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