@burdenoff/fe-libs 2026.1119.5 → 2026.1119.6

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.
Files changed (69) hide show
  1. package/dist/chrome/HeaderThemeSwitcher.js +1 -1
  2. package/dist/chrome/ThemePreferences.js +16 -16
  3. package/dist/chrome/appearance/AppearanceColourSection.d.ts +17 -0
  4. package/dist/chrome/appearance/AppearanceColourSection.js +337 -0
  5. package/dist/chrome/appearance/AppearanceDisplaySection.d.ts +7 -0
  6. package/dist/chrome/appearance/AppearanceDisplaySection.js +137 -0
  7. package/dist/chrome/appearance/AppearanceModeDepth.d.ts +11 -0
  8. package/dist/chrome/appearance/AppearanceModeDepth.js +158 -0
  9. package/dist/chrome/appearance/AppearancePreferences.d.ts +13 -0
  10. package/dist/chrome/appearance/AppearancePreferences.js +308 -0
  11. package/dist/chrome/appearance/AppearancePreview.d.ts +23 -0
  12. package/dist/chrome/appearance/AppearancePreview.js +218 -0
  13. package/dist/chrome/appearance/AppearanceThemeSection.d.ts +14 -0
  14. package/dist/chrome/appearance/AppearanceThemeSection.js +162 -0
  15. package/dist/chrome/appearance/ColourPanel.d.ts +37 -0
  16. package/dist/chrome/appearance/ColourPanel.js +264 -0
  17. package/dist/chrome/appearance/ThemeDialog.d.ts +21 -0
  18. package/dist/chrome/appearance/ThemeDialog.js +378 -0
  19. package/dist/chrome/appearance/appearanceShared.d.ts +24 -0
  20. package/dist/chrome/appearance/appearanceShared.js +46 -0
  21. package/dist/chrome/appearance/appearanceUi.d.ts +49 -0
  22. package/dist/chrome/appearance/appearanceUi.js +98 -0
  23. package/dist/chrome/appearance/useAppearanceLabels.d.ts +181 -0
  24. package/dist/chrome/appearance/useAppearanceLabels.js +259 -0
  25. package/dist/chrome/index.d.ts +1 -0
  26. package/dist/chrome/shell/ShellSidebar.js +2 -0
  27. package/dist/chrome/shellLabelManifest.d.ts +6 -0
  28. package/dist/chrome.js +26 -25
  29. package/dist/platform-pages/AppearanceSettingsPage.d.ts +11 -1
  30. package/dist/platform-pages/AppearanceSettingsPage.js +15 -8
  31. package/dist/shared/assistant/ui/composer/AssistantComposer.js +346 -345
  32. package/dist/shared/backgrounds/useBackgroundColors.js +3 -2
  33. package/dist/shared/providers/AppShellProvider.d.ts +20 -1
  34. package/dist/shared/providers/AppShellProvider.js +230 -222
  35. package/dist/shared/providers/shell/PaletteThemeProvider.d.ts +13 -0
  36. package/dist/shared/providers/shell/PaletteThemeProvider.js +366 -0
  37. package/dist/shared/providers/shell/ThemeProvider.d.ts +9 -76
  38. package/dist/shared/providers/shell/ThemeProvider.js +63 -55
  39. package/dist/shared/providers/shell/appearance/colour.d.ts +29 -0
  40. package/dist/shared/providers/shell/appearance/colour.js +79 -0
  41. package/dist/shared/providers/shell/appearance/contrastFix.d.ts +70 -0
  42. package/dist/shared/providers/shell/appearance/contrastFix.js +117 -0
  43. package/dist/shared/providers/shell/appearance/index.d.ts +9 -0
  44. package/dist/shared/providers/shell/appearance/model.d.ts +68 -0
  45. package/dist/shared/providers/shell/appearance/model.js +92 -0
  46. package/dist/shared/providers/shell/appearance/operations.d.ts +70 -0
  47. package/dist/shared/providers/shell/appearance/operations.js +160 -0
  48. package/dist/shared/providers/shell/appearance/palettes.d.ts +111 -0
  49. package/dist/shared/providers/shell/appearance/palettes.js +460 -0
  50. package/dist/shared/providers/shell/appearance/storage.d.ts +39 -0
  51. package/dist/shared/providers/shell/appearance/storage.js +186 -0
  52. package/dist/shared/providers/shell/appearance/tokens.d.ts +5 -0
  53. package/dist/shared/providers/shell/appearance/tokens.js +43 -0
  54. package/dist/shared/providers/shell/appearance/types.d.ts +80 -0
  55. package/dist/shared/providers/shell/appearance/types.js +28 -0
  56. package/dist/shared/providers/shell/index.d.ts +1 -1
  57. package/dist/shared/providers/shell/responsiveDisplaySettings.d.ts +27 -0
  58. package/dist/shared/providers/shell/responsiveDisplaySettings.js +6 -0
  59. package/dist/shared/providers/shell/themeContext.d.ts +162 -0
  60. package/dist/shared/providers/shell/themeContext.js +4 -0
  61. package/dist/shell-native/system-bars.d.ts +5 -1
  62. package/dist/shell-native/system-bars.js +1 -1
  63. package/dist/ui/dropdown-menu.js +2 -0
  64. package/dist/ui/popover.js +1 -0
  65. package/dist/ui/select.js +1 -0
  66. package/package.json +1 -1
  67. package/src/shared/tokens/build/themes.css +266 -0
  68. package/src/shared/tokens/display-settings.css +569 -0
  69. package/src/shared/tokens/tokens.css +4 -0
