@burdenoff/fe-libs 2026.1119.4 → 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,264 @@
1
+ import { luminance as e, normalizeHex as t } from "../../shared/providers/shell/appearance/colour.js";
2
+ import "../../shared/providers/shell/appearance/palettes.js";
3
+ import { Button as n } from "../../ui/button.js";
4
+ import { Input as r } from "../../ui/input.js";
5
+ import { Label as i } from "../../ui/label.js";
6
+ import { cn as a } from "../../utils/cn.js";
7
+ import "../../utils/index.js";
8
+ import { Tag as o } from "./appearanceUi.js";
9
+ import { useId as s } from "react";
10
+ import { AlertTriangle as c, Check as l } from "lucide-react";
11
+ import { jsx as u, jsxs as d } from "react/jsx-runtime";
12
+ // src/chrome/appearance/ColourPanel.tsx
13
+ var f = (e) => `${(Math.floor(e * 10) / 10).toFixed(1)}:1`, p = (e, t, n) => ({
14
+ "--appearance-swatch": e,
15
+ ...t ? { "--appearance-swatch-on": t } : {},
16
+ ...n ? { "--appearance-swatch-ring": n } : {}
17
+ });
18
+ function m({ kind: e, check: t, labels: n }) {
19
+ let { accent: r, surfaces: i } = t, a = e === "button" ? !r.adjusted : e === "link" ? !r.inkAdjusted : r.rawFillRatio >= 3, s = e === "button" ? r.onRatio : e === "link" ? r.inkRatio : r.fillRatio, c = e === "button" ? r.rawOnRatio : e === "link" ? r.rawInkRatio : r.rawFillRatio;
20
+ return /* @__PURE__ */ d("span", {
21
+ className: "flex flex-col gap-1",
22
+ children: [/* @__PURE__ */ d("span", {
23
+ className: "flex flex-wrap items-center gap-1.5",
24
+ children: [
25
+ e === "button" && /* @__PURE__ */ u("span", {
26
+ className: "inline-flex h-6 min-w-8 items-center justify-center rounded px-1.5 text-xs font-semibold bg-[var(--appearance-swatch)] text-[var(--appearance-swatch-on)]",
27
+ style: p(r.fill, r.on),
28
+ children: "Aa"
29
+ }),
30
+ e === "link" && /* @__PURE__ */ u("span", {
31
+ className: "inline-flex h-6 items-center rounded border border-border-subtle px-1.5 text-xs font-semibold underline bg-[var(--appearance-swatch)] text-[var(--appearance-swatch-on)]",
32
+ style: p(i.surface, r.ink),
33
+ children: n.contrastLinkSample
34
+ }),
35
+ e === "outline" && /* @__PURE__ */ u("span", {
36
+ className: "inline-block h-6 w-8 rounded bg-[var(--appearance-swatch)] shadow-[inset_0_0_0_2px_var(--appearance-swatch-ring)]",
37
+ style: p(i.canvas, void 0, r.fill)
38
+ }),
39
+ /* @__PURE__ */ u(o, {
40
+ tone: a ? "success" : "warning",
41
+ children: a ? n.contrastOk : n.adjusted
42
+ }),
43
+ /* @__PURE__ */ u("span", {
44
+ className: "text-xs tabular-nums text-text-secondary",
45
+ children: f(s)
46
+ })
47
+ ]
48
+ }), !a && /* @__PURE__ */ u("span", {
49
+ className: "text-xs text-text-muted",
50
+ children: n.contrastYours(f(c))
51
+ })]
52
+ });
53
+ }
54
+ function h({ checks: t, labels: n }) {
55
+ let r = [
56
+ {
57
+ kind: "button",
58
+ name: n.contrastButtons,
59
+ rule: n.contrastButtonsRule
60
+ },
61
+ {
62
+ kind: "link",
63
+ name: n.contrastLinks,
64
+ rule: n.contrastLinksRule
65
+ },
66
+ {
67
+ kind: "outline",
68
+ name: n.contrastOutlines,
69
+ rule: n.contrastOutlinesRule
70
+ }
71
+ ], i = { gridTemplateColumns: `minmax(0,1.2fr) repeat(${t.length}, minmax(0,1fr))` }, o = t.some((e) => e.accent.adjusted || e.accent.inkAdjusted), s = e(t[0]?.accent.raw ?? "#7C3AED") > .4;
72
+ return /* @__PURE__ */ d("div", {
73
+ className: "flex flex-col gap-2",
74
+ children: [/* @__PURE__ */ d("div", {
75
+ role: "table",
76
+ "aria-label": n.contrastLabel,
77
+ className: "overflow-hidden rounded-card border border-border-subtle",
78
+ children: [/* @__PURE__ */ u("div", {
79
+ role: "rowgroup",
80
+ children: /* @__PURE__ */ d("div", {
81
+ role: "row",
82
+ className: "grid gap-3 bg-bg-sunken px-3 py-2 text-xs font-semibold text-text-secondary",
83
+ style: i,
84
+ children: [/* @__PURE__ */ u("span", {
85
+ role: "columnheader",
86
+ children: n.contrastWhere
87
+ }), t.map((e) => /* @__PURE__ */ u("span", {
88
+ role: "columnheader",
89
+ children: n.contrastIn(n.schemes[e.scheme])
90
+ }, e.scheme))]
91
+ })
92
+ }), /* @__PURE__ */ u("div", {
93
+ role: "rowgroup",
94
+ children: r.map((e) => /* @__PURE__ */ d("div", {
95
+ role: "row",
96
+ className: "grid items-start gap-3 border-t border-border-subtle px-3 py-2",
97
+ style: i,
98
+ children: [/* @__PURE__ */ d("span", {
99
+ role: "rowheader",
100
+ className: "flex flex-col",
101
+ children: [/* @__PURE__ */ u("span", {
102
+ className: "text-sm font-medium text-text-primary",
103
+ children: e.name
104
+ }), /* @__PURE__ */ u("span", {
105
+ className: "text-xs text-text-muted",
106
+ children: e.rule
107
+ })]
108
+ }), t.map((t) => /* @__PURE__ */ u("span", {
109
+ role: "cell",
110
+ children: /* @__PURE__ */ u(m, {
111
+ kind: e.kind,
112
+ check: t,
113
+ labels: n
114
+ })
115
+ }, t.scheme))]
116
+ }, e.kind))
117
+ })]
118
+ }), /* @__PURE__ */ d("p", {
119
+ className: a("flex items-start gap-2 text-sm", o ? "text-text-primary" : "text-text-secondary"),
120
+ "data-testid": "appearance-contrast-summary",
121
+ children: [o ? /* @__PURE__ */ u(c, {
122
+ className: "mt-0.5 size-4 shrink-0 text-[var(--color-status-warning-text)]",
123
+ "aria-hidden": "true"
124
+ }) : /* @__PURE__ */ u(l, {
125
+ className: "mt-0.5 size-4 shrink-0 text-[var(--color-status-success-text)]",
126
+ "aria-hidden": "true"
127
+ }), /* @__PURE__ */ u("span", { children: o ? s ? n.contrastTooLight : n.contrastTooDark : n.contrastReadable })]
128
+ })]
129
+ });
130
+ }
131
+ function g({ editing: e, draft: a, onDraft: o, onSave: c, onCancel: f, checks: m, quickPicks: g, labels: _ }) {
132
+ let v = s(), y = t(a.hex), b = !y && a.hex.replace(/^#/, "").length >= 6, x = (e) => {
133
+ e.key === "Enter" && (e.preventDefault(), c());
134
+ };
135
+ return /* @__PURE__ */ d("div", {
136
+ role: "group",
137
+ "aria-labelledby": `${v}-title`,
138
+ "data-testid": "appearance-colour-panel",
139
+ className: "flex flex-col gap-4 rounded-card border border-action-primary-bg/50 bg-bg-elevated p-4 shadow-elevation-2",
140
+ children: [
141
+ /* @__PURE__ */ d("p", {
142
+ className: "flex flex-wrap items-baseline gap-x-2 text-sm",
143
+ children: [/* @__PURE__ */ u("span", {
144
+ id: `${v}-title`,
145
+ className: "font-semibold text-text-primary",
146
+ children: e ? _.editTitle : _.addTitle
147
+ }), /* @__PURE__ */ u("span", {
148
+ className: "text-text-muted",
149
+ children: _.panelHint
150
+ })]
151
+ }),
152
+ /* @__PURE__ */ d("div", {
153
+ className: "grid grid-cols-[auto_minmax(0,1fr)] gap-3 sm:grid-cols-[auto_minmax(0,1fr)_minmax(0,1fr)]",
154
+ children: [
155
+ /* @__PURE__ */ d("div", {
156
+ className: "flex flex-col gap-1.5",
157
+ children: [/* @__PURE__ */ u(i, {
158
+ htmlFor: `${v}-well`,
159
+ children: _.pick
160
+ }), /* @__PURE__ */ u("input", {
161
+ id: `${v}-well`,
162
+ type: "color",
163
+ value: (y ?? "#7C3AED").toLowerCase(),
164
+ onChange: (e) => o({
165
+ ...a,
166
+ hex: e.target.value.toUpperCase()
167
+ }),
168
+ className: "h-9 w-14 cursor-pointer rounded-input border border-border-default bg-bg-surface p-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]"
169
+ })]
170
+ }),
171
+ /* @__PURE__ */ d("div", {
172
+ className: "flex min-w-0 flex-col gap-1.5",
173
+ children: [
174
+ /* @__PURE__ */ u(i, {
175
+ htmlFor: `${v}-hex`,
176
+ children: _.hex
177
+ }),
178
+ /* @__PURE__ */ u(r, {
179
+ type: "text",
180
+ id: `${v}-hex`,
181
+ value: a.hex,
182
+ maxLength: 7,
183
+ spellCheck: !1,
184
+ autoComplete: "off",
185
+ className: "font-mono uppercase",
186
+ "aria-invalid": b || void 0,
187
+ "aria-describedby": b ? `${v}-hex-error` : void 0,
188
+ onChange: (e) => {
189
+ let t = e.target.value.trim();
190
+ o({
191
+ ...a,
192
+ hex: t && !t.startsWith("#") ? `#${t}` : t
193
+ });
194
+ },
195
+ onKeyDown: x,
196
+ "data-testid": "appearance-colour-hex"
197
+ }),
198
+ b && /* @__PURE__ */ u("span", {
199
+ id: `${v}-hex-error`,
200
+ className: "text-xs text-[var(--color-status-error-text)]",
201
+ children: _.hexError
202
+ })
203
+ ]
204
+ }),
205
+ /* @__PURE__ */ d("div", {
206
+ className: "col-span-2 flex min-w-0 flex-col gap-1.5 sm:col-span-1",
207
+ children: [/* @__PURE__ */ u(i, {
208
+ htmlFor: `${v}-name`,
209
+ children: _.name
210
+ }), /* @__PURE__ */ u(r, {
211
+ type: "text",
212
+ id: `${v}-name`,
213
+ value: a.name,
214
+ maxLength: 24,
215
+ autoComplete: "off",
216
+ onChange: (e) => o({
217
+ ...a,
218
+ name: e.target.value
219
+ }),
220
+ onKeyDown: x,
221
+ "data-testid": "appearance-colour-name"
222
+ })]
223
+ })
224
+ ]
225
+ }),
226
+ /* @__PURE__ */ d("div", {
227
+ className: "flex flex-wrap items-center gap-2 text-sm text-text-secondary",
228
+ children: [/* @__PURE__ */ u("span", { children: _.fromSite }), g.map((e) => /* @__PURE__ */ d("button", {
229
+ type: "button",
230
+ onClick: () => o({
231
+ hex: e.hex,
232
+ name: e.name
233
+ }),
234
+ className: "inline-flex items-center gap-1.5 rounded-full border border-border-default bg-bg-surface px-2.5 py-1 text-xs text-text-primary transition-colors hover:bg-bg-sunken focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]",
235
+ children: [/* @__PURE__ */ u("span", {
236
+ "aria-hidden": "true",
237
+ className: "size-3 rounded-full bg-[var(--appearance-swatch)]",
238
+ style: p(e.hex)
239
+ }), e.name]
240
+ }, e.id))]
241
+ }),
242
+ y && m.length > 0 && /* @__PURE__ */ u(h, {
243
+ checks: m,
244
+ labels: _
245
+ }),
246
+ /* @__PURE__ */ d("div", {
247
+ className: "flex flex-wrap justify-end gap-2",
248
+ children: [/* @__PURE__ */ u(n, {
249
+ type: "button",
250
+ variant: "ghost",
251
+ onClick: f,
252
+ children: _.cancel
253
+ }), /* @__PURE__ */ d(n, {
254
+ type: "button",
255
+ onClick: c,
256
+ disabled: !y,
257
+ "data-testid": "appearance-colour-save",
258
+ children: [/* @__PURE__ */ u(l, { "aria-hidden": "true" }), e ? _.saveChanges : _.saveColour]
259
+ })]
260
+ })
261
+ ]
262
+ });
263
+ }
264
+ export { g as ColourPanel, h as ContrastCheck, f as formatRatio };
@@ -0,0 +1,21 @@
1
+ import { LookMode, PaletteName, SavedLook } from '../../shared/providers/shell/appearance/types';
2
+ import { AppearanceControls } from '../../shared/providers/shell/themeContext';
3
+ import { AppearanceLabels } from './useAppearanceLabels';
4
+ export interface LookDraft {
5
+ name: string;
6
+ palette: PaletteName;
7
+ accent: SavedLook['accent'];
8
+ mode: LookMode;
9
+ }
10
+ export declare function ThemeDialog({ open, editingId, initial, appearance, brand, labels, onClose, onSave, onDelete, }: {
11
+ open: boolean;
12
+ /** The look being edited, or null to create one. */
13
+ editingId: string | null;
14
+ initial: LookDraft;
15
+ appearance: AppearanceControls;
16
+ brand: string;
17
+ labels: AppearanceLabels;
18
+ onClose: () => void;
19
+ onSave: (draft: LookDraft) => void;
20
+ onDelete?: () => void;
21
+ }): import('react').JSX.Element;
@@ -0,0 +1,378 @@
1
+ import { normalizeHex as e } from "../../shared/providers/shell/appearance/colour.js";
2
+ import { solveAccent as t } from "../../shared/providers/shell/appearance/contrastFix.js";
3
+ import { groundOf as n, hasLightMode as r, lookModeOf as i, resolveAppearance as a } from "../../shared/providers/shell/appearance/model.js";
4
+ import { ACCENT_PRESETS as ee, PALETTES as o } from "../../shared/providers/shell/appearance/palettes.js";
5
+ import { PALETTE_NAMES as te } from "../../shared/providers/shell/appearance/types.js";
6
+ import { Button as s } from "../../ui/button.js";
7
+ import { Dialog as c, DialogContent as ne, DialogDescription as l, DialogTitle as re } from "../../ui/dialog.js";
8
+ import { Input as u } from "../../ui/input.js";
9
+ import { Label as d } from "../../ui/label.js";
10
+ import { cn as ie } from "../../utils/cn.js";
11
+ import "../../utils/index.js";
12
+ import { MiniShell as ae } from "./AppearancePreview.js";
13
+ import { formatRatio as f } from "./ColourPanel.js";
14
+ import { hexFieldState as oe } from "./appearanceShared.js";
15
+ import { SelectedCheck as p, Swatch as se, optionClass as m, radioTabIndex as h, useRadioGroupKeys as ce } from "./appearanceUi.js";
16
+ import { useId as le, useMemo as ue, useState as g } from "react";
17
+ import { Check as de, Trash2 as fe, X as pe } from "lucide-react";
18
+ import { jsx as _, jsxs as v } from "react/jsx-runtime";
19
+ // src/chrome/appearance/ThemeDialog.tsx
20
+ function y({ open: y, editingId: b, initial: x, appearance: S, brand: C, labels: w, onClose: T, onSave: me, onDelete: E }) {
21
+ let D = le(), O = ce(), [k, A] = g(x), [j, M] = g(!1), [he, N] = g(!1), [P, F] = g(x.accent.startsWith("#") ? x.accent : ""), [I, L] = g(!1), [R, z] = g(!1), B = () => {
22
+ L(!1), z(!1);
23
+ }, { settings: V, systemDark: H } = S, U = o[k.palette], W = !r(k.palette), G = ue(() => a({
24
+ palette: k.palette,
25
+ mode: i(k, V.mode),
26
+ darkDepth: V.darkDepth,
27
+ accent: k.accent,
28
+ colours: V.colours
29
+ }, {
30
+ systemDark: H,
31
+ brand: C
32
+ }), [
33
+ k,
34
+ V.mode,
35
+ V.darkDepth,
36
+ V.colours,
37
+ H,
38
+ C
39
+ ]), K = n(k.palette, G.scheme, V.darkDepth, !0), ge = (e) => A((t) => ({
40
+ ...t,
41
+ palette: e,
42
+ mode: r(e) ? t.mode : "dark",
43
+ accent: o[e].fixedAccent ? "auto" : t.accent
44
+ })), q = (e) => A((t) => ({
45
+ ...t,
46
+ accent: e
47
+ })), J = () => {
48
+ k.name.trim() ? I && !U.fixedAccent ? (z(!0), document.getElementById(`${D}-hex`)?.focus()) : me({
49
+ ...k,
50
+ name: k.name.trim().slice(0, 32)
51
+ }) : (M(!0), document.getElementById(`${D}-name`)?.focus());
52
+ }, Y = k.accent.startsWith("#") ? e(k.accent) : null, X = Y ? t(Y, K) : null, Z = a({
53
+ palette: k.palette,
54
+ mode: i(k, V.mode),
55
+ darkDepth: V.darkDepth,
56
+ accent: "auto",
57
+ colours: []
58
+ }, {
59
+ systemDark: H,
60
+ brand: C
61
+ }).accent, Q = [{
62
+ value: "auto",
63
+ name: w.themeColour,
64
+ fill: Z.fill,
65
+ on: Z.on
66
+ }];
67
+ if (!U.fixedAccent) {
68
+ for (let e of ee) {
69
+ let t = a({
70
+ palette: k.palette,
71
+ mode: i(k, V.mode),
72
+ darkDepth: V.darkDepth,
73
+ accent: `preset:${e.id}`,
74
+ colours: []
75
+ }, {
76
+ systemDark: H,
77
+ brand: C
78
+ }).accent;
79
+ Q.push({
80
+ value: `preset:${e.id}`,
81
+ name: w.presets[e.id],
82
+ fill: t.fill,
83
+ on: t.on
84
+ });
85
+ }
86
+ for (let e of V.colours) {
87
+ let n = t(e.hex, K);
88
+ Q.push({
89
+ value: e.hex,
90
+ name: e.name,
91
+ fill: e.hex,
92
+ on: n.on
93
+ });
94
+ }
95
+ }
96
+ let $ = Q.some((e) => e.value === k.accent), _e = Q.find((e) => e.value === k.accent)?.name ?? Y ?? w.themeColour, ve = [
97
+ {
98
+ value: "keep",
99
+ label: w.dialogKeep,
100
+ disabled: W
101
+ },
102
+ {
103
+ value: "light",
104
+ label: w.dialogAlwaysLight,
105
+ disabled: W
106
+ },
107
+ {
108
+ value: "dark",
109
+ label: w.dialogAlwaysDark,
110
+ disabled: !1
111
+ }
112
+ ];
113
+ return /* @__PURE__ */ _(c, {
114
+ open: y,
115
+ onOpenChange: (e) => e ? void 0 : T(),
116
+ children: /* @__PURE__ */ v(ne, {
117
+ showCloseButton: !1,
118
+ "data-testid": "appearance-theme-dialog",
119
+ className: "max-h-[calc(100dvh-2rem)] gap-0 overflow-y-auto p-0 sm:max-w-3xl",
120
+ children: [
121
+ /* @__PURE__ */ v("div", {
122
+ className: "flex items-center justify-between gap-2 border-b border-border-subtle px-5 py-3",
123
+ children: [/* @__PURE__ */ _(re, {
124
+ className: "text-base font-semibold",
125
+ children: b ? w.dialogEdit : w.dialogCreate
126
+ }), /* @__PURE__ */ _(s, {
127
+ type: "button",
128
+ variant: "ghost",
129
+ size: "icon-sm",
130
+ "aria-label": w.dialogClose,
131
+ onClick: T,
132
+ children: /* @__PURE__ */ _(pe, { "aria-hidden": "true" })
133
+ })]
134
+ }),
135
+ /* @__PURE__ */ _(l, {
136
+ className: "sr-only",
137
+ children: w.createThemeHint
138
+ }),
139
+ /* @__PURE__ */ v("div", {
140
+ className: "grid gap-5 px-5 py-4 md:grid-cols-[minmax(0,1fr)_14rem]",
141
+ children: [/* @__PURE__ */ v("div", {
142
+ className: "flex min-w-0 flex-col gap-4",
143
+ children: [
144
+ /* @__PURE__ */ v("div", {
145
+ className: "flex flex-col gap-1.5",
146
+ children: [
147
+ /* @__PURE__ */ _(d, {
148
+ htmlFor: `${D}-name`,
149
+ children: w.name
150
+ }),
151
+ /* @__PURE__ */ _(u, {
152
+ type: "text",
153
+ id: `${D}-name`,
154
+ value: k.name,
155
+ maxLength: 32,
156
+ autoComplete: "off",
157
+ "aria-invalid": j || void 0,
158
+ "aria-describedby": j ? `${D}-name-error` : void 0,
159
+ onChange: (e) => {
160
+ A((t) => ({
161
+ ...t,
162
+ name: e.target.value
163
+ })), e.target.value.trim() && M(!1);
164
+ },
165
+ onKeyDown: (e) => {
166
+ e.key === "Enter" && (e.preventDefault(), J());
167
+ },
168
+ "data-testid": "appearance-theme-name"
169
+ }),
170
+ j && /* @__PURE__ */ _("span", {
171
+ id: `${D}-name-error`,
172
+ className: "text-xs text-[var(--color-status-error-text)]",
173
+ children: w.dialogNameError
174
+ })
175
+ ]
176
+ }),
177
+ /* @__PURE__ */ v("div", {
178
+ className: "flex flex-col gap-1.5",
179
+ children: [/* @__PURE__ */ _("span", {
180
+ id: `${D}-start`,
181
+ className: "text-sm font-medium text-text-primary",
182
+ children: w.dialogStartFrom
183
+ }), /* @__PURE__ */ _("div", {
184
+ role: "radiogroup",
185
+ "aria-labelledby": `${D}-start`,
186
+ onKeyDown: O,
187
+ className: "flex flex-wrap gap-1.5",
188
+ children: te.map((e, t) => {
189
+ let n = k.palette === e;
190
+ return /* @__PURE__ */ v("button", {
191
+ type: "button",
192
+ role: "radio",
193
+ "aria-checked": n,
194
+ tabIndex: h(n, t === 0, !0),
195
+ onClick: () => ge(e),
196
+ className: m(n, "flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium"),
197
+ children: [/* @__PURE__ */ _(p, { selected: n }), w.palettes[e].name]
198
+ }, e);
199
+ })
200
+ })]
201
+ }),
202
+ /* @__PURE__ */ v("div", {
203
+ className: "flex flex-col gap-1.5",
204
+ children: [
205
+ /* @__PURE__ */ _("span", {
206
+ id: `${D}-colour`,
207
+ className: "text-sm font-medium text-text-primary",
208
+ children: w.dialogColour
209
+ }),
210
+ U.fixedAccent && /* @__PURE__ */ _("p", {
211
+ className: "text-xs text-text-muted",
212
+ children: w.dialogFixed
213
+ }),
214
+ /* @__PURE__ */ _("div", {
215
+ role: "radiogroup",
216
+ "aria-labelledby": `${D}-colour`,
217
+ onKeyDown: O,
218
+ className: "flex flex-wrap gap-1",
219
+ children: Q.map((e, t) => /* @__PURE__ */ _(se, {
220
+ selected: k.accent === e.value,
221
+ name: e.name,
222
+ fill: e.fill,
223
+ on: e.on,
224
+ tabIndex: h(k.accent === e.value, t === 0, $),
225
+ onSelect: () => {
226
+ q(e.value), B(), e.value.startsWith("#") && F(e.value);
227
+ }
228
+ }, `${t}-${e.value}`))
229
+ }),
230
+ !U.fixedAccent && /* @__PURE__ */ v("div", {
231
+ className: "flex flex-wrap items-center gap-2",
232
+ children: [
233
+ /* @__PURE__ */ _(d, {
234
+ htmlFor: `${D}-hex`,
235
+ className: "text-xs text-text-secondary",
236
+ children: w.dialogAnyColour
237
+ }),
238
+ /* @__PURE__ */ _("input", {
239
+ type: "color",
240
+ "aria-label": w.dialogPickAny,
241
+ value: (Y ?? "#7C3AED").toLowerCase(),
242
+ onChange: (e) => {
243
+ let t = e.target.value.toUpperCase();
244
+ F(t), q(t), B();
245
+ },
246
+ className: "h-8 w-10 cursor-pointer rounded-input border border-border-default bg-bg-surface p-0.5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]"
247
+ }),
248
+ /* @__PURE__ */ _(u, {
249
+ type: "text",
250
+ id: `${D}-hex`,
251
+ value: P,
252
+ maxLength: 7,
253
+ spellCheck: !1,
254
+ autoComplete: "off",
255
+ className: "h-8 w-28 font-mono uppercase",
256
+ "aria-invalid": R || void 0,
257
+ "aria-describedby": R ? `${D}-hex-error` : void 0,
258
+ onChange: (t) => {
259
+ let n = t.target.value.trim(), r = n && !n.startsWith("#") ? `#${n}` : n;
260
+ F(r);
261
+ let i = e(r);
262
+ i && q(i);
263
+ let a = oe(r, $);
264
+ L(a === "pending"), a !== "pending" && z(!1);
265
+ },
266
+ "data-testid": "appearance-theme-hex"
267
+ }),
268
+ R && /* @__PURE__ */ _("span", {
269
+ id: `${D}-hex-error`,
270
+ className: "basis-full text-xs text-[var(--color-status-error-text)]",
271
+ "data-testid": "appearance-theme-hex-error",
272
+ children: w.hexError
273
+ })
274
+ ]
275
+ }),
276
+ X && /* @__PURE__ */ _("p", {
277
+ className: "text-xs text-text-secondary",
278
+ "data-testid": "appearance-dialog-check",
279
+ children: X.adjusted || X.inkAdjusted ? w.dialogAdjusted(X.fill, f(X.onRatio)) : w.dialogReadable(f(X.onRatio))
280
+ })
281
+ ]
282
+ }),
283
+ /* @__PURE__ */ v("div", {
284
+ className: "flex flex-col gap-1.5",
285
+ children: [
286
+ /* @__PURE__ */ _("span", {
287
+ id: `${D}-mode`,
288
+ className: "text-sm font-medium text-text-primary",
289
+ children: w.dialogMode
290
+ }),
291
+ /* @__PURE__ */ _("div", {
292
+ role: "radiogroup",
293
+ "aria-labelledby": `${D}-mode`,
294
+ onKeyDown: O,
295
+ className: "flex flex-wrap gap-1.5",
296
+ children: ve.map((e) => {
297
+ let t = k.mode === e.value;
298
+ return /* @__PURE__ */ v("button", {
299
+ type: "button",
300
+ role: "radio",
301
+ "aria-checked": t,
302
+ disabled: e.disabled,
303
+ tabIndex: t ? 0 : -1,
304
+ onClick: () => A((t) => ({
305
+ ...t,
306
+ mode: e.value
307
+ })),
308
+ className: m(t, "flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium"),
309
+ children: [/* @__PURE__ */ _(p, { selected: t }), e.label]
310
+ }, e.value);
311
+ })
312
+ }),
313
+ W && /* @__PURE__ */ _("p", {
314
+ className: "text-xs text-text-muted",
315
+ children: w.dialogDarkOnly(w.palettes[k.palette].name)
316
+ })
317
+ ]
318
+ })
319
+ ]
320
+ }), /* @__PURE__ */ v("div", {
321
+ className: "flex flex-col gap-2",
322
+ children: [/* @__PURE__ */ _(ae, {
323
+ look: G,
324
+ className: "h-36"
325
+ }), /* @__PURE__ */ _("span", {
326
+ className: "text-xs text-text-muted",
327
+ children: w.lookSummaryMode(w.palettes[k.palette].name, _e, w.schemes[G.scheme])
328
+ })]
329
+ })]
330
+ }),
331
+ /* @__PURE__ */ v("div", {
332
+ className: ie("flex flex-wrap items-center gap-2 border-t border-border-subtle px-5 py-3", !b && "justify-end"),
333
+ children: [
334
+ b && E && (he ? /* @__PURE__ */ v("span", {
335
+ className: "flex flex-wrap items-center gap-2 text-sm",
336
+ children: [
337
+ w.lookDeleteAsk(k.name || x.name),
338
+ /* @__PURE__ */ _(s, {
339
+ type: "button",
340
+ variant: "destructive",
341
+ size: "sm",
342
+ onClick: E,
343
+ children: w.dialogDeleteYes
344
+ }),
345
+ /* @__PURE__ */ _(s, {
346
+ type: "button",
347
+ variant: "outline",
348
+ size: "sm",
349
+ onClick: () => N(!1),
350
+ children: w.dialogKeepIt
351
+ })
352
+ ]
353
+ }) : /* @__PURE__ */ v(s, {
354
+ type: "button",
355
+ variant: "ghost",
356
+ onClick: () => N(!0),
357
+ children: [/* @__PURE__ */ _(fe, { "aria-hidden": "true" }), w.dialogDelete]
358
+ })),
359
+ /* @__PURE__ */ _("span", { className: "grow" }),
360
+ /* @__PURE__ */ _(s, {
361
+ type: "button",
362
+ variant: "outline",
363
+ onClick: T,
364
+ children: w.cancel
365
+ }),
366
+ /* @__PURE__ */ v(s, {
367
+ type: "button",
368
+ onClick: J,
369
+ "data-testid": "appearance-theme-save",
370
+ children: [/* @__PURE__ */ _(de, { "aria-hidden": "true" }), b ? w.dialogSaveChanges : w.dialogSave]
371
+ })
372
+ ]
373
+ })
374
+ ]
375
+ })
376
+ });
377
+ }
378
+ export { y as ThemeDialog };
@@ -0,0 +1,24 @@
1
+ import { AccentChoice, AppearanceSettings, SavedLook } from '../../shared/providers/shell/appearance/types';
2
+ import { AppearanceControls } from '../../shared/providers/shell/themeContext';
3
+ import { AppearanceLabels } from './useAppearanceLabels';
4
+ /** Shows a short notice, with Undo where the change can be put back. */
5
+ export declare function notify(labels: AppearanceLabels, message: string, undo?: () => void): void;
6
+ /** The name of a colour choice: the theme's own, a preset, a saved colour, or its hex. */
7
+ export declare function accentNameOf(accent: AccentChoice | SavedLook['accent'], appearance: AppearanceControls, labels: AppearanceLabels): string;
8
+ /**
9
+ * What the theme dialog's "any colour" field means for Save:
10
+ * - `colour`: it holds a colour, and that colour is the choice;
11
+ * - `none`: it is empty while a swatch is chosen, so the swatch stands;
12
+ * - `pending`: it holds text that is not a colour, or it was emptied while its own colour was
13
+ * the choice. Save then asks for a colour instead of saving the one chosen before.
14
+ */
15
+ export declare function hexFieldState(text: string, swatchChosen: boolean): 'colour' | 'none' | 'pending';
16
+ /**
17
+ * The one swatch of the Colour section that is on: `auto` (the theme's colour), `preset:<id>`
18
+ * or `colour:<id>`, or null when the colour is none of them. A look keeps its colour as a hex,
19
+ * so of saved colours sharing that hex the first is on, never several (one checked radio, one
20
+ * tab stop).
21
+ */
22
+ export declare function selectedSwatchOf(settings: Pick<AppearanceSettings, 'accent' | 'colours'>, fixedAccent: boolean): string | null;
23
+ /** A roving tab stop: the swatch that is on, or the first one when none is. */
24
+ export declare const swatchTabIndex: (key: string, selected: string | null, first: boolean) => 0 | -1;