@takazudo/zdtp 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +36 -0
- package/dist/apply/build-apply-overrides.d.ts +2 -0
- package/dist/astro/host-adapter.js +3 -3
- package/dist/astro/index.js +1 -1
- package/dist/{autoload-state-CGnis85c.js → autoload-state-CtB0e8mY.js} +1 -1
- package/dist/config/cluster-config.d.ts +10 -2
- package/dist/dashboard/index.d.ts +2 -1
- package/dist/dashboard/index.js +314 -266
- package/dist/dashboard/model.d.ts +3 -1
- package/dist/dashboard/styles.css +107 -32
- package/dist/dashboard/token-dashboard.d.ts +8 -5
- package/dist/dashboard/types.d.ts +19 -3
- package/dist/import-modal.d.ts +21 -22
- package/dist/{index-BcqHRoxf.js → index-BH_IJp9W.js} +2 -2
- package/dist/index-blRjSavc.js +12890 -0
- package/dist/index.d.ts +5 -3
- package/dist/index.js +39 -32
- package/dist/mode-dependence-Ci9avNt8.js +61 -0
- package/dist/{panel-config-Crn5QJGy.js → panel-config-DKfob-1r.js} +314 -301
- package/dist/state/tweak-state.d.ts +17 -7
- package/dist/tabs/modes-row.d.ts +39 -0
- package/dist/testing.js +2 -2
- package/dist/tokens/mode-dependence.d.ts +23 -0
- package/dist/tokens/tier-model.d.ts +9 -0
- package/dist/{tweak-state-Dhjqig0C.js → tweak-state-BiaKbhXN.js} +729 -671
- package/dist/utils/design-token-serde.d.ts +32 -2
- package/dist/zdtp.css +1 -1
- package/package.json +1 -1
- package/dist/index-CUWkR-Gb.js +0 -12322
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { r as
|
|
2
|
-
|
|
1
|
+
import { r as wt, g, k as ge, l as me, n as ne, o as $t, p as Nt, h as Ct, d as Tt, q as R, t as re, u as It, e as Pt, v as Ot, w as At, x as _t, y as J, f as Dt, z as Et, A as Ht } from "./panel-config-DKfob-1r.js";
|
|
2
|
+
import { s as F } from "./mode-dependence-Ci9avNt8.js";
|
|
3
|
+
const Ge = (e, t) => {
|
|
3
4
|
if (typeof e == "number") {
|
|
4
5
|
if (t === 3)
|
|
5
6
|
return {
|
|
@@ -32,7 +33,7 @@ const Le = (e, t) => {
|
|
|
32
33
|
alpha: (e & 255) / 255
|
|
33
34
|
};
|
|
34
35
|
}
|
|
35
|
-
},
|
|
36
|
+
}, Vt = {
|
|
36
37
|
aliceblue: 15792383,
|
|
37
38
|
antiquewhite: 16444375,
|
|
38
39
|
aqua: 65535,
|
|
@@ -183,23 +184,23 @@ const Le = (e, t) => {
|
|
|
183
184
|
whitesmoke: 16119285,
|
|
184
185
|
yellow: 16776960,
|
|
185
186
|
yellowgreen: 10145074
|
|
186
|
-
},
|
|
187
|
+
}, Ft = (e) => Ge(Vt[e.toLowerCase()], 6), zt = /^#?([0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{4}|[0-9a-f]{3})$/i, Rt = (e) => {
|
|
187
188
|
let t;
|
|
188
|
-
return (t = e.match(
|
|
189
|
-
},
|
|
190
|
-
`^rgba?\\(\\s*${
|
|
191
|
-
),
|
|
192
|
-
`^rgba?\\(\\s*${E}${
|
|
193
|
-
),
|
|
189
|
+
return (t = e.match(zt)) ? Ge(parseInt(t[1], 16), t[1].length) : void 0;
|
|
190
|
+
}, $ = "([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)", E = `${$}%`, Te = `(?:${$}%|${$})`, Lt = `(?:${$}(deg|grad|rad|turn)|${$})`, O = "\\s*,\\s*", jt = new RegExp(
|
|
191
|
+
`^rgba?\\(\\s*${$}${O}${$}${O}${$}\\s*(?:,\\s*${Te}\\s*)?\\)$`
|
|
192
|
+
), Kt = new RegExp(
|
|
193
|
+
`^rgba?\\(\\s*${E}${O}${E}${O}${E}\\s*(?:,\\s*${Te}\\s*)?\\)$`
|
|
194
|
+
), Bt = (e) => {
|
|
194
195
|
let t = { mode: "rgb" }, n;
|
|
195
|
-
if (n = e.match(
|
|
196
|
+
if (n = e.match(jt))
|
|
196
197
|
n[1] !== void 0 && (t.r = n[1] / 255), n[2] !== void 0 && (t.g = n[2] / 255), n[3] !== void 0 && (t.b = n[3] / 255);
|
|
197
|
-
else if (n = e.match(
|
|
198
|
+
else if (n = e.match(Kt))
|
|
198
199
|
n[1] !== void 0 && (t.r = n[1] / 100), n[2] !== void 0 && (t.g = n[2] / 100), n[3] !== void 0 && (t.b = n[3] / 100);
|
|
199
200
|
else
|
|
200
201
|
return;
|
|
201
202
|
return n[4] !== void 0 ? t.alpha = Math.max(0, Math.min(1, n[4] / 100)) : n[5] !== void 0 && (t.alpha = Math.max(0, Math.min(1, +n[5]))), t;
|
|
202
|
-
},
|
|
203
|
+
}, W = (e, t) => e === void 0 ? void 0 : typeof e != "object" ? Pe(e) : e.mode !== void 0 ? e : t ? { ...e, mode: t } : void 0, k = (e = "rgb") => (t) => (t = W(t, e)) !== void 0 ? (
|
|
203
204
|
// if the color's mode corresponds to our target mode
|
|
204
205
|
t.mode === e ? (
|
|
205
206
|
// then just return the color
|
|
@@ -207,41 +208,41 @@ const Le = (e, t) => {
|
|
|
207
208
|
) : (
|
|
208
209
|
// otherwise check to see if we have a dedicated
|
|
209
210
|
// converter for the target mode
|
|
210
|
-
|
|
211
|
+
v[t.mode][e] ? (
|
|
211
212
|
// and return its result...
|
|
212
|
-
|
|
213
|
+
v[t.mode][e](t)
|
|
213
214
|
) : (
|
|
214
215
|
// ...otherwise pass through RGB as an intermediary step.
|
|
215
216
|
// if the target mode is RGB...
|
|
216
217
|
e === "rgb" ? (
|
|
217
218
|
// just return the RGB
|
|
218
|
-
|
|
219
|
+
v[t.mode].rgb(t)
|
|
219
220
|
) : (
|
|
220
221
|
// otherwise convert color.mode -> RGB -> target_mode
|
|
221
|
-
|
|
222
|
+
v.rgb[e](v[t.mode].rgb(t))
|
|
222
223
|
)
|
|
223
224
|
)
|
|
224
225
|
)
|
|
225
|
-
) : void 0,
|
|
226
|
-
...
|
|
226
|
+
) : void 0, v = {}, qe = {}, X = [], Je = {}, Gt = (e) => e, Ie = (e) => (v[e.mode] = {
|
|
227
|
+
...v[e.mode],
|
|
227
228
|
...e.toMode
|
|
228
229
|
}, Object.keys(e.fromMode || {}).forEach((t) => {
|
|
229
|
-
|
|
230
|
+
v[t] || (v[t] = {}), v[t][e.mode] = e.fromMode[t];
|
|
230
231
|
}), e.ranges || (e.ranges = {}), e.difference || (e.difference = {}), e.channels.forEach((t) => {
|
|
231
232
|
if (e.ranges[t] === void 0 && (e.ranges[t] = [0, 1]), !e.interpolate[t])
|
|
232
233
|
throw new Error(`Missing interpolator for: ${t}`);
|
|
233
234
|
typeof e.interpolate[t] == "function" && (e.interpolate[t] = {
|
|
234
235
|
use: e.interpolate[t]
|
|
235
|
-
}), e.interpolate[t].fixup || (e.interpolate[t].fixup =
|
|
236
|
-
}),
|
|
237
|
-
|
|
238
|
-
}),
|
|
236
|
+
}), e.interpolate[t].fixup || (e.interpolate[t].fixup = Gt);
|
|
237
|
+
}), qe[e.mode] = e, (e.parse || []).forEach((t) => {
|
|
238
|
+
qt(t, e.mode);
|
|
239
|
+
}), k(e.mode)), oe = (e) => qe[e], qt = (e, t) => {
|
|
239
240
|
if (typeof e == "string") {
|
|
240
241
|
if (!t)
|
|
241
242
|
throw new Error("'mode' required when 'parser' is a string");
|
|
242
|
-
|
|
243
|
-
} else typeof e == "function" &&
|
|
244
|
-
},
|
|
243
|
+
Je[e] = t;
|
|
244
|
+
} else typeof e == "function" && X.indexOf(e) < 0 && X.push(e);
|
|
245
|
+
}, ye = /[^\x00-\x7F]|[a-zA-Z_]/, Jt = /[^\x00-\x7F]|[-\w]/, l = {
|
|
245
246
|
Function: "function",
|
|
246
247
|
Ident: "ident",
|
|
247
248
|
Number: "number",
|
|
@@ -251,63 +252,63 @@ const Le = (e, t) => {
|
|
|
251
252
|
Hue: "hue",
|
|
252
253
|
Alpha: "alpha"
|
|
253
254
|
};
|
|
254
|
-
let
|
|
255
|
-
function
|
|
256
|
-
let t = e[
|
|
257
|
-
return t === "-" || t === "+" ? /\d/.test(n) || n === "." && /\d/.test(e[
|
|
255
|
+
let d = 0;
|
|
256
|
+
function j(e) {
|
|
257
|
+
let t = e[d], n = e[d + 1];
|
|
258
|
+
return t === "-" || t === "+" ? /\d/.test(n) || n === "." && /\d/.test(e[d + 2]) : t === "." ? /\d/.test(n) : /\d/.test(t);
|
|
258
259
|
}
|
|
259
|
-
function
|
|
260
|
-
if (
|
|
260
|
+
function be(e) {
|
|
261
|
+
if (d >= e.length)
|
|
261
262
|
return !1;
|
|
262
|
-
let t = e[
|
|
263
|
-
if (
|
|
263
|
+
let t = e[d];
|
|
264
|
+
if (ye.test(t))
|
|
264
265
|
return !0;
|
|
265
266
|
if (t === "-") {
|
|
266
|
-
if (e.length -
|
|
267
|
+
if (e.length - d < 2)
|
|
267
268
|
return !1;
|
|
268
|
-
let n = e[
|
|
269
|
-
return !!(n === "-" ||
|
|
269
|
+
let n = e[d + 1];
|
|
270
|
+
return !!(n === "-" || ye.test(n));
|
|
270
271
|
}
|
|
271
272
|
return !1;
|
|
272
273
|
}
|
|
273
|
-
const
|
|
274
|
+
const Wt = {
|
|
274
275
|
deg: 1,
|
|
275
276
|
rad: 180 / Math.PI,
|
|
276
277
|
grad: 9 / 10,
|
|
277
278
|
turn: 360
|
|
278
279
|
};
|
|
279
|
-
function
|
|
280
|
+
function D(e) {
|
|
280
281
|
let t = "";
|
|
281
|
-
if ((e[
|
|
282
|
-
let n =
|
|
283
|
-
return n === "deg" || n === "rad" || n === "turn" || n === "grad" ? { type: l.Hue, value: t *
|
|
282
|
+
if ((e[d] === "-" || e[d] === "+") && (t += e[d++]), t += K(e), e[d] === "." && /\d/.test(e[d + 1]) && (t += e[d++] + K(e)), (e[d] === "e" || e[d] === "E") && ((e[d + 1] === "-" || e[d + 1] === "+") && /\d/.test(e[d + 2]) ? t += e[d++] + e[d++] + K(e) : /\d/.test(e[d + 1]) && (t += e[d++] + K(e))), be(e)) {
|
|
283
|
+
let n = Y(e);
|
|
284
|
+
return n === "deg" || n === "rad" || n === "turn" || n === "grad" ? { type: l.Hue, value: t * Wt[n] } : void 0;
|
|
284
285
|
}
|
|
285
|
-
return e[
|
|
286
|
+
return e[d] === "%" ? (d++, { type: l.Percentage, value: +t }) : { type: l.Number, value: +t };
|
|
286
287
|
}
|
|
287
|
-
function
|
|
288
|
+
function K(e) {
|
|
288
289
|
let t = "";
|
|
289
|
-
for (; /\d/.test(e[
|
|
290
|
-
t += e[
|
|
290
|
+
for (; /\d/.test(e[d]); )
|
|
291
|
+
t += e[d++];
|
|
291
292
|
return t;
|
|
292
293
|
}
|
|
293
|
-
function
|
|
294
|
+
function Y(e) {
|
|
294
295
|
let t = "";
|
|
295
|
-
for (;
|
|
296
|
-
t += e[
|
|
296
|
+
for (; d < e.length && Jt.test(e[d]); )
|
|
297
|
+
t += e[d++];
|
|
297
298
|
return t;
|
|
298
299
|
}
|
|
299
|
-
function
|
|
300
|
-
let t =
|
|
301
|
-
return e[
|
|
300
|
+
function Xt(e) {
|
|
301
|
+
let t = Y(e);
|
|
302
|
+
return e[d] === "(" ? (d++, { type: l.Function, value: t }) : t === "none" ? { type: l.None, value: void 0 } : { type: l.Ident, value: t };
|
|
302
303
|
}
|
|
303
|
-
function
|
|
304
|
+
function Yt(e = "") {
|
|
304
305
|
let t = e.trim(), n = [], r;
|
|
305
|
-
for (
|
|
306
|
-
if (r = t[
|
|
306
|
+
for (d = 0; d < t.length; ) {
|
|
307
|
+
if (r = t[d++], r === `
|
|
307
308
|
` || r === " " || r === " ") {
|
|
308
|
-
for (;
|
|
309
|
-
` || t[
|
|
310
|
-
|
|
309
|
+
for (; d < t.length && (t[d] === `
|
|
310
|
+
` || t[d] === " " || t[d] === " "); )
|
|
311
|
+
d++;
|
|
311
312
|
continue;
|
|
312
313
|
}
|
|
313
314
|
if (r === ",")
|
|
@@ -317,40 +318,40 @@ function Gt(e = "") {
|
|
|
317
318
|
continue;
|
|
318
319
|
}
|
|
319
320
|
if (r === "+") {
|
|
320
|
-
if (
|
|
321
|
-
n.push(
|
|
321
|
+
if (d--, j(t)) {
|
|
322
|
+
n.push(D(t));
|
|
322
323
|
continue;
|
|
323
324
|
}
|
|
324
325
|
return;
|
|
325
326
|
}
|
|
326
327
|
if (r === "-") {
|
|
327
|
-
if (
|
|
328
|
-
n.push(
|
|
328
|
+
if (d--, j(t)) {
|
|
329
|
+
n.push(D(t));
|
|
329
330
|
continue;
|
|
330
331
|
}
|
|
331
|
-
if (
|
|
332
|
-
n.push({ type: l.Ident, value:
|
|
332
|
+
if (be(t)) {
|
|
333
|
+
n.push({ type: l.Ident, value: Y(t) });
|
|
333
334
|
continue;
|
|
334
335
|
}
|
|
335
336
|
return;
|
|
336
337
|
}
|
|
337
338
|
if (r === ".") {
|
|
338
|
-
if (
|
|
339
|
-
n.push(
|
|
339
|
+
if (d--, j(t)) {
|
|
340
|
+
n.push(D(t));
|
|
340
341
|
continue;
|
|
341
342
|
}
|
|
342
343
|
return;
|
|
343
344
|
}
|
|
344
345
|
if (r === "/") {
|
|
345
|
-
for (;
|
|
346
|
-
` || t[
|
|
347
|
-
|
|
346
|
+
for (; d < t.length && (t[d] === `
|
|
347
|
+
` || t[d] === " " || t[d] === " "); )
|
|
348
|
+
d++;
|
|
348
349
|
let o;
|
|
349
|
-
if (
|
|
350
|
+
if (j(t) && (o = D(t), o.type !== l.Hue)) {
|
|
350
351
|
n.push({ type: l.Alpha, value: o });
|
|
351
352
|
continue;
|
|
352
353
|
}
|
|
353
|
-
if (
|
|
354
|
+
if (be(t) && Y(t) === "none") {
|
|
354
355
|
n.push({
|
|
355
356
|
type: l.Alpha,
|
|
356
357
|
value: { type: l.None, value: void 0 }
|
|
@@ -360,34 +361,34 @@ function Gt(e = "") {
|
|
|
360
361
|
return;
|
|
361
362
|
}
|
|
362
363
|
if (/\d/.test(r)) {
|
|
363
|
-
|
|
364
|
+
d--, n.push(D(t));
|
|
364
365
|
continue;
|
|
365
366
|
}
|
|
366
|
-
if (
|
|
367
|
-
|
|
367
|
+
if (ye.test(r)) {
|
|
368
|
+
d--, n.push(Xt(t));
|
|
368
369
|
continue;
|
|
369
370
|
}
|
|
370
371
|
return;
|
|
371
372
|
}
|
|
372
373
|
return n;
|
|
373
374
|
}
|
|
374
|
-
function
|
|
375
|
+
function Ut(e) {
|
|
375
376
|
e._i = 0;
|
|
376
377
|
let t = e[e._i++];
|
|
377
378
|
if (!t || t.type !== l.Function || t.value !== "color" || (t = e[e._i++], t.type !== l.Ident))
|
|
378
379
|
return;
|
|
379
|
-
const n =
|
|
380
|
+
const n = Je[t.value];
|
|
380
381
|
if (!n)
|
|
381
382
|
return;
|
|
382
|
-
const r = { mode: n }, o =
|
|
383
|
+
const r = { mode: n }, o = We(e, !1);
|
|
383
384
|
if (!o)
|
|
384
385
|
return;
|
|
385
|
-
const i =
|
|
386
|
+
const i = oe(n).channels;
|
|
386
387
|
for (let a = 0, s, f; a < i.length; a++)
|
|
387
388
|
s = o[a], f = i[a], s.type !== l.None && (r[f] = s.type === l.Number ? s.value : s.value / 100, f === "alpha" && (r[f] = Math.max(0, Math.min(1, r[f]))));
|
|
388
389
|
return r;
|
|
389
390
|
}
|
|
390
|
-
function
|
|
391
|
+
function We(e, t) {
|
|
391
392
|
const n = [];
|
|
392
393
|
let r;
|
|
393
394
|
for (; e._i < e.length; ) {
|
|
@@ -411,26 +412,26 @@ function Be(e, t) {
|
|
|
411
412
|
return n.length === 3 && n.push({ type: l.None, value: void 0 }), n.every((o) => o.type !== l.Alpha) ? n : void 0;
|
|
412
413
|
}
|
|
413
414
|
}
|
|
414
|
-
function
|
|
415
|
+
function Zt(e, t) {
|
|
415
416
|
e._i = 0;
|
|
416
417
|
let n = e[e._i++];
|
|
417
418
|
if (!n || n.type !== l.Function)
|
|
418
419
|
return;
|
|
419
|
-
let r =
|
|
420
|
+
let r = We(e, t);
|
|
420
421
|
if (r)
|
|
421
422
|
return r.unshift(n.value), r;
|
|
422
423
|
}
|
|
423
|
-
const
|
|
424
|
+
const Pe = (e) => {
|
|
424
425
|
if (typeof e != "string")
|
|
425
426
|
return;
|
|
426
|
-
const t =
|
|
427
|
-
let r, o = 0, i =
|
|
427
|
+
const t = Yt(e), n = t ? Zt(t, !0) : void 0;
|
|
428
|
+
let r, o = 0, i = X.length;
|
|
428
429
|
for (; o < i; )
|
|
429
|
-
if ((r =
|
|
430
|
+
if ((r = X[o++](e, n)) !== void 0)
|
|
430
431
|
return r;
|
|
431
|
-
return t ?
|
|
432
|
+
return t ? Ut(t) : void 0;
|
|
432
433
|
};
|
|
433
|
-
function
|
|
434
|
+
function Qt(e, t) {
|
|
434
435
|
if (!t || t[0] !== "rgb" && t[0] !== "rgba")
|
|
435
436
|
return;
|
|
436
437
|
const n = { mode: "rgb" }, [, r, o, i, a] = t;
|
|
@@ -443,81 +444,81 @@ function Wt(e, t) {
|
|
|
443
444
|
)
|
|
444
445
|
)), n;
|
|
445
446
|
}
|
|
446
|
-
const
|
|
447
|
+
const en = (e) => e === "transparent" ? { mode: "rgb", r: 0, g: 0, b: 0, alpha: 0 } : void 0, tn = (e, t, n) => e + n * (t - e), nn = (e) => {
|
|
447
448
|
let t = [];
|
|
448
449
|
for (let n = 0; n < e.length - 1; n++) {
|
|
449
450
|
let r = e[n], o = e[n + 1];
|
|
450
451
|
r === void 0 && o === void 0 ? t.push(void 0) : r !== void 0 && o !== void 0 ? t.push([r, o]) : t.push(r !== void 0 ? [r, r] : [o, o]);
|
|
451
452
|
}
|
|
452
453
|
return t;
|
|
453
|
-
},
|
|
454
|
-
let n =
|
|
454
|
+
}, rn = (e) => (t) => {
|
|
455
|
+
let n = nn(t);
|
|
455
456
|
return (r) => {
|
|
456
457
|
let o = r * n.length, i = r >= 1 ? n.length - 1 : Math.max(Math.floor(o), 0), a = n[i];
|
|
457
458
|
return a === void 0 ? void 0 : e(a[0], a[1], o - i);
|
|
458
459
|
};
|
|
459
|
-
},
|
|
460
|
+
}, b = rn(tn), Oe = (e) => {
|
|
460
461
|
let t = !1, n = e.map((r) => r !== void 0 ? (t = !0, r) : 1);
|
|
461
462
|
return t ? n : e;
|
|
462
|
-
},
|
|
463
|
+
}, on = {
|
|
463
464
|
mode: "rgb",
|
|
464
465
|
channels: ["r", "g", "b", "alpha"],
|
|
465
466
|
parse: [
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
467
|
+
Qt,
|
|
468
|
+
Rt,
|
|
469
|
+
Bt,
|
|
470
|
+
Ft,
|
|
471
|
+
en,
|
|
471
472
|
"srgb"
|
|
472
473
|
],
|
|
473
474
|
serialize: "srgb",
|
|
474
475
|
interpolate: {
|
|
475
|
-
r:
|
|
476
|
-
g:
|
|
477
|
-
b
|
|
478
|
-
alpha: { use:
|
|
476
|
+
r: b,
|
|
477
|
+
g: b,
|
|
478
|
+
b,
|
|
479
|
+
alpha: { use: b, fixup: Oe }
|
|
479
480
|
},
|
|
480
481
|
gamut: !0,
|
|
481
482
|
white: { r: 1, g: 1, b: 1 },
|
|
482
483
|
black: { r: 0, g: 0, b: 0 }
|
|
483
|
-
},
|
|
484
|
+
}, fe = (e = 0) => {
|
|
484
485
|
const t = Math.abs(e);
|
|
485
486
|
return t <= 0.04045 ? e / 12.92 : (Math.sign(e) || 1) * Math.pow((t + 0.055) / 1.055, 2.4);
|
|
486
|
-
},
|
|
487
|
+
}, Xe = ({ r: e, g: t, b: n, alpha: r }) => {
|
|
487
488
|
let o = {
|
|
488
489
|
mode: "lrgb",
|
|
489
|
-
r:
|
|
490
|
-
g:
|
|
491
|
-
b:
|
|
490
|
+
r: fe(e),
|
|
491
|
+
g: fe(t),
|
|
492
|
+
b: fe(n)
|
|
492
493
|
};
|
|
493
494
|
return r !== void 0 && (o.alpha = r), o;
|
|
494
|
-
},
|
|
495
|
+
}, le = (e = 0) => {
|
|
495
496
|
const t = Math.abs(e);
|
|
496
497
|
return t > 31308e-7 ? (Math.sign(e) || 1) * (1.055 * Math.pow(t, 1 / 2.4) - 0.055) : e * 12.92;
|
|
497
|
-
},
|
|
498
|
+
}, Ye = ({ r: e, g: t, b: n, alpha: r }, o = "rgb") => {
|
|
498
499
|
let i = {
|
|
499
500
|
mode: o,
|
|
500
|
-
r:
|
|
501
|
-
g:
|
|
502
|
-
b:
|
|
501
|
+
r: le(e),
|
|
502
|
+
g: le(t),
|
|
503
|
+
b: le(n)
|
|
503
504
|
};
|
|
504
505
|
return r !== void 0 && (i.alpha = r), i;
|
|
505
|
-
},
|
|
506
|
+
}, N = (e) => (e = e % 360) < 0 ? e + 360 : e, an = (e, t) => e.map((n, r, o) => {
|
|
506
507
|
if (n === void 0)
|
|
507
508
|
return n;
|
|
508
|
-
let i =
|
|
509
|
-
return r === 0 || e[r - 1] === void 0 ? i : t(i -
|
|
510
|
-
}).reduce((n, r) => !n.length || r === void 0 || n[n.length - 1] === void 0 ? (n.push(r), n) : (n.push(r + n[n.length - 1]), n), []),
|
|
509
|
+
let i = N(n);
|
|
510
|
+
return r === 0 || e[r - 1] === void 0 ? i : t(i - N(o[r - 1]));
|
|
511
|
+
}).reduce((n, r) => !n.length || r === void 0 || n[n.length - 1] === void 0 ? (n.push(r), n) : (n.push(r + n[n.length - 1]), n), []), Ue = (e) => an(e, (t) => Math.abs(t) <= 180 ? t : t - 360 * Math.sign(t)), sn = (e, t) => {
|
|
511
512
|
if (e.h === void 0 || t.h === void 0 || !e.s || !t.s)
|
|
512
513
|
return 0;
|
|
513
|
-
let n =
|
|
514
|
+
let n = N(e.h), r = N(t.h), o = Math.sin((r - n + 360) / 2 * Math.PI / 180);
|
|
514
515
|
return 2 * Math.sqrt(e.s * t.s) * o;
|
|
515
|
-
},
|
|
516
|
+
}, fn = (e, t) => {
|
|
516
517
|
if (e.h === void 0 || t.h === void 0 || !e.c || !t.c)
|
|
517
518
|
return 0;
|
|
518
|
-
let n =
|
|
519
|
+
let n = N(e.h), r = N(t.h), o = Math.sin((r - n + 360) / 2 * Math.PI / 180);
|
|
519
520
|
return 2 * Math.sqrt(e.c * t.c) * o;
|
|
520
|
-
},
|
|
521
|
+
}, Ze = (e) => {
|
|
521
522
|
let t = e.reduce(
|
|
522
523
|
(r, o) => {
|
|
523
524
|
if (o !== void 0) {
|
|
@@ -529,11 +530,11 @@ const Xt = (e) => e === "transparent" ? { mode: "rgb", r: 0, g: 0, b: 0, alpha:
|
|
|
529
530
|
{ sin: 0, cos: 0 }
|
|
530
531
|
), n = Math.atan2(t.sin, t.cos) * 180 / Math.PI;
|
|
531
532
|
return n < 0 ? 360 + n : n;
|
|
532
|
-
},
|
|
533
|
+
}, U = ({ l: e, a: t, b: n, alpha: r }, o = "lch") => {
|
|
533
534
|
t === void 0 && (t = 0), n === void 0 && (n = 0);
|
|
534
535
|
let i = Math.sqrt(t * t + n * n), a = { mode: o, l: e, c: i };
|
|
535
|
-
return i && (a.h =
|
|
536
|
-
},
|
|
536
|
+
return i && (a.h = N(Math.atan2(n, t) * 180 / Math.PI)), r !== void 0 && (a.alpha = r), a;
|
|
537
|
+
}, Z = ({ l: e, c: t, h: n, alpha: r }, o = "lab") => {
|
|
537
538
|
n === void 0 && (n = 0);
|
|
538
539
|
let i = {
|
|
539
540
|
mode: o,
|
|
@@ -542,13 +543,13 @@ const Xt = (e) => e === "transparent" ? { mode: "rgb", r: 0, g: 0, b: 0, alpha:
|
|
|
542
543
|
b: t ? t * Math.sin(n / 180 * Math.PI) : 0
|
|
543
544
|
};
|
|
544
545
|
return r !== void 0 && (i.alpha = r), i;
|
|
545
|
-
},
|
|
546
|
+
}, I = {
|
|
546
547
|
X: 0.3457 / 0.3585,
|
|
547
548
|
Y: 1,
|
|
548
549
|
Z: (1 - 0.3457 - 0.3585) / 0.3585
|
|
549
550
|
};
|
|
550
|
-
function
|
|
551
|
-
e =
|
|
551
|
+
function ln({ h: e, s: t, l: n, alpha: r }) {
|
|
552
|
+
e = N(e !== void 0 ? e : 0), t === void 0 && (t = 0), n === void 0 && (n = 0);
|
|
552
553
|
let o = n + t * (n < 0.5 ? n : 1 - n), i = o - (o - n) * 2 * Math.abs(e / 60 % 2 - 1), a;
|
|
553
554
|
switch (Math.floor(e / 60)) {
|
|
554
555
|
case 0:
|
|
@@ -574,7 +575,7 @@ function rn({ h: e, s: t, l: n, alpha: r }) {
|
|
|
574
575
|
}
|
|
575
576
|
return a.mode = "rgb", r !== void 0 && (a.alpha = r), a;
|
|
576
577
|
}
|
|
577
|
-
function
|
|
578
|
+
function un({ r: e, g: t, b: n, alpha: r }) {
|
|
578
579
|
e === void 0 && (e = 0), t === void 0 && (t = 0), n === void 0 && (n = 0);
|
|
579
580
|
let o = Math.max(e, t, n), i = Math.min(e, t, n), a = {
|
|
580
581
|
mode: "hsl",
|
|
@@ -583,7 +584,7 @@ function on({ r: e, g: t, b: n, alpha: r }) {
|
|
|
583
584
|
};
|
|
584
585
|
return o - i !== 0 && (a.h = (o === e ? (t - n) / (o - i) + (t < n) * 6 : o === t ? (n - e) / (o - i) + 2 : (e - t) / (o - i) + 4) * 60), r !== void 0 && (a.alpha = r), a;
|
|
585
586
|
}
|
|
586
|
-
const
|
|
587
|
+
const cn = (e, t) => {
|
|
587
588
|
switch (t) {
|
|
588
589
|
case "deg":
|
|
589
590
|
return +e;
|
|
@@ -594,15 +595,15 @@ const an = (e, t) => {
|
|
|
594
595
|
case "turn":
|
|
595
596
|
return e * 360;
|
|
596
597
|
}
|
|
597
|
-
},
|
|
598
|
-
`^hsla?\\(\\s*${
|
|
599
|
-
),
|
|
600
|
-
let t = e.match(
|
|
598
|
+
}, dn = new RegExp(
|
|
599
|
+
`^hsla?\\(\\s*${Lt}${O}${E}${O}${E}\\s*(?:,\\s*${Te}\\s*)?\\)$`
|
|
600
|
+
), hn = (e) => {
|
|
601
|
+
let t = e.match(dn);
|
|
601
602
|
if (!t) return;
|
|
602
603
|
let n = { mode: "hsl" };
|
|
603
|
-
return t[3] !== void 0 ? n.h = +t[3] : t[1] !== void 0 && t[2] !== void 0 && (n.h =
|
|
604
|
+
return t[3] !== void 0 ? n.h = +t[3] : t[1] !== void 0 && t[2] !== void 0 && (n.h = cn(t[1], t[2])), t[4] !== void 0 && (n.s = Math.min(Math.max(0, t[4] / 100), 1)), t[5] !== void 0 && (n.l = Math.min(Math.max(0, t[5] / 100), 1)), t[6] !== void 0 ? n.alpha = Math.max(0, Math.min(1, t[6] / 100)) : t[7] !== void 0 && (n.alpha = Math.max(0, Math.min(1, +t[7]))), n;
|
|
604
605
|
};
|
|
605
|
-
function
|
|
606
|
+
function pn(e, t) {
|
|
606
607
|
if (!t || t[0] !== "hsl" && t[0] !== "hsla")
|
|
607
608
|
return;
|
|
608
609
|
const n = { mode: "hsl" }, [, r, o, i, a] = t;
|
|
@@ -629,74 +630,74 @@ function ln(e, t) {
|
|
|
629
630
|
)
|
|
630
631
|
)), n;
|
|
631
632
|
}
|
|
632
|
-
const
|
|
633
|
+
const gn = {
|
|
633
634
|
mode: "hsl",
|
|
634
635
|
toMode: {
|
|
635
|
-
rgb:
|
|
636
|
+
rgb: ln
|
|
636
637
|
},
|
|
637
638
|
fromMode: {
|
|
638
|
-
rgb:
|
|
639
|
+
rgb: un
|
|
639
640
|
},
|
|
640
641
|
channels: ["h", "s", "l", "alpha"],
|
|
641
642
|
ranges: {
|
|
642
643
|
h: [0, 360]
|
|
643
644
|
},
|
|
644
645
|
gamut: "rgb",
|
|
645
|
-
parse: [
|
|
646
|
+
parse: [pn, hn],
|
|
646
647
|
serialize: (e) => `hsl(${e.h !== void 0 ? e.h : "none"} ${e.s !== void 0 ? e.s * 100 + "%" : "none"} ${e.l !== void 0 ? e.l * 100 + "%" : "none"}${e.alpha < 1 ? ` / ${e.alpha}` : ""})`,
|
|
647
648
|
interpolate: {
|
|
648
|
-
h: { use:
|
|
649
|
-
s:
|
|
650
|
-
l:
|
|
651
|
-
alpha: { use:
|
|
649
|
+
h: { use: b, fixup: Ue },
|
|
650
|
+
s: b,
|
|
651
|
+
l: b,
|
|
652
|
+
alpha: { use: b, fixup: Oe }
|
|
652
653
|
},
|
|
653
654
|
difference: {
|
|
654
|
-
h:
|
|
655
|
+
h: sn
|
|
655
656
|
},
|
|
656
657
|
average: {
|
|
657
|
-
h:
|
|
658
|
+
h: Ze
|
|
658
659
|
}
|
|
659
|
-
},
|
|
660
|
-
let
|
|
661
|
-
const
|
|
660
|
+
}, Qe = Math.pow(29, 3) / Math.pow(3, 3), et = Math.pow(6, 3) / Math.pow(29, 3);
|
|
661
|
+
let ue = (e) => Math.pow(e, 3) > et ? Math.pow(e, 3) : (116 * e - 16) / Qe;
|
|
662
|
+
const mn = ({ l: e, a: t, b: n, alpha: r }) => {
|
|
662
663
|
e === void 0 && (e = 0), t === void 0 && (t = 0), n === void 0 && (n = 0);
|
|
663
664
|
let o = (e + 16) / 116, i = t / 500 + o, a = o - n / 200, s = {
|
|
664
665
|
mode: "xyz50",
|
|
665
|
-
x:
|
|
666
|
-
y:
|
|
667
|
-
z:
|
|
666
|
+
x: ue(i) * I.X,
|
|
667
|
+
y: ue(o) * I.Y,
|
|
668
|
+
z: ue(a) * I.Z
|
|
668
669
|
};
|
|
669
670
|
return r !== void 0 && (s.alpha = r), s;
|
|
670
|
-
},
|
|
671
|
+
}, yn = ({ x: e, y: t, z: n, alpha: r }) => {
|
|
671
672
|
e === void 0 && (e = 0), t === void 0 && (t = 0), n === void 0 && (n = 0);
|
|
672
|
-
let o =
|
|
673
|
+
let o = Ye({
|
|
673
674
|
r: e * 3.1341359569958707 - t * 1.6173863321612538 - 0.4906619460083532 * n,
|
|
674
675
|
g: e * -0.978795502912089 + t * 1.916254567259524 + 0.03344273116131949 * n,
|
|
675
676
|
b: e * 0.07195537988411677 - t * 0.2289768264158322 + 1.405386058324125 * n
|
|
676
677
|
});
|
|
677
678
|
return r !== void 0 && (o.alpha = r), o;
|
|
678
|
-
},
|
|
679
|
-
let { r: t, g: n, b: r, alpha: o } =
|
|
679
|
+
}, bn = (e) => yn(mn(e)), xn = (e) => {
|
|
680
|
+
let { r: t, g: n, b: r, alpha: o } = Xe(e), i = {
|
|
680
681
|
mode: "xyz50",
|
|
681
682
|
x: 0.436065742824811 * t + 0.3851514688337912 * n + 0.14307845442264197 * r,
|
|
682
683
|
y: 0.22249319175623702 * t + 0.7168870538238823 * n + 0.06061979053616537 * r,
|
|
683
684
|
z: 0.013923904500943465 * t + 0.09708128566574634 * n + 0.7140993584005155 * r
|
|
684
685
|
};
|
|
685
686
|
return o !== void 0 && (i.alpha = o), i;
|
|
686
|
-
},
|
|
687
|
+
}, ce = (e) => e > et ? Math.cbrt(e) : (Qe * e + 16) / 116, Mn = ({ x: e, y: t, z: n, alpha: r }) => {
|
|
687
688
|
e === void 0 && (e = 0), t === void 0 && (t = 0), n === void 0 && (n = 0);
|
|
688
|
-
let o =
|
|
689
|
+
let o = ce(e / I.X), i = ce(t / I.Y), a = ce(n / I.Z), s = {
|
|
689
690
|
mode: "lab",
|
|
690
691
|
l: 116 * i - 16,
|
|
691
692
|
a: 500 * (o - i),
|
|
692
693
|
b: 200 * (i - a)
|
|
693
694
|
};
|
|
694
695
|
return r !== void 0 && (s.alpha = r), s;
|
|
695
|
-
},
|
|
696
|
-
let t =
|
|
696
|
+
}, kn = (e) => {
|
|
697
|
+
let t = Mn(xn(e));
|
|
697
698
|
return e.r === e.b && e.b === e.g && (t.a = t.b = 0), t;
|
|
698
699
|
};
|
|
699
|
-
function
|
|
700
|
+
function Sn(e, t) {
|
|
700
701
|
if (!t || t[0] !== "lch")
|
|
701
702
|
return;
|
|
702
703
|
const n = { mode: "lch" }, [, r, o, i, a] = t;
|
|
@@ -721,15 +722,15 @@ function yn(e, t) {
|
|
|
721
722
|
)
|
|
722
723
|
)), n;
|
|
723
724
|
}
|
|
724
|
-
const
|
|
725
|
+
const vn = {
|
|
725
726
|
mode: "lch",
|
|
726
727
|
toMode: {
|
|
727
|
-
lab:
|
|
728
|
-
rgb: (e) =>
|
|
728
|
+
lab: Z,
|
|
729
|
+
rgb: (e) => bn(Z(e))
|
|
729
730
|
},
|
|
730
731
|
fromMode: {
|
|
731
|
-
rgb: (e) =>
|
|
732
|
-
lab:
|
|
732
|
+
rgb: (e) => U(kn(e)),
|
|
733
|
+
lab: U
|
|
733
734
|
},
|
|
734
735
|
channels: ["l", "c", "h", "alpha"],
|
|
735
736
|
ranges: {
|
|
@@ -737,21 +738,21 @@ const bn = {
|
|
|
737
738
|
c: [0, 150],
|
|
738
739
|
h: [0, 360]
|
|
739
740
|
},
|
|
740
|
-
parse: [
|
|
741
|
+
parse: [Sn],
|
|
741
742
|
serialize: (e) => `lch(${e.l !== void 0 ? e.l : "none"} ${e.c !== void 0 ? e.c : "none"} ${e.h !== void 0 ? e.h : "none"}${e.alpha < 1 ? ` / ${e.alpha}` : ""})`,
|
|
742
743
|
interpolate: {
|
|
743
|
-
h: { use:
|
|
744
|
-
c:
|
|
745
|
-
l:
|
|
746
|
-
alpha: { use:
|
|
744
|
+
h: { use: b, fixup: Ue },
|
|
745
|
+
c: b,
|
|
746
|
+
l: b,
|
|
747
|
+
alpha: { use: b, fixup: Oe }
|
|
747
748
|
},
|
|
748
749
|
difference: {
|
|
749
|
-
h:
|
|
750
|
+
h: fn
|
|
750
751
|
},
|
|
751
752
|
average: {
|
|
752
|
-
h:
|
|
753
|
+
h: Ze
|
|
753
754
|
}
|
|
754
|
-
},
|
|
755
|
+
}, wn = ({ r: e, g: t, b: n, alpha: r }) => {
|
|
755
756
|
e === void 0 && (e = 0), t === void 0 && (t = 0), n === void 0 && (n = 0);
|
|
756
757
|
let o = Math.cbrt(
|
|
757
758
|
0.412221469470763 * e + 0.5363325372617348 * t + 0.0514459932675022 * n
|
|
@@ -766,10 +767,10 @@ const bn = {
|
|
|
766
767
|
b: 0.0259040424655478 * o + 0.7827717124575296 * i - 0.8086757549230774 * a
|
|
767
768
|
};
|
|
768
769
|
return r !== void 0 && (s.alpha = r), s;
|
|
769
|
-
},
|
|
770
|
-
let t =
|
|
770
|
+
}, $n = (e) => {
|
|
771
|
+
let t = wn(Xe(e));
|
|
771
772
|
return e.r === e.b && e.b === e.g && (t.a = t.b = 0), t;
|
|
772
|
-
},
|
|
773
|
+
}, Nn = ({ l: e, a: t, b: n, alpha: r }) => {
|
|
773
774
|
e === void 0 && (e = 0), t === void 0 && (t = 0), n === void 0 && (n = 0);
|
|
774
775
|
let o = Math.pow(e + 0.3963377773761749 * t + 0.2158037573099136 * n, 3), i = Math.pow(e - 0.1055613458156586 * t - 0.0638541728258133 * n, 3), a = Math.pow(e - 0.0894841775298119 * t - 1.2914855480194092 * n, 3), s = {
|
|
775
776
|
mode: "lrgb",
|
|
@@ -778,8 +779,8 @@ const bn = {
|
|
|
778
779
|
b: -0.0041960761386756 * o - 0.7034186179359362 * i + 1.7076146940746117 * a
|
|
779
780
|
};
|
|
780
781
|
return r !== void 0 && (s.alpha = r), s;
|
|
781
|
-
},
|
|
782
|
-
function
|
|
782
|
+
}, Cn = (e) => Ye(Nn(e));
|
|
783
|
+
function Tn(e, t) {
|
|
783
784
|
if (!t || t[0] !== "oklch")
|
|
784
785
|
return;
|
|
785
786
|
const n = { mode: "oklch" }, [, r, o, i, a] = t;
|
|
@@ -807,35 +808,35 @@ function Sn(e, t) {
|
|
|
807
808
|
)
|
|
808
809
|
)), n;
|
|
809
810
|
}
|
|
810
|
-
const
|
|
811
|
-
...
|
|
811
|
+
const In = {
|
|
812
|
+
...vn,
|
|
812
813
|
mode: "oklch",
|
|
813
814
|
toMode: {
|
|
814
|
-
oklab: (e) =>
|
|
815
|
-
rgb: (e) =>
|
|
815
|
+
oklab: (e) => Z(e, "oklab"),
|
|
816
|
+
rgb: (e) => Cn(Z(e, "oklab"))
|
|
816
817
|
},
|
|
817
818
|
fromMode: {
|
|
818
|
-
rgb: (e) =>
|
|
819
|
-
oklab: (e) =>
|
|
819
|
+
rgb: (e) => U($n(e), "oklch"),
|
|
820
|
+
oklab: (e) => U(e, "oklch")
|
|
820
821
|
},
|
|
821
|
-
parse: [
|
|
822
|
+
parse: [Tn],
|
|
822
823
|
serialize: (e) => `oklch(${e.l !== void 0 ? e.l : "none"} ${e.c !== void 0 ? e.c : "none"} ${e.h !== void 0 ? e.h : "none"}${e.alpha < 1 ? ` / ${e.alpha}` : ""})`,
|
|
823
824
|
ranges: {
|
|
824
825
|
l: [0, 1],
|
|
825
826
|
c: [0, 0.4],
|
|
826
827
|
h: [0, 360]
|
|
827
828
|
}
|
|
828
|
-
},
|
|
829
|
+
}, Pn = (e) => Math.max(0, Math.min(1, e || 0)), G = (e) => Math.round(Pn(e) * 255), tt = k("rgb"), nt = (e) => {
|
|
829
830
|
if (e === void 0)
|
|
830
831
|
return;
|
|
831
|
-
let t =
|
|
832
|
+
let t = G(e.r), n = G(e.g), r = G(e.b);
|
|
832
833
|
return "#" + (1 << 24 | t << 16 | n << 8 | r).toString(16).slice(1);
|
|
833
|
-
},
|
|
834
|
+
}, On = (e) => {
|
|
834
835
|
if (e === void 0)
|
|
835
836
|
return;
|
|
836
|
-
let t =
|
|
837
|
-
return
|
|
838
|
-
},
|
|
837
|
+
let t = G(e.alpha !== void 0 ? e.alpha : 1);
|
|
838
|
+
return nt(e) + (256 | t).toString(16).slice(1);
|
|
839
|
+
}, An = (e) => nt(tt(e)), _n = (e) => On(tt(e)), rt = k("rgb"), ot = (e) => {
|
|
839
840
|
const t = {
|
|
840
841
|
mode: e.mode,
|
|
841
842
|
r: Math.max(0, Math.min(e.r !== void 0 ? e.r : 0, 1)),
|
|
@@ -843,54 +844,54 @@ const wn = {
|
|
|
843
844
|
b: Math.max(0, Math.min(e.b !== void 0 ? e.b : 0, 1))
|
|
844
845
|
};
|
|
845
846
|
return e.alpha !== void 0 && (t.alpha = e.alpha), t;
|
|
846
|
-
},
|
|
847
|
-
function
|
|
848
|
-
return
|
|
847
|
+
}, Dn = (e) => ot(rt(e)), it = (e) => e !== void 0 && (e.r === void 0 || e.r >= 0 && e.r <= 1) && (e.g === void 0 || e.g >= 0 && e.g <= 1) && (e.b === void 0 || e.b >= 0 && e.b <= 1);
|
|
848
|
+
function En(e) {
|
|
849
|
+
return it(rt(e));
|
|
849
850
|
}
|
|
850
|
-
function
|
|
851
|
-
const { gamut: t } =
|
|
851
|
+
function Ae(e = "rgb") {
|
|
852
|
+
const { gamut: t } = oe(e);
|
|
852
853
|
if (!t)
|
|
853
854
|
return (r) => !0;
|
|
854
|
-
const n =
|
|
855
|
-
return (r) =>
|
|
855
|
+
const n = k(typeof t == "string" ? t : e);
|
|
856
|
+
return (r) => it(n(r));
|
|
856
857
|
}
|
|
857
|
-
function
|
|
858
|
-
const { gamut: t } =
|
|
858
|
+
function Hn(e = "rgb") {
|
|
859
|
+
const { gamut: t } = oe(e);
|
|
859
860
|
if (!t)
|
|
860
|
-
return (i) =>
|
|
861
|
-
const n = typeof t == "string" ? t : e, r =
|
|
861
|
+
return (i) => W(i);
|
|
862
|
+
const n = typeof t == "string" ? t : e, r = k(n), o = Ae(n);
|
|
862
863
|
return (i) => {
|
|
863
|
-
const a =
|
|
864
|
+
const a = W(i);
|
|
864
865
|
if (!a)
|
|
865
866
|
return;
|
|
866
867
|
const s = r(a);
|
|
867
868
|
if (o(s))
|
|
868
869
|
return a;
|
|
869
|
-
const f =
|
|
870
|
-
return a.mode === f.mode ? f :
|
|
870
|
+
const f = ot(s);
|
|
871
|
+
return a.mode === f.mode ? f : k(a.mode)(f);
|
|
871
872
|
};
|
|
872
873
|
}
|
|
873
|
-
function
|
|
874
|
-
e =
|
|
875
|
-
let r = n === "rgb" ?
|
|
874
|
+
function Vn(e, t = "lch", n = "rgb") {
|
|
875
|
+
e = W(e);
|
|
876
|
+
let r = n === "rgb" ? En : Ae(n), o = n === "rgb" ? Dn : Hn(n);
|
|
876
877
|
if (e === void 0 || r(e)) return e;
|
|
877
|
-
let i =
|
|
878
|
-
e =
|
|
878
|
+
let i = k(e.mode);
|
|
879
|
+
e = k(t)(e);
|
|
879
880
|
let a = { ...e, c: 0 };
|
|
880
881
|
if (!r(a))
|
|
881
882
|
return i(o(a));
|
|
882
|
-
let s = 0, f = e.c !== void 0 ? e.c : 0, u =
|
|
883
|
-
for (; f - s >
|
|
884
|
-
a.c = s + (f - s) * 0.5, r(a) ? (
|
|
883
|
+
let s = 0, f = e.c !== void 0 ? e.c : 0, u = oe(t).ranges.c, h = (u[1] - u[0]) / Math.pow(2, 13), c = a.c;
|
|
884
|
+
for (; f - s > h; )
|
|
885
|
+
a.c = s + (f - s) * 0.5, r(a) ? (c = a.c, s = a.c) : f = a.c;
|
|
885
886
|
return i(
|
|
886
|
-
r(a) ? a : { ...a, c
|
|
887
|
+
r(a) ? a : { ...a, c }
|
|
887
888
|
);
|
|
888
889
|
}
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
const
|
|
893
|
-
function
|
|
890
|
+
Ie(In);
|
|
891
|
+
Ie(on);
|
|
892
|
+
Ie(gn);
|
|
893
|
+
const kr = 0.37, _e = k("oklch"), at = k("rgb"), Fn = k("hsl"), zn = Ae("rgb");
|
|
894
|
+
function ie(e) {
|
|
894
895
|
return {
|
|
895
896
|
mode: "oklch",
|
|
896
897
|
l: e.l / 100,
|
|
@@ -899,7 +900,7 @@ function ne(e) {
|
|
|
899
900
|
alpha: e.a / 100
|
|
900
901
|
};
|
|
901
902
|
}
|
|
902
|
-
function
|
|
903
|
+
function Rn(e) {
|
|
903
904
|
return {
|
|
904
905
|
l: (e.l ?? 0) * 100,
|
|
905
906
|
c: e.c ?? 0,
|
|
@@ -907,19 +908,19 @@ function Dn(e) {
|
|
|
907
908
|
a: (e.alpha ?? 1) * 100
|
|
908
909
|
};
|
|
909
910
|
}
|
|
910
|
-
function
|
|
911
|
+
function Sr(e) {
|
|
911
912
|
const t = (e.l / 100).toFixed(4), n = e.c.toFixed(4), r = e.h.toFixed(2);
|
|
912
913
|
if (e.a >= 100)
|
|
913
914
|
return `oklch(${t} ${n} ${r})`;
|
|
914
915
|
const o = (e.a / 100).toFixed(4);
|
|
915
916
|
return `oklch(${t} ${n} ${r} / ${o})`;
|
|
916
917
|
}
|
|
917
|
-
function
|
|
918
|
+
function vr(e) {
|
|
918
919
|
const t = { l: 0, c: 0, h: 0, a: 100 };
|
|
919
920
|
try {
|
|
920
|
-
const n =
|
|
921
|
+
const n = Pe(e);
|
|
921
922
|
if (!n) return t;
|
|
922
|
-
const r =
|
|
923
|
+
const r = _e(n);
|
|
923
924
|
if (!r) return t;
|
|
924
925
|
const o = r.alpha === void 0 ? 1 : r.alpha;
|
|
925
926
|
return {
|
|
@@ -932,12 +933,12 @@ function xr(e) {
|
|
|
932
933
|
return t;
|
|
933
934
|
}
|
|
934
935
|
}
|
|
935
|
-
function
|
|
936
|
-
const n =
|
|
937
|
-
return r ? e.a < 100 ?
|
|
936
|
+
function wr(e, t) {
|
|
937
|
+
const n = ie(e), r = at(n);
|
|
938
|
+
return r ? e.a < 100 ? _n({ ...r, alpha: e.a / 100 }) ?? "#000000ff" : An(r) ?? "#000000" : "#000000";
|
|
938
939
|
}
|
|
939
|
-
function
|
|
940
|
-
const t =
|
|
940
|
+
function $r(e) {
|
|
941
|
+
const t = ie(e), n = Fn(t);
|
|
941
942
|
return n ? {
|
|
942
943
|
h: n.h ?? 0,
|
|
943
944
|
s: (n.s ?? 0) * 100,
|
|
@@ -945,18 +946,18 @@ function kr(e) {
|
|
|
945
946
|
a: e.a
|
|
946
947
|
} : { h: 0, s: 0, l: 0, a: e.a };
|
|
947
948
|
}
|
|
948
|
-
function
|
|
949
|
+
function Nr(e) {
|
|
949
950
|
const t = {
|
|
950
951
|
mode: "hsl",
|
|
951
952
|
h: e.h,
|
|
952
953
|
s: e.s / 100,
|
|
953
954
|
l: e.l / 100,
|
|
954
955
|
alpha: e.a / 100
|
|
955
|
-
}, n =
|
|
956
|
-
return n ?
|
|
956
|
+
}, n = _e(t);
|
|
957
|
+
return n ? Rn(n) : { l: 0, c: 0, h: 0, a: e.a };
|
|
957
958
|
}
|
|
958
|
-
function
|
|
959
|
-
const t =
|
|
959
|
+
function Cr(e) {
|
|
960
|
+
const t = ie(e), n = Vn(t, "oklch", "rgb");
|
|
960
961
|
return n ? {
|
|
961
962
|
l: (n.l ?? e.l / 100) * 100,
|
|
962
963
|
c: n.c ?? 0,
|
|
@@ -964,19 +965,19 @@ function Sr(e) {
|
|
|
964
965
|
a: e.a
|
|
965
966
|
} : { l: e.l, c: 0, h: e.h, a: e.a };
|
|
966
967
|
}
|
|
967
|
-
function
|
|
968
|
-
const t =
|
|
969
|
-
return t ?
|
|
968
|
+
function Tr(e) {
|
|
969
|
+
const t = at(ie(e));
|
|
970
|
+
return t ? zn(t) : !1;
|
|
970
971
|
}
|
|
971
|
-
function
|
|
972
|
+
function Ir(e) {
|
|
972
973
|
const t = e.trim();
|
|
973
974
|
if (!t) return null;
|
|
974
975
|
if (/^oklch\s*\(/i.test(t))
|
|
975
|
-
return
|
|
976
|
+
return Q(t);
|
|
976
977
|
try {
|
|
977
|
-
const n =
|
|
978
|
+
const n = Pe(t.toLowerCase());
|
|
978
979
|
if (!n) return null;
|
|
979
|
-
const r =
|
|
980
|
+
const r = _e(n);
|
|
980
981
|
return !r || !Number.isFinite(r.l) || !Number.isFinite(r.c) || r.h !== void 0 && !Number.isFinite(r.h) || r.alpha !== void 0 && !Number.isFinite(r.alpha) ? null : {
|
|
981
982
|
l: r.l * 100,
|
|
982
983
|
c: r.c,
|
|
@@ -989,7 +990,7 @@ function Nr(e) {
|
|
|
989
990
|
return null;
|
|
990
991
|
}
|
|
991
992
|
}
|
|
992
|
-
function
|
|
993
|
+
function Ln(e, t) {
|
|
993
994
|
const n = parseFloat(e);
|
|
994
995
|
let r;
|
|
995
996
|
switch (t.toLowerCase()) {
|
|
@@ -1007,120 +1008,120 @@ function Hn(e, t) {
|
|
|
1007
1008
|
}
|
|
1008
1009
|
return (r % 360 + 360) % 360;
|
|
1009
1010
|
}
|
|
1010
|
-
function
|
|
1011
|
+
function Q(e) {
|
|
1011
1012
|
const n = e.trim().match(/^oklch\(\s*(.*?)\s*\)$/i);
|
|
1012
1013
|
if (!n) return null;
|
|
1013
1014
|
const o = n[1].split("/");
|
|
1014
1015
|
if (o.length > 2) return null;
|
|
1015
1016
|
const i = o[0].trim(), a = o.length === 2 ? o[1].trim() : null, s = i.split(/\s+/).filter(Boolean);
|
|
1016
1017
|
if (s.length !== 3) return null;
|
|
1017
|
-
const f = (
|
|
1018
|
-
if (
|
|
1019
|
-
const
|
|
1020
|
-
if (!
|
|
1021
|
-
const
|
|
1022
|
-
return isNaN(
|
|
1018
|
+
const f = (y) => {
|
|
1019
|
+
if (y.toLowerCase() === "none") return { value: 0, isPercent: !1 };
|
|
1020
|
+
const _ = y.match(/^([+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?)(%?)$/i);
|
|
1021
|
+
if (!_) return null;
|
|
1022
|
+
const L = parseFloat(_[1]);
|
|
1023
|
+
return isNaN(L) ? null : { value: L, isPercent: _[2] === "%" };
|
|
1023
1024
|
}, u = f(s[0]);
|
|
1024
1025
|
if (!u) return null;
|
|
1025
|
-
const
|
|
1026
|
-
if (!
|
|
1027
|
-
const p =
|
|
1026
|
+
const h = u.isPercent ? u.value : u.value * 100, c = f(s[1]);
|
|
1027
|
+
if (!c) return null;
|
|
1028
|
+
const p = c.isPercent ? c.value / 100 * 0.4 : c.value, m = s[2];
|
|
1028
1029
|
let S;
|
|
1029
|
-
if (
|
|
1030
|
+
if (m.toLowerCase() === "none")
|
|
1030
1031
|
S = 0;
|
|
1031
1032
|
else {
|
|
1032
|
-
const
|
|
1033
|
-
if (!
|
|
1034
|
-
const
|
|
1035
|
-
S =
|
|
1033
|
+
const y = m.match(/^([+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?)(deg|rad|grad|turn)?$/i);
|
|
1034
|
+
if (!y) return null;
|
|
1035
|
+
const _ = y[1], L = y[2] ?? "deg";
|
|
1036
|
+
S = Ln(_, L);
|
|
1036
1037
|
}
|
|
1037
|
-
let
|
|
1038
|
+
let C = 100;
|
|
1038
1039
|
if (a !== null) {
|
|
1039
|
-
const
|
|
1040
|
-
if (!
|
|
1041
|
-
|
|
1040
|
+
const y = f(a.trim());
|
|
1041
|
+
if (!y) return null;
|
|
1042
|
+
C = y.isPercent ? y.value : y.value * 100;
|
|
1042
1043
|
}
|
|
1043
1044
|
return {
|
|
1044
|
-
l:
|
|
1045
|
+
l: h,
|
|
1045
1046
|
c: p,
|
|
1046
1047
|
h: S,
|
|
1047
|
-
a:
|
|
1048
|
+
a: C
|
|
1048
1049
|
};
|
|
1049
1050
|
}
|
|
1050
|
-
function
|
|
1051
|
-
return
|
|
1052
|
-
}
|
|
1053
|
-
function ot(e = g()) {
|
|
1054
|
-
return vt(e);
|
|
1055
|
-
}
|
|
1056
|
-
function it(e = g()) {
|
|
1057
|
-
return kt(e);
|
|
1058
|
-
}
|
|
1059
|
-
function F(e = g()) {
|
|
1060
|
-
return Mt(e);
|
|
1051
|
+
function st(e = g()) {
|
|
1052
|
+
return Dt(e);
|
|
1061
1053
|
}
|
|
1062
|
-
function
|
|
1063
|
-
return
|
|
1054
|
+
function ft(e = g()) {
|
|
1055
|
+
return Ct(e);
|
|
1064
1056
|
}
|
|
1065
|
-
function
|
|
1057
|
+
function lt(e = g()) {
|
|
1066
1058
|
return Nt(e);
|
|
1067
1059
|
}
|
|
1068
|
-
function
|
|
1069
|
-
return wt(e);
|
|
1070
|
-
}
|
|
1071
|
-
function ft(e = g()) {
|
|
1060
|
+
function z(e = g()) {
|
|
1072
1061
|
return $t(e);
|
|
1073
1062
|
}
|
|
1074
|
-
|
|
1075
|
-
function lt(e = g()) {
|
|
1063
|
+
function Pr(e = g()) {
|
|
1076
1064
|
return Tt(e);
|
|
1077
1065
|
}
|
|
1078
1066
|
function ut(e = g()) {
|
|
1079
|
-
return
|
|
1067
|
+
return Pt(e);
|
|
1080
1068
|
}
|
|
1081
|
-
function
|
|
1069
|
+
function ct(e = g()) {
|
|
1070
|
+
return It(e);
|
|
1071
|
+
}
|
|
1072
|
+
function dt(e = g()) {
|
|
1073
|
+
return Ot(e);
|
|
1074
|
+
}
|
|
1075
|
+
const jn = "float", de = { right: 440, bottom: 340 };
|
|
1076
|
+
function ht(e = g()) {
|
|
1077
|
+
return _t(e);
|
|
1078
|
+
}
|
|
1079
|
+
function pt(e = g()) {
|
|
1080
|
+
return At(e);
|
|
1081
|
+
}
|
|
1082
|
+
function Or(e, t) {
|
|
1082
1083
|
try {
|
|
1083
|
-
const n = (t ?? localStorage).getItem(
|
|
1084
|
+
const n = (t ?? localStorage).getItem(ht(e));
|
|
1084
1085
|
if (n === "float" || n === "right" || n === "bottom" || n === "mini")
|
|
1085
1086
|
return n;
|
|
1086
1087
|
} catch {
|
|
1087
1088
|
}
|
|
1088
|
-
return
|
|
1089
|
+
return jn;
|
|
1089
1090
|
}
|
|
1090
|
-
function
|
|
1091
|
+
function Ar(e, t, n) {
|
|
1091
1092
|
try {
|
|
1092
|
-
(n ?? localStorage).setItem(
|
|
1093
|
+
(n ?? localStorage).setItem(ht(t), e);
|
|
1093
1094
|
} catch {
|
|
1094
1095
|
}
|
|
1095
1096
|
}
|
|
1096
|
-
function
|
|
1097
|
+
function _r(e, t) {
|
|
1097
1098
|
try {
|
|
1098
|
-
const n = (t ?? localStorage).getItem(
|
|
1099
|
+
const n = (t ?? localStorage).getItem(pt(e));
|
|
1099
1100
|
if (n) {
|
|
1100
1101
|
const r = JSON.parse(n);
|
|
1101
1102
|
return {
|
|
1102
|
-
right: typeof r.right == "number" && Number.isFinite(r.right) && r.right > 0 ? Math.max(
|
|
1103
|
-
bottom: typeof r.bottom == "number" && Number.isFinite(r.bottom) && r.bottom > 0 ? r.bottom :
|
|
1103
|
+
right: typeof r.right == "number" && Number.isFinite(r.right) && r.right > 0 ? Math.max(xe, r.right) : de.right,
|
|
1104
|
+
bottom: typeof r.bottom == "number" && Number.isFinite(r.bottom) && r.bottom > 0 ? r.bottom : de.bottom
|
|
1104
1105
|
};
|
|
1105
1106
|
}
|
|
1106
1107
|
} catch {
|
|
1107
1108
|
}
|
|
1108
|
-
return { ...
|
|
1109
|
+
return { ...de };
|
|
1109
1110
|
}
|
|
1110
|
-
function
|
|
1111
|
+
function Dr(e, t, n) {
|
|
1111
1112
|
try {
|
|
1112
|
-
(n ?? localStorage).setItem(
|
|
1113
|
+
(n ?? localStorage).setItem(pt(t), JSON.stringify(e));
|
|
1113
1114
|
} catch {
|
|
1114
1115
|
}
|
|
1115
1116
|
}
|
|
1116
|
-
const
|
|
1117
|
-
function
|
|
1118
|
-
const { top: n, left: r } =
|
|
1117
|
+
const Kn = { top: 60, left: 20 };
|
|
1118
|
+
function Bn(e = 0, t) {
|
|
1119
|
+
const { top: n, left: r } = gt(e, t);
|
|
1119
1120
|
return { top: n, left: r };
|
|
1120
1121
|
}
|
|
1121
|
-
function
|
|
1122
|
+
function Er(e, t = 0, n) {
|
|
1122
1123
|
try {
|
|
1123
|
-
const r = localStorage.getItem(
|
|
1124
|
+
const r = localStorage.getItem(ut(e));
|
|
1124
1125
|
if (r) {
|
|
1125
1126
|
const o = JSON.parse(r);
|
|
1126
1127
|
if (typeof o.top == "number" && typeof o.left == "number" && Number.isFinite(o.top) && Number.isFinite(o.left))
|
|
@@ -1128,38 +1129,38 @@ function Ar(e, t = 0, n) {
|
|
|
1128
1129
|
}
|
|
1129
1130
|
} catch {
|
|
1130
1131
|
}
|
|
1131
|
-
return
|
|
1132
|
+
return Bn(t, n);
|
|
1132
1133
|
}
|
|
1133
|
-
function
|
|
1134
|
+
function Hr(e, t) {
|
|
1134
1135
|
try {
|
|
1135
|
-
localStorage.setItem(
|
|
1136
|
+
localStorage.setItem(ut(t), JSON.stringify(e));
|
|
1136
1137
|
} catch {
|
|
1137
1138
|
}
|
|
1138
1139
|
}
|
|
1139
|
-
const
|
|
1140
|
-
function
|
|
1141
|
-
const { width: e, height: t } =
|
|
1140
|
+
const he = 60, xe = 320, Re = 240, Me = 1600, ke = 1200, Gn = { width: 1024 * 0.8, height: 768 * 0.8 };
|
|
1141
|
+
function qn() {
|
|
1142
|
+
const { width: e, height: t } = gt();
|
|
1142
1143
|
return { width: e, height: t };
|
|
1143
1144
|
}
|
|
1144
|
-
const
|
|
1145
|
-
function
|
|
1146
|
-
const n = typeof window < "u" ? window.innerWidth :
|
|
1145
|
+
const Le = 32;
|
|
1146
|
+
function Se(e, t) {
|
|
1147
|
+
const n = typeof window < "u" ? window.innerWidth : Me, r = typeof window < "u" ? window.innerHeight : ke, o = Math.max(xe, Math.min(Me, n - Le)), i = Math.max(Re, Math.min(ke, r - Le));
|
|
1147
1148
|
return {
|
|
1148
|
-
width: Math.max(
|
|
1149
|
-
height: Math.max(
|
|
1149
|
+
width: Math.max(xe, Math.min(e, o)),
|
|
1150
|
+
height: Math.max(Re, Math.min(t, i))
|
|
1150
1151
|
};
|
|
1151
1152
|
}
|
|
1152
|
-
const
|
|
1153
|
-
function
|
|
1153
|
+
const Jn = 24;
|
|
1154
|
+
function Wn(e) {
|
|
1154
1155
|
return Number.isFinite(e) ? Math.max(0, Math.floor(e)) : 0;
|
|
1155
1156
|
}
|
|
1156
|
-
function
|
|
1157
|
+
function gt(e = 0, t) {
|
|
1157
1158
|
if (typeof window > "u")
|
|
1158
|
-
return { ...
|
|
1159
|
-
const { width: n, height: r } = t ?
|
|
1159
|
+
return { ...Kn, ...t ?? Gn };
|
|
1160
|
+
const { width: n, height: r } = t ? Se(t.width, t.height) : Se(
|
|
1160
1161
|
Math.min(1200, 0.8 * window.innerWidth),
|
|
1161
1162
|
Math.min(800, 0.8 * window.innerHeight)
|
|
1162
|
-
), o = Math.max(0, Math.round((window.innerHeight - r) / 2)), i = Math.max(0, Math.round((window.innerWidth - n) / 2)), a =
|
|
1163
|
+
), o = Math.max(0, Math.round((window.innerHeight - r) / 2)), i = Math.max(0, Math.round((window.innerWidth - n) / 2)), a = Jn * Wn(e), { top: s, left: f } = Xn(
|
|
1163
1164
|
o + a,
|
|
1164
1165
|
i + a,
|
|
1165
1166
|
n,
|
|
@@ -1167,75 +1168,75 @@ function ct(e = 0, t) {
|
|
|
1167
1168
|
);
|
|
1168
1169
|
return { top: s, left: f, width: n, height: r };
|
|
1169
1170
|
}
|
|
1170
|
-
function
|
|
1171
|
-
const o = typeof window < "u" ? window.innerWidth :
|
|
1171
|
+
function Xn(e, t, n, r) {
|
|
1172
|
+
const o = typeof window < "u" ? window.innerWidth : Me, i = typeof window < "u" ? window.innerHeight : ke;
|
|
1172
1173
|
return {
|
|
1173
1174
|
top: Math.min(Math.max(0, e), Math.max(0, i - r)),
|
|
1174
1175
|
left: Math.min(Math.max(0, t), Math.max(0, o - n))
|
|
1175
1176
|
};
|
|
1176
1177
|
}
|
|
1177
|
-
function
|
|
1178
|
+
function Vr(e) {
|
|
1178
1179
|
try {
|
|
1179
|
-
const t = localStorage.getItem(
|
|
1180
|
+
const t = localStorage.getItem(ct(e));
|
|
1180
1181
|
if (t) {
|
|
1181
1182
|
const n = JSON.parse(t);
|
|
1182
1183
|
if (typeof n.width == "number" && typeof n.height == "number" && Number.isFinite(n.width) && Number.isFinite(n.height))
|
|
1183
|
-
return
|
|
1184
|
+
return Se(n.width, n.height);
|
|
1184
1185
|
}
|
|
1185
1186
|
} catch {
|
|
1186
1187
|
}
|
|
1187
|
-
return
|
|
1188
|
+
return qn();
|
|
1188
1189
|
}
|
|
1189
|
-
function
|
|
1190
|
+
function Fr(e, t) {
|
|
1190
1191
|
try {
|
|
1191
|
-
localStorage.setItem(
|
|
1192
|
+
localStorage.setItem(ct(t), JSON.stringify(e));
|
|
1192
1193
|
} catch {
|
|
1193
1194
|
}
|
|
1194
1195
|
}
|
|
1195
|
-
const
|
|
1196
|
-
function
|
|
1196
|
+
const Yn = 1;
|
|
1197
|
+
function zr(e) {
|
|
1197
1198
|
return e === 0 ? "192px" : e === 2 ? "100%" : "288px";
|
|
1198
1199
|
}
|
|
1199
|
-
function
|
|
1200
|
+
function Rr(e) {
|
|
1200
1201
|
try {
|
|
1201
|
-
const t = localStorage.getItem(
|
|
1202
|
+
const t = localStorage.getItem(dt(e));
|
|
1202
1203
|
if (t === "0" || t === "1" || t === "2")
|
|
1203
1204
|
return Number(t);
|
|
1204
1205
|
} catch {
|
|
1205
1206
|
}
|
|
1206
|
-
return
|
|
1207
|
+
return Yn;
|
|
1207
1208
|
}
|
|
1208
|
-
function
|
|
1209
|
+
function Lr(e, t) {
|
|
1209
1210
|
try {
|
|
1210
|
-
localStorage.setItem(
|
|
1211
|
+
localStorage.setItem(dt(t), String(e));
|
|
1211
1212
|
} catch {
|
|
1212
1213
|
}
|
|
1213
1214
|
}
|
|
1214
|
-
function
|
|
1215
|
-
const o = -(n -
|
|
1215
|
+
function jr(e, t, n, r) {
|
|
1216
|
+
const o = -(n - he), i = window.innerWidth - he, a = -30, s = window.innerHeight - he, f = Math.max(s, a), u = Math.max(i, o);
|
|
1216
1217
|
return {
|
|
1217
1218
|
top: Math.max(a, Math.min(e, f)),
|
|
1218
1219
|
left: Math.max(o, Math.min(t, u))
|
|
1219
1220
|
};
|
|
1220
1221
|
}
|
|
1221
|
-
async function
|
|
1222
|
+
async function Kr(e) {
|
|
1222
1223
|
}
|
|
1223
|
-
function
|
|
1224
|
+
function Un(e) {
|
|
1224
1225
|
return typeof e == "number" || e === "bg" || e === "fg";
|
|
1225
1226
|
}
|
|
1226
|
-
function
|
|
1227
|
+
function ee(e) {
|
|
1227
1228
|
return typeof e == "object" && e !== null && "literal" in e;
|
|
1228
1229
|
}
|
|
1229
|
-
function
|
|
1230
|
-
return
|
|
1230
|
+
function ve(e) {
|
|
1231
|
+
return ee(e) && typeof e.literal == "object" && e.literal !== null;
|
|
1231
1232
|
}
|
|
1232
|
-
function
|
|
1233
|
+
function Zn(e) {
|
|
1233
1234
|
return typeof e == "object" && e !== null && "ref" in e;
|
|
1234
1235
|
}
|
|
1235
|
-
function
|
|
1236
|
+
function pe() {
|
|
1236
1237
|
return {};
|
|
1237
1238
|
}
|
|
1238
|
-
const
|
|
1239
|
+
const Qn = {
|
|
1239
1240
|
id: "stub",
|
|
1240
1241
|
label: "STUB",
|
|
1241
1242
|
paletteSize: 0,
|
|
@@ -1248,16 +1249,18 @@ const Wn = {
|
|
|
1248
1249
|
colorSchemes: {},
|
|
1249
1250
|
panelSettings: { colorScheme: "", colorMode: !1 }
|
|
1250
1251
|
};
|
|
1251
|
-
function
|
|
1252
|
-
return
|
|
1252
|
+
function M(e = g()) {
|
|
1253
|
+
return wt(e.tabs) ?? Qn;
|
|
1253
1254
|
}
|
|
1254
|
-
function
|
|
1255
|
+
function ae(e) {
|
|
1255
1256
|
const t = e.paletteSize;
|
|
1256
1257
|
return {
|
|
1257
1258
|
palette: Array.from({ length: t }, (r, o) => {
|
|
1259
|
+
const i = e.paletteModes?.[o];
|
|
1260
|
+
if (i) return `light-dark(${i.light}, ${i.dark})`;
|
|
1258
1261
|
if (t === 1) return "#808080";
|
|
1259
|
-
const
|
|
1260
|
-
return `#${
|
|
1262
|
+
const s = Math.round(o / (t - 1) * 255).toString(16).padStart(2, "0");
|
|
1263
|
+
return `#${s}${s}${s}`;
|
|
1261
1264
|
}),
|
|
1262
1265
|
background: e.baseDefaults.background ?? 0,
|
|
1263
1266
|
foreground: e.baseDefaults.foreground ?? 0,
|
|
@@ -1268,11 +1271,11 @@ function re(e) {
|
|
|
1268
1271
|
shikiTheme: e.defaultShikiTheme
|
|
1269
1272
|
};
|
|
1270
1273
|
}
|
|
1271
|
-
function
|
|
1272
|
-
const t =
|
|
1273
|
-
return t ?
|
|
1274
|
+
function Br(e) {
|
|
1275
|
+
const t = re(e);
|
|
1276
|
+
return t ? ae(t) : void 0;
|
|
1274
1277
|
}
|
|
1275
|
-
function
|
|
1278
|
+
function er() {
|
|
1276
1279
|
try {
|
|
1277
1280
|
const e = document.createElement("canvas").getContext("2d");
|
|
1278
1281
|
return e ? (e.fillStyle = "#ffffff", e.fillStyle === "#ffffff") : !1;
|
|
@@ -1280,8 +1283,8 @@ function Xn() {
|
|
|
1280
1283
|
return !1;
|
|
1281
1284
|
}
|
|
1282
1285
|
}
|
|
1283
|
-
const
|
|
1284
|
-
function
|
|
1286
|
+
const tr = er();
|
|
1287
|
+
function nr(e) {
|
|
1285
1288
|
const t = e.match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*([\d.]+))?/);
|
|
1286
1289
|
if (!t) return null;
|
|
1287
1290
|
const n = parseInt(t[1], 10), r = parseInt(t[2], 10), o = parseInt(t[3], 10), i = `#${(1 << 24 | n << 16 | r << 8 | o).toString(16).slice(1)}`;
|
|
@@ -1294,12 +1297,12 @@ function Un(e) {
|
|
|
1294
1297
|
}
|
|
1295
1298
|
return i;
|
|
1296
1299
|
}
|
|
1297
|
-
function
|
|
1300
|
+
function rr(e, t, n, r) {
|
|
1298
1301
|
const o = (a) => a.toString(16).padStart(2, "0"), i = `#${o(e)}${o(t)}${o(n)}`;
|
|
1299
1302
|
return r < 255 ? `${i}${o(r)}` : i;
|
|
1300
1303
|
}
|
|
1301
1304
|
let w = null;
|
|
1302
|
-
function
|
|
1305
|
+
function we(e) {
|
|
1303
1306
|
if (!e || e === "initial" || e === "inherit") return "#000000";
|
|
1304
1307
|
const t = e.trim();
|
|
1305
1308
|
if (/^#[0-9a-fA-F]{6}$/.test(t) || /^#[0-9a-fA-F]{8}$/.test(t)) return t;
|
|
@@ -1307,47 +1310,47 @@ function xe(e) {
|
|
|
1307
1310
|
return `#${t[1]}${t[1]}${t[2]}${t[2]}${t[3]}${t[3]}`;
|
|
1308
1311
|
if (/^#[0-9a-fA-F]{4}$/.test(t))
|
|
1309
1312
|
return `#${t[1]}${t[1]}${t[2]}${t[2]}${t[3]}${t[3]}${t[4]}${t[4]}`;
|
|
1310
|
-
const n =
|
|
1313
|
+
const n = nr(t);
|
|
1311
1314
|
if (n) return n;
|
|
1312
|
-
if (!
|
|
1315
|
+
if (!tr) return "#000000";
|
|
1313
1316
|
try {
|
|
1314
1317
|
if (w || (w = document.createElement("canvas").getContext("2d")), !w) return "#000000";
|
|
1315
1318
|
w.fillStyle = "#000000", w.fillStyle = t, w.clearRect(0, 0, 1, 1), w.fillRect(0, 0, 1, 1);
|
|
1316
1319
|
const [r, o, i, a] = w.getImageData(0, 0, 1, 1).data;
|
|
1317
|
-
return
|
|
1320
|
+
return rr(r, o, i, a);
|
|
1318
1321
|
} catch {
|
|
1319
1322
|
return "#000000";
|
|
1320
1323
|
}
|
|
1321
1324
|
}
|
|
1322
|
-
function
|
|
1325
|
+
function P(e, t) {
|
|
1323
1326
|
document.documentElement.style.setProperty(e, t);
|
|
1324
1327
|
}
|
|
1325
|
-
function
|
|
1328
|
+
function or(e, t) {
|
|
1326
1329
|
let n = Math.abs(e.h - t.h) % 360;
|
|
1327
1330
|
return n > 180 && (n = 360 - n), Math.abs(e.l - t.l) <= 1e-3 && Math.abs(e.c - t.c) <= 1e-5 && n <= 1e-3 && Math.abs(e.a - t.a) <= 1e-3;
|
|
1328
1331
|
}
|
|
1329
|
-
function
|
|
1332
|
+
function T(e, t, n) {
|
|
1330
1333
|
if (e === void 0) return n;
|
|
1331
1334
|
if (typeof e == "number") return e;
|
|
1332
1335
|
const r = t.indexOf(e);
|
|
1333
1336
|
if (r >= 0) return r;
|
|
1334
|
-
const o =
|
|
1337
|
+
const o = Q(e);
|
|
1335
1338
|
if (o)
|
|
1336
|
-
for (let
|
|
1337
|
-
const p =
|
|
1338
|
-
if (p &&
|
|
1339
|
+
for (let c = 0; c < t.length; c++) {
|
|
1340
|
+
const p = Q(t[c]);
|
|
1341
|
+
if (p && or(o, p)) return c;
|
|
1339
1342
|
}
|
|
1340
|
-
const i =
|
|
1343
|
+
const i = we(e), a = t.map((c) => we(c)), s = a.indexOf(i);
|
|
1341
1344
|
if (s >= 0) return s;
|
|
1342
|
-
const f =
|
|
1343
|
-
let u = n,
|
|
1344
|
-
for (let
|
|
1345
|
-
const p =
|
|
1346
|
-
|
|
1345
|
+
const f = je(i);
|
|
1346
|
+
let u = n, h = 1 / 0;
|
|
1347
|
+
for (let c = 0; c < a.length; c++) {
|
|
1348
|
+
const p = je(a[c]), m = (f.r - p.r) ** 2 + (f.g - p.g) ** 2 + (f.b - p.b) ** 2;
|
|
1349
|
+
m < h && (h = m, u = c);
|
|
1347
1350
|
}
|
|
1348
1351
|
return u;
|
|
1349
1352
|
}
|
|
1350
|
-
function
|
|
1353
|
+
function je(e) {
|
|
1351
1354
|
const t = e.replace("#", "");
|
|
1352
1355
|
return {
|
|
1353
1356
|
r: parseInt(t.substring(0, 2), 16) || 0,
|
|
@@ -1356,7 +1359,7 @@ function Ve(e) {
|
|
|
1356
1359
|
aa: t.length >= 8 ? parseInt(t.substring(6, 8), 16) || 0 : 255
|
|
1357
1360
|
};
|
|
1358
1361
|
}
|
|
1359
|
-
function
|
|
1362
|
+
function mt(e = M(), t) {
|
|
1360
1363
|
const n = e.panelSettings, r = t !== void 0 && t.applySink !== void 0;
|
|
1361
1364
|
if (n.colorMode && !r) {
|
|
1362
1365
|
const o = document.documentElement.getAttribute("data-theme");
|
|
@@ -1365,25 +1368,28 @@ function dt(e = b(), t) {
|
|
|
1365
1368
|
}
|
|
1366
1369
|
return n.colorScheme;
|
|
1367
1370
|
}
|
|
1368
|
-
function
|
|
1371
|
+
function ir(e = M(), t) {
|
|
1369
1372
|
const n = e.colorSchemes;
|
|
1370
1373
|
if (Object.keys(n).length === 0)
|
|
1371
|
-
return
|
|
1372
|
-
const r =
|
|
1373
|
-
return
|
|
1374
|
+
return ae(e);
|
|
1375
|
+
const r = mt(e, t), o = n[r] ?? Object.values(n)[0];
|
|
1376
|
+
return sr(o, e);
|
|
1374
1377
|
}
|
|
1375
|
-
function
|
|
1376
|
-
return
|
|
1378
|
+
function De(e = M(), t) {
|
|
1379
|
+
return mt(e, t);
|
|
1377
1380
|
}
|
|
1378
|
-
function
|
|
1379
|
-
return
|
|
1381
|
+
function ar(e) {
|
|
1382
|
+
return F(e) || Q(e) ? e : we(e);
|
|
1380
1383
|
}
|
|
1381
|
-
function
|
|
1384
|
+
function sr(e, t = M()) {
|
|
1382
1385
|
if (t.paletteSize === 0)
|
|
1383
1386
|
return console.warn(
|
|
1384
1387
|
`[tweak] Scheme/preset load ignored for palette-less cluster "${t.id}" (paletteSize: 0) — schemes cannot seed a tier with no palette.`
|
|
1385
|
-
),
|
|
1386
|
-
const n = e.palette.map(
|
|
1388
|
+
), ae(t);
|
|
1389
|
+
const n = e.palette.map(ar);
|
|
1390
|
+
for (const [o, i] of Object.entries(t.paletteModes ?? {}))
|
|
1391
|
+
n[Number(o)] = `light-dark(${i.light}, ${i.dark})`;
|
|
1392
|
+
const r = {};
|
|
1387
1393
|
for (const [o, i] of Object.entries(t.semanticDefaults)) {
|
|
1388
1394
|
const a = e.semantic?.[o];
|
|
1389
1395
|
if (a === void 0)
|
|
@@ -1392,28 +1398,28 @@ function nr(e, t = b()) {
|
|
|
1392
1398
|
r[o] = a;
|
|
1393
1399
|
else {
|
|
1394
1400
|
const s = typeof i == "number" ? i : 0;
|
|
1395
|
-
r[o] =
|
|
1401
|
+
r[o] = T(a, e.palette, s);
|
|
1396
1402
|
}
|
|
1397
1403
|
}
|
|
1398
1404
|
return {
|
|
1399
1405
|
palette: n,
|
|
1400
|
-
background:
|
|
1406
|
+
background: T(
|
|
1401
1407
|
e.background,
|
|
1402
1408
|
e.palette,
|
|
1403
1409
|
t.baseDefaults.background ?? 0
|
|
1404
1410
|
),
|
|
1405
|
-
foreground:
|
|
1411
|
+
foreground: T(
|
|
1406
1412
|
e.foreground,
|
|
1407
1413
|
e.palette,
|
|
1408
1414
|
t.baseDefaults.foreground ?? 0
|
|
1409
1415
|
),
|
|
1410
|
-
cursor:
|
|
1411
|
-
selectionBg:
|
|
1416
|
+
cursor: T(e.cursor, e.palette, t.baseDefaults.cursor ?? 0),
|
|
1417
|
+
selectionBg: T(
|
|
1412
1418
|
e.selectionBg,
|
|
1413
1419
|
e.palette,
|
|
1414
1420
|
t.baseDefaults.selectionBg ?? 0
|
|
1415
1421
|
),
|
|
1416
|
-
selectionFg:
|
|
1422
|
+
selectionFg: T(
|
|
1417
1423
|
e.selectionFg,
|
|
1418
1424
|
e.palette,
|
|
1419
1425
|
t.baseDefaults.selectionFg ?? 0
|
|
@@ -1422,75 +1428,111 @@ function nr(e, t = b()) {
|
|
|
1422
1428
|
shikiTheme: String(e.shikiTheme ?? t.defaultShikiTheme)
|
|
1423
1429
|
};
|
|
1424
1430
|
}
|
|
1425
|
-
function
|
|
1431
|
+
function fr(e, t, n, r) {
|
|
1426
1432
|
const o = t.length;
|
|
1427
|
-
return e === "bg" ? t[
|
|
1433
|
+
return e === "bg" ? t[H(n, o)] ?? "#000000" : e === "fg" ? t[H(r, o)] ?? "#ffffff" : t[H(e, o)] ?? "#000000";
|
|
1428
1434
|
}
|
|
1429
|
-
function
|
|
1435
|
+
function H(e, t) {
|
|
1430
1436
|
return e >= 0 && e < t ? e : 0;
|
|
1431
1437
|
}
|
|
1432
|
-
function
|
|
1433
|
-
if (
|
|
1434
|
-
if (
|
|
1438
|
+
function $e(e, t, n, r, o, i, a) {
|
|
1439
|
+
if (Un(e)) return fr(e, t, n, r);
|
|
1440
|
+
if (ee(e) && ve(e))
|
|
1435
1441
|
return a ? e.literal[a] : `light-dark(${e.literal.light}, ${e.literal.dark})`;
|
|
1436
|
-
if (
|
|
1437
|
-
if (
|
|
1442
|
+
if (ee(e) && !ve(e)) return e.literal;
|
|
1443
|
+
if (Zn(e) && o)
|
|
1438
1444
|
try {
|
|
1439
|
-
return `var(${
|
|
1445
|
+
return `var(${Ht(e.ref, o, i ?? [o])})`;
|
|
1440
1446
|
} catch {
|
|
1441
1447
|
return null;
|
|
1442
1448
|
}
|
|
1443
1449
|
return null;
|
|
1444
1450
|
}
|
|
1445
|
-
function
|
|
1451
|
+
function lr(e) {
|
|
1446
1452
|
const t = e.panelSettings.colorMode;
|
|
1447
1453
|
return t ? t.defaultMode : "light";
|
|
1448
1454
|
}
|
|
1449
|
-
function
|
|
1455
|
+
function Gr(e, t) {
|
|
1450
1456
|
return e.literal[t];
|
|
1451
1457
|
}
|
|
1452
|
-
function
|
|
1453
|
-
return
|
|
1458
|
+
function qr(e, t, n = M(), r, o) {
|
|
1459
|
+
return $e(
|
|
1454
1460
|
e,
|
|
1455
1461
|
t.palette,
|
|
1456
1462
|
t.background,
|
|
1457
1463
|
t.foreground,
|
|
1458
1464
|
r,
|
|
1459
1465
|
o,
|
|
1460
|
-
|
|
1466
|
+
lr(n)
|
|
1461
1467
|
) ?? "#000000";
|
|
1462
1468
|
}
|
|
1463
|
-
const
|
|
1464
|
-
function
|
|
1469
|
+
const x = "color-scheme", A = "light dark";
|
|
1470
|
+
function Ee(e) {
|
|
1471
|
+
const t = document.documentElement.style, n = t.getPropertyValue(x), r = n === A && t.getPropertyPriority(x) === "";
|
|
1472
|
+
e && !r && R(e), n === "" && (P(x, A), e && ne(e));
|
|
1473
|
+
}
|
|
1474
|
+
function se(e) {
|
|
1475
|
+
return e.some(
|
|
1476
|
+
(t) => t.tiers.some(
|
|
1477
|
+
(n) => n.items.some((r) => !r.readonly && r.modes !== void 0)
|
|
1478
|
+
)
|
|
1479
|
+
);
|
|
1480
|
+
}
|
|
1481
|
+
function ur(e = g(), t = !1) {
|
|
1482
|
+
const n = [];
|
|
1483
|
+
for (const r of e.tabs)
|
|
1484
|
+
if (!(t && r.id !== "color" && r.id !== "color-secondary"))
|
|
1485
|
+
for (const o of r.tiers)
|
|
1486
|
+
for (const i of o.items) {
|
|
1487
|
+
if (i.readonly || !i.modes) continue;
|
|
1488
|
+
const a = ge(r, o.id, i.id, {});
|
|
1489
|
+
n.push([i.cssVar, me(a)]);
|
|
1490
|
+
}
|
|
1491
|
+
if (n.length !== 0)
|
|
1492
|
+
if (e.applySink) {
|
|
1493
|
+
n.push([x, A]);
|
|
1494
|
+
try {
|
|
1495
|
+
e.applySink.apply(n), ne(e.storagePrefix);
|
|
1496
|
+
} catch (r) {
|
|
1497
|
+
console.warn("[design-token-panel] applySink.apply threw; falling back silently.", r);
|
|
1498
|
+
}
|
|
1499
|
+
} else {
|
|
1500
|
+
for (const [r, o] of n) P(r, o);
|
|
1501
|
+
Ee(e.storagePrefix);
|
|
1502
|
+
}
|
|
1503
|
+
}
|
|
1504
|
+
function te(e, t) {
|
|
1505
|
+
if (e.palette.some((n) => F(n) !== null)) return !0;
|
|
1465
1506
|
for (const n of Object.keys(t.semanticCssNames)) {
|
|
1466
1507
|
const r = e.semanticMappings[n] ?? t.semanticDefaults[n];
|
|
1467
|
-
if (r !== void 0 &&
|
|
1508
|
+
if (r !== void 0 && ve(r) || ee(r) && typeof r.literal == "string" && F(r.literal))
|
|
1509
|
+
return !0;
|
|
1468
1510
|
}
|
|
1469
1511
|
return !1;
|
|
1470
1512
|
}
|
|
1471
|
-
function
|
|
1513
|
+
function Ke(e, t = M(), n, r, o, i) {
|
|
1472
1514
|
const a = e.palette.length;
|
|
1473
1515
|
if (n) {
|
|
1474
1516
|
const s = [];
|
|
1475
1517
|
for (let f = 0; f < a; f++)
|
|
1476
|
-
s.push([
|
|
1518
|
+
s.push([J(t, f), e.palette[f]]);
|
|
1477
1519
|
for (const [f, u] of Object.entries(t.baseRoles)) {
|
|
1478
1520
|
if (typeof u != "string" || u.length === 0) continue;
|
|
1479
|
-
const
|
|
1480
|
-
typeof
|
|
1521
|
+
const h = e[f];
|
|
1522
|
+
typeof h == "number" && s.push([u, e.palette[H(h, a)]]);
|
|
1481
1523
|
}
|
|
1482
1524
|
for (const [f, u] of Object.entries(t.semanticCssNames)) {
|
|
1483
|
-
const
|
|
1484
|
-
|
|
1525
|
+
const h = e.semanticMappings[f] ?? t.semanticDefaults[f], c = $e(
|
|
1526
|
+
h,
|
|
1485
1527
|
e.palette,
|
|
1486
1528
|
e.background,
|
|
1487
1529
|
e.foreground,
|
|
1488
1530
|
r,
|
|
1489
1531
|
o
|
|
1490
1532
|
);
|
|
1491
|
-
|
|
1533
|
+
c !== null && s.push([u, c]);
|
|
1492
1534
|
}
|
|
1493
|
-
|
|
1535
|
+
te(e, t) && (s.push([x, A]), i && ne(i));
|
|
1494
1536
|
try {
|
|
1495
1537
|
n.apply(s);
|
|
1496
1538
|
} catch (f) {
|
|
@@ -1499,14 +1541,14 @@ function ze(e, t = b(), n, r, o, i) {
|
|
|
1499
1541
|
return;
|
|
1500
1542
|
}
|
|
1501
1543
|
for (let s = 0; s < a; s++)
|
|
1502
|
-
|
|
1544
|
+
P(J(t, s), e.palette[s]);
|
|
1503
1545
|
for (const [s, f] of Object.entries(t.baseRoles)) {
|
|
1504
1546
|
if (typeof f != "string" || f.length === 0) continue;
|
|
1505
1547
|
const u = e[s];
|
|
1506
|
-
typeof u == "number" &&
|
|
1548
|
+
typeof u == "number" && P(f, e.palette[H(u, a)]);
|
|
1507
1549
|
}
|
|
1508
1550
|
for (const [s, f] of Object.entries(t.semanticCssNames)) {
|
|
1509
|
-
const u = e.semanticMappings[s] ?? t.semanticDefaults[s],
|
|
1551
|
+
const u = e.semanticMappings[s] ?? t.semanticDefaults[s], h = $e(
|
|
1510
1552
|
u,
|
|
1511
1553
|
e.palette,
|
|
1512
1554
|
e.background,
|
|
@@ -1514,118 +1556,126 @@ function ze(e, t = b(), n, r, o, i) {
|
|
|
1514
1556
|
r,
|
|
1515
1557
|
o
|
|
1516
1558
|
);
|
|
1517
|
-
|
|
1559
|
+
h !== null && P(f, h);
|
|
1518
1560
|
}
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
if (s && t) {
|
|
1530
|
-
const u = r.tabs.find((d) => d.id === "color-secondary");
|
|
1531
|
-
ze(
|
|
1561
|
+
te(e, t) && Ee(i);
|
|
1562
|
+
}
|
|
1563
|
+
function cr(e, t, n, r = !0) {
|
|
1564
|
+
const o = n ?? g(), i = o.applySink, a = o.tabs.find((c) => c.id === "color"), s = M(o);
|
|
1565
|
+
Ke(e, s, i, a, o.tabs, o.storagePrefix);
|
|
1566
|
+
const f = re(o);
|
|
1567
|
+
let u = !1;
|
|
1568
|
+
if (f && t) {
|
|
1569
|
+
const c = o.tabs.find((p) => p.id === "color-secondary");
|
|
1570
|
+
Ke(
|
|
1532
1571
|
t,
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
),
|
|
1572
|
+
f,
|
|
1573
|
+
i,
|
|
1574
|
+
c,
|
|
1575
|
+
o.tabs,
|
|
1576
|
+
o.storagePrefix
|
|
1577
|
+
), u = te(t, f);
|
|
1539
1578
|
}
|
|
1540
|
-
|
|
1541
|
-
|
|
1579
|
+
const h = r && se(
|
|
1580
|
+
o.tabs.filter((c) => c.id !== "color" && c.id !== "color-secondary")
|
|
1581
|
+
);
|
|
1582
|
+
if (!te(e, s) && !u && !h)
|
|
1583
|
+
if (i) {
|
|
1542
1584
|
try {
|
|
1543
|
-
|
|
1544
|
-
} catch (
|
|
1545
|
-
console.warn("[design-token-panel] applySink.clear threw; falling back silently.",
|
|
1585
|
+
i.clear([x]);
|
|
1586
|
+
} catch (c) {
|
|
1587
|
+
console.warn("[design-token-panel] applySink.clear threw; falling back silently.", c);
|
|
1546
1588
|
}
|
|
1547
|
-
|
|
1589
|
+
R(o.storagePrefix);
|
|
1548
1590
|
} else
|
|
1549
|
-
|
|
1591
|
+
He(o.storagePrefix);
|
|
1550
1592
|
}
|
|
1551
|
-
function
|
|
1593
|
+
function Jr(e, t) {
|
|
1552
1594
|
const n = t ?? g();
|
|
1553
|
-
|
|
1554
|
-
}
|
|
1555
|
-
function ar(e, t) {
|
|
1556
|
-
const n = t ?? g(), r = n.applySink;
|
|
1557
|
-
if (j(n.tabs, "spacing", e.spacing, r), j(n.tabs, "font", e.typography, r), j(n.tabs, "size", e.size, r), e.tabs)
|
|
1558
|
-
for (const [o, i] of Object.entries(e.tabs)) {
|
|
1559
|
-
const a = {};
|
|
1560
|
-
for (const s of Object.values(i))
|
|
1561
|
-
for (const [f, u] of Object.entries(s))
|
|
1562
|
-
a[f] = u;
|
|
1563
|
-
j(n.tabs, o, a, r);
|
|
1564
|
-
}
|
|
1595
|
+
cr(e.color, e.secondary, n, !1), yt(e, n);
|
|
1565
1596
|
}
|
|
1566
|
-
function
|
|
1567
|
-
const
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1597
|
+
function Wr(e, t) {
|
|
1598
|
+
const n = t ?? g();
|
|
1599
|
+
ur(n, !0), yt(e, n);
|
|
1600
|
+
}
|
|
1601
|
+
function yt(e, t) {
|
|
1602
|
+
const n = t.applySink;
|
|
1603
|
+
B(t.tabs, "spacing", e.spacing, n, t.storagePrefix), B(t.tabs, "font", e.typography, n, t.storagePrefix), B(t.tabs, "size", e.size, n, t.storagePrefix);
|
|
1604
|
+
for (const r of t.tabs) {
|
|
1605
|
+
if (["color", "color-secondary", "spacing", "font", "size"].includes(r.id)) continue;
|
|
1606
|
+
const o = e.tabs?.[r.id] === void 0;
|
|
1607
|
+
if (o && !se([r])) continue;
|
|
1608
|
+
const i = {};
|
|
1609
|
+
for (const a of Object.values(e.tabs?.[r.id] ?? {}))
|
|
1610
|
+
for (const [s, f] of Object.entries(a))
|
|
1611
|
+
i[s] = f;
|
|
1612
|
+
B(t.tabs, r.id, i, n, t.storagePrefix, o);
|
|
1613
|
+
}
|
|
1614
|
+
}
|
|
1615
|
+
function B(e, t, n, r, o, i = !1) {
|
|
1616
|
+
const a = e.find((u) => u.id === t);
|
|
1617
|
+
if (!a) return;
|
|
1618
|
+
const s = {};
|
|
1619
|
+
for (const u of a.tiers) {
|
|
1620
|
+
const h = {};
|
|
1621
|
+
for (const c of u.items) {
|
|
1622
|
+
const p = n[c.id];
|
|
1623
|
+
typeof p == "string" && p.length > 0 && (h[c.id] = p);
|
|
1575
1624
|
}
|
|
1576
|
-
|
|
1625
|
+
s[u.id] = h;
|
|
1577
1626
|
}
|
|
1578
1627
|
if (r) {
|
|
1579
|
-
const
|
|
1580
|
-
for (const
|
|
1581
|
-
for (const
|
|
1582
|
-
if (!
|
|
1628
|
+
const u = [], h = [];
|
|
1629
|
+
for (const p of a.tiers)
|
|
1630
|
+
for (const m of p.items)
|
|
1631
|
+
if (!(m.readonly || i && !m.modes))
|
|
1583
1632
|
try {
|
|
1584
|
-
const
|
|
1585
|
-
typeof n[
|
|
1633
|
+
const S = ge(a, p.id, m.id, s), C = me(S);
|
|
1634
|
+
typeof n[m.id] == "string" && n[m.id].length > 0 || m.modes || p.referencesTier !== void 0 ? u.push([m.cssVar, C]) : h.push(m.cssVar);
|
|
1586
1635
|
} catch {
|
|
1587
|
-
|
|
1636
|
+
h.push(m.cssVar);
|
|
1588
1637
|
}
|
|
1589
|
-
|
|
1638
|
+
const c = u.some(([, p]) => F(p) !== null);
|
|
1639
|
+
if (c && u.push([x, A]), u.length > 0)
|
|
1590
1640
|
try {
|
|
1591
|
-
r.apply(
|
|
1592
|
-
} catch (
|
|
1593
|
-
console.warn("[design-token-panel] applySink.apply threw; falling back silently.",
|
|
1641
|
+
r.apply(u), c && o && ne(o);
|
|
1642
|
+
} catch (p) {
|
|
1643
|
+
console.warn("[design-token-panel] applySink.apply threw; falling back silently.", p);
|
|
1594
1644
|
}
|
|
1595
|
-
if (
|
|
1645
|
+
if (h.length > 0)
|
|
1596
1646
|
try {
|
|
1597
|
-
r.clear(
|
|
1598
|
-
} catch (
|
|
1599
|
-
console.warn("[design-token-panel] applySink.clear threw; falling back silently.",
|
|
1647
|
+
r.clear(h);
|
|
1648
|
+
} catch (p) {
|
|
1649
|
+
console.warn("[design-token-panel] applySink.clear threw; falling back silently.", p);
|
|
1600
1650
|
}
|
|
1601
1651
|
return;
|
|
1602
1652
|
}
|
|
1603
|
-
const
|
|
1604
|
-
for (const
|
|
1605
|
-
for (const
|
|
1606
|
-
if (!
|
|
1653
|
+
const f = document.documentElement;
|
|
1654
|
+
for (const u of a.tiers)
|
|
1655
|
+
for (const h of u.items)
|
|
1656
|
+
if (!(h.readonly || i && !h.modes))
|
|
1607
1657
|
try {
|
|
1608
|
-
const
|
|
1609
|
-
typeof n[
|
|
1658
|
+
const c = ge(a, u.id, h.id, s), p = me(c);
|
|
1659
|
+
typeof n[h.id] == "string" && n[h.id].length > 0 || h.modes || u.referencesTier !== void 0 ? (P(h.cssVar, p), F(p) && Ee(o)) : f.style.removeProperty(h.cssVar);
|
|
1610
1660
|
} catch {
|
|
1611
|
-
|
|
1661
|
+
f.style.removeProperty(h.cssVar);
|
|
1612
1662
|
}
|
|
1613
1663
|
}
|
|
1614
|
-
function
|
|
1615
|
-
const t = e ?? g(), n =
|
|
1664
|
+
function bt(e) {
|
|
1665
|
+
const t = e ?? g(), n = M(t), r = re(t);
|
|
1616
1666
|
return r ? [n, r] : [n];
|
|
1617
1667
|
}
|
|
1618
|
-
function
|
|
1668
|
+
function xt(e) {
|
|
1619
1669
|
const t = [];
|
|
1620
1670
|
for (let n = 0; n < e.paletteSize; n++)
|
|
1621
|
-
t.push(
|
|
1671
|
+
t.push(J(e, n));
|
|
1622
1672
|
for (const n of Object.values(e.baseRoles))
|
|
1623
1673
|
typeof n == "string" && n.length > 0 && t.push(n);
|
|
1624
1674
|
for (const n of Object.values(e.semanticCssNames))
|
|
1625
1675
|
t.push(n);
|
|
1626
1676
|
return t;
|
|
1627
1677
|
}
|
|
1628
|
-
function
|
|
1678
|
+
function dr(e) {
|
|
1629
1679
|
const t = [];
|
|
1630
1680
|
for (const n of e.tabs)
|
|
1631
1681
|
if (!(n.id === "color" || n.id === "color-secondary"))
|
|
@@ -1634,69 +1684,76 @@ function sr(e) {
|
|
|
1634
1684
|
o.readonly || t.push(o.cssVar);
|
|
1635
1685
|
return t;
|
|
1636
1686
|
}
|
|
1637
|
-
function
|
|
1638
|
-
if (!
|
|
1687
|
+
function He(e) {
|
|
1688
|
+
if (!Et(e)) return;
|
|
1639
1689
|
const t = document.documentElement;
|
|
1640
|
-
t.style.getPropertyValue(
|
|
1690
|
+
t.style.getPropertyValue(x) === A && t.style.getPropertyPriority(x) === "" && t.style.removeProperty(x), R(e);
|
|
1641
1691
|
}
|
|
1642
|
-
function
|
|
1643
|
-
const r =
|
|
1644
|
-
|
|
1692
|
+
function Xr(e, t, n) {
|
|
1693
|
+
const r = bt(n), o = n?.applySink, i = n ?? g(), a = se(
|
|
1694
|
+
i.tabs.filter((s) => s.id !== "color" && s.id !== "color-secondary")
|
|
1695
|
+
);
|
|
1696
|
+
return Mt(
|
|
1697
|
+
r,
|
|
1698
|
+
o,
|
|
1699
|
+
i.storagePrefix,
|
|
1700
|
+
a
|
|
1701
|
+
);
|
|
1645
1702
|
}
|
|
1646
|
-
function
|
|
1703
|
+
function Mt(e, t, n, r = !1) {
|
|
1647
1704
|
if (t) {
|
|
1648
|
-
const
|
|
1649
|
-
for (const
|
|
1650
|
-
|
|
1651
|
-
if (e.length > 0 &&
|
|
1705
|
+
const i = [];
|
|
1706
|
+
for (const a of e)
|
|
1707
|
+
i.push(...xt(a));
|
|
1708
|
+
if (e.length > 0 && !r && i.push(x), i.length > 0)
|
|
1652
1709
|
try {
|
|
1653
|
-
t.clear(
|
|
1654
|
-
} catch (
|
|
1655
|
-
console.warn("[design-token-panel] applySink.clear threw; falling back silently.",
|
|
1710
|
+
t.clear(i);
|
|
1711
|
+
} catch (a) {
|
|
1712
|
+
console.warn("[design-token-panel] applySink.clear threw; falling back silently.", a);
|
|
1656
1713
|
}
|
|
1657
|
-
n && e.length > 0 &&
|
|
1714
|
+
n && e.length > 0 && !r && R(n);
|
|
1658
1715
|
return;
|
|
1659
1716
|
}
|
|
1660
|
-
const
|
|
1661
|
-
for (const
|
|
1662
|
-
for (let
|
|
1663
|
-
|
|
1664
|
-
for (const
|
|
1665
|
-
|
|
1666
|
-
for (const
|
|
1667
|
-
|
|
1717
|
+
const o = document.documentElement;
|
|
1718
|
+
for (const i of e) {
|
|
1719
|
+
for (let a = 0; a < i.paletteSize; a++)
|
|
1720
|
+
o.style.removeProperty(J(i, a));
|
|
1721
|
+
for (const a of Object.values(i.baseRoles))
|
|
1722
|
+
o.style.removeProperty(a);
|
|
1723
|
+
for (const a of Object.values(i.semanticCssNames))
|
|
1724
|
+
o.style.removeProperty(a);
|
|
1668
1725
|
}
|
|
1669
|
-
e.length > 0 && n &&
|
|
1726
|
+
e.length > 0 && n && !r && He(n);
|
|
1670
1727
|
}
|
|
1671
|
-
function
|
|
1672
|
-
const n = t ?? g(), r = n.applySink, o =
|
|
1728
|
+
function Yr(e, t) {
|
|
1729
|
+
const n = t ?? g(), r = n.applySink, o = bt(n), i = o.length > 0 || se(n.tabs);
|
|
1673
1730
|
if (r) {
|
|
1674
|
-
const
|
|
1675
|
-
for (const
|
|
1676
|
-
|
|
1677
|
-
if (
|
|
1731
|
+
const s = [];
|
|
1732
|
+
for (const f of o)
|
|
1733
|
+
s.push(...xt(f));
|
|
1734
|
+
if (i && s.push(x), s.push(...dr(n)), s.length > 0)
|
|
1678
1735
|
try {
|
|
1679
|
-
r.clear(
|
|
1680
|
-
} catch (
|
|
1681
|
-
console.warn("[design-token-panel] applySink.clear threw; falling back silently.",
|
|
1736
|
+
r.clear([...new Set(s)]);
|
|
1737
|
+
} catch (f) {
|
|
1738
|
+
console.warn("[design-token-panel] applySink.clear threw; falling back silently.", f);
|
|
1682
1739
|
}
|
|
1683
|
-
|
|
1740
|
+
i && R(n.storagePrefix);
|
|
1684
1741
|
return;
|
|
1685
1742
|
}
|
|
1686
|
-
|
|
1687
|
-
const
|
|
1688
|
-
for (const
|
|
1689
|
-
if (!(
|
|
1690
|
-
for (const
|
|
1691
|
-
for (const
|
|
1692
|
-
|
|
1693
|
-
}
|
|
1694
|
-
function
|
|
1743
|
+
Mt(o, void 0, n.storagePrefix), i && He(n.storagePrefix);
|
|
1744
|
+
const a = document.documentElement;
|
|
1745
|
+
for (const s of n.tabs)
|
|
1746
|
+
if (!(s.id === "color" || s.id === "color-secondary"))
|
|
1747
|
+
for (const f of s.tiers)
|
|
1748
|
+
for (const u of f.items)
|
|
1749
|
+
u.readonly || a.style.removeProperty(u.cssVar);
|
|
1750
|
+
}
|
|
1751
|
+
function kt(e, t) {
|
|
1695
1752
|
if (!e || typeof e != "object") return !1;
|
|
1696
1753
|
const n = e;
|
|
1697
1754
|
return Array.isArray(n.palette) && n.palette.length === t && typeof n.background == "number" && typeof n.foreground == "number" && typeof n.cursor == "number" && typeof n.selectionBg == "number" && typeof n.selectionFg == "number" && typeof n.semanticMappings == "object" && n.semanticMappings !== null;
|
|
1698
1755
|
}
|
|
1699
|
-
function
|
|
1756
|
+
function hr(e, t) {
|
|
1700
1757
|
if (typeof e == "number")
|
|
1701
1758
|
return Number.isInteger(e) && e >= 0 && e < t ? e : void 0;
|
|
1702
1759
|
if (e === "bg" || e === "fg") return e;
|
|
@@ -1728,16 +1785,16 @@ function ur(e, t) {
|
|
|
1728
1785
|
return;
|
|
1729
1786
|
}
|
|
1730
1787
|
}
|
|
1731
|
-
function
|
|
1788
|
+
function pr(e, t, n) {
|
|
1732
1789
|
if (!e || typeof e != "object" || Array.isArray(e)) return { ...t };
|
|
1733
1790
|
const r = { ...t };
|
|
1734
1791
|
for (const [o, i] of Object.entries(e)) {
|
|
1735
|
-
const a =
|
|
1792
|
+
const a = hr(i, n);
|
|
1736
1793
|
a !== void 0 && (r[o] = a);
|
|
1737
1794
|
}
|
|
1738
1795
|
return r;
|
|
1739
1796
|
}
|
|
1740
|
-
function
|
|
1797
|
+
function Ne(e, t, n) {
|
|
1741
1798
|
const r = Array.isArray(e.palette) ? e.palette : null;
|
|
1742
1799
|
let o;
|
|
1743
1800
|
return r && r.length === t.palette.length && r.every((i) => typeof i == "string") ? o = r : (r && r.some((i) => typeof i != "string") && console.error(
|
|
@@ -1749,7 +1806,7 @@ function ke(e, t, n) {
|
|
|
1749
1806
|
cursor: typeof e.cursor == "number" ? e.cursor : t.cursor,
|
|
1750
1807
|
selectionBg: typeof e.selectionBg == "number" ? e.selectionBg : t.selectionBg,
|
|
1751
1808
|
selectionFg: typeof e.selectionFg == "number" ? e.selectionFg : t.selectionFg,
|
|
1752
|
-
semanticMappings:
|
|
1809
|
+
semanticMappings: pr(
|
|
1753
1810
|
e.semanticMappings,
|
|
1754
1811
|
t.semanticMappings,
|
|
1755
1812
|
n
|
|
@@ -1757,7 +1814,7 @@ function ke(e, t, n) {
|
|
|
1757
1814
|
shikiTheme: typeof e.shikiTheme == "string" && e.shikiTheme.length > 0 ? e.shikiTheme : t.shikiTheme
|
|
1758
1815
|
};
|
|
1759
1816
|
}
|
|
1760
|
-
const
|
|
1817
|
+
const Ur = {
|
|
1761
1818
|
"text-caption": "text-xs",
|
|
1762
1819
|
"text-small": "text-sm",
|
|
1763
1820
|
"text-body": "text-base",
|
|
@@ -1767,14 +1824,14 @@ const Gr = {
|
|
|
1767
1824
|
// Dropped — no main-site equivalent. `null` signals "discard".
|
|
1768
1825
|
"text-micro": null
|
|
1769
1826
|
};
|
|
1770
|
-
function
|
|
1827
|
+
function Be(e) {
|
|
1771
1828
|
if (!e || typeof e != "object") return {};
|
|
1772
1829
|
const t = {};
|
|
1773
1830
|
for (const [n, r] of Object.entries(e))
|
|
1774
1831
|
typeof r == "string" && (t[n] = r);
|
|
1775
1832
|
return t;
|
|
1776
1833
|
}
|
|
1777
|
-
function
|
|
1834
|
+
function gr(e, t = {}) {
|
|
1778
1835
|
if (!e || typeof e != "object") return {};
|
|
1779
1836
|
const n = {};
|
|
1780
1837
|
for (const [r, o] of Object.entries(e))
|
|
@@ -1787,7 +1844,7 @@ function dr(e, t = {}) {
|
|
|
1787
1844
|
n[r] = o;
|
|
1788
1845
|
return n;
|
|
1789
1846
|
}
|
|
1790
|
-
function
|
|
1847
|
+
function mr(e) {
|
|
1791
1848
|
if (!e || typeof e != "object" || Array.isArray(e)) return {};
|
|
1792
1849
|
const t = {};
|
|
1793
1850
|
for (const [n, r] of Object.entries(e)) {
|
|
@@ -1804,36 +1861,36 @@ function hr(e) {
|
|
|
1804
1861
|
}
|
|
1805
1862
|
return t;
|
|
1806
1863
|
}
|
|
1807
|
-
function
|
|
1864
|
+
function Ce(e, t, n, r = g()) {
|
|
1808
1865
|
if (!e.color || typeof e.color != "object") return null;
|
|
1809
|
-
const o = n ??
|
|
1810
|
-
color:
|
|
1866
|
+
const o = n ?? ze(t, r), i = e.typography !== void 0 ? e.typography : e.font, a = r.legacyIdRenameMap ?? {}, s = {
|
|
1867
|
+
color: Ne(e.color, o, t.paletteSize),
|
|
1811
1868
|
// New sections added after v1 migration — tolerate their absence so
|
|
1812
1869
|
// older v2 payloads (Color-only) still load cleanly.
|
|
1813
|
-
spacing:
|
|
1870
|
+
spacing: Be(e.spacing),
|
|
1814
1871
|
// Typography slice: apply the host-configured rename map (if any)
|
|
1815
1872
|
// so payloads persisted under the host's "old" ids survive a
|
|
1816
1873
|
// host-driven id rename without losing the user's tweaks.
|
|
1817
|
-
typography:
|
|
1818
|
-
size:
|
|
1819
|
-
}, f =
|
|
1820
|
-
f && e.secondary &&
|
|
1874
|
+
typography: gr(i, a),
|
|
1875
|
+
size: Be(e.size)
|
|
1876
|
+
}, f = re(r);
|
|
1877
|
+
f && e.secondary && kt(e.secondary, f.paletteSize) && (s.secondary = Ne(
|
|
1821
1878
|
e.secondary,
|
|
1822
|
-
|
|
1879
|
+
ae(f),
|
|
1823
1880
|
f.paletteSize
|
|
1824
1881
|
));
|
|
1825
|
-
const u =
|
|
1882
|
+
const u = mr(e.tabs);
|
|
1826
1883
|
return Object.keys(u).length > 0 && (s.tabs = u), s;
|
|
1827
1884
|
}
|
|
1828
|
-
function
|
|
1829
|
-
const o =
|
|
1885
|
+
function yr(e = localStorage, t, n = M(), r = g()) {
|
|
1886
|
+
const o = st(r), i = ft(r), a = lt(r), s = V(e, a);
|
|
1830
1887
|
if (s !== null) {
|
|
1831
|
-
const
|
|
1832
|
-
if (
|
|
1833
|
-
const
|
|
1888
|
+
const h = q(s);
|
|
1889
|
+
if (h && typeof h == "object") {
|
|
1890
|
+
const c = h, p = Ce(c, n, t, r);
|
|
1834
1891
|
if (p !== null) {
|
|
1835
|
-
const
|
|
1836
|
-
if (S ||
|
|
1892
|
+
const m = c.typography !== void 0 ? c.typography : c.font, S = JSON.stringify(m ?? {}) !== JSON.stringify(p.typography), C = c.color, y = Array.isArray(C?.palette) && C.palette.length !== n.paletteSize;
|
|
1893
|
+
if (S || c.typography === void 0 || y)
|
|
1837
1894
|
try {
|
|
1838
1895
|
e.setItem(a, JSON.stringify(p));
|
|
1839
1896
|
} catch {
|
|
@@ -1843,11 +1900,11 @@ function pr(e = localStorage, t, n = b(), r = g()) {
|
|
|
1843
1900
|
}
|
|
1844
1901
|
console.warn(`[tweak] Malformed ${a}, attempting v2 migration`);
|
|
1845
1902
|
}
|
|
1846
|
-
const f =
|
|
1903
|
+
const f = V(e, i);
|
|
1847
1904
|
if (f !== null) {
|
|
1848
|
-
const
|
|
1849
|
-
if (
|
|
1850
|
-
const p =
|
|
1905
|
+
const h = q(f);
|
|
1906
|
+
if (h && typeof h == "object") {
|
|
1907
|
+
const p = Ce(h, n, t, r);
|
|
1851
1908
|
if (p !== null) {
|
|
1852
1909
|
try {
|
|
1853
1910
|
e.setItem(a, JSON.stringify(p)), e.removeItem(i);
|
|
@@ -1858,17 +1915,17 @@ function pr(e = localStorage, t, n = b(), r = g()) {
|
|
|
1858
1915
|
}
|
|
1859
1916
|
console.warn(`[tweak] Malformed ${i}, attempting v1 migration`);
|
|
1860
1917
|
}
|
|
1861
|
-
const u =
|
|
1918
|
+
const u = V(e, o);
|
|
1862
1919
|
if (u !== null) {
|
|
1863
|
-
const
|
|
1864
|
-
if (
|
|
1865
|
-
const
|
|
1866
|
-
p.shikiTheme || (p.shikiTheme =
|
|
1920
|
+
const h = q(u);
|
|
1921
|
+
if (h && typeof h == "object" && kt(h, n.paletteSize)) {
|
|
1922
|
+
const c = t ?? ze(n, r), p = h;
|
|
1923
|
+
p.shikiTheme || (p.shikiTheme = c.shikiTheme);
|
|
1867
1924
|
const S = {
|
|
1868
|
-
color:
|
|
1869
|
-
spacing:
|
|
1870
|
-
typography:
|
|
1871
|
-
size:
|
|
1925
|
+
color: Ne(p, c, n.paletteSize),
|
|
1926
|
+
spacing: pe(),
|
|
1927
|
+
typography: pe(),
|
|
1928
|
+
size: pe()
|
|
1872
1929
|
};
|
|
1873
1930
|
try {
|
|
1874
1931
|
e.setItem(a, JSON.stringify(S)), e.removeItem(o);
|
|
@@ -1884,24 +1941,24 @@ function pr(e = localStorage, t, n = b(), r = g()) {
|
|
|
1884
1941
|
}
|
|
1885
1942
|
return null;
|
|
1886
1943
|
}
|
|
1887
|
-
function
|
|
1888
|
-
const n =
|
|
1944
|
+
function Ve(e, t) {
|
|
1945
|
+
const n = V(e, z(t));
|
|
1889
1946
|
if (n === null) return null;
|
|
1890
|
-
const r =
|
|
1947
|
+
const r = q(n);
|
|
1891
1948
|
if (!r || typeof r != "object" || Array.isArray(r)) return null;
|
|
1892
1949
|
const o = r, i = o.color;
|
|
1893
1950
|
return !i || typeof i != "object" || Array.isArray(i) || Array.isArray(i.palette) ? null : o;
|
|
1894
1951
|
}
|
|
1895
|
-
function
|
|
1952
|
+
function Fe(e) {
|
|
1896
1953
|
const t = e?.color;
|
|
1897
1954
|
return t && typeof t == "object" && !Array.isArray(t) ? t : void 0;
|
|
1898
1955
|
}
|
|
1899
|
-
function
|
|
1956
|
+
function St(e) {
|
|
1900
1957
|
const t = e?.secondary;
|
|
1901
1958
|
return t && typeof t == "object" && !Array.isArray(t) ? t : void 0;
|
|
1902
1959
|
}
|
|
1903
|
-
function
|
|
1904
|
-
const o =
|
|
1960
|
+
function br(e, t, n, r) {
|
|
1961
|
+
const o = De(t, r), i = Fe(e)?.[o], a = i && typeof i == "object" && !Array.isArray(i) ? i : void 0, s = St(e)?.[o], f = n ?? ze(t, r), u = {
|
|
1905
1962
|
color: a ?? f,
|
|
1906
1963
|
secondary: s,
|
|
1907
1964
|
spacing: e.spacing,
|
|
@@ -1910,71 +1967,71 @@ function gr(e, t, n, r) {
|
|
|
1910
1967
|
size: e.size,
|
|
1911
1968
|
tabs: e.tabs
|
|
1912
1969
|
};
|
|
1913
|
-
return
|
|
1970
|
+
return Ce(u, t, f, r);
|
|
1914
1971
|
}
|
|
1915
|
-
function
|
|
1916
|
-
const r =
|
|
1972
|
+
function Zr(e = g(), t = M(e), n = localStorage) {
|
|
1973
|
+
const r = Ve(n, e);
|
|
1917
1974
|
if (!r) return !1;
|
|
1918
|
-
const o =
|
|
1975
|
+
const o = De(t, e), i = Fe(r)?.[o];
|
|
1919
1976
|
return !!i && typeof i == "object" && !Array.isArray(i);
|
|
1920
1977
|
}
|
|
1921
|
-
function
|
|
1922
|
-
const i =
|
|
1978
|
+
function vt(e, t, n, r, o) {
|
|
1979
|
+
const i = De(r, o), s = {
|
|
1923
1980
|
color: {
|
|
1924
|
-
...
|
|
1981
|
+
...Fe(t),
|
|
1925
1982
|
[i]: e.color
|
|
1926
1983
|
},
|
|
1927
1984
|
spacing: e.spacing,
|
|
1928
1985
|
typography: e.typography,
|
|
1929
1986
|
size: e.size
|
|
1930
|
-
}, f = { ...
|
|
1987
|
+
}, f = { ...St(t) };
|
|
1931
1988
|
e.secondary !== void 0 ? f[i] = e.secondary : delete f[i], Object.keys(f).length > 0 && (s.secondary = f), e.tabs && Object.keys(e.tabs).length > 0 && (s.tabs = e.tabs);
|
|
1932
1989
|
try {
|
|
1933
|
-
n.setItem(
|
|
1990
|
+
n.setItem(z(o), JSON.stringify(s));
|
|
1934
1991
|
} catch {
|
|
1935
1992
|
}
|
|
1936
1993
|
}
|
|
1937
|
-
function
|
|
1938
|
-
const o =
|
|
1994
|
+
function Qr(e = localStorage, t, n = M(), r = g()) {
|
|
1995
|
+
const o = Ve(e, r);
|
|
1939
1996
|
if (o !== null)
|
|
1940
|
-
return
|
|
1941
|
-
|
|
1942
|
-
const i =
|
|
1943
|
-
return i === null ? null : (
|
|
1997
|
+
return br(o, n, t, r);
|
|
1998
|
+
V(e, z(r)) !== null && console.warn(`[tweak] Malformed ${z(r)}, attempting v3/v2/v1 migration`);
|
|
1999
|
+
const i = yr(e, t, n, r);
|
|
2000
|
+
return i === null ? null : (vt(i, null, e, n, r), i);
|
|
1944
2001
|
}
|
|
1945
|
-
function
|
|
1946
|
-
const r =
|
|
1947
|
-
|
|
2002
|
+
function eo(e, t = localStorage, n = g()) {
|
|
2003
|
+
const r = M(n), o = Ve(t, n);
|
|
2004
|
+
vt(e, o, t, r, n);
|
|
1948
2005
|
}
|
|
1949
|
-
function
|
|
2006
|
+
function to(e = localStorage, t = g()) {
|
|
1950
2007
|
for (const n of [
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
2008
|
+
z(t),
|
|
2009
|
+
lt(t),
|
|
2010
|
+
ft(t),
|
|
2011
|
+
st(t)
|
|
1955
2012
|
])
|
|
1956
2013
|
try {
|
|
1957
2014
|
e.removeItem(n);
|
|
1958
2015
|
} catch {
|
|
1959
2016
|
}
|
|
1960
2017
|
}
|
|
1961
|
-
function
|
|
2018
|
+
function V(e, t) {
|
|
1962
2019
|
try {
|
|
1963
2020
|
return e.getItem(t);
|
|
1964
2021
|
} catch {
|
|
1965
2022
|
return null;
|
|
1966
2023
|
}
|
|
1967
2024
|
}
|
|
1968
|
-
function
|
|
2025
|
+
function q(e) {
|
|
1969
2026
|
try {
|
|
1970
2027
|
return JSON.parse(e);
|
|
1971
2028
|
} catch {
|
|
1972
2029
|
return null;
|
|
1973
2030
|
}
|
|
1974
2031
|
}
|
|
1975
|
-
function
|
|
2032
|
+
function ze(e, t) {
|
|
1976
2033
|
try {
|
|
1977
|
-
return
|
|
2034
|
+
return ir(e, t);
|
|
1978
2035
|
} catch {
|
|
1979
2036
|
return {
|
|
1980
2037
|
palette: Array.from(
|
|
@@ -1992,64 +2049,65 @@ function Pe(e, t) {
|
|
|
1992
2049
|
}
|
|
1993
2050
|
}
|
|
1994
2051
|
export {
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2052
|
+
Hr as $,
|
|
2053
|
+
Jr as A,
|
|
2054
|
+
eo as B,
|
|
2055
|
+
De as C,
|
|
2056
|
+
Kn as D,
|
|
2057
|
+
qn as E,
|
|
2058
|
+
Yn as F,
|
|
2059
|
+
jn as G,
|
|
2060
|
+
de as H,
|
|
2061
|
+
Vr as I,
|
|
2062
|
+
Er as J,
|
|
2063
|
+
jr as K,
|
|
2064
|
+
Rr as L,
|
|
2065
|
+
kr as M,
|
|
2066
|
+
_r as N,
|
|
2067
|
+
xe as O,
|
|
2068
|
+
Or as P,
|
|
2069
|
+
Lr as Q,
|
|
2070
|
+
Ar as R,
|
|
2071
|
+
Zr as S,
|
|
2072
|
+
Wr as T,
|
|
2073
|
+
ur as U,
|
|
2074
|
+
to as V,
|
|
2075
|
+
Yr as W,
|
|
2076
|
+
ir as X,
|
|
2077
|
+
zr as Y,
|
|
2078
|
+
Ur as Z,
|
|
2079
|
+
cr as _,
|
|
2080
|
+
st as a,
|
|
2081
|
+
Fr as a0,
|
|
2082
|
+
Dr as a1,
|
|
2083
|
+
Se as a2,
|
|
2084
|
+
pe as a3,
|
|
2085
|
+
z as a4,
|
|
2086
|
+
lt as a5,
|
|
2087
|
+
qr as a6,
|
|
2088
|
+
ft as b,
|
|
2089
|
+
ve as c,
|
|
2090
|
+
ee as d,
|
|
2091
|
+
Zn as e,
|
|
2092
|
+
M as f,
|
|
2093
|
+
Pr as g,
|
|
2094
|
+
sr as h,
|
|
2095
|
+
Un as i,
|
|
2096
|
+
Br as j,
|
|
2097
|
+
Ir as k,
|
|
2098
|
+
Qr as l,
|
|
2099
|
+
vr as m,
|
|
2100
|
+
ar as n,
|
|
2101
|
+
wr as o,
|
|
2102
|
+
$r as p,
|
|
2103
|
+
Cr as q,
|
|
2104
|
+
Sr as r,
|
|
2105
|
+
H as s,
|
|
2106
|
+
Nr as t,
|
|
2107
|
+
Tr as u,
|
|
2108
|
+
Q as v,
|
|
2109
|
+
Gr as w,
|
|
2110
|
+
lr as x,
|
|
2111
|
+
Kr as y,
|
|
2112
|
+
Xr as z
|
|
2055
2113
|
};
|