From abd4b3453c6fd4b6cc83f13cbc5689e8fae47282 Mon Sep 17 00:00:00 2001 From: "asamuzaK (Kazz)" Date: Sun, 17 May 2026 13:34:38 +0900 Subject: [PATCH] Remove nullObject --- package.json | 17 +- pnpm-lock.yaml | 602 ++++++++++-------------------------- src/js/cache.ts | 26 +- src/js/color.ts | 265 +++++++--------- src/js/convert.ts | 54 ++-- src/js/css-calc.ts | 16 +- src/js/css-gradient.ts | 9 +- src/js/css-var.ts | 26 +- src/js/relative-color.ts | 68 ++-- src/js/resolve.ts | 107 +++---- test/cache.test.ts | 25 +- test/color.test.ts | 164 +++++----- test/convert.test.ts | 24 +- test/css-calc.test.ts | 10 +- test/css-var.test.ts | 6 +- test/relative-color.test.ts | 70 ++--- test/resolve.test.ts | 122 +++++--- test/util.test.ts | 24 +- 18 files changed, 635 insertions(+), 1000 deletions(-) diff --git a/package.json b/package.json index c7525b1..86a5bf8 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "src" ], "type": "module", + "types": "./dist/esm/index.d.ts", "exports": { ".": { "types": "./dist/esm/index.d.ts", @@ -24,29 +25,29 @@ "./package.json": "./package.json" }, "dependencies": { - "@asamuzakjp/generational-cache": "^2.0.1", - "@csstools/css-calc": "^3.2.0", - "@csstools/css-color-parser": "^4.1.0", + "@asamuzakjp/generational-cache": "^2.0.2", + "@csstools/css-calc": "^3.2.1", + "@csstools/css-color-parser": "^4.1.1", "@csstools/css-parser-algorithms": "^4.0.0", "@csstools/css-tokenizer": "^4.0.0" }, "devDependencies": { "@tanstack/vite-config": "^0.5.2", - "@types/node": "^25.7.0", + "@types/node": "^25.8.0", "@vitest/coverage-istanbul": "^4.1.6", "esbuild": "^0.28.0", "eslint": "^9.39.4", "eslint-plugin-regexp": "^3.1.0", "globals": "^17.6.0", - "knip": "^6.13.1", + "knip": "^6.14.0", "mitata": "^1.0.34", "neostandard": "^0.13.0", "prettier": "^3.8.3", - "publint": "^0.3.20", + "publint": "^0.3.21", "rimraf": "^6.1.3", - "tsx": "^4.21.0", + "tsx": "^4.22.0", "typescript": "^5.9.3", - "vite": "^8.0.12", + "vite": "^8.0.13", "vitest": "^4.1.6" }, "packageManager": "pnpm@10.33.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3c81c0d..4adfe7e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -22,14 +22,14 @@ importers: .: dependencies: '@asamuzakjp/generational-cache': - specifier: ^2.0.1 - version: 2.0.1 + specifier: ^2.0.2 + version: 2.0.2 '@csstools/css-calc': - specifier: ^3.2.0 - version: 3.2.0(@csstools/css-parser-algorithms@4.0.0(@csstools/css-tokenizer@4.0.0))(@csstools/css-tokenizer@4.0.0) + specifier: ^3.2.1 + version: 3.2.1(@csstools/css-parser-algorithms@4.0.0(@csstools/css-tokenizer@4.0.0))(@csstools/css-tokenizer@4.0.0) '@csstools/css-color-parser': - specifier: ^4.1.0 - version: 4.1.0(@csstools/css-parser-algorithms@4.0.0(@csstools/css-tokenizer@4.0.0))(@csstools/css-tokenizer@4.0.0) + specifier: ^4.1.1 + version: 4.1.1(@csstools/css-parser-algorithms@4.0.0(@csstools/css-tokenizer@4.0.0))(@csstools/css-tokenizer@4.0.0) '@csstools/css-parser-algorithms': specifier: ^4.0.0 version: 4.0.0(@csstools/css-tokenizer@4.0.0) @@ -39,10 +39,10 @@ importers: devDependencies: '@tanstack/vite-config': specifier: ^0.5.2 - version: 0.5.2(@types/node@25.7.0)(rollup@4.60.1)(typescript@5.9.3)(vite@8.0.12(@types/node@25.7.0)(esbuild@0.28.0)(jiti@2.7.0)(tsx@4.21.0)(yaml@2.9.0)) + version: 0.5.2(@types/node@25.8.0)(rollup@4.60.1)(typescript@5.9.3)(vite@8.0.13(@types/node@25.8.0)(esbuild@0.28.0)(jiti@2.7.0)(tsx@4.22.0)(yaml@2.9.0)) '@types/node': - specifier: ^25.7.0 - version: 25.7.0 + specifier: ^25.8.0 + version: 25.8.0 '@vitest/coverage-istanbul': specifier: ^4.1.6 version: 4.1.6(vitest@4.1.6) @@ -59,8 +59,8 @@ importers: specifier: ^17.6.0 version: 17.6.0 knip: - specifier: ^6.13.1 - version: 6.13.1(@emnapi/core@1.10.0)(@emnapi/runtime@1.10.0) + specifier: ^6.14.0 + version: 6.14.0(@emnapi/core@1.10.0)(@emnapi/runtime@1.10.0) mitata: specifier: ^1.0.34 version: 1.0.34 @@ -71,28 +71,28 @@ importers: specifier: ^3.8.3 version: 3.8.3 publint: - specifier: ^0.3.20 - version: 0.3.20 + specifier: ^0.3.21 + version: 0.3.21 rimraf: specifier: ^6.1.3 version: 6.1.3 tsx: - specifier: ^4.21.0 - version: 4.21.0 + specifier: ^4.22.0 + version: 4.22.0 typescript: specifier: ^5.9.3 version: 5.9.3 vite: - specifier: ^8.0.12 - version: 8.0.12(@types/node@25.7.0)(esbuild@0.28.0)(jiti@2.7.0)(tsx@4.21.0)(yaml@2.9.0) + specifier: ^8.0.13 + version: 8.0.13(@types/node@25.8.0)(esbuild@0.28.0)(jiti@2.7.0)(tsx@4.22.0)(yaml@2.9.0) vitest: specifier: ^4.1.6 - version: 4.1.6(@types/node@25.7.0)(@vitest/coverage-istanbul@4.1.6)(vite@8.0.12(@types/node@25.7.0)(esbuild@0.28.0)(jiti@2.7.0)(tsx@4.21.0)(yaml@2.9.0)) + version: 4.1.6(@types/node@25.8.0)(@vitest/coverage-istanbul@4.1.6)(vite@8.0.13(@types/node@25.8.0)(esbuild@0.28.0)(jiti@2.7.0)(tsx@4.22.0)(yaml@2.9.0)) packages: - '@asamuzakjp/generational-cache@2.0.1': - resolution: {integrity: sha512-O06obS7ehFd/gLFUjQaH7bh8c5BQKjCBNAI6MSl6U1dDTRXV/RCJPp4Z4hsdZl3XF3RBRkz81/kW72gz2Cz8YA==} + '@asamuzakjp/generational-cache@2.0.2': + resolution: {integrity: sha512-JBnb/PiTVA29RjgrSNWFEaHFex5BzKxHJZr3Ce4DtFBn/qB0xGoZ+6d9doAOi7iz9SXCq13qPBxiuaJDdlcAOg==} engines: {node: ^22.13.0 || >=24.0.0} '@babel/code-frame@7.29.0': @@ -166,15 +166,15 @@ packages: resolution: {integrity: sha512-LMGQLS9EuADloEFkcTBR3BwV/CGHV7zyDxVRtVDTwdI2Ca4it0CCVTT9wCkxSgokjE5Ho41hEPgb8OEUwoXr6Q==} engines: {node: '>=20.19.0'} - '@csstools/css-calc@3.2.0': - resolution: {integrity: sha512-bR9e6o2BDB12jzN/gIbjHa5wLJ4UjD1CB9pM7ehlc0ddk6EBz+yYS1EV2MF55/HUxrHcB/hehAyt5vhsA3hx7w==} + '@csstools/css-calc@3.2.1': + resolution: {integrity: sha512-DtdHlgXh5ZkA43cwBcAm+huzgJiwx3ZTWVjBs94kwz2xKqSimDA3lBgCjphYgwgVUMWatSM0pDd8TILB1yrVVg==} engines: {node: '>=20.19.0'} peerDependencies: '@csstools/css-parser-algorithms': ^4.0.0 '@csstools/css-tokenizer': ^4.0.0 - '@csstools/css-color-parser@4.1.0': - resolution: {integrity: sha512-U0KhLYmy2GVj6q4T3WaAe6NPuFYCPQoE3b0dRGxejWDgcPp8TP7S5rVdM5ZrFaqu4N67X8YaPBw14dQSYx3IyQ==} + '@csstools/css-color-parser@4.1.1': + resolution: {integrity: sha512-eZ5XOtyhK+mggRafYUWzA0tvaYOFgdY8AkgQiCJF9qNAePnUo/zmsqqYubBBb3sQ8uNUaSKTY9s9klfRaAXL0g==} engines: {node: '>=20.19.0'} peerDependencies: '@csstools/css-parser-algorithms': ^4.0.0 @@ -199,312 +199,156 @@ packages: '@emnapi/wasi-threads@1.2.1': resolution: {integrity: sha512-uTII7OYF+/Mes/MrcIOYp5yOtSMLBWSIoLPpcgwipoiKbli6k322tcoFsxoIIxPDqW01SQGAgko4EzZi2BNv2w==} - '@esbuild/aix-ppc64@0.27.7': - resolution: {integrity: sha512-EKX3Qwmhz1eMdEJokhALr0YiD0lhQNwDqkPYyPhiSwKrh7/4KRjQc04sZ8db+5DVVnZ1LmbNDI1uAMPEUBnQPg==} - engines: {node: '>=18'} - cpu: [ppc64] - os: [aix] - '@esbuild/aix-ppc64@0.28.0': resolution: {integrity: sha512-lhRUCeuOyJQURhTxl4WkpFTjIsbDayJHih5kZC1giwE+MhIzAb7mEsQMqMf18rHLsrb5qI1tafG20mLxEWcWlA==} engines: {node: '>=18'} cpu: [ppc64] os: [aix] - '@esbuild/android-arm64@0.27.7': - resolution: {integrity: sha512-62dPZHpIXzvChfvfLJow3q5dDtiNMkwiRzPylSCfriLvZeq0a1bWChrGx/BbUbPwOrsWKMn8idSllklzBy+dgQ==} - engines: {node: '>=18'} - cpu: [arm64] - os: [android] - '@esbuild/android-arm64@0.28.0': resolution: {integrity: sha512-+WzIXQOSaGs33tLEgYPYe/yQHf0WTU0X42Jca3y8NWMbUVhp7rUnw+vAsRC/QiDrdD31IszMrZy+qwPOPjd+rw==} engines: {node: '>=18'} cpu: [arm64] os: [android] - '@esbuild/android-arm@0.27.7': - resolution: {integrity: sha512-jbPXvB4Yj2yBV7HUfE2KHe4GJX51QplCN1pGbYjvsyCZbQmies29EoJbkEc+vYuU5o45AfQn37vZlyXy4YJ8RQ==} - engines: {node: '>=18'} - cpu: [arm] - os: [android] - '@esbuild/android-arm@0.28.0': resolution: {integrity: sha512-wqh0ByljabXLKHeWXYLqoJ5jKC4XBaw6Hk08OfMrCRd2nP2ZQ5eleDZC41XHyCNgktBGYMbqnrJKq/K/lzPMSQ==} engines: {node: '>=18'} cpu: [arm] os: [android] - '@esbuild/android-x64@0.27.7': - resolution: {integrity: sha512-x5VpMODneVDb70PYV2VQOmIUUiBtY3D3mPBG8NxVk5CogneYhkR7MmM3yR/uMdITLrC1ml/NV1rj4bMJuy9MCg==} - engines: {node: '>=18'} - cpu: [x64] - os: [android] - '@esbuild/android-x64@0.28.0': resolution: {integrity: sha512-+VJggoaKhk2VNNqVL7f6S189UzShHC/mR9EE8rDdSkdpN0KflSwWY/gWjDrNxxisg8Fp1ZCD9jLMo4m0OUfeUA==} engines: {node: '>=18'} cpu: [x64] os: [android] - '@esbuild/darwin-arm64@0.27.7': - resolution: {integrity: sha512-5lckdqeuBPlKUwvoCXIgI2D9/ABmPq3Rdp7IfL70393YgaASt7tbju3Ac+ePVi3KDH6N2RqePfHnXkaDtY9fkw==} - engines: {node: '>=18'} - cpu: [arm64] - os: [darwin] - '@esbuild/darwin-arm64@0.28.0': resolution: {integrity: sha512-0T+A9WZm+bZ84nZBtk1ckYsOvyA3x7e2Acj1KdVfV4/2tdG4fzUp91YHx+GArWLtwqp77pBXVCPn2We7Letr0Q==} engines: {node: '>=18'} cpu: [arm64] os: [darwin] - '@esbuild/darwin-x64@0.27.7': - resolution: {integrity: sha512-rYnXrKcXuT7Z+WL5K980jVFdvVKhCHhUwid+dDYQpH+qu+TefcomiMAJpIiC2EM3Rjtq0sO3StMV/+3w3MyyqQ==} - engines: {node: '>=18'} - cpu: [x64] - os: [darwin] - '@esbuild/darwin-x64@0.28.0': resolution: {integrity: sha512-fyzLm/DLDl/84OCfp2f/XQ4flmORsjU7VKt8HLjvIXChJoFFOIL6pLJPH4Yhd1n1gGFF9mPwtlN5Wf82DZs+LQ==} engines: {node: '>=18'} cpu: [x64] os: [darwin] - '@esbuild/freebsd-arm64@0.27.7': - resolution: {integrity: sha512-B48PqeCsEgOtzME2GbNM2roU29AMTuOIN91dsMO30t+Ydis3z/3Ngoj5hhnsOSSwNzS+6JppqWsuhTp6E82l2w==} - engines: {node: '>=18'} - cpu: [arm64] - os: [freebsd] - '@esbuild/freebsd-arm64@0.28.0': resolution: {integrity: sha512-l9GeW5UZBT9k9brBYI+0WDffcRxgHQD8ShN2Ur4xWq/NFzUKm3k5lsH4PdaRgb2w7mI9u61nr2gI2mLI27Nh3Q==} engines: {node: '>=18'} cpu: [arm64] os: [freebsd] - '@esbuild/freebsd-x64@0.27.7': - resolution: {integrity: sha512-jOBDK5XEjA4m5IJK3bpAQF9/Lelu/Z9ZcdhTRLf4cajlB+8VEhFFRjWgfy3M1O4rO2GQ/b2dLwCUGpiF/eATNQ==} - engines: {node: '>=18'} - cpu: [x64] - os: [freebsd] - '@esbuild/freebsd-x64@0.28.0': resolution: {integrity: sha512-BXoQai/A0wPO6Es3yFJ7APCiKGc1tdAEOgeTNy3SsB491S3aHn4S4r3e976eUnPdU+NbdtmBuLncYir2tMU9Nw==} engines: {node: '>=18'} cpu: [x64] os: [freebsd] - '@esbuild/linux-arm64@0.27.7': - resolution: {integrity: sha512-RZPHBoxXuNnPQO9rvjh5jdkRmVizktkT7TCDkDmQ0W2SwHInKCAV95GRuvdSvA7w4VMwfCjUiPwDi0ZO6Nfe9A==} - engines: {node: '>=18'} - cpu: [arm64] - os: [linux] - '@esbuild/linux-arm64@0.28.0': resolution: {integrity: sha512-RVyzfb3FWsGA55n6WY0MEIEPURL1FcbhFE6BffZEMEekfCzCIMtB5yyDcFnVbTnwk+CLAgTujmV/Lgvih56W+A==} engines: {node: '>=18'} cpu: [arm64] os: [linux] - '@esbuild/linux-arm@0.27.7': - resolution: {integrity: sha512-RkT/YXYBTSULo3+af8Ib0ykH8u2MBh57o7q/DAs3lTJlyVQkgQvlrPTnjIzzRPQyavxtPtfg0EopvDyIt0j1rA==} - engines: {node: '>=18'} - cpu: [arm] - os: [linux] - '@esbuild/linux-arm@0.28.0': resolution: {integrity: sha512-CjaaREJagqJp7iTaNQjjidaNbCKYcd4IDkzbwwxtSvjI7NZm79qiHc8HqciMddQ6CKvJT6aBd8lO9kN/ZudLlw==} engines: {node: '>=18'} cpu: [arm] os: [linux] - '@esbuild/linux-ia32@0.27.7': - resolution: {integrity: sha512-GA48aKNkyQDbd3KtkplYWT102C5sn/EZTY4XROkxONgruHPU72l+gW+FfF8tf2cFjeHaRbWpOYa/uRBz/Xq1Pg==} - engines: {node: '>=18'} - cpu: [ia32] - os: [linux] - '@esbuild/linux-ia32@0.28.0': resolution: {integrity: sha512-KBnSTt1kxl9x70q+ydterVdl+Cn0H18ngRMRCEQfrbqdUuntQQ0LoMZv47uB97NljZFzY6HcfqEZ2SAyIUTQBQ==} engines: {node: '>=18'} cpu: [ia32] os: [linux] - '@esbuild/linux-loong64@0.27.7': - resolution: {integrity: sha512-a4POruNM2oWsD4WKvBSEKGIiWQF8fZOAsycHOt6JBpZ+JN2n2JH9WAv56SOyu9X5IqAjqSIPTaJkqN8F7XOQ5Q==} - engines: {node: '>=18'} - cpu: [loong64] - os: [linux] - '@esbuild/linux-loong64@0.28.0': resolution: {integrity: sha512-zpSlUce1mnxzgBADvxKXX5sl8aYQHo2ezvMNI8I0lbblJtp8V4odlm3Yzlj7gPyt3T8ReksE6bK+pT3WD+aJRg==} engines: {node: '>=18'} cpu: [loong64] os: [linux] - '@esbuild/linux-mips64el@0.27.7': - resolution: {integrity: sha512-KabT5I6StirGfIz0FMgl1I+R1H73Gp0ofL9A3nG3i/cYFJzKHhouBV5VWK1CSgKvVaG4q1RNpCTR2LuTVB3fIw==} - engines: {node: '>=18'} - cpu: [mips64el] - os: [linux] - '@esbuild/linux-mips64el@0.28.0': resolution: {integrity: sha512-2jIfP6mmjkdmeTlsX/9vmdmhBmKADrWqN7zcdtHIeNSCH1SqIoNI63cYsjQR8J+wGa4Y5izRcSHSm8K3QWmk3w==} engines: {node: '>=18'} cpu: [mips64el] os: [linux] - '@esbuild/linux-ppc64@0.27.7': - resolution: {integrity: sha512-gRsL4x6wsGHGRqhtI+ifpN/vpOFTQtnbsupUF5R5YTAg+y/lKelYR1hXbnBdzDjGbMYjVJLJTd2OFmMewAgwlQ==} - engines: {node: '>=18'} - cpu: [ppc64] - os: [linux] - '@esbuild/linux-ppc64@0.28.0': resolution: {integrity: sha512-bc0FE9wWeC0WBm49IQMPSPILRocGTQt3j5KPCA8os6VprfuJ7KD+5PzESSrJ6GmPIPJK965ZJHTUlSA6GNYEhg==} engines: {node: '>=18'} cpu: [ppc64] os: [linux] - '@esbuild/linux-riscv64@0.27.7': - resolution: {integrity: sha512-hL25LbxO1QOngGzu2U5xeXtxXcW+/GvMN3ejANqXkxZ/opySAZMrc+9LY/WyjAan41unrR3YrmtTsUpwT66InQ==} - engines: {node: '>=18'} - cpu: [riscv64] - os: [linux] - '@esbuild/linux-riscv64@0.28.0': resolution: {integrity: sha512-SQPZOwoTTT/HXFXQJG/vBX8sOFagGqvZyXcgLA3NhIqcBv1BJU1d46c0rGcrij2B56Z2rNiSLaZOYW5cUk7yLQ==} engines: {node: '>=18'} cpu: [riscv64] os: [linux] - '@esbuild/linux-s390x@0.27.7': - resolution: {integrity: sha512-2k8go8Ycu1Kb46vEelhu1vqEP+UeRVj2zY1pSuPdgvbd5ykAw82Lrro28vXUrRmzEsUV0NzCf54yARIK8r0fdw==} - engines: {node: '>=18'} - cpu: [s390x] - os: [linux] - '@esbuild/linux-s390x@0.28.0': resolution: {integrity: sha512-SCfR0HN8CEEjnYnySJTd2cw0k9OHB/YFzt5zgJEwa+wL/T/raGWYMBqwDNAC6dqFKmJYZoQBRfHjgwLHGSrn3Q==} engines: {node: '>=18'} cpu: [s390x] os: [linux] - '@esbuild/linux-x64@0.27.7': - resolution: {integrity: sha512-hzznmADPt+OmsYzw1EE33ccA+HPdIqiCRq7cQeL1Jlq2gb1+OyWBkMCrYGBJ+sxVzve2ZJEVeePbLM2iEIZSxA==} - engines: {node: '>=18'} - cpu: [x64] - os: [linux] - '@esbuild/linux-x64@0.28.0': resolution: {integrity: sha512-us0dSb9iFxIi8srnpl931Nvs65it/Jd2a2K3qs7fz2WfGPHqzfzZTfec7oxZJRNPXPnNYZtanmRc4AL/JwVzHQ==} engines: {node: '>=18'} cpu: [x64] os: [linux] - '@esbuild/netbsd-arm64@0.27.7': - resolution: {integrity: sha512-b6pqtrQdigZBwZxAn1UpazEisvwaIDvdbMbmrly7cDTMFnw/+3lVxxCTGOrkPVnsYIosJJXAsILG9XcQS+Yu6w==} - engines: {node: '>=18'} - cpu: [arm64] - os: [netbsd] - '@esbuild/netbsd-arm64@0.28.0': resolution: {integrity: sha512-CR/RYotgtCKwtftMwJlUU7xCVNg3lMYZ0RzTmAHSfLCXw3NtZtNpswLEj/Kkf6kEL3Gw+BpOekRX0BYCtklhUw==} engines: {node: '>=18'} cpu: [arm64] os: [netbsd] - '@esbuild/netbsd-x64@0.27.7': - resolution: {integrity: sha512-OfatkLojr6U+WN5EDYuoQhtM+1xco+/6FSzJJnuWiUw5eVcicbyK3dq5EeV/QHT1uy6GoDhGbFpprUiHUYggrw==} - engines: {node: '>=18'} - cpu: [x64] - os: [netbsd] - '@esbuild/netbsd-x64@0.28.0': resolution: {integrity: sha512-nU1yhmYutL+fQ71Kxnhg8uEOdC0pwEW9entHykTgEbna2pw2dkbFSMeqjjyHZoCmt8SBkOSvV+yNmm94aUrrqw==} engines: {node: '>=18'} cpu: [x64] os: [netbsd] - '@esbuild/openbsd-arm64@0.27.7': - resolution: {integrity: sha512-AFuojMQTxAz75Fo8idVcqoQWEHIXFRbOc1TrVcFSgCZtQfSdc1RXgB3tjOn/krRHENUB4j00bfGjyl2mJrU37A==} - engines: {node: '>=18'} - cpu: [arm64] - os: [openbsd] - '@esbuild/openbsd-arm64@0.28.0': resolution: {integrity: sha512-cXb5vApOsRsxsEl4mcZ1XY3D4DzcoMxR/nnc4IyqYs0rTI8ZKmW6kyyg+11Z8yvgMfAEldKzP7AdP64HnSC/6g==} engines: {node: '>=18'} cpu: [arm64] os: [openbsd] - '@esbuild/openbsd-x64@0.27.7': - resolution: {integrity: sha512-+A1NJmfM8WNDv5CLVQYJ5PshuRm/4cI6WMZRg1by1GwPIQPCTs1GLEUHwiiQGT5zDdyLiRM/l1G0Pv54gvtKIg==} - engines: {node: '>=18'} - cpu: [x64] - os: [openbsd] - '@esbuild/openbsd-x64@0.28.0': resolution: {integrity: sha512-8wZM2qqtv9UP3mzy7HiGYNH/zjTA355mpeuA+859TyR+e+Tc08IHYpLJuMsfpDJwoLo1ikIJI8jC3GFjnRClzA==} engines: {node: '>=18'} cpu: [x64] os: [openbsd] - '@esbuild/openharmony-arm64@0.27.7': - resolution: {integrity: sha512-+KrvYb/C8zA9CU/g0sR6w2RBw7IGc5J2BPnc3dYc5VJxHCSF1yNMxTV5LQ7GuKteQXZtspjFbiuW5/dOj7H4Yw==} - engines: {node: '>=18'} - cpu: [arm64] - os: [openharmony] - '@esbuild/openharmony-arm64@0.28.0': resolution: {integrity: sha512-FLGfyizszcef5C3YtoyQDACyg95+dndv79i2EekILBofh5wpCa1KuBqOWKrEHZg3zrL3t5ouE5jgr94vA+Wb2w==} engines: {node: '>=18'} cpu: [arm64] os: [openharmony] - '@esbuild/sunos-x64@0.27.7': - resolution: {integrity: sha512-ikktIhFBzQNt/QDyOL580ti9+5mL/YZeUPKU2ivGtGjdTYoqz6jObj6nOMfhASpS4GU4Q/Clh1QtxWAvcYKamA==} - engines: {node: '>=18'} - cpu: [x64] - os: [sunos] - '@esbuild/sunos-x64@0.28.0': resolution: {integrity: sha512-1ZgjUoEdHZZl/YlV76TSCz9Hqj9h9YmMGAgAPYd+q4SicWNX3G5GCyx9uhQWSLcbvPW8Ni7lj4gDa1T40akdlw==} engines: {node: '>=18'} cpu: [x64] os: [sunos] - '@esbuild/win32-arm64@0.27.7': - resolution: {integrity: sha512-7yRhbHvPqSpRUV7Q20VuDwbjW5kIMwTHpptuUzV+AA46kiPze5Z7qgt6CLCK3pWFrHeNfDd1VKgyP4O+ng17CA==} - engines: {node: '>=18'} - cpu: [arm64] - os: [win32] - '@esbuild/win32-arm64@0.28.0': resolution: {integrity: sha512-Q9StnDmQ/enxnpxCCLSg0oo4+34B9TdXpuyPeTedN/6+iXBJ4J+zwfQI28u/Jl40nOYAxGoNi7mFP40RUtkmUA==} engines: {node: '>=18'} cpu: [arm64] os: [win32] - '@esbuild/win32-ia32@0.27.7': - resolution: {integrity: sha512-SmwKXe6VHIyZYbBLJrhOoCJRB/Z1tckzmgTLfFYOfpMAx63BJEaL9ExI8x7v0oAO3Zh6D/Oi1gVxEYr5oUCFhw==} - engines: {node: '>=18'} - cpu: [ia32] - os: [win32] - '@esbuild/win32-ia32@0.28.0': resolution: {integrity: sha512-zF3ag/gfiCe6U2iczcRzSYJKH1DCI+ByzSENHlM2FcDbEeo5Zd2C86Aq0tKUYAJJ1obRP84ymxIAksZUcdztHA==} engines: {node: '>=18'} cpu: [ia32] os: [win32] - '@esbuild/win32-x64@0.27.7': - resolution: {integrity: sha512-56hiAJPhwQ1R4i+21FVF7V8kSD5zZTdHcVuRFMW0hn753vVfQN8xlx4uOPT4xoGH0Z/oVATuR82AiqSTDIpaHg==} - engines: {node: '>=18'} - cpu: [x64] - os: [win32] - '@esbuild/win32-x64@0.28.0': resolution: {integrity: sha512-pEl1bO9mfAmIC+tW5btTmrKaujg3zGtUmWNdCw/xs70FBjwAL3o9OEKNHvNmnyylD6ubxUERiEhdsL0xBQ9efw==} engines: {node: '>=18'} @@ -738,9 +582,6 @@ packages: cpu: [x64] os: [win32] - '@oxc-project/types@0.129.0': - resolution: {integrity: sha512-3oz8m3FGdr2nDXVqmFUw7jolKliC4MoyXYIG2c7gpjBnzUWQpUGIYcXYKxTdTi+N2jusvt610ckTMkxdwHkYEg==} - '@oxc-project/types@0.130.0': resolution: {integrity: sha512-ibD2usx9JRu7f5pu2tMKMI4cpA4NgXJQoYRP4pQ7Pxmn1l6k/53qWtQWZayhYy3X4QZkt90Ot+mJEaeXouio6Q==} @@ -856,103 +697,103 @@ packages: resolution: {integrity: sha512-HDVTWq3H0uTXiU0eeSQntcVUTPP3GamzeXI41+x7uU9J65JgWQh3qWZHblR1i0npXfFtF+mxBiU2nJH8znxWnQ==} engines: {node: '>=18'} - '@rolldown/binding-android-arm64@1.0.0': - resolution: {integrity: sha512-TWMZnRLMe63C2Lhyicviu7ZHaU4kxa6PS3rofvc9GmcvptzNN11BcfQ4Sl7MwTOsisQoa2keB/EBdNCAnUo8vA==} + '@rolldown/binding-android-arm64@1.0.1': + resolution: {integrity: sha512-fJI3I0r3C3Oj/zdBCpaCmBRZYf07xpaq4yCfDDoSFm+beWNzbIl26puW8RraUdugoJw/95zerNOn6jasAhzSmg==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [android] - '@rolldown/binding-darwin-arm64@1.0.0': - resolution: {integrity: sha512-6XcD+8k0gPVItNagEw78/qqcBDwKcwDYS8V2hRmVsfUSIrd8cWe/CBvRDI5toqFyPfj+FJr6t8U6Xj2P2prEew==} + '@rolldown/binding-darwin-arm64@1.0.1': + resolution: {integrity: sha512-cKnAhWEsV7TPcA/5EAteDp6KcJZBQ2G+BqE7zayMMi7kMvwRsbv7WT9aOnn0WNl4SKEIf43vjS31iUPu80nzXg==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [darwin] - '@rolldown/binding-darwin-x64@1.0.0': - resolution: {integrity: sha512-iN/tWVXRQDWvmZlKdceP1Dwug9GDpEymhb9p4xnEe6zvCg5lFmzVljl+1qR1NVx3yfGpr2Na+CuLmv5IU8uzfQ==} + '@rolldown/binding-darwin-x64@1.0.1': + resolution: {integrity: sha512-YKrVwQjIRBPo+5G/u03wGjbdy4q7pyzCe93DK9VJ7zkVmeg8LJ7GbgsiHWdR4xSoe4CAXRD7Bcjgbtr64bkXNg==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [darwin] - '@rolldown/binding-freebsd-x64@1.0.0': - resolution: {integrity: sha512-jjQMDvvwSOuhOwMszD/klSOjyWMM3zI64hWTj9KT5x4MxRbZAf+7vLQ6qouRhtsLVFHr3f0ILaJAfgENPiQdAQ==} + '@rolldown/binding-freebsd-x64@1.0.1': + resolution: {integrity: sha512-z/oBsREo46SsFqBwYtFe0kpJeBijAT48O/WXLI4suiCLBkr03RTtTJMCzSdDd2znlh8VJizL09XVkQgk8IZonw==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [freebsd] - '@rolldown/binding-linux-arm-gnueabihf@1.0.0': - resolution: {integrity: sha512-d//Dtg2x6/m3mbV64yUGNnDGNZaDGRpDLLNGerHQUVObuNaIQaaDp25yUiqGXtHEXX+NP2d0wAlmKgpYgIAJ2A==} + '@rolldown/binding-linux-arm-gnueabihf@1.0.1': + resolution: {integrity: sha512-ik8q7GM11zxvYxFc2PeDcT6TBvhCQMaUxfph/M5l9sKuTs/Sjg3L+Byw0F7w0ZVLBZmx30P+gG0ECzzN+MFcmQ==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm] os: [linux] - '@rolldown/binding-linux-arm64-gnu@1.0.0': - resolution: {integrity: sha512-n7Ofp0mx+aB2cC+Sdy5YtMnXtY9lchnHbY+3Yt0uq9JsWQExf4f5Whu0tK0R8Jdc9S6RchTHjIFY7uc92puOVQ==} + '@rolldown/binding-linux-arm64-gnu@1.0.1': + resolution: {integrity: sha512-QoSx2EkyrrdZ6kcyE8stqZ62t0Yra8Fs5ia9lOxJrh6TMQJK7gQKmscdTHf7pOXKREKrVwOtJcQG3qVSfc866A==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [linux] libc: [glibc] - '@rolldown/binding-linux-arm64-musl@1.0.0': - resolution: {integrity: sha512-EIVjy2cgd7uuMMo94FVkBp7F6DhcZAUwNURkSG3RwUmvAXR6s0ISxM81U+IydcZByPG0pZIHsf1b6kTxoFDgJA==} + '@rolldown/binding-linux-arm64-musl@1.0.1': + resolution: {integrity: sha512-uwNwFpwKeNiZawfAWBgg0VIztPTV3ihhh1vV334h9ivnNLorxnQMU6Fz8wG1Zb4Qh9LC1/MkcyT3YlDXG3Rsgg==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [linux] libc: [musl] - '@rolldown/binding-linux-ppc64-gnu@1.0.0': - resolution: {integrity: sha512-JEwwOPcwTLAcpDQlqSmjEmfs63xJnSiUNIGvLcDLUHCWK4XowpS/7c7tUsUH6uT/ct6bMUTdXKfI8967FYj6mg==} + '@rolldown/binding-linux-ppc64-gnu@1.0.1': + resolution: {integrity: sha512-zY1bul7OWr7DFBiJ++wofXvnr8B45ce3QsQUhKrIhXsygAh7bTkwyeM1bi1a2g5C/yC/N8TZyGDEoMfm/l9mpg==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [ppc64] os: [linux] libc: [glibc] - '@rolldown/binding-linux-s390x-gnu@1.0.0': - resolution: {integrity: sha512-0wjCFhLrihtAubnT9iA0N++0pSV0z5Hg7tNGdNJ4RFaINceHadoF+kiFGyY1qSSNVIAZtLotG8Ju1bgDPkjnFA==} + '@rolldown/binding-linux-s390x-gnu@1.0.1': + resolution: {integrity: sha512-0frlsT/f4Ft6I7SMESTKnF3cZsdicQn1dCMkF/jT9wDLE+gGoiQfv1nmT9e+s7s/fekvvy6tZM2jHvI2tkbJDQ==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [s390x] os: [linux] libc: [glibc] - '@rolldown/binding-linux-x64-gnu@1.0.0': - resolution: {integrity: sha512-Dfn7iak9BcMMePxcoJfpSbWqnEyrp/dRF63/8qW/eHBdOZov6x5aShLLEYGYdIeSJ6vMLK/XCVB+lGIxm41bQA==} + '@rolldown/binding-linux-x64-gnu@1.0.1': + resolution: {integrity: sha512-XABVmGp9Tg0WspTVvwduTc4fpqy6JnAUrSQe6OuyqD/03nI7r0O9OWUkMIwFrjKAIqolvqoA4ZrJppgwE0Gxmw==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [linux] libc: [glibc] - '@rolldown/binding-linux-x64-musl@1.0.0': - resolution: {integrity: sha512-5/utzzDmD/pD/bmuaUcbTf/sZYy0aztwIVlfpoW1fTjCZ0BaPOMVWGZL1zvgxyi7ZIVYWlxKONHmSbHuiOh8Jw==} + '@rolldown/binding-linux-x64-musl@1.0.1': + resolution: {integrity: sha512-bV4fzswuzVcKD90o/VM6QqKxnxlDq0g2BISDLNVmxrnhpv1DDbyPhCIjYfvzYLV+MvkKKnQt2Q6AO86SEBULUQ==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [linux] libc: [musl] - '@rolldown/binding-openharmony-arm64@1.0.0': - resolution: {integrity: sha512-ouJs8VcUomfLfpbUECqFMRqdV4x6aeAK3MA4m6vTrJJjKyWTV5KnxZx7Jd9G+GlDaQQxubcba00x16OyJ1meig==} + '@rolldown/binding-openharmony-arm64@1.0.1': + resolution: {integrity: sha512-/Mh0Zhq3OP7fVs0kcQHZP6lZEthMGTaSf8UBQYSFEZDWGXXlEC+nJ6EqenaK2t4LBXMe3A+K/G2BVXXdtOr4PQ==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [openharmony] - '@rolldown/binding-wasm32-wasi@1.0.0': - resolution: {integrity: sha512-E+oHKGiDA+lsKMmFtffDDw91EryDT7uJocrIuCHqhm6bCTM6xFK+3gaCkYOHfPwQr0cCNarSM2xaELoQDz9jJg==} + '@rolldown/binding-wasm32-wasi@1.0.1': + resolution: {integrity: sha512-+1xc9X45l8ufsBAm6Gjvx2qDRIY9lTVt0cgWNcJ+1gdhXvkbxePA60yRTwSTuXL09CMhyJmjpV7E3NoyxbqFQQ==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [wasm32] - '@rolldown/binding-win32-arm64-msvc@1.0.0': - resolution: {integrity: sha512-yYK02n8Rngo+gbm1y6G0+7jk1sJ/2Wt7K0me0Y7k/ErBpyf+LJ2gFpqWVTcRV1rUepBlQRmpgWkTQCiiwrK0Ow==} + '@rolldown/binding-win32-arm64-msvc@1.0.1': + resolution: {integrity: sha512-1D+UqZdfnuR+Jy1GgMJwi85bD40H21uNmOPRWQhw4oRSuolZ/B5rixZ45DK2KXOTCvmVCecauWgEhbw8bI7tOw==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [win32] - '@rolldown/binding-win32-x64-msvc@1.0.0': - resolution: {integrity: sha512-14bpChMahXRRXiTwahSl+zzHPW6qQTXtkMuJBFlbo+pqSAews2d4BdCSHfrJ/MBsCZtpmTafsY+1QhBzitcmdg==} + '@rolldown/binding-win32-x64-msvc@1.0.1': + resolution: {integrity: sha512-INAycaWuhlOK3wk4mRHGsdgwYWmd9cChdPdE9bwWmy6rn9VqVNYNFGhOdXrofXUxwHIncSiPNb8tNm8knDVIeQ==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [win32] - '@rolldown/pluginutils@1.0.0': - resolution: {integrity: sha512-aKs/3GSWyV0mrhNmt/96/Z3yczC3yvrzYATCiCXQebBsGyYzjNdUphRVLeJQ67ySKVXRfMxt2lm12pmXvbPFQQ==} + '@rolldown/pluginutils@1.0.1': + resolution: {integrity: sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==} '@rollup/pluginutils@5.3.0': resolution: {integrity: sha512-5EdhGZtnu3V88ces7s53hhfK5KSASnJZv8Lulpc04cWO3REESroJXg73DFsOmgbU2BhwV0E20bu2IDZb3VKW4Q==} @@ -1159,8 +1000,8 @@ packages: '@types/json-schema@7.0.15': resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} - '@types/node@25.7.0': - resolution: {integrity: sha512-z+pdZyxE+RTQE9AcboAZCb4otwcrvgHD+GlBpPgn0emDVt0ohrTMhAwlr2Wd9nZ+nihhYFxO2pThz3C5qSu2Eg==} + '@types/node@25.8.0': + resolution: {integrity: sha512-TCFSk8IZh+iLX1xtksoBVtdmgL+1IX0fC9BeU4QqFSuNdN/K+HUlhqOzEmSYYpZUVsLYcPqc9KX+60iDuninSQ==} '@typescript-eslint/eslint-plugin@8.59.3': resolution: {integrity: sha512-PwFvSKsXGShKGW6n5bZOhGHEcCZXM8HofLK9fNsEwZXzFRjoY+XT1Vsf1zgyXdwTr0ZYz1/2tkZ0DBTT9jZjhw==} @@ -1485,8 +1326,8 @@ packages: resolution: {integrity: sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==} engines: {node: '>= 0.4'} - electron-to-chromium@1.5.354: - resolution: {integrity: sha512-JaBHwWcfIdmSAfWM5l3uwjGd431j8YEMikZ+K/2nXVuBqJKyZ0f+2h4n4JY5AyNiZmnY9qQr2RU3v9DxDmHMNg==} + electron-to-chromium@1.5.356: + resolution: {integrity: sha512-9NgFd7m5t5MCJ5rUSjJITUXAH9mEGlrlofnMf4YEr+pz6JlP7cWmTAH+JFmbPnaSW8koVTkuW7pacORWAnA5Yw==} enhanced-resolve@5.21.3: resolution: {integrity: sha512-QyL119InA+XXEkNLNTPCXPugSvOfhwv0JOlGNzvxs0hZaiHLNvXSpudUWsOlsXGWJh8G6ckCScEkVHfX3kw/2Q==} @@ -1531,11 +1372,6 @@ packages: resolution: {integrity: sha512-w+5mJ3GuFL+NjVtJlvydShqE1eN3h3PbI7/5LAsYJP/2qtuMXjfL2LpHSRqo4b4eSF5K/DH1JXKUAHSB2UW50g==} engines: {node: '>= 0.4'} - esbuild@0.27.7: - resolution: {integrity: sha512-IxpibTjyVnmrIQo5aqNpCgoACA/dTKLTlhMHihVHhdkxKyPO1uBBthumT0rdHmcsk9uMonIWS0m4FljWzILh3w==} - engines: {node: '>=18'} - hasBin: true - esbuild@0.28.0: resolution: {integrity: sha512-sNR9MHpXSUV/XB4zmsFKN+QgVG82Cc7+/aaxJ8Adi8hyOac+EXptIp45QBPaVyX3N70664wRbTcLTOemCAnyqw==} engines: {node: '>=18'} @@ -1995,8 +1831,8 @@ packages: keyv@4.5.4: resolution: {integrity: sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==} - knip@6.13.1: - resolution: {integrity: sha512-hvSnb+YDpDWW1LXub4U0JFfkQhscwgInWuQOv99WTutPZavf1cEP3GwxzEzO2JJpGI9yATk6l0jPLY1V3fp1sQ==} + knip@6.14.0: + resolution: {integrity: sha512-yEI9ysdGQ3h77gLObvovH0KUYs6ITtJ1f6owmXRalOO32TbolYvHY7Z+2AEOXqw0ZWeh9219/agh2K/GmtfsxQ==} engines: {node: ^20.19.0 || >=22.12.0} hasBin: true @@ -2117,8 +1953,8 @@ packages: magic-string@0.30.21: resolution: {integrity: sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==} - magicast@0.5.2: - resolution: {integrity: sha512-E3ZJh4J3S9KfwdjZhe2afj6R9lGIN5Pher1pF39UGrXRqq/VDaGVIGN13BjHd2u8B61hArAGOnso7nBOouW3TQ==} + magicast@0.5.3: + resolution: {integrity: sha512-pVKE4UdSQ7DvHzivsCIFx2BJn1mHG6KsyrFcaxFx6tONdneEuThrDx0Cj3AMg58KyN4pzYT+LHOotxDQDjNvkw==} make-dir@4.0.0: resolution: {integrity: sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==} @@ -2311,8 +2147,8 @@ packages: prop-types@15.8.1: resolution: {integrity: sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==} - publint@0.3.20: - resolution: {integrity: sha512-UWqFYP7VBVCe9l/leEEGJrDs6Am4K4KapLmLi5qbt+9fA+Ny38ghdW+bw1nYfVqCK8/3kgsxjjhFjTYqYYRpyw==} + publint@0.3.21: + resolution: {integrity: sha512-OqejcnMV6E9zel2oCrUOJEiiFkGiAAni0A6ibfQNh1k9Gu5z4F+Yso8lllam7AzmV6Do0vp7u3UpZNRBwuXaHQ==} engines: {node: '>=18'} hasBin: true @@ -2355,8 +2191,8 @@ packages: engines: {node: '>= 0.4'} hasBin: true - resolve@2.0.0-next.6: - resolution: {integrity: sha512-3JmVl5hMGtJ3kMmB3zi3DL25KfkCEyy3Tw7Gmw7z5w8M9WlwoPFnIvwChzu1+cF3iaK3sp18hhPz8ANeimdJfA==} + resolve@2.0.0-next.7: + resolution: {integrity: sha512-tqt+NBWwyaMgw3zDsnygx4CByWjQEJHOPMdslYhppaQSJUtL/D4JO9CcBBlhPoI8lz9oJIDXkwXfhF4aWqP8xQ==} engines: {node: '>= 0.4'} hasBin: true @@ -2365,8 +2201,8 @@ packages: engines: {node: 20 || >=22} hasBin: true - rolldown@1.0.0: - resolution: {integrity: sha512-yD986aXDESFGS95spT1LAv0jssywP4npMEjmMHyN2/5+eE8qQJUype2AaKkRiLgBgyD0LFlubwAht7VmY8rGoA==} + rolldown@1.0.1: + resolution: {integrity: sha512-X0KQHljNnEkWNqqiz9zJrGunh1B0HgOxLXvnFpCOcadzcy5qohZ3tqMEUg00vncoRovXuK3ZqCT9KnnKzoInFQ==} engines: {node: ^20.19.0 || >=22.12.0} hasBin: true @@ -2559,8 +2395,8 @@ packages: tslib@2.8.1: resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==} - tsx@4.21.0: - resolution: {integrity: sha512-5C1sg4USs1lfG0GFb2RLXsdpXqBSEhAaA/0kPL01wxzpMqLILNxIxIOKiILz+cdg/pLnOUxFYOR5yhHU666wbw==} + tsx@4.22.0: + resolution: {integrity: sha512-8ccZMPD69s1AbKXx0C5ddTNZfNjwV04iIKgjZmKfKxMynEtSYcK0Lh7iQFh53fI5Yu4pb9usgAiqyPmEONaALg==} engines: {node: '>=18.0.0'} hasBin: true @@ -2612,8 +2448,8 @@ packages: resolution: {integrity: sha512-nWJ91DjeOkej/TA8pXQ3myruKpKEYgqvpw9lz4OPHj/NWFNluYrjbz9j01CJ8yKQd2g4jFoOkINCTW2I5LEEyw==} engines: {node: '>= 0.4'} - undici-types@7.21.0: - resolution: {integrity: sha512-w9IMgQrz4O0YN1LtB7K5P63vhlIOvC7opSmouCJ+ZywlPAlO9gIkJ+otk6LvGpAs2wg4econaCz3TvQ9xPoyuQ==} + undici-types@7.24.6: + resolution: {integrity: sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg==} unicorn-magic@0.3.0: resolution: {integrity: sha512-+QBBXBCvifc56fsbuxZQ6Sic3wqqc3WWaqxs58gvJrcOuN83HGTCwz3oS5phzU9LthRNE9VrJCFCLUgHeeFnfA==} @@ -2652,8 +2488,8 @@ packages: peerDependencies: vite: '*' - vite@8.0.12: - resolution: {integrity: sha512-w2dDofOWv2QB09ZITZBsvKTVAlYvPR4IAmrY/v0ir9KvLs0xybR7i48wxhM1/oyBWO34wPns+bPGw5ZrZqDpZg==} + vite@8.0.13: + resolution: {integrity: sha512-MFtjBYgzmSxmgA4RAfjIyXWpGe1oALnjgUTzzV7QLx/TKxCzjtMH6Fd9/eVK+5Fg1qNoz5VAwsmMs/NofrmJvw==} engines: {node: ^20.19.0 || >=22.12.0} hasBin: true peerDependencies: @@ -2797,7 +2633,7 @@ packages: snapshots: - '@asamuzakjp/generational-cache@2.0.1': {} + '@asamuzakjp/generational-cache@2.0.2': {} '@babel/code-frame@7.29.0': dependencies: @@ -2901,15 +2737,15 @@ snapshots: '@csstools/color-helpers@6.0.2': {} - '@csstools/css-calc@3.2.0(@csstools/css-parser-algorithms@4.0.0(@csstools/css-tokenizer@4.0.0))(@csstools/css-tokenizer@4.0.0)': + '@csstools/css-calc@3.2.1(@csstools/css-parser-algorithms@4.0.0(@csstools/css-tokenizer@4.0.0))(@csstools/css-tokenizer@4.0.0)': dependencies: '@csstools/css-parser-algorithms': 4.0.0(@csstools/css-tokenizer@4.0.0) '@csstools/css-tokenizer': 4.0.0 - '@csstools/css-color-parser@4.1.0(@csstools/css-parser-algorithms@4.0.0(@csstools/css-tokenizer@4.0.0))(@csstools/css-tokenizer@4.0.0)': + '@csstools/css-color-parser@4.1.1(@csstools/css-parser-algorithms@4.0.0(@csstools/css-tokenizer@4.0.0))(@csstools/css-tokenizer@4.0.0)': dependencies: '@csstools/color-helpers': 6.0.2 - '@csstools/css-calc': 3.2.0(@csstools/css-parser-algorithms@4.0.0(@csstools/css-tokenizer@4.0.0))(@csstools/css-tokenizer@4.0.0) + '@csstools/css-calc': 3.2.1(@csstools/css-parser-algorithms@4.0.0(@csstools/css-tokenizer@4.0.0))(@csstools/css-tokenizer@4.0.0) '@csstools/css-parser-algorithms': 4.0.0(@csstools/css-tokenizer@4.0.0) '@csstools/css-tokenizer': 4.0.0 @@ -2935,159 +2771,81 @@ snapshots: tslib: 2.8.1 optional: true - '@esbuild/aix-ppc64@0.27.7': - optional: true - '@esbuild/aix-ppc64@0.28.0': optional: true - '@esbuild/android-arm64@0.27.7': - optional: true - '@esbuild/android-arm64@0.28.0': optional: true - '@esbuild/android-arm@0.27.7': - optional: true - '@esbuild/android-arm@0.28.0': optional: true - '@esbuild/android-x64@0.27.7': - optional: true - '@esbuild/android-x64@0.28.0': optional: true - '@esbuild/darwin-arm64@0.27.7': - optional: true - '@esbuild/darwin-arm64@0.28.0': optional: true - '@esbuild/darwin-x64@0.27.7': - optional: true - '@esbuild/darwin-x64@0.28.0': optional: true - '@esbuild/freebsd-arm64@0.27.7': - optional: true - '@esbuild/freebsd-arm64@0.28.0': optional: true - '@esbuild/freebsd-x64@0.27.7': - optional: true - '@esbuild/freebsd-x64@0.28.0': optional: true - '@esbuild/linux-arm64@0.27.7': - optional: true - '@esbuild/linux-arm64@0.28.0': optional: true - '@esbuild/linux-arm@0.27.7': - optional: true - '@esbuild/linux-arm@0.28.0': optional: true - '@esbuild/linux-ia32@0.27.7': - optional: true - '@esbuild/linux-ia32@0.28.0': optional: true - '@esbuild/linux-loong64@0.27.7': - optional: true - '@esbuild/linux-loong64@0.28.0': optional: true - '@esbuild/linux-mips64el@0.27.7': - optional: true - '@esbuild/linux-mips64el@0.28.0': optional: true - '@esbuild/linux-ppc64@0.27.7': - optional: true - '@esbuild/linux-ppc64@0.28.0': optional: true - '@esbuild/linux-riscv64@0.27.7': - optional: true - '@esbuild/linux-riscv64@0.28.0': optional: true - '@esbuild/linux-s390x@0.27.7': - optional: true - '@esbuild/linux-s390x@0.28.0': optional: true - '@esbuild/linux-x64@0.27.7': - optional: true - '@esbuild/linux-x64@0.28.0': optional: true - '@esbuild/netbsd-arm64@0.27.7': - optional: true - '@esbuild/netbsd-arm64@0.28.0': optional: true - '@esbuild/netbsd-x64@0.27.7': - optional: true - '@esbuild/netbsd-x64@0.28.0': optional: true - '@esbuild/openbsd-arm64@0.27.7': - optional: true - '@esbuild/openbsd-arm64@0.28.0': optional: true - '@esbuild/openbsd-x64@0.27.7': - optional: true - '@esbuild/openbsd-x64@0.28.0': optional: true - '@esbuild/openharmony-arm64@0.27.7': - optional: true - '@esbuild/openharmony-arm64@0.28.0': optional: true - '@esbuild/sunos-x64@0.27.7': - optional: true - '@esbuild/sunos-x64@0.28.0': optional: true - '@esbuild/win32-arm64@0.27.7': - optional: true - '@esbuild/win32-arm64@0.28.0': optional: true - '@esbuild/win32-ia32@0.27.7': - optional: true - '@esbuild/win32-ia32@0.28.0': optional: true - '@esbuild/win32-x64@0.27.7': - optional: true - '@esbuild/win32-x64@0.28.0': optional: true @@ -3176,23 +2934,23 @@ snapshots: '@jridgewell/resolve-uri': 3.1.2 '@jridgewell/sourcemap-codec': 1.5.5 - '@microsoft/api-extractor-model@7.29.6(@types/node@25.7.0)': + '@microsoft/api-extractor-model@7.29.6(@types/node@25.8.0)': dependencies: '@microsoft/tsdoc': 0.15.1 '@microsoft/tsdoc-config': 0.17.1 - '@rushstack/node-core-library': 5.7.0(@types/node@25.7.0) + '@rushstack/node-core-library': 5.7.0(@types/node@25.8.0) transitivePeerDependencies: - '@types/node' - '@microsoft/api-extractor@7.47.7(@types/node@25.7.0)': + '@microsoft/api-extractor@7.47.7(@types/node@25.8.0)': dependencies: - '@microsoft/api-extractor-model': 7.29.6(@types/node@25.7.0) + '@microsoft/api-extractor-model': 7.29.6(@types/node@25.8.0) '@microsoft/tsdoc': 0.15.1 '@microsoft/tsdoc-config': 0.17.1 - '@rushstack/node-core-library': 5.7.0(@types/node@25.7.0) + '@rushstack/node-core-library': 5.7.0(@types/node@25.8.0) '@rushstack/rig-package': 0.5.3 - '@rushstack/terminal': 0.14.0(@types/node@25.7.0) - '@rushstack/ts-command-line': 4.22.6(@types/node@25.7.0) + '@rushstack/terminal': 0.14.0(@types/node@25.8.0) + '@rushstack/ts-command-line': 4.22.6(@types/node@25.8.0) lodash: 4.18.1 minimatch: 3.1.5 resolve: 1.22.12 @@ -3282,8 +3040,6 @@ snapshots: '@oxc-parser/binding-win32-x64-msvc@0.130.0': optional: true - '@oxc-project/types@0.129.0': {} - '@oxc-project/types@0.130.0': {} '@oxc-resolver/binding-android-arm-eabi@11.19.1': @@ -3353,56 +3109,56 @@ snapshots: '@publint/pack@0.1.4': {} - '@rolldown/binding-android-arm64@1.0.0': + '@rolldown/binding-android-arm64@1.0.1': optional: true - '@rolldown/binding-darwin-arm64@1.0.0': + '@rolldown/binding-darwin-arm64@1.0.1': optional: true - '@rolldown/binding-darwin-x64@1.0.0': + '@rolldown/binding-darwin-x64@1.0.1': optional: true - '@rolldown/binding-freebsd-x64@1.0.0': + '@rolldown/binding-freebsd-x64@1.0.1': optional: true - '@rolldown/binding-linux-arm-gnueabihf@1.0.0': + '@rolldown/binding-linux-arm-gnueabihf@1.0.1': optional: true - '@rolldown/binding-linux-arm64-gnu@1.0.0': + '@rolldown/binding-linux-arm64-gnu@1.0.1': optional: true - '@rolldown/binding-linux-arm64-musl@1.0.0': + '@rolldown/binding-linux-arm64-musl@1.0.1': optional: true - '@rolldown/binding-linux-ppc64-gnu@1.0.0': + '@rolldown/binding-linux-ppc64-gnu@1.0.1': optional: true - '@rolldown/binding-linux-s390x-gnu@1.0.0': + '@rolldown/binding-linux-s390x-gnu@1.0.1': optional: true - '@rolldown/binding-linux-x64-gnu@1.0.0': + '@rolldown/binding-linux-x64-gnu@1.0.1': optional: true - '@rolldown/binding-linux-x64-musl@1.0.0': + '@rolldown/binding-linux-x64-musl@1.0.1': optional: true - '@rolldown/binding-openharmony-arm64@1.0.0': + '@rolldown/binding-openharmony-arm64@1.0.1': optional: true - '@rolldown/binding-wasm32-wasi@1.0.0': + '@rolldown/binding-wasm32-wasi@1.0.1': dependencies: '@emnapi/core': 1.10.0 '@emnapi/runtime': 1.10.0 '@napi-rs/wasm-runtime': 1.1.4(@emnapi/core@1.10.0)(@emnapi/runtime@1.10.0) optional: true - '@rolldown/binding-win32-arm64-msvc@1.0.0': + '@rolldown/binding-win32-arm64-msvc@1.0.1': optional: true - '@rolldown/binding-win32-x64-msvc@1.0.0': + '@rolldown/binding-win32-x64-msvc@1.0.1': optional: true - '@rolldown/pluginutils@1.0.0': {} + '@rolldown/pluginutils@1.0.1': {} '@rollup/pluginutils@5.3.0(rollup@4.60.1)': dependencies: @@ -3487,7 +3243,7 @@ snapshots: '@rollup/rollup-win32-x64-msvc@4.60.1': optional: true - '@rushstack/node-core-library@5.7.0(@types/node@25.7.0)': + '@rushstack/node-core-library@5.7.0(@types/node@25.8.0)': dependencies: ajv: 8.20.0 ajv-draft-04: 1.0.0(ajv@8.20.0) @@ -3498,23 +3254,23 @@ snapshots: resolve: 1.22.12 semver: 7.5.4 optionalDependencies: - '@types/node': 25.7.0 + '@types/node': 25.8.0 '@rushstack/rig-package@0.5.3': dependencies: resolve: 1.22.12 strip-json-comments: 3.1.1 - '@rushstack/terminal@0.14.0(@types/node@25.7.0)': + '@rushstack/terminal@0.14.0(@types/node@25.8.0)': dependencies: - '@rushstack/node-core-library': 5.7.0(@types/node@25.7.0) + '@rushstack/node-core-library': 5.7.0(@types/node@25.8.0) supports-color: 8.1.1 optionalDependencies: - '@types/node': 25.7.0 + '@types/node': 25.8.0 - '@rushstack/ts-command-line@4.22.6(@types/node@25.7.0)': + '@rushstack/ts-command-line@4.22.6(@types/node@25.8.0)': dependencies: - '@rushstack/terminal': 0.14.0(@types/node@25.7.0) + '@rushstack/terminal': 0.14.0(@types/node@25.8.0) '@types/argparse': 1.0.38 argparse: 1.0.10 string-argv: 0.3.2 @@ -3535,12 +3291,12 @@ snapshots: - supports-color - typescript - '@tanstack/vite-config@0.5.2(@types/node@25.7.0)(rollup@4.60.1)(typescript@5.9.3)(vite@8.0.12(@types/node@25.7.0)(esbuild@0.28.0)(jiti@2.7.0)(tsx@4.21.0)(yaml@2.9.0))': + '@tanstack/vite-config@0.5.2(@types/node@25.8.0)(rollup@4.60.1)(typescript@5.9.3)(vite@8.0.13(@types/node@25.8.0)(esbuild@0.28.0)(jiti@2.7.0)(tsx@4.22.0)(yaml@2.9.0))': dependencies: - vite: 8.0.12(@types/node@25.7.0)(esbuild@0.28.0)(jiti@2.7.0)(tsx@4.21.0)(yaml@2.9.0) - vite-plugin-dts: 4.2.3(@types/node@25.7.0)(rollup@4.60.1)(typescript@5.9.3)(vite@8.0.12(@types/node@25.7.0)(esbuild@0.28.0)(jiti@2.7.0)(tsx@4.21.0)(yaml@2.9.0)) - vite-plugin-externalize-deps: 0.10.0(vite@8.0.12(@types/node@25.7.0)(esbuild@0.28.0)(jiti@2.7.0)(tsx@4.21.0)(yaml@2.9.0)) - vite-tsconfig-paths: 6.1.1(typescript@5.9.3)(vite@8.0.12(@types/node@25.7.0)(esbuild@0.28.0)(jiti@2.7.0)(tsx@4.21.0)(yaml@2.9.0)) + vite: 8.0.13(@types/node@25.8.0)(esbuild@0.28.0)(jiti@2.7.0)(tsx@4.22.0)(yaml@2.9.0) + vite-plugin-dts: 4.2.3(@types/node@25.8.0)(rollup@4.60.1)(typescript@5.9.3)(vite@8.0.13(@types/node@25.8.0)(esbuild@0.28.0)(jiti@2.7.0)(tsx@4.22.0)(yaml@2.9.0)) + vite-plugin-externalize-deps: 0.10.0(vite@8.0.13(@types/node@25.8.0)(esbuild@0.28.0)(jiti@2.7.0)(tsx@4.22.0)(yaml@2.9.0)) + vite-tsconfig-paths: 6.1.1(typescript@5.9.3)(vite@8.0.13(@types/node@25.8.0)(esbuild@0.28.0)(jiti@2.7.0)(tsx@4.22.0)(yaml@2.9.0)) transitivePeerDependencies: - '@types/node' - rollup @@ -3568,9 +3324,9 @@ snapshots: '@types/json-schema@7.0.15': {} - '@types/node@25.7.0': + '@types/node@25.8.0': dependencies: - undici-types: 7.21.0 + undici-types: 7.24.6 '@typescript-eslint/eslint-plugin@8.59.3(@typescript-eslint/parser@8.59.3(eslint@9.39.4(jiti@2.7.0))(typescript@5.9.3))(eslint@9.39.4(jiti@2.7.0))(typescript@5.9.3)': dependencies: @@ -3672,10 +3428,10 @@ snapshots: istanbul-lib-coverage: 3.2.2 istanbul-lib-report: 3.0.1 istanbul-reports: 3.2.0 - magicast: 0.5.2 + magicast: 0.5.3 obug: 2.1.1 tinyrainbow: 3.1.0 - vitest: 4.1.6(@types/node@25.7.0)(@vitest/coverage-istanbul@4.1.6)(vite@8.0.12(@types/node@25.7.0)(esbuild@0.28.0)(jiti@2.7.0)(tsx@4.21.0)(yaml@2.9.0)) + vitest: 4.1.6(@types/node@25.8.0)(@vitest/coverage-istanbul@4.1.6)(vite@8.0.13(@types/node@25.8.0)(esbuild@0.28.0)(jiti@2.7.0)(tsx@4.22.0)(yaml@2.9.0)) transitivePeerDependencies: - supports-color @@ -3688,13 +3444,13 @@ snapshots: chai: 6.2.2 tinyrainbow: 3.1.0 - '@vitest/mocker@4.1.6(vite@8.0.12(@types/node@25.7.0)(esbuild@0.28.0)(jiti@2.7.0)(tsx@4.21.0)(yaml@2.9.0))': + '@vitest/mocker@4.1.6(vite@8.0.13(@types/node@25.8.0)(esbuild@0.28.0)(jiti@2.7.0)(tsx@4.22.0)(yaml@2.9.0))': dependencies: '@vitest/spy': 4.1.6 estree-walker: 3.0.3 magic-string: 0.30.21 optionalDependencies: - vite: 8.0.12(@types/node@25.7.0)(esbuild@0.28.0)(jiti@2.7.0)(tsx@4.21.0)(yaml@2.9.0) + vite: 8.0.13(@types/node@25.8.0)(esbuild@0.28.0)(jiti@2.7.0)(tsx@4.22.0)(yaml@2.9.0) '@vitest/pretty-format@4.1.6': dependencies: @@ -3880,7 +3636,7 @@ snapshots: dependencies: baseline-browser-mapping: 2.10.29 caniuse-lite: 1.0.30001792 - electron-to-chromium: 1.5.354 + electron-to-chromium: 1.5.356 node-releases: 2.0.44 update-browserslist-db: 1.2.3(browserslist@4.28.2) @@ -3984,7 +3740,7 @@ snapshots: es-errors: 1.3.0 gopd: 1.2.0 - electron-to-chromium@1.5.354: {} + electron-to-chromium@1.5.356: {} enhanced-resolve@5.21.3: dependencies: @@ -4096,35 +3852,6 @@ snapshots: is-date-object: 1.1.0 is-symbol: 1.1.1 - esbuild@0.27.7: - optionalDependencies: - '@esbuild/aix-ppc64': 0.27.7 - '@esbuild/android-arm': 0.27.7 - '@esbuild/android-arm64': 0.27.7 - '@esbuild/android-x64': 0.27.7 - '@esbuild/darwin-arm64': 0.27.7 - '@esbuild/darwin-x64': 0.27.7 - '@esbuild/freebsd-arm64': 0.27.7 - '@esbuild/freebsd-x64': 0.27.7 - '@esbuild/linux-arm': 0.27.7 - '@esbuild/linux-arm64': 0.27.7 - '@esbuild/linux-ia32': 0.27.7 - '@esbuild/linux-loong64': 0.27.7 - '@esbuild/linux-mips64el': 0.27.7 - '@esbuild/linux-ppc64': 0.27.7 - '@esbuild/linux-riscv64': 0.27.7 - '@esbuild/linux-s390x': 0.27.7 - '@esbuild/linux-x64': 0.27.7 - '@esbuild/netbsd-arm64': 0.27.7 - '@esbuild/netbsd-x64': 0.27.7 - '@esbuild/openbsd-arm64': 0.27.7 - '@esbuild/openbsd-x64': 0.27.7 - '@esbuild/openharmony-arm64': 0.27.7 - '@esbuild/sunos-x64': 0.27.7 - '@esbuild/win32-arm64': 0.27.7 - '@esbuild/win32-ia32': 0.27.7 - '@esbuild/win32-x64': 0.27.7 - esbuild@0.28.0: optionalDependencies: '@esbuild/aix-ppc64': 0.28.0 @@ -4207,7 +3934,7 @@ snapshots: object.fromentries: 2.0.8 object.values: 1.2.1 prop-types: 15.8.1 - resolve: 2.0.0-next.6 + resolve: 2.0.0-next.7 semver: 6.3.1 string.prototype.matchall: 4.0.12 string.prototype.repeat: 1.0.0 @@ -4643,7 +4370,7 @@ snapshots: dependencies: json-buffer: 3.0.1 - knip@6.13.1(@emnapi/core@1.10.0)(@emnapi/runtime@1.10.0): + knip@6.14.0(@emnapi/core@1.10.0)(@emnapi/runtime@1.10.0): dependencies: fdir: 6.5.0(picomatch@4.0.4) formatly: 0.3.0 @@ -4754,7 +4481,7 @@ snapshots: dependencies: '@jridgewell/sourcemap-codec': 1.5.5 - magicast@0.5.2: + magicast@0.5.3: dependencies: '@babel/parser': 7.29.3 '@babel/types': 7.29.0 @@ -4999,7 +4726,7 @@ snapshots: object-assign: 4.1.1 react-is: 16.13.1 - publint@0.3.20: + publint@0.3.21: dependencies: '@publint/pack': 0.1.4 package-manager-detector: 1.6.0 @@ -5052,7 +4779,7 @@ snapshots: path-parse: 1.0.7 supports-preserve-symlinks-flag: 1.0.0 - resolve@2.0.0-next.6: + resolve@2.0.0-next.7: dependencies: es-errors: 1.3.0 is-core-module: 2.16.2 @@ -5066,26 +4793,26 @@ snapshots: glob: 13.0.6 package-json-from-dist: 1.0.1 - rolldown@1.0.0: + rolldown@1.0.1: dependencies: - '@oxc-project/types': 0.129.0 - '@rolldown/pluginutils': 1.0.0 + '@oxc-project/types': 0.130.0 + '@rolldown/pluginutils': 1.0.1 optionalDependencies: - '@rolldown/binding-android-arm64': 1.0.0 - '@rolldown/binding-darwin-arm64': 1.0.0 - '@rolldown/binding-darwin-x64': 1.0.0 - '@rolldown/binding-freebsd-x64': 1.0.0 - '@rolldown/binding-linux-arm-gnueabihf': 1.0.0 - '@rolldown/binding-linux-arm64-gnu': 1.0.0 - '@rolldown/binding-linux-arm64-musl': 1.0.0 - '@rolldown/binding-linux-ppc64-gnu': 1.0.0 - '@rolldown/binding-linux-s390x-gnu': 1.0.0 - '@rolldown/binding-linux-x64-gnu': 1.0.0 - '@rolldown/binding-linux-x64-musl': 1.0.0 - '@rolldown/binding-openharmony-arm64': 1.0.0 - '@rolldown/binding-wasm32-wasi': 1.0.0 - '@rolldown/binding-win32-arm64-msvc': 1.0.0 - '@rolldown/binding-win32-x64-msvc': 1.0.0 + '@rolldown/binding-android-arm64': 1.0.1 + '@rolldown/binding-darwin-arm64': 1.0.1 + '@rolldown/binding-darwin-x64': 1.0.1 + '@rolldown/binding-freebsd-x64': 1.0.1 + '@rolldown/binding-linux-arm-gnueabihf': 1.0.1 + '@rolldown/binding-linux-arm64-gnu': 1.0.1 + '@rolldown/binding-linux-arm64-musl': 1.0.1 + '@rolldown/binding-linux-ppc64-gnu': 1.0.1 + '@rolldown/binding-linux-s390x-gnu': 1.0.1 + '@rolldown/binding-linux-x64-gnu': 1.0.1 + '@rolldown/binding-linux-x64-musl': 1.0.1 + '@rolldown/binding-openharmony-arm64': 1.0.1 + '@rolldown/binding-wasm32-wasi': 1.0.1 + '@rolldown/binding-win32-arm64-msvc': 1.0.1 + '@rolldown/binding-win32-x64-msvc': 1.0.1 rollup@4.60.1: dependencies: @@ -5320,10 +5047,9 @@ snapshots: tslib@2.8.1: optional: true - tsx@4.21.0: + tsx@4.22.0: dependencies: - esbuild: 0.27.7 - get-tsconfig: 4.14.0 + esbuild: 0.28.0 optionalDependencies: fsevents: 2.3.3 @@ -5390,7 +5116,7 @@ snapshots: has-symbols: 1.1.0 which-boxed-primitive: 1.1.1 - undici-types@7.21.0: {} + undici-types@7.24.6: {} unicorn-magic@0.3.0: {} @@ -5406,9 +5132,9 @@ snapshots: dependencies: punycode: 2.3.1 - vite-plugin-dts@4.2.3(@types/node@25.7.0)(rollup@4.60.1)(typescript@5.9.3)(vite@8.0.12(@types/node@25.7.0)(esbuild@0.28.0)(jiti@2.7.0)(tsx@4.21.0)(yaml@2.9.0)): + vite-plugin-dts@4.2.3(@types/node@25.8.0)(rollup@4.60.1)(typescript@5.9.3)(vite@8.0.13(@types/node@25.8.0)(esbuild@0.28.0)(jiti@2.7.0)(tsx@4.22.0)(yaml@2.9.0)): dependencies: - '@microsoft/api-extractor': 7.47.7(@types/node@25.7.0) + '@microsoft/api-extractor': 7.47.7(@types/node@25.8.0) '@rollup/pluginutils': 5.3.0(rollup@4.60.1) '@volar/typescript': 2.4.28 '@vue/language-core': 2.1.6(typescript@5.9.3) @@ -5419,45 +5145,45 @@ snapshots: magic-string: 0.30.21 typescript: 5.9.3 optionalDependencies: - vite: 8.0.12(@types/node@25.7.0)(esbuild@0.28.0)(jiti@2.7.0)(tsx@4.21.0)(yaml@2.9.0) + vite: 8.0.13(@types/node@25.8.0)(esbuild@0.28.0)(jiti@2.7.0)(tsx@4.22.0)(yaml@2.9.0) transitivePeerDependencies: - '@types/node' - rollup - supports-color - vite-plugin-externalize-deps@0.10.0(vite@8.0.12(@types/node@25.7.0)(esbuild@0.28.0)(jiti@2.7.0)(tsx@4.21.0)(yaml@2.9.0)): + vite-plugin-externalize-deps@0.10.0(vite@8.0.13(@types/node@25.8.0)(esbuild@0.28.0)(jiti@2.7.0)(tsx@4.22.0)(yaml@2.9.0)): dependencies: - vite: 8.0.12(@types/node@25.7.0)(esbuild@0.28.0)(jiti@2.7.0)(tsx@4.21.0)(yaml@2.9.0) + vite: 8.0.13(@types/node@25.8.0)(esbuild@0.28.0)(jiti@2.7.0)(tsx@4.22.0)(yaml@2.9.0) - vite-tsconfig-paths@6.1.1(typescript@5.9.3)(vite@8.0.12(@types/node@25.7.0)(esbuild@0.28.0)(jiti@2.7.0)(tsx@4.21.0)(yaml@2.9.0)): + vite-tsconfig-paths@6.1.1(typescript@5.9.3)(vite@8.0.13(@types/node@25.8.0)(esbuild@0.28.0)(jiti@2.7.0)(tsx@4.22.0)(yaml@2.9.0)): dependencies: debug: 4.4.3 globrex: 0.1.2 tsconfck: 3.1.6(typescript@5.9.3) - vite: 8.0.12(@types/node@25.7.0)(esbuild@0.28.0)(jiti@2.7.0)(tsx@4.21.0)(yaml@2.9.0) + vite: 8.0.13(@types/node@25.8.0)(esbuild@0.28.0)(jiti@2.7.0)(tsx@4.22.0)(yaml@2.9.0) transitivePeerDependencies: - supports-color - typescript - vite@8.0.12(@types/node@25.7.0)(esbuild@0.28.0)(jiti@2.7.0)(tsx@4.21.0)(yaml@2.9.0): + vite@8.0.13(@types/node@25.8.0)(esbuild@0.28.0)(jiti@2.7.0)(tsx@4.22.0)(yaml@2.9.0): dependencies: lightningcss: 1.32.0 picomatch: 4.0.4 postcss: 8.5.14 - rolldown: 1.0.0 + rolldown: 1.0.1 tinyglobby: 0.2.16 optionalDependencies: - '@types/node': 25.7.0 + '@types/node': 25.8.0 esbuild: 0.28.0 fsevents: 2.3.3 jiti: 2.7.0 - tsx: 4.21.0 + tsx: 4.22.0 yaml: 2.9.0 - vitest@4.1.6(@types/node@25.7.0)(@vitest/coverage-istanbul@4.1.6)(vite@8.0.12(@types/node@25.7.0)(esbuild@0.28.0)(jiti@2.7.0)(tsx@4.21.0)(yaml@2.9.0)): + vitest@4.1.6(@types/node@25.8.0)(@vitest/coverage-istanbul@4.1.6)(vite@8.0.13(@types/node@25.8.0)(esbuild@0.28.0)(jiti@2.7.0)(tsx@4.22.0)(yaml@2.9.0)): dependencies: '@vitest/expect': 4.1.6 - '@vitest/mocker': 4.1.6(vite@8.0.12(@types/node@25.7.0)(esbuild@0.28.0)(jiti@2.7.0)(tsx@4.21.0)(yaml@2.9.0)) + '@vitest/mocker': 4.1.6(vite@8.0.13(@types/node@25.8.0)(esbuild@0.28.0)(jiti@2.7.0)(tsx@4.22.0)(yaml@2.9.0)) '@vitest/pretty-format': 4.1.6 '@vitest/runner': 4.1.6 '@vitest/snapshot': 4.1.6 @@ -5474,10 +5200,10 @@ snapshots: tinyexec: 1.1.2 tinyglobby: 0.2.16 tinyrainbow: 3.1.0 - vite: 8.0.12(@types/node@25.7.0)(esbuild@0.28.0)(jiti@2.7.0)(tsx@4.21.0)(yaml@2.9.0) + vite: 8.0.13(@types/node@25.8.0)(esbuild@0.28.0)(jiti@2.7.0)(tsx@4.22.0)(yaml@2.9.0) why-is-node-running: 2.3.0 optionalDependencies: - '@types/node': 25.7.0 + '@types/node': 25.8.0 '@vitest/coverage-istanbul': 4.1.6(vitest@4.1.6) transitivePeerDependencies: - msw diff --git a/src/js/cache.ts b/src/js/cache.ts index 4eb065d..66be869 100644 --- a/src/js/cache.ts +++ b/src/js/cache.ts @@ -13,30 +13,15 @@ const CACHE_SIZE = 2048; */ export class CacheItem { /* private */ - #isNull: boolean; #item: unknown; - constructor(item: unknown, isNull: boolean = false) { + constructor(item: unknown) { this.#item = item; - this.#isNull = !!isNull; } get item() { return this.#item; } - - get isNull() { - return this.#isNull; - } -} - -/** - * NullObject - */ -export class NullObject extends CacheItem { - constructor() { - super(Symbol('null'), true); - } } /* @@ -44,11 +29,6 @@ export class NullObject extends CacheItem { */ export const genCache = new GenerationalCache(CACHE_SIZE); -/** - * shared null object - */ -const sharedNullObject = new NullObject(); - /** * set cache * @param key - cache key @@ -59,9 +39,7 @@ export const setCache = (key: string, value: unknown): void => { if (!key) { return; } - if (value === null) { - genCache.set(key, sharedNullObject); - } else if (value instanceof CacheItem) { + if (value instanceof CacheItem) { genCache.set(key, value); } else { genCache.set(key, new CacheItem(value)); diff --git a/src/js/color.ts b/src/js/color.ts index d935eb2..3e01ab6 100644 --- a/src/js/color.ts +++ b/src/js/color.ts @@ -6,13 +6,7 @@ * https://w3c.github.io/csswg-drafts/css-color-4/#color-conversion-code */ -import { - CacheItem, - NullObject, - createCacheKey, - getCache, - setCache -} from './cache'; +import { createCacheKey, getCache, setCache } from './cache'; import { isString } from './common'; import { resolveColor } from './resolve'; import { interpolateHue, roundToPrecision, splitValue } from './util'; @@ -366,7 +360,7 @@ export const cacheInvalidColorValue = ( cacheKey: string, format: string, nullable: boolean = false -): SpecifiedColorChannels | string | NullObject => { +): SpecifiedColorChannels | string | null => { if (format === VAL_SPEC) { const res = ''; setCache(cacheKey, res); @@ -374,7 +368,7 @@ export const cacheInvalidColorValue = ( } if (nullable) { setCache(cacheKey, null); - return new NullObject(); + return null; } const res: SpecifiedColorChannels = ['rgb', 0, 0, 0, 0]; setCache(cacheKey, res); @@ -390,19 +384,19 @@ export const cacheInvalidColorValue = ( export const resolveInvalidColorValue = ( format: string, nullable: boolean = false -): SpecifiedColorChannels | string | NullObject => { +): SpecifiedColorChannels | string | null => { switch (format) { case 'hsl': case 'hwb': case VAL_MIX: { - return new NullObject(); + return null; } case VAL_SPEC: { return ''; } default: { if (nullable) { - return new NullObject(); + return null; } return ['rgb', 0, 0, 0, 0] as SpecifiedColorChannels; } @@ -1245,12 +1239,12 @@ export const convertHexToXyz = (value: string): ColorChannels => { * parse rgb() * @param value - rgb color value * @param [opt] - options - * @returns parsed color - ['rgb', r, g, b, alpha], '(empty)', NullObject + * @returns parsed color - ['rgb', r, g, b, alpha], '(empty)', null */ export const parseRgb = ( value: string, opt: Options = {} -): SpecifiedColorChannels | string | NullObject => { +): SpecifiedColorChannels | string | null => { if (isString(value)) { value = value.toLowerCase().trim(); } else { @@ -1259,10 +1253,9 @@ export const parseRgb = ( const { format = '', nullable = false } = opt; if (!REG_PARSE_RGB.test(value)) { const res = resolveInvalidColorValue(format, nullable); - if (res instanceof NullObject) { - return res; - } - if (isString(res)) { + if (res === null) { + return null; + } else if (isString(res)) { return res as string; } return res as SpecifiedColorChannels; @@ -1308,12 +1301,12 @@ export const parseRgb = ( * parse hsl() * @param value - hsl color value * @param [opt] - options - * @returns parsed color - ['rgb', r, g, b, alpha], '(empty)', NullObject + * @returns parsed color - ['rgb', r, g, b, alpha], '(empty)', null */ export const parseHsl = ( value: string, opt: Options = {} -): SpecifiedColorChannels | string | NullObject => { +): SpecifiedColorChannels | string | null => { if (isString(value)) { value = value.trim(); } else { @@ -1322,10 +1315,9 @@ export const parseHsl = ( const { format = '', nullable = false } = opt; if (!REG_HSL.test(value)) { const res = resolveInvalidColorValue(format, nullable); - if (res instanceof NullObject) { - return res; - } - if (isString(res)) { + if (res === null) { + return null; + } else if (isString(res)) { return res as string; } return res as SpecifiedColorChannels; @@ -1380,12 +1372,12 @@ export const parseHsl = ( * parse hwb() * @param value - hwb color value * @param [opt] - options - * @returns parsed color - ['rgb', r, g, b, alpha], '(empty)', NullObject + * @returns parsed color - ['rgb', r, g, b, alpha], '(empty)', null */ export const parseHwb = ( value: string, opt: Options = {} -): SpecifiedColorChannels | string | NullObject => { +): SpecifiedColorChannels | string | null => { if (isString(value)) { value = value.trim(); } else { @@ -1394,10 +1386,9 @@ export const parseHwb = ( const { format = '', nullable = false } = opt; if (!REG_HWB.test(value)) { const res = resolveInvalidColorValue(format, nullable); - if (res instanceof NullObject) { - return res; - } - if (isString(res)) { + if (res === null) { + return null; + } else if (isString(res)) { return res as string; } return res as SpecifiedColorChannels; @@ -1453,12 +1444,12 @@ export const parseHwb = ( * @param value - lab color value * @param [opt] - options * @returns parsed color - * - [xyz-d50, x, y, z, alpha], ['lab', l, a, b, alpha], '(empty)', NullObject + * - [xyz-d50, x, y, z, alpha], ['lab', l, a, b, alpha], '(empty)', null */ export const parseLab = ( value: string, opt: Options = {} -): SpecifiedColorChannels | string | NullObject => { +): SpecifiedColorChannels | string | null => { if (isString(value)) { value = value.trim(); } else { @@ -1467,10 +1458,9 @@ export const parseLab = ( const { format = '', nullable = false } = opt; if (!REG_LAB.test(value)) { const res = resolveInvalidColorValue(format, nullable); - if (res instanceof NullObject) { - return res; - } - if (isString(res)) { + if (res === null) { + return null; + } else if (isString(res)) { return res as string; } return res as SpecifiedColorChannels; @@ -1543,13 +1533,12 @@ export const parseLab = ( * @param value - lch color value * @param [opt] - options * @returns parsed color - * - ['xyz-d50', x, y, z, alpha], ['lch', l, c, h, alpha] - * - '(empty)', NullObject + * - ['xyz-d50', x, y, z, alpha], ['lch', l, c, h, alpha], '(empty)', null */ export const parseLch = ( value: string, opt: Options = {} -): SpecifiedColorChannels | string | NullObject => { +): SpecifiedColorChannels | string | null => { if (isString(value)) { value = value.trim(); } else { @@ -1558,10 +1547,9 @@ export const parseLch = ( const { format = '', nullable = false } = opt; if (!REG_LCH.test(value)) { const res = resolveInvalidColorValue(format, nullable); - if (res instanceof NullObject) { - return res; - } - if (isString(res)) { + if (res === null) { + return null; + } else if (isString(res)) { return res as string; } return res as SpecifiedColorChannels; @@ -1615,13 +1603,12 @@ export const parseLch = ( * @param value - oklab color value * @param [opt] - options * @returns parsed color - * - ['xyz-d65', x, y, z, alpha], ['oklab', l, a, b, alpha] - * - '(empty)', NullObject + * - ['xyz-d65', x, y, z, alpha], ['oklab', l, a, b, alpha], '(empty)', null */ export const parseOklab = ( value: string, opt: Options = {} -): SpecifiedColorChannels | string | NullObject => { +): SpecifiedColorChannels | string | null => { if (isString(value)) { value = value.trim(); } else { @@ -1630,10 +1617,9 @@ export const parseOklab = ( const { format = '', nullable = false } = opt; if (!REG_OKLAB.test(value)) { const res = resolveInvalidColorValue(format, nullable); - if (res instanceof NullObject) { - return res; - } - if (isString(res)) { + if (res === null) { + return null; + } else if (isString(res)) { return res as string; } return res as SpecifiedColorChannels; @@ -1691,13 +1677,12 @@ export const parseOklab = ( * @param value - oklch color value * @param [opt] - options * @returns parsed color - * - ['xyz-d65', x, y, z, alpha], ['oklch', l, c, h, alpha] - * - '(empty)', NullObject + * - ['xyz-d65', x, y, z, alpha], ['oklch', l, c, h, alpha], '(empty)', null */ export const parseOklch = ( value: string, opt: Options = {} -): SpecifiedColorChannels | string | NullObject => { +): SpecifiedColorChannels | string | null => { if (isString(value)) { value = value.trim(); } else { @@ -1706,10 +1691,9 @@ export const parseOklch = ( const { format = '', nullable = false } = opt; if (!REG_OKLCH.test(value)) { const res = resolveInvalidColorValue(format, nullable); - if (res instanceof NullObject) { - return res; - } - if (isString(res)) { + if (res === null) { + return null; + } else if (isString(res)) { return res as string; } return res as SpecifiedColorChannels; @@ -1772,13 +1756,12 @@ export const parseOklch = ( * @param value - color function value * @param [opt] - options * @returns parsed color - * - ['xyz-(d50|d65)', x, y, z, alpha], [cs, r, g, b, alpha] - * - '(empty)', NullObject + * - ['xyz-(d50|d65)', x, y, z, alpha], [cs, r, g, b, alpha], '(empty)', null */ export const parseColorFunc = ( value: string, opt: Options = {} -): SpecifiedColorChannels | string | NullObject => { +): SpecifiedColorChannels | string | null => { if (isString(value)) { value = value.trim(); } else { @@ -1787,10 +1770,9 @@ export const parseColorFunc = ( const { colorSpace = '', d50 = false, format = '', nullable = false } = opt; if (!REG_FN_COLOR.test(value)) { const res = resolveInvalidColorValue(format, nullable); - if (res instanceof NullObject) { - return res; - } - if (isString(res)) { + if (res === null) { + return null; + } else if (isString(res)) { return res as string; } return res as SpecifiedColorChannels; @@ -1925,12 +1907,12 @@ export const parseColorFunc = ( * @param [opt] - options * @returns parsed color * - ['xyz-(d50|d65)', x, y, z, alpha], ['rgb', r, g, b, alpha] - * - value, '(empty)', NullObject + * - value, '(empty)', null */ export const parseColorValue = ( value: string, opt: Options = {} -): SpecifiedColorChannels | string | NullObject => { +): SpecifiedColorChannels | string | null => { if (isString(value)) { value = value.toLowerCase().trim(); } else { @@ -1939,10 +1921,9 @@ export const parseColorValue = ( const { d50 = false, format = '', nullable = false } = opt; if (!REG_COLOR.test(value)) { const res = resolveInvalidColorValue(format, nullable); - if (res instanceof NullObject) { - return res; - } - if (isString(res)) { + if (res === null) { + return null; + } else if (isString(res)) { return res as string; } return res as SpecifiedColorChannels; @@ -1980,7 +1961,7 @@ export const parseColorValue = ( switch (format) { case VAL_COMP: { if (nullable && value !== 'transparent') { - return new NullObject(); + return null; } return ['rgb', 0, 0, 0, 0]; } @@ -1994,7 +1975,7 @@ export const parseColorValue = ( if (value === 'transparent') { return ['rgb', 0, 0, 0, 0]; } - return new NullObject(); + return null; } default: } @@ -2079,12 +2060,12 @@ export const parseColorValue = ( * @param value - CSS color value * @param [opt] - options * @returns resolved color - * - [cs, v1, v2, v3, alpha], value, '(empty)', NullObject + * - [cs, v1, v2, v3, alpha], value, '(empty)', null */ export const resolveColorValue = ( value: string, opt: Options = {} -): SpecifiedColorChannels | string | NullObject => { +): SpecifiedColorChannels | string | null => { if (isString(value)) { value = value.toLowerCase().trim(); } else { @@ -2100,21 +2081,14 @@ export const resolveColorValue = ( opt ); const cachedResult = getCache(cacheKey); - if (cachedResult instanceof CacheItem) { - if (cachedResult.isNull) { - return cachedResult as NullObject; - } - const cachedItem = cachedResult.item; - if (isString(cachedItem)) { - return cachedItem as string; - } - return cachedItem as SpecifiedColorChannels; + if (cachedResult !== false) { + return cachedResult.item as SpecifiedColorChannels | string | null; } if (!REG_COLOR.test(value)) { const res = resolveInvalidColorValue(format, nullable); - if (res instanceof NullObject) { + if (res === null) { setCache(cacheKey, null); - return res; + return null; } setCache(cacheKey, res); if (isString(res)) { @@ -2162,13 +2136,13 @@ export const resolveColorValue = ( return res; } setCache(cacheKey, null); - return new NullObject(); + return null; } case VAL_COMP: default: { if (nullable && value !== 'transparent') { setCache(cacheKey, null); - return new NullObject(); + return null; } const res: SpecifiedColorChannels = ['rgb', 0, 0, 0, 0]; setCache(cacheKey, res); @@ -2243,12 +2217,12 @@ export const resolveColorValue = ( * resolve color() * @param value - color function value * @param [opt] - options - * @returns resolved color - [cs, v1, v2, v3, alpha], '(empty)', NullObject + * @returns resolved color - [cs, v1, v2, v3, alpha], '(empty)', null */ export const resolveColorFunc = ( value: string, opt: Options = {} -): SpecifiedColorChannels | string | NullObject => { +): SpecifiedColorChannels | string | null => { if (isString(value)) { value = value.toLowerCase().trim(); } else { @@ -2264,21 +2238,14 @@ export const resolveColorFunc = ( opt ); const cachedResult = getCache(cacheKey); - if (cachedResult instanceof CacheItem) { - if (cachedResult.isNull) { - return cachedResult as NullObject; - } - const cachedItem = cachedResult.item; - if (isString(cachedItem)) { - return cachedItem as string; - } - return cachedItem as SpecifiedColorChannels; + if (cachedResult !== false) { + return cachedResult.item as SpecifiedColorChannels | string | null; } if (!REG_FN_COLOR.test(value)) { const res = resolveInvalidColorValue(format, nullable); - if (res instanceof NullObject) { + if (res === null) { setCache(cacheKey, null); - return res; + return null; } setCache(cacheKey, res); if (isString(res)) { @@ -2309,7 +2276,7 @@ export const resolveColorFunc = ( * convert color value to linear rgb * @param value - CSS color value * @param [opt] - options - * @returns ColorChannels | NullObject - [r, g, b, alpha] r|g|b|alpha: 0..1 + * @returns ColorChannels | null - [r, g, b, alpha] r|g|b|alpha: 0..1 */ export const convertColorToLinearRgb = ( value: string, @@ -2317,7 +2284,7 @@ export const convertColorToLinearRgb = ( colorSpace?: string; format?: string; } = {} -): ColorChannels | NullObject => { +): ColorChannels | null => { if (isString(value)) { value = value.trim(); } else { @@ -2333,8 +2300,8 @@ export const convertColorToLinearRgb = ( } else { xyz = parseColorValue(value, opt); } - if (xyz instanceof NullObject) { - return xyz; + if (xyz === null) { + return null; } [cs, x, y, z, alpha] = xyz as ComputedColorChannels; if (cs === colorSpace) { @@ -2368,13 +2335,12 @@ export const convertColorToLinearRgb = ( * convert color value to rgb * @param value - CSS color value * @param [opt] - options - * @returns ColorChannels | NullObject - * - [r, g, b, alpha] r|g|b: 0..255 alpha: 0..1 + * @returns ColorChannels | null - [r, g, b, alpha] r|g|b: 0..255 alpha: 0..1 */ export const convertColorToRgb = ( value: string, opt: Options = {} -): ColorChannels | NullObject => { +): ColorChannels | null => { if (isString(value)) { value = value.trim(); } else { @@ -2389,8 +2355,8 @@ export const convertColorToRgb = ( } else { rgb = resolveColorValue(value, opt); } - if (rgb instanceof NullObject) { - return rgb; + if (rgb === null) { + return null; } [, r, g, b, alpha] = rgb as ComputedColorChannels; } else if (value.startsWith(FN_COLOR)) { @@ -2421,12 +2387,12 @@ export const convertColorToRgb = ( * convert color value to xyz * @param value - CSS color value * @param [opt] - options - * @returns ColorChannels | NullObject - [x, y, z, alpha] + * @returns ColorChannels | null - [x, y, z, alpha] */ export const convertColorToXyz = ( value: string, opt: Options = {} -): ColorChannels | NullObject => { +): ColorChannels | null => { if (isString(value)) { value = value.trim(); } else { @@ -2441,8 +2407,8 @@ export const convertColorToXyz = ( } else { xyz = parseColorValue(value, opt); } - if (xyz instanceof NullObject) { - return xyz; + if (xyz === null) { + return null; } [, x, y, z, alpha] = xyz as ComputedColorChannels; } else if (value.startsWith(FN_COLOR)) { @@ -2476,12 +2442,12 @@ export const convertColorToXyz = ( * convert color value to hsl * @param value - CSS color value * @param [opt] - options - * @returns ColorChannels | NullObject - [h, s, l, alpha], hue may be powerless + * @returns ColorChannels | null - [h, s, l, alpha], hue may be powerless */ export const convertColorToHsl = ( value: string, opt: Options = {} -): ColorChannels | [number | string, number, number, number] | NullObject => { +): ColorChannels | [number | string, number, number, number] | null => { if (isString(value)) { value = value.trim(); } else { @@ -2506,8 +2472,8 @@ export const convertColorToHsl = ( } else { xyz = parseColorValue(value, opt); } - if (xyz instanceof NullObject) { - return xyz; + if (xyz === null) { + return null; } [, x, y, z, alpha] = xyz as ComputedColorChannels; } else if (value.startsWith(FN_COLOR)) { @@ -2526,12 +2492,12 @@ export const convertColorToHsl = ( * convert color value to hwb * @param value - CSS color value * @param [opt] - options - * @returns ColorChannels | NullObject - [h, w, b, alpha], hue may be powerless + * @returns ColorChannels | null - [h, w, b, alpha], hue may be powerless */ export const convertColorToHwb = ( value: string, opt: Options = {} -): ColorChannels | [number | string, number, number, number] | NullObject => { +): ColorChannels | [number | string, number, number, number] | null => { if (isString(value)) { value = value.trim(); } else { @@ -2556,8 +2522,8 @@ export const convertColorToHwb = ( } else { xyz = parseColorValue(value, opt); } - if (xyz instanceof NullObject) { - return xyz; + if (xyz === null) { + return null; } [, x, y, z, alpha] = xyz as ComputedColorChannels; } else if (value.startsWith(FN_COLOR)) { @@ -2576,12 +2542,12 @@ export const convertColorToHwb = ( * convert color value to lab * @param value - CSS color value * @param [opt] - options - * @returns ColorChannels | NullObject - [l, a, b, alpha] + * @returns ColorChannels | null - [l, a, b, alpha] */ export const convertColorToLab = ( value: string, opt: Options = {} -): ColorChannels | NullObject => { +): ColorChannels | null => { if (isString(value)) { value = value.trim(); } else { @@ -2604,8 +2570,8 @@ export const convertColorToLab = ( } else { xyz = parseColorValue(value, opt); } - if (xyz instanceof NullObject) { - return xyz; + if (xyz === null) { + return null; } [, x, y, z, alpha] = xyz as ComputedColorChannels; } else if (value.startsWith(FN_COLOR)) { @@ -2625,12 +2591,12 @@ export const convertColorToLab = ( * convert color value to lch * @param value - CSS color value * @param [opt] - options - * @returns ColorChannels | NullObject - [l, c, h, alpha], hue may be powerless + * @returns ColorChannels | null - [l, c, h, alpha], hue may be powerless */ export const convertColorToLch = ( value: string, opt: Options = {} -): ColorChannels | [number, number, number | string, number] | NullObject => { +): ColorChannels | [number, number, number | string, number] | null => { if (isString(value)) { value = value.trim(); } else { @@ -2653,8 +2619,8 @@ export const convertColorToLch = ( } else { xyz = parseColorValue(value, opt); } - if (xyz instanceof NullObject) { - return xyz; + if (xyz === null) { + return null; } [, x, y, z, alpha] = xyz as ComputedColorChannels; } else if (value.startsWith(FN_COLOR)) { @@ -2674,12 +2640,12 @@ export const convertColorToLch = ( * convert color value to oklab * @param value - CSS color value * @param [opt] - options - * @returns ColorChannels | NullObject - [l, a, b, alpha] + * @returns ColorChannels | null - [l, a, b, alpha] */ export const convertColorToOklab = ( value: string, opt: Options = {} -): ColorChannels | NullObject => { +): ColorChannels | null => { if (isString(value)) { value = value.trim(); } else { @@ -2701,8 +2667,8 @@ export const convertColorToOklab = ( } else { xyz = parseColorValue(value, opt); } - if (xyz instanceof NullObject) { - return xyz; + if (xyz === null) { + return null; } [, x, y, z, alpha] = xyz as ComputedColorChannels; } else if (value.startsWith(FN_COLOR)) { @@ -2718,12 +2684,12 @@ export const convertColorToOklab = ( * convert color value to oklch * @param value - CSS color value * @param [opt] - options - * @returns ColorChannels | NullObject - [l, c, h, alpha], hue may be powerless + * @returns ColorChannels | null - [l, c, h, alpha], hue may be powerless */ export const convertColorToOklch = ( value: string, opt: Options = {} -): ColorChannels | [number, number, number | string, number] | NullObject => { +): ColorChannels | [number, number, number | string, number] | null => { if (isString(value)) { value = value.trim(); } else { @@ -2745,8 +2711,8 @@ export const convertColorToOklch = ( } else { xyz = parseColorValue(value, opt); } - if (xyz instanceof NullObject) { - return xyz; + if (xyz === null) { + return null; } [, x, y, z, alpha] = xyz as ComputedColorChannels; } else if (value.startsWith(FN_COLOR)) { @@ -2762,12 +2728,12 @@ export const convertColorToOklch = ( * resolve color-mix() * @param value - color-mix color value * @param [opt] - options - * @returns resolved color - [cs, v1, v2, v3, alpha], '(empty)' + * @returns resolved color - [cs, v1, v2, v3, alpha], '(empty)', null */ export const resolveColorMix = ( value: string, opt: Options = {} -): SpecifiedColorChannels | string | NullObject => { +): SpecifiedColorChannels | string | null => { if (isString(value)) { value = value.toLowerCase().trim(); } else { @@ -2783,15 +2749,8 @@ export const resolveColorMix = ( opt ); const cachedResult = getCache(cacheKey); - if (cachedResult instanceof CacheItem) { - if (cachedResult.isNull) { - return cachedResult as NullObject; - } - const cachedItem = cachedResult.item; - if (isString(cachedItem)) { - return cachedItem as string; - } - return cachedItem as SpecifiedColorChannels; + if (cachedResult !== false) { + return cachedResult.item as SpecifiedColorChannels | string | null; } const nestedItems = []; let colorSpace = ''; @@ -3128,7 +3087,7 @@ export const resolveColorMix = ( }); } } - if (rgbA instanceof NullObject || rgbB instanceof NullObject) { + if (rgbA === null || rgbB === null) { const res = cacheInvalidColorValue(cacheKey, format, nullable); return res; } @@ -3192,7 +3151,7 @@ export const resolveColorMix = ( format: VAL_MIX }); } - if (xyzA instanceof NullObject || xyzB instanceof NullObject) { + if (xyzA === null || xyzB === null) { const res = cacheInvalidColorValue(cacheKey, format, nullable); return res; } @@ -3276,7 +3235,7 @@ export const resolveColorMix = ( }); } } - if (hslA instanceof NullObject || hslB instanceof NullObject) { + if (hslA === null || hslB === null) { const res = cacheInvalidColorValue(cacheKey, format, nullable); return res; } @@ -3356,7 +3315,7 @@ export const resolveColorMix = ( }); } } - if (lchA instanceof NullObject || lchB instanceof NullObject) { + if (lchA === null || lchB === null) { const res = cacheInvalidColorValue(cacheKey, format, nullable); return res; } @@ -3439,7 +3398,7 @@ export const resolveColorMix = ( }); } } - if (labA instanceof NullObject || labB instanceof NullObject) { + if (labA === null || labB === null) { const res = cacheInvalidColorValue(cacheKey, format, nullable); return res; } diff --git a/src/js/convert.ts b/src/js/convert.ts index 104bf96..1d925e0 100644 --- a/src/js/convert.ts +++ b/src/js/convert.ts @@ -2,13 +2,7 @@ * convert */ -import { - CacheItem, - NullObject, - createCacheKey, - getCache, - setCache -} from './cache'; +import { createCacheKey, getCache, setCache } from './cache'; import { convertColorToHsl, convertColorToHwb, @@ -43,36 +37,30 @@ const REG_FN_VAR = new RegExp(SYN_FN_VAR); * @param [opt] - options * @returns value */ -export const preProcess = ( - value: string, - opt: Options = {} -): string | NullObject => { +export const preProcess = (value: string, opt: Options = {}): string | null => { if (!isString(value)) { - return new NullObject(); + return null; } value = value.trim(); if (!value) { - return new NullObject(); + return null; } const cacheKey: string = createCacheKey( { namespace: NAMESPACE, name: 'preProcess', value }, opt ); const cachedResult = getCache(cacheKey); - if (cachedResult instanceof CacheItem) { - if (cachedResult.isNull) { - return cachedResult as NullObject; - } - return cachedResult.item as string; + if (cachedResult !== false) { + return cachedResult.item as string | null; } - let res: string | NullObject = value; + let res: string | null = value; if (REG_FN_VAR.test(value)) { const resolved = resolveVar(value, opt); if (isString(resolved)) { res = resolved; } else { setCache(cacheKey, null); - return new NullObject(); + return null; } } if (isString(res)) { @@ -82,7 +70,7 @@ export const preProcess = ( res = resolved; } else { setCache(cacheKey, null); - return new NullObject(); + return null; } } else if (REG_FN_CALC.test(res)) { res = cssCalc(res, opt); @@ -90,7 +78,12 @@ export const preProcess = ( } if (isString(res)) { if (res.startsWith('color-mix')) { - res = resolveColor(res, { ...opt, format: VAL_COMP, nullable: true }); + const resolvedColorMix = resolveColor(res, { + ...opt, + format: VAL_COMP, + nullable: true + }); + res = typeof resolvedColorMix === 'string' ? resolvedColorMix : null; } } setCache(cacheKey, res); @@ -117,7 +110,7 @@ const createColorConverter = ( throw new TypeError(`${value} is not a string.`); } const resolved = preProcess(value, opt); - if (resolved instanceof NullObject) { + if (resolved === null) { return [0, 0, 0, 0]; } const val = resolved.toLowerCase(); @@ -126,7 +119,7 @@ const createColorConverter = ( opt ); const cached = getCache(cacheKey); - if (cached instanceof CacheItem) { + if (cached !== false) { return cached.item as ColorChannels; } const result = convertFn(val, { ...opt, format }) as ColorChannels; @@ -155,7 +148,7 @@ export const colorToHex = (value: string, opt: Options = {}): string | null => { throw new TypeError(`${value} is not a string.`); } const resolved = preProcess(value, opt); - if (resolved instanceof NullObject) { + if (resolved === null) { return null; } const val = resolved.toLowerCase(); @@ -164,11 +157,8 @@ export const colorToHex = (value: string, opt: Options = {}): string | null => { opt ); const cached = getCache(cacheKey); - if (cached instanceof CacheItem) { - if (cached.isNull) { - return null; - } - return cached.item as string; + if (cached !== false) { + return cached.item as string | null; } const hex = resolveColor(val, { ...opt, @@ -278,7 +268,7 @@ export const colorToXyz = (value: string, opt: Options = {}): ColorChannels => { throw new TypeError(`${value} is not a string.`); } const resolved = preProcess(value, opt); - if (resolved instanceof NullObject) { + if (resolved === null) { return [0, 0, 0, 0]; } const val = resolved.toLowerCase(); @@ -287,7 +277,7 @@ export const colorToXyz = (value: string, opt: Options = {}): ColorChannels => { opt ); const cached = getCache(cacheKey); - if (cached instanceof CacheItem) { + if (cached !== false) { return cached.item as ColorChannels; } let parsed; diff --git a/src/js/css-calc.ts b/src/js/css-calc.ts index 62e9a23..5a5dbf4 100644 --- a/src/js/css-calc.ts +++ b/src/js/css-calc.ts @@ -4,13 +4,7 @@ import { calc, conversionOptions as CalcOptions } from '@csstools/css-calc'; import { CSSToken, TokenType, tokenize } from '@csstools/css-tokenizer'; -import { - CacheItem, - NullObject, - createCacheKey, - getCache, - setCache -} from './cache'; +import { createCacheKey, getCache, setCache } from './cache'; import { isString, isStringOrNumber } from './common'; import { resolveVar } from './css-var'; import { resolveLengthInPixels, roundToPrecision } from './util'; @@ -752,7 +746,7 @@ export const serializeCalc = (value: string, opt: Options = {}): string => { opt ); const cachedResult = getCache(cacheKey); - if (cachedResult instanceof CacheItem) { + if (cachedResult !== false) { return cachedResult.item as string; } const items: string[] = tokenize({ css: value }) @@ -831,7 +825,7 @@ export const serializeCalc = (value: string, opt: Options = {}): string => { export const resolveDimension = ( token: CSSToken, opt: Options = {} -): string | NullObject => { +): string | null => { if (!Array.isArray(token)) { throw new TypeError(`${token} is not an array.`); } @@ -847,7 +841,7 @@ export const resolveDimension = ( if (Number.isFinite(pixelValue)) { return `${roundToPrecision(pixelValue, HEX)}px`; } - return new NullObject(); + return null; }; /** @@ -971,7 +965,7 @@ export const cssCalc = (value: string, opt: Options = {}): string => { opt ); const cachedResult = getCache(cacheKey); - if (cachedResult instanceof CacheItem) { + if (cachedResult !== false) { return cachedResult.item as string; } const tokens = tokenize({ css: value }); diff --git a/src/js/css-gradient.ts b/src/js/css-gradient.ts index 76be172..8693131 100644 --- a/src/js/css-gradient.ts +++ b/src/js/css-gradient.ts @@ -2,7 +2,7 @@ * css-gradient */ -import { CacheItem, createCacheKey, getCache, setCache } from './cache'; +import { createCacheKey, getCache, setCache } from './cache'; import { resolveColor } from './resolve'; import { isString } from './common'; import { MatchedRegExp, Options } from './typedef'; @@ -270,11 +270,8 @@ export const parseGradient = ( opt ); const cachedResult = getCache(cacheKey); - if (cachedResult instanceof CacheItem) { - if (cachedResult.isNull) { - return null; - } - return cachedResult.item as Gradient; + if (cachedResult !== false) { + return cachedResult.item as Gradient | null; } const type = getGradientType(value); const gradValue = value.replace(REG_GRAD, '').replace(/\)$/, ''); diff --git a/src/js/css-var.ts b/src/js/css-var.ts index a488edd..c97ef6f 100644 --- a/src/js/css-var.ts +++ b/src/js/css-var.ts @@ -3,13 +3,7 @@ */ import { CSSToken, TokenType, tokenize } from '@csstools/css-tokenizer'; -import { - CacheItem, - NullObject, - createCacheKey, - getCache, - setCache -} from './cache'; +import { createCacheKey, getCache, setCache } from './cache'; import { isString } from './common'; import { cssCalc } from './css-calc'; import { isColor } from './util'; @@ -122,7 +116,7 @@ export function resolveCustomProperty( export function parseTokens( tokens: CSSToken[], opt: Options = {} -): string[] | NullObject { +): string[] | null { const res: string[] = []; while (tokens.length) { const token = tokens.shift(); @@ -131,7 +125,7 @@ export function parseTokens( if (value === FN_VAR) { const [, resolvedValue] = resolveCustomProperty(tokens, opt); if (!resolvedValue) { - return new NullObject(); + return null; } res.push(resolvedValue); } else { @@ -178,10 +172,7 @@ export function parseTokens( * @param [opt] - options * @returns resolved value */ -export function resolveVar( - value: string, - opt: Options = {} -): string | NullObject { +export function resolveVar(value: string, opt: Options = {}): string | null { const { format = '' } = opt; if (isString(value)) { if (!REG_FN_VAR.test(value) || format === VAL_SPEC) { @@ -200,11 +191,8 @@ export function resolveVar( opt ); const cachedResult = getCache(cacheKey); - if (cachedResult instanceof CacheItem) { - if (cachedResult.isNull) { - return cachedResult as NullObject; - } - return cachedResult.item as string; + if (cachedResult !== false) { + return cachedResult.item as string | null; } const tokens = tokenize({ css: value }); const values = parseTokens(tokens, opt); @@ -217,7 +205,7 @@ export function resolveVar( return color; } else { setCache(cacheKey, null); - return new NullObject(); + return null; } } diff --git a/src/js/relative-color.ts b/src/js/relative-color.ts index dedee92..939adf2 100644 --- a/src/js/relative-color.ts +++ b/src/js/relative-color.ts @@ -8,13 +8,7 @@ import { parseComponentValue } from '@csstools/css-parser-algorithms'; import { CSSToken, TokenType, tokenize } from '@csstools/css-tokenizer'; -import { - CacheItem, - NullObject, - createCacheKey, - getCache, - setCache -} from './cache'; +import { createCacheKey, getCache, setCache } from './cache'; import { NAMED_COLORS, convertColorToRgb } from './color'; import { isString, isStringOrNumber } from './common'; import { resolveDimension, serializeCalc } from './css-calc'; @@ -141,7 +135,7 @@ const REG_FN_VAR = new RegExp(SYN_FN_VAR); export function resolveColorChannels( tokens: CSSToken[], opt: Options = {} -): NumberOrStringColorChannels | NullObject { +): NumberOrStringColorChannels | null { if (!Array.isArray(tokens)) { throw new TypeError(`${tokens} is not an array.`); } @@ -149,7 +143,7 @@ export function resolveColorChannels( const colorChannel = COLOR_CHANNELS.get(colorSpace); // invalid color channel if (!colorChannel) { - return new NullObject(); + return null; } const mathFunc = new Set(); const channels: [ @@ -183,7 +177,7 @@ export function resolveColorChannels( precededPct && !REG_FN_CALC_SUM.test(func) ) { - return new NullObject(); + return null; } precededPct = false; channel.push(value); @@ -192,7 +186,7 @@ export function resolveColorChannels( } case DIM: { if (!func || !REG_FN_CALC_SUM.test(func)) { - return new NullObject(); + return null; } const resolvedValue = resolveDimension(token, opt); if (isString(resolvedValue)) { @@ -214,7 +208,7 @@ export function resolveColorChannels( case IDENT: { // invalid channel key if (!colorChannel.includes(value)) { - return new NullObject(); + return null; } channel.push(value); if (!func) { @@ -255,7 +249,7 @@ export function resolveColorChannels( } case PCT: { if (!func) { - return new NullObject(); + return null; } else if (!REG_FN_CALC_SUM.test(func)) { let lastValue: string | number | undefined; for (let j = channel.length - 1; j >= 0; j--) { @@ -265,7 +259,7 @@ export function resolveColorChannels( } } if (lastValue === '+' || lastValue === '-') { - return new NullObject(); + return null; } else if (lastValue === '*' || lastValue === '/') { precededPct = false; } else { @@ -324,18 +318,18 @@ export function resolveColorChannels( export function extractOriginColor( value: string, opt: Options = {} -): string | NullObject { +): string | null { const { colorScheme = 'normal', currentColor = '', format = '' } = opt; if (isString(value)) { value = value.toLowerCase().trim(); if (!value) { - return new NullObject(); + return null; } if (!REG_FN_REL_START.test(value)) { return value; } } else { - return new NullObject(); + return null; } const cacheKey: string = createCacheKey( { @@ -346,18 +340,15 @@ export function extractOriginColor( opt ); const cachedResult = getCache(cacheKey); - if (cachedResult instanceof CacheItem) { - if (cachedResult.isNull) { - return cachedResult as NullObject; - } - return cachedResult.item as string; + if (cachedResult !== false) { + return cachedResult.item as string | null; } if (/currentcolor/.test(value)) { if (currentColor) { value = value.replace(/currentcolor/g, currentColor); } else { setCache(cacheKey, null); - return new NullObject(); + return null; } } let colorSpace = ''; @@ -376,7 +367,7 @@ export function extractOriginColor( }) as string; if (specifiedOriginColor === '') { setCache(cacheKey, null); - return new NullObject(); + return null; } if (format === VAL_SPEC) { value = value.replace(originColor, specifiedOriginColor); @@ -396,7 +387,7 @@ export function extractOriginColor( !Object.hasOwn(NAMED_COLORS, originColor) ) { setCache(cacheKey, null); - return new NullObject(); + return null; } } else if (format === VAL_SPEC) { const resolvedOriginColor = resolveColor(originColor, opt); @@ -407,9 +398,9 @@ export function extractOriginColor( if (format === VAL_SPEC) { const tokens = tokenize({ css: restValue }); const channelValues = resolveColorChannels(tokens, opt); - if (channelValues instanceof NullObject) { + if (channelValues === null) { setCache(cacheKey, null); - return channelValues; + return null; } const [v1, v2, v3, v4] = channelValues; let channelValue = ''; @@ -473,14 +464,14 @@ export function extractOriginColor( originColor.join('').trim(), opt ); - if (resolvedOriginColor instanceof NullObject) { + if (resolvedOriginColor === null) { setCache(cacheKey, null); - return resolvedOriginColor; + return null; } const channelValues = resolveColorChannels(tokens.slice(tokenIndex), opt); - if (channelValues instanceof NullObject) { + if (channelValues === null) { setCache(cacheKey, null); - return channelValues; + return null; } const [v1, v2, v3, v4] = channelValues; let channelValue = ''; @@ -504,7 +495,7 @@ export function extractOriginColor( export function resolveRelativeColor( value: string, opt: Options = {} -): string | NullObject { +): string | null { const { format = '' } = opt; if (isString(value)) { if (REG_FN_VAR.test(value)) { @@ -529,16 +520,13 @@ export function resolveRelativeColor( opt ); const cachedResult = getCache(cacheKey); - if (cachedResult instanceof CacheItem) { - if (cachedResult.isNull) { - return cachedResult as NullObject; - } - return cachedResult.item as string; + if (cachedResult !== false) { + return cachedResult.item as string | null; } const originColor = extractOriginColor(value, opt); - if (originColor instanceof NullObject) { + if (originColor === null) { setCache(cacheKey, null); - return originColor; + return null; } value = originColor; if (format === VAL_SPEC) { @@ -554,7 +542,7 @@ export function resolveRelativeColor( const parsedComponents = colorParser(components); if (!parsedComponents) { setCache(cacheKey, null); - return new NullObject(); + return null; } const { alpha: alphaComponent, diff --git a/src/js/resolve.ts b/src/js/resolve.ts index 4768778..74be6f9 100644 --- a/src/js/resolve.ts +++ b/src/js/resolve.ts @@ -2,13 +2,7 @@ * resolve */ -import { - CacheItem, - NullObject, - createCacheKey, - getCache, - setCache -} from './cache'; +import { createCacheKey, getCache, setCache } from './cache'; import { convertRgbToHex, resolveColorFunc, @@ -55,7 +49,7 @@ const REG_FN_VAR = new RegExp(SYN_FN_VAR); export const resolveColor = ( value: string, opt: Options = {} -): string | NullObject => { +): string | null => { if (!isString(value)) { throw new TypeError(`${value} is not a string.`); } @@ -71,11 +65,8 @@ export const resolveColor = ( opt ); const cachedResult = getCache(cacheKey); - if (cachedResult instanceof CacheItem) { - if (cachedResult.isNull) { - return cachedResult as NullObject; - } - return cachedResult.item as string; + if (cachedResult !== false) { + return cachedResult.item as string | null; } // 1. var() resolution if (REG_FN_VAR.test(value)) { @@ -84,10 +75,10 @@ export const resolveColor = ( return value; } const resolvedVar = resolveVar(value, opt); - if (resolvedVar instanceof NullObject) { + if (resolvedVar === null) { const res = format === 'hex' || format === 'hexAlpha' || nullable - ? resolvedVar + ? null : RGB_TRANSPARENT; setCache(cacheKey, res); return res; @@ -115,20 +106,19 @@ export const resolveColor = ( } const chosen = colorScheme === 'dark' ? dark : light; const resolved = resolveColor(chosen, opt); - const res = - resolved instanceof NullObject && !nullable - ? RGB_TRANSPARENT - : resolved; + const res = resolved === null && !nullable ? RGB_TRANSPARENT : resolved; setCache(cacheKey, res); return res; } // fallback for invalid light-dark - const invalidRes = - format === VAL_SPEC - ? '' - : format === 'hex' || format === 'hexAlpha' - ? new NullObject() - : RGB_TRANSPARENT; + let invalidRes; + if (format === VAL_SPEC) { + invalidRes = ''; + } else if (format === 'hex' || format === 'hexAlpha') { + invalidRes = null; + } else { + invalidRes = RGB_TRANSPARENT; + } setCache(cacheKey, invalidRes); return invalidRes; } @@ -137,18 +127,16 @@ export const resolveColor = ( const resolvedRel = resolveRelativeColor(value, opt); if (format === VAL_COMP) { const res = - resolvedRel instanceof NullObject && !nullable - ? RGB_TRANSPARENT - : resolvedRel; + resolvedRel === null && !nullable ? RGB_TRANSPARENT : resolvedRel; setCache(cacheKey, res); return res; } if (format === VAL_SPEC) { - const res = resolvedRel instanceof NullObject ? '' : resolvedRel; + const res = resolvedRel === null ? '' : resolvedRel; setCache(cacheKey, res); return res; } - value = resolvedRel instanceof NullObject ? '' : resolvedRel; + value = resolvedRel === null ? '' : resolvedRel; } // 4. calc() resolution if (REG_FN_CALC.test(value)) { @@ -161,14 +149,14 @@ export const resolveColor = ( let b = NaN; let alpha = NaN; if (value === 'transparent') { - let res: string | NullObject; + let res: string | null; switch (format) { case VAL_SPEC: { res = value; break; } case 'hex': { - res = new NullObject(); + res = null; break; } case 'hexAlpha': { @@ -196,9 +184,9 @@ export const resolveColor = ( } else { resolvedCurrent = resolveColorValue(currentColor, opt); } - if (resolvedCurrent instanceof NullObject) { - setCache(cacheKey, resolvedCurrent); - return resolvedCurrent; + if (resolvedCurrent === null) { + setCache(cacheKey, null); + return null; } [cs, r, g, b, alpha] = resolvedCurrent as ComputedColorChannels; } else { @@ -212,21 +200,24 @@ export const resolveColor = ( } else if (format === VAL_SPEC) { let res = ''; if (value.startsWith(FN_MIX)) { - res = resolveColorMix(value, opt) as string; + const mixRes = resolveColorMix(value, opt); + res = mixRes ? (mixRes as string) : ''; } else if (value.startsWith(FN_COLOR)) { - const [scs, rr, gg, bb, aa] = resolveColorFunc( - value, - opt - ) as SpecifiedColorChannels; - res = - aa === 1 - ? `color(${scs} ${rr} ${gg} ${bb})` - : `color(${scs} ${rr} ${gg} ${bb} / ${aa})`; + const funcRes = resolveColorFunc(value, opt); + if (isString(funcRes)) { + res = funcRes; + } else if (Array.isArray(funcRes)) { + const [scs, rr, gg, bb, aa] = funcRes as SpecifiedColorChannels; + res = + aa === 1 + ? `color(${scs} ${rr} ${gg} ${bb})` + : `color(${scs} ${rr} ${gg} ${bb} / ${aa})`; + } } else { const rgb = resolveColorValue(value, opt); if (isString(rgb)) { res = rgb; - } else { + } else if (Array.isArray(rgb)) { const [scs, rr, gg, bb, aa] = rgb as SpecifiedColorChannels; if (scs === 'rgb') { res = @@ -249,28 +240,28 @@ export const resolveColor = ( } value = value.replace(/transparent/g, RGB_TRANSPARENT); const resolvedMix = resolveColorMix(value, opt); - if (resolvedMix instanceof NullObject) { - setCache(cacheKey, resolvedMix); - return resolvedMix; + if (resolvedMix === null) { + setCache(cacheKey, null); + return null; } [cs, r, g, b, alpha] = resolvedMix as ComputedColorChannels; } else if (value.startsWith(FN_COLOR)) { const resolvedFunc = resolveColorFunc(value, opt); - if (resolvedFunc instanceof NullObject) { - setCache(cacheKey, resolvedFunc); - return resolvedFunc; + if (resolvedFunc === null) { + setCache(cacheKey, null); + return null; } [cs, r, g, b, alpha] = resolvedFunc as ComputedColorChannels; } else if (value) { const resolvedVal = resolveColorValue(value, opt); - if (resolvedVal instanceof NullObject) { - setCache(cacheKey, resolvedVal); - return resolvedVal; + if (resolvedVal === null) { + setCache(cacheKey, null); + return null; } [cs, r, g, b, alpha] = resolvedVal as ComputedColorChannels; } // 6. Format Finalization - let finalRes: string | NullObject = ''; + let finalRes: string | null = ''; switch (format) { case 'hex': case 'hexAlpha': { @@ -281,7 +272,7 @@ export const resolveColor = ( Number.isNaN(alpha) || (format === 'hex' && alpha === 0) ) { - finalRes = new NullObject(); + finalRes = null; } else { finalRes = convertRgbToHex([r, g, b, format === 'hex' ? 1 : alpha]); } @@ -314,9 +305,9 @@ export const resolveColor = ( * resolve CSS color * @param value - CSS color value. system colors are not supported * @param [opt] - options + * @returns resolved value */ export const resolve = (value: string, opt: Options = {}): string | null => { opt.nullable = false; - const resolvedValue = resolveColor(value, opt); - return resolvedValue instanceof NullObject ? null : (resolvedValue as string); + return resolveColor(value, opt); }; diff --git a/test/cache.test.ts b/test/cache.test.ts index a6af67e..149b98f 100644 --- a/test/cache.test.ts +++ b/test/cache.test.ts @@ -168,36 +168,25 @@ describe('CacheItem', () => { it('should create instance', () => { const item = new CacheItem(); assert.strictEqual(item instanceof CacheItem, true, 'instance'); - assert.strictEqual(item.isNull, false, 'isNull'); + assert.strictEqual(item.isNull, undefined, 'isNull'); assert.strictEqual(item.item, undefined, 'item'); }); it('should create instance', () => { const item = new CacheItem('foo'); assert.strictEqual(item instanceof CacheItem, true, 'instance'); - assert.strictEqual(item.isNull, false, 'isNull'); + assert.strictEqual(item.isNull, undefined, 'isNull'); assert.strictEqual(item.item, 'foo', 'item'); }); it('should create instance', () => { const item = new CacheItem(['foo', 1, 'bar']); assert.strictEqual(item instanceof CacheItem, true, 'instance'); - assert.strictEqual(item.isNull, false, 'isNull'); + assert.strictEqual(item.isNull, undefined, 'isNull'); assert.deepEqual(item.item, ['foo', 1, 'bar'], 'item'); }); }); -describe('NullObject', () => { - const { CacheItem, NullObject } = cache; - - it('should create instance', () => { - const item = new NullObject(); - assert.strictEqual(item instanceof NullObject, true, 'instance'); - assert.strictEqual(item instanceof CacheItem, true, 'instance'); - assert.strictEqual(item.isNull, true, 'isNull'); - }); -}); - describe('set cache', () => { const { CacheItem, genCache } = cache; const func = cache.setCache; @@ -240,7 +229,7 @@ describe('set cache', () => { }); describe('get cache', () => { - const { CacheItem, NullObject, genCache, setCache } = cache; + const { CacheItem, genCache, setCache } = cache; const func = cache.getCache; beforeEach(() => { @@ -254,7 +243,6 @@ describe('get cache', () => { setCache('foo'); const res = func('foo'); assert.strictEqual(res instanceof CacheItem, true, 'instance'); - assert.strictEqual(res instanceof NullObject, false, 'instance'); assert.strictEqual((res as CacheItem).item, undefined, 'result'); }); @@ -262,15 +250,14 @@ describe('get cache', () => { setCache('bar', 'bar'); const res = func('bar'); assert.strictEqual(res instanceof CacheItem, true, 'instance'); - assert.strictEqual(res instanceof NullObject, false, 'instance'); assert.strictEqual((res as CacheItem).item, 'bar', 'result'); }); - it('should get null object', () => { + it('should get null', () => { setCache('baz', null); const res = func('baz'); assert.strictEqual(res instanceof CacheItem, true, 'instance'); - assert.strictEqual(res instanceof NullObject, true, 'instance'); + assert.strictEqual((res as CacheItem).item, null, 'result'); }); it('should get false', () => { diff --git a/test/color.test.ts b/test/color.test.ts index fe61894..a28572f 100644 --- a/test/color.test.ts +++ b/test/color.test.ts @@ -6,7 +6,7 @@ import { afterEach, assert, beforeEach, describe, it } from 'vitest'; /* test */ -import { NullObject, genCache } from '../src/js/cache'; +import { genCache } from '../src/js/cache'; import * as color from '../src/js/color'; beforeEach(() => { @@ -39,10 +39,9 @@ describe('cache invalid color value', () => { assert.deepEqual(res, ['rgb', 0, 0, 0, 0], 'result'); }); - it('should get null object', () => { + it('should get null', () => { const res = func('foo', 'computedValue', true); - assert.strictEqual(res.isNull, true, 'result'); - assert.strictEqual(res instanceof NullObject, true, 'result'); + assert.strictEqual(res, null, 'result'); }); }); @@ -59,10 +58,9 @@ describe('resolve invalid color value', () => { assert.deepEqual(res, ['rgb', 0, 0, 0, 0], 'result'); }); - it('should get null object', () => { + it('should get null', () => { const res = func('foo', true); - assert.strictEqual(res.isNull, true, 'result'); - assert.strictEqual(res instanceof NullObject, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get value', () => { @@ -70,33 +68,29 @@ describe('resolve invalid color value', () => { assert.deepEqual(res, ['rgb', 0, 0, 0, 0], 'result'); }); - it('should get null object', () => { + it('should get null', () => { const res = func('computedValue', true); - assert.strictEqual(res.isNull, true, 'result'); - assert.strictEqual(res instanceof NullObject, true, 'result'); + assert.strictEqual(res, null, 'result'); }); - it('should get null object', () => { + it('should get null', () => { const res = func('hsl'); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); - it('should get null object', () => { + it('should get null', () => { const res = func('hwb'); - assert.strictEqual(res.isNull, true, 'result'); - assert.strictEqual(res instanceof NullObject, true, 'result'); + assert.strictEqual(res, null, 'result'); }); - it('should get null object', () => { + it('should get null', () => { const res = func('mixValue'); - assert.strictEqual(res.isNull, true, 'result'); - assert.strictEqual(res instanceof NullObject, true, 'result'); + assert.strictEqual(res, null, 'result'); }); - it('should get null object', () => { + it('should get null', () => { const res = func('mixValue'); - assert.strictEqual(res.isNull, true, 'result'); - assert.strictEqual(res instanceof NullObject, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get empty string', () => { @@ -2437,7 +2431,7 @@ describe('parse rgb()', () => { const res = func('rgb(1, 2, 3 / 1)', { format: 'mixValue' }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get value', () => { @@ -2452,7 +2446,7 @@ describe('parse rgb()', () => { format: 'computedValue', nullable: true }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get value', () => { @@ -2574,7 +2568,7 @@ describe('parse hsl()', () => { const res = func('hsl(1, 2%, 3% / 1)', { format: 'mixValue' }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get value', () => { @@ -2589,14 +2583,14 @@ describe('parse hsl()', () => { format: 'computedValue', nullable: true }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get null object', () => { const res = func('hsl(1, 2%, 3% / 1)', { format: 'hsl' }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get value', () => { @@ -2747,7 +2741,7 @@ describe('parse hwb()', () => { const res = func('hsw(1, 20%, 30% / 1)', { format: 'mixValue' }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get value', () => { @@ -2762,14 +2756,14 @@ describe('parse hwb()', () => { format: 'computedValue', nullable: true }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get null object', () => { const res = func('hsw(1, 20%, 30% / 1)', { format: 'hwb' }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get value', () => { @@ -2945,7 +2939,7 @@ describe('parse lab()', () => { const res = func('lab(100%, 20%, 30% / 1)', { format: 'mixValue' }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get value', () => { @@ -2960,7 +2954,7 @@ describe('parse lab()', () => { format: 'computedValue', nullable: true }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get value', () => { @@ -3183,7 +3177,7 @@ describe('parse lch()', () => { const res = func('lch(100%, 20%, 30% / 1)', { format: 'mixValue' }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get value', () => { @@ -3198,7 +3192,7 @@ describe('parse lch()', () => { format: 'computedValue', nullable: true }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get value', () => { @@ -3420,7 +3414,7 @@ describe('parse oklab()', () => { const res = func('oklab(100%, 20%, 30% / 1)', { format: 'mixValue' }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get value', () => { @@ -3435,7 +3429,7 @@ describe('parse oklab()', () => { format: 'computedValue', nullable: true }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get value', () => { @@ -3666,7 +3660,7 @@ describe('parse oklch()', () => { const res = func('oklch(100%, 20%, 30% / 1)', { format: 'mixValue' }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get value', () => { @@ -3681,7 +3675,7 @@ describe('parse oklch()', () => { format: 'computedValue', nullable: true }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get value', () => { @@ -3907,7 +3901,7 @@ describe('parse color func', () => { const res = func('color(in foo, 1 1 1)', { format: 'mixValue' }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get value', () => { @@ -3922,7 +3916,7 @@ describe('parse color func', () => { format: 'computedValue', nullable: true }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get value', () => { @@ -4398,7 +4392,7 @@ describe('parse color value', () => { format: 'computedValue', nullable: true }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get empty string', () => { @@ -4412,7 +4406,7 @@ describe('parse color value', () => { const res = func('foo', { format: 'mixValue' }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get value', () => { @@ -4439,7 +4433,7 @@ describe('parse color value', () => { format: 'computedValue', nullable: true }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get empty string', () => { @@ -4453,7 +4447,7 @@ describe('parse color value', () => { const res = func('foo(1 1 1 / 1)', { format: 'mixValue' }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get value', () => { @@ -4835,13 +4829,13 @@ describe('resolve color value', () => { format: 'computedValue', nullable: true }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); const res2 = func('#12345', { format: 'computedValue', nullable: true }); - assert.strictEqual(res2.isNull, true, 'result'); + assert.strictEqual(res2, null, 'result'); }); it('should get null object', () => { @@ -4852,7 +4846,7 @@ describe('resolve color value', () => { callback: () => {} } }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); const res2 = func('#12345', { format: 'computedValue', @@ -4861,7 +4855,7 @@ describe('resolve color value', () => { callback: () => {} } }); - assert.strictEqual(res2.isNull, true, 'result'); + assert.strictEqual(res2, null, 'result'); }); it('should get empty string', () => { @@ -4880,12 +4874,12 @@ describe('resolve color value', () => { const res = func('#12345', { format: 'mixValue' }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); const res2 = func('#12345', { format: 'mixValue' }); - assert.strictEqual(res2.isNull, true, 'result'); + assert.strictEqual(res2, null, 'result'); }); it('should get null object', () => { @@ -4895,7 +4889,7 @@ describe('resolve color value', () => { callback: () => {} } }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); const res2 = func('#12345', { format: 'mixValue', @@ -4903,7 +4897,7 @@ describe('resolve color value', () => { callback: () => {} } }); - assert.strictEqual(res2.isNull, true, 'result'); + assert.strictEqual(res2, null, 'result'); }); it('should get value', () => { @@ -4923,7 +4917,7 @@ describe('resolve color value', () => { format: 'computedValue', nullable: true }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get empty string', () => { @@ -4937,7 +4931,7 @@ describe('resolve color value', () => { const res = func('rgb(foo 128 255)', { format: 'mixValue' }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get value', () => { @@ -4957,7 +4951,7 @@ describe('resolve color value', () => { format: 'computedValue', nullable: true }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get empty string', () => { @@ -4971,12 +4965,12 @@ describe('resolve color value', () => { const res = func('foo', { format: 'mixValue' }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); const res2 = func('foo', { format: 'mixValue' }); - assert.strictEqual(res2.isNull, true, 'result'); + assert.strictEqual(res2, null, 'result'); }); it('should get null object', () => { @@ -4986,7 +4980,7 @@ describe('resolve color value', () => { callback: () => {} } }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); const res2 = func('foo', { format: 'mixValue', @@ -4994,7 +4988,7 @@ describe('resolve color value', () => { callback: () => {} } }); - assert.strictEqual(res2.isNull, true, 'result'); + assert.strictEqual(res2, null, 'result'); }); it('should get value', () => { @@ -5263,7 +5257,7 @@ describe('resolve color value', () => { format: 'computedValue', nullable: true }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get value', () => { @@ -5296,7 +5290,7 @@ describe('resolve color value', () => { format: 'computedValue', nullable: true }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get value', () => { @@ -5528,13 +5522,13 @@ describe('resolve color()', () => { format: 'computedValue', nullable: true }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); const res2 = func('color(in foo, 1 1 1)', { format: 'computedValue', nullable: true }); - assert.strictEqual(res2.isNull, true, 'result'); + assert.strictEqual(res2, null, 'result'); }); it('should get null object', () => { @@ -5545,7 +5539,7 @@ describe('resolve color()', () => { callback: () => {} } }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); const res2 = func('color(in foo, 1 1 1)', { format: 'computedValue', @@ -5554,7 +5548,7 @@ describe('resolve color()', () => { callback: () => {} } }); - assert.strictEqual(res2.isNull, true, 'result'); + assert.strictEqual(res2, null, 'result'); }); it('should get empty string', () => { @@ -5591,12 +5585,12 @@ describe('resolve color()', () => { const res = func('color(in foo, 1 1 1)', { format: 'mixValue' }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); const res2 = func('color(in foo, 1 1 1)', { format: 'mixValue' }); - assert.strictEqual(res2.isNull, true, 'result'); + assert.strictEqual(res2, null, 'result'); }); it('should get null object', () => { @@ -5606,7 +5600,7 @@ describe('resolve color()', () => { callback: () => {} } }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); const res2 = func('color(in foo, 1 1 1)', { format: 'mixValue', @@ -5614,7 +5608,7 @@ describe('resolve color()', () => { callback: () => {} } }); - assert.strictEqual(res2.isNull, true, 'result'); + assert.strictEqual(res2, null, 'result'); }); it('should get value', () => { @@ -5634,7 +5628,7 @@ describe('resolve color()', () => { format: 'computedValue', nullable: true }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get empty string', () => { @@ -5648,7 +5642,7 @@ describe('resolve color()', () => { const res = func('color(srgb foo bar baz)', { format: 'mixValue' }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get value', () => { @@ -6257,14 +6251,14 @@ describe('convert color value to linear rgb', () => { const res = func('color(srgb-linear foo bar baz)', { format: 'mixValue' }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get null object', () => { const res = func('rgb(foo bar baz)', { format: 'mixValue' }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get value', () => { @@ -6321,7 +6315,7 @@ describe('convert color value to rgb', () => { const res = func('foo', { format: 'mixValue' }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get value', () => { @@ -6379,7 +6373,7 @@ describe('convert color value to xyz', () => { const res = func('foo', { format: 'mixValue' }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get value', () => { @@ -6444,14 +6438,14 @@ describe('convert color value to hsl', () => { const res = func('hsl(foo, bar, baz)', { format: 'mixValue' }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get null object', () => { const res = func('foo', { format: 'mixValue' }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get value', () => { @@ -6512,7 +6506,7 @@ describe('convert color value to hwb', () => { const res = func('foo', { format: 'mixValue' }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get value', () => { @@ -6567,7 +6561,7 @@ describe('convert color value to lab', () => { const res = func('foo', { format: 'mixValue' }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get value', () => { @@ -6630,7 +6624,7 @@ describe('convert color value to lch', () => { const res = func('foo', { format: 'mixValue' }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get value', () => { @@ -6693,7 +6687,7 @@ describe('convert color value to oklab', () => { const res = func('foo', { format: 'mixValue' }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get value', () => { @@ -6756,7 +6750,7 @@ describe('convert color value to oklch', () => { const res = func('foo', { format: 'mixValue' }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get value', () => { @@ -6874,13 +6868,13 @@ describe('resolve color-mix()', () => { format: 'computedValue', nullable: true }); - assert.deepEqual(res.isNull, true, 'result'); + assert.deepEqual(res, null, 'result'); const res2 = func('color-mix(in foo, blue, red)', { format: 'computedValue', nullable: true }); - assert.deepEqual(res2.isNull, true, 'result'); + assert.deepEqual(res2, null, 'result'); }); it('should get null object', () => { @@ -6891,7 +6885,7 @@ describe('resolve color-mix()', () => { callback: () => {} } }); - assert.deepEqual(res.isNull, true, 'result'); + assert.deepEqual(res, null, 'result'); const res2 = func('color-mix(in foo, blue, red)', { format: 'computedValue', @@ -6900,7 +6894,7 @@ describe('resolve color-mix()', () => { callback: () => {} } }); - assert.deepEqual(res2.isNull, true, 'result'); + assert.deepEqual(res2, null, 'result'); }); it('should get empty string', () => { diff --git a/test/convert.test.ts b/test/convert.test.ts index b0d3a90..8ef8dc8 100644 --- a/test/convert.test.ts +++ b/test/convert.test.ts @@ -22,12 +22,12 @@ describe('pre process', () => { it('should get null object', () => { const res = func(); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get null object', () => { const res = func(' '); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get value as is', () => { @@ -37,10 +37,10 @@ describe('pre process', () => { it('should get null object', () => { const res = func('var(--foo)'); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); const res2 = func('var(--foo)'); - assert.strictEqual(res2.isNull, true, 'result'); + assert.strictEqual(res2, null, 'result'); }); it('should get null object', () => { @@ -49,14 +49,14 @@ describe('pre process', () => { callback: () => {} } }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); const res2 = func('var(--foo)', { customProperty: { callback: () => {} } }); - assert.strictEqual(res2.isNull, true, 'result'); + assert.strictEqual(res2, null, 'result'); }); it('should get value', () => { @@ -95,10 +95,10 @@ describe('pre process', () => { it('should get null object', () => { const res = func('rgb(from rebeccapurple l a b)'); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); const res2 = func('rgb(from rebeccapurple l a b)'); - assert.strictEqual(res2.isNull, true, 'result'); + assert.strictEqual(res2, null, 'result'); }); it('should get null object', () => { @@ -107,14 +107,14 @@ describe('pre process', () => { callback: () => {} } }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); const res2 = func('rgb(from rebeccapurple l a b)', { dimension: { callback: () => {} } }); - assert.strictEqual(res2.isNull, true, 'result'); + assert.strictEqual(res2, null, 'result'); }); it('should get value', () => { @@ -127,10 +127,10 @@ describe('pre process', () => { it('should get null object', () => { const res = func('color-mix(in oklab, red, foo)'); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); const res2 = func('color-mix(in oklab, red, foo)'); - assert.strictEqual(res2.isNull, true, 'result'); + assert.strictEqual(res2, null, 'result'); }); it('should get value', () => { diff --git a/test/css-calc.test.ts b/test/css-calc.test.ts index 3c6275f..f3c0902 100644 --- a/test/css-calc.test.ts +++ b/test/css-calc.test.ts @@ -885,7 +885,7 @@ describe('resolve dimension', () => { it('should get null object', () => { const res = func([]); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get null object', () => { @@ -902,7 +902,7 @@ describe('resolve dimension', () => { } ]; const res = func(token); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get null object', () => { @@ -919,7 +919,7 @@ describe('resolve dimension', () => { } ]; const res = func(token); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get null object', () => { @@ -936,7 +936,7 @@ describe('resolve dimension', () => { } ]; const res = func(token); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get value', () => { @@ -1158,7 +1158,7 @@ describe('resolve dimension', () => { const res = func(token, { format: 'specifiedValue' }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); }); diff --git a/test/css-var.test.ts b/test/css-var.test.ts index 738d0d3..df7d9b5 100644 --- a/test/css-var.test.ts +++ b/test/css-var.test.ts @@ -459,7 +459,7 @@ describe('parse tokens', () => { ['ident-token', '--foo'], [')-token', ')'] ]); - assert.deepEqual(res.isNull, true, 'result'); + assert.deepEqual(res, null, 'result'); }); it('should get value', () => { @@ -559,10 +559,10 @@ describe('resolve CSS var()', () => { it('should get null object', () => { const res = func('var(--foo)'); - assert.deepEqual(res.isNull, true, 'result'); + assert.deepEqual(res, null, 'result'); const res2 = func('var(--foo)'); - assert.deepEqual(res2.isNull, true, 'result'); + assert.deepEqual(res2, null, 'result'); }); it('should get value', () => { diff --git a/test/relative-color.test.ts b/test/relative-color.test.ts index 5277140..7f42c91 100644 --- a/test/relative-color.test.ts +++ b/test/relative-color.test.ts @@ -43,7 +43,7 @@ describe('resolve relative color channels', () => { const res = func(tokens, { format: 'specifiedValue' }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get null object', () => { @@ -53,7 +53,7 @@ describe('resolve relative color channels', () => { colorSpace: 'lab', format: 'specifiedValue' }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get value', () => { @@ -73,7 +73,7 @@ describe('resolve relative color channels', () => { colorSpace: 'rgb', format: 'specifiedValue' }); - assert.deepEqual(res.isNull, true, 'result'); + assert.deepEqual(res, null, 'result'); }); it('should get value', () => { @@ -112,24 +112,24 @@ describe('extract origin color', () => { it('should get null object', () => { const res = func(); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get null object', () => { const res = func(' '); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get null object', () => { const res = func('rgb(from rebeccapurple l a b)', { format: 'specifiedValue' }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); const res2 = func('rgb(from rebeccapurple l a b)', { format: 'specifiedValue' }); - assert.strictEqual(res2.isNull, true, 'result'); + assert.strictEqual(res2, null, 'result'); }); it('should get null object', () => { @@ -139,7 +139,7 @@ describe('extract origin color', () => { callback: () => {} } }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); const res2 = func('rgb(from rebeccapurple l a b)', { format: 'specifiedValue', @@ -147,19 +147,19 @@ describe('extract origin color', () => { callback: () => {} } }); - assert.strictEqual(res2.isNull, true, 'result'); + assert.strictEqual(res2, null, 'result'); }); it('should get null object', () => { const res = func('rgb(from rgb(from rebeccapurple r g b) l a b)', { format: 'specifiedValue' }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); const res2 = func('rgb(from rgb(from rebeccapurple r g b) l a b)', { format: 'specifiedValue' }); - assert.strictEqual(res2.isNull, true, 'result'); + assert.strictEqual(res2, null, 'result'); }); it('should get null object', () => { @@ -169,7 +169,7 @@ describe('extract origin color', () => { callback: () => {} } }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); const res2 = func('rgb(from rgb(from rebeccapurple r g b) l a b)', { format: 'specifiedValue', @@ -177,14 +177,14 @@ describe('extract origin color', () => { callback: () => {} } }); - assert.strictEqual(res2.isNull, true, 'result'); + assert.strictEqual(res2, null, 'result'); }); it('should get null object', () => { const res = func('rgb(from currentColor r g b)', { currentColor: 'foo' }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get value', () => { @@ -194,10 +194,10 @@ describe('extract origin color', () => { it('should get null object', () => { const res = func('rgb(from currentColor r g b)'); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); const res2 = func('rgb(from currentColor r g b)'); - assert.strictEqual(res2.isNull, true, 'result'); + assert.strictEqual(res2, null, 'result'); }); it('should get null object', () => { @@ -206,14 +206,14 @@ describe('extract origin color', () => { callback: () => {} } }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); const res2 = func('rgb(from currentColor r g b)', { dimension: { callback: () => {} } }); - assert.strictEqual(res2.isNull, true, 'result'); + assert.strictEqual(res2, null, 'result'); }); it('should get value', () => { @@ -250,12 +250,12 @@ describe('extract origin color', () => { const res = func('rgb(from currentColor r g b)', { currentColor: 'rgb(from foo r g b)' }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); const res2 = func('rgb(from currentColor r g b)', { currentColor: 'rgb(from foo r g b)' }); - assert.strictEqual(res2.isNull, true, 'result'); + assert.strictEqual(res2, null, 'result'); }); it('should get null object', () => { @@ -265,7 +265,7 @@ describe('extract origin color', () => { callback: () => {} } }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); const res2 = func('rgb(from currentColor r g b)', { currentColor: 'rgb(from foo r g b)', @@ -273,7 +273,7 @@ describe('extract origin color', () => { callback: () => {} } }); - assert.strictEqual(res2.isNull, true, 'result'); + assert.strictEqual(res2, null, 'result'); }); it('should get value', () => { @@ -302,14 +302,14 @@ describe('extract origin color', () => { const res = func('rgb(from light-dark(foo, red) r g b)', { format: 'specifiedValue' }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get null object', () => { const res = func('rgb(from light-dark(foo, red) r g b)', { format: 'computedValue' }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get value', () => { @@ -363,28 +363,28 @@ describe('extract origin color', () => { const res = func('rgb(from rebeccapurple calc(r * 2rem) g b)', { format: 'specifiedValue' }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get null object', () => { const res = func('rgb(from rebeccapurple calc(r + 50%) g b)', { format: 'specifiedValue' }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get null object', () => { const res = func('rgb(from rebeccapurple calc(2rem * r) g b)', { format: 'specifiedValue' }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get null object', () => { const res = func('rgb(from rebeccapurple calc(50% + r) g b)', { format: 'specifiedValue' }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); }); @@ -803,10 +803,10 @@ describe('resolve relative color', () => { it('should get null object', () => { const res = func('rgb(from rebeccapurple l a b)'); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); const res2 = func('rgb(from rebeccapurple l a b)'); - assert.strictEqual(res2.isNull, true, 'result'); + assert.strictEqual(res2, null, 'result'); }); it('should get null object', () => { @@ -815,23 +815,19 @@ describe('resolve relative color', () => { callback: () => {} } }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); const res2 = func('rgb(from rebeccapurple l a b)', { dimension: { callback: () => {} } }); - assert.strictEqual(res2.isNull, true, 'result'); + assert.strictEqual(res2, null, 'result'); }); it('should handle unclassified tokens inside math functions', () => { const res = func('rgb(from red calc("string") g b)'); - assert.strictEqual( - typeof res === 'string' || res.isNull === true, - true, - 'result' - ); + assert.strictEqual(typeof res === 'string' || res === null, true, 'result'); }); it('should handle unusual tokens inside math functions', () => { diff --git a/test/resolve.test.ts b/test/resolve.test.ts index cd3ba1e..09fdc9d 100644 --- a/test/resolve.test.ts +++ b/test/resolve.test.ts @@ -106,12 +106,12 @@ describe('resolve CSS color', () => { const res = func('var(--foo)', { format: 'hex' }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); const res2 = func('var(--foo)', { format: 'hex' }); - assert.strictEqual(res2.isNull, true, 'result'); + assert.strictEqual(res2, null, 'result'); }); it('should get null object', () => { @@ -121,7 +121,7 @@ describe('resolve CSS color', () => { callback: () => {} } }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); const res2 = func('var(--foo)', { format: 'hex', @@ -129,19 +129,19 @@ describe('resolve CSS color', () => { callback: () => {} } }); - assert.strictEqual(res2.isNull, true, 'result'); + assert.strictEqual(res2, null, 'result'); }); it('should get null object', () => { const res = func('var(--foo)', { format: 'hexAlpha' }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); const res2 = func('var(--foo)', { format: 'hexAlpha' }); - assert.strictEqual(res2.isNull, true, 'result'); + assert.strictEqual(res2, null, 'result'); }); it('should get null object', () => { @@ -151,7 +151,7 @@ describe('resolve CSS color', () => { callback: () => {} } }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); const res2 = func('var(--foo)', { format: 'hexAlpha', @@ -159,7 +159,7 @@ describe('resolve CSS color', () => { callback: () => {} } }); - assert.strictEqual(res2.isNull, true, 'result'); + assert.strictEqual(res2, null, 'result'); }); it('should get value', () => { @@ -175,13 +175,13 @@ describe('resolve CSS color', () => { format: 'computedValue', nullable: true }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); const res2 = func('var(--foo)', { format: 'computedValue', nullable: true }); - assert.strictEqual(res2.isNull, true, 'result'); + assert.strictEqual(res2, null, 'result'); }); it('should get value', () => { @@ -252,13 +252,13 @@ describe('resolve CSS color', () => { colorScheme: 'normal', format: 'hex' }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); const res2 = func('light-dark(, blue)', { colorScheme: 'normal', format: 'hex' }); - assert.strictEqual(res2.isNull, true, 'result'); + assert.strictEqual(res2, null, 'result'); }); it('should get null object', () => { @@ -266,7 +266,7 @@ describe('resolve CSS color', () => { colorScheme: 'normal', format: 'hexAlpha' }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get value', () => { @@ -359,14 +359,14 @@ describe('resolve CSS color', () => { format: 'hex', nullable: true }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); const res2 = func('light-dark(transparent, blue)', { colorScheme: 'normal', format: 'hex', nullable: true }); - assert.strictEqual(res2.isNull, true, 'result'); + assert.strictEqual(res2, null, 'result'); }); it('should get value', () => { @@ -574,12 +574,12 @@ describe('resolve CSS color', () => { const res = func('foo', { format: 'hex' }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); const res2 = func('foo', { format: 'hex' }); - assert.strictEqual(res2.isNull, true, 'result'); + assert.strictEqual(res2, null, 'result'); }); it('should get null object', () => { @@ -589,7 +589,7 @@ describe('resolve CSS color', () => { callback: () => {} } }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); const res2 = func('foo', { format: 'hex', @@ -597,7 +597,7 @@ describe('resolve CSS color', () => { callback: () => {} } }); - assert.strictEqual(res2.isNull, true, 'result'); + assert.strictEqual(res2, null, 'result'); }); it('should get value', () => { @@ -789,14 +789,14 @@ describe('resolve CSS color', () => { format: 'computedValue', nullable: true }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); const res2 = func('currentColor', { currentColor: 'foo', format: 'computedValue', nullable: true }); - assert.strictEqual(res2.isNull, true, 'result'); + assert.strictEqual(res2, null, 'result'); }); it('should get null object', () => { @@ -805,14 +805,14 @@ describe('resolve CSS color', () => { format: 'computedValue', nullable: true }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); const res2 = func('color-mix(in oklab, currentcolor, red)', { currentColor: 'foo', format: 'computedValue', nullable: true }); - assert.strictEqual(res2.isNull, true, 'result'); + assert.strictEqual(res2, null, 'result'); }); it('should get value', () => { @@ -860,13 +860,13 @@ describe('resolve CSS color', () => { format: 'computedValue', nullable: true }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); const res2 = func('color-mix(in oklab, transparent, foo)', { format: 'computedValue', nullable: true }); - assert.strictEqual(res2.isNull, true, 'result'); + assert.strictEqual(res2, null, 'result'); }); it('should get value', () => { @@ -915,12 +915,12 @@ describe('resolve CSS color', () => { const res = func('transparent', { format: 'hex' }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); const res2 = func('transparent', { format: 'hex' }); - assert.strictEqual(res2.isNull, true, 'result'); + assert.strictEqual(res2, null, 'result'); }); it('should get null object', () => { @@ -930,7 +930,7 @@ describe('resolve CSS color', () => { callback: () => {} } }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); const res2 = func('transparent', { format: 'hex', @@ -938,7 +938,7 @@ describe('resolve CSS color', () => { callback: () => {} } }); - assert.strictEqual(res2.isNull, true, 'result'); + assert.strictEqual(res2, null, 'result'); }); it('should get value', () => { @@ -976,13 +976,13 @@ describe('resolve CSS color', () => { format: 'computedValue', nullable: true }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); const res2 = func('color-mix(in oklab, foo, red)', { format: 'computedValue', nullable: true }); - assert.strictEqual(res2.isNull, true, 'result'); + assert.strictEqual(res2, null, 'result'); }); it('should get value', () => { @@ -1113,13 +1113,13 @@ describe('resolve CSS color', () => { format: 'computedValue', nullable: true }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); const res2 = func('color(srgb foo 1 1)', { format: 'computedValue', nullable: true }); - assert.strictEqual(res2.isNull, true, 'result'); + assert.strictEqual(res2, null, 'result'); }); it('should get value', () => { @@ -1196,13 +1196,13 @@ describe('resolve CSS color', () => { format: 'computedValue', nullable: true }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); const res2 = func('rgb(foo 1 1)', { format: 'computedValue', nullable: true }); - assert.strictEqual(res2.isNull, true, 'result'); + assert.strictEqual(res2, null, 'result'); }); it('should get value', () => { @@ -1407,24 +1407,24 @@ describe('resolve CSS color', () => { const res = func('transparent', { format: 'hex' }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); const res2 = func('transparent', { format: 'hex' }); - assert.strictEqual(res2.isNull, true, 'result'); + assert.strictEqual(res2, null, 'result'); }); it('should get null object', () => { const res = func('foo', { format: 'hex' }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); const res2 = func('foo', { format: 'hex' }); - assert.strictEqual(res2.isNull, true, 'result'); + assert.strictEqual(res2, null, 'result'); }); it('should get value', () => { @@ -1443,12 +1443,12 @@ describe('resolve CSS color', () => { const res = func('currentColor', { format: 'hex' }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); const res2 = func('currentColor', { format: 'hex' }); - assert.strictEqual(res2.isNull, true, 'result'); + assert.strictEqual(res2, null, 'result'); }); it('should get value', () => { @@ -1491,12 +1491,12 @@ describe('resolve CSS color', () => { const res = func('currentColor', { format: 'hexAlpha' }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); const res2 = func('currentColor', { format: 'hexAlpha' }); - assert.strictEqual(res2.isNull, true, 'result'); + assert.strictEqual(res2, null, 'result'); }); it('should get null object', () => { @@ -1506,7 +1506,7 @@ describe('resolve CSS color', () => { callback: () => {} } }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); const res2 = func('currentColor', { format: 'hexAlpha', @@ -1514,7 +1514,7 @@ describe('resolve CSS color', () => { callback: () => {} } }); - assert.strictEqual(res2.isNull, true, 'result'); + assert.strictEqual(res2, null, 'result'); }); it('should get value', () => { @@ -1652,13 +1652,13 @@ describe('resolve CSS color', () => { format: 'computedValue', nullable: true }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); const res2 = func('rgb(from rebeccapurple l a b)', { format: 'computedValue', nullable: true }); - assert.strictEqual(res2.isNull, true, 'result'); + assert.strictEqual(res2, null, 'result'); }); it('should get value', () => { @@ -1730,14 +1730,14 @@ describe('resolve CSS color', () => { const res = func('rgb(from rebeccapurple l a b)', { format: 'hex' }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get null object', () => { const res = func('rgb(from rebeccapurple l a b)', { format: 'hexAlpha' }); - assert.strictEqual(res.isNull, true, 'result'); + assert.strictEqual(res, null, 'result'); }); }); @@ -1815,4 +1815,28 @@ describe('resolve', () => { ); assert.strictEqual(res, 'lch(0 0 none)', 'result'); }); + + it('should get empty string', () => { + const res = func('color(srgb foo 1 1)', { + format: 'specifiedValue' + }); + assert.strictEqual(res, '', 'result'); + + const res2 = func('color(srgb foo 1 1)', { + format: 'specifiedValue' + }); + assert.strictEqual(res2, '', 'result'); + }); + + it('should get empty string', () => { + const res = func('color(invalid-format)', { + format: 'specifiedValue' + }); + assert.strictEqual(res, '', 'result'); + + const res2 = func('color(invalid-format)', { + format: 'specifiedValue' + }); + assert.strictEqual(res2, '', 'result'); + }); }); diff --git a/test/util.test.ts b/test/util.test.ts index 399e3db..c750f8f 100644 --- a/test/util.test.ts +++ b/test/util.test.ts @@ -281,7 +281,29 @@ describe('is color', () => { it('should get true', () => { const res = func( - 'color-mix(in oklab, green, color-mix(in rgb, red, transparent)', + 'color-mix(in oklab, green, color-mix(in srgb, red, transparent))', + { + format: 'computedColor' + } + ); + assert.strictEqual(res, true, 'result'); + }); + + it('should get false', () => { + const res = func( + // Invalid color space + 'color-mix(in oklab, green, color-mix(in rgb, red, transparent))', + { + format: 'computedColor' + } + ); + assert.strictEqual(res, false, 'result'); + }); + + it('should get true', () => { + const res = func( + // Missing close paren should be okay + 'color-mix(in oklab, green, color-mix(in srgb, red, transparent)', { format: 'computedColor' }