@adea-ai/ui 0.151.15 → 0.152.1
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/components/composites/accent-picker/accent-picker.d.ts +44 -10
- package/dist/components/composites/accent-picker/accent-picker.d.ts.map +1 -1
- package/dist/components/composites/accent-picker/accent-picker.js +155 -58
- package/dist/components/composites/accent-picker/accent-picker.js.map +1 -1
- package/dist/components/composites/accent-picker/color-math.d.ts +13 -0
- package/dist/components/composites/accent-picker/color-math.d.ts.map +1 -0
- package/dist/components/composites/accent-picker/color-math.js +61 -0
- package/dist/components/composites/accent-picker/color-math.js.map +1 -0
- package/dist/components/composites/accent-picker/custom-color-popover.d.ts +18 -0
- package/dist/components/composites/accent-picker/custom-color-popover.d.ts.map +1 -0
- package/dist/components/composites/accent-picker/custom-color-popover.js +248 -0
- package/dist/components/composites/accent-picker/custom-color-popover.js.map +1 -0
- package/dist/components/composites/accent-picker/index.d.ts +1 -1
- package/dist/components/composites/accent-picker/index.d.ts.map +1 -1
- package/dist/components/composites/accent-picker/index.js +1 -1
- package/dist/components/composites/appearance-editor/appearance-choices.d.ts.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-choices.js +37 -74
- package/dist/components/composites/appearance-editor/appearance-choices.js.map +1 -1
- package/dist/components/composites/icon-picker/icon-picker.js +1 -1
- package/dist/components/composites/icon-picker/icon-picker.js.map +1 -1
- package/dist/components/conversation/scroll-follow.d.ts.map +1 -1
- package/dist/components/conversation/scroll-follow.js +14 -1
- package/dist/components/conversation/scroll-follow.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/r/accent-picker.json +13 -0
- package/dist/r/appearance-editor.json +1 -0
- package/dist/r/registry.json +14 -0
- package/dist/r/src/components/composites/accent-picker/accent-picker.tsx +154 -38
- package/dist/r/src/components/composites/accent-picker/color-math.ts +54 -0
- package/dist/r/src/components/composites/accent-picker/custom-color-popover.tsx +220 -0
- package/dist/r/src/components/composites/accent-picker/index.ts +6 -1
- package/dist/r/src/components/composites/appearance-editor/appearance-choices.tsx +34 -58
- package/dist/r/src/components/composites/icon-picker/icon-picker.tsx +1 -1
- package/dist/r/src/components/conversation/scroll-follow.ts +24 -1
- package/package.json +1 -1
- package/registry.json +14 -0
- package/src/components/composites/accent-picker/accent-picker.tsx +154 -38
- package/src/components/composites/accent-picker/color-math.ts +54 -0
- package/src/components/composites/accent-picker/custom-color-popover.tsx +220 -0
- package/src/components/composites/accent-picker/index.ts +6 -1
- package/src/components/composites/appearance-editor/appearance-choices.tsx +34 -58
- package/src/components/composites/icon-picker/icon-picker.tsx +1 -1
- package/src/components/conversation/scroll-follow.ts +24 -1
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import { cn } from "../../../lib/utils.js";
|
|
2
|
+
import { Button } from "../../ui/button/button.js";
|
|
3
|
+
import { Input } from "../../ui/input/input.js";
|
|
4
|
+
import { Popover, PopoverContent, PopoverTrigger } from "../../ui/popover/popover.js";
|
|
5
|
+
import { clamp, hexToHsv, hsvToHex } from "./color-math.js";
|
|
6
|
+
import { addEventListener, className, createComponent, effect, insert, setAttribute, setStyleProperty, style, template } from "solid-js/web";
|
|
7
|
+
import { Show, createSignal } from "solid-js";
|
|
8
|
+
// src/components/composites/accent-picker/custom-color-popover.tsx
|
|
9
|
+
var _tmpl$ = /*#__PURE__*/ template(`<div class="flex flex-col gap-3"data-slot=custom-color><div class="flex items-center gap-2"><span aria-hidden=true class="size-8 shrink-0 rounded-md border border-border bg-(--swatch-draft)">`);
|
|
10
|
+
var _tmpl$2 = /*#__PURE__*/ template(`<span aria-hidden=true data-slot=swatch-custom-chip class="size-3 rounded-full border border-border bg-(--swatch-custom)">`);
|
|
11
|
+
var _tmpl$3 = /*#__PURE__*/ template(`<div role=slider tabindex=0 aria-valuemin=0 data-slot=custom-color-area><span aria-hidden=true class="pointer-events-none absolute size-3.5 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-background shadow-sm ring-1 ring-border">`);
|
|
12
|
+
/**
|
|
13
|
+
* The Custom entry of the accent picker: a button that opens a colour picker
|
|
14
|
+
* anchored right under it, right edges aligned since Custom ends the row (a
|
|
15
|
+
* saturation/brightness field, a hue strip and a hex field). Nothing is committed while the colour is being explored; Apply (or
|
|
16
|
+
* Enter in the hex field) commits it and closes, Escape or a click outside
|
|
17
|
+
* leaves the stored colour alone. The operating system's colour panel is not
|
|
18
|
+
* used because on macOS it floats wherever it was last left, not by the button.
|
|
19
|
+
*/
|
|
20
|
+
function CustomColorPopover(props) {
|
|
21
|
+
const [open, setOpen] = createSignal(false);
|
|
22
|
+
const [draft, setDraft] = createSignal({
|
|
23
|
+
h: 0,
|
|
24
|
+
s: 0,
|
|
25
|
+
v: 0
|
|
26
|
+
});
|
|
27
|
+
const [hexText, setHexText] = createSignal("");
|
|
28
|
+
const draftHex = () => hsvToHex(draft());
|
|
29
|
+
const typedHex = () => {
|
|
30
|
+
const text = hexText().trim();
|
|
31
|
+
return hexToHsv(text.startsWith("#") ? text : `#${text}`);
|
|
32
|
+
};
|
|
33
|
+
const start = () => {
|
|
34
|
+
const initial = hexToHsv(props.value ?? props.seed) ?? {
|
|
35
|
+
h: 262,
|
|
36
|
+
s: .8,
|
|
37
|
+
v: .9
|
|
38
|
+
};
|
|
39
|
+
setDraft(initial);
|
|
40
|
+
setHexText(hsvToHex(initial));
|
|
41
|
+
};
|
|
42
|
+
const update = (next) => {
|
|
43
|
+
setDraft(next);
|
|
44
|
+
setHexText(hsvToHex(next));
|
|
45
|
+
};
|
|
46
|
+
const commit = () => {
|
|
47
|
+
if (!typedHex()) return;
|
|
48
|
+
props.onCommit(draftHex());
|
|
49
|
+
setOpen(false);
|
|
50
|
+
};
|
|
51
|
+
return createComponent(Popover, {
|
|
52
|
+
get open() {
|
|
53
|
+
return open();
|
|
54
|
+
},
|
|
55
|
+
onOpenChange: (next) => {
|
|
56
|
+
if (next) start();
|
|
57
|
+
setOpen(next);
|
|
58
|
+
},
|
|
59
|
+
placement: "bottom-end",
|
|
60
|
+
get children() {
|
|
61
|
+
return [createComponent(PopoverTrigger, {
|
|
62
|
+
as: Button,
|
|
63
|
+
type: "button",
|
|
64
|
+
get variant() {
|
|
65
|
+
return props.value ? "secondary" : "outline";
|
|
66
|
+
},
|
|
67
|
+
size: "sm",
|
|
68
|
+
"data-slot": "swatch-custom",
|
|
69
|
+
get disabled() {
|
|
70
|
+
return props.disabled;
|
|
71
|
+
},
|
|
72
|
+
get ["aria-pressed"]() {
|
|
73
|
+
return props.value !== void 0;
|
|
74
|
+
},
|
|
75
|
+
"class": "shrink-0 gap-1.5",
|
|
76
|
+
get children() {
|
|
77
|
+
return [createComponent(Show, {
|
|
78
|
+
get when() {
|
|
79
|
+
return props.value;
|
|
80
|
+
},
|
|
81
|
+
children: (color) => (() => {
|
|
82
|
+
var _el$4 = _tmpl$2();
|
|
83
|
+
effect((_$p) => setStyleProperty(_el$4, "--swatch-custom", color()));
|
|
84
|
+
return _el$4;
|
|
85
|
+
})()
|
|
86
|
+
}), "Custom"];
|
|
87
|
+
}
|
|
88
|
+
}), createComponent(PopoverContent, {
|
|
89
|
+
"class": "w-60",
|
|
90
|
+
"aria-label": "Custom colour",
|
|
91
|
+
get children() {
|
|
92
|
+
var _el$ = _tmpl$(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild;
|
|
93
|
+
insert(_el$, createComponent(DragArea, {
|
|
94
|
+
label: "Saturation and brightness",
|
|
95
|
+
get value() {
|
|
96
|
+
return Math.round(draft().s * 100);
|
|
97
|
+
},
|
|
98
|
+
max: 100,
|
|
99
|
+
get valueText() {
|
|
100
|
+
return `Saturation ${Math.round(draft().s * 100)}%, brightness ${Math.round(draft().v * 100)}%`;
|
|
101
|
+
},
|
|
102
|
+
"class": "h-36 rounded-md",
|
|
103
|
+
get style() {
|
|
104
|
+
return { "background-image": `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${draft().h} 100% 50%))` };
|
|
105
|
+
},
|
|
106
|
+
get thumb() {
|
|
107
|
+
return {
|
|
108
|
+
x: draft().s,
|
|
109
|
+
y: 1 - draft().v
|
|
110
|
+
};
|
|
111
|
+
},
|
|
112
|
+
onPoint: (x, y) => update({
|
|
113
|
+
...draft(),
|
|
114
|
+
s: x,
|
|
115
|
+
v: 1 - y
|
|
116
|
+
}),
|
|
117
|
+
onStep: (dx, dy) => update({
|
|
118
|
+
...draft(),
|
|
119
|
+
s: clamp(draft().s + dx),
|
|
120
|
+
v: clamp(draft().v - dy)
|
|
121
|
+
})
|
|
122
|
+
}), _el$2);
|
|
123
|
+
insert(_el$, createComponent(DragArea, {
|
|
124
|
+
label: "Hue",
|
|
125
|
+
get value() {
|
|
126
|
+
return Math.round(draft().h);
|
|
127
|
+
},
|
|
128
|
+
max: 360,
|
|
129
|
+
get valueText() {
|
|
130
|
+
return `${Math.round(draft().h)} degrees`;
|
|
131
|
+
},
|
|
132
|
+
"class": "h-3 rounded-full",
|
|
133
|
+
style: { "background-image": "linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00)" },
|
|
134
|
+
get thumb() {
|
|
135
|
+
return {
|
|
136
|
+
x: draft().h / 360,
|
|
137
|
+
y: .5
|
|
138
|
+
};
|
|
139
|
+
},
|
|
140
|
+
onPoint: (x) => update({
|
|
141
|
+
...draft(),
|
|
142
|
+
h: Math.min(359.99, x * 360)
|
|
143
|
+
}),
|
|
144
|
+
onStep: (dx) => update({
|
|
145
|
+
...draft(),
|
|
146
|
+
h: Math.min(359.99, Math.max(0, draft().h + dx * 360))
|
|
147
|
+
})
|
|
148
|
+
}), _el$2);
|
|
149
|
+
insert(_el$2, createComponent(Input, {
|
|
150
|
+
"aria-label": "Hex colour",
|
|
151
|
+
"class": "min-w-0 flex-1 font-mono",
|
|
152
|
+
get value() {
|
|
153
|
+
return hexText();
|
|
154
|
+
},
|
|
155
|
+
maxLength: 7,
|
|
156
|
+
spellcheck: false,
|
|
157
|
+
get ["aria-invalid"]() {
|
|
158
|
+
return typedHex() ? void 0 : true;
|
|
159
|
+
},
|
|
160
|
+
onInput: (event) => {
|
|
161
|
+
const text = event.currentTarget.value.trim();
|
|
162
|
+
setHexText(text);
|
|
163
|
+
const parsed = typedHex();
|
|
164
|
+
if (parsed) setDraft(parsed);
|
|
165
|
+
},
|
|
166
|
+
onKeyDown: (event) => {
|
|
167
|
+
if (event.key === "Enter") {
|
|
168
|
+
event.preventDefault();
|
|
169
|
+
commit();
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}), null);
|
|
173
|
+
insert(_el$2, createComponent(Button, {
|
|
174
|
+
type: "button",
|
|
175
|
+
size: "sm",
|
|
176
|
+
get disabled() {
|
|
177
|
+
return !typedHex();
|
|
178
|
+
},
|
|
179
|
+
onClick: commit,
|
|
180
|
+
children: "Apply"
|
|
181
|
+
}), null);
|
|
182
|
+
effect((_$p) => setStyleProperty(_el$3, "--swatch-draft", draftHex()));
|
|
183
|
+
return _el$;
|
|
184
|
+
}
|
|
185
|
+
})];
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* A pointer- and keyboard-driven area reporting a position in [0, 1] on each
|
|
191
|
+
* axis: the saturation/brightness field and the hue strip. Its listeners are
|
|
192
|
+
* native (`on:`) rather than delegated, so this module registers nothing on
|
|
193
|
+
* `window.document` when it loads.
|
|
194
|
+
*/
|
|
195
|
+
function DragArea(props) {
|
|
196
|
+
const point = (event) => {
|
|
197
|
+
const rect = event.currentTarget.getBoundingClientRect();
|
|
198
|
+
if (rect.width === 0 || rect.height === 0) return;
|
|
199
|
+
props.onPoint(clamp((event.clientX - rect.left) / rect.width), clamp((event.clientY - rect.top) / rect.height));
|
|
200
|
+
};
|
|
201
|
+
return (() => {
|
|
202
|
+
var _el$5 = _tmpl$3(), _el$6 = _el$5.firstChild;
|
|
203
|
+
addEventListener(_el$5, "keydown", (event) => {
|
|
204
|
+
const step = event.shiftKey ? .1 : .02;
|
|
205
|
+
const move = {
|
|
206
|
+
ArrowLeft: [-step, 0],
|
|
207
|
+
ArrowRight: [step, 0],
|
|
208
|
+
ArrowUp: [0, -step],
|
|
209
|
+
ArrowDown: [0, step]
|
|
210
|
+
}[event.key];
|
|
211
|
+
if (!move) return;
|
|
212
|
+
event.preventDefault();
|
|
213
|
+
props.onStep(move[0], move[1]);
|
|
214
|
+
});
|
|
215
|
+
addEventListener(_el$5, "pointermove", (event) => {
|
|
216
|
+
if (event.buttons & 1) point(event);
|
|
217
|
+
});
|
|
218
|
+
addEventListener(_el$5, "pointerdown", (event) => {
|
|
219
|
+
event.currentTarget.setPointerCapture?.(event.pointerId);
|
|
220
|
+
point(event);
|
|
221
|
+
});
|
|
222
|
+
effect((_p$) => {
|
|
223
|
+
var _v$ = props.label, _v$2 = props.max, _v$3 = props.value, _v$4 = props.valueText, _v$5 = cn("relative w-full cursor-crosshair touch-none border border-border outline-none", "focus-visible:ring-3 focus-visible:ring-primary-subtle", props.class), _v$6 = props.style, _v$7 = `${props.thumb.x * 100}%`, _v$8 = `${props.thumb.y * 100}%`;
|
|
224
|
+
_v$ !== _p$.e && setAttribute(_el$5, "aria-label", _p$.e = _v$);
|
|
225
|
+
_v$2 !== _p$.t && setAttribute(_el$5, "aria-valuemax", _p$.t = _v$2);
|
|
226
|
+
_v$3 !== _p$.a && setAttribute(_el$5, "aria-valuenow", _p$.a = _v$3);
|
|
227
|
+
_v$4 !== _p$.o && setAttribute(_el$5, "aria-valuetext", _p$.o = _v$4);
|
|
228
|
+
_v$5 !== _p$.i && className(_el$5, _p$.i = _v$5);
|
|
229
|
+
_p$.n = style(_el$5, _v$6, _p$.n);
|
|
230
|
+
_v$7 !== _p$.s && setStyleProperty(_el$6, "left", _p$.s = _v$7);
|
|
231
|
+
_v$8 !== _p$.h && setStyleProperty(_el$6, "top", _p$.h = _v$8);
|
|
232
|
+
return _p$;
|
|
233
|
+
}, {
|
|
234
|
+
e: void 0,
|
|
235
|
+
t: void 0,
|
|
236
|
+
a: void 0,
|
|
237
|
+
o: void 0,
|
|
238
|
+
i: void 0,
|
|
239
|
+
n: void 0,
|
|
240
|
+
s: void 0,
|
|
241
|
+
h: void 0
|
|
242
|
+
});
|
|
243
|
+
return _el$5;
|
|
244
|
+
})();
|
|
245
|
+
}
|
|
246
|
+
export { CustomColorPopover };
|
|
247
|
+
|
|
248
|
+
//# sourceMappingURL=custom-color-popover.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom-color-popover.js","names":["JSX","Show","createSignal","cn","Button","Input","Popover","PopoverContent","PopoverTrigger","clamp","hexToHsv","hsvToHex","Hsv","CustomColorPopover","props","value","seed","disabled","onCommit","open","setOpen","draft","setDraft","h","s","v","hexText","setHexText","draftHex","typedHex","text","trim","startsWith","start","initial","update","next","commit","_$createComponent","onOpenChange","placement","children","as","type","variant","size","aria-pressed","undefined","when","color","_el$4","_tmpl$2","_$effect","_$p","_$setStyleProperty","_el$","_tmpl$","_el$2","firstChild","_el$3","_$insert","DragArea","label","Math","round","max","valueText","style","thumb","x","y","onPoint","onStep","dx","dy","min","maxLength","spellcheck","aria-invalid","onInput","event","currentTarget","parsed","onKeyDown","key","preventDefault","onClick","class","CSSProperties","point","PointerEvent","rect","HTMLElement","getBoundingClientRect","width","height","clientX","left","clientY","top","_el$5","_tmpl$3","_el$6","_$addEventListener","step","shiftKey","moves","Record","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","move","buttons","setPointerCapture","pointerId","_p$","_v$","_v$2","_v$3","_v$4","_v$5","_v$6","_v$7","_v$8","e","_$setAttribute","t","a","o","i","_$className","n","_$style","_$createComponent","_$setStyleProperty","_$setAttribute","_$className","_$style"],"sources":["../../../../src/components/composites/accent-picker/custom-color-popover.tsx"],"sourcesContent":["import type { JSX } from 'solid-js'\nimport { Show, createSignal } from 'solid-js'\nimport { cn } from '#lib/utils'\nimport { Button } from '../../ui/button'\nimport { Input } from '../../ui/input'\nimport { Popover, PopoverContent, PopoverTrigger } from '../../ui/popover'\nimport { clamp, hexToHsv, hsvToHex, type Hsv } from './color-math'\n\n/**\n * The Custom entry of the accent picker: a button that opens a colour picker\n * anchored right under it, right edges aligned since Custom ends the row (a\n * saturation/brightness field, a hue strip and a hex field). Nothing is committed while the colour is being explored; Apply (or\n * Enter in the hex field) commits it and closes, Escape or a click outside\n * leaves the stored colour alone. The operating system's colour panel is not\n * used because on macOS it floats wherever it was last left, not by the button.\n */\nexport function CustomColorPopover(props: {\n /** The stored custom colour, or `undefined` while a preset or inherit is chosen. */\n value: string | undefined\n /** Where the picker starts while no custom colour is stored. */\n seed: string\n disabled?: boolean\n onCommit(value: `#${string}`): void\n}) {\n const [open, setOpen] = createSignal(false)\n const [draft, setDraft] = createSignal<Hsv>({ h: 0, s: 0, v: 0 })\n const [hexText, setHexText] = createSignal('')\n const draftHex = () => hsvToHex(draft())\n // The hex field is what Apply commits, so text that is not a colour yet blocks it.\n const typedHex = () => {\n const text = hexText().trim()\n return hexToHsv(text.startsWith('#') ? text : `#${text}`)\n }\n\n const start = () => {\n const initial = hexToHsv(props.value ?? props.seed) ?? { h: 262, s: 0.8, v: 0.9 }\n setDraft(initial)\n setHexText(hsvToHex(initial))\n }\n const update = (next: Hsv) => {\n setDraft(next)\n setHexText(hsvToHex(next))\n }\n const commit = () => {\n if (!typedHex()) return\n props.onCommit(draftHex())\n setOpen(false)\n }\n\n return (\n <Popover\n open={open()}\n onOpenChange={(next) => {\n if (next) start()\n setOpen(next)\n }}\n placement=\"bottom-end\"\n >\n <PopoverTrigger\n as={Button}\n type=\"button\"\n variant={props.value ? 'secondary' : 'outline'}\n size=\"sm\"\n data-slot=\"swatch-custom\"\n disabled={props.disabled}\n aria-pressed={props.value !== undefined}\n class=\"shrink-0 gap-1.5\"\n >\n <Show when={props.value}>\n {(color) => (\n <span\n aria-hidden=\"true\"\n data-slot=\"swatch-custom-chip\"\n class=\"size-3 rounded-full border border-border bg-(--swatch-custom)\"\n style={{ '--swatch-custom': color() }}\n />\n )}\n </Show>\n Custom\n </PopoverTrigger>\n <PopoverContent class=\"w-60\" aria-label=\"Custom colour\">\n <div class=\"flex flex-col gap-3\" data-slot=\"custom-color\">\n <DragArea\n label=\"Saturation and brightness\"\n value={Math.round(draft().s * 100)}\n max={100}\n valueText={`Saturation ${Math.round(draft().s * 100)}%, brightness ${Math.round(draft().v * 100)}%`}\n class=\"h-36 rounded-md\"\n style={{\n 'background-image': `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${draft().h} 100% 50%))`,\n }}\n thumb={{ x: draft().s, y: 1 - draft().v }}\n onPoint={(x, y) => update({ ...draft(), s: x, v: 1 - y })}\n onStep={(dx, dy) =>\n update({ ...draft(), s: clamp(draft().s + dx), v: clamp(draft().v - dy) })\n }\n />\n <DragArea\n label=\"Hue\"\n value={Math.round(draft().h)}\n max={360}\n valueText={`${Math.round(draft().h)} degrees`}\n class=\"h-3 rounded-full\"\n style={{\n 'background-image':\n 'linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00)',\n }}\n thumb={{ x: draft().h / 360, y: 0.5 }}\n onPoint={(x) => update({ ...draft(), h: Math.min(359.99, x * 360) })}\n onStep={(dx) =>\n update({ ...draft(), h: Math.min(359.99, Math.max(0, draft().h + dx * 360)) })\n }\n />\n <div class=\"flex items-center gap-2\">\n <span\n aria-hidden=\"true\"\n class=\"size-8 shrink-0 rounded-md border border-border bg-(--swatch-draft)\"\n style={{ '--swatch-draft': draftHex() }}\n />\n <Input\n aria-label=\"Hex colour\"\n class=\"min-w-0 flex-1 font-mono\"\n value={hexText()}\n maxLength={7}\n spellcheck={false}\n aria-invalid={typedHex() ? undefined : true}\n onInput={(event) => {\n const text = event.currentTarget.value.trim()\n setHexText(text)\n const parsed = typedHex()\n if (parsed) setDraft(parsed)\n }}\n onKeyDown={(event) => {\n if (event.key === 'Enter') {\n event.preventDefault()\n commit()\n }\n }}\n />\n <Button type=\"button\" size=\"sm\" disabled={!typedHex()} onClick={commit}>\n Apply\n </Button>\n </div>\n </div>\n </PopoverContent>\n </Popover>\n )\n}\n\n/**\n * A pointer- and keyboard-driven area reporting a position in [0, 1] on each\n * axis: the saturation/brightness field and the hue strip. Its listeners are\n * native (`on:`) rather than delegated, so this module registers nothing on\n * `window.document` when it loads.\n */\nfunction DragArea(props: {\n label: string\n /** The value assistive technology reads, from 0 to `max`; the 2D field reports saturation and names both axes in `valueText`. */\n value: number\n max: number\n valueText: string\n class: string\n style: JSX.CSSProperties\n thumb: { x: number; y: number }\n onPoint(x: number, y: number): void\n onStep(dx: number, dy: number): void\n}) {\n const point = (event: PointerEvent) => {\n const rect = (event.currentTarget as HTMLElement).getBoundingClientRect()\n if (rect.width === 0 || rect.height === 0) return\n props.onPoint(\n clamp((event.clientX - rect.left) / rect.width),\n clamp((event.clientY - rect.top) / rect.height)\n )\n }\n return (\n <div\n role=\"slider\"\n tabIndex={0}\n aria-label={props.label}\n aria-valuemin={0}\n aria-valuemax={props.max}\n aria-valuenow={props.value}\n aria-valuetext={props.valueText}\n data-slot=\"custom-color-area\"\n class={cn(\n 'relative w-full cursor-crosshair touch-none border border-border outline-none',\n 'focus-visible:ring-3 focus-visible:ring-primary-subtle',\n props.class\n )}\n style={props.style}\n on:pointerdown={(event) => {\n event.currentTarget.setPointerCapture?.(event.pointerId)\n point(event)\n }}\n on:pointermove={(event) => {\n if (event.buttons & 1) point(event)\n }}\n on:keydown={(event) => {\n const step = event.shiftKey ? 0.1 : 0.02\n const moves: Record<string, [number, number]> = {\n ArrowLeft: [-step, 0],\n ArrowRight: [step, 0],\n ArrowUp: [0, -step],\n ArrowDown: [0, step],\n }\n const move = moves[event.key]\n if (!move) return\n event.preventDefault()\n props.onStep(move[0], move[1])\n }}\n >\n <span\n aria-hidden=\"true\"\n class=\"pointer-events-none absolute size-3.5 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-background shadow-sm ring-1 ring-border\"\n style={{ left: `${props.thumb.x * 100}%`, top: `${props.thumb.y * 100}%` }}\n />\n </div>\n )\n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AccentPicker, type AccentPickerProps } from './accent-picker';
|
|
1
|
+
export { AccentPicker, isCustomAccentValue, type AccentPickerOption, type AccentPickerProps, } from './accent-picker';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/composites/accent-picker/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/composites/accent-picker/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,GACvB,MAAM,iBAAiB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { AccentPicker } from "./accent-picker.js";
|
|
1
|
+
export { AccentPicker, isCustomAccentValue } from "./accent-picker.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appearance-choices.d.ts","sourceRoot":"","sources":["../../../../src/components/composites/appearance-editor/appearance-choices.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"appearance-choices.d.ts","sourceRoot":"","sources":["../../../../src/components/composites/appearance-editor/appearance-choices.tsx"],"names":[],"mappings":"AAgCA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAe/D,wBAAgB,WAAW,CAAC,KAAK,EAAE,qBAAqB,kCAmDvD;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAOpE;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,qBAAqB,kCAyHzD;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,qBAAqB,kCA6BxD"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { isThemeAccentId } from "../../../lib/theme-accents.js";
|
|
2
2
|
import { THEME_DEFAULT_ID } from "../../../lib/theme-defaults.js";
|
|
3
|
-
import {
|
|
4
|
-
import { Input } from "../../ui/input/input.js";
|
|
3
|
+
import { AccentPicker, isCustomAccentValue } from "../accent-picker/accent-picker.js";
|
|
5
4
|
import { AccentSwatchGroups } from "./accent-swatch-groups.js";
|
|
6
5
|
import { ThemeMiniature, ThemeMiniatureSplit } from "./theme-preview.js";
|
|
7
6
|
import { createComponent, insert, memo, template } from "solid-js/web";
|
|
@@ -12,10 +11,9 @@ import { RadioGroup } from "@kobalte/core/radio-group";
|
|
|
12
11
|
var _tmpl$ = /*#__PURE__*/ template(`<span class="block h-20 w-full">`);
|
|
13
12
|
var _tmpl$2 = /*#__PURE__*/ template(`<span class="flex items-center justify-center gap-1.5">`);
|
|
14
13
|
var _tmpl$3 = /*#__PURE__*/ template(`<span>`);
|
|
15
|
-
var _tmpl$4 = /*#__PURE__*/ template(`<div class="
|
|
16
|
-
var _tmpl$5 = /*#__PURE__*/ template(`<
|
|
17
|
-
var _tmpl$6 = /*#__PURE__*/ template(`<
|
|
18
|
-
var _tmpl$7 = /*#__PURE__*/ template(`<div class="flex flex-col gap-1">`);
|
|
14
|
+
var _tmpl$4 = /*#__PURE__*/ template(`<div class="grid grid-cols-2 gap-2 sm:grid-cols-3"data-accent-grid>`);
|
|
15
|
+
var _tmpl$5 = /*#__PURE__*/ template(`<span class="text-xs font-medium text-muted-foreground">Custom`);
|
|
16
|
+
var _tmpl$6 = /*#__PURE__*/ template(`<div class="flex flex-col gap-1">`);
|
|
19
17
|
var MODES = [
|
|
20
18
|
{
|
|
21
19
|
value: "system",
|
|
@@ -157,11 +155,14 @@ function AccentChoices(props) {
|
|
|
157
155
|
label: "Theme default"
|
|
158
156
|
}, ...presets] : presets;
|
|
159
157
|
};
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
158
|
+
const rowOptions = () => {
|
|
159
|
+
const presets = props.accentOptions.filter((option) => option.id !== THEME_DEFAULT_ID);
|
|
160
|
+
return showThemeDefault() ? [{
|
|
161
|
+
id: THEME_DEFAULT_ID,
|
|
162
|
+
label: "Theme default",
|
|
163
|
+
light: themeDefaultColor(),
|
|
164
|
+
dark: themeDefaultColor()
|
|
165
|
+
}, ...presets] : presets;
|
|
165
166
|
};
|
|
166
167
|
return createComponent(Show, {
|
|
167
168
|
get when() {
|
|
@@ -199,16 +200,16 @@ function AccentChoices(props) {
|
|
|
199
200
|
return themeDefaultColor();
|
|
200
201
|
}
|
|
201
202
|
}), (() => {
|
|
202
|
-
var _el$
|
|
203
|
-
insert(_el$
|
|
203
|
+
var _el$5 = _tmpl$6();
|
|
204
|
+
insert(_el$5, createComponent(Show, {
|
|
204
205
|
get when() {
|
|
205
206
|
return props.showCustomAccentCaption ?? true;
|
|
206
207
|
},
|
|
207
208
|
get children() {
|
|
208
|
-
return _tmpl$
|
|
209
|
+
return _tmpl$5();
|
|
209
210
|
}
|
|
210
211
|
}), null);
|
|
211
|
-
insert(_el$
|
|
212
|
+
insert(_el$5, createComponent(RadioGroup.Item, {
|
|
212
213
|
value: "custom",
|
|
213
214
|
get children() {
|
|
214
215
|
return [createComponent(RadioGroup.ItemInput, {}), createComponent(RadioGroup.ItemLabel, {
|
|
@@ -217,12 +218,12 @@ function AccentChoices(props) {
|
|
|
217
218
|
})];
|
|
218
219
|
}
|
|
219
220
|
}), null);
|
|
220
|
-
return _el$
|
|
221
|
+
return _el$5;
|
|
221
222
|
})()];
|
|
222
223
|
},
|
|
223
224
|
get children() {
|
|
224
|
-
var _el$
|
|
225
|
-
insert(_el$
|
|
225
|
+
var _el$4 = _tmpl$4();
|
|
226
|
+
insert(_el$4, createComponent(For, {
|
|
226
227
|
get each() {
|
|
227
228
|
return labelEntries();
|
|
228
229
|
},
|
|
@@ -244,7 +245,7 @@ function AccentChoices(props) {
|
|
|
244
245
|
}
|
|
245
246
|
})
|
|
246
247
|
}), null);
|
|
247
|
-
insert(_el$
|
|
248
|
+
insert(_el$4, createComponent(RadioGroup.Item, {
|
|
248
249
|
value: "custom",
|
|
249
250
|
"class": "min-w-0",
|
|
250
251
|
get children() {
|
|
@@ -254,74 +255,36 @@ function AccentChoices(props) {
|
|
|
254
255
|
})];
|
|
255
256
|
}
|
|
256
257
|
}), null);
|
|
257
|
-
return _el$
|
|
258
|
+
return _el$4;
|
|
258
259
|
}
|
|
259
260
|
});
|
|
260
261
|
}
|
|
261
262
|
});
|
|
262
263
|
},
|
|
263
264
|
get children() {
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
265
|
+
return createComponent(AccentPicker, {
|
|
266
|
+
label: "Accent",
|
|
267
|
+
inherit: false,
|
|
268
|
+
get options() {
|
|
269
|
+
return rowOptions();
|
|
268
270
|
},
|
|
269
|
-
|
|
270
|
-
|
|
271
|
+
layout: "row",
|
|
272
|
+
get appearance() {
|
|
273
|
+
return resolvedAppearance();
|
|
271
274
|
},
|
|
272
|
-
orientation: "horizontal",
|
|
273
|
-
"aria-label": "Accent",
|
|
274
|
-
"class": "min-w-0 flex-1",
|
|
275
|
-
onChange: (accent) => props.onChange({ accent }),
|
|
276
|
-
get children() {
|
|
277
|
-
return createComponent(AccentSwatchGroups, {
|
|
278
|
-
get accentOptions() {
|
|
279
|
-
return props.accentOptions;
|
|
280
|
-
},
|
|
281
|
-
get resolvedAppearance() {
|
|
282
|
-
return resolvedAppearance();
|
|
283
|
-
},
|
|
284
|
-
get showThemeDefault() {
|
|
285
|
-
return showThemeDefault();
|
|
286
|
-
},
|
|
287
|
-
get themeDefaultColor() {
|
|
288
|
-
return themeDefaultColor();
|
|
289
|
-
},
|
|
290
|
-
layout: "row"
|
|
291
|
-
});
|
|
292
|
-
}
|
|
293
|
-
}), null);
|
|
294
|
-
insert(_el$4, createComponent(Button, {
|
|
295
|
-
type: "button",
|
|
296
|
-
variant: "outline",
|
|
297
|
-
size: "sm",
|
|
298
|
-
tabIndex: 0,
|
|
299
|
-
get disabled() {
|
|
300
|
-
return props.saving;
|
|
301
|
-
},
|
|
302
|
-
get ["aria-pressed"]() {
|
|
303
|
-
return isCustomAccent(props);
|
|
304
|
-
},
|
|
305
|
-
onClick: openCustomColor,
|
|
306
|
-
children: "Custom"
|
|
307
|
-
}), null);
|
|
308
|
-
insert(_el$4, createComponent(Input, {
|
|
309
|
-
ref: (element) => {
|
|
310
|
-
colorPicker = element;
|
|
311
|
-
},
|
|
312
|
-
type: "color",
|
|
313
|
-
"class": "sr-only w-px",
|
|
314
|
-
tabIndex: -1,
|
|
315
|
-
"aria-label": "Custom accent color",
|
|
316
275
|
get value() {
|
|
317
|
-
return
|
|
276
|
+
return props.draft.accent;
|
|
277
|
+
},
|
|
278
|
+
get customSeed() {
|
|
279
|
+
return memo(() => !!isCustomAccentValue(props.customAccentValue))() ? props.customAccentValue : "#000000";
|
|
318
280
|
},
|
|
319
281
|
get disabled() {
|
|
320
282
|
return props.saving;
|
|
321
283
|
},
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
284
|
+
onValueChange: (accent) => {
|
|
285
|
+
if (accent !== null) props.onChange({ accent });
|
|
286
|
+
}
|
|
287
|
+
});
|
|
325
288
|
}
|
|
326
289
|
});
|
|
327
290
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appearance-choices.js","names":["RadioGroup","Radio","Monitor","Moon","Sun","For","Show","isThemeAccentId","THEME_DEFAULT_ID","Button","Input","AccentSwatchGroups","AppearanceEditorProps","ThemeMiniature","ThemeMiniatureSplit","MODES","value","label","const","SURFACES","MODE_ICONS","system","light","dark","ModeChoices","props","_$createComponent","draft","mode","disabled","saving","orientation","onChange","option","find","candidate","children","each","Icon","Item","data-mode","ItemInput","ItemLabel","_el$","_tmpl$","_$insert","when","fallback","theme","_$memo","lightTheme","darkTheme","showModeIcons","_el$3","_tmpl$3","_el$2","_tmpl$2","isCustomAccent","accent","accentOptions","some","id","AccentChoices","resolvedAppearance","accentSelection","showThemeDefault","showThemeDefaultAccent","entryStyle","accentEntryStyle","themeDefaultColor","colors","labelEntries","presets","filter","colorPicker","HTMLInputElement","openCustomColor","showPicker","click","customAccentValue","_el$6","_tmpl$7","showCustomAccentCaption","_tmpl$6","_el$5","_tmpl$5","data-accent-option","_el$4","_tmpl$4","layout","type","variant","size","tabIndex","aria-pressed","onClick","ref","element","test","event","currentTarget","GlassChoices","surface","surfaceCapability","frosted","_$createComponent","Radio","_$memo"],"sources":["../../../../src/components/composites/appearance-editor/appearance-choices.tsx"],"sourcesContent":["/*\n * MIT License\n *\n * Copyright (c) 2026 Wing\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n// Pinned mode-card, accent-swatch, and glass-chip composition. Kobalte replaces\n// the app port's manual roving focus; it does not replace the donor hierarchy.\nimport { RadioGroup as Radio } from '@kobalte/core/radio-group'\nimport { Monitor, Moon, Sun } from 'lucide-solid'\nimport { For, Show } from 'solid-js'\nimport { isThemeAccentId } from '#lib/theme-accents'\nimport { THEME_DEFAULT_ID } from '#lib/theme-defaults'\nimport { Button } from '../../ui/button'\nimport { Input } from '../../ui/input'\nimport { AccentSwatchGroups } from './accent-swatch-groups'\nimport type { AppearanceEditorProps } from './appearance-types'\nimport { ThemeMiniature, ThemeMiniatureSplit } from './theme-preview'\n\nconst MODES = [\n { value: 'system', label: 'System' },\n { value: 'light', label: 'Light' },\n { value: 'dark', label: 'Dark' },\n] as const\nconst SURFACES = [\n { value: 'theme', label: 'Theme default' },\n { value: 'frosted', label: 'Frosted' },\n { value: 'opaque', label: 'Opaque' },\n] as const\nconst MODE_ICONS = { system: Monitor, light: Sun, dark: Moon } as const\n\nexport function ModeChoices(props: AppearanceEditorProps) {\n return (\n <Radio\n value={props.draft.mode}\n disabled={props.saving}\n orientation=\"horizontal\"\n aria-label=\"Appearance mode\"\n onChange={(mode) => {\n const option = MODES.find((candidate) => candidate.value === mode)\n if (option) props.onChange({ mode: option.value })\n }}\n class=\"grid grid-cols-1 gap-3 px-4 py-4 sm:grid-cols-3\"\n >\n <For each={MODES}>\n {(option) => {\n const Icon = MODE_ICONS[option.value]\n return (\n <Radio.Item\n value={option.value}\n data-mode={option.value}\n class=\"min-w-0 rounded-lg focus-within:ring-3 focus-within:ring-ring/50\"\n >\n <Radio.ItemInput />\n <Radio.ItemLabel class=\"flex cursor-pointer flex-col gap-2 rounded-lg border p-2 text-center text-xs data-[checked]:border-primary data-[checked]:ring-1 data-[checked]:ring-primary data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50\">\n <span class=\"block h-20 w-full\">\n <Show\n when={option.value === 'system'}\n fallback={\n <ThemeMiniature\n theme={option.value === 'light' ? props.lightTheme : props.darkTheme}\n />\n }\n >\n <ThemeMiniatureSplit light={props.lightTheme} dark={props.darkTheme} />\n </Show>\n </span>\n {/* The glyph names the axis beside the miniature, so the cards read\n like ThemeModeToggle without losing the previews. */}\n <Show when={props.showModeIcons} fallback={<span>{option.label}</span>}>\n <span class=\"flex items-center justify-center gap-1.5\">\n <Icon aria-hidden=\"true\" class=\"size-3.5\" />\n {option.label}\n </span>\n </Show>\n </Radio.ItemLabel>\n </Radio.Item>\n )\n }}\n </For>\n </Radio>\n )\n}\n\n/**\n * Whether the draft accent is the host's custom colour: not the theme default,\n * not a preset, and not a theme accent id. A theme accent id counts as known even\n * when the current pair cannot offer it — it is a stored role, not a colour the\n * user typed, and showing it in the custom field would invite editing `ansi-blue`.\n */\nexport function isCustomAccent(props: AppearanceEditorProps): boolean {\n const accent = props.draft.accent\n return (\n accent !== THEME_DEFAULT_ID &&\n !props.accentOptions.some((option) => option.id === accent) &&\n !isThemeAccentId(accent)\n )\n}\n\nexport function AccentChoices(props: AppearanceEditorProps) {\n // The resolved appearance decides which side of a preset pair — and which\n // theme accent — the swatches paint, so the row previews each choice as the\n // user will see it.\n const resolvedAppearance = () =>\n props.draft.mode === 'system' ? props.resolvedAppearance : props.draft.mode\n const accentSelection = () => (isCustomAccent(props) ? 'custom' : props.draft.accent)\n const showThemeDefault = () => props.showThemeDefaultAccent ?? true\n const entryStyle = () => props.accentEntryStyle ?? 'swatches'\n const themeDefaultColor = () =>\n resolvedAppearance() === 'light'\n ? props.lightTheme.colors.accent\n : props.darkTheme.colors.accent\n // The named-chip style feeds the same resolved preset list to both entries:\n // \"Theme default\" leads only when the host has not folded it into a preset.\n const labelEntries = () => {\n const presets = props.accentOptions.filter((option) => option.id !== THEME_DEFAULT_ID)\n return showThemeDefault()\n ? [{ id: THEME_DEFAULT_ID, label: 'Theme default' }, ...presets]\n : presets\n }\n // The `row` style's Custom entry is a button that opens the native colour\n // selector, so the draft only changes once a colour is chosen there. The\n // input stays in the tree for the selector to anchor to and for the value a\n // saved hex restores.\n let colorPicker: HTMLInputElement | undefined\n const openCustomColor = () => {\n if (!colorPicker || props.saving) return\n if (typeof colorPicker.showPicker === 'function') colorPicker.showPicker()\n else colorPicker.click()\n }\n return (\n <Show\n when={entryStyle() === 'row'}\n fallback={\n <Radio\n value={accentSelection()}\n disabled={props.saving}\n orientation=\"horizontal\"\n aria-label=\"Accent\"\n class=\"flex flex-col items-start gap-3\"\n onChange={(accent) =>\n props.onChange({\n accent: accent === 'custom' ? (props.customAccentValue ?? '') : accent,\n })\n }\n >\n <Show\n when={entryStyle() === 'labels'}\n fallback={\n <>\n <AccentSwatchGroups\n accentOptions={props.accentOptions}\n resolvedAppearance={resolvedAppearance()}\n showThemeDefault={showThemeDefault()}\n themeDefaultColor={themeDefaultColor()}\n />\n <div class=\"flex flex-col gap-1\">\n <Show when={props.showCustomAccentCaption ?? true}>\n <span class=\"text-xs font-medium text-muted-foreground\">Custom</span>\n </Show>\n <Radio.Item value=\"custom\">\n <Radio.ItemInput />\n <Radio.ItemLabel class=\"flex h-7 cursor-pointer items-center rounded-md border px-2 text-xs whitespace-nowrap data-[checked]:border-primary data-[checked]:ring-1 data-[checked]:ring-primary\">\n Custom\n </Radio.ItemLabel>\n </Radio.Item>\n </div>\n </>\n }\n >\n {/* The named-chip style: one grid, every choice a labelled control,\n including the custom colour — nothing to caption from above. */}\n <div class=\"grid grid-cols-2 gap-2 sm:grid-cols-3\" data-accent-grid>\n <For each={labelEntries()}>\n {(option) => (\n <Radio.Item value={option.id} class=\"min-w-0\" data-accent-option={option.id}>\n <Radio.ItemInput />\n <Radio.ItemLabel class=\"flex h-7 cursor-pointer items-center rounded-md border px-2 text-xs whitespace-nowrap data-[checked]:border-primary data-[checked]:ring-1 data-[checked]:ring-primary\">\n {option.label}\n </Radio.ItemLabel>\n </Radio.Item>\n )}\n </For>\n <Radio.Item value=\"custom\" class=\"min-w-0\">\n <Radio.ItemInput />\n <Radio.ItemLabel class=\"flex h-7 cursor-pointer items-center rounded-md border px-2 text-xs whitespace-nowrap data-[checked]:border-primary data-[checked]:ring-1 data-[checked]:ring-primary\">\n Custom\n </Radio.ItemLabel>\n </Radio.Item>\n </div>\n </Show>\n </Radio>\n }\n >\n <div class=\"flex w-full min-w-0 items-center gap-2\" data-accent-choices>\n <Radio\n value={accentSelection()}\n disabled={props.saving}\n orientation=\"horizontal\"\n aria-label=\"Accent\"\n class=\"min-w-0 flex-1\"\n onChange={(accent) => props.onChange({ accent })}\n >\n <AccentSwatchGroups\n accentOptions={props.accentOptions}\n resolvedAppearance={resolvedAppearance()}\n showThemeDefault={showThemeDefault()}\n themeDefaultColor={themeDefaultColor()}\n layout=\"row\"\n />\n </Radio>\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n tabIndex={0}\n disabled={props.saving}\n aria-pressed={isCustomAccent(props)}\n onClick={openCustomColor}\n >\n Custom\n </Button>\n <Input\n ref={(element) => {\n colorPicker = element\n }}\n type=\"color\"\n // `w-px` beats the Input's own `w-full`: an absolutely positioned\n // full-width input sized the sheet's scroll width.\n class=\"sr-only w-px\"\n tabIndex={-1}\n aria-label=\"Custom accent color\"\n value={\n /^#[0-9a-f]{6}$/i.test(props.draft.accent)\n ? props.draft.accent\n : (props.customAccentValue ?? '#000000')\n }\n disabled={props.saving}\n onChange={(event) => props.onChange({ accent: event.currentTarget.value })}\n />\n </div>\n </Show>\n )\n}\n\nexport function GlassChoices(props: AppearanceEditorProps) {\n return (\n <Radio\n value={props.draft.surface}\n disabled={props.saving}\n orientation=\"horizontal\"\n aria-label=\"Glass\"\n class=\"flex flex-wrap gap-1\"\n onChange={(surface) => {\n const option = SURFACES.find((candidate) => candidate.value === surface)\n if (option) props.onChange({ surface: option.value })\n }}\n >\n <For each={SURFACES}>\n {(option) => (\n <Radio.Item\n value={option.value}\n disabled={option.value === 'frosted' && !props.surfaceCapability.frosted}\n class=\"rounded-md focus-within:ring-3 focus-within:ring-ring/50\"\n >\n <Radio.ItemInput />\n <Radio.ItemLabel class=\"flex h-7 cursor-pointer items-center rounded-md border px-2 text-xs whitespace-nowrap data-[checked]:border-primary data-[checked]:ring-1 data-[checked]:ring-primary data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50\">\n {option.label}\n </Radio.ItemLabel>\n </Radio.Item>\n )}\n </For>\n </Radio>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAoCA,IAAMe,QAAQ;CACZ;EAAEC,OAAO;E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MAAME,MAAM+B,SACXjC,MAAMsD,qBAAqB;IAAU;IAAA,IAE5ClD,WAAQ;KAAA,OAAEJ,MAAMK;IAAM;IACtBE,WAAWmE,UAAU1E,MAAMO,SAAS,EAAE0B,QAAQyC,MAAMC,cAAcpF,MAAM,CAAC;GAAC,CAAA,GAAA,IAAA;GAAA,OAAAuE;EAAA;CAAA,CAAA;AAKpF;AAEA,SAAgBc,aAAa5E,OAA8B;CACzD,OAAAC,gBACGzB,YAAK;EAAA,IACJe,QAAK;GAAA,OAAES,MAAME,MAAM2E;EAAO;EAAA,IAC1BzE,WAAQ;GAAA,OAAEJ,MAAMK;EAAM;EACtBC,aAAW;EAAA,cAAA;EAAA,SAAA;EAGXC,WAAWsE,YAAY;GACrB,MAAMrE,SAASd,SAASe,MAAMC,cAAcA,UAAUnB,UAAUsF,OAAO;GACvE,IAAIrE,QAAQR,MAAMO,SAAS,EAAEsE,SAASrE,OAAOjB,MAAM,CAAC;EACtD;EAAC,IAAAoB,WAAA;GAAA,OAAAV,gBAEArB,KAAG;IAACgC,MAAMlB;IAAQiB,WACfH,WAAMP,gBACLzB,WAAMsC,MAAI;KAAA,IACTvB,QAAK;MAAA,OAAEiB,OAAOjB;KAAK;KAAA,IACnBa,WAAQ;MAAA,OAAEoB,WAAAhB,OAAOjB,UAAU,SAAS,CAAA,CAAA,KAAI,CAACS,MAAM8E,kBAAkBC;KAAO;KAAA,SAAA;KAAA,IAAApE,WAAA;MAAA,OAAA,CAAAV,gBAGvEzB,WAAMwC,WAAS,CAAA,CAAA,GAAAf,gBACfzB,WAAMyC,WAAS;OAAA,SAAA;OAAA,IAAAN,WAAA;QAAA,OACbH,OAAOhB;OAAK;MAAA,CAAA,CAAA;KAAA;IAAA,CAAA;GAGlB,CAAA;EAAA;CAAA,CAAA;AAIT"}
|
|
1
|
+
{"version":3,"file":"appearance-choices.js","names":["RadioGroup","Radio","Monitor","Moon","Sun","For","Show","isThemeAccentId","THEME_DEFAULT_ID","AccentPicker","isCustomAccentValue","AccentSwatchGroups","AppearanceEditorProps","ThemeMiniature","ThemeMiniatureSplit","MODES","value","label","const","SURFACES","MODE_ICONS","system","light","dark","ModeChoices","props","_$createComponent","draft","mode","disabled","saving","orientation","onChange","option","find","candidate","children","each","Icon","Item","data-mode","ItemInput","ItemLabel","_el$","_tmpl$","_$insert","when","fallback","theme","_$memo","lightTheme","darkTheme","showModeIcons","_el$3","_tmpl$3","_el$2","_tmpl$2","isCustomAccent","accent","accentOptions","some","id","AccentChoices","resolvedAppearance","accentSelection","showThemeDefault","showThemeDefaultAccent","entryStyle","accentEntryStyle","themeDefaultColor","colors","labelEntries","presets","filter","rowOptions","customAccentValue","_el$5","_tmpl$6","showCustomAccentCaption","_tmpl$5","_el$4","_tmpl$4","data-accent-option","inherit","options","layout","appearance","customSeed","onValueChange","GlassChoices","surface","surfaceCapability","frosted","_$createComponent","Radio","_$memo"],"sources":["../../../../src/components/composites/appearance-editor/appearance-choices.tsx"],"sourcesContent":["/*\n * MIT License\n *\n * Copyright (c) 2026 Wing\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n// Pinned mode-card, accent-swatch, and glass-chip composition. Kobalte replaces\n// the app port's manual roving focus; it does not replace the donor hierarchy.\nimport { RadioGroup as Radio } from '@kobalte/core/radio-group'\nimport { Monitor, Moon, Sun } from 'lucide-solid'\nimport { For, Show } from 'solid-js'\nimport { isThemeAccentId } from '#lib/theme-accents'\nimport { THEME_DEFAULT_ID } from '#lib/theme-defaults'\nimport { AccentPicker, isCustomAccentValue } from '../accent-picker'\nimport { AccentSwatchGroups } from './accent-swatch-groups'\nimport type { AppearanceEditorProps } from './appearance-types'\nimport { ThemeMiniature, ThemeMiniatureSplit } from './theme-preview'\n\nconst MODES = [\n { value: 'system', label: 'System' },\n { value: 'light', label: 'Light' },\n { value: 'dark', label: 'Dark' },\n] as const\nconst SURFACES = [\n { value: 'theme', label: 'Theme default' },\n { value: 'frosted', label: 'Frosted' },\n { value: 'opaque', label: 'Opaque' },\n] as const\nconst MODE_ICONS = { system: Monitor, light: Sun, dark: Moon } as const\n\nexport function ModeChoices(props: AppearanceEditorProps) {\n return (\n <Radio\n value={props.draft.mode}\n disabled={props.saving}\n orientation=\"horizontal\"\n aria-label=\"Appearance mode\"\n onChange={(mode) => {\n const option = MODES.find((candidate) => candidate.value === mode)\n if (option) props.onChange({ mode: option.value })\n }}\n class=\"grid grid-cols-1 gap-3 px-4 py-4 sm:grid-cols-3\"\n >\n <For each={MODES}>\n {(option) => {\n const Icon = MODE_ICONS[option.value]\n return (\n <Radio.Item\n value={option.value}\n data-mode={option.value}\n class=\"min-w-0 rounded-lg focus-within:ring-3 focus-within:ring-ring/50\"\n >\n <Radio.ItemInput />\n <Radio.ItemLabel class=\"flex cursor-pointer flex-col gap-2 rounded-lg border p-2 text-center text-xs data-[checked]:border-primary data-[checked]:ring-1 data-[checked]:ring-primary data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50\">\n <span class=\"block h-20 w-full\">\n <Show\n when={option.value === 'system'}\n fallback={\n <ThemeMiniature\n theme={option.value === 'light' ? props.lightTheme : props.darkTheme}\n />\n }\n >\n <ThemeMiniatureSplit light={props.lightTheme} dark={props.darkTheme} />\n </Show>\n </span>\n {/* The glyph names the axis beside the miniature, so the cards read\n like ThemeModeToggle without losing the previews. */}\n <Show when={props.showModeIcons} fallback={<span>{option.label}</span>}>\n <span class=\"flex items-center justify-center gap-1.5\">\n <Icon aria-hidden=\"true\" class=\"size-3.5\" />\n {option.label}\n </span>\n </Show>\n </Radio.ItemLabel>\n </Radio.Item>\n )\n }}\n </For>\n </Radio>\n )\n}\n\n/**\n * Whether the draft accent is the host's custom colour: not the theme default,\n * not a preset, and not a theme accent id. A theme accent id counts as known even\n * when the current pair cannot offer it — it is a stored role, not a colour the\n * user typed, and showing it in the custom field would invite editing `ansi-blue`.\n */\nexport function isCustomAccent(props: AppearanceEditorProps): boolean {\n const accent = props.draft.accent\n return (\n accent !== THEME_DEFAULT_ID &&\n !props.accentOptions.some((option) => option.id === accent) &&\n !isThemeAccentId(accent)\n )\n}\n\nexport function AccentChoices(props: AppearanceEditorProps) {\n // The resolved appearance decides which side of a preset pair — and which\n // theme accent — the swatches paint, so the row previews each choice as the\n // user will see it.\n const resolvedAppearance = () =>\n props.draft.mode === 'system' ? props.resolvedAppearance : props.draft.mode\n const accentSelection = () => (isCustomAccent(props) ? 'custom' : props.draft.accent)\n const showThemeDefault = () => props.showThemeDefaultAccent ?? true\n const entryStyle = () => props.accentEntryStyle ?? 'swatches'\n const themeDefaultColor = () =>\n resolvedAppearance() === 'light'\n ? props.lightTheme.colors.accent\n : props.darkTheme.colors.accent\n // The named-chip style feeds the same resolved preset list to both entries:\n // \"Theme default\" leads only when the host has not folded it into a preset.\n const labelEntries = () => {\n const presets = props.accentOptions.filter((option) => option.id !== THEME_DEFAULT_ID)\n return showThemeDefault()\n ? [{ id: THEME_DEFAULT_ID, label: 'Theme default' }, ...presets]\n : presets\n }\n // The `row` style is the shared AccentPicker every accent setting uses: the\n // swatches, then a Custom button that opens the native colour selector, so the\n // draft only changes once a colour is chosen there. The app has nothing to\n // inherit from, so there is no inherit swatch; \"Theme default\" leads when the\n // host keeps it.\n const rowOptions = () => {\n const presets = props.accentOptions.filter((option) => option.id !== THEME_DEFAULT_ID)\n return showThemeDefault()\n ? [\n {\n id: THEME_DEFAULT_ID,\n label: 'Theme default',\n light: themeDefaultColor(),\n dark: themeDefaultColor(),\n },\n ...presets,\n ]\n : presets\n }\n return (\n <Show\n when={entryStyle() === 'row'}\n fallback={\n <Radio\n value={accentSelection()}\n disabled={props.saving}\n orientation=\"horizontal\"\n aria-label=\"Accent\"\n class=\"flex flex-col items-start gap-3\"\n onChange={(accent) =>\n props.onChange({\n accent: accent === 'custom' ? (props.customAccentValue ?? '') : accent,\n })\n }\n >\n <Show\n when={entryStyle() === 'labels'}\n fallback={\n <>\n <AccentSwatchGroups\n accentOptions={props.accentOptions}\n resolvedAppearance={resolvedAppearance()}\n showThemeDefault={showThemeDefault()}\n themeDefaultColor={themeDefaultColor()}\n />\n <div class=\"flex flex-col gap-1\">\n <Show when={props.showCustomAccentCaption ?? true}>\n <span class=\"text-xs font-medium text-muted-foreground\">Custom</span>\n </Show>\n <Radio.Item value=\"custom\">\n <Radio.ItemInput />\n <Radio.ItemLabel class=\"flex h-7 cursor-pointer items-center rounded-md border px-2 text-xs whitespace-nowrap data-[checked]:border-primary data-[checked]:ring-1 data-[checked]:ring-primary\">\n Custom\n </Radio.ItemLabel>\n </Radio.Item>\n </div>\n </>\n }\n >\n {/* The named-chip style: one grid, every choice a labelled control,\n including the custom colour — nothing to caption from above. */}\n <div class=\"grid grid-cols-2 gap-2 sm:grid-cols-3\" data-accent-grid>\n <For each={labelEntries()}>\n {(option) => (\n <Radio.Item value={option.id} class=\"min-w-0\" data-accent-option={option.id}>\n <Radio.ItemInput />\n <Radio.ItemLabel class=\"flex h-7 cursor-pointer items-center rounded-md border px-2 text-xs whitespace-nowrap data-[checked]:border-primary data-[checked]:ring-1 data-[checked]:ring-primary\">\n {option.label}\n </Radio.ItemLabel>\n </Radio.Item>\n )}\n </For>\n <Radio.Item value=\"custom\" class=\"min-w-0\">\n <Radio.ItemInput />\n <Radio.ItemLabel class=\"flex h-7 cursor-pointer items-center rounded-md border px-2 text-xs whitespace-nowrap data-[checked]:border-primary data-[checked]:ring-1 data-[checked]:ring-primary\">\n Custom\n </Radio.ItemLabel>\n </Radio.Item>\n </div>\n </Show>\n </Radio>\n }\n >\n <AccentPicker\n label=\"Accent\"\n inherit={false}\n options={rowOptions()}\n layout=\"row\"\n appearance={resolvedAppearance()}\n value={props.draft.accent}\n customSeed={\n isCustomAccentValue(props.customAccentValue) ? props.customAccentValue : '#000000'\n }\n disabled={props.saving}\n onValueChange={(accent) => {\n if (accent !== null) props.onChange({ accent })\n }}\n />\n </Show>\n )\n}\n\nexport function GlassChoices(props: AppearanceEditorProps) {\n return (\n <Radio\n value={props.draft.surface}\n disabled={props.saving}\n orientation=\"horizontal\"\n aria-label=\"Glass\"\n class=\"flex flex-wrap gap-1\"\n onChange={(surface) => {\n const option = SURFACES.find((candidate) => candidate.value === surface)\n if (option) props.onChange({ surface: option.value })\n }}\n >\n <For each={SURFACES}>\n {(option) => (\n <Radio.Item\n value={option.value}\n disabled={option.value === 'frosted' && !props.surfaceCapability.frosted}\n class=\"rounded-md focus-within:ring-3 focus-within:ring-ring/50\"\n >\n <Radio.ItemInput />\n <Radio.ItemLabel class=\"flex h-7 cursor-pointer items-center rounded-md border px-2 text-xs whitespace-nowrap data-[checked]:border-primary data-[checked]:ring-1 data-[checked]:ring-primary data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50\">\n {option.label}\n </Radio.ItemLabel>\n </Radio.Item>\n )}\n </For>\n </Radio>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAmCA,IAAMe,QAAQ;CACZ;EAAEC,OAAO;EAAUC,OAAO;CAAS;CACnC;EAAED,OAAO;EAASC,OAAO;CAAQ;CACjC;EAAED,OAAO;EAA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WAAQ;MAAA,OAAEoB,WAAAhB,OAAOjB,UAAU,SAAS,CAAA,CAAA,KAAI,CAACS,MAAMkE,kBAAkBC;KAAO;KAAA,SAAA;KAAA,IAAAxD,WAAA;MAAA,OAAA,CAAAV,gBAGvEzB,WAAMwC,WAAS,CAAA,CAAA,GAAAf,gBACfzB,WAAMyC,WAAS;OAAA,SAAA;OAAA,IAAAN,WAAA;QAAA,OACbH,OAAOhB;OAAK;MAAA,CAAA,CAAA;KAAA;IAAA,CAAA;GAGlB,CAAA;EAAA;CAAA,CAAA;AAIT"}
|
|
@@ -244,7 +244,7 @@ function IconPickerDropdown(props) {
|
|
|
244
244
|
})];
|
|
245
245
|
}
|
|
246
246
|
}), createComponent(PopoverContent, {
|
|
247
|
-
"class": "w-
|
|
247
|
+
"class": "w-88 max-w-(--kb-popper-content-available-width)",
|
|
248
248
|
get children() {
|
|
249
249
|
return createComponent(IconPicker, mergeProps(picker, { onValueChange: (key) => {
|
|
250
250
|
picker.onValueChange(key);
|