@burdenoff/fe-libs 2026.1119.5 → 2026.1119.7
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/dist/chrome/HeaderThemeSwitcher.js +1 -1
- package/dist/chrome/PersonaSurfaceControls.js +82 -189
- package/dist/chrome/PersonaViewsList.d.ts +28 -0
- package/dist/chrome/PersonaViewsList.js +139 -0
- package/dist/chrome/ThemePreferences.js +16 -16
- package/dist/chrome/appearance/AppearanceColourSection.d.ts +17 -0
- package/dist/chrome/appearance/AppearanceColourSection.js +337 -0
- package/dist/chrome/appearance/AppearanceDisplaySection.d.ts +7 -0
- package/dist/chrome/appearance/AppearanceDisplaySection.js +137 -0
- package/dist/chrome/appearance/AppearanceModeDepth.d.ts +11 -0
- package/dist/chrome/appearance/AppearanceModeDepth.js +158 -0
- package/dist/chrome/appearance/AppearancePreferences.d.ts +13 -0
- package/dist/chrome/appearance/AppearancePreferences.js +308 -0
- package/dist/chrome/appearance/AppearancePreview.d.ts +23 -0
- package/dist/chrome/appearance/AppearancePreview.js +218 -0
- package/dist/chrome/appearance/AppearanceThemeSection.d.ts +14 -0
- package/dist/chrome/appearance/AppearanceThemeSection.js +162 -0
- package/dist/chrome/appearance/ColourPanel.d.ts +37 -0
- package/dist/chrome/appearance/ColourPanel.js +264 -0
- package/dist/chrome/appearance/ThemeDialog.d.ts +21 -0
- package/dist/chrome/appearance/ThemeDialog.js +378 -0
- package/dist/chrome/appearance/appearanceShared.d.ts +24 -0
- package/dist/chrome/appearance/appearanceShared.js +46 -0
- package/dist/chrome/appearance/appearanceUi.d.ts +49 -0
- package/dist/chrome/appearance/appearanceUi.js +98 -0
- package/dist/chrome/appearance/useAppearanceLabels.d.ts +181 -0
- package/dist/chrome/appearance/useAppearanceLabels.js +259 -0
- package/dist/chrome/index.d.ts +1 -0
- package/dist/chrome/personaViewOptions.d.ts +8 -0
- package/dist/chrome/personaViewOptions.js +14 -0
- package/dist/chrome/shell/NewMenu.d.ts +13 -1
- package/dist/chrome/shell/NewMenu.js +27 -14
- package/dist/chrome/shell/ShellSidebar.js +2 -0
- package/dist/chrome/shell/SidebarProfileMenu.d.ts +36 -4
- package/dist/chrome/shell/SidebarProfileMenu.js +423 -331
- package/dist/chrome/shell/WorkspaceAccountCard.d.ts +22 -0
- package/dist/chrome/shell/WorkspaceAccountCard.js +102 -0
- package/dist/chrome/shell/pageHost.d.ts +19 -0
- package/dist/chrome/shell/pageHost.js +21 -0
- package/dist/chrome/shell/pageWidth.d.ts +39 -0
- package/dist/chrome/shell/pageWidth.js +18 -0
- package/dist/chrome/shellLabelManifest.d.ts +6 -0
- package/dist/chrome.js +26 -25
- package/dist/platform-pages/AppearanceSettingsPage.d.ts +11 -1
- package/dist/platform-pages/AppearanceSettingsPage.js +15 -8
- package/dist/shared/assistant/ui/composer/AssistantComposer.js +346 -345
- package/dist/shared/backgrounds/BackgroundSettingsSection.d.ts +11 -0
- package/dist/shared/backgrounds/BackgroundSettingsSection.js +67 -0
- package/dist/shared/backgrounds/backgroundSectionLabels.d.ts +14 -0
- package/dist/shared/backgrounds/backgroundSectionLabels.js +36 -0
- package/dist/shared/backgrounds/index.d.ts +3 -0
- package/dist/shared/backgrounds/useBackgroundColors.js +3 -2
- package/dist/shared/backgrounds/useStartPageBackground.d.ts +12 -0
- package/dist/shared/backgrounds/useStartPageBackground.js +23 -0
- package/dist/shared/providers/AppShellProvider.d.ts +20 -1
- package/dist/shared/providers/AppShellProvider.js +230 -222
- package/dist/shared/providers/shell/PaletteThemeProvider.d.ts +13 -0
- package/dist/shared/providers/shell/PaletteThemeProvider.js +366 -0
- package/dist/shared/providers/shell/ThemeProvider.d.ts +9 -76
- package/dist/shared/providers/shell/ThemeProvider.js +63 -55
- package/dist/shared/providers/shell/appearance/colour.d.ts +29 -0
- package/dist/shared/providers/shell/appearance/colour.js +79 -0
- package/dist/shared/providers/shell/appearance/contrastFix.d.ts +70 -0
- package/dist/shared/providers/shell/appearance/contrastFix.js +117 -0
- package/dist/shared/providers/shell/appearance/index.d.ts +9 -0
- package/dist/shared/providers/shell/appearance/model.d.ts +68 -0
- package/dist/shared/providers/shell/appearance/model.js +92 -0
- package/dist/shared/providers/shell/appearance/operations.d.ts +70 -0
- package/dist/shared/providers/shell/appearance/operations.js +160 -0
- package/dist/shared/providers/shell/appearance/palettes.d.ts +111 -0
- package/dist/shared/providers/shell/appearance/palettes.js +460 -0
- package/dist/shared/providers/shell/appearance/storage.d.ts +39 -0
- package/dist/shared/providers/shell/appearance/storage.js +186 -0
- package/dist/shared/providers/shell/appearance/tokens.d.ts +5 -0
- package/dist/shared/providers/shell/appearance/tokens.js +43 -0
- package/dist/shared/providers/shell/appearance/types.d.ts +80 -0
- package/dist/shared/providers/shell/appearance/types.js +28 -0
- package/dist/shared/providers/shell/index.d.ts +1 -1
- package/dist/shared/providers/shell/responsiveDisplaySettings.d.ts +27 -0
- package/dist/shared/providers/shell/responsiveDisplaySettings.js +6 -0
- package/dist/shared/providers/shell/themeContext.d.ts +162 -0
- package/dist/shared/providers/shell/themeContext.js +4 -0
- package/dist/shared-backgrounds.js +4 -1
- package/dist/shell-native/system-bars.d.ts +5 -1
- package/dist/shell-native/system-bars.js +1 -1
- package/dist/ui/dropdown-menu.js +2 -0
- package/dist/ui/popover.js +1 -0
- package/dist/ui/select.js +1 -0
- package/package.json +5 -1
- package/src/shared/styles/page-widths.css +38 -0
- package/src/shared/tokens/build/brands/healthybowl.css +25 -3
- package/src/shared/tokens/build/themes.css +266 -0
- package/src/shared/tokens/display-settings.css +569 -0
- package/src/shared/tokens/tokens.css +4 -0
|
@@ -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;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { normalizeHex as e } from "../../shared/providers/shell/appearance/colour.js";
|
|
2
|
+
import { accentHexOf as t } from "../../shared/providers/shell/appearance/model.js";
|
|
3
|
+
import { ACCENT_PRESETS as n } from "../../shared/providers/shell/appearance/palettes.js";
|
|
4
|
+
import { toast as r } from "sonner";
|
|
5
|
+
// src/chrome/appearance/appearanceShared.ts
|
|
6
|
+
function i(e, t, n) {
|
|
7
|
+
n ? r(t, {
|
|
8
|
+
duration: 6500,
|
|
9
|
+
action: {
|
|
10
|
+
label: e.undo,
|
|
11
|
+
onClick: () => {
|
|
12
|
+
n(), r(e.undone);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}) : r(t);
|
|
16
|
+
}
|
|
17
|
+
function a(e, r, i) {
|
|
18
|
+
if (e === "auto") return i.themeColour;
|
|
19
|
+
if (e.startsWith("preset:")) {
|
|
20
|
+
let t = e.slice(7), r = n.find((e) => e.id === t);
|
|
21
|
+
return r ? i.presets[r.id] : i.themeColour;
|
|
22
|
+
}
|
|
23
|
+
let a = t(e, r.settings.colours);
|
|
24
|
+
if (!a) return i.themeColour;
|
|
25
|
+
if (e.startsWith("colour:")) {
|
|
26
|
+
let t = e.slice(7), n = r.settings.colours.find((e) => e.id === t);
|
|
27
|
+
if (n) return n.name;
|
|
28
|
+
}
|
|
29
|
+
return r.settings.colours.find((e) => e.hex === a)?.name ?? a;
|
|
30
|
+
}
|
|
31
|
+
function o(t, n) {
|
|
32
|
+
return e(t) ? "colour" : t.trim() === "" && n ? "none" : "pending";
|
|
33
|
+
}
|
|
34
|
+
function s(t, n) {
|
|
35
|
+
let { accent: r, colours: i } = t;
|
|
36
|
+
if (n || r === "auto") return "auto";
|
|
37
|
+
if (r.startsWith("preset:")) return r;
|
|
38
|
+
if (r.startsWith("colour:")) {
|
|
39
|
+
let e = r.slice(7);
|
|
40
|
+
return i.some((t) => t.id === e) ? r : null;
|
|
41
|
+
}
|
|
42
|
+
let a = e(r), o = a ? i.find((e) => e.hex === a) : void 0;
|
|
43
|
+
return o ? `colour:${o.id}` : null;
|
|
44
|
+
}
|
|
45
|
+
var c = (e, t, n) => e === t || t === null && n ? 0 : -1;
|
|
46
|
+
export { a as accentNameOf, o as hexFieldState, i as notify, s as selectedSwatchOf, c as swatchTabIndex };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { KeyboardEvent, ReactNode } from 'react';
|
|
2
|
+
/** Every option: a card-like button, focus ring in the accent. */
|
|
3
|
+
export declare const OPTION = "relative min-w-0 rounded-card border text-start text-text-primary transition-colors outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)] disabled:cursor-not-allowed disabled:opacity-50";
|
|
4
|
+
/** An option nobody chose. */
|
|
5
|
+
export declare const OPTION_IDLE = "border-border-default bg-bg-surface enabled:hover:border-border-strong enabled:hover:bg-bg-sunken";
|
|
6
|
+
/** The chosen option: tinted with the accent, ringed in it (and it shows a check). */
|
|
7
|
+
export declare const OPTION_ON = "border-action-primary-bg bg-[var(--color-accent-soft)] shadow-[inset_0_0_0_1px_var(--color-action-primary-bg)]";
|
|
8
|
+
export declare const optionClass: (selected: boolean, extra?: string) => string;
|
|
9
|
+
/** The check a chosen option shows, in the accent's ink. */
|
|
10
|
+
export declare function SelectedCheck({ selected, className }: {
|
|
11
|
+
selected: boolean;
|
|
12
|
+
className?: string;
|
|
13
|
+
}): import('react').JSX.Element | null;
|
|
14
|
+
/** A small label beside a name: Default, New, Dark only, Yours, Adjusted. */
|
|
15
|
+
export declare function Tag({ children, tone, }: {
|
|
16
|
+
children: ReactNode;
|
|
17
|
+
tone?: 'neutral' | 'accent' | 'success' | 'warning';
|
|
18
|
+
}): import('react').JSX.Element;
|
|
19
|
+
/**
|
|
20
|
+
* Arrow keys, Home and End move through a radio group's enabled options and choose the one
|
|
21
|
+
* they land on, as a native radio group does (mirrored in a right-to-left page).
|
|
22
|
+
*/
|
|
23
|
+
export declare function useRadioGroupKeys(): (event: KeyboardEvent<HTMLElement>) => void;
|
|
24
|
+
/** The tab stop of a radio group: the chosen option, or the first when none is chosen. */
|
|
25
|
+
export declare const radioTabIndex: (selected: boolean, isFirst: boolean, anySelected: boolean) => 0 | -1;
|
|
26
|
+
/** One section of the page. */
|
|
27
|
+
export declare function AppearanceSection({ id, icon, title, description, aside, children, }: {
|
|
28
|
+
id: string;
|
|
29
|
+
icon: ReactNode;
|
|
30
|
+
title: string;
|
|
31
|
+
description?: string;
|
|
32
|
+
aside?: ReactNode;
|
|
33
|
+
children: ReactNode;
|
|
34
|
+
}): import('react').JSX.Element;
|
|
35
|
+
/**
|
|
36
|
+
* One colour to choose (a radio): a dot painted in the colour as it will be used, its name,
|
|
37
|
+
* and a line below (Default, the hex, Adjusted). The chosen one is tinted and its dot checked.
|
|
38
|
+
*/
|
|
39
|
+
export declare function Swatch({ selected, name, sub, fill, on, onSelect, tabIndex, title, testId, }: {
|
|
40
|
+
selected: boolean;
|
|
41
|
+
name: string;
|
|
42
|
+
sub?: string;
|
|
43
|
+
fill: string;
|
|
44
|
+
on: string;
|
|
45
|
+
onSelect: () => void;
|
|
46
|
+
tabIndex: number;
|
|
47
|
+
title?: string;
|
|
48
|
+
testId?: string;
|
|
49
|
+
}): import('react').JSX.Element;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { Card as e, CardContent as t, CardDescription as n, CardHeader as r, CardTitle as i } from "../../ui/card.js";
|
|
2
|
+
import { cn as a } from "../../utils/cn.js";
|
|
3
|
+
import "../../utils/index.js";
|
|
4
|
+
import { useCallback as o } from "react";
|
|
5
|
+
import { Check as s } from "lucide-react";
|
|
6
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
7
|
+
// src/chrome/appearance/appearanceUi.tsx
|
|
8
|
+
var u = "relative min-w-0 rounded-card border text-start text-text-primary transition-colors outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)] disabled:cursor-not-allowed disabled:opacity-50", d = "border-border-default bg-bg-surface enabled:hover:border-border-strong enabled:hover:bg-bg-sunken", f = "border-action-primary-bg bg-[var(--color-accent-soft)] shadow-[inset_0_0_0_1px_var(--color-action-primary-bg)]", p = (e, t) => a(u, e ? f : d, t);
|
|
9
|
+
function m({ selected: e, className: t }) {
|
|
10
|
+
return e ? /* @__PURE__ */ c(s, {
|
|
11
|
+
className: a("size-4 shrink-0 text-action-primary-bg", t),
|
|
12
|
+
"aria-hidden": "true"
|
|
13
|
+
}) : null;
|
|
14
|
+
}
|
|
15
|
+
function h({ children: e, tone: t = "neutral" }) {
|
|
16
|
+
return /* @__PURE__ */ c("span", {
|
|
17
|
+
className: a("inline-flex items-center whitespace-nowrap rounded-full border px-1.5 text-[11px] font-semibold leading-4", t === "neutral" && "border-border-subtle bg-bg-sunken text-text-secondary", t === "accent" && "border-action-primary-bg/40 bg-[var(--color-accent-soft)] text-action-primary-bg", t === "success" && "border-[var(--color-status-success-border)] bg-[var(--color-status-success-bgSubtle)] text-[var(--color-status-success-text)]", t === "warning" && "border-[var(--color-status-warning-border)] bg-[var(--color-status-warning-bgSubtle)] text-[var(--color-status-warning-text)]"),
|
|
18
|
+
children: e
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
function g() {
|
|
22
|
+
return o((e) => {
|
|
23
|
+
if (![
|
|
24
|
+
"ArrowRight",
|
|
25
|
+
"ArrowLeft",
|
|
26
|
+
"ArrowDown",
|
|
27
|
+
"ArrowUp",
|
|
28
|
+
"Home",
|
|
29
|
+
"End"
|
|
30
|
+
].includes(e.key)) return;
|
|
31
|
+
let t = e.target.closest("[role=\"radio\"]"), n = e.currentTarget;
|
|
32
|
+
if (!t || !n.contains(t)) return;
|
|
33
|
+
let r = Array.from(n.querySelectorAll("[role=\"radio\"]")).filter((e) => !e.disabled && e.getAttribute("aria-disabled") !== "true"), i = r.indexOf(t);
|
|
34
|
+
if (i < 0 || r.length === 0) return;
|
|
35
|
+
let a = getComputedStyle(n).direction === "rtl", o = e.key === "ArrowDown" || e.key === (a ? "ArrowLeft" : "ArrowRight"), s = e.key === "ArrowUp" || e.key === (a ? "ArrowRight" : "ArrowLeft"), c = i;
|
|
36
|
+
e.key === "Home" ? c = 0 : e.key === "End" ? c = r.length - 1 : o ? c = (i + 1) % r.length : s && (c = (i - 1 + r.length) % r.length), e.preventDefault();
|
|
37
|
+
let l = r[c];
|
|
38
|
+
l && (l.focus(), l.click());
|
|
39
|
+
}, []);
|
|
40
|
+
}
|
|
41
|
+
var _ = (e, t, n) => e || !n && t ? 0 : -1;
|
|
42
|
+
function v({ id: a, icon: o, title: s, description: u, aside: d, children: f }) {
|
|
43
|
+
return /* @__PURE__ */ l(e, {
|
|
44
|
+
"aria-labelledby": `${a}-title`,
|
|
45
|
+
role: "region",
|
|
46
|
+
"data-testid": a,
|
|
47
|
+
children: [/* @__PURE__ */ l(r, {
|
|
48
|
+
className: "gap-1",
|
|
49
|
+
children: [/* @__PURE__ */ l("div", {
|
|
50
|
+
className: "flex flex-wrap items-start justify-between gap-2",
|
|
51
|
+
children: [/* @__PURE__ */ l(i, {
|
|
52
|
+
id: `${a}-title`,
|
|
53
|
+
className: "flex items-center gap-2",
|
|
54
|
+
children: [/* @__PURE__ */ c("span", {
|
|
55
|
+
className: "text-text-secondary [&_svg]:size-4",
|
|
56
|
+
"aria-hidden": "true",
|
|
57
|
+
children: o
|
|
58
|
+
}), s]
|
|
59
|
+
}), d]
|
|
60
|
+
}), u && /* @__PURE__ */ c(n, { children: u })]
|
|
61
|
+
}), /* @__PURE__ */ c(t, {
|
|
62
|
+
className: "flex flex-col gap-4",
|
|
63
|
+
children: f
|
|
64
|
+
})]
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
function y({ selected: e, name: t, sub: n, fill: r, on: i, onSelect: o, tabIndex: d, title: p, testId: m }) {
|
|
68
|
+
return /* @__PURE__ */ l("button", {
|
|
69
|
+
type: "button",
|
|
70
|
+
role: "radio",
|
|
71
|
+
"aria-checked": e,
|
|
72
|
+
tabIndex: d,
|
|
73
|
+
onClick: o,
|
|
74
|
+
title: p,
|
|
75
|
+
"data-testid": m,
|
|
76
|
+
className: a(u, "flex w-[4.5rem] flex-col items-center gap-1 px-0.5 pt-1.5 pb-1 text-center text-xs", e ? f : "border-transparent text-text-secondary hover:bg-bg-sunken hover:text-text-primary"),
|
|
77
|
+
children: [
|
|
78
|
+
/* @__PURE__ */ c("span", {
|
|
79
|
+
"aria-hidden": "true",
|
|
80
|
+
className: "flex size-8 items-center justify-center rounded-full bg-[var(--appearance-swatch)] text-[var(--appearance-swatch-on)] shadow-[inset_0_0_0_1px_color-mix(in_oklab,var(--color-text-primary)_25%,transparent)]",
|
|
81
|
+
style: {
|
|
82
|
+
"--appearance-swatch": r,
|
|
83
|
+
"--appearance-swatch-on": i
|
|
84
|
+
},
|
|
85
|
+
children: e && /* @__PURE__ */ c(s, { className: "size-4" })
|
|
86
|
+
}),
|
|
87
|
+
/* @__PURE__ */ c("span", {
|
|
88
|
+
className: a("max-w-full break-words leading-tight", e && "font-semibold"),
|
|
89
|
+
children: t
|
|
90
|
+
}),
|
|
91
|
+
n && /* @__PURE__ */ c("span", {
|
|
92
|
+
className: "text-[10px] leading-none text-text-muted",
|
|
93
|
+
children: n
|
|
94
|
+
})
|
|
95
|
+
]
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
export { v as AppearanceSection, u as OPTION, d as OPTION_IDLE, f as OPTION_ON, m as SelectedCheck, y as Swatch, h as Tag, p as optionClass, _ as radioTabIndex, g as useRadioGroupKeys };
|