@@ -0,0 +1,460 @@
1
+ // src/shared/providers/shell/appearance/palettes.ts
2
+ var e = (e, t, n, r, i, a, o, s) => ({
3
+ canvas: e,
4
+ surface: t,
5
+ elevated: n,
6
+ sunken: r,
7
+ popover: i,
8
+ borderDefault: a,
9
+ borderSubtle: o,
10
+ borderStrong: s
11
+ }), t = {
12
+ name: "fluidgrids",
13
+ modes: ["light", "dark"],
14
+ darkLabel: "#020817",
15
+ light: {
16
+ surfaces: e("#F8FAFC", "#FFFFFF", "#FFFFFF", "#F1F5F9", "#FFFFFF", "#CBD5E1", "#E2E8F0", "#94A3B8"),
17
+ text: {
18
+ primary: "#020817",
19
+ secondary: "#475569",
20
+ muted: "#5F6E84",
21
+ link: "#7E22CE"
22
+ },
23
+ glows: {
24
+ glow: "#9333EA",
25
+ glowAlt: "#4F46E5",
26
+ glow3: "#0E7490",
27
+ glow4: "#A21CAF"
28
+ }
29
+ },
30
+ dark: {
31
+ depths: {
32
+ dark: e("#090F1C", "#101828", "#18233A", "#060A14", "#18233A", "#283449", "#1C2638", "#3A475E"),
33
+ darker: e("#020817", "#0A1120", "#111A2E", "#01050F", "#111A2E", "#1E293B", "#131C2E", "#334155"),
34
+ black: e("#000000", "#07090F", "#0E121B", "#000000", "#0E121B", "#1A202C", "#10141D", "#2A3242")
35
+ },
36
+ text: {
37
+ primary: "#F8FAFC",
38
+ secondary: "#CBD5E1",
39
+ muted: "#94A3B8",
40
+ link: "#C68DFC"
41
+ },
42
+ glows: {
43
+ glow: "#C084FC",
44
+ glowAlt: "#818CF8",
45
+ glow3: "#22D3EE",
46
+ glow4: "#E879F9"
47
+ }
48
+ },
49
+ accent: {
50
+ light: {
51
+ fill: "#9333EA",
52
+ on: "#FFFFFF",
53
+ hover: "#7E22CE",
54
+ active: "#6B21A8",
55
+ ink: "#7E22CE"
56
+ },
57
+ dark: {
58
+ fill: "#A855F7",
59
+ on: "#020817",
60
+ hover: "#B972F9",
61
+ active: "#C084FC",
62
+ ink: "#C68DFC"
63
+ }
64
+ }
65
+ }, n = {
66
+ name: "classic",
67
+ modes: ["light", "dark"],
68
+ darkLabel: "#0A0E16",
69
+ light: {
70
+ surfaces: e("#F9FAFB", "#FFFFFF", "#FFFFFF", "#F3F4F6", "#FFFFFF", "#D1D5DB", "#E5E7EB", "#9CA3AF"),
71
+ text: {
72
+ primary: "#111827",
73
+ secondary: "#4B5563",
74
+ muted: "#6B7280",
75
+ link: "#2563EB"
76
+ },
77
+ glows: {
78
+ glow: "#0E7490",
79
+ glowAlt: "#4F46E5"
80
+ }
81
+ },
82
+ dark: {
83
+ depths: {
84
+ dark: e("#0A0E16", "#121826", "#1B2333", "#070A11", "#1F2937", "#2A3343", "#1C2433", "#3C4759"),
85
+ darker: e("#05070D", "#0C111C", "#141B28", "#040509", "#17202B", "#212936", "#151C29", "#333D4C"),
86
+ black: e("#000000", "#05070F", "#0C111C", "#000000", "#0F151E", "#1A202B", "#0E131D", "#2A3240")
87
+ },
88
+ text: {
89
+ primary: "#F4F6FB",
90
+ secondary: "#AEB6C5",
91
+ muted: "#8B94A6",
92
+ link: "#7AB6FF"
93
+ },
94
+ glows: {
95
+ glow: "#22D3EE",
96
+ glowAlt: "#8AA8FF"
97
+ }
98
+ },
99
+ accent: "brand"
100
+ }, r = {
101
+ name: "forest",
102
+ modes: ["dark"],
103
+ darkLabel: "#06100A",
104
+ light: null,
105
+ dark: {
106
+ depths: {
107
+ dark: e("#0A130D", "#122019", "#192C22", "#060C09", "#19271F", "#294437", "#1B2E24", "#3B5A49"),
108
+ darker: e("#050B07", "#0C1812", "#101E16", "#030605", "#101A14", "#20372C", "#14241C", "#324D3E"),
109
+ black: e("#000000", "#050B08", "#0B1711", "#000000", "#0B140F", "#192C23", "#0D1A13", "#294134")
110
+ },
111
+ text: {
112
+ primary: "#EDF6F0",
113
+ secondary: "#B0C7B9",
114
+ muted: "#87A292",
115
+ link: "#6EE7A8"
116
+ },
117
+ glows: {
118
+ glow: "#4ADE80",
119
+ glowAlt: "#2DD4BF"
120
+ }
121
+ },
122
+ accent: {
123
+ light: null,
124
+ dark: {
125
+ fill: "#15803D",
126
+ on: "#FFFFFF",
127
+ hover: "#1B9E4B",
128
+ active: "#0F5C2E",
129
+ ink: "#4ADE80"
130
+ }
131
+ }
132
+ }, i = {
133
+ name: "ocean",
134
+ modes: ["dark"],
135
+ darkLabel: "#050A12",
136
+ light: null,
137
+ dark: {
138
+ depths: {
139
+ dark: e("#091018", "#10192A", "#182740", "#060B12", "#182740", "#233246", "#172333", "#34465E"),
140
+ darker: e("#05090F", "#0A1220", "#0F1A2D", "#03060A", "#0F1A2D", "#1B2839", "#111B29", "#2C3C51"),
141
+ black: e("#000000", "#040811", "#0A1424", "#000000", "#0A1424", "#151F2E", "#0B121D", "#243244")
142
+ },
143
+ text: {
144
+ primary: "#EEF3FB",
145
+ secondary: "#AAB9CE",
146
+ muted: "#8493AB",
147
+ link: "#7AB6FF"
148
+ },
149
+ glows: {
150
+ glow: "#60A5FA",
151
+ glowAlt: "#A78BFA"
152
+ }
153
+ },
154
+ accent: {
155
+ light: null,
156
+ dark: {
157
+ fill: "#2563EB",
158
+ on: "#FFFFFF",
159
+ hover: "#3B82F6",
160
+ active: "#1D4ED8",
161
+ ink: "#60A5FA"
162
+ }
163
+ }
164
+ }, a = {
165
+ name: "sunset",
166
+ modes: ["dark"],
167
+ darkLabel: "#0F0B16",
168
+ light: null,
169
+ dark: {
170
+ depths: {
171
+ dark: e("#15101C", "#20182A", "#2C2138", "#0F0B16", "#2C2138", "#3A2C44", "#251B30", "#4E3C5A"),
172
+ darker: e("#0C0912", "#181120", "#1E1627", "#08060D", "#1E1627", "#2E2337", "#1D1426", "#43334D"),
173
+ black: e("#000000", "#0B0711", "#17101F", "#000000", "#17101F", "#251B2C", "#140D1B", "#382A41")
174
+ },
175
+ text: {
176
+ primary: "#F6EEF3",
177
+ secondary: "#C8B6C6",
178
+ muted: "#A290A0",
179
+ link: "#FBA56A"
180
+ },
181
+ glows: {
182
+ glow: "#FB923C",
183
+ glowAlt: "#F472B6"
184
+ }
185
+ },
186
+ accent: {
187
+ light: null,
188
+ dark: {
189
+ fill: "#C2410C",
190
+ on: "#FFFFFF",
191
+ hover: "#EA580C",
192
+ active: "#9A3412",
193
+ ink: "#FB923C"
194
+ }
195
+ }
196
+ }, o = e("#000000", "#0A0A0A", "#141414", "#000000", "#141414", "#6B6B6B", "#4A4A4A", "#9A9A9A"), s = {
197
+ fluidgrids: t,
198
+ classic: n,
199
+ forest: r,
200
+ ocean: i,
201
+ sunset: a,
202
+ "high-contrast": {
203
+ name: "high-contrast",
204
+ modes: ["dark"],
205
+ darkLabel: "#000000",
206
+ light: null,
207
+ dark: {
208
+ depths: {
209
+ dark: o,
210
+ darker: o,
211
+ black: o
212
+ },
213
+ text: {
214
+ primary: "#FFFFFF",
215
+ secondary: "#EDEDED",
216
+ muted: "#D4D4D4",
217
+ link: "#6FB3FF"
218
+ },
219
+ glows: {
220
+ glow: "#00E676",
221
+ glowAlt: "#40C4FF"
222
+ }
223
+ },
224
+ accent: {
225
+ light: null,
226
+ dark: {
227
+ fill: "#00E676",
228
+ on: "#000000",
229
+ hover: "#4DFF9D",
230
+ active: "#00C853",
231
+ ink: "#00E676"
232
+ }
233
+ },
234
+ fixedAccent: !0,
235
+ depthless: !0,
236
+ solid: !0
237
+ }
238
+ }, c = {
239
+ fluidgrids: {
240
+ light: {
241
+ fill: "#0E7490",
242
+ on: "#FFFFFF",
243
+ hover: "#155E75",
244
+ active: "#164E63",
245
+ ink: "#0E7490"
246
+ },
247
+ dark: {
248
+ fill: "#0891B2",
249
+ on: "#0A0E16",
250
+ hover: "#06B6D4",
251
+ active: "#22D3EE",
252
+ ink: "#22D3EE"
253
+ }
254
+ },
255
+ default: {
256
+ light: {
257
+ fill: "#2563EB",
258
+ on: "#FFFFFF",
259
+ hover: "#1D4ED8",
260
+ active: "#1E40AF",
261
+ ink: "#2563EB"
262
+ },
263
+ dark: {
264
+ fill: "#2563EB",
265
+ on: "#FFFFFF",
266
+ hover: "#1D4ED8",
267
+ active: "#1E40AF",
268
+ ink: "#7AB6FF"
269
+ }
270
+ }
271
+ };
272
+ function l(e, t, n) {
273
+ let r = s[e];
274
+ return r.accent === "brand" ? (n === "fluidgrids" ? c.fluidgrids : c.default)[t] : (t === "light" ? r.accent.light : null) ?? r.accent.dark;
275
+ }
276
+ var u = [
277
+ {
278
+ id: "purple",
279
+ light: {
280
+ fill: "#9333EA",
281
+ on: "#FFFFFF",
282
+ hover: "#7E22CE",
283
+ active: "#6B21A8",
284
+ ink: "#7E22CE"
285
+ },
286
+ dark: {
287
+ fill: "#A855F7",
288
+ on: "dark",
289
+ hover: "#B972F9",
290
+ active: "#C084FC",
291
+ ink: "#C084FC"
292
+ }
293
+ },
294
+ {
295
+ id: "indigo",
296
+ light: {
297
+ fill: "#4F46E5",
298
+ on: "#FFFFFF",
299
+ hover: "#4338CA",
300
+ active: "#3730A3",
301
+ ink: "#4338CA"
302
+ },
303
+ dark: {
304
+ fill: "#828DF9",
305
+ on: "dark",
306
+ hover: "#A5B4FC",
307
+ active: "#C7D2FE",
308
+ ink: "#A5B4FC"
309
+ }
310
+ },
311
+ {
312
+ id: "blue",
313
+ light: {
314
+ fill: "#2563EB",
315
+ on: "#FFFFFF",
316
+ hover: "#1D4ED8",
317
+ active: "#1E40AF",
318
+ ink: "#1D4ED8"
319
+ },
320
+ dark: {
321
+ fill: "#60A5FA",
322
+ on: "dark",
323
+ hover: "#93C5FD",
324
+ active: "#BFDBFE",
325
+ ink: "#93C5FD"
326
+ }
327
+ },
328
+ {
329
+ id: "cyan",
330
+ light: {
331
+ fill: "#0E7490",
332
+ on: "#FFFFFF",
333
+ hover: "#155E75",
334
+ active: "#164E63",
335
+ ink: "#0E7490"
336
+ },
337
+ dark: {
338
+ fill: "#29A0C1",
339
+ on: "dark",
340
+ hover: "#06B6D4",
341
+ active: "#22D3EE",
342
+ ink: "#22D3EE"
343
+ }
344
+ },
345
+ {
346
+ id: "teal",
347
+ light: {
348
+ fill: "#0F766E",
349
+ on: "#FFFFFF",
350
+ hover: "#115E59",
351
+ active: "#134E4A",
352
+ ink: "#0F766E"
353
+ },
354
+ dark: {
355
+ fill: "#2DD4BF",
356
+ on: "dark",
357
+ hover: "#5EEAD4",
358
+ active: "#99F6E4",
359
+ ink: "#5EEAD4"
360
+ }
361
+ },
362
+ {
363
+ id: "green",
364
+ light: {
365
+ fill: "#15803D",
366
+ on: "#FFFFFF",
367
+ hover: "#166534",
368
+ active: "#14532D",
369
+ ink: "#15803D"
370
+ },
371
+ dark: {
372
+ fill: "#4ADE80",
373
+ on: "dark",
374
+ hover: "#86EFAC",
375
+ active: "#BBF7D0",
376
+ ink: "#86EFAC"
377
+ }
378
+ },
379
+ {
380
+ id: "amber",
381
+ light: {
382
+ fill: "#B45309",
383
+ on: "#FFFFFF",
384
+ hover: "#92400E",
385
+ active: "#78350F",
386
+ ink: "#B45309"
387
+ },
388
+ dark: {
389
+ fill: "#FBBF24",
390
+ on: "dark",
391
+ hover: "#FCD34D",
392
+ active: "#FDE68A",
393
+ ink: "#FCD34D"
394
+ }
395
+ },
396
+ {
397
+ id: "rose",
398
+ light: {
399
+ fill: "#E11D48",
400
+ on: "#FFFFFF",
401
+ hover: "#BE123C",
402
+ active: "#9F1239",
403
+ ink: "#BE123C"
404
+ },
405
+ dark: {
406
+ fill: "#FB7185",
407
+ on: "dark",
408
+ hover: "#FDA4AF",
409
+ active: "#FECDD3",
410
+ ink: "#FDA4AF"
411
+ }
412
+ },
413
+ {
414
+ id: "fuchsia",
415
+ light: {
416
+ fill: "#C026D3",
417
+ on: "#FFFFFF",
418
+ hover: "#A21CAF",
419
+ active: "#86198F",
420
+ ink: "#A21CAF"
421
+ },
422
+ dark: {
423
+ fill: "#E879F9",
424
+ on: "dark",
425
+ hover: "#F0ABFC",
426
+ active: "#F5D0FE",
427
+ ink: "#F0ABFC"
428
+ }
429
+ }
430
+ ], d = "#FF5A8A", f = "#7C3AED", p = [
431
+ {
432
+ id: "purple",
433
+ hex: "#A855F7"
434
+ },
435
+ {
436
+ id: "indigo",
437
+ hex: "#6366F1"
438
+ },
439
+ {
440
+ id: "cyan",
441
+ hex: "#06B6D4"
442
+ },
443
+ {
444
+ id: "fuchsia",
445
+ hex: "#D946EF"
446
+ }
447
+ ];
448
+ function m(e, t, n) {
449
+ let r = s[e];
450
+ return t === "light" && r.light ? r.light.surfaces : r.dark.depths[n];
451
+ }
452
+ function h(e, t) {
453
+ let n = s[e];
454
+ return t === "light" && n.light ? n.light.text : n.dark.text;
455
+ }
456
+ function g(e, t) {
457
+ let n = s[e];
458
+ return t === "light" && n.light ? n.light.glows : n.dark.glows;
459
+ }
460
+ export { u as ACCENT_PRESETS, d as NEW_COLOUR_START, s as PALETTES, f as PICKER_FALLBACK, p as SITE_COLOURS, l as paletteAccent, g as paletteGlows, m as paletteSurfaces, h as paletteText };
@@ -0,0 +1,39 @@
1
+ import { AccentChoice, AppearanceDefaults, AppearanceSettings, SavedColour, SavedLook } from './types';
2
+ export declare const APPEARANCE_VERSION = "2";
3
+ /** The keys of one provider's storage. */
4
+ export declare function appearanceKeys(prefix: string): {
5
+ palette: string;
6
+ colorMode: string;
7
+ darkDepth: string;
8
+ accent: string;
9
+ colours: string;
10
+ looks: string;
11
+ activeLook: string;
12
+ version: string;
13
+ legacyMode: string;
14
+ legacyCustomList: string;
15
+ legacyActiveCustom: string;
16
+ density: string;
17
+ typography: string;
18
+ glass: string;
19
+ reduceMotion: string;
20
+ };
21
+ /** The storage, or null where it cannot be used (a private window, blocked site data). */
22
+ export declare function deviceStorage(): Storage | null;
23
+ /** Writes a value; a storage that refuses it keeps the choice for this visit only. */
24
+ export declare function writeKey(storage: Storage | null, key: string, value: string): void;
25
+ /** Removes a value (a storage that refuses keeps it; the choice still applies for this visit). */
26
+ export declare function clearKey(storage: Storage | null, key: string): void;
27
+ /** The person's colours as stored, without broken or repeated entries. */
28
+ export declare function sanitizeColours(value: unknown): SavedColour[];
29
+ /** The saved looks as stored, without broken or repeated entries. */
30
+ export declare function sanitizeLooks(value: unknown): SavedLook[];
31
+ /** An accent choice as stored; anything unknown (or a deleted colour) is the theme's own. */
32
+ export declare function sanitizeAccent(value: unknown, colours: readonly SavedColour[]): AccentChoice;
33
+ /**
34
+ * Reads the earlier model's keys once and writes what they mean in this one. Values already
35
+ * stored under the new keys win; the earlier keys are left as they are.
36
+ */
37
+ export declare function migrateLegacyAppearance(storage: Storage | null, prefix: string): void;
38
+ /** The stored choices (after the one-time move), with the product's defaults for the rest. */
39
+ export declare function readAppearance(storage: Storage | null, prefix: string, defaults: AppearanceDefaults): AppearanceSettings;
@@ -0,0 +1,186 @@
1
+ import { normalizeHex as e } from "./colour.js";
2
+ import { isAccentPresetId as t, isColorModeSetting as n, isDarkDepth as r, isPaletteName as i } from "./types.js";
3
+ function a(e) {
4
+ return {
5
+ palette: `${e}-palette`,
6
+ colorMode: `${e}-color-mode`,
7
+ darkDepth: `${e}-dark-depth`,
8
+ accent: `${e}-accent`,
9
+ colours: `${e}-colours`,
10
+ looks: `${e}-looks`,
11
+ activeLook: `${e}-active-look`,
12
+ version: `${e}-appearance-version`,
13
+ legacyMode: `${e}-mode`,
14
+ legacyCustomList: `${e}-custom-list`,
15
+ legacyActiveCustom: `${e}-active-custom`,
16
+ density: `${e}-density`,
17
+ typography: `${e}-typography`,
18
+ glass: `${e}-glass`,
19
+ reduceMotion: `${e}-reduce-motion`
20
+ };
21
+ }
22
+ function o() {
23
+ try {
24
+ return typeof window < "u" ? window.localStorage : null;
25
+ } catch {
26
+ return null;
27
+ }
28
+ }
29
+ var s = (e, t) => {
30
+ try {
31
+ return e?.getItem(t) ?? null;
32
+ } catch {
33
+ return null;
34
+ }
35
+ };
36
+ function c(e, t, n) {
37
+ try {
38
+ e?.setItem(t, n);
39
+ } catch {}
40
+ }
41
+ function l(e, t) {
42
+ try {
43
+ e?.removeItem(t);
44
+ } catch {}
45
+ }
46
+ var u = (e) => {
47
+ if (!e) return null;
48
+ try {
49
+ return JSON.parse(e);
50
+ } catch {
51
+ return null;
52
+ }
53
+ }, d = (e) => typeof e == "object" && !!e && !Array.isArray(e), f = (e, t) => typeof e == "string" ? e.trim().slice(0, t) : "";
54
+ function p(t) {
55
+ if (!Array.isArray(t)) return [];
56
+ let n = /* @__PURE__ */ new Set(), r = [];
57
+ for (let i of t) {
58
+ if (!d(i)) continue;
59
+ let t = typeof i.id == "string" ? i.id : "", a = e(typeof i.hex == "string" ? i.hex : ""), o = f(i.name, 24);
60
+ if (t && a && !n.has(t) && (n.add(t), r.push({
61
+ id: t,
62
+ name: o || a,
63
+ hex: a
64
+ }), r.length >= 24)) break;
65
+ }
66
+ return r;
67
+ }
68
+ var m = (n) => {
69
+ if (typeof n != "string") return "auto";
70
+ if (n.startsWith("preset:")) {
71
+ let e = n.slice(7);
72
+ return t(e) ? `preset:${e}` : "auto";
73
+ }
74
+ return e(n) || "auto";
75
+ }, h = (e) => e === "light" || e === "dark" || e === "keep" ? e : "keep";
76
+ function g(e) {
77
+ if (!Array.isArray(e)) return [];
78
+ let t = /* @__PURE__ */ new Set(), n = [];
79
+ for (let r of e) {
80
+ if (!d(r)) continue;
81
+ let e = typeof r.id == "string" ? r.id : "";
82
+ e && !t.has(e) && i(r.palette) && (t.add(e), n.push({
83
+ id: e,
84
+ name: f(r.name, 32) || e,
85
+ palette: r.palette,
86
+ accent: m(r.accent),
87
+ mode: h(r.mode)
88
+ }));
89
+ }
90
+ return n;
91
+ }
92
+ function _(n, r) {
93
+ if (typeof n != "string" || n === "auto") return "auto";
94
+ if (n.startsWith("preset:")) {
95
+ let e = n.slice(7);
96
+ return t(e) ? `preset:${e}` : "auto";
97
+ }
98
+ if (n.startsWith("colour:")) {
99
+ let e = n.slice(7);
100
+ return r.some((t) => t.id === e) ? `colour:${e}` : "auto";
101
+ }
102
+ return e(n) || "auto";
103
+ }
104
+ function v(t) {
105
+ return Array.isArray(t) ? t.flatMap((t) => !d(t) || typeof t.id != "string" || !t.id ? [] : [{
106
+ id: t.id,
107
+ name: f(t.name, 32),
108
+ base: t.base === "dark" ? "dark" : "light",
109
+ accent: e(typeof t.accent == "string" ? t.accent : ""),
110
+ ...typeof t.density == "string" ? { density: t.density } : {},
111
+ ...typeof t.typography == "string" ? { typography: t.typography } : {},
112
+ ...typeof t.glass == "string" ? { glass: t.glass } : {},
113
+ ...typeof t.reduceMotion == "boolean" ? { reduceMotion: t.reduceMotion } : {}
114
+ }]) : [];
115
+ }
116
+ var y = [
117
+ "compact",
118
+ "comfortable",
119
+ "spacious"
120
+ ], b = [
121
+ "small",
122
+ "default",
123
+ "large"
124
+ ], x = [
125
+ "off",
126
+ "subtle",
127
+ "full"
128
+ ], S = [
129
+ "forest",
130
+ "ocean",
131
+ "sunset",
132
+ "high-contrast"
133
+ ];
134
+ function C(e, t) {
135
+ if (!e) return;
136
+ let n = a(t);
137
+ if (s(e, n.version) === "2") return;
138
+ let r = (t, n) => {
139
+ s(e, t) === null && c(e, t, n);
140
+ }, i = v(u(s(e, n.legacyCustomList))), o = [], l = /* @__PURE__ */ new Map();
141
+ for (let e of i) {
142
+ if (!e.accent || l.has(e.accent) || o.length >= 24) continue;
143
+ let t = `legacy-${e.id}`;
144
+ l.set(e.accent, t), o.push({
145
+ id: t,
146
+ name: (e.name || e.accent).slice(0, 24),
147
+ hex: e.accent
148
+ });
149
+ }
150
+ let d = i.map((e) => ({
151
+ id: e.id,
152
+ name: e.name || e.id,
153
+ palette: "classic",
154
+ accent: e.accent ? e.accent : "auto",
155
+ mode: e.base
156
+ }));
157
+ o.length && r(n.colours, JSON.stringify(o)), d.length && r(n.looks, JSON.stringify(d));
158
+ let f = s(e, n.legacyMode);
159
+ if (f === "light" || f === "dark" || f === "system") r(n.palette, "classic"), r(n.colorMode, f);
160
+ else if (S.includes(f ?? "")) r(n.palette, f ?? "classic"), r(n.colorMode, "dark");
161
+ else if (f === "custom") {
162
+ let t = s(e, n.legacyActiveCustom), a = i.find((e) => e.id === t);
163
+ if (a) {
164
+ if (r(n.activeLook, a.id), r(n.palette, "classic"), r(n.colorMode, a.base), a.accent) {
165
+ let e = l.get(a.accent);
166
+ r(n.accent, e ? `colour:${e}` : a.accent);
167
+ }
168
+ a.density && y.includes(a.density) && c(e, n.density, a.density), a.typography && b.includes(a.typography) && c(e, n.typography, a.typography), a.glass && x.includes(a.glass) && c(e, n.glass, a.glass), typeof a.reduceMotion == "boolean" && c(e, n.reduceMotion, a.reduceMotion ? "1" : "0");
169
+ }
170
+ }
171
+ c(e, n.version, "2");
172
+ }
173
+ function w(e, t, o) {
174
+ C(e, t);
175
+ let c = a(t), l = s(e, c.palette), d = s(e, c.colorMode), f = s(e, c.darkDepth), m = p(u(s(e, c.colours))), h = g(u(s(e, c.looks))), v = s(e, c.activeLook);
176
+ return {
177
+ palette: i(l) ? l : o.palette,
178
+ mode: n(d) ? d : o.mode,
179
+ darkDepth: r(f) ? f : o.darkDepth,
180
+ accent: _(s(e, c.accent), m),
181
+ colours: m,
182
+ looks: h,
183
+ activeLookId: h.some((e) => e.id === v) ? v : null
184
+ };
185
+ }
186
+ export { a as appearanceKeys, l as clearKey, o as deviceStorage, C as migrateLegacyAppearance, w as readAppearance, _ as sanitizeAccent, p as sanitizeColours, g as sanitizeLooks, c as writeKey };
@@ -0,0 +1,5 @@
1
+ import { CSSProperties } from 'react';
2
+ import { ResolvedAppearance } from './model';
3
+ /** A style object that declares custom properties. */
4
+ export type TokenStyle = CSSProperties & Record<`--${string}`, string>;
5
+ export declare function lookTokenStyle(look: ResolvedAppearance): TokenStyle;