@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.
- package/dist/chrome/HeaderThemeSwitcher.js +1 -1
- 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/shell/ShellSidebar.js +2 -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/useBackgroundColors.js +3 -2
- 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/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 +1 -1
- 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
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useThemeOptionLabels as e } from "./useThemeOptionLabels.js";
|
|
2
2
|
import { useTheme as t } from "../shared/providers/shell/ThemeProvider.js";
|
|
3
3
|
import { DropdownMenu as n, DropdownMenuContent as r, DropdownMenuItem as i, DropdownMenuLabel as a, DropdownMenuSeparator as o, DropdownMenuTrigger as s } from "../ui/dropdown-menu.js";
|
|
4
|
-
import "../utils/index.js";
|
|
5
4
|
import { cn as c } from "../utils/cn.js";
|
|
5
|
+
import "../utils/index.js";
|
|
6
6
|
import { useExclusiveMenu as l } from "../shared/hooks/useExclusiveMenu.js";
|
|
7
7
|
import { useShellLabel as u } from "../shared/providers/shell/useShellLabel.js";
|
|
8
8
|
import { useCallback as d, useState as f } from "react";
|
|
@@ -7,8 +7,8 @@ import { Input as ee } from "../ui/input.js";
|
|
|
7
7
|
import { Label as u } from "../ui/label.js";
|
|
8
8
|
import { Switch as d } from "../ui/switch.js";
|
|
9
9
|
import { Select as f, SelectContent as p, SelectItem as m, SelectTrigger as h, SelectValue as g } from "../ui/select.js";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
10
|
+
import { cn as _ } from "../utils/cn.js";
|
|
11
|
+
import { Badge as v } from "../ui/badge.js";
|
|
12
12
|
import "../utils/index.js";
|
|
13
13
|
import { useCallback as y, useId as b, useMemo as x, useState as S } from "react";
|
|
14
14
|
import { Check as C, Palette as w, Pencil as te, Plus as ne, Trash2 as T, X as E } from "lucide-react";
|
|
@@ -125,7 +125,7 @@ function j({ className: f, showCustomThemes: p = !0 }) {
|
|
|
125
125
|
j
|
|
126
126
|
]);
|
|
127
127
|
return /* @__PURE__ */ O("div", {
|
|
128
|
-
className:
|
|
128
|
+
className: _("flex flex-col gap-6", f),
|
|
129
129
|
children: [
|
|
130
130
|
p && /* @__PURE__ */ O(a, { children: [/* @__PURE__ */ O(c, { children: [/* @__PURE__ */ O(l, {
|
|
131
131
|
className: "flex items-center gap-2",
|
|
@@ -280,7 +280,7 @@ function j({ className: f, showCustomThemes: p = !0 }) {
|
|
|
280
280
|
className: "h-8 w-44"
|
|
281
281
|
}) : /* @__PURE__ */ O("span", {
|
|
282
282
|
className: "flex flex-1 items-center gap-2 text-sm text-text-primary",
|
|
283
|
-
children: [e.name, t && /* @__PURE__ */ O(
|
|
283
|
+
children: [e.name, t && /* @__PURE__ */ O(v, {
|
|
284
284
|
variant: "success",
|
|
285
285
|
className: "gap-1",
|
|
286
286
|
children: [/* @__PURE__ */ D(C, {
|
|
@@ -333,7 +333,7 @@ function j({ className: f, showCustomThemes: p = !0 }) {
|
|
|
333
333
|
"data-density": $.density,
|
|
334
334
|
"data-typography": $.typography,
|
|
335
335
|
"data-glass": $.glass,
|
|
336
|
-
className:
|
|
336
|
+
className: _("flex flex-col gap-4 rounded-card border border-border-seam p-4", A(n.find((e) => e.value === $.theme)?.family ?? "light")),
|
|
337
337
|
children: [
|
|
338
338
|
/* @__PURE__ */ O("div", {
|
|
339
339
|
className: "flex flex-wrap items-center gap-2",
|
|
@@ -383,20 +383,20 @@ function j({ className: f, showCustomThemes: p = !0 }) {
|
|
|
383
383
|
/* @__PURE__ */ O("div", {
|
|
384
384
|
className: "flex flex-wrap items-center gap-2",
|
|
385
385
|
children: [
|
|
386
|
-
/* @__PURE__ */ D(
|
|
387
|
-
/* @__PURE__ */ D(
|
|
386
|
+
/* @__PURE__ */ D(v, { children: m("themeSwitcher.default", "Default") }),
|
|
387
|
+
/* @__PURE__ */ D(v, {
|
|
388
388
|
variant: "secondary",
|
|
389
389
|
children: m("notifications.actionStyle.secondary", "Secondary")
|
|
390
390
|
}),
|
|
391
|
-
/* @__PURE__ */ D(
|
|
391
|
+
/* @__PURE__ */ D(v, {
|
|
392
392
|
variant: "success",
|
|
393
393
|
children: m("common.success", "Success")
|
|
394
394
|
}),
|
|
395
|
-
/* @__PURE__ */ D(
|
|
395
|
+
/* @__PURE__ */ D(v, {
|
|
396
396
|
variant: "warning",
|
|
397
397
|
children: m("themeSwitcher.warning", "Warning")
|
|
398
398
|
}),
|
|
399
|
-
/* @__PURE__ */ D(
|
|
399
|
+
/* @__PURE__ */ D(v, {
|
|
400
400
|
variant: "destructive",
|
|
401
401
|
children: m("common.errorPage.title", "Error")
|
|
402
402
|
})
|
|
@@ -424,9 +424,9 @@ function M({ label: e, family: t, accent: n, active: r, onSelect: i }) {
|
|
|
424
424
|
role: "radio",
|
|
425
425
|
"aria-checked": r,
|
|
426
426
|
onClick: i,
|
|
427
|
-
className:
|
|
427
|
+
className: _("group relative flex flex-col gap-2 rounded-card border p-2 text-start transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]", r ? "border-border-focus bg-[var(--color-accent-soft)]" : "border-border-default bg-bg-surface hover:border-border-strong hover:bg-bg-sunken"),
|
|
428
428
|
children: [/* @__PURE__ */ D("span", {
|
|
429
|
-
className:
|
|
429
|
+
className: _("relative flex h-12 w-full items-end overflow-hidden rounded-button border border-border-seam", A(t)),
|
|
430
430
|
"aria-hidden": "true",
|
|
431
431
|
children: /* @__PURE__ */ D("span", {
|
|
432
432
|
className: "m-1.5 size-3 rounded-full shadow-elevation-1",
|
|
@@ -457,13 +457,13 @@ function N({ title: e, description: t, value: n, options: r, onChange: i }) {
|
|
|
457
457
|
role: "radio",
|
|
458
458
|
"aria-checked": t,
|
|
459
459
|
onClick: () => i(e.value),
|
|
460
|
-
className:
|
|
460
|
+
className: _("flex-1 rounded-button px-4 py-1.5 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]", t ? "bg-bg-surface text-text-primary shadow-elevation-1" : "text-text-secondary hover:text-text-primary"),
|
|
461
461
|
children: e.label
|
|
462
462
|
}, e.value);
|
|
463
463
|
})
|
|
464
464
|
}) })] });
|
|
465
465
|
}
|
|
466
|
-
function P({ name: n, base: r, accent: f, density: p, typography: m, glass: h, reduceMotion: g, onName:
|
|
466
|
+
function P({ name: n, base: r, accent: f, density: p, typography: m, glass: h, reduceMotion: g, onName: v, onBase: y, onAccent: x, onDensity: S, onTypography: w, onGlass: te, onReduceMotion: ne, onSave: T, onCancel: k }) {
|
|
467
467
|
let A = t(), j = e(), M = b(), N = b(), P = b();
|
|
468
468
|
return /* @__PURE__ */ O(a, { children: [/* @__PURE__ */ O(c, {
|
|
469
469
|
className: "flex-row items-start justify-between gap-4 space-y-0",
|
|
@@ -492,7 +492,7 @@ function P({ name: n, base: r, accent: f, density: p, typography: m, glass: h, r
|
|
|
492
492
|
}), /* @__PURE__ */ D(ee, {
|
|
493
493
|
id: M,
|
|
494
494
|
value: n,
|
|
495
|
-
onChange: (e) =>
|
|
495
|
+
onChange: (e) => v(e.target.value),
|
|
496
496
|
placeholder: A("themeSwitcher.myTheme", "My theme")
|
|
497
497
|
})]
|
|
498
498
|
}),
|
|
@@ -513,7 +513,7 @@ function P({ name: n, base: r, accent: f, density: p, typography: m, glass: h, r
|
|
|
513
513
|
role: "radio",
|
|
514
514
|
"aria-checked": t,
|
|
515
515
|
onClick: () => y(e),
|
|
516
|
-
className:
|
|
516
|
+
className: _("flex-1 rounded-button px-4 py-1.5 text-sm font-medium capitalize transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]", t ? "bg-bg-surface text-text-primary shadow-elevation-1" : "text-text-secondary hover:text-text-primary"),
|
|
517
517
|
children: e === "light" ? A("themeSwitcher.lightBase", "light") : A("themeSwitcher.darkBase", "dark")
|
|
518
518
|
}, e);
|
|
519
519
|
})
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
import { AppearanceControls } from '../../shared/providers/shell/themeContext';
|
|
3
|
+
import { ColourDraft } from './ColourPanel';
|
|
4
|
+
import { AppearanceLabels } from './useAppearanceLabels';
|
|
5
|
+
/** The colour being added or changed (`editId`: the saved colour being changed). */
|
|
6
|
+
export type ColourPanelState = (ColourDraft & {
|
|
7
|
+
editId: string | null;
|
|
8
|
+
}) | null;
|
|
9
|
+
export declare function AppearanceColourSection({ appearance, brand, labels, panel, setPanel, addColourButton, }: {
|
|
10
|
+
appearance: AppearanceControls;
|
|
11
|
+
brand: string;
|
|
12
|
+
labels: AppearanceLabels;
|
|
13
|
+
/** The open panel (the page's live preview shows its colour before it is saved). */
|
|
14
|
+
panel: ColourPanelState;
|
|
15
|
+
setPanel: (next: ColourPanelState | ((current: ColourPanelState) => ColourPanelState)) => void;
|
|
16
|
+
addColourButton: RefObject<HTMLButtonElement | null>;
|
|
17
|
+
}): import('react').JSX.Element;
|
|
@@ -0,0 +1,337 @@
|
|
|
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, resolveAppearance as r } from "../../shared/providers/shell/appearance/model.js";
|
|
4
|
+
import { ACCENT_PRESETS as i, NEW_COLOUR_START as a, PALETTES as o, SITE_COLOURS as s, paletteSurfaces as c } from "../../shared/providers/shell/appearance/palettes.js";
|
|
5
|
+
import { Button as l } from "../../ui/button.js";
|
|
6
|
+
import { Input as u } from "../../ui/input.js";
|
|
7
|
+
import { cn as d } from "../../utils/cn.js";
|
|
8
|
+
import "../../utils/index.js";
|
|
9
|
+
import { ColourPanel as f, formatRatio as p } from "./ColourPanel.js";
|
|
10
|
+
import { accentNameOf as m, notify as h, selectedSwatchOf as g, swatchTabIndex as _ } from "./appearanceShared.js";
|
|
11
|
+
import { AppearanceSection as v, Swatch as y, useRadioGroupKeys as b } from "./appearanceUi.js";
|
|
12
|
+
import { useRef as x, useState as S } from "react";
|
|
13
|
+
import { AlertTriangle as C, Check as w, ChevronDown as T, ChevronUp as E, GripVertical as D, Palette as O, Pencil as k, Plus as ee, Trash2 as A } from "lucide-react";
|
|
14
|
+
import { Fragment as j, jsx as M, jsxs as N } from "react/jsx-runtime";
|
|
15
|
+
// src/chrome/appearance/AppearanceColourSection.tsx
|
|
16
|
+
function P({ appearance: u, brand: d, labels: x, panel: T, setPanel: E, addColourButton: D }) {
|
|
17
|
+
let A = b(), { settings: P, resolved: I, systemDark: L } = u, [R, z] = S(!1), B = n(P.palette, I.scheme, P.darkDepth, !0), V = o[P.palette], H = !!V.fixedAccent, U = T ? e(T.hex) : null, W = () => {
|
|
18
|
+
z(!1), E({
|
|
19
|
+
editId: null,
|
|
20
|
+
hex: a,
|
|
21
|
+
name: x.colourDefaultName(P.colours.length + 1)
|
|
22
|
+
});
|
|
23
|
+
}, G = () => {
|
|
24
|
+
E(null), requestAnimationFrame(() => D.current?.focus());
|
|
25
|
+
}, K = () => {
|
|
26
|
+
if (!T) return;
|
|
27
|
+
let t = e(T.hex);
|
|
28
|
+
if (!t) return;
|
|
29
|
+
let n = T.name.trim() || x.colourDefaultName(P.colours.length + 1);
|
|
30
|
+
if (T.editId) u.updateColour(T.editId, {
|
|
31
|
+
hex: t,
|
|
32
|
+
name: n
|
|
33
|
+
}), h(x, x.colourUpdated(n));
|
|
34
|
+
else {
|
|
35
|
+
let e = u.addColour({
|
|
36
|
+
hex: t,
|
|
37
|
+
name: n
|
|
38
|
+
});
|
|
39
|
+
if (!e) {
|
|
40
|
+
h(x, x.colourFull);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
h(x, x.colourSaved(e.name));
|
|
44
|
+
}
|
|
45
|
+
G();
|
|
46
|
+
}, q = (e) => {
|
|
47
|
+
let t = P.colours.find((t) => t.id === e);
|
|
48
|
+
if (!t) return;
|
|
49
|
+
let n = u.snapshot(), r = P.accent === `colour:${e}`;
|
|
50
|
+
u.deleteColour(e), P.colours.length <= 1 && z(!1), h(x, r ? x.colourDeletedAccent(t.name) : x.colourDeleted(t.name), () => {
|
|
51
|
+
u.restore(n), z(!0);
|
|
52
|
+
});
|
|
53
|
+
}, J = U ? V.modes.map((e) => ({
|
|
54
|
+
scheme: e,
|
|
55
|
+
surfaces: c(P.palette, e, P.darkDepth),
|
|
56
|
+
accent: t(U, n(P.palette, e, P.darkDepth, !0))
|
|
57
|
+
})) : [], Y = m(P.accent, u, x), X = !I.auto && !P.accent.startsWith("preset:") && P.accent !== "auto" && (I.accent.adjusted || I.accent.inkAdjusted), Z = r({
|
|
58
|
+
...P,
|
|
59
|
+
accent: "auto",
|
|
60
|
+
colours: []
|
|
61
|
+
}, {
|
|
62
|
+
systemDark: L,
|
|
63
|
+
brand: d
|
|
64
|
+
}).accent, Q = (e) => {
|
|
65
|
+
if (e === "purple") return x.palettes.fluidgrids.name;
|
|
66
|
+
if (e === "cyan" && d === "fluidgrids") return x.palettes.classic.name;
|
|
67
|
+
}, $ = g(P, H);
|
|
68
|
+
return /* @__PURE__ */ N(v, {
|
|
69
|
+
id: "appearance-colour",
|
|
70
|
+
icon: /* @__PURE__ */ M(O, {}),
|
|
71
|
+
title: x.colourTitle,
|
|
72
|
+
description: x.colourDescription,
|
|
73
|
+
children: [
|
|
74
|
+
H && /* @__PURE__ */ N("p", {
|
|
75
|
+
className: "flex items-start gap-2 text-sm text-text-secondary",
|
|
76
|
+
children: [/* @__PURE__ */ M(C, {
|
|
77
|
+
className: "mt-0.5 size-4 shrink-0 text-text-muted",
|
|
78
|
+
"aria-hidden": "true"
|
|
79
|
+
}), x.colourFixed]
|
|
80
|
+
}),
|
|
81
|
+
/* @__PURE__ */ N("div", {
|
|
82
|
+
role: "radiogroup",
|
|
83
|
+
"aria-labelledby": "appearance-colour-title",
|
|
84
|
+
onKeyDown: A,
|
|
85
|
+
className: "flex flex-col gap-3",
|
|
86
|
+
"data-testid": "appearance-colours",
|
|
87
|
+
children: [
|
|
88
|
+
/* @__PURE__ */ M("span", {
|
|
89
|
+
className: "text-sm font-medium text-text-primary",
|
|
90
|
+
children: x.presetsTitle
|
|
91
|
+
}),
|
|
92
|
+
/* @__PURE__ */ N("div", {
|
|
93
|
+
className: "flex flex-wrap gap-1",
|
|
94
|
+
children: [/* @__PURE__ */ M(y, {
|
|
95
|
+
selected: $ === "auto",
|
|
96
|
+
name: x.themeColour,
|
|
97
|
+
sub: x.tagDefault,
|
|
98
|
+
fill: Z.fill,
|
|
99
|
+
on: Z.on,
|
|
100
|
+
tabIndex: _("auto", $, !0),
|
|
101
|
+
onSelect: () => u.setAccent("auto"),
|
|
102
|
+
testId: "appearance-accent-auto"
|
|
103
|
+
}), !H && i.map((e) => {
|
|
104
|
+
let t = `preset:${e.id}`, n = r({
|
|
105
|
+
...P,
|
|
106
|
+
accent: t
|
|
107
|
+
}, {
|
|
108
|
+
systemDark: L,
|
|
109
|
+
brand: d
|
|
110
|
+
}).accent;
|
|
111
|
+
return /* @__PURE__ */ M(y, {
|
|
112
|
+
selected: $ === t,
|
|
113
|
+
name: x.presets[e.id],
|
|
114
|
+
sub: Q(e.id),
|
|
115
|
+
fill: n.fill,
|
|
116
|
+
on: n.on,
|
|
117
|
+
tabIndex: _(t, $, !1),
|
|
118
|
+
onSelect: () => u.setAccent(t),
|
|
119
|
+
testId: `appearance-accent-${e.id}`
|
|
120
|
+
}, e.id);
|
|
121
|
+
})]
|
|
122
|
+
}),
|
|
123
|
+
!H && /* @__PURE__ */ N(j, { children: [/* @__PURE__ */ N("span", {
|
|
124
|
+
className: "flex items-baseline gap-2 text-sm font-medium text-text-primary",
|
|
125
|
+
children: [x.mine, /* @__PURE__ */ M("span", {
|
|
126
|
+
className: "text-xs font-normal text-text-muted",
|
|
127
|
+
children: x.mineHint
|
|
128
|
+
})]
|
|
129
|
+
}), /* @__PURE__ */ N("div", {
|
|
130
|
+
className: "flex flex-wrap gap-1",
|
|
131
|
+
"data-testid": "appearance-my-colours",
|
|
132
|
+
children: [P.colours.length === 0 && /* @__PURE__ */ M("span", {
|
|
133
|
+
className: "text-xs text-text-muted",
|
|
134
|
+
children: x.mineEmpty
|
|
135
|
+
}), P.colours.map((e) => {
|
|
136
|
+
let n = t(e.hex, B), r = `colour:${e.id}`;
|
|
137
|
+
return /* @__PURE__ */ M(y, {
|
|
138
|
+
selected: $ === r,
|
|
139
|
+
name: e.name,
|
|
140
|
+
sub: n.adjusted ? x.adjusted : e.hex,
|
|
141
|
+
fill: e.hex,
|
|
142
|
+
on: n.on,
|
|
143
|
+
tabIndex: _(r, $, !1),
|
|
144
|
+
onSelect: () => u.setAccent(`colour:${e.id}`),
|
|
145
|
+
testId: `appearance-colour-${e.id}`
|
|
146
|
+
}, e.id);
|
|
147
|
+
})]
|
|
148
|
+
})] })
|
|
149
|
+
]
|
|
150
|
+
}),
|
|
151
|
+
!H && /* @__PURE__ */ N("div", {
|
|
152
|
+
className: "flex flex-wrap items-center gap-2",
|
|
153
|
+
children: [/* @__PURE__ */ N(l, {
|
|
154
|
+
ref: D,
|
|
155
|
+
type: "button",
|
|
156
|
+
variant: "outline",
|
|
157
|
+
size: "sm",
|
|
158
|
+
onClick: W,
|
|
159
|
+
disabled: P.colours.length >= 24,
|
|
160
|
+
"data-testid": "appearance-colour-add",
|
|
161
|
+
children: [/* @__PURE__ */ M(ee, { "aria-hidden": "true" }), x.addColour]
|
|
162
|
+
}), P.colours.length > 0 && /* @__PURE__ */ N(l, {
|
|
163
|
+
type: "button",
|
|
164
|
+
variant: "ghost",
|
|
165
|
+
size: "sm",
|
|
166
|
+
"aria-expanded": R,
|
|
167
|
+
onClick: () => {
|
|
168
|
+
E(null), z((e) => !e);
|
|
169
|
+
},
|
|
170
|
+
"data-testid": "appearance-colour-manage",
|
|
171
|
+
children: [M(R ? w : k, { "aria-hidden": "true" }), R ? x.done : x.manage]
|
|
172
|
+
})]
|
|
173
|
+
}),
|
|
174
|
+
T && !H && /* @__PURE__ */ M("div", {
|
|
175
|
+
onKeyDown: (e) => {
|
|
176
|
+
e.key === "Escape" && (e.stopPropagation(), G());
|
|
177
|
+
},
|
|
178
|
+
children: /* @__PURE__ */ M(f, {
|
|
179
|
+
editing: T.editId !== null,
|
|
180
|
+
draft: T,
|
|
181
|
+
onDraft: (e) => E((t) => t && {
|
|
182
|
+
...t,
|
|
183
|
+
...e
|
|
184
|
+
}),
|
|
185
|
+
onSave: K,
|
|
186
|
+
onCancel: G,
|
|
187
|
+
checks: J,
|
|
188
|
+
quickPicks: s.map((e) => ({
|
|
189
|
+
id: e.id,
|
|
190
|
+
name: x.presets[e.id],
|
|
191
|
+
hex: e.hex
|
|
192
|
+
})),
|
|
193
|
+
labels: x
|
|
194
|
+
})
|
|
195
|
+
}),
|
|
196
|
+
R && !H && P.colours.length > 0 && /* @__PURE__ */ M(F, {
|
|
197
|
+
appearance: u,
|
|
198
|
+
labels: x,
|
|
199
|
+
onDelete: q,
|
|
200
|
+
onEdit: (e) => {
|
|
201
|
+
z(!1), E({
|
|
202
|
+
editId: e.id,
|
|
203
|
+
hex: e.hex,
|
|
204
|
+
name: e.name
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
}),
|
|
208
|
+
X && /* @__PURE__ */ N("p", {
|
|
209
|
+
className: "flex items-start gap-2 text-sm text-text-secondary",
|
|
210
|
+
"data-testid": "appearance-adjusted",
|
|
211
|
+
children: [/* @__PURE__ */ M(C, {
|
|
212
|
+
className: "mt-0.5 size-4 shrink-0 text-[var(--color-status-warning-text)]",
|
|
213
|
+
"aria-hidden": "true"
|
|
214
|
+
}), x.adjustedLine(Y, x.schemes[I.scheme], I.accent.fill, p(I.accent.onRatio), I.accent.ink)]
|
|
215
|
+
})
|
|
216
|
+
]
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
function F({ appearance: e, labels: t, onDelete: n, onEdit: r }) {
|
|
220
|
+
let i = e.settings.colours, a = x(null), [o, s] = S(null), c = (n, r) => {
|
|
221
|
+
let a = i.find((e) => e.id === n), o = r.trim();
|
|
222
|
+
a && o && o !== a.name && (e.updateColour(n, { name: o }), h(t, t.colourRenamed(o)));
|
|
223
|
+
}, f = (t, n) => {
|
|
224
|
+
e.moveColour(t, n), requestAnimationFrame(() => {
|
|
225
|
+
document.querySelector(`[data-move="${t}"]:not(:disabled)`)?.focus();
|
|
226
|
+
});
|
|
227
|
+
};
|
|
228
|
+
return /* @__PURE__ */ N("div", {
|
|
229
|
+
className: "flex flex-col gap-2",
|
|
230
|
+
"data-testid": "appearance-manage-colours",
|
|
231
|
+
children: [/* @__PURE__ */ M("ul", {
|
|
232
|
+
"aria-label": t.mine,
|
|
233
|
+
className: "flex flex-col divide-y divide-border-subtle rounded-card border border-border-subtle",
|
|
234
|
+
children: i.map((p, m) => /* @__PURE__ */ N("li", {
|
|
235
|
+
draggable: !0,
|
|
236
|
+
onDragStart: (e) => {
|
|
237
|
+
a.current = p.id, e.dataTransfer.effectAllowed = "move", e.dataTransfer.setData("text/plain", p.id);
|
|
238
|
+
},
|
|
239
|
+
onDragOver: (e) => {
|
|
240
|
+
a.current && (e.preventDefault(), s(p.id));
|
|
241
|
+
},
|
|
242
|
+
onDragLeave: () => s((e) => e === p.id ? null : e),
|
|
243
|
+
onDrop: (n) => {
|
|
244
|
+
n.preventDefault();
|
|
245
|
+
let r = a.current;
|
|
246
|
+
if (a.current = null, s(null), r && r !== p.id) {
|
|
247
|
+
e.moveColour(r, m);
|
|
248
|
+
let n = i.find((e) => e.id === r);
|
|
249
|
+
n && h(t, t.colourMoved(n.name));
|
|
250
|
+
}
|
|
251
|
+
},
|
|
252
|
+
onDragEnd: () => {
|
|
253
|
+
a.current = null, s(null);
|
|
254
|
+
},
|
|
255
|
+
className: d("flex flex-wrap items-center gap-2 px-2 py-1.5", o === p.id && "bg-[var(--color-accent-soft)]"),
|
|
256
|
+
"data-testid": `appearance-manage-${p.id}`,
|
|
257
|
+
children: [
|
|
258
|
+
/* @__PURE__ */ M("span", {
|
|
259
|
+
className: "cursor-grab text-text-muted",
|
|
260
|
+
title: t.dragHandle,
|
|
261
|
+
children: /* @__PURE__ */ M(D, {
|
|
262
|
+
className: "size-4",
|
|
263
|
+
"aria-hidden": "true"
|
|
264
|
+
})
|
|
265
|
+
}),
|
|
266
|
+
/* @__PURE__ */ M("span", {
|
|
267
|
+
"aria-hidden": "true",
|
|
268
|
+
className: "size-6 shrink-0 rounded-full bg-[var(--appearance-swatch)] shadow-[inset_0_0_0_1px_color-mix(in_oklab,var(--color-text-primary)_25%,transparent)]",
|
|
269
|
+
style: { "--appearance-swatch": p.hex }
|
|
270
|
+
}),
|
|
271
|
+
/* @__PURE__ */ M(u, {
|
|
272
|
+
type: "text",
|
|
273
|
+
defaultValue: p.name,
|
|
274
|
+
maxLength: 24,
|
|
275
|
+
autoComplete: "off",
|
|
276
|
+
"aria-label": t.nameFor(p.name),
|
|
277
|
+
className: "h-8 min-w-0 flex-[1_1_8rem]",
|
|
278
|
+
onBlur: (e) => c(p.id, e.target.value),
|
|
279
|
+
onKeyDown: (e) => {
|
|
280
|
+
e.key === "Enter" && (e.preventDefault(), e.currentTarget.blur());
|
|
281
|
+
}
|
|
282
|
+
}, `${p.id}-${p.name}`),
|
|
283
|
+
/* @__PURE__ */ M("span", {
|
|
284
|
+
className: "font-mono text-xs text-text-muted",
|
|
285
|
+
children: p.hex
|
|
286
|
+
}),
|
|
287
|
+
/* @__PURE__ */ N("span", {
|
|
288
|
+
className: "ms-auto flex items-center gap-0.5",
|
|
289
|
+
children: [
|
|
290
|
+
/* @__PURE__ */ M(l, {
|
|
291
|
+
type: "button",
|
|
292
|
+
variant: "ghost",
|
|
293
|
+
size: "icon-sm",
|
|
294
|
+
"aria-label": t.moveUp(p.name),
|
|
295
|
+
disabled: m === 0,
|
|
296
|
+
"data-move": p.id,
|
|
297
|
+
onClick: () => f(p.id, m - 1),
|
|
298
|
+
children: /* @__PURE__ */ M(E, { "aria-hidden": "true" })
|
|
299
|
+
}),
|
|
300
|
+
/* @__PURE__ */ M(l, {
|
|
301
|
+
type: "button",
|
|
302
|
+
variant: "ghost",
|
|
303
|
+
size: "icon-sm",
|
|
304
|
+
"aria-label": t.moveDown(p.name),
|
|
305
|
+
disabled: m === i.length - 1,
|
|
306
|
+
"data-move": p.id,
|
|
307
|
+
onClick: () => f(p.id, m + 1),
|
|
308
|
+
children: /* @__PURE__ */ M(T, { "aria-hidden": "true" })
|
|
309
|
+
}),
|
|
310
|
+
/* @__PURE__ */ M(l, {
|
|
311
|
+
type: "button",
|
|
312
|
+
variant: "ghost",
|
|
313
|
+
size: "icon-sm",
|
|
314
|
+
"aria-label": t.changeColour(p.name),
|
|
315
|
+
onClick: () => r(p),
|
|
316
|
+
children: /* @__PURE__ */ M(O, { "aria-hidden": "true" })
|
|
317
|
+
}),
|
|
318
|
+
/* @__PURE__ */ M(l, {
|
|
319
|
+
type: "button",
|
|
320
|
+
variant: "ghost",
|
|
321
|
+
size: "icon-sm",
|
|
322
|
+
"aria-label": t.deleteColour(p.name),
|
|
323
|
+
onClick: () => n(p.id),
|
|
324
|
+
"data-testid": `appearance-colour-delete-${p.id}`,
|
|
325
|
+
children: /* @__PURE__ */ M(A, { "aria-hidden": "true" })
|
|
326
|
+
})
|
|
327
|
+
]
|
|
328
|
+
})
|
|
329
|
+
]
|
|
330
|
+
}, p.id))
|
|
331
|
+
}), /* @__PURE__ */ M("p", {
|
|
332
|
+
className: "text-xs text-text-muted",
|
|
333
|
+
children: t.manageHint
|
|
334
|
+
})]
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
export { P as AppearanceColourSection };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AppearanceControls, ThemeContextValue } from '../../shared/providers/shell/themeContext';
|
|
2
|
+
import { AppearanceLabels } from './useAppearanceLabels';
|
|
3
|
+
export declare function AppearanceDisplaySection({ appearance, theme, labels, }: {
|
|
4
|
+
appearance: AppearanceControls;
|
|
5
|
+
theme: ThemeContextValue;
|
|
6
|
+
labels: AppearanceLabels;
|
|
7
|
+
}): import('react').JSX.Element;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { PALETTES as e } from "../../shared/providers/shell/appearance/palettes.js";
|
|
2
|
+
import { Switch as t } from "../../ui/switch.js";
|
|
3
|
+
import { AppearanceSection as n, SelectedCheck as r, Tag as i, optionClass as a, useRadioGroupKeys as o } from "./appearanceUi.js";
|
|
4
|
+
import { useId as s } from "react";
|
|
5
|
+
import { Layers as c } from "lucide-react";
|
|
6
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
7
|
+
// src/chrome/appearance/AppearanceDisplaySection.tsx
|
|
8
|
+
var d = [
|
|
9
|
+
"compact",
|
|
10
|
+
"comfortable",
|
|
11
|
+
"spacious"
|
|
12
|
+
], f = [
|
|
13
|
+
"small",
|
|
14
|
+
"default",
|
|
15
|
+
"large"
|
|
16
|
+
], p = [
|
|
17
|
+
"off",
|
|
18
|
+
"subtle",
|
|
19
|
+
"full"
|
|
20
|
+
];
|
|
21
|
+
function m({ appearance: r, theme: i, labels: a }) {
|
|
22
|
+
let m = s(), g = o(), _ = !!e[r.settings.palette].solid;
|
|
23
|
+
return /* @__PURE__ */ u(n, {
|
|
24
|
+
id: "appearance-display",
|
|
25
|
+
icon: /* @__PURE__ */ l(c, {}),
|
|
26
|
+
title: a.displayTitle,
|
|
27
|
+
description: a.displayDescription,
|
|
28
|
+
children: [
|
|
29
|
+
/* @__PURE__ */ l(h, {
|
|
30
|
+
id: `${m}-density`,
|
|
31
|
+
name: a.density,
|
|
32
|
+
hint: a.densityHint,
|
|
33
|
+
value: i.density,
|
|
34
|
+
options: d.map((e) => ({
|
|
35
|
+
value: e,
|
|
36
|
+
label: a.densities[e]
|
|
37
|
+
})),
|
|
38
|
+
defaultValue: r.displayDefaults.density,
|
|
39
|
+
defaultLabel: a.tagDefault,
|
|
40
|
+
onChange: i.setDensity,
|
|
41
|
+
keys: g,
|
|
42
|
+
testId: "appearance-density"
|
|
43
|
+
}),
|
|
44
|
+
/* @__PURE__ */ l(h, {
|
|
45
|
+
id: `${m}-text`,
|
|
46
|
+
name: a.textSize,
|
|
47
|
+
hint: a.textSizeHint,
|
|
48
|
+
value: i.typography,
|
|
49
|
+
options: f.map((e) => ({
|
|
50
|
+
value: e,
|
|
51
|
+
label: a.textSizes[e]
|
|
52
|
+
})),
|
|
53
|
+
defaultValue: r.displayDefaults.typography,
|
|
54
|
+
defaultLabel: a.tagDefault,
|
|
55
|
+
onChange: i.setTypography,
|
|
56
|
+
keys: g,
|
|
57
|
+
testId: "appearance-text"
|
|
58
|
+
}),
|
|
59
|
+
/* @__PURE__ */ l(h, {
|
|
60
|
+
id: `${m}-glass`,
|
|
61
|
+
name: a.glass,
|
|
62
|
+
hint: _ ? a.glassSolid : a.glassHint,
|
|
63
|
+
value: i.glass,
|
|
64
|
+
options: p.map((e) => ({
|
|
65
|
+
value: e,
|
|
66
|
+
label: a.glasses[e]
|
|
67
|
+
})),
|
|
68
|
+
defaultValue: r.displayDefaults.glass,
|
|
69
|
+
defaultLabel: a.tagDefault,
|
|
70
|
+
onChange: i.setGlass,
|
|
71
|
+
keys: g,
|
|
72
|
+
disabled: _,
|
|
73
|
+
testId: "appearance-glass"
|
|
74
|
+
}),
|
|
75
|
+
/* @__PURE__ */ u("div", {
|
|
76
|
+
className: "flex items-center justify-between gap-4",
|
|
77
|
+
children: [/* @__PURE__ */ u("div", {
|
|
78
|
+
className: "flex min-w-0 flex-col",
|
|
79
|
+
children: [/* @__PURE__ */ l("span", {
|
|
80
|
+
id: `${m}-motion`,
|
|
81
|
+
className: "text-sm font-medium text-text-primary",
|
|
82
|
+
children: a.reduceMotion
|
|
83
|
+
}), /* @__PURE__ */ l("span", {
|
|
84
|
+
className: "text-xs text-text-muted",
|
|
85
|
+
children: a.reduceMotionHint
|
|
86
|
+
})]
|
|
87
|
+
}), /* @__PURE__ */ l(t, {
|
|
88
|
+
checked: i.reduceMotion,
|
|
89
|
+
onCheckedChange: i.setReduceMotion,
|
|
90
|
+
"aria-labelledby": `${m}-motion`,
|
|
91
|
+
"data-testid": "appearance-reduce-motion"
|
|
92
|
+
})]
|
|
93
|
+
})
|
|
94
|
+
]
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
function h({ id: e, name: t, hint: n, value: o, options: s, defaultValue: c, defaultLabel: d, onChange: f, keys: p, disabled: m = !1, testId: h }) {
|
|
98
|
+
return /* @__PURE__ */ u("div", {
|
|
99
|
+
className: "flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",
|
|
100
|
+
children: [/* @__PURE__ */ u("div", {
|
|
101
|
+
className: "flex min-w-0 flex-col",
|
|
102
|
+
children: [/* @__PURE__ */ l("span", {
|
|
103
|
+
id: e,
|
|
104
|
+
className: "text-sm font-medium text-text-primary",
|
|
105
|
+
children: t
|
|
106
|
+
}), /* @__PURE__ */ l("span", {
|
|
107
|
+
className: "text-xs text-text-muted",
|
|
108
|
+
children: n
|
|
109
|
+
})]
|
|
110
|
+
}), /* @__PURE__ */ l("div", {
|
|
111
|
+
role: "radiogroup",
|
|
112
|
+
"aria-labelledby": e,
|
|
113
|
+
onKeyDown: p,
|
|
114
|
+
className: "flex flex-wrap gap-1.5",
|
|
115
|
+
"data-testid": h,
|
|
116
|
+
children: s.map((e) => {
|
|
117
|
+
let t = o === e.value;
|
|
118
|
+
return /* @__PURE__ */ u("button", {
|
|
119
|
+
type: "button",
|
|
120
|
+
role: "radio",
|
|
121
|
+
"aria-checked": t,
|
|
122
|
+
disabled: m,
|
|
123
|
+
tabIndex: t ? 0 : -1,
|
|
124
|
+
onClick: () => f(e.value),
|
|
125
|
+
"data-value": e.value,
|
|
126
|
+
className: a(t, "flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium"),
|
|
127
|
+
children: [
|
|
128
|
+
/* @__PURE__ */ l(r, { selected: t }),
|
|
129
|
+
e.label,
|
|
130
|
+
e.value === c && e.label !== d && /* @__PURE__ */ l(i, { children: d })
|
|
131
|
+
]
|
|
132
|
+
}, e.value);
|
|
133
|
+
})
|
|
134
|
+
})]
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
export { m as AppearanceDisplaySection };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AppearanceControls } from '../../shared/providers/shell/themeContext';
|
|
2
|
+
import { AppearanceLabels } from './useAppearanceLabels';
|
|
3
|
+
export declare function AppearanceModeSection({ appearance, labels, }: {
|
|
4
|
+
appearance: AppearanceControls;
|
|
5
|
+
labels: AppearanceLabels;
|
|
6
|
+
}): import('react').JSX.Element;
|
|
7
|
+
export declare function AppearanceDepthSection({ appearance, brand, labels, }: {
|
|
8
|
+
appearance: AppearanceControls;
|
|
9
|
+
brand: string;
|
|
10
|
+
labels: AppearanceLabels;
|
|
11
|
+
}): import('react').JSX.Element;
|