@terrazzo/plugin-css 2.0.0-alpha.2 → 2.0.0-alpha.5
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/CHANGELOG.md +4 -10
- package/README.md +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +26 -4274
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -1,4259 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
if (len === 3) return {
|
|
5
|
-
mode: "rgb",
|
|
6
|
-
r: (color >> 8 & 15 | color >> 4 & 240) / 255,
|
|
7
|
-
g: (color >> 4 & 15 | color & 240) / 255,
|
|
8
|
-
b: (color & 15 | color << 4 & 240) / 255
|
|
9
|
-
};
|
|
10
|
-
if (len === 4) return {
|
|
11
|
-
mode: "rgb",
|
|
12
|
-
r: (color >> 12 & 15 | color >> 8 & 240) / 255,
|
|
13
|
-
g: (color >> 8 & 15 | color >> 4 & 240) / 255,
|
|
14
|
-
b: (color >> 4 & 15 | color & 240) / 255,
|
|
15
|
-
alpha: (color & 15 | color << 4 & 240) / 255
|
|
16
|
-
};
|
|
17
|
-
if (len === 6) return {
|
|
18
|
-
mode: "rgb",
|
|
19
|
-
r: (color >> 16 & 255) / 255,
|
|
20
|
-
g: (color >> 8 & 255) / 255,
|
|
21
|
-
b: (color & 255) / 255
|
|
22
|
-
};
|
|
23
|
-
if (len === 8) return {
|
|
24
|
-
mode: "rgb",
|
|
25
|
-
r: (color >> 24 & 255) / 255,
|
|
26
|
-
g: (color >> 16 & 255) / 255,
|
|
27
|
-
b: (color >> 8 & 255) / 255,
|
|
28
|
-
alpha: (color & 255) / 255
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
var parseNumber_default = parseNumber;
|
|
32
|
-
|
|
33
|
-
//#endregion
|
|
34
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/colors/named.js
|
|
35
|
-
const named = {
|
|
36
|
-
aliceblue: 15792383,
|
|
37
|
-
antiquewhite: 16444375,
|
|
38
|
-
aqua: 65535,
|
|
39
|
-
aquamarine: 8388564,
|
|
40
|
-
azure: 15794175,
|
|
41
|
-
beige: 16119260,
|
|
42
|
-
bisque: 16770244,
|
|
43
|
-
black: 0,
|
|
44
|
-
blanchedalmond: 16772045,
|
|
45
|
-
blue: 255,
|
|
46
|
-
blueviolet: 9055202,
|
|
47
|
-
brown: 10824234,
|
|
48
|
-
burlywood: 14596231,
|
|
49
|
-
cadetblue: 6266528,
|
|
50
|
-
chartreuse: 8388352,
|
|
51
|
-
chocolate: 13789470,
|
|
52
|
-
coral: 16744272,
|
|
53
|
-
cornflowerblue: 6591981,
|
|
54
|
-
cornsilk: 16775388,
|
|
55
|
-
crimson: 14423100,
|
|
56
|
-
cyan: 65535,
|
|
57
|
-
darkblue: 139,
|
|
58
|
-
darkcyan: 35723,
|
|
59
|
-
darkgoldenrod: 12092939,
|
|
60
|
-
darkgray: 11119017,
|
|
61
|
-
darkgreen: 25600,
|
|
62
|
-
darkgrey: 11119017,
|
|
63
|
-
darkkhaki: 12433259,
|
|
64
|
-
darkmagenta: 9109643,
|
|
65
|
-
darkolivegreen: 5597999,
|
|
66
|
-
darkorange: 16747520,
|
|
67
|
-
darkorchid: 10040012,
|
|
68
|
-
darkred: 9109504,
|
|
69
|
-
darksalmon: 15308410,
|
|
70
|
-
darkseagreen: 9419919,
|
|
71
|
-
darkslateblue: 4734347,
|
|
72
|
-
darkslategray: 3100495,
|
|
73
|
-
darkslategrey: 3100495,
|
|
74
|
-
darkturquoise: 52945,
|
|
75
|
-
darkviolet: 9699539,
|
|
76
|
-
deeppink: 16716947,
|
|
77
|
-
deepskyblue: 49151,
|
|
78
|
-
dimgray: 6908265,
|
|
79
|
-
dimgrey: 6908265,
|
|
80
|
-
dodgerblue: 2003199,
|
|
81
|
-
firebrick: 11674146,
|
|
82
|
-
floralwhite: 16775920,
|
|
83
|
-
forestgreen: 2263842,
|
|
84
|
-
fuchsia: 16711935,
|
|
85
|
-
gainsboro: 14474460,
|
|
86
|
-
ghostwhite: 16316671,
|
|
87
|
-
gold: 16766720,
|
|
88
|
-
goldenrod: 14329120,
|
|
89
|
-
gray: 8421504,
|
|
90
|
-
green: 32768,
|
|
91
|
-
greenyellow: 11403055,
|
|
92
|
-
grey: 8421504,
|
|
93
|
-
honeydew: 15794160,
|
|
94
|
-
hotpink: 16738740,
|
|
95
|
-
indianred: 13458524,
|
|
96
|
-
indigo: 4915330,
|
|
97
|
-
ivory: 16777200,
|
|
98
|
-
khaki: 15787660,
|
|
99
|
-
lavender: 15132410,
|
|
100
|
-
lavenderblush: 16773365,
|
|
101
|
-
lawngreen: 8190976,
|
|
102
|
-
lemonchiffon: 16775885,
|
|
103
|
-
lightblue: 11393254,
|
|
104
|
-
lightcoral: 15761536,
|
|
105
|
-
lightcyan: 14745599,
|
|
106
|
-
lightgoldenrodyellow: 16448210,
|
|
107
|
-
lightgray: 13882323,
|
|
108
|
-
lightgreen: 9498256,
|
|
109
|
-
lightgrey: 13882323,
|
|
110
|
-
lightpink: 16758465,
|
|
111
|
-
lightsalmon: 16752762,
|
|
112
|
-
lightseagreen: 2142890,
|
|
113
|
-
lightskyblue: 8900346,
|
|
114
|
-
lightslategray: 7833753,
|
|
115
|
-
lightslategrey: 7833753,
|
|
116
|
-
lightsteelblue: 11584734,
|
|
117
|
-
lightyellow: 16777184,
|
|
118
|
-
lime: 65280,
|
|
119
|
-
limegreen: 3329330,
|
|
120
|
-
linen: 16445670,
|
|
121
|
-
magenta: 16711935,
|
|
122
|
-
maroon: 8388608,
|
|
123
|
-
mediumaquamarine: 6737322,
|
|
124
|
-
mediumblue: 205,
|
|
125
|
-
mediumorchid: 12211667,
|
|
126
|
-
mediumpurple: 9662683,
|
|
127
|
-
mediumseagreen: 3978097,
|
|
128
|
-
mediumslateblue: 8087790,
|
|
129
|
-
mediumspringgreen: 64154,
|
|
130
|
-
mediumturquoise: 4772300,
|
|
131
|
-
mediumvioletred: 13047173,
|
|
132
|
-
midnightblue: 1644912,
|
|
133
|
-
mintcream: 16121850,
|
|
134
|
-
mistyrose: 16770273,
|
|
135
|
-
moccasin: 16770229,
|
|
136
|
-
navajowhite: 16768685,
|
|
137
|
-
navy: 128,
|
|
138
|
-
oldlace: 16643558,
|
|
139
|
-
olive: 8421376,
|
|
140
|
-
olivedrab: 7048739,
|
|
141
|
-
orange: 16753920,
|
|
142
|
-
orangered: 16729344,
|
|
143
|
-
orchid: 14315734,
|
|
144
|
-
palegoldenrod: 15657130,
|
|
145
|
-
palegreen: 10025880,
|
|
146
|
-
paleturquoise: 11529966,
|
|
147
|
-
palevioletred: 14381203,
|
|
148
|
-
papayawhip: 16773077,
|
|
149
|
-
peachpuff: 16767673,
|
|
150
|
-
peru: 13468991,
|
|
151
|
-
pink: 16761035,
|
|
152
|
-
plum: 14524637,
|
|
153
|
-
powderblue: 11591910,
|
|
154
|
-
purple: 8388736,
|
|
155
|
-
rebeccapurple: 6697881,
|
|
156
|
-
red: 16711680,
|
|
157
|
-
rosybrown: 12357519,
|
|
158
|
-
royalblue: 4286945,
|
|
159
|
-
saddlebrown: 9127187,
|
|
160
|
-
salmon: 16416882,
|
|
161
|
-
sandybrown: 16032864,
|
|
162
|
-
seagreen: 3050327,
|
|
163
|
-
seashell: 16774638,
|
|
164
|
-
sienna: 10506797,
|
|
165
|
-
silver: 12632256,
|
|
166
|
-
skyblue: 8900331,
|
|
167
|
-
slateblue: 6970061,
|
|
168
|
-
slategray: 7372944,
|
|
169
|
-
slategrey: 7372944,
|
|
170
|
-
snow: 16775930,
|
|
171
|
-
springgreen: 65407,
|
|
172
|
-
steelblue: 4620980,
|
|
173
|
-
tan: 13808780,
|
|
174
|
-
teal: 32896,
|
|
175
|
-
thistle: 14204888,
|
|
176
|
-
tomato: 16737095,
|
|
177
|
-
turquoise: 4251856,
|
|
178
|
-
violet: 15631086,
|
|
179
|
-
wheat: 16113331,
|
|
180
|
-
white: 16777215,
|
|
181
|
-
whitesmoke: 16119285,
|
|
182
|
-
yellow: 16776960,
|
|
183
|
-
yellowgreen: 10145074
|
|
184
|
-
};
|
|
185
|
-
var named_default = named;
|
|
186
|
-
|
|
187
|
-
//#endregion
|
|
188
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/rgb/parseNamed.js
|
|
189
|
-
const parseNamed = (color) => {
|
|
190
|
-
return parseNumber_default(named_default[color.toLowerCase()], 6);
|
|
191
|
-
};
|
|
192
|
-
var parseNamed_default = parseNamed;
|
|
193
|
-
|
|
194
|
-
//#endregion
|
|
195
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/rgb/parseHex.js
|
|
196
|
-
const hex = /^#?([0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{4}|[0-9a-f]{3})$/i;
|
|
197
|
-
const parseHex = (color) => {
|
|
198
|
-
let match;
|
|
199
|
-
return (match = color.match(hex)) ? parseNumber_default(parseInt(match[1], 16), match[1].length) : void 0;
|
|
200
|
-
};
|
|
201
|
-
var parseHex_default = parseHex;
|
|
202
|
-
|
|
203
|
-
//#endregion
|
|
204
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/util/regex.js
|
|
205
|
-
const num$1 = "([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)";
|
|
206
|
-
const num_none = `(?:${num$1}|none)`;
|
|
207
|
-
const per = `${num$1}%`;
|
|
208
|
-
const per_none = `(?:${num$1}%|none)`;
|
|
209
|
-
const num_per = `(?:${num$1}%|${num$1})`;
|
|
210
|
-
const num_per_none = `(?:${num$1}%|${num$1}|none)`;
|
|
211
|
-
const hue$1 = `(?:${num$1}(deg|grad|rad|turn)|${num$1})`;
|
|
212
|
-
const hue_none = `(?:${num$1}(deg|grad|rad|turn)|${num$1}|none)`;
|
|
213
|
-
const c = `\\s*,\\s*`;
|
|
214
|
-
const rx_num_per_none = /* @__PURE__ */ new RegExp("^" + num_per_none + "$");
|
|
215
|
-
|
|
216
|
-
//#endregion
|
|
217
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/rgb/parseRgbLegacy.js
|
|
218
|
-
const rgb_num_old = /* @__PURE__ */ new RegExp(`^rgba?\\(\\s*${num$1}${c}${num$1}${c}${num$1}\\s*(?:,\\s*${num_per}\\s*)?\\)$`);
|
|
219
|
-
const rgb_per_old = /* @__PURE__ */ new RegExp(`^rgba?\\(\\s*${per}${c}${per}${c}${per}\\s*(?:,\\s*${num_per}\\s*)?\\)$`);
|
|
220
|
-
const parseRgbLegacy = (color) => {
|
|
221
|
-
let res = { mode: "rgb" };
|
|
222
|
-
let match;
|
|
223
|
-
if (match = color.match(rgb_num_old)) {
|
|
224
|
-
if (match[1] !== void 0) res.r = match[1] / 255;
|
|
225
|
-
if (match[2] !== void 0) res.g = match[2] / 255;
|
|
226
|
-
if (match[3] !== void 0) res.b = match[3] / 255;
|
|
227
|
-
} else if (match = color.match(rgb_per_old)) {
|
|
228
|
-
if (match[1] !== void 0) res.r = match[1] / 100;
|
|
229
|
-
if (match[2] !== void 0) res.g = match[2] / 100;
|
|
230
|
-
if (match[3] !== void 0) res.b = match[3] / 100;
|
|
231
|
-
} else return;
|
|
232
|
-
if (match[4] !== void 0) res.alpha = Math.max(0, Math.min(1, match[4] / 100));
|
|
233
|
-
else if (match[5] !== void 0) res.alpha = Math.max(0, Math.min(1, +match[5]));
|
|
234
|
-
return res;
|
|
235
|
-
};
|
|
236
|
-
var parseRgbLegacy_default = parseRgbLegacy;
|
|
237
|
-
|
|
238
|
-
//#endregion
|
|
239
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/_prepare.js
|
|
240
|
-
const prepare = (color, mode) => color === void 0 ? void 0 : typeof color !== "object" ? parse_default(color) : color.mode !== void 0 ? color : mode ? {
|
|
241
|
-
...color,
|
|
242
|
-
mode
|
|
243
|
-
} : void 0;
|
|
244
|
-
var _prepare_default = prepare;
|
|
245
|
-
|
|
246
|
-
//#endregion
|
|
247
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/converter.js
|
|
248
|
-
const converter = (target_mode = "rgb") => (color) => (color = _prepare_default(color, target_mode)) !== void 0 ? color.mode === target_mode ? color : converters$1[color.mode][target_mode] ? converters$1[color.mode][target_mode](color) : target_mode === "rgb" ? converters$1[color.mode].rgb(color) : converters$1.rgb[target_mode](converters$1[color.mode].rgb(color)) : void 0;
|
|
249
|
-
var converter_default = converter;
|
|
250
|
-
|
|
251
|
-
//#endregion
|
|
252
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/modes.js
|
|
253
|
-
const converters$1 = {};
|
|
254
|
-
const modes = {};
|
|
255
|
-
const parsers = [];
|
|
256
|
-
const colorProfiles = {};
|
|
257
|
-
const identity = (v) => v;
|
|
258
|
-
const useMode = (definition$28) => {
|
|
259
|
-
converters$1[definition$28.mode] = {
|
|
260
|
-
...converters$1[definition$28.mode],
|
|
261
|
-
...definition$28.toMode
|
|
262
|
-
};
|
|
263
|
-
Object.keys(definition$28.fromMode || {}).forEach((k$3) => {
|
|
264
|
-
if (!converters$1[k$3]) converters$1[k$3] = {};
|
|
265
|
-
converters$1[k$3][definition$28.mode] = definition$28.fromMode[k$3];
|
|
266
|
-
});
|
|
267
|
-
if (!definition$28.ranges) definition$28.ranges = {};
|
|
268
|
-
if (!definition$28.difference) definition$28.difference = {};
|
|
269
|
-
definition$28.channels.forEach((channel) => {
|
|
270
|
-
if (definition$28.ranges[channel] === void 0) definition$28.ranges[channel] = [0, 1];
|
|
271
|
-
if (!definition$28.interpolate[channel]) throw new Error(`Missing interpolator for: ${channel}`);
|
|
272
|
-
if (typeof definition$28.interpolate[channel] === "function") definition$28.interpolate[channel] = { use: definition$28.interpolate[channel] };
|
|
273
|
-
if (!definition$28.interpolate[channel].fixup) definition$28.interpolate[channel].fixup = identity;
|
|
274
|
-
});
|
|
275
|
-
modes[definition$28.mode] = definition$28;
|
|
276
|
-
(definition$28.parse || []).forEach((parser) => {
|
|
277
|
-
useParser(parser, definition$28.mode);
|
|
278
|
-
});
|
|
279
|
-
return converter_default(definition$28.mode);
|
|
280
|
-
};
|
|
281
|
-
const getMode = (mode) => modes[mode];
|
|
282
|
-
const useParser = (parser, mode) => {
|
|
283
|
-
if (typeof parser === "string") {
|
|
284
|
-
if (!mode) throw new Error(`'mode' required when 'parser' is a string`);
|
|
285
|
-
colorProfiles[parser] = mode;
|
|
286
|
-
} else if (typeof parser === "function") {
|
|
287
|
-
if (parsers.indexOf(parser) < 0) parsers.push(parser);
|
|
288
|
-
}
|
|
289
|
-
};
|
|
290
|
-
|
|
291
|
-
//#endregion
|
|
292
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/parse.js
|
|
293
|
-
const IdentStartCodePoint = /[^\x00-\x7F]|[a-zA-Z_]/;
|
|
294
|
-
const IdentCodePoint = /[^\x00-\x7F]|[-\w]/;
|
|
295
|
-
const Tok = {
|
|
296
|
-
Function: "function",
|
|
297
|
-
Ident: "ident",
|
|
298
|
-
Number: "number",
|
|
299
|
-
Percentage: "percentage",
|
|
300
|
-
ParenClose: ")",
|
|
301
|
-
None: "none",
|
|
302
|
-
Hue: "hue",
|
|
303
|
-
Alpha: "alpha"
|
|
304
|
-
};
|
|
305
|
-
let _i = 0;
|
|
306
|
-
function is_num(chars) {
|
|
307
|
-
let ch = chars[_i];
|
|
308
|
-
let ch1 = chars[_i + 1];
|
|
309
|
-
if (ch === "-" || ch === "+") return /\d/.test(ch1) || ch1 === "." && /\d/.test(chars[_i + 2]);
|
|
310
|
-
if (ch === ".") return /\d/.test(ch1);
|
|
311
|
-
return /\d/.test(ch);
|
|
312
|
-
}
|
|
313
|
-
function is_ident(chars) {
|
|
314
|
-
if (_i >= chars.length) return false;
|
|
315
|
-
let ch = chars[_i];
|
|
316
|
-
if (IdentStartCodePoint.test(ch)) return true;
|
|
317
|
-
if (ch === "-") {
|
|
318
|
-
if (chars.length - _i < 2) return false;
|
|
319
|
-
let ch1 = chars[_i + 1];
|
|
320
|
-
if (ch1 === "-" || IdentStartCodePoint.test(ch1)) return true;
|
|
321
|
-
return false;
|
|
322
|
-
}
|
|
323
|
-
return false;
|
|
324
|
-
}
|
|
325
|
-
const huenits = {
|
|
326
|
-
deg: 1,
|
|
327
|
-
rad: 180 / Math.PI,
|
|
328
|
-
grad: 9 / 10,
|
|
329
|
-
turn: 360
|
|
330
|
-
};
|
|
331
|
-
function num(chars) {
|
|
332
|
-
let value = "";
|
|
333
|
-
if (chars[_i] === "-" || chars[_i] === "+") value += chars[_i++];
|
|
334
|
-
value += digits(chars);
|
|
335
|
-
if (chars[_i] === "." && /\d/.test(chars[_i + 1])) value += chars[_i++] + digits(chars);
|
|
336
|
-
if (chars[_i] === "e" || chars[_i] === "E") {
|
|
337
|
-
if ((chars[_i + 1] === "-" || chars[_i + 1] === "+") && /\d/.test(chars[_i + 2])) value += chars[_i++] + chars[_i++] + digits(chars);
|
|
338
|
-
else if (/\d/.test(chars[_i + 1])) value += chars[_i++] + digits(chars);
|
|
339
|
-
}
|
|
340
|
-
if (is_ident(chars)) {
|
|
341
|
-
let id = ident(chars);
|
|
342
|
-
if (id === "deg" || id === "rad" || id === "turn" || id === "grad") return {
|
|
343
|
-
type: Tok.Hue,
|
|
344
|
-
value: value * huenits[id]
|
|
345
|
-
};
|
|
346
|
-
return;
|
|
347
|
-
}
|
|
348
|
-
if (chars[_i] === "%") {
|
|
349
|
-
_i++;
|
|
350
|
-
return {
|
|
351
|
-
type: Tok.Percentage,
|
|
352
|
-
value: +value
|
|
353
|
-
};
|
|
354
|
-
}
|
|
355
|
-
return {
|
|
356
|
-
type: Tok.Number,
|
|
357
|
-
value: +value
|
|
358
|
-
};
|
|
359
|
-
}
|
|
360
|
-
function digits(chars) {
|
|
361
|
-
let v = "";
|
|
362
|
-
while (/\d/.test(chars[_i])) v += chars[_i++];
|
|
363
|
-
return v;
|
|
364
|
-
}
|
|
365
|
-
function ident(chars) {
|
|
366
|
-
let v = "";
|
|
367
|
-
while (_i < chars.length && IdentCodePoint.test(chars[_i])) v += chars[_i++];
|
|
368
|
-
return v;
|
|
369
|
-
}
|
|
370
|
-
function identlike(chars) {
|
|
371
|
-
let v = ident(chars);
|
|
372
|
-
if (chars[_i] === "(") {
|
|
373
|
-
_i++;
|
|
374
|
-
return {
|
|
375
|
-
type: Tok.Function,
|
|
376
|
-
value: v
|
|
377
|
-
};
|
|
378
|
-
}
|
|
379
|
-
if (v === "none") return {
|
|
380
|
-
type: Tok.None,
|
|
381
|
-
value: void 0
|
|
382
|
-
};
|
|
383
|
-
return {
|
|
384
|
-
type: Tok.Ident,
|
|
385
|
-
value: v
|
|
386
|
-
};
|
|
387
|
-
}
|
|
388
|
-
function tokenize(str = "") {
|
|
389
|
-
let chars = str.trim();
|
|
390
|
-
let tokens = [];
|
|
391
|
-
let ch;
|
|
392
|
-
_i = 0;
|
|
393
|
-
while (_i < chars.length) {
|
|
394
|
-
ch = chars[_i++];
|
|
395
|
-
if (ch === "\n" || ch === " " || ch === " ") {
|
|
396
|
-
while (_i < chars.length && (chars[_i] === "\n" || chars[_i] === " " || chars[_i] === " ")) _i++;
|
|
397
|
-
continue;
|
|
398
|
-
}
|
|
399
|
-
if (ch === ",") return;
|
|
400
|
-
if (ch === ")") {
|
|
401
|
-
tokens.push({ type: Tok.ParenClose });
|
|
402
|
-
continue;
|
|
403
|
-
}
|
|
404
|
-
if (ch === "+") {
|
|
405
|
-
_i--;
|
|
406
|
-
if (is_num(chars)) {
|
|
407
|
-
tokens.push(num(chars));
|
|
408
|
-
continue;
|
|
409
|
-
}
|
|
410
|
-
return;
|
|
411
|
-
}
|
|
412
|
-
if (ch === "-") {
|
|
413
|
-
_i--;
|
|
414
|
-
if (is_num(chars)) {
|
|
415
|
-
tokens.push(num(chars));
|
|
416
|
-
continue;
|
|
417
|
-
}
|
|
418
|
-
if (is_ident(chars)) {
|
|
419
|
-
tokens.push({
|
|
420
|
-
type: Tok.Ident,
|
|
421
|
-
value: ident(chars)
|
|
422
|
-
});
|
|
423
|
-
continue;
|
|
424
|
-
}
|
|
425
|
-
return;
|
|
426
|
-
}
|
|
427
|
-
if (ch === ".") {
|
|
428
|
-
_i--;
|
|
429
|
-
if (is_num(chars)) {
|
|
430
|
-
tokens.push(num(chars));
|
|
431
|
-
continue;
|
|
432
|
-
}
|
|
433
|
-
return;
|
|
434
|
-
}
|
|
435
|
-
if (ch === "/") {
|
|
436
|
-
while (_i < chars.length && (chars[_i] === "\n" || chars[_i] === " " || chars[_i] === " ")) _i++;
|
|
437
|
-
let alpha;
|
|
438
|
-
if (is_num(chars)) {
|
|
439
|
-
alpha = num(chars);
|
|
440
|
-
if (alpha.type !== Tok.Hue) {
|
|
441
|
-
tokens.push({
|
|
442
|
-
type: Tok.Alpha,
|
|
443
|
-
value: alpha
|
|
444
|
-
});
|
|
445
|
-
continue;
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
if (is_ident(chars)) {
|
|
449
|
-
if (ident(chars) === "none") {
|
|
450
|
-
tokens.push({
|
|
451
|
-
type: Tok.Alpha,
|
|
452
|
-
value: {
|
|
453
|
-
type: Tok.None,
|
|
454
|
-
value: void 0
|
|
455
|
-
}
|
|
456
|
-
});
|
|
457
|
-
continue;
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
return;
|
|
461
|
-
}
|
|
462
|
-
if (/\d/.test(ch)) {
|
|
463
|
-
_i--;
|
|
464
|
-
tokens.push(num(chars));
|
|
465
|
-
continue;
|
|
466
|
-
}
|
|
467
|
-
if (IdentStartCodePoint.test(ch)) {
|
|
468
|
-
_i--;
|
|
469
|
-
tokens.push(identlike(chars));
|
|
470
|
-
continue;
|
|
471
|
-
}
|
|
472
|
-
return;
|
|
473
|
-
}
|
|
474
|
-
return tokens;
|
|
475
|
-
}
|
|
476
|
-
function parseColorSyntax(tokens) {
|
|
477
|
-
tokens._i = 0;
|
|
478
|
-
let token = tokens[tokens._i++];
|
|
479
|
-
if (!token || token.type !== Tok.Function || token.value !== "color") return;
|
|
480
|
-
token = tokens[tokens._i++];
|
|
481
|
-
if (token.type !== Tok.Ident) return;
|
|
482
|
-
const mode = colorProfiles[token.value];
|
|
483
|
-
if (!mode) return;
|
|
484
|
-
const res = { mode };
|
|
485
|
-
const coords = consumeCoords(tokens, false);
|
|
486
|
-
if (!coords) return;
|
|
487
|
-
const channels = getMode(mode).channels;
|
|
488
|
-
for (let ii = 0, c$1, ch; ii < channels.length; ii++) {
|
|
489
|
-
c$1 = coords[ii];
|
|
490
|
-
ch = channels[ii];
|
|
491
|
-
if (c$1.type !== Tok.None) {
|
|
492
|
-
res[ch] = c$1.type === Tok.Number ? c$1.value : c$1.value / 100;
|
|
493
|
-
if (ch === "alpha") res[ch] = Math.max(0, Math.min(1, res[ch]));
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
return res;
|
|
497
|
-
}
|
|
498
|
-
function consumeCoords(tokens, includeHue) {
|
|
499
|
-
const coords = [];
|
|
500
|
-
let token;
|
|
501
|
-
while (tokens._i < tokens.length) {
|
|
502
|
-
token = tokens[tokens._i++];
|
|
503
|
-
if (token.type === Tok.None || token.type === Tok.Number || token.type === Tok.Alpha || token.type === Tok.Percentage || includeHue && token.type === Tok.Hue) {
|
|
504
|
-
coords.push(token);
|
|
505
|
-
continue;
|
|
506
|
-
}
|
|
507
|
-
if (token.type === Tok.ParenClose) {
|
|
508
|
-
if (tokens._i < tokens.length) return;
|
|
509
|
-
continue;
|
|
510
|
-
}
|
|
511
|
-
return;
|
|
512
|
-
}
|
|
513
|
-
if (coords.length < 3 || coords.length > 4) return;
|
|
514
|
-
if (coords.length === 4) {
|
|
515
|
-
if (coords[3].type !== Tok.Alpha) return;
|
|
516
|
-
coords[3] = coords[3].value;
|
|
517
|
-
}
|
|
518
|
-
if (coords.length === 3) coords.push({
|
|
519
|
-
type: Tok.None,
|
|
520
|
-
value: void 0
|
|
521
|
-
});
|
|
522
|
-
return coords.every((c$1) => c$1.type !== Tok.Alpha) ? coords : void 0;
|
|
523
|
-
}
|
|
524
|
-
function parseModernSyntax(tokens, includeHue) {
|
|
525
|
-
tokens._i = 0;
|
|
526
|
-
let token = tokens[tokens._i++];
|
|
527
|
-
if (!token || token.type !== Tok.Function) return;
|
|
528
|
-
let coords = consumeCoords(tokens, includeHue);
|
|
529
|
-
if (!coords) return;
|
|
530
|
-
coords.unshift(token.value);
|
|
531
|
-
return coords;
|
|
532
|
-
}
|
|
533
|
-
const parse = (color) => {
|
|
534
|
-
if (typeof color !== "string") return;
|
|
535
|
-
const tokens = tokenize(color);
|
|
536
|
-
const parsed = tokens ? parseModernSyntax(tokens, true) : void 0;
|
|
537
|
-
let result = void 0;
|
|
538
|
-
let i = 0;
|
|
539
|
-
let len = parsers.length;
|
|
540
|
-
while (i < len) if ((result = parsers[i++](color, parsed)) !== void 0) return result;
|
|
541
|
-
return tokens ? parseColorSyntax(tokens) : void 0;
|
|
542
|
-
};
|
|
543
|
-
var parse_default = parse;
|
|
544
|
-
|
|
545
|
-
//#endregion
|
|
546
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/rgb/parseRgb.js
|
|
547
|
-
function parseRgb(color, parsed) {
|
|
548
|
-
if (!parsed || parsed[0] !== "rgb" && parsed[0] !== "rgba") return;
|
|
549
|
-
const res = { mode: "rgb" };
|
|
550
|
-
const [, r$1, g, b, alpha] = parsed;
|
|
551
|
-
if (r$1.type === Tok.Hue || g.type === Tok.Hue || b.type === Tok.Hue) return;
|
|
552
|
-
if (r$1.type !== Tok.None) res.r = r$1.type === Tok.Number ? r$1.value / 255 : r$1.value / 100;
|
|
553
|
-
if (g.type !== Tok.None) res.g = g.type === Tok.Number ? g.value / 255 : g.value / 100;
|
|
554
|
-
if (b.type !== Tok.None) res.b = b.type === Tok.Number ? b.value / 255 : b.value / 100;
|
|
555
|
-
if (alpha.type !== Tok.None) res.alpha = Math.min(1, Math.max(0, alpha.type === Tok.Number ? alpha.value : alpha.value / 100));
|
|
556
|
-
return res;
|
|
557
|
-
}
|
|
558
|
-
var parseRgb_default = parseRgb;
|
|
559
|
-
|
|
560
|
-
//#endregion
|
|
561
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/rgb/parseTransparent.js
|
|
562
|
-
const parseTransparent = (c$1) => c$1 === "transparent" ? {
|
|
563
|
-
mode: "rgb",
|
|
564
|
-
r: 0,
|
|
565
|
-
g: 0,
|
|
566
|
-
b: 0,
|
|
567
|
-
alpha: 0
|
|
568
|
-
} : void 0;
|
|
569
|
-
var parseTransparent_default = parseTransparent;
|
|
570
|
-
|
|
571
|
-
//#endregion
|
|
572
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/interpolate/lerp.js
|
|
573
|
-
const lerp = (a, b, t) => a + t * (b - a);
|
|
574
|
-
|
|
575
|
-
//#endregion
|
|
576
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/interpolate/piecewise.js
|
|
577
|
-
const get_classes = (arr) => {
|
|
578
|
-
let classes = [];
|
|
579
|
-
for (let i = 0; i < arr.length - 1; i++) {
|
|
580
|
-
let a = arr[i];
|
|
581
|
-
let b = arr[i + 1];
|
|
582
|
-
if (a === void 0 && b === void 0) classes.push(void 0);
|
|
583
|
-
else if (a !== void 0 && b !== void 0) classes.push([a, b]);
|
|
584
|
-
else classes.push(a !== void 0 ? [a, a] : [b, b]);
|
|
585
|
-
}
|
|
586
|
-
return classes;
|
|
587
|
-
};
|
|
588
|
-
const interpolatorPiecewise = (interpolator) => (arr) => {
|
|
589
|
-
let classes = get_classes(arr);
|
|
590
|
-
return (t) => {
|
|
591
|
-
let cls = t * classes.length;
|
|
592
|
-
let idx = t >= 1 ? classes.length - 1 : Math.max(Math.floor(cls), 0);
|
|
593
|
-
let pair = classes[idx];
|
|
594
|
-
return pair === void 0 ? void 0 : interpolator(pair[0], pair[1], cls - idx);
|
|
595
|
-
};
|
|
596
|
-
};
|
|
597
|
-
|
|
598
|
-
//#endregion
|
|
599
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/interpolate/linear.js
|
|
600
|
-
const interpolatorLinear = interpolatorPiecewise(lerp);
|
|
601
|
-
|
|
602
|
-
//#endregion
|
|
603
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/fixup/alpha.js
|
|
604
|
-
const fixupAlpha = (arr) => {
|
|
605
|
-
let some_defined = false;
|
|
606
|
-
let res = arr.map((v) => {
|
|
607
|
-
if (v !== void 0) {
|
|
608
|
-
some_defined = true;
|
|
609
|
-
return v;
|
|
610
|
-
}
|
|
611
|
-
return 1;
|
|
612
|
-
});
|
|
613
|
-
return some_defined ? res : arr;
|
|
614
|
-
};
|
|
615
|
-
|
|
616
|
-
//#endregion
|
|
617
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/rgb/definition.js
|
|
618
|
-
const definition$27 = {
|
|
619
|
-
mode: "rgb",
|
|
620
|
-
channels: [
|
|
621
|
-
"r",
|
|
622
|
-
"g",
|
|
623
|
-
"b",
|
|
624
|
-
"alpha"
|
|
625
|
-
],
|
|
626
|
-
parse: [
|
|
627
|
-
parseRgb_default,
|
|
628
|
-
parseHex_default,
|
|
629
|
-
parseRgbLegacy_default,
|
|
630
|
-
parseNamed_default,
|
|
631
|
-
parseTransparent_default,
|
|
632
|
-
"srgb"
|
|
633
|
-
],
|
|
634
|
-
serialize: "srgb",
|
|
635
|
-
interpolate: {
|
|
636
|
-
r: interpolatorLinear,
|
|
637
|
-
g: interpolatorLinear,
|
|
638
|
-
b: interpolatorLinear,
|
|
639
|
-
alpha: {
|
|
640
|
-
use: interpolatorLinear,
|
|
641
|
-
fixup: fixupAlpha
|
|
642
|
-
}
|
|
643
|
-
},
|
|
644
|
-
gamut: true,
|
|
645
|
-
white: {
|
|
646
|
-
r: 1,
|
|
647
|
-
g: 1,
|
|
648
|
-
b: 1
|
|
649
|
-
},
|
|
650
|
-
black: {
|
|
651
|
-
r: 0,
|
|
652
|
-
g: 0,
|
|
653
|
-
b: 0
|
|
654
|
-
}
|
|
655
|
-
};
|
|
656
|
-
var definition_default$12 = definition$27;
|
|
657
|
-
|
|
658
|
-
//#endregion
|
|
659
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/a98/convertA98ToXyz65.js
|
|
660
|
-
const linearize$2 = (v = 0) => Math.pow(Math.abs(v), 563 / 256) * Math.sign(v);
|
|
661
|
-
const convertA98ToXyz65 = (a98$2) => {
|
|
662
|
-
let r$1 = linearize$2(a98$2.r);
|
|
663
|
-
let g = linearize$2(a98$2.g);
|
|
664
|
-
let b = linearize$2(a98$2.b);
|
|
665
|
-
let res = {
|
|
666
|
-
mode: "xyz65",
|
|
667
|
-
x: .5766690429101305 * r$1 + .1855582379065463 * g + .1882286462349947 * b,
|
|
668
|
-
y: .297344975250536 * r$1 + .6273635662554661 * g + .0752914584939979 * b,
|
|
669
|
-
z: .0270313613864123 * r$1 + .0706888525358272 * g + .9913375368376386 * b
|
|
670
|
-
};
|
|
671
|
-
if (a98$2.alpha !== void 0) res.alpha = a98$2.alpha;
|
|
672
|
-
return res;
|
|
673
|
-
};
|
|
674
|
-
var convertA98ToXyz65_default = convertA98ToXyz65;
|
|
675
|
-
|
|
676
|
-
//#endregion
|
|
677
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/a98/convertXyz65ToA98.js
|
|
678
|
-
const gamma$2 = (v) => Math.pow(Math.abs(v), 256 / 563) * Math.sign(v);
|
|
679
|
-
const convertXyz65ToA98 = ({ x, y, z, alpha }) => {
|
|
680
|
-
if (x === void 0) x = 0;
|
|
681
|
-
if (y === void 0) y = 0;
|
|
682
|
-
if (z === void 0) z = 0;
|
|
683
|
-
let res = {
|
|
684
|
-
mode: "a98",
|
|
685
|
-
r: gamma$2(x * 2.0415879038107465 - y * .5650069742788597 - .3447313507783297 * z),
|
|
686
|
-
g: gamma$2(x * -.9692436362808798 + y * 1.8759675015077206 + .0415550574071756 * z),
|
|
687
|
-
b: gamma$2(x * .0134442806320312 - y * .1183623922310184 + 1.0151749943912058 * z)
|
|
688
|
-
};
|
|
689
|
-
if (alpha !== void 0) res.alpha = alpha;
|
|
690
|
-
return res;
|
|
691
|
-
};
|
|
692
|
-
var convertXyz65ToA98_default = convertXyz65ToA98;
|
|
693
|
-
|
|
694
|
-
//#endregion
|
|
695
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/lrgb/convertRgbToLrgb.js
|
|
696
|
-
const fn$3 = (c$1 = 0) => {
|
|
697
|
-
const abs$1 = Math.abs(c$1);
|
|
698
|
-
if (abs$1 <= .04045) return c$1 / 12.92;
|
|
699
|
-
return (Math.sign(c$1) || 1) * Math.pow((abs$1 + .055) / 1.055, 2.4);
|
|
700
|
-
};
|
|
701
|
-
const convertRgbToLrgb = ({ r: r$1, g, b, alpha }) => {
|
|
702
|
-
let res = {
|
|
703
|
-
mode: "lrgb",
|
|
704
|
-
r: fn$3(r$1),
|
|
705
|
-
g: fn$3(g),
|
|
706
|
-
b: fn$3(b)
|
|
707
|
-
};
|
|
708
|
-
if (alpha !== void 0) res.alpha = alpha;
|
|
709
|
-
return res;
|
|
710
|
-
};
|
|
711
|
-
var convertRgbToLrgb_default = convertRgbToLrgb;
|
|
712
|
-
|
|
713
|
-
//#endregion
|
|
714
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/xyz65/convertRgbToXyz65.js
|
|
715
|
-
const convertRgbToXyz65 = (rgb$4) => {
|
|
716
|
-
let { r: r$1, g, b, alpha } = convertRgbToLrgb_default(rgb$4);
|
|
717
|
-
let res = {
|
|
718
|
-
mode: "xyz65",
|
|
719
|
-
x: .4123907992659593 * r$1 + .357584339383878 * g + .1804807884018343 * b,
|
|
720
|
-
y: .2126390058715102 * r$1 + .715168678767756 * g + .0721923153607337 * b,
|
|
721
|
-
z: .0193308187155918 * r$1 + .119194779794626 * g + .9505321522496607 * b
|
|
722
|
-
};
|
|
723
|
-
if (alpha !== void 0) res.alpha = alpha;
|
|
724
|
-
return res;
|
|
725
|
-
};
|
|
726
|
-
var convertRgbToXyz65_default = convertRgbToXyz65;
|
|
727
|
-
|
|
728
|
-
//#endregion
|
|
729
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/lrgb/convertLrgbToRgb.js
|
|
730
|
-
const fn$2 = (c$1 = 0) => {
|
|
731
|
-
const abs$1 = Math.abs(c$1);
|
|
732
|
-
if (abs$1 > .0031308) return (Math.sign(c$1) || 1) * (1.055 * Math.pow(abs$1, 1 / 2.4) - .055);
|
|
733
|
-
return c$1 * 12.92;
|
|
734
|
-
};
|
|
735
|
-
const convertLrgbToRgb = ({ r: r$1, g, b, alpha }, mode = "rgb") => {
|
|
736
|
-
let res = {
|
|
737
|
-
mode,
|
|
738
|
-
r: fn$2(r$1),
|
|
739
|
-
g: fn$2(g),
|
|
740
|
-
b: fn$2(b)
|
|
741
|
-
};
|
|
742
|
-
if (alpha !== void 0) res.alpha = alpha;
|
|
743
|
-
return res;
|
|
744
|
-
};
|
|
745
|
-
var convertLrgbToRgb_default = convertLrgbToRgb;
|
|
746
|
-
|
|
747
|
-
//#endregion
|
|
748
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/xyz65/convertXyz65ToRgb.js
|
|
749
|
-
const convertXyz65ToRgb = ({ x, y, z, alpha }) => {
|
|
750
|
-
if (x === void 0) x = 0;
|
|
751
|
-
if (y === void 0) y = 0;
|
|
752
|
-
if (z === void 0) z = 0;
|
|
753
|
-
let res = convertLrgbToRgb_default({
|
|
754
|
-
r: x * 3.2409699419045226 - y * 1.537383177570094 - .4986107602930034 * z,
|
|
755
|
-
g: x * -.9692436362808796 + y * 1.8759675015077204 + .0415550574071756 * z,
|
|
756
|
-
b: x * .0556300796969936 - y * .2039769588889765 + 1.0569715142428784 * z
|
|
757
|
-
});
|
|
758
|
-
if (alpha !== void 0) res.alpha = alpha;
|
|
759
|
-
return res;
|
|
760
|
-
};
|
|
761
|
-
var convertXyz65ToRgb_default = convertXyz65ToRgb;
|
|
762
|
-
|
|
763
|
-
//#endregion
|
|
764
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/a98/definition.js
|
|
765
|
-
const definition$26 = {
|
|
766
|
-
...definition_default$12,
|
|
767
|
-
mode: "a98",
|
|
768
|
-
parse: ["a98-rgb"],
|
|
769
|
-
serialize: "a98-rgb",
|
|
770
|
-
fromMode: {
|
|
771
|
-
rgb: (color) => convertXyz65ToA98_default(convertRgbToXyz65_default(color)),
|
|
772
|
-
xyz65: convertXyz65ToA98_default
|
|
773
|
-
},
|
|
774
|
-
toMode: {
|
|
775
|
-
rgb: (color) => convertXyz65ToRgb_default(convertA98ToXyz65_default(color)),
|
|
776
|
-
xyz65: convertA98ToXyz65_default
|
|
777
|
-
}
|
|
778
|
-
};
|
|
779
|
-
var definition_default = definition$26;
|
|
780
|
-
|
|
781
|
-
//#endregion
|
|
782
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/util/normalizeHue.js
|
|
783
|
-
const normalizeHue = (hue$2) => (hue$2 = hue$2 % 360) < 0 ? hue$2 + 360 : hue$2;
|
|
784
|
-
var normalizeHue_default = normalizeHue;
|
|
785
|
-
|
|
786
|
-
//#endregion
|
|
787
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/hsl/convertHslToRgb.js
|
|
788
|
-
function convertHslToRgb({ h, s, l, alpha }) {
|
|
789
|
-
h = normalizeHue_default(h !== void 0 ? h : 0);
|
|
790
|
-
if (s === void 0) s = 0;
|
|
791
|
-
if (l === void 0) l = 0;
|
|
792
|
-
let m1 = l + s * (l < .5 ? l : 1 - l);
|
|
793
|
-
let m2 = m1 - (m1 - l) * 2 * Math.abs(h / 60 % 2 - 1);
|
|
794
|
-
let res;
|
|
795
|
-
switch (Math.floor(h / 60)) {
|
|
796
|
-
case 0:
|
|
797
|
-
res = {
|
|
798
|
-
r: m1,
|
|
799
|
-
g: m2,
|
|
800
|
-
b: 2 * l - m1
|
|
801
|
-
};
|
|
802
|
-
break;
|
|
803
|
-
case 1:
|
|
804
|
-
res = {
|
|
805
|
-
r: m2,
|
|
806
|
-
g: m1,
|
|
807
|
-
b: 2 * l - m1
|
|
808
|
-
};
|
|
809
|
-
break;
|
|
810
|
-
case 2:
|
|
811
|
-
res = {
|
|
812
|
-
r: 2 * l - m1,
|
|
813
|
-
g: m1,
|
|
814
|
-
b: m2
|
|
815
|
-
};
|
|
816
|
-
break;
|
|
817
|
-
case 3:
|
|
818
|
-
res = {
|
|
819
|
-
r: 2 * l - m1,
|
|
820
|
-
g: m2,
|
|
821
|
-
b: m1
|
|
822
|
-
};
|
|
823
|
-
break;
|
|
824
|
-
case 4:
|
|
825
|
-
res = {
|
|
826
|
-
r: m2,
|
|
827
|
-
g: 2 * l - m1,
|
|
828
|
-
b: m1
|
|
829
|
-
};
|
|
830
|
-
break;
|
|
831
|
-
case 5:
|
|
832
|
-
res = {
|
|
833
|
-
r: m1,
|
|
834
|
-
g: 2 * l - m1,
|
|
835
|
-
b: m2
|
|
836
|
-
};
|
|
837
|
-
break;
|
|
838
|
-
default: res = {
|
|
839
|
-
r: 2 * l - m1,
|
|
840
|
-
g: 2 * l - m1,
|
|
841
|
-
b: 2 * l - m1
|
|
842
|
-
};
|
|
843
|
-
}
|
|
844
|
-
res.mode = "rgb";
|
|
845
|
-
if (alpha !== void 0) res.alpha = alpha;
|
|
846
|
-
return res;
|
|
847
|
-
}
|
|
848
|
-
|
|
849
|
-
//#endregion
|
|
850
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/hsl/convertRgbToHsl.js
|
|
851
|
-
function convertRgbToHsl({ r: r$1, g, b, alpha }) {
|
|
852
|
-
if (r$1 === void 0) r$1 = 0;
|
|
853
|
-
if (g === void 0) g = 0;
|
|
854
|
-
if (b === void 0) b = 0;
|
|
855
|
-
let M$1 = Math.max(r$1, g, b), m = Math.min(r$1, g, b);
|
|
856
|
-
let res = {
|
|
857
|
-
mode: "hsl",
|
|
858
|
-
s: M$1 === m ? 0 : (M$1 - m) / (1 - Math.abs(M$1 + m - 1)),
|
|
859
|
-
l: .5 * (M$1 + m)
|
|
860
|
-
};
|
|
861
|
-
if (M$1 - m !== 0) res.h = (M$1 === r$1 ? (g - b) / (M$1 - m) + (g < b) * 6 : M$1 === g ? (b - r$1) / (M$1 - m) + 2 : (r$1 - g) / (M$1 - m) + 4) * 60;
|
|
862
|
-
if (alpha !== void 0) res.alpha = alpha;
|
|
863
|
-
return res;
|
|
864
|
-
}
|
|
865
|
-
|
|
866
|
-
//#endregion
|
|
867
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/util/hue.js
|
|
868
|
-
const hueToDeg = (val, unit) => {
|
|
869
|
-
switch (unit) {
|
|
870
|
-
case "deg": return +val;
|
|
871
|
-
case "rad": return val / Math.PI * 180;
|
|
872
|
-
case "grad": return val / 10 * 9;
|
|
873
|
-
case "turn": return val * 360;
|
|
874
|
-
}
|
|
875
|
-
};
|
|
876
|
-
var hue_default = hueToDeg;
|
|
877
|
-
|
|
878
|
-
//#endregion
|
|
879
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/hsl/parseHslLegacy.js
|
|
880
|
-
const hsl_old = /* @__PURE__ */ new RegExp(`^hsla?\\(\\s*${hue$1}${c}${per}${c}${per}\\s*(?:,\\s*${num_per}\\s*)?\\)$`);
|
|
881
|
-
const parseHslLegacy = (color) => {
|
|
882
|
-
let match = color.match(hsl_old);
|
|
883
|
-
if (!match) return;
|
|
884
|
-
let res = { mode: "hsl" };
|
|
885
|
-
if (match[3] !== void 0) res.h = +match[3];
|
|
886
|
-
else if (match[1] !== void 0 && match[2] !== void 0) res.h = hue_default(match[1], match[2]);
|
|
887
|
-
if (match[4] !== void 0) res.s = Math.min(Math.max(0, match[4] / 100), 1);
|
|
888
|
-
if (match[5] !== void 0) res.l = Math.min(Math.max(0, match[5] / 100), 1);
|
|
889
|
-
if (match[6] !== void 0) res.alpha = Math.max(0, Math.min(1, match[6] / 100));
|
|
890
|
-
else if (match[7] !== void 0) res.alpha = Math.max(0, Math.min(1, +match[7]));
|
|
891
|
-
return res;
|
|
892
|
-
};
|
|
893
|
-
var parseHslLegacy_default = parseHslLegacy;
|
|
894
|
-
|
|
895
|
-
//#endregion
|
|
896
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/hsl/parseHsl.js
|
|
897
|
-
function parseHsl(color, parsed) {
|
|
898
|
-
if (!parsed || parsed[0] !== "hsl" && parsed[0] !== "hsla") return;
|
|
899
|
-
const res = { mode: "hsl" };
|
|
900
|
-
const [, h, s, l, alpha] = parsed;
|
|
901
|
-
if (h.type !== Tok.None) {
|
|
902
|
-
if (h.type === Tok.Percentage) return;
|
|
903
|
-
res.h = h.value;
|
|
904
|
-
}
|
|
905
|
-
if (s.type !== Tok.None) {
|
|
906
|
-
if (s.type === Tok.Hue) return;
|
|
907
|
-
res.s = s.value / 100;
|
|
908
|
-
}
|
|
909
|
-
if (l.type !== Tok.None) {
|
|
910
|
-
if (l.type === Tok.Hue) return;
|
|
911
|
-
res.l = l.value / 100;
|
|
912
|
-
}
|
|
913
|
-
if (alpha.type !== Tok.None) res.alpha = Math.min(1, Math.max(0, alpha.type === Tok.Number ? alpha.value : alpha.value / 100));
|
|
914
|
-
return res;
|
|
915
|
-
}
|
|
916
|
-
var parseHsl_default = parseHsl;
|
|
917
|
-
|
|
918
|
-
//#endregion
|
|
919
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/fixup/hue.js
|
|
920
|
-
const hue = (hues, fn$4) => {
|
|
921
|
-
return hues.map((hue$2, idx, arr) => {
|
|
922
|
-
if (hue$2 === void 0) return hue$2;
|
|
923
|
-
let normalized = normalizeHue_default(hue$2);
|
|
924
|
-
if (idx === 0 || hues[idx - 1] === void 0) return normalized;
|
|
925
|
-
return fn$4(normalized - normalizeHue_default(arr[idx - 1]));
|
|
926
|
-
}).reduce((acc, curr) => {
|
|
927
|
-
if (!acc.length || curr === void 0 || acc[acc.length - 1] === void 0) {
|
|
928
|
-
acc.push(curr);
|
|
929
|
-
return acc;
|
|
930
|
-
}
|
|
931
|
-
acc.push(curr + acc[acc.length - 1]);
|
|
932
|
-
return acc;
|
|
933
|
-
}, []);
|
|
934
|
-
};
|
|
935
|
-
const fixupHueShorter = (arr) => hue(arr, (d) => Math.abs(d) <= 180 ? d : d - 360 * Math.sign(d));
|
|
936
|
-
|
|
937
|
-
//#endregion
|
|
938
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/difference.js
|
|
939
|
-
const differenceHueSaturation = (std, smp) => {
|
|
940
|
-
if (std.h === void 0 || smp.h === void 0 || !std.s || !smp.s) return 0;
|
|
941
|
-
let std_h = normalizeHue_default(std.h);
|
|
942
|
-
let smp_h = normalizeHue_default(smp.h);
|
|
943
|
-
let dH = Math.sin((smp_h - std_h + 360) / 2 * Math.PI / 180);
|
|
944
|
-
return 2 * Math.sqrt(std.s * smp.s) * dH;
|
|
945
|
-
};
|
|
946
|
-
const differenceHueNaive = (std, smp) => {
|
|
947
|
-
if (std.h === void 0 || smp.h === void 0) return 0;
|
|
948
|
-
let std_h = normalizeHue_default(std.h);
|
|
949
|
-
let smp_h = normalizeHue_default(smp.h);
|
|
950
|
-
if (Math.abs(smp_h - std_h) > 180) return std_h - (smp_h - 360 * Math.sign(smp_h - std_h));
|
|
951
|
-
return smp_h - std_h;
|
|
952
|
-
};
|
|
953
|
-
const differenceHueChroma = (std, smp) => {
|
|
954
|
-
if (std.h === void 0 || smp.h === void 0 || !std.c || !smp.c) return 0;
|
|
955
|
-
let std_h = normalizeHue_default(std.h);
|
|
956
|
-
let smp_h = normalizeHue_default(smp.h);
|
|
957
|
-
let dH = Math.sin((smp_h - std_h + 360) / 2 * Math.PI / 180);
|
|
958
|
-
return 2 * Math.sqrt(std.c * smp.c) * dH;
|
|
959
|
-
};
|
|
960
|
-
const differenceEuclidean = (mode = "rgb", weights = [
|
|
961
|
-
1,
|
|
962
|
-
1,
|
|
963
|
-
1,
|
|
964
|
-
0
|
|
965
|
-
]) => {
|
|
966
|
-
let def = getMode(mode);
|
|
967
|
-
let channels = def.channels;
|
|
968
|
-
let diffs = def.difference;
|
|
969
|
-
let conv = converter_default(mode);
|
|
970
|
-
return (std, smp) => {
|
|
971
|
-
let ConvStd = conv(std);
|
|
972
|
-
let ConvSmp = conv(smp);
|
|
973
|
-
return Math.sqrt(channels.reduce((sum, k$3, idx) => {
|
|
974
|
-
let delta = diffs[k$3] ? diffs[k$3](ConvStd, ConvSmp) : ConvStd[k$3] - ConvSmp[k$3];
|
|
975
|
-
return sum + (weights[idx] || 0) * Math.pow(isNaN(delta) ? 0 : delta, 2);
|
|
976
|
-
}, 0));
|
|
977
|
-
};
|
|
978
|
-
};
|
|
979
|
-
|
|
980
|
-
//#endregion
|
|
981
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/average.js
|
|
982
|
-
const averageAngle = (val) => {
|
|
983
|
-
let sum = val.reduce((sum$1, val$1) => {
|
|
984
|
-
if (val$1 !== void 0) {
|
|
985
|
-
let rad = val$1 * Math.PI / 180;
|
|
986
|
-
sum$1.sin += Math.sin(rad);
|
|
987
|
-
sum$1.cos += Math.cos(rad);
|
|
988
|
-
}
|
|
989
|
-
return sum$1;
|
|
990
|
-
}, {
|
|
991
|
-
sin: 0,
|
|
992
|
-
cos: 0
|
|
993
|
-
});
|
|
994
|
-
let angle = Math.atan2(sum.sin, sum.cos) * 180 / Math.PI;
|
|
995
|
-
return angle < 0 ? 360 + angle : angle;
|
|
996
|
-
};
|
|
997
|
-
|
|
998
|
-
//#endregion
|
|
999
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/hsl/definition.js
|
|
1000
|
-
const definition$25 = {
|
|
1001
|
-
mode: "hsl",
|
|
1002
|
-
toMode: { rgb: convertHslToRgb },
|
|
1003
|
-
fromMode: { rgb: convertRgbToHsl },
|
|
1004
|
-
channels: [
|
|
1005
|
-
"h",
|
|
1006
|
-
"s",
|
|
1007
|
-
"l",
|
|
1008
|
-
"alpha"
|
|
1009
|
-
],
|
|
1010
|
-
ranges: { h: [0, 360] },
|
|
1011
|
-
gamut: "rgb",
|
|
1012
|
-
parse: [parseHsl_default, parseHslLegacy_default],
|
|
1013
|
-
serialize: (c$1) => `hsl(${c$1.h !== void 0 ? c$1.h : "none"} ${c$1.s !== void 0 ? c$1.s * 100 + "%" : "none"} ${c$1.l !== void 0 ? c$1.l * 100 + "%" : "none"}${c$1.alpha < 1 ? ` / ${c$1.alpha}` : ""})`,
|
|
1014
|
-
interpolate: {
|
|
1015
|
-
h: {
|
|
1016
|
-
use: interpolatorLinear,
|
|
1017
|
-
fixup: fixupHueShorter
|
|
1018
|
-
},
|
|
1019
|
-
s: interpolatorLinear,
|
|
1020
|
-
l: interpolatorLinear,
|
|
1021
|
-
alpha: {
|
|
1022
|
-
use: interpolatorLinear,
|
|
1023
|
-
fixup: fixupAlpha
|
|
1024
|
-
}
|
|
1025
|
-
},
|
|
1026
|
-
difference: { h: differenceHueSaturation },
|
|
1027
|
-
average: { h: averageAngle }
|
|
1028
|
-
};
|
|
1029
|
-
var definition_default$1 = definition$25;
|
|
1030
|
-
|
|
1031
|
-
//#endregion
|
|
1032
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/hsv/convertHsvToRgb.js
|
|
1033
|
-
function convertHsvToRgb({ h, s, v, alpha }) {
|
|
1034
|
-
h = normalizeHue_default(h !== void 0 ? h : 0);
|
|
1035
|
-
if (s === void 0) s = 0;
|
|
1036
|
-
if (v === void 0) v = 0;
|
|
1037
|
-
let f$2 = Math.abs(h / 60 % 2 - 1);
|
|
1038
|
-
let res;
|
|
1039
|
-
switch (Math.floor(h / 60)) {
|
|
1040
|
-
case 0:
|
|
1041
|
-
res = {
|
|
1042
|
-
r: v,
|
|
1043
|
-
g: v * (1 - s * f$2),
|
|
1044
|
-
b: v * (1 - s)
|
|
1045
|
-
};
|
|
1046
|
-
break;
|
|
1047
|
-
case 1:
|
|
1048
|
-
res = {
|
|
1049
|
-
r: v * (1 - s * f$2),
|
|
1050
|
-
g: v,
|
|
1051
|
-
b: v * (1 - s)
|
|
1052
|
-
};
|
|
1053
|
-
break;
|
|
1054
|
-
case 2:
|
|
1055
|
-
res = {
|
|
1056
|
-
r: v * (1 - s),
|
|
1057
|
-
g: v,
|
|
1058
|
-
b: v * (1 - s * f$2)
|
|
1059
|
-
};
|
|
1060
|
-
break;
|
|
1061
|
-
case 3:
|
|
1062
|
-
res = {
|
|
1063
|
-
r: v * (1 - s),
|
|
1064
|
-
g: v * (1 - s * f$2),
|
|
1065
|
-
b: v
|
|
1066
|
-
};
|
|
1067
|
-
break;
|
|
1068
|
-
case 4:
|
|
1069
|
-
res = {
|
|
1070
|
-
r: v * (1 - s * f$2),
|
|
1071
|
-
g: v * (1 - s),
|
|
1072
|
-
b: v
|
|
1073
|
-
};
|
|
1074
|
-
break;
|
|
1075
|
-
case 5:
|
|
1076
|
-
res = {
|
|
1077
|
-
r: v,
|
|
1078
|
-
g: v * (1 - s),
|
|
1079
|
-
b: v * (1 - s * f$2)
|
|
1080
|
-
};
|
|
1081
|
-
break;
|
|
1082
|
-
default: res = {
|
|
1083
|
-
r: v * (1 - s),
|
|
1084
|
-
g: v * (1 - s),
|
|
1085
|
-
b: v * (1 - s)
|
|
1086
|
-
};
|
|
1087
|
-
}
|
|
1088
|
-
res.mode = "rgb";
|
|
1089
|
-
if (alpha !== void 0) res.alpha = alpha;
|
|
1090
|
-
return res;
|
|
1091
|
-
}
|
|
1092
|
-
|
|
1093
|
-
//#endregion
|
|
1094
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/hsv/convertRgbToHsv.js
|
|
1095
|
-
function convertRgbToHsv({ r: r$1, g, b, alpha }) {
|
|
1096
|
-
if (r$1 === void 0) r$1 = 0;
|
|
1097
|
-
if (g === void 0) g = 0;
|
|
1098
|
-
if (b === void 0) b = 0;
|
|
1099
|
-
let M$1 = Math.max(r$1, g, b), m = Math.min(r$1, g, b);
|
|
1100
|
-
let res = {
|
|
1101
|
-
mode: "hsv",
|
|
1102
|
-
s: M$1 === 0 ? 0 : 1 - m / M$1,
|
|
1103
|
-
v: M$1
|
|
1104
|
-
};
|
|
1105
|
-
if (M$1 - m !== 0) res.h = (M$1 === r$1 ? (g - b) / (M$1 - m) + (g < b) * 6 : M$1 === g ? (b - r$1) / (M$1 - m) + 2 : (r$1 - g) / (M$1 - m) + 4) * 60;
|
|
1106
|
-
if (alpha !== void 0) res.alpha = alpha;
|
|
1107
|
-
return res;
|
|
1108
|
-
}
|
|
1109
|
-
|
|
1110
|
-
//#endregion
|
|
1111
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/hsv/definition.js
|
|
1112
|
-
const definition$24 = {
|
|
1113
|
-
mode: "hsv",
|
|
1114
|
-
toMode: { rgb: convertHsvToRgb },
|
|
1115
|
-
parse: ["--hsv"],
|
|
1116
|
-
serialize: "--hsv",
|
|
1117
|
-
fromMode: { rgb: convertRgbToHsv },
|
|
1118
|
-
channels: [
|
|
1119
|
-
"h",
|
|
1120
|
-
"s",
|
|
1121
|
-
"v",
|
|
1122
|
-
"alpha"
|
|
1123
|
-
],
|
|
1124
|
-
ranges: { h: [0, 360] },
|
|
1125
|
-
gamut: "rgb",
|
|
1126
|
-
interpolate: {
|
|
1127
|
-
h: {
|
|
1128
|
-
use: interpolatorLinear,
|
|
1129
|
-
fixup: fixupHueShorter
|
|
1130
|
-
},
|
|
1131
|
-
s: interpolatorLinear,
|
|
1132
|
-
v: interpolatorLinear,
|
|
1133
|
-
alpha: {
|
|
1134
|
-
use: interpolatorLinear,
|
|
1135
|
-
fixup: fixupAlpha
|
|
1136
|
-
}
|
|
1137
|
-
},
|
|
1138
|
-
difference: { h: differenceHueSaturation },
|
|
1139
|
-
average: { h: averageAngle }
|
|
1140
|
-
};
|
|
1141
|
-
var definition_default$19 = definition$24;
|
|
1142
|
-
|
|
1143
|
-
//#endregion
|
|
1144
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/hwb/convertHwbToRgb.js
|
|
1145
|
-
function convertHwbToRgb({ h, w, b, alpha }) {
|
|
1146
|
-
if (w === void 0) w = 0;
|
|
1147
|
-
if (b === void 0) b = 0;
|
|
1148
|
-
if (w + b > 1) {
|
|
1149
|
-
let s = w + b;
|
|
1150
|
-
w /= s;
|
|
1151
|
-
b /= s;
|
|
1152
|
-
}
|
|
1153
|
-
return convertHsvToRgb({
|
|
1154
|
-
h,
|
|
1155
|
-
s: b === 1 ? 1 : 1 - w / (1 - b),
|
|
1156
|
-
v: 1 - b,
|
|
1157
|
-
alpha
|
|
1158
|
-
});
|
|
1159
|
-
}
|
|
1160
|
-
|
|
1161
|
-
//#endregion
|
|
1162
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/hwb/convertRgbToHwb.js
|
|
1163
|
-
function convertRgbToHwb(rgba) {
|
|
1164
|
-
let hsv$2 = convertRgbToHsv(rgba);
|
|
1165
|
-
if (hsv$2 === void 0) return void 0;
|
|
1166
|
-
let s = hsv$2.s !== void 0 ? hsv$2.s : 0;
|
|
1167
|
-
let v = hsv$2.v !== void 0 ? hsv$2.v : 0;
|
|
1168
|
-
let res = {
|
|
1169
|
-
mode: "hwb",
|
|
1170
|
-
w: (1 - s) * v,
|
|
1171
|
-
b: 1 - v
|
|
1172
|
-
};
|
|
1173
|
-
if (hsv$2.h !== void 0) res.h = hsv$2.h;
|
|
1174
|
-
if (hsv$2.alpha !== void 0) res.alpha = hsv$2.alpha;
|
|
1175
|
-
return res;
|
|
1176
|
-
}
|
|
1177
|
-
|
|
1178
|
-
//#endregion
|
|
1179
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/hwb/parseHwb.js
|
|
1180
|
-
function ParseHwb(color, parsed) {
|
|
1181
|
-
if (!parsed || parsed[0] !== "hwb") return;
|
|
1182
|
-
const res = { mode: "hwb" };
|
|
1183
|
-
const [, h, w, b, alpha] = parsed;
|
|
1184
|
-
if (h.type !== Tok.None) {
|
|
1185
|
-
if (h.type === Tok.Percentage) return;
|
|
1186
|
-
res.h = h.value;
|
|
1187
|
-
}
|
|
1188
|
-
if (w.type !== Tok.None) {
|
|
1189
|
-
if (w.type === Tok.Hue) return;
|
|
1190
|
-
res.w = w.value / 100;
|
|
1191
|
-
}
|
|
1192
|
-
if (b.type !== Tok.None) {
|
|
1193
|
-
if (b.type === Tok.Hue) return;
|
|
1194
|
-
res.b = b.value / 100;
|
|
1195
|
-
}
|
|
1196
|
-
if (alpha.type !== Tok.None) res.alpha = Math.min(1, Math.max(0, alpha.type === Tok.Number ? alpha.value : alpha.value / 100));
|
|
1197
|
-
return res;
|
|
1198
|
-
}
|
|
1199
|
-
var parseHwb_default = ParseHwb;
|
|
1200
|
-
|
|
1201
|
-
//#endregion
|
|
1202
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/hwb/definition.js
|
|
1203
|
-
const definition$23 = {
|
|
1204
|
-
mode: "hwb",
|
|
1205
|
-
toMode: { rgb: convertHwbToRgb },
|
|
1206
|
-
fromMode: { rgb: convertRgbToHwb },
|
|
1207
|
-
channels: [
|
|
1208
|
-
"h",
|
|
1209
|
-
"w",
|
|
1210
|
-
"b",
|
|
1211
|
-
"alpha"
|
|
1212
|
-
],
|
|
1213
|
-
ranges: { h: [0, 360] },
|
|
1214
|
-
gamut: "rgb",
|
|
1215
|
-
parse: [parseHwb_default],
|
|
1216
|
-
serialize: (c$1) => `hwb(${c$1.h !== void 0 ? c$1.h : "none"} ${c$1.w !== void 0 ? c$1.w * 100 + "%" : "none"} ${c$1.b !== void 0 ? c$1.b * 100 + "%" : "none"}${c$1.alpha < 1 ? ` / ${c$1.alpha}` : ""})`,
|
|
1217
|
-
interpolate: {
|
|
1218
|
-
h: {
|
|
1219
|
-
use: interpolatorLinear,
|
|
1220
|
-
fixup: fixupHueShorter
|
|
1221
|
-
},
|
|
1222
|
-
w: interpolatorLinear,
|
|
1223
|
-
b: interpolatorLinear,
|
|
1224
|
-
alpha: {
|
|
1225
|
-
use: interpolatorLinear,
|
|
1226
|
-
fixup: fixupAlpha
|
|
1227
|
-
}
|
|
1228
|
-
},
|
|
1229
|
-
difference: { h: differenceHueNaive },
|
|
1230
|
-
average: { h: averageAngle }
|
|
1231
|
-
};
|
|
1232
|
-
var definition_default$2 = definition$23;
|
|
1233
|
-
|
|
1234
|
-
//#endregion
|
|
1235
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/xyz50/constants.js
|
|
1236
|
-
const k = Math.pow(29, 3) / Math.pow(3, 3);
|
|
1237
|
-
const e = Math.pow(6, 3) / Math.pow(29, 3);
|
|
1238
|
-
|
|
1239
|
-
//#endregion
|
|
1240
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/constants.js
|
|
1241
|
-
const D50 = {
|
|
1242
|
-
X: .3457 / .3585,
|
|
1243
|
-
Y: 1,
|
|
1244
|
-
Z: .2958 / .3585
|
|
1245
|
-
};
|
|
1246
|
-
const D65 = {
|
|
1247
|
-
X: .3127 / .329,
|
|
1248
|
-
Y: 1,
|
|
1249
|
-
Z: .3583 / .329
|
|
1250
|
-
};
|
|
1251
|
-
const k$2 = Math.pow(29, 3) / Math.pow(3, 3);
|
|
1252
|
-
const e$2 = Math.pow(6, 3) / Math.pow(29, 3);
|
|
1253
|
-
|
|
1254
|
-
//#endregion
|
|
1255
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/lab/convertLabToXyz50.js
|
|
1256
|
-
let fn$1 = (v) => Math.pow(v, 3) > e ? Math.pow(v, 3) : (116 * v - 16) / k;
|
|
1257
|
-
const convertLabToXyz50 = ({ l, a, b, alpha }) => {
|
|
1258
|
-
if (l === void 0) l = 0;
|
|
1259
|
-
if (a === void 0) a = 0;
|
|
1260
|
-
if (b === void 0) b = 0;
|
|
1261
|
-
let fy = (l + 16) / 116;
|
|
1262
|
-
let fx = a / 500 + fy;
|
|
1263
|
-
let fz = fy - b / 200;
|
|
1264
|
-
let res = {
|
|
1265
|
-
mode: "xyz50",
|
|
1266
|
-
x: fn$1(fx) * D50.X,
|
|
1267
|
-
y: fn$1(fy) * D50.Y,
|
|
1268
|
-
z: fn$1(fz) * D50.Z
|
|
1269
|
-
};
|
|
1270
|
-
if (alpha !== void 0) res.alpha = alpha;
|
|
1271
|
-
return res;
|
|
1272
|
-
};
|
|
1273
|
-
var convertLabToXyz50_default = convertLabToXyz50;
|
|
1274
|
-
|
|
1275
|
-
//#endregion
|
|
1276
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/xyz50/convertXyz50ToRgb.js
|
|
1277
|
-
const convertXyz50ToRgb = ({ x, y, z, alpha }) => {
|
|
1278
|
-
if (x === void 0) x = 0;
|
|
1279
|
-
if (y === void 0) y = 0;
|
|
1280
|
-
if (z === void 0) z = 0;
|
|
1281
|
-
let res = convertLrgbToRgb_default({
|
|
1282
|
-
r: x * 3.1341359569958707 - y * 1.6173863321612538 - .4906619460083532 * z,
|
|
1283
|
-
g: x * -.978795502912089 + y * 1.916254567259524 + .03344273116131949 * z,
|
|
1284
|
-
b: x * .07195537988411677 - y * .2289768264158322 + 1.405386058324125 * z
|
|
1285
|
-
});
|
|
1286
|
-
if (alpha !== void 0) res.alpha = alpha;
|
|
1287
|
-
return res;
|
|
1288
|
-
};
|
|
1289
|
-
var convertXyz50ToRgb_default = convertXyz50ToRgb;
|
|
1290
|
-
|
|
1291
|
-
//#endregion
|
|
1292
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/lab/convertLabToRgb.js
|
|
1293
|
-
const convertLabToRgb = (lab$2) => convertXyz50ToRgb_default(convertLabToXyz50_default(lab$2));
|
|
1294
|
-
var convertLabToRgb_default = convertLabToRgb;
|
|
1295
|
-
|
|
1296
|
-
//#endregion
|
|
1297
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/xyz50/convertRgbToXyz50.js
|
|
1298
|
-
const convertRgbToXyz50 = (rgb$4) => {
|
|
1299
|
-
let { r: r$1, g, b, alpha } = convertRgbToLrgb_default(rgb$4);
|
|
1300
|
-
let res = {
|
|
1301
|
-
mode: "xyz50",
|
|
1302
|
-
x: .436065742824811 * r$1 + .3851514688337912 * g + .14307845442264197 * b,
|
|
1303
|
-
y: .22249319175623702 * r$1 + .7168870538238823 * g + .06061979053616537 * b,
|
|
1304
|
-
z: .013923904500943465 * r$1 + .09708128566574634 * g + .7140993584005155 * b
|
|
1305
|
-
};
|
|
1306
|
-
if (alpha !== void 0) res.alpha = alpha;
|
|
1307
|
-
return res;
|
|
1308
|
-
};
|
|
1309
|
-
var convertRgbToXyz50_default = convertRgbToXyz50;
|
|
1310
|
-
|
|
1311
|
-
//#endregion
|
|
1312
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/lab/convertXyz50ToLab.js
|
|
1313
|
-
const f$1 = (value) => value > e ? Math.cbrt(value) : (k * value + 16) / 116;
|
|
1314
|
-
const convertXyz50ToLab = ({ x, y, z, alpha }) => {
|
|
1315
|
-
if (x === void 0) x = 0;
|
|
1316
|
-
if (y === void 0) y = 0;
|
|
1317
|
-
if (z === void 0) z = 0;
|
|
1318
|
-
let f0 = f$1(x / D50.X);
|
|
1319
|
-
let f1 = f$1(y / D50.Y);
|
|
1320
|
-
let f2 = f$1(z / D50.Z);
|
|
1321
|
-
let res = {
|
|
1322
|
-
mode: "lab",
|
|
1323
|
-
l: 116 * f1 - 16,
|
|
1324
|
-
a: 500 * (f0 - f1),
|
|
1325
|
-
b: 200 * (f1 - f2)
|
|
1326
|
-
};
|
|
1327
|
-
if (alpha !== void 0) res.alpha = alpha;
|
|
1328
|
-
return res;
|
|
1329
|
-
};
|
|
1330
|
-
var convertXyz50ToLab_default = convertXyz50ToLab;
|
|
1331
|
-
|
|
1332
|
-
//#endregion
|
|
1333
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/lab/convertRgbToLab.js
|
|
1334
|
-
const convertRgbToLab = (rgb$4) => {
|
|
1335
|
-
let res = convertXyz50ToLab_default(convertRgbToXyz50_default(rgb$4));
|
|
1336
|
-
if (rgb$4.r === rgb$4.b && rgb$4.b === rgb$4.g) res.a = res.b = 0;
|
|
1337
|
-
return res;
|
|
1338
|
-
};
|
|
1339
|
-
var convertRgbToLab_default = convertRgbToLab;
|
|
1340
|
-
|
|
1341
|
-
//#endregion
|
|
1342
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/lab/parseLab.js
|
|
1343
|
-
function parseLab(color, parsed) {
|
|
1344
|
-
if (!parsed || parsed[0] !== "lab") return;
|
|
1345
|
-
const res = { mode: "lab" };
|
|
1346
|
-
const [, l, a, b, alpha] = parsed;
|
|
1347
|
-
if (l.type === Tok.Hue || a.type === Tok.Hue || b.type === Tok.Hue) return;
|
|
1348
|
-
if (l.type !== Tok.None) res.l = Math.min(Math.max(0, l.value), 100);
|
|
1349
|
-
if (a.type !== Tok.None) res.a = a.type === Tok.Number ? a.value : a.value * 125 / 100;
|
|
1350
|
-
if (b.type !== Tok.None) res.b = b.type === Tok.Number ? b.value : b.value * 125 / 100;
|
|
1351
|
-
if (alpha.type !== Tok.None) res.alpha = Math.min(1, Math.max(0, alpha.type === Tok.Number ? alpha.value : alpha.value / 100));
|
|
1352
|
-
return res;
|
|
1353
|
-
}
|
|
1354
|
-
var parseLab_default = parseLab;
|
|
1355
|
-
|
|
1356
|
-
//#endregion
|
|
1357
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/lab/definition.js
|
|
1358
|
-
const definition$22 = {
|
|
1359
|
-
mode: "lab",
|
|
1360
|
-
toMode: {
|
|
1361
|
-
xyz50: convertLabToXyz50_default,
|
|
1362
|
-
rgb: convertLabToRgb_default
|
|
1363
|
-
},
|
|
1364
|
-
fromMode: {
|
|
1365
|
-
xyz50: convertXyz50ToLab_default,
|
|
1366
|
-
rgb: convertRgbToLab_default
|
|
1367
|
-
},
|
|
1368
|
-
channels: [
|
|
1369
|
-
"l",
|
|
1370
|
-
"a",
|
|
1371
|
-
"b",
|
|
1372
|
-
"alpha"
|
|
1373
|
-
],
|
|
1374
|
-
ranges: {
|
|
1375
|
-
l: [0, 100],
|
|
1376
|
-
a: [-125, 125],
|
|
1377
|
-
b: [-125, 125]
|
|
1378
|
-
},
|
|
1379
|
-
parse: [parseLab_default],
|
|
1380
|
-
serialize: (c$1) => `lab(${c$1.l !== void 0 ? c$1.l : "none"} ${c$1.a !== void 0 ? c$1.a : "none"} ${c$1.b !== void 0 ? c$1.b : "none"}${c$1.alpha < 1 ? ` / ${c$1.alpha}` : ""})`,
|
|
1381
|
-
interpolate: {
|
|
1382
|
-
l: interpolatorLinear,
|
|
1383
|
-
a: interpolatorLinear,
|
|
1384
|
-
b: interpolatorLinear,
|
|
1385
|
-
alpha: {
|
|
1386
|
-
use: interpolatorLinear,
|
|
1387
|
-
fixup: fixupAlpha
|
|
1388
|
-
}
|
|
1389
|
-
}
|
|
1390
|
-
};
|
|
1391
|
-
var definition_default$3 = definition$22;
|
|
1392
|
-
|
|
1393
|
-
//#endregion
|
|
1394
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/xyz65/constants.js
|
|
1395
|
-
const k$1 = Math.pow(29, 3) / Math.pow(3, 3);
|
|
1396
|
-
const e$1 = Math.pow(6, 3) / Math.pow(29, 3);
|
|
1397
|
-
|
|
1398
|
-
//#endregion
|
|
1399
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/lab65/convertLab65ToXyz65.js
|
|
1400
|
-
let fn = (v) => Math.pow(v, 3) > e$1 ? Math.pow(v, 3) : (116 * v - 16) / k$1;
|
|
1401
|
-
const convertLab65ToXyz65 = ({ l, a, b, alpha }) => {
|
|
1402
|
-
if (l === void 0) l = 0;
|
|
1403
|
-
if (a === void 0) a = 0;
|
|
1404
|
-
if (b === void 0) b = 0;
|
|
1405
|
-
let fy = (l + 16) / 116;
|
|
1406
|
-
let fx = a / 500 + fy;
|
|
1407
|
-
let fz = fy - b / 200;
|
|
1408
|
-
let res = {
|
|
1409
|
-
mode: "xyz65",
|
|
1410
|
-
x: fn(fx) * D65.X,
|
|
1411
|
-
y: fn(fy) * D65.Y,
|
|
1412
|
-
z: fn(fz) * D65.Z
|
|
1413
|
-
};
|
|
1414
|
-
if (alpha !== void 0) res.alpha = alpha;
|
|
1415
|
-
return res;
|
|
1416
|
-
};
|
|
1417
|
-
var convertLab65ToXyz65_default = convertLab65ToXyz65;
|
|
1418
|
-
|
|
1419
|
-
//#endregion
|
|
1420
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/lab65/convertLab65ToRgb.js
|
|
1421
|
-
const convertLab65ToRgb = (lab$2) => convertXyz65ToRgb_default(convertLab65ToXyz65_default(lab$2));
|
|
1422
|
-
var convertLab65ToRgb_default = convertLab65ToRgb;
|
|
1423
|
-
|
|
1424
|
-
//#endregion
|
|
1425
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/lab65/convertXyz65ToLab65.js
|
|
1426
|
-
const f = (value) => value > e$1 ? Math.cbrt(value) : (k$1 * value + 16) / 116;
|
|
1427
|
-
const convertXyz65ToLab65 = ({ x, y, z, alpha }) => {
|
|
1428
|
-
if (x === void 0) x = 0;
|
|
1429
|
-
if (y === void 0) y = 0;
|
|
1430
|
-
if (z === void 0) z = 0;
|
|
1431
|
-
let f0 = f(x / D65.X);
|
|
1432
|
-
let f1 = f(y / D65.Y);
|
|
1433
|
-
let f2 = f(z / D65.Z);
|
|
1434
|
-
let res = {
|
|
1435
|
-
mode: "lab65",
|
|
1436
|
-
l: 116 * f1 - 16,
|
|
1437
|
-
a: 500 * (f0 - f1),
|
|
1438
|
-
b: 200 * (f1 - f2)
|
|
1439
|
-
};
|
|
1440
|
-
if (alpha !== void 0) res.alpha = alpha;
|
|
1441
|
-
return res;
|
|
1442
|
-
};
|
|
1443
|
-
var convertXyz65ToLab65_default = convertXyz65ToLab65;
|
|
1444
|
-
|
|
1445
|
-
//#endregion
|
|
1446
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/lab65/convertRgbToLab65.js
|
|
1447
|
-
const convertRgbToLab65 = (rgb$4) => {
|
|
1448
|
-
let res = convertXyz65ToLab65_default(convertRgbToXyz65_default(rgb$4));
|
|
1449
|
-
if (rgb$4.r === rgb$4.b && rgb$4.b === rgb$4.g) res.a = res.b = 0;
|
|
1450
|
-
return res;
|
|
1451
|
-
};
|
|
1452
|
-
var convertRgbToLab65_default = convertRgbToLab65;
|
|
1453
|
-
|
|
1454
|
-
//#endregion
|
|
1455
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/lab65/definition.js
|
|
1456
|
-
const definition$21 = {
|
|
1457
|
-
...definition_default$3,
|
|
1458
|
-
mode: "lab65",
|
|
1459
|
-
parse: ["--lab-d65"],
|
|
1460
|
-
serialize: "--lab-d65",
|
|
1461
|
-
toMode: {
|
|
1462
|
-
xyz65: convertLab65ToXyz65_default,
|
|
1463
|
-
rgb: convertLab65ToRgb_default
|
|
1464
|
-
},
|
|
1465
|
-
fromMode: {
|
|
1466
|
-
xyz65: convertXyz65ToLab65_default,
|
|
1467
|
-
rgb: convertRgbToLab65_default
|
|
1468
|
-
},
|
|
1469
|
-
ranges: {
|
|
1470
|
-
l: [0, 100],
|
|
1471
|
-
a: [-125, 125],
|
|
1472
|
-
b: [-125, 125]
|
|
1473
|
-
}
|
|
1474
|
-
};
|
|
1475
|
-
var definition_default$4 = definition$21;
|
|
1476
|
-
|
|
1477
|
-
//#endregion
|
|
1478
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/lch/convertLabToLch.js
|
|
1479
|
-
const convertLabToLch = ({ l, a, b, alpha }, mode = "lch") => {
|
|
1480
|
-
if (a === void 0) a = 0;
|
|
1481
|
-
if (b === void 0) b = 0;
|
|
1482
|
-
let c$1 = Math.sqrt(a * a + b * b);
|
|
1483
|
-
let res = {
|
|
1484
|
-
mode,
|
|
1485
|
-
l,
|
|
1486
|
-
c: c$1
|
|
1487
|
-
};
|
|
1488
|
-
if (c$1) res.h = normalizeHue_default(Math.atan2(b, a) * 180 / Math.PI);
|
|
1489
|
-
if (alpha !== void 0) res.alpha = alpha;
|
|
1490
|
-
return res;
|
|
1491
|
-
};
|
|
1492
|
-
var convertLabToLch_default = convertLabToLch;
|
|
1493
|
-
|
|
1494
|
-
//#endregion
|
|
1495
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/lch/convertLchToLab.js
|
|
1496
|
-
const convertLchToLab = ({ l, c: c$1, h, alpha }, mode = "lab") => {
|
|
1497
|
-
if (h === void 0) h = 0;
|
|
1498
|
-
let res = {
|
|
1499
|
-
mode,
|
|
1500
|
-
l,
|
|
1501
|
-
a: c$1 ? c$1 * Math.cos(h / 180 * Math.PI) : 0,
|
|
1502
|
-
b: c$1 ? c$1 * Math.sin(h / 180 * Math.PI) : 0
|
|
1503
|
-
};
|
|
1504
|
-
if (alpha !== void 0) res.alpha = alpha;
|
|
1505
|
-
return res;
|
|
1506
|
-
};
|
|
1507
|
-
var convertLchToLab_default = convertLchToLab;
|
|
1508
|
-
|
|
1509
|
-
//#endregion
|
|
1510
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/lch/parseLch.js
|
|
1511
|
-
function parseLch(color, parsed) {
|
|
1512
|
-
if (!parsed || parsed[0] !== "lch") return;
|
|
1513
|
-
const res = { mode: "lch" };
|
|
1514
|
-
const [, l, c$1, h, alpha] = parsed;
|
|
1515
|
-
if (l.type !== Tok.None) {
|
|
1516
|
-
if (l.type === Tok.Hue) return;
|
|
1517
|
-
res.l = Math.min(Math.max(0, l.value), 100);
|
|
1518
|
-
}
|
|
1519
|
-
if (c$1.type !== Tok.None) res.c = Math.max(0, c$1.type === Tok.Number ? c$1.value : c$1.value * 150 / 100);
|
|
1520
|
-
if (h.type !== Tok.None) {
|
|
1521
|
-
if (h.type === Tok.Percentage) return;
|
|
1522
|
-
res.h = h.value;
|
|
1523
|
-
}
|
|
1524
|
-
if (alpha.type !== Tok.None) res.alpha = Math.min(1, Math.max(0, alpha.type === Tok.Number ? alpha.value : alpha.value / 100));
|
|
1525
|
-
return res;
|
|
1526
|
-
}
|
|
1527
|
-
var parseLch_default = parseLch;
|
|
1528
|
-
|
|
1529
|
-
//#endregion
|
|
1530
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/lch/definition.js
|
|
1531
|
-
const definition$20 = {
|
|
1532
|
-
mode: "lch",
|
|
1533
|
-
toMode: {
|
|
1534
|
-
lab: convertLchToLab_default,
|
|
1535
|
-
rgb: (c$1) => convertLabToRgb_default(convertLchToLab_default(c$1))
|
|
1536
|
-
},
|
|
1537
|
-
fromMode: {
|
|
1538
|
-
rgb: (c$1) => convertLabToLch_default(convertRgbToLab_default(c$1)),
|
|
1539
|
-
lab: convertLabToLch_default
|
|
1540
|
-
},
|
|
1541
|
-
channels: [
|
|
1542
|
-
"l",
|
|
1543
|
-
"c",
|
|
1544
|
-
"h",
|
|
1545
|
-
"alpha"
|
|
1546
|
-
],
|
|
1547
|
-
ranges: {
|
|
1548
|
-
l: [0, 100],
|
|
1549
|
-
c: [0, 150],
|
|
1550
|
-
h: [0, 360]
|
|
1551
|
-
},
|
|
1552
|
-
parse: [parseLch_default],
|
|
1553
|
-
serialize: (c$1) => `lch(${c$1.l !== void 0 ? c$1.l : "none"} ${c$1.c !== void 0 ? c$1.c : "none"} ${c$1.h !== void 0 ? c$1.h : "none"}${c$1.alpha < 1 ? ` / ${c$1.alpha}` : ""})`,
|
|
1554
|
-
interpolate: {
|
|
1555
|
-
h: {
|
|
1556
|
-
use: interpolatorLinear,
|
|
1557
|
-
fixup: fixupHueShorter
|
|
1558
|
-
},
|
|
1559
|
-
c: interpolatorLinear,
|
|
1560
|
-
l: interpolatorLinear,
|
|
1561
|
-
alpha: {
|
|
1562
|
-
use: interpolatorLinear,
|
|
1563
|
-
fixup: fixupAlpha
|
|
1564
|
-
}
|
|
1565
|
-
},
|
|
1566
|
-
difference: { h: differenceHueChroma },
|
|
1567
|
-
average: { h: averageAngle }
|
|
1568
|
-
};
|
|
1569
|
-
var definition_default$5 = definition$20;
|
|
1570
|
-
|
|
1571
|
-
//#endregion
|
|
1572
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/lch65/definition.js
|
|
1573
|
-
const definition$19 = {
|
|
1574
|
-
...definition_default$5,
|
|
1575
|
-
mode: "lch65",
|
|
1576
|
-
parse: ["--lch-d65"],
|
|
1577
|
-
serialize: "--lch-d65",
|
|
1578
|
-
toMode: {
|
|
1579
|
-
lab65: (c$1) => convertLchToLab_default(c$1, "lab65"),
|
|
1580
|
-
rgb: (c$1) => convertLab65ToRgb_default(convertLchToLab_default(c$1, "lab65"))
|
|
1581
|
-
},
|
|
1582
|
-
fromMode: {
|
|
1583
|
-
rgb: (c$1) => convertLabToLch_default(convertRgbToLab65_default(c$1), "lch65"),
|
|
1584
|
-
lab65: (c$1) => convertLabToLch_default(c$1, "lch65")
|
|
1585
|
-
},
|
|
1586
|
-
ranges: {
|
|
1587
|
-
l: [0, 100],
|
|
1588
|
-
c: [0, 150],
|
|
1589
|
-
h: [0, 360]
|
|
1590
|
-
}
|
|
1591
|
-
};
|
|
1592
|
-
var definition_default$23 = definition$19;
|
|
1593
|
-
|
|
1594
|
-
//#endregion
|
|
1595
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/lrgb/definition.js
|
|
1596
|
-
const definition$18 = {
|
|
1597
|
-
...definition_default$12,
|
|
1598
|
-
mode: "lrgb",
|
|
1599
|
-
toMode: { rgb: convertLrgbToRgb_default },
|
|
1600
|
-
fromMode: { rgb: convertRgbToLrgb_default },
|
|
1601
|
-
parse: ["srgb-linear"],
|
|
1602
|
-
serialize: "srgb-linear"
|
|
1603
|
-
};
|
|
1604
|
-
var definition_default$6 = definition$18;
|
|
1605
|
-
|
|
1606
|
-
//#endregion
|
|
1607
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/oklab/convertOklabToLrgb.js
|
|
1608
|
-
const convertOklabToLrgb = ({ l, a, b, alpha }) => {
|
|
1609
|
-
if (l === void 0) l = 0;
|
|
1610
|
-
if (a === void 0) a = 0;
|
|
1611
|
-
if (b === void 0) b = 0;
|
|
1612
|
-
let L = Math.pow(l + .3963377773761749 * a + .2158037573099136 * b, 3);
|
|
1613
|
-
let M$1 = Math.pow(l - .1055613458156586 * a - .0638541728258133 * b, 3);
|
|
1614
|
-
let S = Math.pow(l - .0894841775298119 * a - 1.2914855480194092 * b, 3);
|
|
1615
|
-
let res = {
|
|
1616
|
-
mode: "lrgb",
|
|
1617
|
-
r: 4.076741636075957 * L - 3.3077115392580616 * M$1 + .2309699031821044 * S,
|
|
1618
|
-
g: -1.2684379732850317 * L + 2.6097573492876887 * M$1 - .3413193760026573 * S,
|
|
1619
|
-
b: -.0041960761386756 * L - .7034186179359362 * M$1 + 1.7076146940746117 * S
|
|
1620
|
-
};
|
|
1621
|
-
if (alpha !== void 0) res.alpha = alpha;
|
|
1622
|
-
return res;
|
|
1623
|
-
};
|
|
1624
|
-
var convertOklabToLrgb_default = convertOklabToLrgb;
|
|
1625
|
-
|
|
1626
|
-
//#endregion
|
|
1627
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/oklab/convertLrgbToOklab.js
|
|
1628
|
-
const convertLrgbToOklab = ({ r: r$1, g, b, alpha }) => {
|
|
1629
|
-
if (r$1 === void 0) r$1 = 0;
|
|
1630
|
-
if (g === void 0) g = 0;
|
|
1631
|
-
if (b === void 0) b = 0;
|
|
1632
|
-
let L = Math.cbrt(.412221469470763 * r$1 + .5363325372617348 * g + .0514459932675022 * b);
|
|
1633
|
-
let M$1 = Math.cbrt(.2119034958178252 * r$1 + .6806995506452344 * g + .1073969535369406 * b);
|
|
1634
|
-
let S = Math.cbrt(.0883024591900564 * r$1 + .2817188391361215 * g + .6299787016738222 * b);
|
|
1635
|
-
let res = {
|
|
1636
|
-
mode: "oklab",
|
|
1637
|
-
l: .210454268309314 * L + .7936177747023054 * M$1 - .0040720430116193 * S,
|
|
1638
|
-
a: 1.9779985324311684 * L - 2.42859224204858 * M$1 + .450593709617411 * S,
|
|
1639
|
-
b: .0259040424655478 * L + .7827717124575296 * M$1 - .8086757549230774 * S
|
|
1640
|
-
};
|
|
1641
|
-
if (alpha !== void 0) res.alpha = alpha;
|
|
1642
|
-
return res;
|
|
1643
|
-
};
|
|
1644
|
-
var convertLrgbToOklab_default = convertLrgbToOklab;
|
|
1645
|
-
|
|
1646
|
-
//#endregion
|
|
1647
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/oklab/convertRgbToOklab.js
|
|
1648
|
-
const convertRgbToOklab = (rgb$4) => {
|
|
1649
|
-
let res = convertLrgbToOklab_default(convertRgbToLrgb_default(rgb$4));
|
|
1650
|
-
if (rgb$4.r === rgb$4.b && rgb$4.b === rgb$4.g) res.a = res.b = 0;
|
|
1651
|
-
return res;
|
|
1652
|
-
};
|
|
1653
|
-
var convertRgbToOklab_default = convertRgbToOklab;
|
|
1654
|
-
|
|
1655
|
-
//#endregion
|
|
1656
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/oklab/convertOklabToRgb.js
|
|
1657
|
-
const convertOklabToRgb = (c$1) => convertLrgbToRgb_default(convertOklabToLrgb_default(c$1));
|
|
1658
|
-
var convertOklabToRgb_default = convertOklabToRgb;
|
|
1659
|
-
|
|
1660
|
-
//#endregion
|
|
1661
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/oklab/parseOklab.js
|
|
1662
|
-
function parseOklab(color, parsed) {
|
|
1663
|
-
if (!parsed || parsed[0] !== "oklab") return;
|
|
1664
|
-
const res = { mode: "oklab" };
|
|
1665
|
-
const [, l, a, b, alpha] = parsed;
|
|
1666
|
-
if (l.type === Tok.Hue || a.type === Tok.Hue || b.type === Tok.Hue) return;
|
|
1667
|
-
if (l.type !== Tok.None) res.l = Math.min(Math.max(0, l.type === Tok.Number ? l.value : l.value / 100), 1);
|
|
1668
|
-
if (a.type !== Tok.None) res.a = a.type === Tok.Number ? a.value : a.value * .4 / 100;
|
|
1669
|
-
if (b.type !== Tok.None) res.b = b.type === Tok.Number ? b.value : b.value * .4 / 100;
|
|
1670
|
-
if (alpha.type !== Tok.None) res.alpha = Math.min(1, Math.max(0, alpha.type === Tok.Number ? alpha.value : alpha.value / 100));
|
|
1671
|
-
return res;
|
|
1672
|
-
}
|
|
1673
|
-
var parseOklab_default = parseOklab;
|
|
1674
|
-
|
|
1675
|
-
//#endregion
|
|
1676
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/oklab/definition.js
|
|
1677
|
-
const definition$17 = {
|
|
1678
|
-
...definition_default$3,
|
|
1679
|
-
mode: "oklab",
|
|
1680
|
-
toMode: {
|
|
1681
|
-
lrgb: convertOklabToLrgb_default,
|
|
1682
|
-
rgb: convertOklabToRgb_default
|
|
1683
|
-
},
|
|
1684
|
-
fromMode: {
|
|
1685
|
-
lrgb: convertLrgbToOklab_default,
|
|
1686
|
-
rgb: convertRgbToOklab_default
|
|
1687
|
-
},
|
|
1688
|
-
ranges: {
|
|
1689
|
-
l: [0, 1],
|
|
1690
|
-
a: [-.4, .4],
|
|
1691
|
-
b: [-.4, .4]
|
|
1692
|
-
},
|
|
1693
|
-
parse: [parseOklab_default],
|
|
1694
|
-
serialize: (c$1) => `oklab(${c$1.l !== void 0 ? c$1.l : "none"} ${c$1.a !== void 0 ? c$1.a : "none"} ${c$1.b !== void 0 ? c$1.b : "none"}${c$1.alpha < 1 ? ` / ${c$1.alpha}` : ""})`
|
|
1695
|
-
};
|
|
1696
|
-
var definition_default$7 = definition$17;
|
|
1697
|
-
|
|
1698
|
-
//#endregion
|
|
1699
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/oklch/parseOklch.js
|
|
1700
|
-
function parseOklch(color, parsed) {
|
|
1701
|
-
if (!parsed || parsed[0] !== "oklch") return;
|
|
1702
|
-
const res = { mode: "oklch" };
|
|
1703
|
-
const [, l, c$1, h, alpha] = parsed;
|
|
1704
|
-
if (l.type !== Tok.None) {
|
|
1705
|
-
if (l.type === Tok.Hue) return;
|
|
1706
|
-
res.l = Math.min(Math.max(0, l.type === Tok.Number ? l.value : l.value / 100), 1);
|
|
1707
|
-
}
|
|
1708
|
-
if (c$1.type !== Tok.None) res.c = Math.max(0, c$1.type === Tok.Number ? c$1.value : c$1.value * .4 / 100);
|
|
1709
|
-
if (h.type !== Tok.None) {
|
|
1710
|
-
if (h.type === Tok.Percentage) return;
|
|
1711
|
-
res.h = h.value;
|
|
1712
|
-
}
|
|
1713
|
-
if (alpha.type !== Tok.None) res.alpha = Math.min(1, Math.max(0, alpha.type === Tok.Number ? alpha.value : alpha.value / 100));
|
|
1714
|
-
return res;
|
|
1715
|
-
}
|
|
1716
|
-
var parseOklch_default = parseOklch;
|
|
1717
|
-
|
|
1718
|
-
//#endregion
|
|
1719
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/oklch/definition.js
|
|
1720
|
-
const definition$16 = {
|
|
1721
|
-
...definition_default$5,
|
|
1722
|
-
mode: "oklch",
|
|
1723
|
-
toMode: {
|
|
1724
|
-
oklab: (c$1) => convertLchToLab_default(c$1, "oklab"),
|
|
1725
|
-
rgb: (c$1) => convertOklabToRgb_default(convertLchToLab_default(c$1, "oklab"))
|
|
1726
|
-
},
|
|
1727
|
-
fromMode: {
|
|
1728
|
-
rgb: (c$1) => convertLabToLch_default(convertRgbToOklab_default(c$1), "oklch"),
|
|
1729
|
-
oklab: (c$1) => convertLabToLch_default(c$1, "oklch")
|
|
1730
|
-
},
|
|
1731
|
-
parse: [parseOklch_default],
|
|
1732
|
-
serialize: (c$1) => `oklch(${c$1.l !== void 0 ? c$1.l : "none"} ${c$1.c !== void 0 ? c$1.c : "none"} ${c$1.h !== void 0 ? c$1.h : "none"}${c$1.alpha < 1 ? ` / ${c$1.alpha}` : ""})`,
|
|
1733
|
-
ranges: {
|
|
1734
|
-
l: [0, 1],
|
|
1735
|
-
c: [0, .4],
|
|
1736
|
-
h: [0, 360]
|
|
1737
|
-
}
|
|
1738
|
-
};
|
|
1739
|
-
var definition_default$8 = definition$16;
|
|
1740
|
-
|
|
1741
|
-
//#endregion
|
|
1742
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/p3/convertP3ToXyz65.js
|
|
1743
|
-
const convertP3ToXyz65 = (rgb$4) => {
|
|
1744
|
-
let { r: r$1, g, b, alpha } = convertRgbToLrgb_default(rgb$4);
|
|
1745
|
-
let res = {
|
|
1746
|
-
mode: "xyz65",
|
|
1747
|
-
x: .486570948648216 * r$1 + .265667693169093 * g + .1982172852343625 * b,
|
|
1748
|
-
y: .2289745640697487 * r$1 + .6917385218365062 * g + .079286914093745 * b,
|
|
1749
|
-
z: 0 * r$1 + .0451133818589026 * g + 1.043944368900976 * b
|
|
1750
|
-
};
|
|
1751
|
-
if (alpha !== void 0) res.alpha = alpha;
|
|
1752
|
-
return res;
|
|
1753
|
-
};
|
|
1754
|
-
var convertP3ToXyz65_default = convertP3ToXyz65;
|
|
1755
|
-
|
|
1756
|
-
//#endregion
|
|
1757
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/p3/convertXyz65ToP3.js
|
|
1758
|
-
const convertXyz65ToP3 = ({ x, y, z, alpha }) => {
|
|
1759
|
-
if (x === void 0) x = 0;
|
|
1760
|
-
if (y === void 0) y = 0;
|
|
1761
|
-
if (z === void 0) z = 0;
|
|
1762
|
-
let res = convertLrgbToRgb_default({
|
|
1763
|
-
r: x * 2.4934969119414263 - y * .9313836179191242 - .402710784450717 * z,
|
|
1764
|
-
g: x * -.8294889695615749 + y * 1.7626640603183465 + .0236246858419436 * z,
|
|
1765
|
-
b: x * .0358458302437845 - y * .0761723892680418 + .9568845240076871 * z
|
|
1766
|
-
}, "p3");
|
|
1767
|
-
if (alpha !== void 0) res.alpha = alpha;
|
|
1768
|
-
return res;
|
|
1769
|
-
};
|
|
1770
|
-
var convertXyz65ToP3_default = convertXyz65ToP3;
|
|
1771
|
-
|
|
1772
|
-
//#endregion
|
|
1773
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/p3/definition.js
|
|
1774
|
-
const definition$15 = {
|
|
1775
|
-
...definition_default$12,
|
|
1776
|
-
mode: "p3",
|
|
1777
|
-
parse: ["display-p3"],
|
|
1778
|
-
serialize: "display-p3",
|
|
1779
|
-
fromMode: {
|
|
1780
|
-
rgb: (color) => convertXyz65ToP3_default(convertRgbToXyz65_default(color)),
|
|
1781
|
-
xyz65: convertXyz65ToP3_default
|
|
1782
|
-
},
|
|
1783
|
-
toMode: {
|
|
1784
|
-
rgb: (color) => convertXyz65ToRgb_default(convertP3ToXyz65_default(color)),
|
|
1785
|
-
xyz65: convertP3ToXyz65_default
|
|
1786
|
-
}
|
|
1787
|
-
};
|
|
1788
|
-
var definition_default$9 = definition$15;
|
|
1789
|
-
|
|
1790
|
-
//#endregion
|
|
1791
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/prophoto/convertXyz50ToProphoto.js
|
|
1792
|
-
const gamma$1 = (v) => {
|
|
1793
|
-
let abs$1 = Math.abs(v);
|
|
1794
|
-
if (abs$1 >= 1 / 512) return Math.sign(v) * Math.pow(abs$1, 1 / 1.8);
|
|
1795
|
-
return 16 * v;
|
|
1796
|
-
};
|
|
1797
|
-
const convertXyz50ToProphoto = ({ x, y, z, alpha }) => {
|
|
1798
|
-
if (x === void 0) x = 0;
|
|
1799
|
-
if (y === void 0) y = 0;
|
|
1800
|
-
if (z === void 0) z = 0;
|
|
1801
|
-
let res = {
|
|
1802
|
-
mode: "prophoto",
|
|
1803
|
-
r: gamma$1(x * 1.3457868816471585 - y * .2555720873797946 - .0511018649755453 * z),
|
|
1804
|
-
g: gamma$1(x * -.5446307051249019 + y * 1.5082477428451466 + .0205274474364214 * z),
|
|
1805
|
-
b: gamma$1(x * 0 + y * 0 + 1.2119675456389452 * z)
|
|
1806
|
-
};
|
|
1807
|
-
if (alpha !== void 0) res.alpha = alpha;
|
|
1808
|
-
return res;
|
|
1809
|
-
};
|
|
1810
|
-
var convertXyz50ToProphoto_default = convertXyz50ToProphoto;
|
|
1811
|
-
|
|
1812
|
-
//#endregion
|
|
1813
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/prophoto/convertProphotoToXyz50.js
|
|
1814
|
-
const linearize$1 = (v = 0) => {
|
|
1815
|
-
let abs$1 = Math.abs(v);
|
|
1816
|
-
if (abs$1 >= 16 / 512) return Math.sign(v) * Math.pow(abs$1, 1.8);
|
|
1817
|
-
return v / 16;
|
|
1818
|
-
};
|
|
1819
|
-
const convertProphotoToXyz50 = (prophoto$2) => {
|
|
1820
|
-
let r$1 = linearize$1(prophoto$2.r);
|
|
1821
|
-
let g = linearize$1(prophoto$2.g);
|
|
1822
|
-
let b = linearize$1(prophoto$2.b);
|
|
1823
|
-
let res = {
|
|
1824
|
-
mode: "xyz50",
|
|
1825
|
-
x: .7977666449006423 * r$1 + .1351812974005331 * g + .0313477341283922 * b,
|
|
1826
|
-
y: .2880748288194013 * r$1 + .7118352342418731 * g + 899369387256e-16 * b,
|
|
1827
|
-
z: 0 * r$1 + 0 * g + .8251046025104602 * b
|
|
1828
|
-
};
|
|
1829
|
-
if (prophoto$2.alpha !== void 0) res.alpha = prophoto$2.alpha;
|
|
1830
|
-
return res;
|
|
1831
|
-
};
|
|
1832
|
-
var convertProphotoToXyz50_default = convertProphotoToXyz50;
|
|
1833
|
-
|
|
1834
|
-
//#endregion
|
|
1835
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/prophoto/definition.js
|
|
1836
|
-
const definition$14 = {
|
|
1837
|
-
...definition_default$12,
|
|
1838
|
-
mode: "prophoto",
|
|
1839
|
-
parse: ["prophoto-rgb"],
|
|
1840
|
-
serialize: "prophoto-rgb",
|
|
1841
|
-
fromMode: {
|
|
1842
|
-
xyz50: convertXyz50ToProphoto_default,
|
|
1843
|
-
rgb: (color) => convertXyz50ToProphoto_default(convertRgbToXyz50_default(color))
|
|
1844
|
-
},
|
|
1845
|
-
toMode: {
|
|
1846
|
-
xyz50: convertProphotoToXyz50_default,
|
|
1847
|
-
rgb: (color) => convertXyz50ToRgb_default(convertProphotoToXyz50_default(color))
|
|
1848
|
-
}
|
|
1849
|
-
};
|
|
1850
|
-
var definition_default$10 = definition$14;
|
|
1851
|
-
|
|
1852
|
-
//#endregion
|
|
1853
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/rec2020/convertXyz65ToRec2020.js
|
|
1854
|
-
const α$1 = 1.09929682680944;
|
|
1855
|
-
const β$1 = .018053968510807;
|
|
1856
|
-
const gamma = (v) => {
|
|
1857
|
-
const abs$1 = Math.abs(v);
|
|
1858
|
-
if (abs$1 > β$1) return (Math.sign(v) || 1) * (α$1 * Math.pow(abs$1, .45) - (α$1 - 1));
|
|
1859
|
-
return 4.5 * v;
|
|
1860
|
-
};
|
|
1861
|
-
const convertXyz65ToRec2020 = ({ x, y, z, alpha }) => {
|
|
1862
|
-
if (x === void 0) x = 0;
|
|
1863
|
-
if (y === void 0) y = 0;
|
|
1864
|
-
if (z === void 0) z = 0;
|
|
1865
|
-
let res = {
|
|
1866
|
-
mode: "rec2020",
|
|
1867
|
-
r: gamma(x * 1.7166511879712683 - y * .3556707837763925 - .2533662813736599 * z),
|
|
1868
|
-
g: gamma(x * -.6666843518324893 + y * 1.6164812366349395 + .0157685458139111 * z),
|
|
1869
|
-
b: gamma(x * .0176398574453108 - y * .0427706132578085 + .9421031212354739 * z)
|
|
1870
|
-
};
|
|
1871
|
-
if (alpha !== void 0) res.alpha = alpha;
|
|
1872
|
-
return res;
|
|
1873
|
-
};
|
|
1874
|
-
var convertXyz65ToRec2020_default = convertXyz65ToRec2020;
|
|
1875
|
-
|
|
1876
|
-
//#endregion
|
|
1877
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/rec2020/convertRec2020ToXyz65.js
|
|
1878
|
-
const α = 1.09929682680944;
|
|
1879
|
-
const β = .018053968510807;
|
|
1880
|
-
const linearize = (v = 0) => {
|
|
1881
|
-
let abs$1 = Math.abs(v);
|
|
1882
|
-
if (abs$1 < β * 4.5) return v / 4.5;
|
|
1883
|
-
return (Math.sign(v) || 1) * Math.pow((abs$1 + α - 1) / α, 1 / .45);
|
|
1884
|
-
};
|
|
1885
|
-
const convertRec2020ToXyz65 = (rec2020$2) => {
|
|
1886
|
-
let r$1 = linearize(rec2020$2.r);
|
|
1887
|
-
let g = linearize(rec2020$2.g);
|
|
1888
|
-
let b = linearize(rec2020$2.b);
|
|
1889
|
-
let res = {
|
|
1890
|
-
mode: "xyz65",
|
|
1891
|
-
x: .6369580483012911 * r$1 + .1446169035862083 * g + .1688809751641721 * b,
|
|
1892
|
-
y: .262700212011267 * r$1 + .6779980715188708 * g + .059301716469862 * b,
|
|
1893
|
-
z: 0 * r$1 + .0280726930490874 * g + 1.0609850577107909 * b
|
|
1894
|
-
};
|
|
1895
|
-
if (rec2020$2.alpha !== void 0) res.alpha = rec2020$2.alpha;
|
|
1896
|
-
return res;
|
|
1897
|
-
};
|
|
1898
|
-
var convertRec2020ToXyz65_default = convertRec2020ToXyz65;
|
|
1899
|
-
|
|
1900
|
-
//#endregion
|
|
1901
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/rec2020/definition.js
|
|
1902
|
-
const definition$13 = {
|
|
1903
|
-
...definition_default$12,
|
|
1904
|
-
mode: "rec2020",
|
|
1905
|
-
fromMode: {
|
|
1906
|
-
xyz65: convertXyz65ToRec2020_default,
|
|
1907
|
-
rgb: (color) => convertXyz65ToRec2020_default(convertRgbToXyz65_default(color))
|
|
1908
|
-
},
|
|
1909
|
-
toMode: {
|
|
1910
|
-
xyz65: convertRec2020ToXyz65_default,
|
|
1911
|
-
rgb: (color) => convertXyz65ToRgb_default(convertRec2020ToXyz65_default(color))
|
|
1912
|
-
},
|
|
1913
|
-
parse: ["rec2020"],
|
|
1914
|
-
serialize: "rec2020"
|
|
1915
|
-
};
|
|
1916
|
-
var definition_default$11 = definition$13;
|
|
1917
|
-
|
|
1918
|
-
//#endregion
|
|
1919
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/xyz50/definition.js
|
|
1920
|
-
const definition$12 = {
|
|
1921
|
-
mode: "xyz50",
|
|
1922
|
-
parse: ["xyz-d50"],
|
|
1923
|
-
serialize: "xyz-d50",
|
|
1924
|
-
toMode: {
|
|
1925
|
-
rgb: convertXyz50ToRgb_default,
|
|
1926
|
-
lab: convertXyz50ToLab_default
|
|
1927
|
-
},
|
|
1928
|
-
fromMode: {
|
|
1929
|
-
rgb: convertRgbToXyz50_default,
|
|
1930
|
-
lab: convertLabToXyz50_default
|
|
1931
|
-
},
|
|
1932
|
-
channels: [
|
|
1933
|
-
"x",
|
|
1934
|
-
"y",
|
|
1935
|
-
"z",
|
|
1936
|
-
"alpha"
|
|
1937
|
-
],
|
|
1938
|
-
ranges: {
|
|
1939
|
-
x: [0, .964],
|
|
1940
|
-
y: [0, .999],
|
|
1941
|
-
z: [0, .825]
|
|
1942
|
-
},
|
|
1943
|
-
interpolate: {
|
|
1944
|
-
x: interpolatorLinear,
|
|
1945
|
-
y: interpolatorLinear,
|
|
1946
|
-
z: interpolatorLinear,
|
|
1947
|
-
alpha: {
|
|
1948
|
-
use: interpolatorLinear,
|
|
1949
|
-
fixup: fixupAlpha
|
|
1950
|
-
}
|
|
1951
|
-
}
|
|
1952
|
-
};
|
|
1953
|
-
var definition_default$13 = definition$12;
|
|
1954
|
-
|
|
1955
|
-
//#endregion
|
|
1956
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/xyz65/convertXyz65ToXyz50.js
|
|
1957
|
-
const convertXyz65ToXyz50 = (xyz65$2) => {
|
|
1958
|
-
let { x, y, z, alpha } = xyz65$2;
|
|
1959
|
-
if (x === void 0) x = 0;
|
|
1960
|
-
if (y === void 0) y = 0;
|
|
1961
|
-
if (z === void 0) z = 0;
|
|
1962
|
-
let res = {
|
|
1963
|
-
mode: "xyz50",
|
|
1964
|
-
x: 1.0479298208405488 * x + .0229467933410191 * y - .0501922295431356 * z,
|
|
1965
|
-
y: .0296278156881593 * x + .990434484573249 * y - .0170738250293851 * z,
|
|
1966
|
-
z: -.0092430581525912 * x + .0150551448965779 * y + .7518742899580008 * z
|
|
1967
|
-
};
|
|
1968
|
-
if (alpha !== void 0) res.alpha = alpha;
|
|
1969
|
-
return res;
|
|
1970
|
-
};
|
|
1971
|
-
var convertXyz65ToXyz50_default = convertXyz65ToXyz50;
|
|
1972
|
-
|
|
1973
|
-
//#endregion
|
|
1974
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/xyz65/convertXyz50ToXyz65.js
|
|
1975
|
-
const convertXyz50ToXyz65 = (xyz50$2) => {
|
|
1976
|
-
let { x, y, z, alpha } = xyz50$2;
|
|
1977
|
-
if (x === void 0) x = 0;
|
|
1978
|
-
if (y === void 0) y = 0;
|
|
1979
|
-
if (z === void 0) z = 0;
|
|
1980
|
-
let res = {
|
|
1981
|
-
mode: "xyz65",
|
|
1982
|
-
x: .9554734527042182 * x - .0230985368742614 * y + .0632593086610217 * z,
|
|
1983
|
-
y: -.0283697069632081 * x + 1.0099954580058226 * y + .021041398966943 * z,
|
|
1984
|
-
z: .0123140016883199 * x - .0205076964334779 * y + 1.3303659366080753 * z
|
|
1985
|
-
};
|
|
1986
|
-
if (alpha !== void 0) res.alpha = alpha;
|
|
1987
|
-
return res;
|
|
1988
|
-
};
|
|
1989
|
-
var convertXyz50ToXyz65_default = convertXyz50ToXyz65;
|
|
1990
|
-
|
|
1991
|
-
//#endregion
|
|
1992
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/xyz65/definition.js
|
|
1993
|
-
const definition$11 = {
|
|
1994
|
-
mode: "xyz65",
|
|
1995
|
-
toMode: {
|
|
1996
|
-
rgb: convertXyz65ToRgb_default,
|
|
1997
|
-
xyz50: convertXyz65ToXyz50_default
|
|
1998
|
-
},
|
|
1999
|
-
fromMode: {
|
|
2000
|
-
rgb: convertRgbToXyz65_default,
|
|
2001
|
-
xyz50: convertXyz50ToXyz65_default
|
|
2002
|
-
},
|
|
2003
|
-
ranges: {
|
|
2004
|
-
x: [0, .95],
|
|
2005
|
-
y: [0, 1],
|
|
2006
|
-
z: [0, 1.088]
|
|
2007
|
-
},
|
|
2008
|
-
channels: [
|
|
2009
|
-
"x",
|
|
2010
|
-
"y",
|
|
2011
|
-
"z",
|
|
2012
|
-
"alpha"
|
|
2013
|
-
],
|
|
2014
|
-
parse: ["xyz", "xyz-d65"],
|
|
2015
|
-
serialize: "xyz-d65",
|
|
2016
|
-
interpolate: {
|
|
2017
|
-
x: interpolatorLinear,
|
|
2018
|
-
y: interpolatorLinear,
|
|
2019
|
-
z: interpolatorLinear,
|
|
2020
|
-
alpha: {
|
|
2021
|
-
use: interpolatorLinear,
|
|
2022
|
-
fixup: fixupAlpha
|
|
2023
|
-
}
|
|
2024
|
-
}
|
|
2025
|
-
};
|
|
2026
|
-
var definition_default$14 = definition$11;
|
|
2027
|
-
|
|
2028
|
-
//#endregion
|
|
2029
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/bootstrap/css.js
|
|
2030
|
-
const a98$1 = useMode(definition_default);
|
|
2031
|
-
const hsl$2 = useMode(definition_default$1);
|
|
2032
|
-
const hsv$1 = useMode(definition_default$19);
|
|
2033
|
-
const hwb$1 = useMode(definition_default$2);
|
|
2034
|
-
const lab$1 = useMode(definition_default$3);
|
|
2035
|
-
const lab65$1 = useMode(definition_default$4);
|
|
2036
|
-
const lch$1 = useMode(definition_default$5);
|
|
2037
|
-
const lch65$1 = useMode(definition_default$23);
|
|
2038
|
-
const lrgb$1 = useMode(definition_default$6);
|
|
2039
|
-
const oklab$1 = useMode(definition_default$7);
|
|
2040
|
-
const oklch$1 = useMode(definition_default$8);
|
|
2041
|
-
const p3$1 = useMode(definition_default$9);
|
|
2042
|
-
const prophoto$1 = useMode(definition_default$10);
|
|
2043
|
-
const rec2020$1 = useMode(definition_default$11);
|
|
2044
|
-
const rgb$3 = useMode(definition_default$12);
|
|
2045
|
-
const xyz50$1 = useMode(definition_default$13);
|
|
2046
|
-
const xyz65$1 = useMode(definition_default$14);
|
|
2047
|
-
|
|
2048
|
-
//#endregion
|
|
2049
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/cubehelix/constants.js
|
|
2050
|
-
const M = [
|
|
2051
|
-
-.14861,
|
|
2052
|
-
1.78277,
|
|
2053
|
-
-.29227,
|
|
2054
|
-
-.90649,
|
|
2055
|
-
1.97294,
|
|
2056
|
-
0
|
|
2057
|
-
];
|
|
2058
|
-
const degToRad = Math.PI / 180;
|
|
2059
|
-
const radToDeg = 180 / Math.PI;
|
|
2060
|
-
|
|
2061
|
-
//#endregion
|
|
2062
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/cubehelix/convertRgbToCubehelix.js
|
|
2063
|
-
let DE = M[3] * M[4];
|
|
2064
|
-
let BE = M[1] * M[4];
|
|
2065
|
-
let BCAD = M[1] * M[2] - M[0] * M[3];
|
|
2066
|
-
const convertRgbToCubehelix = ({ r: r$1, g, b, alpha }) => {
|
|
2067
|
-
if (r$1 === void 0) r$1 = 0;
|
|
2068
|
-
if (g === void 0) g = 0;
|
|
2069
|
-
if (b === void 0) b = 0;
|
|
2070
|
-
let l = (BCAD * b + r$1 * DE - g * BE) / (BCAD + DE - BE);
|
|
2071
|
-
let x = b - l;
|
|
2072
|
-
let y = (M[4] * (g - l) - M[2] * x) / M[3];
|
|
2073
|
-
let res = {
|
|
2074
|
-
mode: "cubehelix",
|
|
2075
|
-
l,
|
|
2076
|
-
s: l === 0 || l === 1 ? void 0 : Math.sqrt(x * x + y * y) / (M[4] * l * (1 - l))
|
|
2077
|
-
};
|
|
2078
|
-
if (res.s) res.h = Math.atan2(y, x) * radToDeg - 120;
|
|
2079
|
-
if (alpha !== void 0) res.alpha = alpha;
|
|
2080
|
-
return res;
|
|
2081
|
-
};
|
|
2082
|
-
var convertRgbToCubehelix_default = convertRgbToCubehelix;
|
|
2083
|
-
|
|
2084
|
-
//#endregion
|
|
2085
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/cubehelix/convertCubehelixToRgb.js
|
|
2086
|
-
const convertCubehelixToRgb = ({ h, s, l, alpha }) => {
|
|
2087
|
-
let res = { mode: "rgb" };
|
|
2088
|
-
h = (h === void 0 ? 0 : h + 120) * degToRad;
|
|
2089
|
-
if (l === void 0) l = 0;
|
|
2090
|
-
let amp = s === void 0 ? 0 : s * l * (1 - l);
|
|
2091
|
-
let cosh = Math.cos(h);
|
|
2092
|
-
let sinh = Math.sin(h);
|
|
2093
|
-
res.r = l + amp * (M[0] * cosh + M[1] * sinh);
|
|
2094
|
-
res.g = l + amp * (M[2] * cosh + M[3] * sinh);
|
|
2095
|
-
res.b = l + amp * (M[4] * cosh + M[5] * sinh);
|
|
2096
|
-
if (alpha !== void 0) res.alpha = alpha;
|
|
2097
|
-
return res;
|
|
2098
|
-
};
|
|
2099
|
-
var convertCubehelixToRgb_default = convertCubehelixToRgb;
|
|
2100
|
-
|
|
2101
|
-
//#endregion
|
|
2102
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/cubehelix/definition.js
|
|
2103
|
-
const definition$10 = {
|
|
2104
|
-
mode: "cubehelix",
|
|
2105
|
-
channels: [
|
|
2106
|
-
"h",
|
|
2107
|
-
"s",
|
|
2108
|
-
"l",
|
|
2109
|
-
"alpha"
|
|
2110
|
-
],
|
|
2111
|
-
parse: ["--cubehelix"],
|
|
2112
|
-
serialize: "--cubehelix",
|
|
2113
|
-
ranges: {
|
|
2114
|
-
h: [0, 360],
|
|
2115
|
-
s: [0, 4.614],
|
|
2116
|
-
l: [0, 1]
|
|
2117
|
-
},
|
|
2118
|
-
fromMode: { rgb: convertRgbToCubehelix_default },
|
|
2119
|
-
toMode: { rgb: convertCubehelixToRgb_default },
|
|
2120
|
-
interpolate: {
|
|
2121
|
-
h: {
|
|
2122
|
-
use: interpolatorLinear,
|
|
2123
|
-
fixup: fixupHueShorter
|
|
2124
|
-
},
|
|
2125
|
-
s: interpolatorLinear,
|
|
2126
|
-
l: interpolatorLinear,
|
|
2127
|
-
alpha: {
|
|
2128
|
-
use: interpolatorLinear,
|
|
2129
|
-
fixup: fixupAlpha
|
|
2130
|
-
}
|
|
2131
|
-
},
|
|
2132
|
-
difference: { h: differenceHueSaturation },
|
|
2133
|
-
average: { h: averageAngle }
|
|
2134
|
-
};
|
|
2135
|
-
var definition_default$15 = definition$10;
|
|
2136
|
-
|
|
2137
|
-
//#endregion
|
|
2138
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/dlch/constants.js
|
|
2139
|
-
const kE = 1;
|
|
2140
|
-
const kCH = 1;
|
|
2141
|
-
const θ = 26 / 180 * Math.PI;
|
|
2142
|
-
const cosθ = Math.cos(θ);
|
|
2143
|
-
const sinθ = Math.sin(θ);
|
|
2144
|
-
const factor = 100 / Math.log(139 / 100);
|
|
2145
|
-
|
|
2146
|
-
//#endregion
|
|
2147
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/dlch/convertDlchToLab65.js
|
|
2148
|
-
const convertDlchToLab65 = ({ l, c: c$1, h, alpha }) => {
|
|
2149
|
-
if (l === void 0) l = 0;
|
|
2150
|
-
if (c$1 === void 0) c$1 = 0;
|
|
2151
|
-
if (h === void 0) h = 0;
|
|
2152
|
-
let res = {
|
|
2153
|
-
mode: "lab65",
|
|
2154
|
-
l: (Math.exp(l * kE / factor) - 1) / .0039
|
|
2155
|
-
};
|
|
2156
|
-
let G = (Math.exp(.0435 * c$1 * kCH * kE) - 1) / .075;
|
|
2157
|
-
let e$3 = G * Math.cos(h / 180 * Math.PI - θ);
|
|
2158
|
-
let f$2 = G * Math.sin(h / 180 * Math.PI - θ);
|
|
2159
|
-
res.a = e$3 * cosθ - f$2 / .83 * sinθ;
|
|
2160
|
-
res.b = e$3 * sinθ + f$2 / .83 * cosθ;
|
|
2161
|
-
if (alpha !== void 0) res.alpha = alpha;
|
|
2162
|
-
return res;
|
|
2163
|
-
};
|
|
2164
|
-
var convertDlchToLab65_default = convertDlchToLab65;
|
|
2165
|
-
|
|
2166
|
-
//#endregion
|
|
2167
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/dlch/convertLab65ToDlch.js
|
|
2168
|
-
const convertLab65ToDlch = ({ l, a, b, alpha }) => {
|
|
2169
|
-
if (l === void 0) l = 0;
|
|
2170
|
-
if (a === void 0) a = 0;
|
|
2171
|
-
if (b === void 0) b = 0;
|
|
2172
|
-
let e$3 = a * cosθ + b * sinθ;
|
|
2173
|
-
let f$2 = .83 * (b * cosθ - a * sinθ);
|
|
2174
|
-
let G = Math.sqrt(e$3 * e$3 + f$2 * f$2);
|
|
2175
|
-
let res = {
|
|
2176
|
-
mode: "dlch",
|
|
2177
|
-
l: factor / kE * Math.log(1 + .0039 * l),
|
|
2178
|
-
c: Math.log(1 + .075 * G) / (.0435 * kCH * kE)
|
|
2179
|
-
};
|
|
2180
|
-
if (res.c) res.h = normalizeHue_default((Math.atan2(f$2, e$3) + θ) / Math.PI * 180);
|
|
2181
|
-
if (alpha !== void 0) res.alpha = alpha;
|
|
2182
|
-
return res;
|
|
2183
|
-
};
|
|
2184
|
-
var convertLab65ToDlch_default = convertLab65ToDlch;
|
|
2185
|
-
|
|
2186
|
-
//#endregion
|
|
2187
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/dlab/definition.js
|
|
2188
|
-
const convertDlabToLab65 = (c$1) => convertDlchToLab65_default(convertLabToLch_default(c$1, "dlch"));
|
|
2189
|
-
const convertLab65ToDlab = (c$1) => convertLchToLab_default(convertLab65ToDlch_default(c$1), "dlab");
|
|
2190
|
-
const definition$9 = {
|
|
2191
|
-
mode: "dlab",
|
|
2192
|
-
parse: ["--din99o-lab"],
|
|
2193
|
-
serialize: "--din99o-lab",
|
|
2194
|
-
toMode: {
|
|
2195
|
-
lab65: convertDlabToLab65,
|
|
2196
|
-
rgb: (c$1) => convertLab65ToRgb_default(convertDlabToLab65(c$1))
|
|
2197
|
-
},
|
|
2198
|
-
fromMode: {
|
|
2199
|
-
lab65: convertLab65ToDlab,
|
|
2200
|
-
rgb: (c$1) => convertLab65ToDlab(convertRgbToLab65_default(c$1))
|
|
2201
|
-
},
|
|
2202
|
-
channels: [
|
|
2203
|
-
"l",
|
|
2204
|
-
"a",
|
|
2205
|
-
"b",
|
|
2206
|
-
"alpha"
|
|
2207
|
-
],
|
|
2208
|
-
ranges: {
|
|
2209
|
-
l: [0, 100],
|
|
2210
|
-
a: [-40.09, 45.501],
|
|
2211
|
-
b: [-40.469, 44.344]
|
|
2212
|
-
},
|
|
2213
|
-
interpolate: {
|
|
2214
|
-
l: interpolatorLinear,
|
|
2215
|
-
a: interpolatorLinear,
|
|
2216
|
-
b: interpolatorLinear,
|
|
2217
|
-
alpha: {
|
|
2218
|
-
use: interpolatorLinear,
|
|
2219
|
-
fixup: fixupAlpha
|
|
2220
|
-
}
|
|
2221
|
-
}
|
|
2222
|
-
};
|
|
2223
|
-
var definition_default$16 = definition$9;
|
|
2224
|
-
|
|
2225
|
-
//#endregion
|
|
2226
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/dlch/definition.js
|
|
2227
|
-
const definition$8 = {
|
|
2228
|
-
mode: "dlch",
|
|
2229
|
-
parse: ["--din99o-lch"],
|
|
2230
|
-
serialize: "--din99o-lch",
|
|
2231
|
-
toMode: {
|
|
2232
|
-
lab65: convertDlchToLab65_default,
|
|
2233
|
-
dlab: (c$1) => convertLchToLab_default(c$1, "dlab"),
|
|
2234
|
-
rgb: (c$1) => convertLab65ToRgb_default(convertDlchToLab65_default(c$1))
|
|
2235
|
-
},
|
|
2236
|
-
fromMode: {
|
|
2237
|
-
lab65: convertLab65ToDlch_default,
|
|
2238
|
-
dlab: (c$1) => convertLabToLch_default(c$1, "dlch"),
|
|
2239
|
-
rgb: (c$1) => convertLab65ToDlch_default(convertRgbToLab65_default(c$1))
|
|
2240
|
-
},
|
|
2241
|
-
channels: [
|
|
2242
|
-
"l",
|
|
2243
|
-
"c",
|
|
2244
|
-
"h",
|
|
2245
|
-
"alpha"
|
|
2246
|
-
],
|
|
2247
|
-
ranges: {
|
|
2248
|
-
l: [0, 100],
|
|
2249
|
-
c: [0, 51.484],
|
|
2250
|
-
h: [0, 360]
|
|
2251
|
-
},
|
|
2252
|
-
interpolate: {
|
|
2253
|
-
l: interpolatorLinear,
|
|
2254
|
-
c: interpolatorLinear,
|
|
2255
|
-
h: {
|
|
2256
|
-
use: interpolatorLinear,
|
|
2257
|
-
fixup: fixupHueShorter
|
|
2258
|
-
},
|
|
2259
|
-
alpha: {
|
|
2260
|
-
use: interpolatorLinear,
|
|
2261
|
-
fixup: fixupAlpha
|
|
2262
|
-
}
|
|
2263
|
-
},
|
|
2264
|
-
difference: { h: differenceHueChroma },
|
|
2265
|
-
average: { h: averageAngle }
|
|
2266
|
-
};
|
|
2267
|
-
var definition_default$17 = definition$8;
|
|
2268
|
-
|
|
2269
|
-
//#endregion
|
|
2270
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/hsi/convertHsiToRgb.js
|
|
2271
|
-
function convertHsiToRgb({ h, s, i, alpha }) {
|
|
2272
|
-
h = normalizeHue_default(h !== void 0 ? h : 0);
|
|
2273
|
-
if (s === void 0) s = 0;
|
|
2274
|
-
if (i === void 0) i = 0;
|
|
2275
|
-
let f$2 = Math.abs(h / 60 % 2 - 1);
|
|
2276
|
-
let res;
|
|
2277
|
-
switch (Math.floor(h / 60)) {
|
|
2278
|
-
case 0:
|
|
2279
|
-
res = {
|
|
2280
|
-
r: i * (1 + s * (3 / (2 - f$2) - 1)),
|
|
2281
|
-
g: i * (1 + s * (3 * (1 - f$2) / (2 - f$2) - 1)),
|
|
2282
|
-
b: i * (1 - s)
|
|
2283
|
-
};
|
|
2284
|
-
break;
|
|
2285
|
-
case 1:
|
|
2286
|
-
res = {
|
|
2287
|
-
r: i * (1 + s * (3 * (1 - f$2) / (2 - f$2) - 1)),
|
|
2288
|
-
g: i * (1 + s * (3 / (2 - f$2) - 1)),
|
|
2289
|
-
b: i * (1 - s)
|
|
2290
|
-
};
|
|
2291
|
-
break;
|
|
2292
|
-
case 2:
|
|
2293
|
-
res = {
|
|
2294
|
-
r: i * (1 - s),
|
|
2295
|
-
g: i * (1 + s * (3 / (2 - f$2) - 1)),
|
|
2296
|
-
b: i * (1 + s * (3 * (1 - f$2) / (2 - f$2) - 1))
|
|
2297
|
-
};
|
|
2298
|
-
break;
|
|
2299
|
-
case 3:
|
|
2300
|
-
res = {
|
|
2301
|
-
r: i * (1 - s),
|
|
2302
|
-
g: i * (1 + s * (3 * (1 - f$2) / (2 - f$2) - 1)),
|
|
2303
|
-
b: i * (1 + s * (3 / (2 - f$2) - 1))
|
|
2304
|
-
};
|
|
2305
|
-
break;
|
|
2306
|
-
case 4:
|
|
2307
|
-
res = {
|
|
2308
|
-
r: i * (1 + s * (3 * (1 - f$2) / (2 - f$2) - 1)),
|
|
2309
|
-
g: i * (1 - s),
|
|
2310
|
-
b: i * (1 + s * (3 / (2 - f$2) - 1))
|
|
2311
|
-
};
|
|
2312
|
-
break;
|
|
2313
|
-
case 5:
|
|
2314
|
-
res = {
|
|
2315
|
-
r: i * (1 + s * (3 / (2 - f$2) - 1)),
|
|
2316
|
-
g: i * (1 - s),
|
|
2317
|
-
b: i * (1 + s * (3 * (1 - f$2) / (2 - f$2) - 1))
|
|
2318
|
-
};
|
|
2319
|
-
break;
|
|
2320
|
-
default: res = {
|
|
2321
|
-
r: i * (1 - s),
|
|
2322
|
-
g: i * (1 - s),
|
|
2323
|
-
b: i * (1 - s)
|
|
2324
|
-
};
|
|
2325
|
-
}
|
|
2326
|
-
res.mode = "rgb";
|
|
2327
|
-
if (alpha !== void 0) res.alpha = alpha;
|
|
2328
|
-
return res;
|
|
2329
|
-
}
|
|
2330
|
-
|
|
2331
|
-
//#endregion
|
|
2332
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/hsi/convertRgbToHsi.js
|
|
2333
|
-
function convertRgbToHsi({ r: r$1, g, b, alpha }) {
|
|
2334
|
-
if (r$1 === void 0) r$1 = 0;
|
|
2335
|
-
if (g === void 0) g = 0;
|
|
2336
|
-
if (b === void 0) b = 0;
|
|
2337
|
-
let M$1 = Math.max(r$1, g, b), m = Math.min(r$1, g, b);
|
|
2338
|
-
let res = {
|
|
2339
|
-
mode: "hsi",
|
|
2340
|
-
s: r$1 + g + b === 0 ? 0 : 1 - 3 * m / (r$1 + g + b),
|
|
2341
|
-
i: (r$1 + g + b) / 3
|
|
2342
|
-
};
|
|
2343
|
-
if (M$1 - m !== 0) res.h = (M$1 === r$1 ? (g - b) / (M$1 - m) + (g < b) * 6 : M$1 === g ? (b - r$1) / (M$1 - m) + 2 : (r$1 - g) / (M$1 - m) + 4) * 60;
|
|
2344
|
-
if (alpha !== void 0) res.alpha = alpha;
|
|
2345
|
-
return res;
|
|
2346
|
-
}
|
|
2347
|
-
|
|
2348
|
-
//#endregion
|
|
2349
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/hsi/definition.js
|
|
2350
|
-
const definition$7 = {
|
|
2351
|
-
mode: "hsi",
|
|
2352
|
-
toMode: { rgb: convertHsiToRgb },
|
|
2353
|
-
parse: ["--hsi"],
|
|
2354
|
-
serialize: "--hsi",
|
|
2355
|
-
fromMode: { rgb: convertRgbToHsi },
|
|
2356
|
-
channels: [
|
|
2357
|
-
"h",
|
|
2358
|
-
"s",
|
|
2359
|
-
"i",
|
|
2360
|
-
"alpha"
|
|
2361
|
-
],
|
|
2362
|
-
ranges: { h: [0, 360] },
|
|
2363
|
-
gamut: "rgb",
|
|
2364
|
-
interpolate: {
|
|
2365
|
-
h: {
|
|
2366
|
-
use: interpolatorLinear,
|
|
2367
|
-
fixup: fixupHueShorter
|
|
2368
|
-
},
|
|
2369
|
-
s: interpolatorLinear,
|
|
2370
|
-
i: interpolatorLinear,
|
|
2371
|
-
alpha: {
|
|
2372
|
-
use: interpolatorLinear,
|
|
2373
|
-
fixup: fixupAlpha
|
|
2374
|
-
}
|
|
2375
|
-
},
|
|
2376
|
-
difference: { h: differenceHueSaturation },
|
|
2377
|
-
average: { h: averageAngle }
|
|
2378
|
-
};
|
|
2379
|
-
var definition_default$18 = definition$7;
|
|
2380
|
-
|
|
2381
|
-
//#endregion
|
|
2382
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/hdr/constants.js
|
|
2383
|
-
const YW = 203;
|
|
2384
|
-
|
|
2385
|
-
//#endregion
|
|
2386
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/hdr/transfer.js
|
|
2387
|
-
const M1 = .1593017578125;
|
|
2388
|
-
const M2 = 78.84375;
|
|
2389
|
-
const C1 = .8359375;
|
|
2390
|
-
const C2 = 18.8515625;
|
|
2391
|
-
const C3 = 18.6875;
|
|
2392
|
-
function transferPqDecode(v) {
|
|
2393
|
-
if (v < 0) return 0;
|
|
2394
|
-
const c$1 = Math.pow(v, 1 / M2);
|
|
2395
|
-
return 1e4 * Math.pow(Math.max(0, c$1 - C1) / (C2 - C3 * c$1), 1 / M1);
|
|
2396
|
-
}
|
|
2397
|
-
function transferPqEncode(v) {
|
|
2398
|
-
if (v < 0) return 0;
|
|
2399
|
-
const c$1 = Math.pow(v / 1e4, M1);
|
|
2400
|
-
return Math.pow((C1 + C2 * c$1) / (1 + C3 * c$1), M2);
|
|
2401
|
-
}
|
|
2402
|
-
|
|
2403
|
-
//#endregion
|
|
2404
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/itp/convertItpToXyz65.js
|
|
2405
|
-
const toRel = (c$1) => Math.max(c$1 / YW, 0);
|
|
2406
|
-
const convertItpToXyz65 = ({ i, t, p: p$2, alpha }) => {
|
|
2407
|
-
if (i === void 0) i = 0;
|
|
2408
|
-
if (t === void 0) t = 0;
|
|
2409
|
-
if (p$2 === void 0) p$2 = 0;
|
|
2410
|
-
const l = transferPqDecode(i + .008609037037932761 * t + .11102962500302593 * p$2);
|
|
2411
|
-
const m = transferPqDecode(i - .00860903703793275 * t - .11102962500302599 * p$2);
|
|
2412
|
-
const s = transferPqDecode(i + .5600313357106791 * t - .32062717498731885 * p$2);
|
|
2413
|
-
const res = {
|
|
2414
|
-
mode: "xyz65",
|
|
2415
|
-
x: toRel(2.070152218389422 * l - 1.3263473389671556 * m + .2066510476294051 * s),
|
|
2416
|
-
y: toRel(.3647385209748074 * l + .680566024947227 * m - .0453045459220346 * s),
|
|
2417
|
-
z: toRel(-.049747207535812 * l - .0492609666966138 * m + 1.1880659249923042 * s)
|
|
2418
|
-
};
|
|
2419
|
-
if (alpha !== void 0) res.alpha = alpha;
|
|
2420
|
-
return res;
|
|
2421
|
-
};
|
|
2422
|
-
var convertItpToXyz65_default = convertItpToXyz65;
|
|
2423
|
-
|
|
2424
|
-
//#endregion
|
|
2425
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/itp/convertXyz65ToItp.js
|
|
2426
|
-
const toAbs = (c$1 = 0) => Math.max(c$1 * YW, 0);
|
|
2427
|
-
const convertXyz65ToItp = ({ x, y, z, alpha }) => {
|
|
2428
|
-
const absX = toAbs(x);
|
|
2429
|
-
const absY = toAbs(y);
|
|
2430
|
-
const absZ = toAbs(z);
|
|
2431
|
-
const l = transferPqEncode(.3592832590121217 * absX + .6976051147779502 * absY - .0358915932320289 * absZ);
|
|
2432
|
-
const m = transferPqEncode(-.1920808463704995 * absX + 1.1004767970374323 * absY + .0753748658519118 * absZ);
|
|
2433
|
-
const s = transferPqEncode(.0070797844607477 * absX + .0748396662186366 * absY + .8433265453898765 * absZ);
|
|
2434
|
-
const i = .5 * l + .5 * m;
|
|
2435
|
-
const t = 1.61376953125 * l - 3.323486328125 * m + 1.709716796875 * s;
|
|
2436
|
-
const p$2 = 4.378173828125 * l - 4.24560546875 * m - .132568359375 * s;
|
|
2437
|
-
const res = {
|
|
2438
|
-
mode: "itp",
|
|
2439
|
-
i,
|
|
2440
|
-
t,
|
|
2441
|
-
p: p$2
|
|
2442
|
-
};
|
|
2443
|
-
if (alpha !== void 0) res.alpha = alpha;
|
|
2444
|
-
return res;
|
|
2445
|
-
};
|
|
2446
|
-
var convertXyz65ToItp_default = convertXyz65ToItp;
|
|
2447
|
-
|
|
2448
|
-
//#endregion
|
|
2449
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/itp/definition.js
|
|
2450
|
-
const definition$6 = {
|
|
2451
|
-
mode: "itp",
|
|
2452
|
-
channels: [
|
|
2453
|
-
"i",
|
|
2454
|
-
"t",
|
|
2455
|
-
"p",
|
|
2456
|
-
"alpha"
|
|
2457
|
-
],
|
|
2458
|
-
parse: ["--ictcp"],
|
|
2459
|
-
serialize: "--ictcp",
|
|
2460
|
-
toMode: {
|
|
2461
|
-
xyz65: convertItpToXyz65_default,
|
|
2462
|
-
rgb: (color) => convertXyz65ToRgb_default(convertItpToXyz65_default(color))
|
|
2463
|
-
},
|
|
2464
|
-
fromMode: {
|
|
2465
|
-
xyz65: convertXyz65ToItp_default,
|
|
2466
|
-
rgb: (color) => convertXyz65ToItp_default(convertRgbToXyz65_default(color))
|
|
2467
|
-
},
|
|
2468
|
-
ranges: {
|
|
2469
|
-
i: [0, .581],
|
|
2470
|
-
t: [-.369, .272],
|
|
2471
|
-
p: [-.164, .331]
|
|
2472
|
-
},
|
|
2473
|
-
interpolate: {
|
|
2474
|
-
i: interpolatorLinear,
|
|
2475
|
-
t: interpolatorLinear,
|
|
2476
|
-
p: interpolatorLinear,
|
|
2477
|
-
alpha: {
|
|
2478
|
-
use: interpolatorLinear,
|
|
2479
|
-
fixup: fixupAlpha
|
|
2480
|
-
}
|
|
2481
|
-
}
|
|
2482
|
-
};
|
|
2483
|
-
var definition_default$20 = definition$6;
|
|
2484
|
-
|
|
2485
|
-
//#endregion
|
|
2486
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/jab/convertXyz65ToJab.js
|
|
2487
|
-
const p$1 = 134.03437499999998;
|
|
2488
|
-
const d0$1 = 16295499532821565e-27;
|
|
2489
|
-
const jabPqEncode = (v) => {
|
|
2490
|
-
if (v < 0) return 0;
|
|
2491
|
-
let vn$2 = Math.pow(v / 1e4, M1);
|
|
2492
|
-
return Math.pow((C1 + C2 * vn$2) / (1 + C3 * vn$2), p$1);
|
|
2493
|
-
};
|
|
2494
|
-
const abs = (v = 0) => Math.max(v * 203, 0);
|
|
2495
|
-
const convertXyz65ToJab = ({ x, y, z, alpha }) => {
|
|
2496
|
-
x = abs(x);
|
|
2497
|
-
y = abs(y);
|
|
2498
|
-
z = abs(z);
|
|
2499
|
-
let xp = 1.15 * x - .15 * z;
|
|
2500
|
-
let yp = .66 * y + .34 * x;
|
|
2501
|
-
let l = jabPqEncode(.41478972 * xp + .579999 * yp + .014648 * z);
|
|
2502
|
-
let m = jabPqEncode(-.20151 * xp + 1.120649 * yp + .0531008 * z);
|
|
2503
|
-
let s = jabPqEncode(-.0166008 * xp + .2648 * yp + .6684799 * z);
|
|
2504
|
-
let i = (l + m) / 2;
|
|
2505
|
-
let res = {
|
|
2506
|
-
mode: "jab",
|
|
2507
|
-
j: .44 * i / (1 - .56 * i) - d0$1,
|
|
2508
|
-
a: 3.524 * l - 4.066708 * m + .542708 * s,
|
|
2509
|
-
b: .199076 * l + 1.096799 * m - 1.295875 * s
|
|
2510
|
-
};
|
|
2511
|
-
if (alpha !== void 0) res.alpha = alpha;
|
|
2512
|
-
return res;
|
|
2513
|
-
};
|
|
2514
|
-
var convertXyz65ToJab_default = convertXyz65ToJab;
|
|
2515
|
-
|
|
2516
|
-
//#endregion
|
|
2517
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/jab/convertJabToXyz65.js
|
|
2518
|
-
const p = 134.03437499999998;
|
|
2519
|
-
const d0 = 16295499532821565e-27;
|
|
2520
|
-
const jabPqDecode = (v) => {
|
|
2521
|
-
if (v < 0) return 0;
|
|
2522
|
-
let vp = Math.pow(v, 1 / p);
|
|
2523
|
-
return 1e4 * Math.pow((C1 - vp) / (C3 * vp - C2), 1 / M1);
|
|
2524
|
-
};
|
|
2525
|
-
const rel = (v) => v / 203;
|
|
2526
|
-
const convertJabToXyz65 = ({ j, a, b, alpha }) => {
|
|
2527
|
-
if (j === void 0) j = 0;
|
|
2528
|
-
if (a === void 0) a = 0;
|
|
2529
|
-
if (b === void 0) b = 0;
|
|
2530
|
-
let i = (j + d0) / (.44 + .56 * (j + d0));
|
|
2531
|
-
let l = jabPqDecode(i + .13860504 * a + .058047316 * b);
|
|
2532
|
-
let m = jabPqDecode(i - .13860504 * a - .058047316 * b);
|
|
2533
|
-
let s = jabPqDecode(i - .096019242 * a - .8118919 * b);
|
|
2534
|
-
let res = {
|
|
2535
|
-
mode: "xyz65",
|
|
2536
|
-
x: rel(1.661373024652174 * l - .914523081304348 * m + .23136208173913045 * s),
|
|
2537
|
-
y: rel(-.3250758611844533 * l + 1.571847026732543 * m - .21825383453227928 * s),
|
|
2538
|
-
z: rel(-.090982811 * l - .31272829 * m + 1.5227666 * s)
|
|
2539
|
-
};
|
|
2540
|
-
if (alpha !== void 0) res.alpha = alpha;
|
|
2541
|
-
return res;
|
|
2542
|
-
};
|
|
2543
|
-
var convertJabToXyz65_default = convertJabToXyz65;
|
|
2544
|
-
|
|
2545
|
-
//#endregion
|
|
2546
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/jab/convertRgbToJab.js
|
|
2547
|
-
const convertRgbToJab = (rgb$4) => {
|
|
2548
|
-
let res = convertXyz65ToJab_default(convertRgbToXyz65_default(rgb$4));
|
|
2549
|
-
if (rgb$4.r === rgb$4.b && rgb$4.b === rgb$4.g) res.a = res.b = 0;
|
|
2550
|
-
return res;
|
|
2551
|
-
};
|
|
2552
|
-
var convertRgbToJab_default = convertRgbToJab;
|
|
2553
|
-
|
|
2554
|
-
//#endregion
|
|
2555
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/jab/convertJabToRgb.js
|
|
2556
|
-
const convertJabToRgb = (color) => convertXyz65ToRgb_default(convertJabToXyz65_default(color));
|
|
2557
|
-
var convertJabToRgb_default = convertJabToRgb;
|
|
2558
|
-
|
|
2559
|
-
//#endregion
|
|
2560
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/jab/definition.js
|
|
2561
|
-
const definition$5 = {
|
|
2562
|
-
mode: "jab",
|
|
2563
|
-
channels: [
|
|
2564
|
-
"j",
|
|
2565
|
-
"a",
|
|
2566
|
-
"b",
|
|
2567
|
-
"alpha"
|
|
2568
|
-
],
|
|
2569
|
-
parse: ["--jzazbz"],
|
|
2570
|
-
serialize: "--jzazbz",
|
|
2571
|
-
fromMode: {
|
|
2572
|
-
rgb: convertRgbToJab_default,
|
|
2573
|
-
xyz65: convertXyz65ToJab_default
|
|
2574
|
-
},
|
|
2575
|
-
toMode: {
|
|
2576
|
-
rgb: convertJabToRgb_default,
|
|
2577
|
-
xyz65: convertJabToXyz65_default
|
|
2578
|
-
},
|
|
2579
|
-
ranges: {
|
|
2580
|
-
j: [0, .222],
|
|
2581
|
-
a: [-.109, .129],
|
|
2582
|
-
b: [-.185, .134]
|
|
2583
|
-
},
|
|
2584
|
-
interpolate: {
|
|
2585
|
-
j: interpolatorLinear,
|
|
2586
|
-
a: interpolatorLinear,
|
|
2587
|
-
b: interpolatorLinear,
|
|
2588
|
-
alpha: {
|
|
2589
|
-
use: interpolatorLinear,
|
|
2590
|
-
fixup: fixupAlpha
|
|
2591
|
-
}
|
|
2592
|
-
}
|
|
2593
|
-
};
|
|
2594
|
-
var definition_default$21 = definition$5;
|
|
2595
|
-
|
|
2596
|
-
//#endregion
|
|
2597
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/jch/convertJabToJch.js
|
|
2598
|
-
const convertJabToJch = ({ j, a, b, alpha }) => {
|
|
2599
|
-
if (a === void 0) a = 0;
|
|
2600
|
-
if (b === void 0) b = 0;
|
|
2601
|
-
let c$1 = Math.sqrt(a * a + b * b);
|
|
2602
|
-
let res = {
|
|
2603
|
-
mode: "jch",
|
|
2604
|
-
j,
|
|
2605
|
-
c: c$1
|
|
2606
|
-
};
|
|
2607
|
-
if (c$1) res.h = normalizeHue_default(Math.atan2(b, a) * 180 / Math.PI);
|
|
2608
|
-
if (alpha !== void 0) res.alpha = alpha;
|
|
2609
|
-
return res;
|
|
2610
|
-
};
|
|
2611
|
-
var convertJabToJch_default = convertJabToJch;
|
|
2612
|
-
|
|
2613
|
-
//#endregion
|
|
2614
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/jch/convertJchToJab.js
|
|
2615
|
-
const convertJchToJab = ({ j, c: c$1, h, alpha }) => {
|
|
2616
|
-
if (h === void 0) h = 0;
|
|
2617
|
-
let res = {
|
|
2618
|
-
mode: "jab",
|
|
2619
|
-
j,
|
|
2620
|
-
a: c$1 ? c$1 * Math.cos(h / 180 * Math.PI) : 0,
|
|
2621
|
-
b: c$1 ? c$1 * Math.sin(h / 180 * Math.PI) : 0
|
|
2622
|
-
};
|
|
2623
|
-
if (alpha !== void 0) res.alpha = alpha;
|
|
2624
|
-
return res;
|
|
2625
|
-
};
|
|
2626
|
-
var convertJchToJab_default = convertJchToJab;
|
|
2627
|
-
|
|
2628
|
-
//#endregion
|
|
2629
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/jch/definition.js
|
|
2630
|
-
const definition$4 = {
|
|
2631
|
-
mode: "jch",
|
|
2632
|
-
parse: ["--jzczhz"],
|
|
2633
|
-
serialize: "--jzczhz",
|
|
2634
|
-
toMode: {
|
|
2635
|
-
jab: convertJchToJab_default,
|
|
2636
|
-
rgb: (c$1) => convertJabToRgb_default(convertJchToJab_default(c$1))
|
|
2637
|
-
},
|
|
2638
|
-
fromMode: {
|
|
2639
|
-
rgb: (c$1) => convertJabToJch_default(convertRgbToJab_default(c$1)),
|
|
2640
|
-
jab: convertJabToJch_default
|
|
2641
|
-
},
|
|
2642
|
-
channels: [
|
|
2643
|
-
"j",
|
|
2644
|
-
"c",
|
|
2645
|
-
"h",
|
|
2646
|
-
"alpha"
|
|
2647
|
-
],
|
|
2648
|
-
ranges: {
|
|
2649
|
-
j: [0, .221],
|
|
2650
|
-
c: [0, .19],
|
|
2651
|
-
h: [0, 360]
|
|
2652
|
-
},
|
|
2653
|
-
interpolate: {
|
|
2654
|
-
h: {
|
|
2655
|
-
use: interpolatorLinear,
|
|
2656
|
-
fixup: fixupHueShorter
|
|
2657
|
-
},
|
|
2658
|
-
c: interpolatorLinear,
|
|
2659
|
-
j: interpolatorLinear,
|
|
2660
|
-
alpha: {
|
|
2661
|
-
use: interpolatorLinear,
|
|
2662
|
-
fixup: fixupAlpha
|
|
2663
|
-
}
|
|
2664
|
-
},
|
|
2665
|
-
difference: { h: differenceHueChroma },
|
|
2666
|
-
average: { h: averageAngle }
|
|
2667
|
-
};
|
|
2668
|
-
var definition_default$22 = definition$4;
|
|
1
|
+
import { kebabCase, validateCustomTransform } from "@terrazzo/token-tools";
|
|
2
|
+
import { generateShorthand, makeCSSVar, transformCSSValue } from "@terrazzo/token-tools/css";
|
|
3
|
+
import wcmatch from "wildcard-match";
|
|
2669
4
|
|
|
2670
|
-
//#endregion
|
|
2671
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/lchuv/convertLuvToLchuv.js
|
|
2672
|
-
const convertLuvToLchuv = ({ l, u, v, alpha }) => {
|
|
2673
|
-
if (u === void 0) u = 0;
|
|
2674
|
-
if (v === void 0) v = 0;
|
|
2675
|
-
let c$1 = Math.sqrt(u * u + v * v);
|
|
2676
|
-
let res = {
|
|
2677
|
-
mode: "lchuv",
|
|
2678
|
-
l,
|
|
2679
|
-
c: c$1
|
|
2680
|
-
};
|
|
2681
|
-
if (c$1) res.h = normalizeHue_default(Math.atan2(v, u) * 180 / Math.PI);
|
|
2682
|
-
if (alpha !== void 0) res.alpha = alpha;
|
|
2683
|
-
return res;
|
|
2684
|
-
};
|
|
2685
|
-
var convertLuvToLchuv_default = convertLuvToLchuv;
|
|
2686
|
-
|
|
2687
|
-
//#endregion
|
|
2688
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/lchuv/convertLchuvToLuv.js
|
|
2689
|
-
const convertLchuvToLuv = ({ l, c: c$1, h, alpha }) => {
|
|
2690
|
-
if (h === void 0) h = 0;
|
|
2691
|
-
let res = {
|
|
2692
|
-
mode: "luv",
|
|
2693
|
-
l,
|
|
2694
|
-
u: c$1 ? c$1 * Math.cos(h / 180 * Math.PI) : 0,
|
|
2695
|
-
v: c$1 ? c$1 * Math.sin(h / 180 * Math.PI) : 0
|
|
2696
|
-
};
|
|
2697
|
-
if (alpha !== void 0) res.alpha = alpha;
|
|
2698
|
-
return res;
|
|
2699
|
-
};
|
|
2700
|
-
var convertLchuvToLuv_default = convertLchuvToLuv;
|
|
2701
|
-
|
|
2702
|
-
//#endregion
|
|
2703
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/luv/convertXyz50ToLuv.js
|
|
2704
|
-
const u_fn$1 = (x, y, z) => 4 * x / (x + 15 * y + 3 * z);
|
|
2705
|
-
const v_fn$1 = (x, y, z) => 9 * y / (x + 15 * y + 3 * z);
|
|
2706
|
-
const un$1 = u_fn$1(D50.X, D50.Y, D50.Z);
|
|
2707
|
-
const vn$1 = v_fn$1(D50.X, D50.Y, D50.Z);
|
|
2708
|
-
const l_fn = (value) => value <= e ? k * value : 116 * Math.cbrt(value) - 16;
|
|
2709
|
-
const convertXyz50ToLuv = ({ x, y, z, alpha }) => {
|
|
2710
|
-
if (x === void 0) x = 0;
|
|
2711
|
-
if (y === void 0) y = 0;
|
|
2712
|
-
if (z === void 0) z = 0;
|
|
2713
|
-
let l = l_fn(y / D50.Y);
|
|
2714
|
-
let u = u_fn$1(x, y, z);
|
|
2715
|
-
let v = v_fn$1(x, y, z);
|
|
2716
|
-
if (!isFinite(u) || !isFinite(v)) l = u = v = 0;
|
|
2717
|
-
else {
|
|
2718
|
-
u = 13 * l * (u - un$1);
|
|
2719
|
-
v = 13 * l * (v - vn$1);
|
|
2720
|
-
}
|
|
2721
|
-
let res = {
|
|
2722
|
-
mode: "luv",
|
|
2723
|
-
l,
|
|
2724
|
-
u,
|
|
2725
|
-
v
|
|
2726
|
-
};
|
|
2727
|
-
if (alpha !== void 0) res.alpha = alpha;
|
|
2728
|
-
return res;
|
|
2729
|
-
};
|
|
2730
|
-
var convertXyz50ToLuv_default = convertXyz50ToLuv;
|
|
2731
|
-
|
|
2732
|
-
//#endregion
|
|
2733
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/luv/convertLuvToXyz50.js
|
|
2734
|
-
const u_fn = (x, y, z) => 4 * x / (x + 15 * y + 3 * z);
|
|
2735
|
-
const v_fn = (x, y, z) => 9 * y / (x + 15 * y + 3 * z);
|
|
2736
|
-
const un = u_fn(D50.X, D50.Y, D50.Z);
|
|
2737
|
-
const vn = v_fn(D50.X, D50.Y, D50.Z);
|
|
2738
|
-
const convertLuvToXyz50 = ({ l, u, v, alpha }) => {
|
|
2739
|
-
if (l === void 0) l = 0;
|
|
2740
|
-
if (l === 0) return {
|
|
2741
|
-
mode: "xyz50",
|
|
2742
|
-
x: 0,
|
|
2743
|
-
y: 0,
|
|
2744
|
-
z: 0
|
|
2745
|
-
};
|
|
2746
|
-
if (u === void 0) u = 0;
|
|
2747
|
-
if (v === void 0) v = 0;
|
|
2748
|
-
let up = u / (13 * l) + un;
|
|
2749
|
-
let vp = v / (13 * l) + vn;
|
|
2750
|
-
let y = D50.Y * (l <= 8 ? l / k : Math.pow((l + 16) / 116, 3));
|
|
2751
|
-
let x = y * (9 * up) / (4 * vp);
|
|
2752
|
-
let z = y * (12 - 3 * up - 20 * vp) / (4 * vp);
|
|
2753
|
-
let res = {
|
|
2754
|
-
mode: "xyz50",
|
|
2755
|
-
x,
|
|
2756
|
-
y,
|
|
2757
|
-
z
|
|
2758
|
-
};
|
|
2759
|
-
if (alpha !== void 0) res.alpha = alpha;
|
|
2760
|
-
return res;
|
|
2761
|
-
};
|
|
2762
|
-
var convertLuvToXyz50_default = convertLuvToXyz50;
|
|
2763
|
-
|
|
2764
|
-
//#endregion
|
|
2765
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/lchuv/definition.js
|
|
2766
|
-
const convertRgbToLchuv = (rgb$4) => convertLuvToLchuv_default(convertXyz50ToLuv_default(convertRgbToXyz50_default(rgb$4)));
|
|
2767
|
-
const convertLchuvToRgb = (lchuv$1) => convertXyz50ToRgb_default(convertLuvToXyz50_default(convertLchuvToLuv_default(lchuv$1)));
|
|
2768
|
-
const definition$3 = {
|
|
2769
|
-
mode: "lchuv",
|
|
2770
|
-
toMode: {
|
|
2771
|
-
luv: convertLchuvToLuv_default,
|
|
2772
|
-
rgb: convertLchuvToRgb
|
|
2773
|
-
},
|
|
2774
|
-
fromMode: {
|
|
2775
|
-
rgb: convertRgbToLchuv,
|
|
2776
|
-
luv: convertLuvToLchuv_default
|
|
2777
|
-
},
|
|
2778
|
-
channels: [
|
|
2779
|
-
"l",
|
|
2780
|
-
"c",
|
|
2781
|
-
"h",
|
|
2782
|
-
"alpha"
|
|
2783
|
-
],
|
|
2784
|
-
parse: ["--lchuv"],
|
|
2785
|
-
serialize: "--lchuv",
|
|
2786
|
-
ranges: {
|
|
2787
|
-
l: [0, 100],
|
|
2788
|
-
c: [0, 176.956],
|
|
2789
|
-
h: [0, 360]
|
|
2790
|
-
},
|
|
2791
|
-
interpolate: {
|
|
2792
|
-
h: {
|
|
2793
|
-
use: interpolatorLinear,
|
|
2794
|
-
fixup: fixupHueShorter
|
|
2795
|
-
},
|
|
2796
|
-
c: interpolatorLinear,
|
|
2797
|
-
l: interpolatorLinear,
|
|
2798
|
-
alpha: {
|
|
2799
|
-
use: interpolatorLinear,
|
|
2800
|
-
fixup: fixupAlpha
|
|
2801
|
-
}
|
|
2802
|
-
},
|
|
2803
|
-
difference: { h: differenceHueChroma },
|
|
2804
|
-
average: { h: averageAngle }
|
|
2805
|
-
};
|
|
2806
|
-
var definition_default$24 = definition$3;
|
|
2807
|
-
|
|
2808
|
-
//#endregion
|
|
2809
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/luv/definition.js
|
|
2810
|
-
const definition$2 = {
|
|
2811
|
-
mode: "luv",
|
|
2812
|
-
toMode: {
|
|
2813
|
-
xyz50: convertLuvToXyz50_default,
|
|
2814
|
-
rgb: (luv$1) => convertXyz50ToRgb_default(convertLuvToXyz50_default(luv$1))
|
|
2815
|
-
},
|
|
2816
|
-
fromMode: {
|
|
2817
|
-
xyz50: convertXyz50ToLuv_default,
|
|
2818
|
-
rgb: (rgb$4) => convertXyz50ToLuv_default(convertRgbToXyz50_default(rgb$4))
|
|
2819
|
-
},
|
|
2820
|
-
channels: [
|
|
2821
|
-
"l",
|
|
2822
|
-
"u",
|
|
2823
|
-
"v",
|
|
2824
|
-
"alpha"
|
|
2825
|
-
],
|
|
2826
|
-
parse: ["--luv"],
|
|
2827
|
-
serialize: "--luv",
|
|
2828
|
-
ranges: {
|
|
2829
|
-
l: [0, 100],
|
|
2830
|
-
u: [-84.936, 175.042],
|
|
2831
|
-
v: [-125.882, 87.243]
|
|
2832
|
-
},
|
|
2833
|
-
interpolate: {
|
|
2834
|
-
l: interpolatorLinear,
|
|
2835
|
-
u: interpolatorLinear,
|
|
2836
|
-
v: interpolatorLinear,
|
|
2837
|
-
alpha: {
|
|
2838
|
-
use: interpolatorLinear,
|
|
2839
|
-
fixup: fixupAlpha
|
|
2840
|
-
}
|
|
2841
|
-
}
|
|
2842
|
-
};
|
|
2843
|
-
var definition_default$25 = definition$2;
|
|
2844
|
-
|
|
2845
|
-
//#endregion
|
|
2846
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/okhsl/helpers.js
|
|
2847
|
-
function toe(x) {
|
|
2848
|
-
const k_1 = .206;
|
|
2849
|
-
const k_2 = .03;
|
|
2850
|
-
const k_3 = (1 + k_1) / (1 + k_2);
|
|
2851
|
-
return .5 * (k_3 * x - k_1 + Math.sqrt((k_3 * x - k_1) * (k_3 * x - k_1) + 4 * k_2 * k_3 * x));
|
|
2852
|
-
}
|
|
2853
|
-
function toe_inv(x) {
|
|
2854
|
-
const k_1 = .206;
|
|
2855
|
-
const k_2 = .03;
|
|
2856
|
-
const k_3 = (1 + k_1) / (1 + k_2);
|
|
2857
|
-
return (x * x + k_1 * x) / (k_3 * (x + k_2));
|
|
2858
|
-
}
|
|
2859
|
-
function compute_max_saturation(a, b) {
|
|
2860
|
-
let k0, k1, k2, k3, k4, wl, wm, ws;
|
|
2861
|
-
if (-1.88170328 * a - .80936493 * b > 1) {
|
|
2862
|
-
k0 = 1.19086277;
|
|
2863
|
-
k1 = 1.76576728;
|
|
2864
|
-
k2 = .59662641;
|
|
2865
|
-
k3 = .75515197;
|
|
2866
|
-
k4 = .56771245;
|
|
2867
|
-
wl = 4.0767416621;
|
|
2868
|
-
wm = -3.3077115913;
|
|
2869
|
-
ws = .2309699292;
|
|
2870
|
-
} else if (1.81444104 * a - 1.19445276 * b > 1) {
|
|
2871
|
-
k0 = .73956515;
|
|
2872
|
-
k1 = -.45954404;
|
|
2873
|
-
k2 = .08285427;
|
|
2874
|
-
k3 = .1254107;
|
|
2875
|
-
k4 = .14503204;
|
|
2876
|
-
wl = -1.2684380046;
|
|
2877
|
-
wm = 2.6097574011;
|
|
2878
|
-
ws = -.3413193965;
|
|
2879
|
-
} else {
|
|
2880
|
-
k0 = 1.35733652;
|
|
2881
|
-
k1 = -.00915799;
|
|
2882
|
-
k2 = -1.1513021;
|
|
2883
|
-
k3 = -.50559606;
|
|
2884
|
-
k4 = .00692167;
|
|
2885
|
-
wl = -.0041960863;
|
|
2886
|
-
wm = -.7034186147;
|
|
2887
|
-
ws = 1.707614701;
|
|
2888
|
-
}
|
|
2889
|
-
let S = k0 + k1 * a + k2 * b + k3 * a * a + k4 * a * b;
|
|
2890
|
-
let k_l = .3963377774 * a + .2158037573 * b;
|
|
2891
|
-
let k_m = -.1055613458 * a - .0638541728 * b;
|
|
2892
|
-
let k_s = -.0894841775 * a - 1.291485548 * b;
|
|
2893
|
-
{
|
|
2894
|
-
let l_ = 1 + S * k_l;
|
|
2895
|
-
let m_ = 1 + S * k_m;
|
|
2896
|
-
let s_ = 1 + S * k_s;
|
|
2897
|
-
let l = l_ * l_ * l_;
|
|
2898
|
-
let m = m_ * m_ * m_;
|
|
2899
|
-
let s = s_ * s_ * s_;
|
|
2900
|
-
let l_dS = 3 * k_l * l_ * l_;
|
|
2901
|
-
let m_dS = 3 * k_m * m_ * m_;
|
|
2902
|
-
let s_dS = 3 * k_s * s_ * s_;
|
|
2903
|
-
let l_dS2 = 6 * k_l * k_l * l_;
|
|
2904
|
-
let m_dS2 = 6 * k_m * k_m * m_;
|
|
2905
|
-
let s_dS2 = 6 * k_s * k_s * s_;
|
|
2906
|
-
let f$2 = wl * l + wm * m + ws * s;
|
|
2907
|
-
let f1 = wl * l_dS + wm * m_dS + ws * s_dS;
|
|
2908
|
-
let f2 = wl * l_dS2 + wm * m_dS2 + ws * s_dS2;
|
|
2909
|
-
S = S - f$2 * f1 / (f1 * f1 - .5 * f$2 * f2);
|
|
2910
|
-
}
|
|
2911
|
-
return S;
|
|
2912
|
-
}
|
|
2913
|
-
function find_cusp(a, b) {
|
|
2914
|
-
let S_cusp = compute_max_saturation(a, b);
|
|
2915
|
-
let rgb$4 = convertOklabToLrgb_default({
|
|
2916
|
-
l: 1,
|
|
2917
|
-
a: S_cusp * a,
|
|
2918
|
-
b: S_cusp * b
|
|
2919
|
-
});
|
|
2920
|
-
let L_cusp = Math.cbrt(1 / Math.max(rgb$4.r, rgb$4.g, rgb$4.b));
|
|
2921
|
-
let C_cusp = L_cusp * S_cusp;
|
|
2922
|
-
return [L_cusp, C_cusp];
|
|
2923
|
-
}
|
|
2924
|
-
function find_gamut_intersection(a, b, L1, C1$1, L0, cusp = null) {
|
|
2925
|
-
if (!cusp) cusp = find_cusp(a, b);
|
|
2926
|
-
let t;
|
|
2927
|
-
if ((L1 - L0) * cusp[1] - (cusp[0] - L0) * C1$1 <= 0) t = cusp[1] * L0 / (C1$1 * cusp[0] + cusp[1] * (L0 - L1));
|
|
2928
|
-
else {
|
|
2929
|
-
t = cusp[1] * (L0 - 1) / (C1$1 * (cusp[0] - 1) + cusp[1] * (L0 - L1));
|
|
2930
|
-
{
|
|
2931
|
-
let dL = L1 - L0;
|
|
2932
|
-
let dC = C1$1;
|
|
2933
|
-
let k_l = .3963377774 * a + .2158037573 * b;
|
|
2934
|
-
let k_m = -.1055613458 * a - .0638541728 * b;
|
|
2935
|
-
let k_s = -.0894841775 * a - 1.291485548 * b;
|
|
2936
|
-
let l_dt = dL + dC * k_l;
|
|
2937
|
-
let m_dt = dL + dC * k_m;
|
|
2938
|
-
let s_dt = dL + dC * k_s;
|
|
2939
|
-
{
|
|
2940
|
-
let L = L0 * (1 - t) + t * L1;
|
|
2941
|
-
let C = t * C1$1;
|
|
2942
|
-
let l_ = L + C * k_l;
|
|
2943
|
-
let m_ = L + C * k_m;
|
|
2944
|
-
let s_ = L + C * k_s;
|
|
2945
|
-
let l = l_ * l_ * l_;
|
|
2946
|
-
let m = m_ * m_ * m_;
|
|
2947
|
-
let s = s_ * s_ * s_;
|
|
2948
|
-
let ldt = 3 * l_dt * l_ * l_;
|
|
2949
|
-
let mdt = 3 * m_dt * m_ * m_;
|
|
2950
|
-
let sdt = 3 * s_dt * s_ * s_;
|
|
2951
|
-
let ldt2 = 6 * l_dt * l_dt * l_;
|
|
2952
|
-
let mdt2 = 6 * m_dt * m_dt * m_;
|
|
2953
|
-
let sdt2 = 6 * s_dt * s_dt * s_;
|
|
2954
|
-
let r$1 = 4.0767416621 * l - 3.3077115913 * m + .2309699292 * s - 1;
|
|
2955
|
-
let r1 = 4.0767416621 * ldt - 3.3077115913 * mdt + .2309699292 * sdt;
|
|
2956
|
-
let r2 = 4.0767416621 * ldt2 - 3.3077115913 * mdt2 + .2309699292 * sdt2;
|
|
2957
|
-
let u_r = r1 / (r1 * r1 - .5 * r$1 * r2);
|
|
2958
|
-
let t_r = -r$1 * u_r;
|
|
2959
|
-
let g = -1.2684380046 * l + 2.6097574011 * m - .3413193965 * s - 1;
|
|
2960
|
-
let g1 = -1.2684380046 * ldt + 2.6097574011 * mdt - .3413193965 * sdt;
|
|
2961
|
-
let g2 = -1.2684380046 * ldt2 + 2.6097574011 * mdt2 - .3413193965 * sdt2;
|
|
2962
|
-
let u_g = g1 / (g1 * g1 - .5 * g * g2);
|
|
2963
|
-
let t_g = -g * u_g;
|
|
2964
|
-
let b$1 = -.0041960863 * l - .7034186147 * m + 1.707614701 * s - 1;
|
|
2965
|
-
let b1 = -.0041960863 * ldt - .7034186147 * mdt + 1.707614701 * sdt;
|
|
2966
|
-
let b2 = -.0041960863 * ldt2 - .7034186147 * mdt2 + 1.707614701 * sdt2;
|
|
2967
|
-
let u_b = b1 / (b1 * b1 - .5 * b$1 * b2);
|
|
2968
|
-
let t_b = -b$1 * u_b;
|
|
2969
|
-
t_r = u_r >= 0 ? t_r : 1e6;
|
|
2970
|
-
t_g = u_g >= 0 ? t_g : 1e6;
|
|
2971
|
-
t_b = u_b >= 0 ? t_b : 1e6;
|
|
2972
|
-
t += Math.min(t_r, Math.min(t_g, t_b));
|
|
2973
|
-
}
|
|
2974
|
-
}
|
|
2975
|
-
}
|
|
2976
|
-
return t;
|
|
2977
|
-
}
|
|
2978
|
-
function get_ST_max(a_, b_, cusp = null) {
|
|
2979
|
-
if (!cusp) cusp = find_cusp(a_, b_);
|
|
2980
|
-
let L = cusp[0];
|
|
2981
|
-
let C = cusp[1];
|
|
2982
|
-
return [C / L, C / (1 - L)];
|
|
2983
|
-
}
|
|
2984
|
-
function get_Cs(L, a_, b_) {
|
|
2985
|
-
let cusp = find_cusp(a_, b_);
|
|
2986
|
-
let C_max = find_gamut_intersection(a_, b_, L, 1, L, cusp);
|
|
2987
|
-
let ST_max = get_ST_max(a_, b_, cusp);
|
|
2988
|
-
let S_mid = .11516993 + 1 / (7.4477897 + 4.1590124 * b_ + a_ * (-2.19557347 + 1.75198401 * b_ + a_ * (-2.13704948 - 10.02301043 * b_ + a_ * (-4.24894561 + 5.38770819 * b_ + 4.69891013 * a_))));
|
|
2989
|
-
let T_mid = .11239642 + 1 / (1.6132032 - .68124379 * b_ + a_ * (.40370612 + .90148123 * b_ + a_ * (-.27087943 + .6122399 * b_ + a_ * (.00299215 - .45399568 * b_ - .14661872 * a_))));
|
|
2990
|
-
let k$3 = C_max / Math.min(L * ST_max[0], (1 - L) * ST_max[1]);
|
|
2991
|
-
let C_a = L * S_mid;
|
|
2992
|
-
let C_b = (1 - L) * T_mid;
|
|
2993
|
-
let C_mid = .9 * k$3 * Math.sqrt(Math.sqrt(1 / (1 / (C_a * C_a * C_a * C_a) + 1 / (C_b * C_b * C_b * C_b))));
|
|
2994
|
-
C_a = L * .4;
|
|
2995
|
-
C_b = (1 - L) * .8;
|
|
2996
|
-
return [
|
|
2997
|
-
Math.sqrt(1 / (1 / (C_a * C_a) + 1 / (C_b * C_b))),
|
|
2998
|
-
C_mid,
|
|
2999
|
-
C_max
|
|
3000
|
-
];
|
|
3001
|
-
}
|
|
3002
|
-
|
|
3003
|
-
//#endregion
|
|
3004
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/okhsl/convertOklabToOkhsl.js
|
|
3005
|
-
function convertOklabToOkhsl(lab$2) {
|
|
3006
|
-
const l = lab$2.l !== void 0 ? lab$2.l : 0;
|
|
3007
|
-
const a = lab$2.a !== void 0 ? lab$2.a : 0;
|
|
3008
|
-
const b = lab$2.b !== void 0 ? lab$2.b : 0;
|
|
3009
|
-
const ret = {
|
|
3010
|
-
mode: "okhsl",
|
|
3011
|
-
l: toe(l)
|
|
3012
|
-
};
|
|
3013
|
-
if (lab$2.alpha !== void 0) ret.alpha = lab$2.alpha;
|
|
3014
|
-
let c$1 = Math.sqrt(a * a + b * b);
|
|
3015
|
-
if (!c$1) {
|
|
3016
|
-
ret.s = 0;
|
|
3017
|
-
return ret;
|
|
3018
|
-
}
|
|
3019
|
-
let [C_0, C_mid, C_max] = get_Cs(l, a / c$1, b / c$1);
|
|
3020
|
-
let s;
|
|
3021
|
-
if (c$1 < C_mid) {
|
|
3022
|
-
let k_0 = 0;
|
|
3023
|
-
let k_1 = .8 * C_0;
|
|
3024
|
-
let k_2 = 1 - k_1 / C_mid;
|
|
3025
|
-
s = (c$1 - k_0) / (k_1 + k_2 * (c$1 - k_0)) * .8;
|
|
3026
|
-
} else {
|
|
3027
|
-
let k_0 = C_mid;
|
|
3028
|
-
let k_1 = .2 * C_mid * C_mid * 1.25 * 1.25 / C_0;
|
|
3029
|
-
let k_2 = 1 - k_1 / (C_max - C_mid);
|
|
3030
|
-
s = .8 + .2 * ((c$1 - k_0) / (k_1 + k_2 * (c$1 - k_0)));
|
|
3031
|
-
}
|
|
3032
|
-
if (s) {
|
|
3033
|
-
ret.s = s;
|
|
3034
|
-
ret.h = normalizeHue_default(Math.atan2(b, a) * 180 / Math.PI);
|
|
3035
|
-
}
|
|
3036
|
-
return ret;
|
|
3037
|
-
}
|
|
3038
|
-
|
|
3039
|
-
//#endregion
|
|
3040
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/okhsl/convertOkhslToOklab.js
|
|
3041
|
-
function convertOkhslToOklab(hsl$3) {
|
|
3042
|
-
let h = hsl$3.h !== void 0 ? hsl$3.h : 0;
|
|
3043
|
-
let s = hsl$3.s !== void 0 ? hsl$3.s : 0;
|
|
3044
|
-
let l = hsl$3.l !== void 0 ? hsl$3.l : 0;
|
|
3045
|
-
const ret = {
|
|
3046
|
-
mode: "oklab",
|
|
3047
|
-
l: toe_inv(l)
|
|
3048
|
-
};
|
|
3049
|
-
if (hsl$3.alpha !== void 0) ret.alpha = hsl$3.alpha;
|
|
3050
|
-
if (!s || l === 1) {
|
|
3051
|
-
ret.a = ret.b = 0;
|
|
3052
|
-
return ret;
|
|
3053
|
-
}
|
|
3054
|
-
let a_ = Math.cos(h / 180 * Math.PI);
|
|
3055
|
-
let b_ = Math.sin(h / 180 * Math.PI);
|
|
3056
|
-
let [C_0, C_mid, C_max] = get_Cs(ret.l, a_, b_);
|
|
3057
|
-
let t, k_0, k_1, k_2;
|
|
3058
|
-
if (s < .8) {
|
|
3059
|
-
t = 1.25 * s;
|
|
3060
|
-
k_0 = 0;
|
|
3061
|
-
k_1 = .8 * C_0;
|
|
3062
|
-
k_2 = 1 - k_1 / C_mid;
|
|
3063
|
-
} else {
|
|
3064
|
-
t = 5 * (s - .8);
|
|
3065
|
-
k_0 = C_mid;
|
|
3066
|
-
k_1 = .2 * C_mid * C_mid * 1.25 * 1.25 / C_0;
|
|
3067
|
-
k_2 = 1 - k_1 / (C_max - C_mid);
|
|
3068
|
-
}
|
|
3069
|
-
let C = k_0 + t * k_1 / (1 - k_2 * t);
|
|
3070
|
-
ret.a = C * a_;
|
|
3071
|
-
ret.b = C * b_;
|
|
3072
|
-
return ret;
|
|
3073
|
-
}
|
|
3074
|
-
|
|
3075
|
-
//#endregion
|
|
3076
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/okhsl/modeOkhsl.js
|
|
3077
|
-
const modeOkhsl = {
|
|
3078
|
-
...definition_default$1,
|
|
3079
|
-
mode: "okhsl",
|
|
3080
|
-
channels: [
|
|
3081
|
-
"h",
|
|
3082
|
-
"s",
|
|
3083
|
-
"l",
|
|
3084
|
-
"alpha"
|
|
3085
|
-
],
|
|
3086
|
-
parse: ["--okhsl"],
|
|
3087
|
-
serialize: "--okhsl",
|
|
3088
|
-
fromMode: {
|
|
3089
|
-
oklab: convertOklabToOkhsl,
|
|
3090
|
-
rgb: (c$1) => convertOklabToOkhsl(convertRgbToOklab_default(c$1))
|
|
3091
|
-
},
|
|
3092
|
-
toMode: {
|
|
3093
|
-
oklab: convertOkhslToOklab,
|
|
3094
|
-
rgb: (c$1) => convertOklabToRgb_default(convertOkhslToOklab(c$1))
|
|
3095
|
-
}
|
|
3096
|
-
};
|
|
3097
|
-
var modeOkhsl_default = modeOkhsl;
|
|
3098
|
-
|
|
3099
|
-
//#endregion
|
|
3100
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/okhsv/convertOklabToOkhsv.js
|
|
3101
|
-
function convertOklabToOkhsv(lab$2) {
|
|
3102
|
-
let l = lab$2.l !== void 0 ? lab$2.l : 0;
|
|
3103
|
-
let a = lab$2.a !== void 0 ? lab$2.a : 0;
|
|
3104
|
-
let b = lab$2.b !== void 0 ? lab$2.b : 0;
|
|
3105
|
-
let c$1 = Math.sqrt(a * a + b * b);
|
|
3106
|
-
let a_ = c$1 ? a / c$1 : 1;
|
|
3107
|
-
let b_ = c$1 ? b / c$1 : 1;
|
|
3108
|
-
let [S_max, T] = get_ST_max(a_, b_);
|
|
3109
|
-
let S_0 = .5;
|
|
3110
|
-
let k$3 = 1 - S_0 / S_max;
|
|
3111
|
-
let t = T / (c$1 + l * T);
|
|
3112
|
-
let L_v = t * l;
|
|
3113
|
-
let C_v = t * c$1;
|
|
3114
|
-
let L_vt = toe_inv(L_v);
|
|
3115
|
-
let C_vt = C_v * L_vt / L_v;
|
|
3116
|
-
let rgb_scale = convertOklabToLrgb_default({
|
|
3117
|
-
l: L_vt,
|
|
3118
|
-
a: a_ * C_vt,
|
|
3119
|
-
b: b_ * C_vt
|
|
3120
|
-
});
|
|
3121
|
-
let scale_L = Math.cbrt(1 / Math.max(rgb_scale.r, rgb_scale.g, rgb_scale.b, 0));
|
|
3122
|
-
l = l / scale_L;
|
|
3123
|
-
c$1 = c$1 / scale_L * toe(l) / l;
|
|
3124
|
-
l = toe(l);
|
|
3125
|
-
const ret = {
|
|
3126
|
-
mode: "okhsv",
|
|
3127
|
-
s: c$1 ? (S_0 + T) * C_v / (T * S_0 + T * k$3 * C_v) : 0,
|
|
3128
|
-
v: l ? l / L_v : 0
|
|
3129
|
-
};
|
|
3130
|
-
if (ret.s) ret.h = normalizeHue_default(Math.atan2(b, a) * 180 / Math.PI);
|
|
3131
|
-
if (lab$2.alpha !== void 0) ret.alpha = lab$2.alpha;
|
|
3132
|
-
return ret;
|
|
3133
|
-
}
|
|
3134
|
-
|
|
3135
|
-
//#endregion
|
|
3136
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/okhsv/convertOkhsvToOklab.js
|
|
3137
|
-
function convertOkhsvToOklab(hsv$2) {
|
|
3138
|
-
const ret = { mode: "oklab" };
|
|
3139
|
-
if (hsv$2.alpha !== void 0) ret.alpha = hsv$2.alpha;
|
|
3140
|
-
const h = hsv$2.h !== void 0 ? hsv$2.h : 0;
|
|
3141
|
-
const s = hsv$2.s !== void 0 ? hsv$2.s : 0;
|
|
3142
|
-
const v = hsv$2.v !== void 0 ? hsv$2.v : 0;
|
|
3143
|
-
const a_ = Math.cos(h / 180 * Math.PI);
|
|
3144
|
-
const b_ = Math.sin(h / 180 * Math.PI);
|
|
3145
|
-
const [S_max, T] = get_ST_max(a_, b_);
|
|
3146
|
-
const S_0 = .5;
|
|
3147
|
-
const k$3 = 1 - S_0 / S_max;
|
|
3148
|
-
const L_v = 1 - s * S_0 / (S_0 + T - T * k$3 * s);
|
|
3149
|
-
const C_v = s * T * S_0 / (S_0 + T - T * k$3 * s);
|
|
3150
|
-
const L_vt = toe_inv(L_v);
|
|
3151
|
-
const C_vt = C_v * L_vt / L_v;
|
|
3152
|
-
const rgb_scale = convertOklabToLrgb_default({
|
|
3153
|
-
l: L_vt,
|
|
3154
|
-
a: a_ * C_vt,
|
|
3155
|
-
b: b_ * C_vt
|
|
3156
|
-
});
|
|
3157
|
-
const scale_L = Math.cbrt(1 / Math.max(rgb_scale.r, rgb_scale.g, rgb_scale.b, 0));
|
|
3158
|
-
const L_new = toe_inv(v * L_v);
|
|
3159
|
-
const C = C_v * L_new / L_v;
|
|
3160
|
-
ret.l = L_new * scale_L;
|
|
3161
|
-
ret.a = C * a_ * scale_L;
|
|
3162
|
-
ret.b = C * b_ * scale_L;
|
|
3163
|
-
return ret;
|
|
3164
|
-
}
|
|
3165
|
-
|
|
3166
|
-
//#endregion
|
|
3167
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/okhsv/modeOkhsv.js
|
|
3168
|
-
const modeOkhsv = {
|
|
3169
|
-
...definition_default$19,
|
|
3170
|
-
mode: "okhsv",
|
|
3171
|
-
channels: [
|
|
3172
|
-
"h",
|
|
3173
|
-
"s",
|
|
3174
|
-
"v",
|
|
3175
|
-
"alpha"
|
|
3176
|
-
],
|
|
3177
|
-
parse: ["--okhsv"],
|
|
3178
|
-
serialize: "--okhsv",
|
|
3179
|
-
fromMode: {
|
|
3180
|
-
oklab: convertOklabToOkhsv,
|
|
3181
|
-
rgb: (c$1) => convertOklabToOkhsv(convertRgbToOklab_default(c$1))
|
|
3182
|
-
},
|
|
3183
|
-
toMode: {
|
|
3184
|
-
oklab: convertOkhsvToOklab,
|
|
3185
|
-
rgb: (c$1) => convertOklabToRgb_default(convertOkhsvToOklab(c$1))
|
|
3186
|
-
}
|
|
3187
|
-
};
|
|
3188
|
-
var modeOkhsv_default = modeOkhsv;
|
|
3189
|
-
|
|
3190
|
-
//#endregion
|
|
3191
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/xyb/constants.js
|
|
3192
|
-
const bias = .0037930732552754493;
|
|
3193
|
-
const bias_cbrt = Math.cbrt(bias);
|
|
3194
|
-
|
|
3195
|
-
//#endregion
|
|
3196
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/xyb/convertRgbToXyb.js
|
|
3197
|
-
const transfer$1 = (v) => Math.cbrt(v) - bias_cbrt;
|
|
3198
|
-
const convertRgbToXyb = (color) => {
|
|
3199
|
-
const { r: r$1, g, b, alpha } = convertRgbToLrgb_default(color);
|
|
3200
|
-
const l = transfer$1(.3 * r$1 + .622 * g + .078 * b + bias);
|
|
3201
|
-
const m = transfer$1(.23 * r$1 + .692 * g + .078 * b + bias);
|
|
3202
|
-
const s = transfer$1(.2434226892454782 * r$1 + .2047674442449682 * g + .5518098665095535 * b + bias);
|
|
3203
|
-
const res = {
|
|
3204
|
-
mode: "xyb",
|
|
3205
|
-
x: (l - m) / 2,
|
|
3206
|
-
y: (l + m) / 2,
|
|
3207
|
-
b: s - (l + m) / 2
|
|
3208
|
-
};
|
|
3209
|
-
if (alpha !== void 0) res.alpha = alpha;
|
|
3210
|
-
return res;
|
|
3211
|
-
};
|
|
3212
|
-
var convertRgbToXyb_default = convertRgbToXyb;
|
|
3213
|
-
|
|
3214
|
-
//#endregion
|
|
3215
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/xyb/convertXybToRgb.js
|
|
3216
|
-
const transfer = (v) => Math.pow(v + bias_cbrt, 3);
|
|
3217
|
-
const convertXybToRgb = ({ x, y, b, alpha }) => {
|
|
3218
|
-
if (x === void 0) x = 0;
|
|
3219
|
-
if (y === void 0) y = 0;
|
|
3220
|
-
if (b === void 0) b = 0;
|
|
3221
|
-
const l = transfer(x + y) - bias;
|
|
3222
|
-
const m = transfer(y - x) - bias;
|
|
3223
|
-
const s = transfer(b + y) - bias;
|
|
3224
|
-
const res = convertLrgbToRgb_default({
|
|
3225
|
-
r: 11.031566904639861 * l - 9.866943908131562 * m - .16462299650829934 * s,
|
|
3226
|
-
g: -3.2541473810744237 * l + 4.418770377582723 * m - .16462299650829934 * s,
|
|
3227
|
-
b: -3.6588512867136815 * l + 2.7129230459360922 * m + 1.9459282407775895 * s
|
|
3228
|
-
});
|
|
3229
|
-
if (alpha !== void 0) res.alpha = alpha;
|
|
3230
|
-
return res;
|
|
3231
|
-
};
|
|
3232
|
-
var convertXybToRgb_default = convertXybToRgb;
|
|
3233
|
-
|
|
3234
|
-
//#endregion
|
|
3235
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/xyb/definition.js
|
|
3236
|
-
const definition$1 = {
|
|
3237
|
-
mode: "xyb",
|
|
3238
|
-
channels: [
|
|
3239
|
-
"x",
|
|
3240
|
-
"y",
|
|
3241
|
-
"b",
|
|
3242
|
-
"alpha"
|
|
3243
|
-
],
|
|
3244
|
-
parse: ["--xyb"],
|
|
3245
|
-
serialize: "--xyb",
|
|
3246
|
-
toMode: { rgb: convertXybToRgb_default },
|
|
3247
|
-
fromMode: { rgb: convertRgbToXyb_default },
|
|
3248
|
-
ranges: {
|
|
3249
|
-
x: [-.0154, .0281],
|
|
3250
|
-
y: [0, .8453],
|
|
3251
|
-
b: [-.2778, .388]
|
|
3252
|
-
},
|
|
3253
|
-
interpolate: {
|
|
3254
|
-
x: interpolatorLinear,
|
|
3255
|
-
y: interpolatorLinear,
|
|
3256
|
-
b: interpolatorLinear,
|
|
3257
|
-
alpha: {
|
|
3258
|
-
use: interpolatorLinear,
|
|
3259
|
-
fixup: fixupAlpha
|
|
3260
|
-
}
|
|
3261
|
-
}
|
|
3262
|
-
};
|
|
3263
|
-
var definition_default$26 = definition$1;
|
|
3264
|
-
|
|
3265
|
-
//#endregion
|
|
3266
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/yiq/convertRgbToYiq.js
|
|
3267
|
-
const convertRgbToYiq = ({ r: r$1, g, b, alpha }) => {
|
|
3268
|
-
if (r$1 === void 0) r$1 = 0;
|
|
3269
|
-
if (g === void 0) g = 0;
|
|
3270
|
-
if (b === void 0) b = 0;
|
|
3271
|
-
const res = {
|
|
3272
|
-
mode: "yiq",
|
|
3273
|
-
y: .29889531 * r$1 + .58662247 * g + .11448223 * b,
|
|
3274
|
-
i: .59597799 * r$1 - .2741761 * g - .32180189 * b,
|
|
3275
|
-
q: .21147017 * r$1 - .52261711 * g + .31114694 * b
|
|
3276
|
-
};
|
|
3277
|
-
if (alpha !== void 0) res.alpha = alpha;
|
|
3278
|
-
return res;
|
|
3279
|
-
};
|
|
3280
|
-
var convertRgbToYiq_default = convertRgbToYiq;
|
|
3281
|
-
|
|
3282
|
-
//#endregion
|
|
3283
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/yiq/convertYiqToRgb.js
|
|
3284
|
-
const convertYiqToRgb = ({ y, i, q, alpha }) => {
|
|
3285
|
-
if (y === void 0) y = 0;
|
|
3286
|
-
if (i === void 0) i = 0;
|
|
3287
|
-
if (q === void 0) q = 0;
|
|
3288
|
-
const res = {
|
|
3289
|
-
mode: "rgb",
|
|
3290
|
-
r: y + .95608445 * i + .6208885 * q,
|
|
3291
|
-
g: y - .27137664 * i - .6486059 * q,
|
|
3292
|
-
b: y - 1.10561724 * i + 1.70250126 * q
|
|
3293
|
-
};
|
|
3294
|
-
if (alpha !== void 0) res.alpha = alpha;
|
|
3295
|
-
return res;
|
|
3296
|
-
};
|
|
3297
|
-
var convertYiqToRgb_default = convertYiqToRgb;
|
|
3298
|
-
|
|
3299
|
-
//#endregion
|
|
3300
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/yiq/definition.js
|
|
3301
|
-
const definition = {
|
|
3302
|
-
mode: "yiq",
|
|
3303
|
-
toMode: { rgb: convertYiqToRgb_default },
|
|
3304
|
-
fromMode: { rgb: convertRgbToYiq_default },
|
|
3305
|
-
channels: [
|
|
3306
|
-
"y",
|
|
3307
|
-
"i",
|
|
3308
|
-
"q",
|
|
3309
|
-
"alpha"
|
|
3310
|
-
],
|
|
3311
|
-
parse: ["--yiq"],
|
|
3312
|
-
serialize: "--yiq",
|
|
3313
|
-
ranges: {
|
|
3314
|
-
i: [-.595, .595],
|
|
3315
|
-
q: [-.522, .522]
|
|
3316
|
-
},
|
|
3317
|
-
interpolate: {
|
|
3318
|
-
y: interpolatorLinear,
|
|
3319
|
-
i: interpolatorLinear,
|
|
3320
|
-
q: interpolatorLinear,
|
|
3321
|
-
alpha: {
|
|
3322
|
-
use: interpolatorLinear,
|
|
3323
|
-
fixup: fixupAlpha
|
|
3324
|
-
}
|
|
3325
|
-
}
|
|
3326
|
-
};
|
|
3327
|
-
var definition_default$27 = definition;
|
|
3328
|
-
|
|
3329
|
-
//#endregion
|
|
3330
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/round.js
|
|
3331
|
-
const r = (value, precision) => Math.round(value * (precision = Math.pow(10, precision))) / precision;
|
|
3332
|
-
const round = (precision = 4) => (value) => typeof value === "number" ? r(value, precision) : value;
|
|
3333
|
-
var round_default = round;
|
|
3334
|
-
|
|
3335
|
-
//#endregion
|
|
3336
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/formatter.js
|
|
3337
|
-
let twoDecimals = round_default(2);
|
|
3338
|
-
const clamp = (value) => Math.max(0, Math.min(1, value || 0));
|
|
3339
|
-
const fixup = (value) => Math.round(clamp(value) * 255);
|
|
3340
|
-
const rgb$2 = converter_default("rgb");
|
|
3341
|
-
const hsl$1 = converter_default("hsl");
|
|
3342
|
-
const serializeHex = (color) => {
|
|
3343
|
-
if (color === void 0) return;
|
|
3344
|
-
let r$1 = fixup(color.r);
|
|
3345
|
-
let g = fixup(color.g);
|
|
3346
|
-
let b = fixup(color.b);
|
|
3347
|
-
return "#" + (1 << 24 | r$1 << 16 | g << 8 | b).toString(16).slice(1);
|
|
3348
|
-
};
|
|
3349
|
-
const serializeHex8 = (color) => {
|
|
3350
|
-
if (color === void 0) return;
|
|
3351
|
-
let a = fixup(color.alpha !== void 0 ? color.alpha : 1);
|
|
3352
|
-
return serializeHex(color) + (256 | a).toString(16).slice(1);
|
|
3353
|
-
};
|
|
3354
|
-
const formatCss = (c$1) => {
|
|
3355
|
-
const color = _prepare_default(c$1);
|
|
3356
|
-
if (!color) return;
|
|
3357
|
-
const def = getMode(color.mode);
|
|
3358
|
-
if (!def.serialize || typeof def.serialize === "string") {
|
|
3359
|
-
let res = `color(${def.serialize || `--${color.mode}`} `;
|
|
3360
|
-
def.channels.forEach((ch, i) => {
|
|
3361
|
-
if (ch !== "alpha") res += (i ? " " : "") + (color[ch] !== void 0 ? color[ch] : "none");
|
|
3362
|
-
});
|
|
3363
|
-
if (color.alpha !== void 0 && color.alpha < 1) res += ` / ${color.alpha}`;
|
|
3364
|
-
return res + ")";
|
|
3365
|
-
}
|
|
3366
|
-
if (typeof def.serialize === "function") return def.serialize(color);
|
|
3367
|
-
};
|
|
3368
|
-
const formatHex = (c$1) => serializeHex(rgb$2(c$1));
|
|
3369
|
-
const formatHex8 = (c$1) => serializeHex8(rgb$2(c$1));
|
|
3370
|
-
|
|
3371
|
-
//#endregion
|
|
3372
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/clamp.js
|
|
3373
|
-
const rgb$1 = converter_default("rgb");
|
|
3374
|
-
const fixup_rgb = (c$1) => {
|
|
3375
|
-
const res = {
|
|
3376
|
-
mode: c$1.mode,
|
|
3377
|
-
r: Math.max(0, Math.min(c$1.r !== void 0 ? c$1.r : 0, 1)),
|
|
3378
|
-
g: Math.max(0, Math.min(c$1.g !== void 0 ? c$1.g : 0, 1)),
|
|
3379
|
-
b: Math.max(0, Math.min(c$1.b !== void 0 ? c$1.b : 0, 1))
|
|
3380
|
-
};
|
|
3381
|
-
if (c$1.alpha !== void 0) res.alpha = c$1.alpha;
|
|
3382
|
-
return res;
|
|
3383
|
-
};
|
|
3384
|
-
const inrange_rgb = (c$1) => {
|
|
3385
|
-
return c$1 !== void 0 && (c$1.r === void 0 || c$1.r >= 0 && c$1.r <= 1) && (c$1.g === void 0 || c$1.g >= 0 && c$1.g <= 1) && (c$1.b === void 0 || c$1.b >= 0 && c$1.b <= 1);
|
|
3386
|
-
};
|
|
3387
|
-
function displayable(color) {
|
|
3388
|
-
return inrange_rgb(rgb$1(color));
|
|
3389
|
-
}
|
|
3390
|
-
function inGamut(mode = "rgb") {
|
|
3391
|
-
const { gamut } = getMode(mode);
|
|
3392
|
-
if (!gamut) return (color) => true;
|
|
3393
|
-
const conv = converter_default(typeof gamut === "string" ? gamut : mode);
|
|
3394
|
-
return (color) => inrange_rgb(conv(color));
|
|
3395
|
-
}
|
|
3396
|
-
function clampGamut(mode = "rgb") {
|
|
3397
|
-
const { gamut } = getMode(mode);
|
|
3398
|
-
if (!gamut) return (color) => _prepare_default(color);
|
|
3399
|
-
const destMode = typeof gamut === "string" ? gamut : mode;
|
|
3400
|
-
const destConv = converter_default(destMode);
|
|
3401
|
-
const inDestGamut = inGamut(destMode);
|
|
3402
|
-
return (color) => {
|
|
3403
|
-
const original = _prepare_default(color);
|
|
3404
|
-
if (!original) return;
|
|
3405
|
-
const converted = destConv(original);
|
|
3406
|
-
if (inDestGamut(converted)) return original;
|
|
3407
|
-
const clamped = fixup_rgb(converted);
|
|
3408
|
-
if (original.mode === clamped.mode) return clamped;
|
|
3409
|
-
return converter_default(original.mode)(clamped);
|
|
3410
|
-
};
|
|
3411
|
-
}
|
|
3412
|
-
function toGamut(dest = "rgb", mode = "oklch", delta = differenceEuclidean("oklch"), jnd = .02) {
|
|
3413
|
-
const destConv = converter_default(dest);
|
|
3414
|
-
const destMode = getMode(dest);
|
|
3415
|
-
if (!destMode.gamut) return (color) => destConv(color);
|
|
3416
|
-
const inDestinationGamut = inGamut(dest);
|
|
3417
|
-
const clipToGamut = clampGamut(dest);
|
|
3418
|
-
const ucs = converter_default(mode);
|
|
3419
|
-
const { ranges } = getMode(mode);
|
|
3420
|
-
if (!ranges.l || !ranges.c) throw new Error("LCH-like space expected");
|
|
3421
|
-
return (color) => {
|
|
3422
|
-
color = _prepare_default(color);
|
|
3423
|
-
if (color === void 0) return;
|
|
3424
|
-
const candidate = { ...ucs(color) };
|
|
3425
|
-
if (candidate.l === void 0) candidate.l = 0;
|
|
3426
|
-
if (candidate.c === void 0) candidate.c = 0;
|
|
3427
|
-
if (candidate.l >= ranges.l[1]) {
|
|
3428
|
-
const res = {
|
|
3429
|
-
...destMode.white,
|
|
3430
|
-
mode: dest
|
|
3431
|
-
};
|
|
3432
|
-
if (color.alpha !== void 0) res.alpha = color.alpha;
|
|
3433
|
-
return res;
|
|
3434
|
-
}
|
|
3435
|
-
if (candidate.l <= ranges.l[0]) {
|
|
3436
|
-
const res = {
|
|
3437
|
-
...destMode.black,
|
|
3438
|
-
mode: dest
|
|
3439
|
-
};
|
|
3440
|
-
if (color.alpha !== void 0) res.alpha = color.alpha;
|
|
3441
|
-
return res;
|
|
3442
|
-
}
|
|
3443
|
-
if (inDestinationGamut(candidate)) return destConv(candidate);
|
|
3444
|
-
let start = 0;
|
|
3445
|
-
let end = candidate.c;
|
|
3446
|
-
let epsilon = (ranges.c[1] - ranges.c[0]) / 4e3;
|
|
3447
|
-
let clipped = clipToGamut(candidate);
|
|
3448
|
-
while (end - start > epsilon) {
|
|
3449
|
-
candidate.c = (start + end) * .5;
|
|
3450
|
-
clipped = clipToGamut(candidate);
|
|
3451
|
-
if (inDestinationGamut(candidate) || delta && jnd > 0 && delta(candidate, clipped) <= jnd) start = candidate.c;
|
|
3452
|
-
else end = candidate.c;
|
|
3453
|
-
}
|
|
3454
|
-
return destConv(inDestinationGamut(candidate) ? candidate : clipped);
|
|
3455
|
-
};
|
|
3456
|
-
}
|
|
3457
|
-
|
|
3458
|
-
//#endregion
|
|
3459
|
-
//#region ../token-tools/dist/string-D3-qmBT2.js
|
|
3460
|
-
const HEX_RE = /^#?([0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{4}|[0-9a-f]{3})$/i;
|
|
3461
|
-
const CULORI_TO_CSS = {
|
|
3462
|
-
a98: "a98-rgb",
|
|
3463
|
-
hsl: "hsl",
|
|
3464
|
-
hwb: "hwb",
|
|
3465
|
-
lab: "lab",
|
|
3466
|
-
lab65: "lab-d65",
|
|
3467
|
-
lch: "lch",
|
|
3468
|
-
lrgb: "srgb-linear",
|
|
3469
|
-
oklab: "oklab",
|
|
3470
|
-
oklch: "oklch",
|
|
3471
|
-
okhsv: "okhsv",
|
|
3472
|
-
p3: "display-p3",
|
|
3473
|
-
prophoto: "prophoto-rgb",
|
|
3474
|
-
rec2020: "rec2020",
|
|
3475
|
-
rgb: "srgb",
|
|
3476
|
-
xyz50: "xyz-d50",
|
|
3477
|
-
xyz65: "xyz-d65"
|
|
3478
|
-
};
|
|
3479
|
-
const CSS_TO_CULORI = {
|
|
3480
|
-
"a98-rgb": "a98",
|
|
3481
|
-
"display-p3": "p3",
|
|
3482
|
-
hsl: "hsl",
|
|
3483
|
-
hwb: "hwb",
|
|
3484
|
-
lab: "lab",
|
|
3485
|
-
"lab-d65": "lab65",
|
|
3486
|
-
lch: "lch",
|
|
3487
|
-
oklab: "oklab",
|
|
3488
|
-
oklch: "oklch",
|
|
3489
|
-
okhsv: "okhsv",
|
|
3490
|
-
"prophoto-rgb": "prophoto",
|
|
3491
|
-
rec2020: "rec2020",
|
|
3492
|
-
srgb: "rgb",
|
|
3493
|
-
"srgb-linear": "lrgb",
|
|
3494
|
-
xyz: "xyz65",
|
|
3495
|
-
"xyz-d50": "xyz50",
|
|
3496
|
-
"xyz-d65": "xyz65"
|
|
3497
|
-
};
|
|
3498
|
-
/** Parse any color */
|
|
3499
|
-
function parseColor(color) {
|
|
3500
|
-
const result = parse_default(color);
|
|
3501
|
-
if (!result) throw new Error(`Unable to parse color "${color}"`);
|
|
3502
|
-
if (!(result.mode in CULORI_TO_CSS)) throw new Error(`Unsupported color space: ${result.mode}`);
|
|
3503
|
-
const colorSpace = CULORI_TO_CSS[result.mode];
|
|
3504
|
-
let components = [
|
|
3505
|
-
0,
|
|
3506
|
-
0,
|
|
3507
|
-
0
|
|
3508
|
-
];
|
|
3509
|
-
switch (result.mode) {
|
|
3510
|
-
case "a98":
|
|
3511
|
-
case "rec2020":
|
|
3512
|
-
case "p3":
|
|
3513
|
-
case "prophoto":
|
|
3514
|
-
case "lrgb":
|
|
3515
|
-
case "rgb":
|
|
3516
|
-
components = [
|
|
3517
|
-
result.r,
|
|
3518
|
-
result.g,
|
|
3519
|
-
result.b
|
|
3520
|
-
];
|
|
3521
|
-
break;
|
|
3522
|
-
case "hsl": {
|
|
3523
|
-
const maxS = COLORSPACE[colorSpace].ranges[1]?.[1] ?? 1;
|
|
3524
|
-
const maxL = COLORSPACE[colorSpace].ranges[2]?.[1] ?? 1;
|
|
3525
|
-
components = [
|
|
3526
|
-
result.h ?? 0,
|
|
3527
|
-
result.s * maxS,
|
|
3528
|
-
result.l * maxL
|
|
3529
|
-
];
|
|
3530
|
-
break;
|
|
3531
|
-
}
|
|
3532
|
-
case "hwb": {
|
|
3533
|
-
const maxW = COLORSPACE[colorSpace].ranges[1]?.[1] ?? 1;
|
|
3534
|
-
const maxB = COLORSPACE[colorSpace].ranges[2]?.[1] ?? 1;
|
|
3535
|
-
components = [
|
|
3536
|
-
result.h ?? 0,
|
|
3537
|
-
result.w * maxW,
|
|
3538
|
-
result.b * maxB
|
|
3539
|
-
];
|
|
3540
|
-
break;
|
|
3541
|
-
}
|
|
3542
|
-
case "lab":
|
|
3543
|
-
case "lab65":
|
|
3544
|
-
case "oklab":
|
|
3545
|
-
components = [
|
|
3546
|
-
result.l,
|
|
3547
|
-
result.a,
|
|
3548
|
-
result.b
|
|
3549
|
-
];
|
|
3550
|
-
break;
|
|
3551
|
-
case "lch":
|
|
3552
|
-
case "oklch":
|
|
3553
|
-
components = [
|
|
3554
|
-
result.l,
|
|
3555
|
-
result.c,
|
|
3556
|
-
result.h ?? 0
|
|
3557
|
-
];
|
|
3558
|
-
break;
|
|
3559
|
-
case "okhsv":
|
|
3560
|
-
components = [
|
|
3561
|
-
result.h ?? 0,
|
|
3562
|
-
result.s,
|
|
3563
|
-
result.v
|
|
3564
|
-
];
|
|
3565
|
-
break;
|
|
3566
|
-
case "xyz50":
|
|
3567
|
-
case "xyz65":
|
|
3568
|
-
components = [
|
|
3569
|
-
result.x,
|
|
3570
|
-
result.y,
|
|
3571
|
-
result.z
|
|
3572
|
-
];
|
|
3573
|
-
break;
|
|
3574
|
-
}
|
|
3575
|
-
const value = {
|
|
3576
|
-
colorSpace,
|
|
3577
|
-
components,
|
|
3578
|
-
alpha: result.alpha ?? 1
|
|
3579
|
-
};
|
|
3580
|
-
if (HEX_RE.test(color)) value.hex = formatHex(result);
|
|
3581
|
-
return value;
|
|
3582
|
-
}
|
|
3583
|
-
/** Convert a color token to a Culori color */
|
|
3584
|
-
function tokenToCulori(value) {
|
|
3585
|
-
switch (value.colorSpace) {
|
|
3586
|
-
case "a98-rgb":
|
|
3587
|
-
case "display-p3":
|
|
3588
|
-
case "prophoto-rgb":
|
|
3589
|
-
case "rec2020":
|
|
3590
|
-
case "srgb":
|
|
3591
|
-
case "srgb-linear": {
|
|
3592
|
-
const [r$1, g, b] = value.components;
|
|
3593
|
-
return {
|
|
3594
|
-
mode: CSS_TO_CULORI[value.colorSpace] || value.colorSpace,
|
|
3595
|
-
r: r$1,
|
|
3596
|
-
g,
|
|
3597
|
-
b,
|
|
3598
|
-
alpha: value.alpha
|
|
3599
|
-
};
|
|
3600
|
-
}
|
|
3601
|
-
case "hsl": {
|
|
3602
|
-
const [h, s, l] = value.components;
|
|
3603
|
-
const maxS = COLORSPACE[value.colorSpace].ranges[1]?.[1] ?? 1;
|
|
3604
|
-
const maxL = COLORSPACE[value.colorSpace].ranges[2]?.[1] ?? 1;
|
|
3605
|
-
return {
|
|
3606
|
-
mode: "hsl",
|
|
3607
|
-
h,
|
|
3608
|
-
s: s / maxS,
|
|
3609
|
-
l: l / maxL,
|
|
3610
|
-
alpha: value.alpha
|
|
3611
|
-
};
|
|
3612
|
-
}
|
|
3613
|
-
case "hwb": {
|
|
3614
|
-
const [h, w, b] = value.components;
|
|
3615
|
-
const maxW = COLORSPACE[value.colorSpace].ranges[1]?.[1] ?? 1;
|
|
3616
|
-
const maxB = COLORSPACE[value.colorSpace].ranges[2]?.[1] ?? 1;
|
|
3617
|
-
return {
|
|
3618
|
-
mode: "hwb",
|
|
3619
|
-
h,
|
|
3620
|
-
w: w / maxW,
|
|
3621
|
-
b: b / maxB,
|
|
3622
|
-
alpha: value.alpha
|
|
3623
|
-
};
|
|
3624
|
-
}
|
|
3625
|
-
case "lab":
|
|
3626
|
-
case "lab-d65":
|
|
3627
|
-
case "oklab": {
|
|
3628
|
-
const [l = 0, a = 0, b = 0] = value.components;
|
|
3629
|
-
return {
|
|
3630
|
-
mode: value.colorSpace === "lab-d65" ? "lab65" : value.colorSpace,
|
|
3631
|
-
l,
|
|
3632
|
-
a,
|
|
3633
|
-
b,
|
|
3634
|
-
alpha: value.alpha
|
|
3635
|
-
};
|
|
3636
|
-
}
|
|
3637
|
-
case "lch":
|
|
3638
|
-
case "oklch": {
|
|
3639
|
-
const [l, c$1, h] = value.components;
|
|
3640
|
-
return {
|
|
3641
|
-
mode: value.colorSpace,
|
|
3642
|
-
l,
|
|
3643
|
-
c: c$1,
|
|
3644
|
-
h,
|
|
3645
|
-
alpha: value.alpha
|
|
3646
|
-
};
|
|
3647
|
-
}
|
|
3648
|
-
case "okhsv": {
|
|
3649
|
-
const [h, s, v] = value.components;
|
|
3650
|
-
return {
|
|
3651
|
-
mode: value.colorSpace,
|
|
3652
|
-
h,
|
|
3653
|
-
s,
|
|
3654
|
-
v,
|
|
3655
|
-
alpha: value.alpha
|
|
3656
|
-
};
|
|
3657
|
-
}
|
|
3658
|
-
case "xyz":
|
|
3659
|
-
case "xyz-d50":
|
|
3660
|
-
case "xyz-d65": {
|
|
3661
|
-
const [x, y, z] = value.components;
|
|
3662
|
-
return {
|
|
3663
|
-
mode: CSS_TO_CULORI[value.colorSpace],
|
|
3664
|
-
x,
|
|
3665
|
-
y,
|
|
3666
|
-
z,
|
|
3667
|
-
alpha: value.alpha
|
|
3668
|
-
};
|
|
3669
|
-
}
|
|
3670
|
-
default: throw new Error(`Invalid colorSpace "${value.colorSpace}". Expected one of ${Object.keys(CSS_TO_CULORI).join(", ")}`);
|
|
3671
|
-
}
|
|
3672
|
-
}
|
|
3673
|
-
/** Complete list of CSS Module 4 Colorspaces */
|
|
3674
|
-
const COLORSPACE = {
|
|
3675
|
-
"a98-rgb": { ranges: [
|
|
3676
|
-
[0, 1],
|
|
3677
|
-
[0, 1],
|
|
3678
|
-
[0, 1]
|
|
3679
|
-
] },
|
|
3680
|
-
"display-p3": { ranges: [
|
|
3681
|
-
[0, 1],
|
|
3682
|
-
[0, 1],
|
|
3683
|
-
[0, 1]
|
|
3684
|
-
] },
|
|
3685
|
-
hsl: { ranges: [
|
|
3686
|
-
[0, 360],
|
|
3687
|
-
[0, 100],
|
|
3688
|
-
[0, 100]
|
|
3689
|
-
] },
|
|
3690
|
-
hwb: { ranges: [
|
|
3691
|
-
[0, 360],
|
|
3692
|
-
[0, 100],
|
|
3693
|
-
[0, 100]
|
|
3694
|
-
] },
|
|
3695
|
-
lab: { ranges: [
|
|
3696
|
-
[0, 100],
|
|
3697
|
-
[-125, 125],
|
|
3698
|
-
[-125, 125]
|
|
3699
|
-
] },
|
|
3700
|
-
"lab-d65": { ranges: [
|
|
3701
|
-
[0, 100],
|
|
3702
|
-
[-125, 125],
|
|
3703
|
-
[-125, 125]
|
|
3704
|
-
] },
|
|
3705
|
-
lch: { ranges: [
|
|
3706
|
-
[0, 100],
|
|
3707
|
-
[0, 150],
|
|
3708
|
-
[0, 360]
|
|
3709
|
-
] },
|
|
3710
|
-
oklab: { ranges: [
|
|
3711
|
-
[0, 1],
|
|
3712
|
-
[-.4, .4],
|
|
3713
|
-
[-.4, .4]
|
|
3714
|
-
] },
|
|
3715
|
-
oklch: { ranges: [
|
|
3716
|
-
[0, 1],
|
|
3717
|
-
[0, .4],
|
|
3718
|
-
[0, 360]
|
|
3719
|
-
] },
|
|
3720
|
-
okhsv: { ranges: [
|
|
3721
|
-
[0, 360],
|
|
3722
|
-
[0, 1],
|
|
3723
|
-
[0, 1]
|
|
3724
|
-
] },
|
|
3725
|
-
"prophoto-rgb": { ranges: [
|
|
3726
|
-
[0, 1],
|
|
3727
|
-
[0, 1],
|
|
3728
|
-
[0, 1]
|
|
3729
|
-
] },
|
|
3730
|
-
rec2020: { ranges: [
|
|
3731
|
-
[0, 1],
|
|
3732
|
-
[0, 1],
|
|
3733
|
-
[0, 1]
|
|
3734
|
-
] },
|
|
3735
|
-
srgb: { ranges: [
|
|
3736
|
-
[0, 1],
|
|
3737
|
-
[0, 1],
|
|
3738
|
-
[0, 1]
|
|
3739
|
-
] },
|
|
3740
|
-
"srgb-linear": { ranges: [
|
|
3741
|
-
[0, 1],
|
|
3742
|
-
[0, 1],
|
|
3743
|
-
[0, 1]
|
|
3744
|
-
] },
|
|
3745
|
-
"xyz-d50": { ranges: [
|
|
3746
|
-
[0, 1],
|
|
3747
|
-
[0, 1],
|
|
3748
|
-
[0, 1]
|
|
3749
|
-
] },
|
|
3750
|
-
xyz: { ranges: [
|
|
3751
|
-
[0, 1],
|
|
3752
|
-
[0, 1],
|
|
3753
|
-
[0, 1]
|
|
3754
|
-
] },
|
|
3755
|
-
"xyz-d65": { ranges: [
|
|
3756
|
-
[0, 1],
|
|
3757
|
-
[0, 1],
|
|
3758
|
-
[0, 1]
|
|
3759
|
-
] }
|
|
3760
|
-
};
|
|
3761
|
-
/** Turn a string into kebab-case */
|
|
3762
|
-
function kebabCase(str) {
|
|
3763
|
-
let output = "";
|
|
3764
|
-
for (const c$1 of str.split("")) {
|
|
3765
|
-
if (c$1 === ".") {
|
|
3766
|
-
output += "-";
|
|
3767
|
-
continue;
|
|
3768
|
-
}
|
|
3769
|
-
let isFirstUppercase = true;
|
|
3770
|
-
if (isFirstUppercase && /\p{Uppercase_Letter}/u.test(c$1)) {
|
|
3771
|
-
output += `-${c$1.toLocaleLowerCase()}`;
|
|
3772
|
-
isFirstUppercase = false;
|
|
3773
|
-
continue;
|
|
3774
|
-
} else isFirstUppercase = true;
|
|
3775
|
-
output += c$1;
|
|
3776
|
-
}
|
|
3777
|
-
return output;
|
|
3778
|
-
}
|
|
3779
|
-
|
|
3780
|
-
//#endregion
|
|
3781
|
-
//#region ../../node_modules/.pnpm/wildcard-match@5.1.4/node_modules/wildcard-match/build/index.es.mjs
|
|
3782
|
-
/**
|
|
3783
|
-
* Escapes a character if it has a special meaning in regular expressions
|
|
3784
|
-
* and returns the character as is if it doesn't
|
|
3785
|
-
*/
|
|
3786
|
-
function escapeRegExpChar(char) {
|
|
3787
|
-
if (char === "-" || char === "^" || char === "$" || char === "+" || char === "." || char === "(" || char === ")" || char === "|" || char === "[" || char === "]" || char === "{" || char === "}" || char === "*" || char === "?" || char === "\\") return "\\".concat(char);
|
|
3788
|
-
else return char;
|
|
3789
|
-
}
|
|
3790
|
-
/**
|
|
3791
|
-
* Escapes all characters in a given string that have a special meaning in regular expressions
|
|
3792
|
-
*/
|
|
3793
|
-
function escapeRegExpString(str) {
|
|
3794
|
-
var result = "";
|
|
3795
|
-
for (var i = 0; i < str.length; i++) result += escapeRegExpChar(str[i]);
|
|
3796
|
-
return result;
|
|
3797
|
-
}
|
|
3798
|
-
/**
|
|
3799
|
-
* Transforms one or more glob patterns into a RegExp pattern
|
|
3800
|
-
*/
|
|
3801
|
-
function transform(pattern, separator) {
|
|
3802
|
-
if (separator === void 0) separator = true;
|
|
3803
|
-
if (Array.isArray(pattern)) {
|
|
3804
|
-
var regExpPatterns = pattern.map(function(p$2) {
|
|
3805
|
-
return "^".concat(transform(p$2, separator), "$");
|
|
3806
|
-
});
|
|
3807
|
-
return "(?:".concat(regExpPatterns.join("|"), ")");
|
|
3808
|
-
}
|
|
3809
|
-
var separatorSplitter = "";
|
|
3810
|
-
var separatorMatcher = "";
|
|
3811
|
-
var wildcard = ".";
|
|
3812
|
-
if (separator === true) {
|
|
3813
|
-
separatorSplitter = "/";
|
|
3814
|
-
separatorMatcher = "[/\\\\]";
|
|
3815
|
-
wildcard = "[^/\\\\]";
|
|
3816
|
-
} else if (separator) {
|
|
3817
|
-
separatorSplitter = separator;
|
|
3818
|
-
separatorMatcher = escapeRegExpString(separatorSplitter);
|
|
3819
|
-
if (separatorMatcher.length > 1) {
|
|
3820
|
-
separatorMatcher = "(?:".concat(separatorMatcher, ")");
|
|
3821
|
-
wildcard = "((?!".concat(separatorMatcher, ").)");
|
|
3822
|
-
} else wildcard = "[^".concat(separatorMatcher, "]");
|
|
3823
|
-
}
|
|
3824
|
-
var requiredSeparator = separator ? "".concat(separatorMatcher, "+?") : "";
|
|
3825
|
-
var optionalSeparator = separator ? "".concat(separatorMatcher, "*?") : "";
|
|
3826
|
-
var segments = separator ? pattern.split(separatorSplitter) : [pattern];
|
|
3827
|
-
var result = "";
|
|
3828
|
-
for (var s = 0; s < segments.length; s++) {
|
|
3829
|
-
var segment = segments[s];
|
|
3830
|
-
var nextSegment = segments[s + 1];
|
|
3831
|
-
var currentSeparator = "";
|
|
3832
|
-
if (!segment && s > 0) continue;
|
|
3833
|
-
if (separator) if (s === segments.length - 1) currentSeparator = optionalSeparator;
|
|
3834
|
-
else if (nextSegment !== "**") currentSeparator = requiredSeparator;
|
|
3835
|
-
else currentSeparator = "";
|
|
3836
|
-
if (separator && segment === "**") {
|
|
3837
|
-
if (currentSeparator) {
|
|
3838
|
-
result += s === 0 ? "" : s === segments.length - 1 ? "(?:".concat(requiredSeparator, "|$)") : requiredSeparator;
|
|
3839
|
-
result += "(?:".concat(wildcard, "*?").concat(currentSeparator, ")*?");
|
|
3840
|
-
}
|
|
3841
|
-
continue;
|
|
3842
|
-
}
|
|
3843
|
-
for (var c$1 = 0; c$1 < segment.length; c$1++) {
|
|
3844
|
-
var char = segment[c$1];
|
|
3845
|
-
if (char === "\\") {
|
|
3846
|
-
if (c$1 < segment.length - 1) {
|
|
3847
|
-
result += escapeRegExpChar(segment[c$1 + 1]);
|
|
3848
|
-
c$1++;
|
|
3849
|
-
}
|
|
3850
|
-
} else if (char === "?") result += wildcard;
|
|
3851
|
-
else if (char === "*") result += "".concat(wildcard, "*?");
|
|
3852
|
-
else result += escapeRegExpChar(char);
|
|
3853
|
-
}
|
|
3854
|
-
result += currentSeparator;
|
|
3855
|
-
}
|
|
3856
|
-
return result;
|
|
3857
|
-
}
|
|
3858
|
-
function isMatch(regexp, sample) {
|
|
3859
|
-
if (typeof sample !== "string") throw new TypeError("Sample must be a string, but ".concat(typeof sample, " given"));
|
|
3860
|
-
return regexp.test(sample);
|
|
3861
|
-
}
|
|
3862
|
-
/**
|
|
3863
|
-
* Compiles one or more glob patterns into a RegExp and returns an isMatch function.
|
|
3864
|
-
* The isMatch function takes a sample string as its only argument and returns `true`
|
|
3865
|
-
* if the string matches the pattern(s).
|
|
3866
|
-
*
|
|
3867
|
-
* ```js
|
|
3868
|
-
* wildcardMatch('src/*.js')('src/index.js') //=> true
|
|
3869
|
-
* ```
|
|
3870
|
-
*
|
|
3871
|
-
* ```js
|
|
3872
|
-
* const isMatch = wildcardMatch('*.example.com', '.')
|
|
3873
|
-
* isMatch('foo.example.com') //=> true
|
|
3874
|
-
* isMatch('foo.bar.com') //=> false
|
|
3875
|
-
* ```
|
|
3876
|
-
*/
|
|
3877
|
-
function wildcardMatch(pattern, options) {
|
|
3878
|
-
if (typeof pattern !== "string" && !Array.isArray(pattern)) throw new TypeError("The first argument must be a single pattern string or an array of patterns, but ".concat(typeof pattern, " given"));
|
|
3879
|
-
if (typeof options === "string" || typeof options === "boolean") options = { separator: options };
|
|
3880
|
-
if (arguments.length === 2 && !(typeof options === "undefined" || typeof options === "object" && options !== null && !Array.isArray(options))) throw new TypeError("The second argument must be an options object or a string/boolean separator, but ".concat(typeof options, " given"));
|
|
3881
|
-
options = options || {};
|
|
3882
|
-
if (options.separator === "\\") throw new Error("\\ is not a valid separator because it is used for escaping. Try setting the separator to `true` instead");
|
|
3883
|
-
var regexpPattern = transform(pattern, options.separator);
|
|
3884
|
-
var regexp = new RegExp("^".concat(regexpPattern, "$"), options.flags);
|
|
3885
|
-
var fn$4 = isMatch.bind(null, regexp);
|
|
3886
|
-
fn$4.options = options;
|
|
3887
|
-
fn$4.pattern = pattern;
|
|
3888
|
-
fn$4.regexp = regexp;
|
|
3889
|
-
return fn$4;
|
|
3890
|
-
}
|
|
3891
|
-
|
|
3892
|
-
//#endregion
|
|
3893
|
-
//#region ../token-tools/dist/index.js
|
|
3894
|
-
/** Give a user pertinent feedback if they override a transform incorrectly */
|
|
3895
|
-
function validateCustomTransform(value, { $type }) {
|
|
3896
|
-
if (value) {
|
|
3897
|
-
if (typeof value !== "string" && typeof value !== "object" || Array.isArray(value)) throw new Error(`transform(): expected string or Object of strings, received ${Array.isArray(value) ? "Array" : typeof value}`);
|
|
3898
|
-
switch ($type) {
|
|
3899
|
-
case "typography":
|
|
3900
|
-
if (typeof value !== "object") throw new Error("transform(): typography tokens must be an object of keys");
|
|
3901
|
-
break;
|
|
3902
|
-
}
|
|
3903
|
-
}
|
|
3904
|
-
}
|
|
3905
|
-
|
|
3906
|
-
//#endregion
|
|
3907
|
-
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/index.js
|
|
3908
|
-
const a98 = useMode(definition_default);
|
|
3909
|
-
const cubehelix = useMode(definition_default$15);
|
|
3910
|
-
const dlab = useMode(definition_default$16);
|
|
3911
|
-
const dlch = useMode(definition_default$17);
|
|
3912
|
-
const hsi = useMode(definition_default$18);
|
|
3913
|
-
const hsl = useMode(definition_default$1);
|
|
3914
|
-
const hsv = useMode(definition_default$19);
|
|
3915
|
-
const hwb = useMode(definition_default$2);
|
|
3916
|
-
const itp = useMode(definition_default$20);
|
|
3917
|
-
const jab = useMode(definition_default$21);
|
|
3918
|
-
const jch = useMode(definition_default$22);
|
|
3919
|
-
const lab = useMode(definition_default$3);
|
|
3920
|
-
const lab65 = useMode(definition_default$4);
|
|
3921
|
-
const lch = useMode(definition_default$5);
|
|
3922
|
-
const lch65 = useMode(definition_default$23);
|
|
3923
|
-
const lchuv = useMode(definition_default$24);
|
|
3924
|
-
const lrgb = useMode(definition_default$6);
|
|
3925
|
-
const luv = useMode(definition_default$25);
|
|
3926
|
-
const okhsl = useMode(modeOkhsl_default);
|
|
3927
|
-
const okhsv = useMode(modeOkhsv_default);
|
|
3928
|
-
const oklab = useMode(definition_default$7);
|
|
3929
|
-
const oklch = useMode(definition_default$8);
|
|
3930
|
-
const p3 = useMode(definition_default$9);
|
|
3931
|
-
const prophoto = useMode(definition_default$10);
|
|
3932
|
-
const rec2020 = useMode(definition_default$11);
|
|
3933
|
-
const rgb = useMode(definition_default$12);
|
|
3934
|
-
const xyb = useMode(definition_default$26);
|
|
3935
|
-
const xyz50 = useMode(definition_default$13);
|
|
3936
|
-
const xyz65 = useMode(definition_default$14);
|
|
3937
|
-
const yiq = useMode(definition_default$27);
|
|
3938
|
-
|
|
3939
|
-
//#endregion
|
|
3940
|
-
//#region ../token-tools/dist/css.js
|
|
3941
|
-
function defaultAliasTransform(token) {
|
|
3942
|
-
if (!token) throw new Error("Undefined token");
|
|
3943
|
-
return `var(${makeCSSVar(token.id)})`;
|
|
3944
|
-
}
|
|
3945
|
-
/** Generate shorthand CSS for select token types */
|
|
3946
|
-
function generateShorthand({ $type, localID }) {
|
|
3947
|
-
switch ($type) {
|
|
3948
|
-
case "transition": return [
|
|
3949
|
-
"duration",
|
|
3950
|
-
"delay",
|
|
3951
|
-
"timing-function"
|
|
3952
|
-
].map((p$2) => makeCSSVar(`${localID}-${p$2}`, { wrapVar: true })).join(" ");
|
|
3953
|
-
}
|
|
3954
|
-
}
|
|
3955
|
-
const CSS_VAR_RE = /(?:(\p{Uppercase_Letter}?[\p{Lowercase_Letter}\p{Number}]+|[\p{Uppercase_Letter}\p{Number}]+|[\u{80}-\u{10FFFF}\p{Number}]+)|.)/u;
|
|
3956
|
-
/**
|
|
3957
|
-
* Generate a valid CSS variable from any string
|
|
3958
|
-
* Code by @dfrankland
|
|
3959
|
-
*/
|
|
3960
|
-
function makeCSSVar(name, { prefix, wrapVar = false } = {}) {
|
|
3961
|
-
if (typeof name !== "string") throw new Error(`makeCSSVar() Expected string, received ${name}`);
|
|
3962
|
-
let property = name.split(CSS_VAR_RE).filter(Boolean).join("-");
|
|
3963
|
-
if (prefix && !property.startsWith(`${prefix}-`)) property = `${prefix}-${property}`;
|
|
3964
|
-
const finalProperty = `--${property}`.toLocaleLowerCase();
|
|
3965
|
-
return wrapVar ? `var(${finalProperty})` : finalProperty;
|
|
3966
|
-
}
|
|
3967
|
-
/** Convert boolean value to CSS string */
|
|
3968
|
-
function transformBoolean(token, { tokensSet, transformAlias = defaultAliasTransform }) {
|
|
3969
|
-
if (token.aliasChain?.[0]) return transformAlias(tokensSet[token.aliasChain[0]]);
|
|
3970
|
-
return token.$value === true ? "1" : "0";
|
|
3971
|
-
}
|
|
3972
|
-
/** Convert color value to CSS string */
|
|
3973
|
-
function transformColor(token, options) {
|
|
3974
|
-
const { transformAlias = defaultAliasTransform, tokensSet } = options;
|
|
3975
|
-
if (token.aliasChain?.[0]) return transformAlias(tokensSet[token.aliasChain[0]]);
|
|
3976
|
-
const { colorSpace, components, alpha = 1 } = typeof token.$value === "string" ? parseColor(token.$value) : token.$value;
|
|
3977
|
-
const color = tokenToCulori({
|
|
3978
|
-
colorSpace,
|
|
3979
|
-
components,
|
|
3980
|
-
alpha
|
|
3981
|
-
});
|
|
3982
|
-
if (!color) throw new Error(`Can’t convert color ${JSON.stringify(token.$value)} to Culori color`);
|
|
3983
|
-
let formatColor = formatCss;
|
|
3984
|
-
if (options.color?.legacyHex) formatColor = color.alpha !== 1 ? formatHex8 : formatHex;
|
|
3985
|
-
return displayable(color) ? formatColor(color) : downsample({
|
|
3986
|
-
colorSpace,
|
|
3987
|
-
components,
|
|
3988
|
-
alpha
|
|
3989
|
-
}, color, options.color?.depth);
|
|
3990
|
-
}
|
|
3991
|
-
const converters = {
|
|
3992
|
-
a98: useMode(definition_default),
|
|
3993
|
-
hsl: useMode(definition_default$1),
|
|
3994
|
-
hwb: useMode(definition_default$2),
|
|
3995
|
-
lab: useMode(definition_default$3),
|
|
3996
|
-
lab65: useMode(definition_default$4),
|
|
3997
|
-
lch: useMode(definition_default$5),
|
|
3998
|
-
lrgb: useMode(definition_default$6),
|
|
3999
|
-
oklab: useMode(definition_default$7),
|
|
4000
|
-
oklch: useMode(definition_default$8),
|
|
4001
|
-
okhsv: useMode(modeOkhsv_default),
|
|
4002
|
-
p3: useMode(definition_default$9),
|
|
4003
|
-
prophoto: useMode(definition_default$10),
|
|
4004
|
-
rec2020: useMode(definition_default$11),
|
|
4005
|
-
rgb: useMode(definition_default$12),
|
|
4006
|
-
xyz50: useMode(definition_default$13),
|
|
4007
|
-
xyz65: useMode(definition_default$14)
|
|
4008
|
-
};
|
|
4009
|
-
const DEPTH_ROUNDING = {
|
|
4010
|
-
24: round_default(4),
|
|
4011
|
-
30: round_default(4),
|
|
4012
|
-
36: round_default(5),
|
|
4013
|
-
48: round_default(6)
|
|
4014
|
-
};
|
|
4015
|
-
/**
|
|
4016
|
-
* Downsample color to sRGB/Display P3/Rec2020 colorspaces.
|
|
4017
|
-
* Note: because Culori tends to convert to RGB color spaces to ensure the operation,
|
|
4018
|
-
* we have to do an additional step of converting back. So we’re not really converting;
|
|
4019
|
-
* we’re just preserving the original colorspace.
|
|
4020
|
-
*/
|
|
4021
|
-
function downsample($value, culoriColor, depth = 30) {
|
|
4022
|
-
if (!($value.colorSpace in CSS_TO_CULORI)) throw new Error(`Invalid colorSpace "${$value.colorSpace}". Expected one of: ${Object.keys(CSS_TO_CULORI).join(", ")}`);
|
|
4023
|
-
const conversionSpace = CSS_TO_CULORI[$value.colorSpace] || "oklab";
|
|
4024
|
-
let gamutSpace = conversionSpace;
|
|
4025
|
-
if (gamutSpace === "lab" || gamutSpace === "lab65") gamutSpace = "lch";
|
|
4026
|
-
else if (gamutSpace === "oklab") gamutSpace = "oklch";
|
|
4027
|
-
let srgb = converters[conversionSpace](toGamut("rgb", gamutSpace)(culoriColor));
|
|
4028
|
-
let p3$2 = converters[conversionSpace](toGamut("p3", gamutSpace)(culoriColor));
|
|
4029
|
-
let rec2020$2 = converters[conversionSpace](toGamut("rec2020", gamutSpace)(culoriColor));
|
|
4030
|
-
if (typeof depth === "number") {
|
|
4031
|
-
if (!DEPTH_ROUNDING[depth]) throw new Error(`Invalid bit depth: ${depth}. Supported values: ${Object.keys(DEPTH_ROUNDING).join(", ")}`);
|
|
4032
|
-
srgb = roundColor(srgb, depth);
|
|
4033
|
-
p3$2 = roundColor(p3$2, depth);
|
|
4034
|
-
rec2020$2 = roundColor(rec2020$2, depth);
|
|
4035
|
-
}
|
|
4036
|
-
return {
|
|
4037
|
-
".": formatCss(culoriColor),
|
|
4038
|
-
srgb: formatCss(srgb),
|
|
4039
|
-
p3: formatCss(p3$2),
|
|
4040
|
-
rec2020: formatCss(rec2020$2)
|
|
4041
|
-
};
|
|
4042
|
-
}
|
|
4043
|
-
/** Round color to certain depth. */
|
|
4044
|
-
function roundColor(color, depth = 30) {
|
|
4045
|
-
if (depth === "unlimited") return color;
|
|
4046
|
-
const newColor = { ...color };
|
|
4047
|
-
for (const [k$3, v] of Object.entries(color)) {
|
|
4048
|
-
if (typeof v !== "number" || k$3 === "mode") continue;
|
|
4049
|
-
newColor[k$3] = DEPTH_ROUNDING[depth](v);
|
|
4050
|
-
}
|
|
4051
|
-
return newColor;
|
|
4052
|
-
}
|
|
4053
|
-
/** Convert dimension value to CSS */
|
|
4054
|
-
function transformDimension(token, options) {
|
|
4055
|
-
const { tokensSet, transformAlias = defaultAliasTransform } = options;
|
|
4056
|
-
if (token.aliasChain?.[0]) return transformAlias(tokensSet[token.aliasChain[0]]);
|
|
4057
|
-
return token.$value.value === 0 ? "0" : `${token.$value.value}${token.$value.unit}`;
|
|
4058
|
-
}
|
|
4059
|
-
/** Convert strokeStyle value to CSS */
|
|
4060
|
-
function transformStrokeStyle(token, options) {
|
|
4061
|
-
const { tokensSet, transformAlias = defaultAliasTransform } = options;
|
|
4062
|
-
if (token.aliasChain?.[0]) return transformAlias(tokensSet[token.aliasChain[0]]);
|
|
4063
|
-
return typeof token.$value === "string" ? token.$value : "dashed";
|
|
4064
|
-
}
|
|
4065
|
-
/** Convert border value to multiple CSS values */
|
|
4066
|
-
function transformBorder(token, options) {
|
|
4067
|
-
const { tokensSet, transformAlias = defaultAliasTransform } = options;
|
|
4068
|
-
if (token.aliasChain?.[0]) return transformAlias(tokensSet[token.aliasChain[0]]);
|
|
4069
|
-
const width = token.partialAliasOf?.width ? transformAlias(tokensSet[token.partialAliasOf.width]) : transformDimension({ $value: token.$value.width }, options);
|
|
4070
|
-
const color = token.partialAliasOf?.color ? transformAlias(tokensSet[token.partialAliasOf.color]) : transformColor({ $value: token.$value.color }, options);
|
|
4071
|
-
const style = token.partialAliasOf?.style ? transformAlias(tokensSet[token.partialAliasOf.style]) : transformStrokeStyle({ $value: token.$value.style }, options);
|
|
4072
|
-
const formatBorder = (colorKey) => [
|
|
4073
|
-
width,
|
|
4074
|
-
style,
|
|
4075
|
-
typeof color === "string" ? color : color[colorKey]
|
|
4076
|
-
].join(" ");
|
|
4077
|
-
return typeof color === "string" || displayable(color.p3) ? formatBorder(".") : {
|
|
4078
|
-
".": formatBorder("."),
|
|
4079
|
-
srgb: formatBorder("srgb"),
|
|
4080
|
-
p3: formatBorder("p3"),
|
|
4081
|
-
rec2020: formatBorder("rec2020")
|
|
4082
|
-
};
|
|
4083
|
-
}
|
|
4084
|
-
/** Convert cubicBezier value to CSS */
|
|
4085
|
-
function transformCubicBezier(token, options) {
|
|
4086
|
-
const { tokensSet, transformAlias = defaultAliasTransform } = options;
|
|
4087
|
-
if (token.aliasChain?.[0]) return transformAlias(tokensSet[token.aliasChain[0]]);
|
|
4088
|
-
return `cubic-bezier(${token.$value.map((v, i) => token.partialAliasOf?.[i] ? transformAlias(tokensSet[token.partialAliasOf[i]]) : v).join(", ")})`;
|
|
4089
|
-
}
|
|
4090
|
-
/** Convert duration value to CSS */
|
|
4091
|
-
function transformDuration(token, options) {
|
|
4092
|
-
const { tokensSet, transformAlias = defaultAliasTransform } = options;
|
|
4093
|
-
if (token.aliasChain?.[0]) return transformAlias(tokensSet[token.aliasChain[0]]);
|
|
4094
|
-
return `${token.$value.value}${token.$value.unit}`;
|
|
4095
|
-
}
|
|
4096
|
-
const FONT_NAME_KEYWORD = /^[a-z-]+$/;
|
|
4097
|
-
function transformFontFamily(token, options) {
|
|
4098
|
-
const { tokensSet, transformAlias = defaultAliasTransform } = options;
|
|
4099
|
-
if (token.aliasChain?.[0]) return transformAlias(tokensSet[token.aliasChain[0]]);
|
|
4100
|
-
return token.$value.map((fontName) => FONT_NAME_KEYWORD.test(fontName) ? fontName : `"${fontName}"`).join(", ");
|
|
4101
|
-
}
|
|
4102
|
-
/** Convert fontWeight value to CSS */
|
|
4103
|
-
function transformFontWeight(token, options) {
|
|
4104
|
-
const { tokensSet, transformAlias = defaultAliasTransform } = options;
|
|
4105
|
-
if (token.aliasChain?.[0]) return transformAlias(tokensSet[token.aliasChain[0]]);
|
|
4106
|
-
return String(token.$value);
|
|
4107
|
-
}
|
|
4108
|
-
/** Convert gradient value to CSS */
|
|
4109
|
-
function transformGradient(token, options) {
|
|
4110
|
-
const { tokensSet, transformAlias = defaultAliasTransform } = options;
|
|
4111
|
-
if (token.aliasChain?.[0]) return transformAlias(tokensSet[token.aliasChain[0]]);
|
|
4112
|
-
let isHDR = false;
|
|
4113
|
-
const colors = [];
|
|
4114
|
-
const positions = [];
|
|
4115
|
-
for (let i = 0; i < token.$value.length; i++) {
|
|
4116
|
-
const { color, position } = token.$value[i];
|
|
4117
|
-
const colorValue = token.partialAliasOf?.[i]?.color ? transformAlias(tokensSet[token.partialAliasOf[i].color]) : transformColor({ $value: color }, options);
|
|
4118
|
-
if (typeof colorValue !== "string") isHDR = true;
|
|
4119
|
-
colors.push(colorValue);
|
|
4120
|
-
positions.push(token.partialAliasOf?.[i]?.position ? transformAlias(tokensSet[token.partialAliasOf[i].position]) : `${100 * position}%`);
|
|
4121
|
-
}
|
|
4122
|
-
function formatStop(i, colorKey = ".") {
|
|
4123
|
-
return `${typeof colors[i] === "string" ? colors[i] : colors[i][colorKey]} ${positions[i]}`;
|
|
4124
|
-
}
|
|
4125
|
-
return !isHDR ? token.$value.map((_, i) => formatStop(i, positions[i])).join(", ") : {
|
|
4126
|
-
".": token.$value.map((_, i) => formatStop(i, ".")).join(", "),
|
|
4127
|
-
srgb: token.$value.map((_, i) => formatStop(i, "srgb")).join(", "),
|
|
4128
|
-
p3: token.$value.map((_, i) => formatStop(i, "p3")).join(", "),
|
|
4129
|
-
rec2020: token.$value.map((_, i) => formatStop(i, "rec2020")).join(", ")
|
|
4130
|
-
};
|
|
4131
|
-
}
|
|
4132
|
-
/** Convert link value to CSS */
|
|
4133
|
-
function transformLink(token, options) {
|
|
4134
|
-
const { tokensSet, transformAlias = defaultAliasTransform } = options;
|
|
4135
|
-
if (token.aliasChain?.[0]) return transformAlias(tokensSet[token.aliasChain[0]]);
|
|
4136
|
-
return `url("${token.$value}")`;
|
|
4137
|
-
}
|
|
4138
|
-
/** Convert number value to CSS */
|
|
4139
|
-
function transformNumber(token, options) {
|
|
4140
|
-
const { tokensSet, transformAlias = defaultAliasTransform } = options;
|
|
4141
|
-
if (token.aliasChain?.[0]) return transformAlias(tokensSet[token.aliasChain[0]]);
|
|
4142
|
-
return String(token.$value);
|
|
4143
|
-
}
|
|
4144
|
-
/** Convert shadow subvalue to CSS */
|
|
4145
|
-
function transformShadowLayer(value, options) {
|
|
4146
|
-
const { tokensSet, colorValue, partialAliasOf, transformAlias = defaultAliasTransform } = options;
|
|
4147
|
-
const offsetX = partialAliasOf?.offsetX ? transformAlias(tokensSet[partialAliasOf.offsetX]) : transformDimension({ $value: value.offsetX }, options);
|
|
4148
|
-
const offsetY = partialAliasOf?.offsetY ? transformAlias(tokensSet[partialAliasOf.offsetY]) : transformDimension({ $value: value.offsetY }, options);
|
|
4149
|
-
const blur = partialAliasOf?.blur ? transformAlias(tokensSet[partialAliasOf.blur]) : transformDimension({ $value: value.blur }, options);
|
|
4150
|
-
const spread = partialAliasOf?.spread ? transformAlias(tokensSet[partialAliasOf.spread]) : transformDimension({ $value: value.spread }, options);
|
|
4151
|
-
return [
|
|
4152
|
-
value?.inset === true ? "inset" : void 0,
|
|
4153
|
-
offsetX,
|
|
4154
|
-
offsetY,
|
|
4155
|
-
blur,
|
|
4156
|
-
spread,
|
|
4157
|
-
colorValue
|
|
4158
|
-
].filter(Boolean).join(" ");
|
|
4159
|
-
}
|
|
4160
|
-
/** Convert shadow value to CSS */
|
|
4161
|
-
function transformShadow(token, options) {
|
|
4162
|
-
const { tokensSet, transformAlias = defaultAliasTransform } = options;
|
|
4163
|
-
if (token.aliasChain?.[0]) return transformAlias(tokensSet[token.aliasChain[0]]);
|
|
4164
|
-
const colors = token.$value.map((v, i) => token.partialAliasOf?.[i]?.color ? transformAlias(tokensSet[token.partialAliasOf[i].color]) : transformColor({ $value: v.color }, options));
|
|
4165
|
-
const isHDR = colors.some((c$1) => typeof c$1 === "object");
|
|
4166
|
-
const formatShadow = (colorKey) => token.$value.map((v, i) => transformShadowLayer(v, {
|
|
4167
|
-
tokensSet,
|
|
4168
|
-
colorValue: typeof colors[i] === "string" ? colors[i] : colors[i][colorKey],
|
|
4169
|
-
partialAliasOf: token.partialAliasOf?.[i],
|
|
4170
|
-
transformAlias
|
|
4171
|
-
})).join(", ");
|
|
4172
|
-
return !isHDR ? formatShadow(".") : {
|
|
4173
|
-
".": formatShadow("."),
|
|
4174
|
-
srgb: formatShadow("srgb"),
|
|
4175
|
-
p3: formatShadow("p3"),
|
|
4176
|
-
rec2020: formatShadow("rec2020")
|
|
4177
|
-
};
|
|
4178
|
-
}
|
|
4179
|
-
/** Convert string value to CSS */
|
|
4180
|
-
function transformString(token, options) {
|
|
4181
|
-
const { tokensSet, transformAlias = defaultAliasTransform } = options;
|
|
4182
|
-
if (token.aliasChain?.[0]) return transformAlias(tokensSet[token.aliasChain[0]]);
|
|
4183
|
-
return String(token.$value);
|
|
4184
|
-
}
|
|
4185
|
-
/** Convert transition value to shorthand */
|
|
4186
|
-
function transformTransition(token, options) {
|
|
4187
|
-
const { tokensSet, transformAlias = defaultAliasTransform } = options;
|
|
4188
|
-
if (token.aliasChain?.[0]) return transformAlias(tokensSet[token.aliasChain[0]]);
|
|
4189
|
-
const duration = token.partialAliasOf?.duration ? transformAlias(tokensSet[token.partialAliasOf.duration]) : transformDuration({ $value: token.$value.duration }, options);
|
|
4190
|
-
const delay = token.partialAliasOf?.delay ? transformAlias(tokensSet[token.partialAliasOf.delay]) : transformDuration({ $value: token.$value.delay }, options);
|
|
4191
|
-
const timingFunction = token.partialAliasOf?.timingFunction ? transformAlias(tokensSet[token.partialAliasOf.timingFunction]) : transformCubicBezier({ $value: token.$value.timingFunction }, options);
|
|
4192
|
-
return `${duration} ${delay} ${timingFunction}`;
|
|
4193
|
-
}
|
|
4194
|
-
/** Convert typography value to multiple CSS values */
|
|
4195
|
-
function transformTypography(token, options) {
|
|
4196
|
-
const { tokensSet, transformAlias = defaultAliasTransform } = options;
|
|
4197
|
-
const output = {};
|
|
4198
|
-
for (const [property, subvalue] of Object.entries(token.$value)) {
|
|
4199
|
-
let transformedValue;
|
|
4200
|
-
const aliasedID = token.aliasChain?.[0] ?? token.partialAliasOf?.[property];
|
|
4201
|
-
if (aliasedID) {
|
|
4202
|
-
const resolvedToken = tokensSet[aliasedID];
|
|
4203
|
-
transformedValue = transformAlias(resolvedToken.$type === "typography" ? { id: `${aliasedID}-${property}` } : resolvedToken);
|
|
4204
|
-
} else switch (property) {
|
|
4205
|
-
case "fontFamily":
|
|
4206
|
-
transformedValue = transformFontFamily({ $value: subvalue }, options);
|
|
4207
|
-
break;
|
|
4208
|
-
case "fontSize":
|
|
4209
|
-
case "letterSpacing":
|
|
4210
|
-
transformedValue = transformDimension({ $value: subvalue }, options);
|
|
4211
|
-
break;
|
|
4212
|
-
case "fontWeight":
|
|
4213
|
-
transformedValue = transformFontWeight({ $value: subvalue }, options);
|
|
4214
|
-
break;
|
|
4215
|
-
case "lineHeight":
|
|
4216
|
-
if (typeof subvalue === "number") transformedValue = transformNumber({ $value: subvalue }, options);
|
|
4217
|
-
else transformedValue = transformDimension({ $value: subvalue }, options);
|
|
4218
|
-
break;
|
|
4219
|
-
default:
|
|
4220
|
-
transformedValue = transformString({ $value: subvalue }, options);
|
|
4221
|
-
break;
|
|
4222
|
-
}
|
|
4223
|
-
output[kebabCase(property)] = transformedValue;
|
|
4224
|
-
}
|
|
4225
|
-
return output;
|
|
4226
|
-
}
|
|
4227
|
-
/** Main CSS Transform */
|
|
4228
|
-
function transformCSSValue(token, { mode,...options }) {
|
|
4229
|
-
const selectedMode = token.mode[mode];
|
|
4230
|
-
if (!selectedMode) return;
|
|
4231
|
-
const tokenWithModeValue = {
|
|
4232
|
-
id: token.id,
|
|
4233
|
-
$type: token.$type,
|
|
4234
|
-
...selectedMode
|
|
4235
|
-
};
|
|
4236
|
-
switch (tokenWithModeValue.$type) {
|
|
4237
|
-
case "boolean": return transformBoolean(tokenWithModeValue, options);
|
|
4238
|
-
case "border": return transformBorder(tokenWithModeValue, options);
|
|
4239
|
-
case "color": return transformColor(tokenWithModeValue, options);
|
|
4240
|
-
case "cubicBezier": return transformCubicBezier(tokenWithModeValue, options);
|
|
4241
|
-
case "dimension": return transformDimension(tokenWithModeValue, options);
|
|
4242
|
-
case "duration": return transformDuration(tokenWithModeValue, options);
|
|
4243
|
-
case "fontFamily": return transformFontFamily(tokenWithModeValue, options);
|
|
4244
|
-
case "fontWeight": return transformFontWeight(tokenWithModeValue, options);
|
|
4245
|
-
case "gradient": return transformGradient(tokenWithModeValue, options);
|
|
4246
|
-
case "link": return transformLink(tokenWithModeValue, options);
|
|
4247
|
-
case "number": return transformNumber(tokenWithModeValue, options);
|
|
4248
|
-
case "shadow": return transformShadow(tokenWithModeValue, options);
|
|
4249
|
-
case "string": return transformString(tokenWithModeValue, options);
|
|
4250
|
-
case "strokeStyle": return transformStrokeStyle(tokenWithModeValue, options);
|
|
4251
|
-
case "transition": return transformTransition(tokenWithModeValue, options);
|
|
4252
|
-
case "typography": return transformTypography(tokenWithModeValue, options);
|
|
4253
|
-
}
|
|
4254
|
-
}
|
|
4255
|
-
|
|
4256
|
-
//#endregion
|
|
4257
5
|
//#region src/lib.ts
|
|
4258
6
|
const FORMAT_ID = "css";
|
|
4259
7
|
const FILE_PREFIX = `/* -------------------------------------------
|
|
@@ -4296,9 +44,7 @@ function _printRule(rule) {
|
|
|
4296
44
|
output.push(`${indent}:root {`);
|
|
4297
45
|
indent += " ";
|
|
4298
46
|
}
|
|
4299
|
-
const
|
|
4300
|
-
declarations.sort((a, b) => a[0].localeCompare(b[0], "en-us", { numeric: true }));
|
|
4301
|
-
for (const [k$3, d] of declarations) output.push(`${indent}${k$3}: ${d.value};${d.description ? ` /* ${d.description} */` : ""}`);
|
|
47
|
+
for (const [k, d] of Object.entries(rule.declarations)) output.push(`${indent}${k}: ${d.value};${d.description ? ` /* ${d.description} */` : ""}`);
|
|
4302
48
|
while (indent !== "") {
|
|
4303
49
|
indent = indent.substring(0, indent.length - 2);
|
|
4304
50
|
output.push(`${indent}}`);
|
|
@@ -4330,7 +76,7 @@ function generateUtilityCSS(groups, tokens) {
|
|
|
4330
76
|
const groupEntries = Object.entries(groups);
|
|
4331
77
|
groupEntries.sort((a, b) => a[0].localeCompare(b[0]));
|
|
4332
78
|
for (const [group, selectors] of groupEntries) {
|
|
4333
|
-
const selectorMatcher =
|
|
79
|
+
const selectorMatcher = wcmatch(selectors);
|
|
4334
80
|
const matchingTokens = tokens.filter((token) => selectorMatcher(token.token.id));
|
|
4335
81
|
if (!matchingTokens.length) {
|
|
4336
82
|
console.warn(`[@terrazzo/plugin-css] utility group "${group}" matched 0 tokens: ${JSON.stringify(selectors)}`);
|
|
@@ -4390,7 +136,7 @@ function generateUtilityCSS(groups, tokens) {
|
|
|
4390
136
|
const selector = makeSelector(token, "font");
|
|
4391
137
|
if (token.token.$type === "typography" && token.type === "MULTI_VALUE") {
|
|
4392
138
|
const declarations = {};
|
|
4393
|
-
for (const k
|
|
139
|
+
for (const k of Object.keys(token.value)) declarations[k] = { value: makeCSSVar(`${token.localID ?? token.token.id}-${k}`, { wrapVar: true }) };
|
|
4394
140
|
output.push({
|
|
4395
141
|
selectors: [selector],
|
|
4396
142
|
declarations
|
|
@@ -4519,6 +265,7 @@ function buildFormat({ getTransforms, exclude, utility, modeSelectors, baseSelec
|
|
|
4519
265
|
selectors: [baseSelector],
|
|
4520
266
|
declarations: {}
|
|
4521
267
|
};
|
|
268
|
+
if (baseScheme) rootRule.declarations["color-scheme"] = { value: baseScheme };
|
|
4522
269
|
const p3Rule = {
|
|
4523
270
|
selectors: [baseSelector],
|
|
4524
271
|
nestedQuery: P3_MQ,
|
|
@@ -4530,8 +277,7 @@ function buildFormat({ getTransforms, exclude, utility, modeSelectors, baseSelec
|
|
|
4530
277
|
declarations: {}
|
|
4531
278
|
};
|
|
4532
279
|
rules.push(rootRule, p3Rule, rec2020Rule);
|
|
4533
|
-
const shouldExclude =
|
|
4534
|
-
if (baseScheme) rootRule.declarations["color-scheme"] = { value: baseScheme };
|
|
280
|
+
const shouldExclude = wcmatch(exclude ?? []);
|
|
4535
281
|
for (const token of rootTokens) {
|
|
4536
282
|
if (shouldExclude(token.token.id)) continue;
|
|
4537
283
|
const localID = token.localID ?? token.token.id;
|
|
@@ -4569,18 +315,21 @@ function buildFormat({ getTransforms, exclude, utility, modeSelectors, baseSelec
|
|
|
4569
315
|
}
|
|
4570
316
|
}
|
|
4571
317
|
} else if (token.type === "MULTI_VALUE") {
|
|
318
|
+
for (const [name, value] of Object.entries(token.value)) rootRule.declarations[name === "." ? localID : [localID, name].join("-")] = {
|
|
319
|
+
value,
|
|
320
|
+
description: token.token.$description
|
|
321
|
+
};
|
|
4572
322
|
const shorthand = generateShorthand({
|
|
4573
|
-
|
|
323
|
+
token: {
|
|
324
|
+
...token.token,
|
|
325
|
+
$value: token.value
|
|
326
|
+
},
|
|
4574
327
|
localID
|
|
4575
328
|
});
|
|
4576
329
|
if (shorthand) rootRule.declarations[token.localID ?? token.token.id] = {
|
|
4577
330
|
value: shorthand,
|
|
4578
331
|
description: token.token.$description
|
|
4579
332
|
};
|
|
4580
|
-
for (const [name, value] of Object.entries(token.value)) rootRule.declarations[name === "." ? localID : [localID, name].join("-")] = {
|
|
4581
|
-
value,
|
|
4582
|
-
description: token.token.$description
|
|
4583
|
-
};
|
|
4584
333
|
}
|
|
4585
334
|
}
|
|
4586
335
|
}
|
|
@@ -4596,6 +345,7 @@ function buildFormat({ getTransforms, exclude, utility, modeSelectors, baseSelec
|
|
|
4596
345
|
selectors,
|
|
4597
346
|
declarations: {}
|
|
4598
347
|
};
|
|
348
|
+
if (scheme) selectorRule.declarations["color-scheme"] = { value: scheme };
|
|
4599
349
|
const selectorP3Rule = {
|
|
4600
350
|
selectors,
|
|
4601
351
|
nestedQuery: P3_MQ,
|
|
@@ -4608,7 +358,6 @@ function buildFormat({ getTransforms, exclude, utility, modeSelectors, baseSelec
|
|
|
4608
358
|
};
|
|
4609
359
|
const selectorAliasDeclarations = {};
|
|
4610
360
|
rules.push(selectorRule, selectorP3Rule, selectorRec2020Rule);
|
|
4611
|
-
if (scheme) selectorRule.declarations["color-scheme"] = { value: scheme };
|
|
4612
361
|
for (const token of selectorTokens) {
|
|
4613
362
|
const localID = token.localID ?? token.token.id;
|
|
4614
363
|
const aliasTokens = token.token.aliasedBy?.length ? getTransforms({
|
|
@@ -4645,18 +394,21 @@ function buildFormat({ getTransforms, exclude, utility, modeSelectors, baseSelec
|
|
|
4645
394
|
}
|
|
4646
395
|
}
|
|
4647
396
|
} else {
|
|
397
|
+
for (const [name, subvalue] of Object.entries(token.value)) selectorRule.declarations[`${localID}-${name}`] = {
|
|
398
|
+
value: subvalue,
|
|
399
|
+
description: token.token.$description
|
|
400
|
+
};
|
|
4648
401
|
const shorthand = generateShorthand({
|
|
4649
|
-
|
|
402
|
+
token: {
|
|
403
|
+
...token.token,
|
|
404
|
+
$value: token.value
|
|
405
|
+
},
|
|
4650
406
|
localID
|
|
4651
407
|
});
|
|
4652
408
|
if (shorthand) selectorRule.declarations[localID] = {
|
|
4653
409
|
value: shorthand,
|
|
4654
410
|
description: token.token.$description
|
|
4655
411
|
};
|
|
4656
|
-
for (const [name, subvalue] of Object.entries(token.value)) selectorRule.declarations[`${localID}-${name}`] = {
|
|
4657
|
-
value: subvalue,
|
|
4658
|
-
description: token.token.$description
|
|
4659
|
-
};
|
|
4660
412
|
}
|
|
4661
413
|
for (const alias of aliasTokens) if (alias.localID && typeof alias.value === "string") selectorAliasDeclarations[alias.localID] = {
|
|
4662
414
|
value: alias.value,
|
|
@@ -4724,7 +476,7 @@ function cssPlugin(options) {
|
|
|
4724
476
|
if (transformedValue !== void 0) {
|
|
4725
477
|
let listingName = localID;
|
|
4726
478
|
if (typeof transformedValue === "object" && generateShorthand({
|
|
4727
|
-
|
|
479
|
+
token,
|
|
4728
480
|
localID
|
|
4729
481
|
}) === void 0) listingName = void 0;
|
|
4730
482
|
setTransform(id, {
|