@mkbabb/value.js 0.5.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -56
- package/dist/easing.d.ts +49 -0
- package/dist/index.d.ts +19 -8
- package/dist/math.d.ts +1 -1
- package/dist/parsing/animation-shorthand.d.ts +19 -0
- package/dist/parsing/color.d.ts +10 -3
- package/dist/parsing/extract.d.ts +48 -0
- package/dist/parsing/index.d.ts +5 -20
- package/dist/parsing/serialize.d.ts +24 -0
- package/dist/parsing/stylesheet.d.ts +44 -0
- package/dist/parsing/units.d.ts +24 -6
- package/dist/parsing/utils.d.ts +5 -0
- package/dist/postcss-CRluLK2m.js +6400 -0
- package/dist/quantize/cluster.d.ts +45 -0
- package/dist/quantize/index.d.ts +14 -0
- package/dist/quantize/types.d.ts +39 -0
- package/dist/standalone-Ck3UyY5I.js +3458 -0
- package/dist/units/color/constants.d.ts +21 -0
- package/dist/units/color/contrast.d.ts +35 -0
- package/dist/units/color/conversions/cylindrical.d.ts +13 -0
- package/dist/units/color/conversions/direct.d.ts +41 -0
- package/dist/units/color/conversions/hex.d.ts +3 -0
- package/dist/units/color/conversions/index.d.ts +17 -0
- package/dist/units/color/conversions/kelvin.d.ts +5 -0
- package/dist/units/color/conversions/lab.d.ts +8 -0
- package/dist/units/color/conversions/oklab.d.ts +11 -0
- package/dist/units/color/conversions/transfer.d.ts +22 -0
- package/dist/units/color/conversions/xyz-extended.d.ts +13 -0
- package/dist/units/color/dispatch.d.ts +26 -0
- package/dist/units/color/gamut.d.ts +6 -0
- package/dist/units/color/index.d.ts +220 -116
- package/dist/units/color/mix.d.ts +16 -0
- package/dist/units/color/normalize.d.ts +3 -3
- package/dist/units/index.d.ts +39 -1
- package/dist/units/interpolate.d.ts +47 -0
- package/dist/units/normalize.d.ts +47 -7
- package/dist/units/utils.d.ts +1 -1
- package/dist/utils.d.ts +3 -2
- package/dist/value.js +4229 -5229
- package/package.json +62 -30
- package/scripts/migrate-keyframes-js-lerp.mjs +257 -0
- package/dist/units/color/utils.d.ts +0 -77
- package/dist/value.cjs +0 -20
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mkbabb/value.js",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "CSS value units for color, length, angles, & c.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -17,23 +17,43 @@
|
|
|
17
17
|
],
|
|
18
18
|
"type": "module",
|
|
19
19
|
"main": "./dist/value.js",
|
|
20
|
-
"module": "./dist/value.js",
|
|
21
20
|
"types": "./dist/index.d.ts",
|
|
22
|
-
"sideEffects":
|
|
21
|
+
"sideEffects": [
|
|
22
|
+
"./demo/**",
|
|
23
|
+
"**/*.css"
|
|
24
|
+
],
|
|
23
25
|
"exports": {
|
|
24
26
|
".": {
|
|
25
27
|
"types": "./dist/index.d.ts",
|
|
26
28
|
"import": "./dist/value.js",
|
|
27
|
-
"
|
|
29
|
+
"default": "./dist/value.js"
|
|
28
30
|
}
|
|
29
31
|
},
|
|
30
32
|
"files": [
|
|
31
|
-
"dist"
|
|
33
|
+
"dist",
|
|
34
|
+
"scripts/migrate-*.mjs"
|
|
32
35
|
],
|
|
33
36
|
"scripts": {
|
|
34
37
|
"dev": "vite --port 9000",
|
|
38
|
+
"dev:hero-lab": "vite --mode hero-lab --port 9010",
|
|
35
39
|
"build": "vite build --mode production",
|
|
40
|
+
"build:hero-lab": "vite build --mode hero-lab",
|
|
41
|
+
"build:watch": "vite build --mode production --watch",
|
|
36
42
|
"gh-pages": "vite build --mode gh-pages",
|
|
43
|
+
"prepare": "test -f dist/value.js || npm run build",
|
|
44
|
+
"proof:resolution": "node scripts/proof-resolution-contract.mjs",
|
|
45
|
+
"proof:dts-layout": "node scripts/proof-dts-layout.mjs",
|
|
46
|
+
"proof:no-deprecated": "node scripts/proof-no-deprecated.mjs",
|
|
47
|
+
"proof:no-ts-ignore": "node scripts/proof-no-ts-ignore.mjs",
|
|
48
|
+
"proof:as-any-budget": "node scripts/proof-as-any-budget.mjs",
|
|
49
|
+
"proof:as-unknown-as-budget": "node scripts/proof-as-unknown-as-budget.mjs",
|
|
50
|
+
"proof:codemod-publication": "node scripts/proof-codemod-publication.mjs",
|
|
51
|
+
"proof:no-deep": "node scripts/proof-no-deep.mjs",
|
|
52
|
+
"proof:no-bare-builtins": "node scripts/proof-no-bare-builtins.mjs",
|
|
53
|
+
"codemod:keyframes-lerp": "node scripts/migrate-keyframes-js-lerp.mjs",
|
|
54
|
+
"bench": "node bench/color-channel-access.mjs && node bench/color2-direct-paths.mjs && node bench/parser-namelookup.mjs",
|
|
55
|
+
"typecheck": "vue-tsc --noEmit",
|
|
56
|
+
"lint": "eslint . --max-warnings=0",
|
|
37
57
|
"test": "vitest",
|
|
38
58
|
"test:e2e": "playwright test"
|
|
39
59
|
},
|
|
@@ -50,44 +70,56 @@
|
|
|
50
70
|
},
|
|
51
71
|
"homepage": "https://github.com/mkbabb/value.js#readme",
|
|
52
72
|
"dependencies": {
|
|
53
|
-
"@mkbabb/parse-that": "
|
|
73
|
+
"@mkbabb/parse-that": "^0.8.2"
|
|
54
74
|
},
|
|
55
75
|
"devDependencies": {
|
|
56
|
-
"@iconify-json/radix-icons": "^1.2.
|
|
76
|
+
"@iconify-json/radix-icons": "^1.2.6",
|
|
57
77
|
"@iconify/vue": "^4.1.2",
|
|
58
|
-
"@
|
|
59
|
-
"@
|
|
60
|
-
"@
|
|
61
|
-
"@
|
|
62
|
-
"@
|
|
63
|
-
"@
|
|
64
|
-
"@
|
|
65
|
-
"@
|
|
66
|
-
"@
|
|
67
|
-
"@
|
|
68
|
-
"@
|
|
78
|
+
"@lucide/vue": "^1.16.0",
|
|
79
|
+
"@mkbabb/glass-ui": "file:../glass-ui",
|
|
80
|
+
"@mkbabb/keyframes.js": "file:../keyframes.js",
|
|
81
|
+
"@playwright/test": "^1.60.0",
|
|
82
|
+
"@tailwindcss/cli": "^4.3.0",
|
|
83
|
+
"@tailwindcss/postcss": "^4.3.0",
|
|
84
|
+
"@types/katex": "^0.16.8",
|
|
85
|
+
"@types/node": "^24.12.3",
|
|
86
|
+
"@types/sortablejs": "^1.15.9",
|
|
87
|
+
"@typescript-eslint/eslint-plugin": "^8.59.4",
|
|
88
|
+
"@typescript-eslint/parser": "^8.59.4",
|
|
89
|
+
"@unovis/ts": "^1.6.5",
|
|
90
|
+
"@unovis/vue": "^1.6.5",
|
|
91
|
+
"@vee-validate/zod": "^4.15.1",
|
|
92
|
+
"@vitejs/plugin-vue": "^6.0.7",
|
|
93
|
+
"@vue/test-utils": "^2.4.10",
|
|
94
|
+
"@vueuse/core": "^14.3.0",
|
|
95
|
+
"@vueuse/integrations": "^14.3.0",
|
|
69
96
|
"class-variance-authority": "^0.7.1",
|
|
70
97
|
"clsx": "^2.1.1",
|
|
71
98
|
"embla-carousel-vue": "^8.6.0",
|
|
99
|
+
"eslint": "^10.4.0",
|
|
100
|
+
"eslint-plugin-vue": "^10.9.1",
|
|
101
|
+
"globals": "^17.6.0",
|
|
72
102
|
"highlight.js": "^11.11.1",
|
|
73
103
|
"jsdom": "^26.1.0",
|
|
74
|
-
"katex": "^0.16.
|
|
75
|
-
"
|
|
76
|
-
"prettier": "^3.6.2",
|
|
104
|
+
"katex": "^0.16.47",
|
|
105
|
+
"prettier": "^3.8.3",
|
|
77
106
|
"reka-ui": "^2.0.0",
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"
|
|
107
|
+
"sortablejs": "^1.15.7",
|
|
108
|
+
"tailwind-merge": "^3.6.0",
|
|
109
|
+
"tailwindcss": "^4.3.0",
|
|
110
|
+
"tw-animate-css": "^1.4.0",
|
|
111
|
+
"typescript": "^6.0.3",
|
|
82
112
|
"unplugin-vue-markdown": "^29.2.0",
|
|
83
113
|
"v-calendar": "^3.1.2",
|
|
84
|
-
"vaul-vue": "^0.
|
|
85
|
-
"vee-validate": "^4.
|
|
86
|
-
"vite": "^
|
|
114
|
+
"vaul-vue": "^0.4.0",
|
|
115
|
+
"vee-validate": "^4.15.1",
|
|
116
|
+
"vite": "^8.0.13",
|
|
87
117
|
"vite-plugin-dts": "^4.5.4",
|
|
88
118
|
"vitest": "^3.2.4",
|
|
89
|
-
"vue": "^3.5.
|
|
90
|
-
"vue-
|
|
119
|
+
"vue": "^3.5.34",
|
|
120
|
+
"vue-eslint-parser": "^10.4.0",
|
|
121
|
+
"vue-router": "^4.6.4",
|
|
122
|
+
"vue-tsc": "^3.3.1",
|
|
91
123
|
"zod": "^3.23.8"
|
|
92
124
|
}
|
|
93
125
|
}
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Migrates keyframes.js's `lerp(t, a, b)` → `lerp(a, b, t)` call sites
|
|
4
|
+
* (the v0.6.0 silent-breakage finding documented in
|
|
5
|
+
* value.js docs/tranches/E/coordination/Q.md §5).
|
|
6
|
+
*
|
|
7
|
+
* Authored at value.js tranche E, wave W4, Lane F. Lane F's PRODUCT is the
|
|
8
|
+
* migration scaffolding — value.js does NOT write keyframes.js directly per the
|
|
9
|
+
* precept-bound cross-repo boundary. The keyframes.js maintainer applies this
|
|
10
|
+
* codemod locally; the verification protocol lives in `coordination/Q.md §5.4`.
|
|
11
|
+
*
|
|
12
|
+
* Usage:
|
|
13
|
+
*
|
|
14
|
+
* node scripts/migrate-keyframes-js-lerp.mjs <path/to/keyframes.js> [--dry-run]
|
|
15
|
+
*
|
|
16
|
+
* <path/to/keyframes.js> Absolute or relative path to a keyframes.js checkout
|
|
17
|
+
* root (the directory containing `src/animation/`).
|
|
18
|
+
*
|
|
19
|
+
* --dry-run Print the diff WITHOUT writing. Exits 0 even when
|
|
20
|
+
* rewrites are detected.
|
|
21
|
+
*
|
|
22
|
+
* Strategy (conservative — refuses to rewrite anything it can't recognise):
|
|
23
|
+
*
|
|
24
|
+
* For each of the two known call sites discovered by E.W4 Lane F's audit,
|
|
25
|
+
* match the EXACT multi-line shape and rewrite the argument order from
|
|
26
|
+
* `lerp(t, a, b)` → `lerp(a, b, t)`, preserving:
|
|
27
|
+
* - the exact indentation of the original block,
|
|
28
|
+
* - any inline `!` non-null assertions and `as` casts,
|
|
29
|
+
* - the trailing comma + closing paren style.
|
|
30
|
+
*
|
|
31
|
+
* Sites covered (verbatim per keyframes.js @ HEAD `0909177`):
|
|
32
|
+
* 1. src/animation/numeric.ts:159 — `lerp(eased, seg.startVals[i]!, seg.stopVals[i]!)`
|
|
33
|
+
* 2. src/animation/group.ts:251 — `lerp(layer.weight, existing.value, incoming.value)`
|
|
34
|
+
*
|
|
35
|
+
* Each rewrite ASSERTS that the post-rewrite `lerp(` occurrence count equals
|
|
36
|
+
* the pre-rewrite count — the codemod never adds or removes call sites.
|
|
37
|
+
*
|
|
38
|
+
* If a site doesn't match its expected shape (e.g. the maintainer has already
|
|
39
|
+
* re-styled the block, the line has shifted, the args differ), the codemod
|
|
40
|
+
* REFUSES to rewrite that site and prints a diagnostic. The keyframes.js
|
|
41
|
+
* maintainer applies the migration manually using the diffs in
|
|
42
|
+
* `coordination/Q.md §5.2`.
|
|
43
|
+
*
|
|
44
|
+
* Exit codes:
|
|
45
|
+
*
|
|
46
|
+
* 0 All known sites either rewritten successfully or already migrated.
|
|
47
|
+
* 1 Usage error, path not found, or a site failed the conservative match
|
|
48
|
+
* AND was not already in the post-migration shape — manual intervention
|
|
49
|
+
* required.
|
|
50
|
+
*/
|
|
51
|
+
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
52
|
+
import path from "node:path";
|
|
53
|
+
import process from "node:process";
|
|
54
|
+
|
|
55
|
+
const USAGE = `Usage: node scripts/migrate-keyframes-js-lerp.mjs <path/to/keyframes.js> [--dry-run]
|
|
56
|
+
|
|
57
|
+
Migrates keyframes.js's two \`lerp(t, a, b)\` call sites to value.js's
|
|
58
|
+
v0.6.0 \`lerp(a, b, t)\` canonical order.
|
|
59
|
+
|
|
60
|
+
Arguments:
|
|
61
|
+
<path/to/keyframes.js> Path to a keyframes.js checkout root.
|
|
62
|
+
|
|
63
|
+
Flags:
|
|
64
|
+
--dry-run Print the diff but do not write.
|
|
65
|
+
-h, --help Print this message.
|
|
66
|
+
|
|
67
|
+
See value.js docs/tranches/E/coordination/Q.md §5 for full context.
|
|
68
|
+
`;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* The known call sites. Each entry describes the relative path inside the
|
|
72
|
+
* keyframes.js checkout, the legacy (pre-migration) source snippet, and the
|
|
73
|
+
* canonical (post-migration) snippet. The snippets are matched verbatim.
|
|
74
|
+
*
|
|
75
|
+
* Indentation is significant — these strings reproduce the exact bytes from
|
|
76
|
+
* keyframes.js @ HEAD `0909177`, verified at E.W4 Lane F dispatch.
|
|
77
|
+
*/
|
|
78
|
+
const SITES = [
|
|
79
|
+
{
|
|
80
|
+
relPath: "src/animation/numeric.ts",
|
|
81
|
+
legacy: ` (this.result as Record<string, number>)[seg.keys[i]!] = lerp(
|
|
82
|
+
eased,
|
|
83
|
+
seg.startVals[i]!,
|
|
84
|
+
seg.stopVals[i]!,
|
|
85
|
+
);`,
|
|
86
|
+
canonical: ` (this.result as Record<string, number>)[seg.keys[i]!] = lerp(
|
|
87
|
+
seg.startVals[i]!,
|
|
88
|
+
seg.stopVals[i]!,
|
|
89
|
+
eased,
|
|
90
|
+
);`,
|
|
91
|
+
description:
|
|
92
|
+
"numeric.ts:159 — per-segment numeric interpolation in NumericAnimator.update()",
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
relPath: "src/animation/group.ts",
|
|
96
|
+
legacy: ` existing.value = lerp(
|
|
97
|
+
layer.weight,
|
|
98
|
+
existing.value,
|
|
99
|
+
incoming.value,
|
|
100
|
+
);`,
|
|
101
|
+
canonical: ` existing.value = lerp(
|
|
102
|
+
existing.value,
|
|
103
|
+
incoming.value,
|
|
104
|
+
layer.weight,
|
|
105
|
+
);`,
|
|
106
|
+
description:
|
|
107
|
+
"group.ts:251 — weighted-blend lerp in AnimationGroup.tick() weighted branch",
|
|
108
|
+
},
|
|
109
|
+
];
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Print a minimal unified-style diff for a single site. We do not depend on
|
|
113
|
+
* the system `diff(1)` so the codemod is hermetic.
|
|
114
|
+
*/
|
|
115
|
+
function renderSiteDiff(relPath, legacy, canonical) {
|
|
116
|
+
const minus = legacy.split("\n").map((l) => `- ${l}`);
|
|
117
|
+
const plus = canonical.split("\n").map((l) => `+ ${l}`);
|
|
118
|
+
return [`--- a/${relPath}`, `+++ b/${relPath}`, ...minus, ...plus].join(
|
|
119
|
+
"\n",
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Count total `lerp(` occurrences in a source string. Used as the parity
|
|
125
|
+
* assertion — a rewrite must never change the total count.
|
|
126
|
+
*/
|
|
127
|
+
function countLerpCalls(source) {
|
|
128
|
+
const matches = source.match(/\blerp\(/g);
|
|
129
|
+
return matches ? matches.length : 0;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function main(argv) {
|
|
133
|
+
const args = argv.slice(2);
|
|
134
|
+
|
|
135
|
+
if (args.length === 0 || args.includes("-h") || args.includes("--help")) {
|
|
136
|
+
process.stdout.write(USAGE);
|
|
137
|
+
process.exit(args.length === 0 ? 1 : 0);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const dryRun = args.includes("--dry-run");
|
|
141
|
+
const positional = args.filter((a) => !a.startsWith("--") && !a.startsWith("-h"));
|
|
142
|
+
|
|
143
|
+
if (positional.length !== 1) {
|
|
144
|
+
process.stderr.write(USAGE);
|
|
145
|
+
process.exit(1);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const root = path.resolve(positional[0]);
|
|
149
|
+
|
|
150
|
+
if (!existsSync(root)) {
|
|
151
|
+
process.stderr.write(`error: path does not exist: ${root}\n`);
|
|
152
|
+
process.exit(1);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const srcAnimation = path.join(root, "src/animation");
|
|
156
|
+
if (!existsSync(srcAnimation)) {
|
|
157
|
+
process.stderr.write(
|
|
158
|
+
`error: ${root} does not appear to be a keyframes.js checkout ` +
|
|
159
|
+
`(missing src/animation/)\n`,
|
|
160
|
+
);
|
|
161
|
+
process.exit(1);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
process.stdout.write(
|
|
165
|
+
`migrate-keyframes-js-lerp: target = ${root}` +
|
|
166
|
+
(dryRun ? " (dry-run)" : "") +
|
|
167
|
+
"\n\n",
|
|
168
|
+
);
|
|
169
|
+
|
|
170
|
+
let rewriteCount = 0;
|
|
171
|
+
let alreadyMigratedCount = 0;
|
|
172
|
+
let unmatchedCount = 0;
|
|
173
|
+
const failures = [];
|
|
174
|
+
|
|
175
|
+
for (const site of SITES) {
|
|
176
|
+
const filePath = path.join(root, site.relPath);
|
|
177
|
+
|
|
178
|
+
if (!existsSync(filePath)) {
|
|
179
|
+
process.stderr.write(
|
|
180
|
+
`[skip] ${site.relPath} — file missing (the keyframes.js layout has changed)\n`,
|
|
181
|
+
);
|
|
182
|
+
failures.push(site.relPath);
|
|
183
|
+
unmatchedCount++;
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
const before = readFileSync(filePath, "utf8");
|
|
188
|
+
const beforeLerpCount = countLerpCalls(before);
|
|
189
|
+
|
|
190
|
+
const hasLegacy = before.includes(site.legacy);
|
|
191
|
+
const hasCanonical = before.includes(site.canonical);
|
|
192
|
+
|
|
193
|
+
if (hasLegacy) {
|
|
194
|
+
const after = before.replace(site.legacy, site.canonical);
|
|
195
|
+
const afterLerpCount = countLerpCalls(after);
|
|
196
|
+
|
|
197
|
+
if (afterLerpCount !== beforeLerpCount) {
|
|
198
|
+
process.stderr.write(
|
|
199
|
+
`[abort] ${site.relPath} — parity check failed ` +
|
|
200
|
+
`(${beforeLerpCount} → ${afterLerpCount} lerp() calls). ` +
|
|
201
|
+
`Refusing to write.\n`,
|
|
202
|
+
);
|
|
203
|
+
failures.push(site.relPath);
|
|
204
|
+
continue;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
process.stdout.write(`[rewrite] ${site.relPath}\n`);
|
|
208
|
+
process.stdout.write(` ${site.description}\n`);
|
|
209
|
+
process.stdout.write(
|
|
210
|
+
renderSiteDiff(site.relPath, site.legacy, site.canonical) +
|
|
211
|
+
"\n\n",
|
|
212
|
+
);
|
|
213
|
+
|
|
214
|
+
if (!dryRun) {
|
|
215
|
+
writeFileSync(filePath, after, "utf8");
|
|
216
|
+
}
|
|
217
|
+
rewriteCount++;
|
|
218
|
+
} else if (hasCanonical) {
|
|
219
|
+
process.stdout.write(
|
|
220
|
+
`[already-migrated] ${site.relPath} — canonical (a, b, t) order present; skipping\n\n`,
|
|
221
|
+
);
|
|
222
|
+
alreadyMigratedCount++;
|
|
223
|
+
} else {
|
|
224
|
+
process.stderr.write(
|
|
225
|
+
`[unmatched] ${site.relPath} — neither legacy nor canonical shape found.\n` +
|
|
226
|
+
` The block at this site has drifted from the ` +
|
|
227
|
+
`audit-recorded shape; the codemod cannot rewrite safely.\n` +
|
|
228
|
+
` Apply the diff manually per ` +
|
|
229
|
+
`coordination/Q.md §5.2.\n\n`,
|
|
230
|
+
);
|
|
231
|
+
failures.push(site.relPath);
|
|
232
|
+
unmatchedCount++;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
process.stdout.write("---\n");
|
|
237
|
+
process.stdout.write(
|
|
238
|
+
`summary: rewritten=${rewriteCount}, already-migrated=${alreadyMigratedCount}, unmatched=${unmatchedCount}\n`,
|
|
239
|
+
);
|
|
240
|
+
|
|
241
|
+
if (dryRun) {
|
|
242
|
+
process.stdout.write(
|
|
243
|
+
"dry-run: no files were modified. Re-run without --dry-run to apply.\n",
|
|
244
|
+
);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
if (failures.length > 0) {
|
|
248
|
+
process.stderr.write(
|
|
249
|
+
`\nfailed sites:\n${failures.map((f) => ` - ${f}`).join("\n")}\n`,
|
|
250
|
+
);
|
|
251
|
+
process.exit(1);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
process.exit(0);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
main(process.argv);
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { AdobeRGBColor, Color, DisplayP3Color, HSLColor, HSVColor, HWBColor, KelvinColor, LABColor, LCHColor, LinearSRGBColor, OKLABColor, OKLCHColor, ProPhotoRGBColor, RGBColor, Rec2020Color, XYZColor, ColorSpaceMap } from '.';
|
|
2
|
-
import { ColorSpace, WhitePoint } from './constants';
|
|
3
|
-
export declare const getFormattedColorSpaceRange: <T extends ColorSpace>(colorSpace: T) => ColorSpaceMap<{
|
|
4
|
-
min: string;
|
|
5
|
-
max: string;
|
|
6
|
-
}>[T];
|
|
7
|
-
export declare const hex2rgb: (hex: string) => RGBColor;
|
|
8
|
-
export declare const rgb2hex: ({ r, g, b, alpha }: RGBColor) => string;
|
|
9
|
-
export declare const kelvin2rgb: ({ kelvin, alpha }: KelvinColor) => RGBColor;
|
|
10
|
-
export declare const rgb2kelvin: ({ r, g, b, alpha }: RGBColor) => KelvinColor;
|
|
11
|
-
export declare const hsv2hsl: ({ h, s, v, alpha }: HSVColor) => HSLColor;
|
|
12
|
-
export declare const hsl2hsv: ({ h, s, l, alpha }: HSLColor) => HSVColor;
|
|
13
|
-
export declare const hwb2hsl: ({ h, w, b, alpha }: HWBColor) => HSLColor;
|
|
14
|
-
export declare const hsl2hwb: ({ h, s, l, alpha }: HSLColor) => HWBColor;
|
|
15
|
-
export declare const rgb2hsl: ({ r, g, b, alpha }: RGBColor) => HSLColor;
|
|
16
|
-
export declare function hsl2rgb({ h, s, l, alpha }: HSLColor): RGBColor;
|
|
17
|
-
export declare function xyz2lab(xyz: XYZColor, toWhitePoint?: WhitePoint): LABColor;
|
|
18
|
-
export declare function lab2xyz(lab: LABColor): XYZColor;
|
|
19
|
-
export declare function srgbToLinear(channel: number): number;
|
|
20
|
-
export declare function linearToSrgb(channel: number): number;
|
|
21
|
-
export declare function rgb2xyz({ r, g, b, alpha }: RGBColor): XYZColor;
|
|
22
|
-
export declare const xyz2rgb: ({ x, y, z, alpha }: XYZColor, correctGamut?: boolean) => RGBColor;
|
|
23
|
-
export declare function lch2lab({ l, c, h, alpha }: LCHColor): LABColor;
|
|
24
|
-
export declare function lab2lch({ l, a, b, alpha }: LABColor): LCHColor;
|
|
25
|
-
export declare function oklab2xyz({ l, a, b, alpha }: OKLABColor): XYZColor;
|
|
26
|
-
export declare function xyz2oklab(xyz: XYZColor): OKLABColor;
|
|
27
|
-
export declare function oklab2lab(oklab: OKLABColor): LABColor;
|
|
28
|
-
export declare function lab2oklab(lab: LABColor): OKLABColor;
|
|
29
|
-
export declare function oklab2oklch({ l, a, b, alpha }: OKLABColor): OKLCHColor;
|
|
30
|
-
export declare function oklch2oklab({ l, c, h, alpha }: OKLCHColor): OKLABColor;
|
|
31
|
-
export declare function oklch2lab(oklch: OKLCHColor): LABColor;
|
|
32
|
-
export declare function lab2oklch(lab: LABColor): OKLCHColor;
|
|
33
|
-
export declare function hsl2xyz(hsl: HSLColor): XYZColor<number>;
|
|
34
|
-
export declare function xyz2hsl(xyz: XYZColor): HSLColor<number>;
|
|
35
|
-
export declare function hsv2xyz(hsv: HSVColor): XYZColor;
|
|
36
|
-
export declare function xyz2hsv(xyz: XYZColor): HSVColor;
|
|
37
|
-
export declare function hwb2xyz(hwb: HWBColor): XYZColor;
|
|
38
|
-
export declare function xyz2hwb(xyz: XYZColor): HWBColor;
|
|
39
|
-
export declare function lch2xyz(lch: LCHColor): XYZColor;
|
|
40
|
-
export declare function xyz2lch(xyz: XYZColor): LCHColor;
|
|
41
|
-
export declare function oklch2xyz(oklch: OKLCHColor): XYZColor;
|
|
42
|
-
export declare function xyz2oklch(xyz: XYZColor): OKLCHColor;
|
|
43
|
-
export declare function kelvin2xyz(kelvin: KelvinColor): XYZColor;
|
|
44
|
-
export declare function xyz2kelvin(xyz: XYZColor): KelvinColor;
|
|
45
|
-
export declare function adobeRgbToLinear(c: number): number;
|
|
46
|
-
export declare function linearToAdobeRgb(c: number): number;
|
|
47
|
-
export declare function proPhotoToLinear(c: number): number;
|
|
48
|
-
export declare function linearToProPhoto(c: number): number;
|
|
49
|
-
export declare function rec2020ToLinear(c: number): number;
|
|
50
|
-
export declare function linearToRec2020(c: number): number;
|
|
51
|
-
export declare function linearSrgb2xyz({ r, g, b, alpha }: LinearSRGBColor): XYZColor;
|
|
52
|
-
export declare function xyz2linearSrgb({ x, y, z, alpha }: XYZColor): LinearSRGBColor;
|
|
53
|
-
export declare function displayP32xyz({ r, g, b, alpha }: DisplayP3Color): XYZColor;
|
|
54
|
-
export declare function xyz2displayP3({ x, y, z, alpha }: XYZColor): DisplayP3Color;
|
|
55
|
-
export declare function adobeRgb2xyz({ r, g, b, alpha }: AdobeRGBColor): XYZColor;
|
|
56
|
-
export declare function xyz2adobeRgb({ x, y, z, alpha }: XYZColor): AdobeRGBColor;
|
|
57
|
-
export declare function proPhoto2xyz({ r, g, b, alpha }: ProPhotoRGBColor): XYZColor;
|
|
58
|
-
export declare function xyz2proPhoto({ x, y, z, alpha }: XYZColor): ProPhotoRGBColor;
|
|
59
|
-
export declare function rec20202xyz({ r, g, b, alpha }: Rec2020Color): XYZColor;
|
|
60
|
-
export declare function xyz2rec2020({ x, y, z, alpha }: XYZColor): Rec2020Color;
|
|
61
|
-
export declare function color2<T, C extends ColorSpace>(color: Color<T>, to: C): Color<T>;
|
|
62
|
-
export { deltaEOK, isInSRGBGamut, DELTA_E_OK_JND } from './gamut';
|
|
63
|
-
export declare function gamutMap<C extends Color>(color: C): C;
|
|
64
|
-
export type HueInterpolationMethod = "shorter" | "longer" | "increasing" | "decreasing";
|
|
65
|
-
export declare const CYLINDRICAL_HUE_COMPONENT: Partial<Record<ColorSpace, string>>;
|
|
66
|
-
/**
|
|
67
|
-
* Interpolate between two hue values using the given method.
|
|
68
|
-
* Hues are in [0, 1] (normalized). Returns an interpolated hue in [0, 1].
|
|
69
|
-
* Handles NaN (CSS `none`): if one hue is NaN, the other's value is used.
|
|
70
|
-
*/
|
|
71
|
-
export declare function interpolateHue(h1: number, h2: number, t: number, method?: HueInterpolationMethod): number;
|
|
72
|
-
/**
|
|
73
|
-
* Mix two colors per CSS color-mix() specification.
|
|
74
|
-
* Both colors should be normalized (components in [0, 1]).
|
|
75
|
-
* Percentages p1, p2 are in [0, 1] (e.g. 0.5 = 50%).
|
|
76
|
-
*/
|
|
77
|
-
export declare function mixColors(col1: Color, col2: Color, p1: number, p2: number, space?: ColorSpace, hueMethod?: HueInterpolationMethod): Color;
|