@gemboss/ui 0.56.0 → 0.58.0
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/CHANGELOG.md +176 -0
- package/README.md +60 -1
- package/catalog/editor.html +1 -1
- package/catalog/index.html +3 -3
- package/gemboss-ui.css +2 -2
- package/package.json +19 -1
- package/parts/components.css +1 -1
- package/parts/core.css +1 -1
- package/parts/shell.css +1 -1
- package/src/assistant/host.tsx +21 -5
- package/src/assistant/sessions.tsx +36 -18
- package/src/collections.css +1 -1
- package/src/collections.tsx +15 -4
- package/src/dialog.tsx +4 -1
- package/src/editor/chips.tsx +24 -0
- package/src/editor/controls.tsx +18 -7
- package/src/editor/index.ts +3 -1
- package/src/editor/picker.tsx +9 -3
- package/src/editor/repeater.tsx +26 -14
- package/src/editor/swatch.ts +86 -0
- package/src/editor-chips.css +1 -0
- package/src/editor-color.css +1 -1
- package/src/editor-picker.css +1 -1
- package/src/editor-plain.js +1 -1
- package/src/editor-popover.css +1 -1
- package/src/editor-rail.css +1 -0
- package/src/editor.css +1 -1
- package/src/index-table.tsx +1 -1
- package/src/index.ts +7 -0
- package/src/job-card.css +1 -0
- package/src/job-card.tsx +130 -0
- package/src/narration.css +1 -0
- package/src/save-bar.css +1 -0
- package/src/save-bar.tsx +50 -0
- package/src/skill-flow/canvas.tsx +574 -0
- package/src/skill-flow/index.ts +10 -0
- package/src/skill-flow/layout.ts +229 -0
- package/src/skill-flow/model.ts +256 -0
- package/src/skill-flow.css +1 -0
- package/src/skill-stats.css +1 -0
- package/src/skill-stats.tsx +213 -0
- package/src/skill-view.css +1 -0
- package/src/skill-view.tsx +257 -0
package/src/editor/controls.tsx
CHANGED
|
@@ -18,7 +18,7 @@ import { cssUrl } from "./css-url";
|
|
|
18
18
|
import { ColorPicker } from "./color-picker";
|
|
19
19
|
import { useOnNewValue } from "./new-value";
|
|
20
20
|
import { Popover } from "./popover";
|
|
21
|
-
import { opacityOf, parseColor, swatchState, swatchWhy, themeColorName, withOpacity } from "./swatch";
|
|
21
|
+
import { mixColor, mixName, mixOf, opacityOf, parseColor, swatchState, swatchWhy, themeColorName, withOpacity } from "./swatch";
|
|
22
22
|
import { Segmented } from "../segmented";
|
|
23
23
|
import { Menu, MenuItem } from "../menu";
|
|
24
24
|
|
|
@@ -270,10 +270,13 @@ export function ColorControl({ id, value, onChange, disabled, label, placeholder
|
|
|
270
270
|
// seller read a colour nobody chose. Empty, the swatch is white with the slash a colour picker draws for "none" (editor.css
|
|
271
271
|
// `[data-empty]`), and opens on white.
|
|
272
272
|
const empty = !draft.trim();
|
|
273
|
-
|
|
273
|
+
// A TWO-COLOUR MIX (a gradient's "+ Add color" between theme colours, swatch.ts mixOf): painted as the page draws it when the
|
|
274
|
+
// theme's chips say both sides, and named "Border + #eeeeee" over the box, not the code it is written as (Control UI C13).
|
|
275
|
+
const mixed = mixColor(draft.trim(), (token) => choices?.find((c) => c.value === token && c.group !== "recent")?.swatch ?? null);
|
|
276
|
+
const { usable } = shown?.usable ? shown : mixed ? { usable: true } : swatchState(draft);
|
|
274
277
|
// What the swatch paints: the colour with its opacity (the checkerboard shows through). Nothing for what it cannot show (a
|
|
275
278
|
// gradient, an unknown token): the native swatch painted those black, a colour nobody chose (SwatchState's rule).
|
|
276
|
-
const parsed = usable ? parseColor(chosen ? chosen.swatch : draft) : null;
|
|
279
|
+
const parsed = usable ? (mixed ?? parseColor(chosen ? chosen.swatch : draft)) : null;
|
|
277
280
|
const paint = parsed ? `rgba(${Math.round(parsed.r)}, ${Math.round(parsed.g)}, ${Math.round(parsed.b)}, ${parsed.a})` : null;
|
|
278
281
|
const rowRef = useRef<HTMLDivElement>(null);
|
|
279
282
|
const swatchRef = useRef<HTMLButtonElement>(null);
|
|
@@ -287,13 +290,21 @@ export function ColorControl({ id, value, onChange, disabled, label, placeholder
|
|
|
287
290
|
const [typing, setTyping] = useState(false);
|
|
288
291
|
useOnNewValue(() => { if (disabled) setTyping(false); }, [disabled]);
|
|
289
292
|
const tokenLabel = themeColorName(draft);
|
|
293
|
+
const mixRead = mixOf(draft);
|
|
294
|
+
const mixLabel = mixName(mixRead);
|
|
295
|
+
const halfMix = mixRead?.[0].share === 50;
|
|
290
296
|
const themeLabel = tokenLabel ? (chosen && chosen.group !== "recent" ? chosen.label : tokenLabel) : null;
|
|
297
|
+
// The words drawn over the box: a theme colour's name, or a mix's two names; and what kind of name it is.
|
|
298
|
+
const boxName = themeLabel ?? mixLabel;
|
|
299
|
+
const boxKind = themeLabel ? "Theme" : "Mix";
|
|
291
300
|
// Focused, the token is selected whole, so what is typed replaces it; again on a click's mouseup, which would put the caret back.
|
|
292
301
|
const selectOnUp = useRef(false);
|
|
293
302
|
// Why the swatch is off, said under it, read with it (a tooltip alone reached neither a finger nor the keys). The COMMITTED
|
|
294
303
|
// value's reason, and kept while the panel saves (it disables every field): taken from the draft or dropped while saving, the
|
|
295
304
|
// line came and went on every write and while a hex was typed (review of #4636). A draft that is a whole hex has none.
|
|
296
305
|
const why = usable ? null : swatchWhy(value);
|
|
306
|
+
// The picker opens on the colour the swatch paints: a mix's own, its transparency with it.
|
|
307
|
+
const base = mixed && paint ? paint : chosen ? chosen.swatch : draft;
|
|
297
308
|
const whyId = useId();
|
|
298
309
|
// The opacity, as typed until it is committed (blur / Enter): "50", "50%" or " 50 % " all read 50; anything else changes nothing.
|
|
299
310
|
const opacity = opacityOf(draft);
|
|
@@ -317,18 +328,18 @@ export function ColorControl({ id, value, onChange, disabled, label, placeholder
|
|
|
317
328
|
runs, which closed it on each pick and opened it again with the focus: review of #5296), nor by the text box holding a
|
|
318
329
|
half-typed colour (it closed at "#" and opened at "#123", taking the focus and the rest of the typing). */}
|
|
319
330
|
<Popover open={picking} anchor={rowRef.current} returnTo={swatchRef.current} title={label} onClose={() => setPicking(false)}>
|
|
320
|
-
<ColorPicker value={draft} base={
|
|
331
|
+
<ColorPicker value={draft} base={base} label={label} choices={choices} allowNone={allowNone} noneLabel={placeholder}
|
|
321
332
|
onChange={(next) => { setDraft(next); onChange(next); }} />
|
|
322
333
|
</Popover>
|
|
323
334
|
<span className="gemboss-ei-color-box">
|
|
324
335
|
<input id={id} className="gemboss-field gemboss-ei-inp" placeholder={placeholder ?? "Not set"} value={draft} disabled={disabled} aria-describedby={describedBy}
|
|
325
|
-
title={themeLabel ? `${themeLabel} (theme colour)` : undefined} data-theme-colour={
|
|
326
|
-
onFocus={(e) => { setTyping(true); if (
|
|
336
|
+
title={themeLabel ? `${themeLabel} (theme colour)` : mixLabel ? (halfMix ? `${mixLabel} (half of each)` : mixLabel) : undefined} data-theme-colour={boxName && !typing ? "" : undefined}
|
|
337
|
+
onFocus={(e) => { setTyping(true); if (boxName) { const box = e.currentTarget; selectOnUp.current = true; requestAnimationFrame(() => box.select()); } }}
|
|
327
338
|
onMouseUp={(e) => { if (selectOnUp.current) { selectOnUp.current = false; e.preventDefault(); e.currentTarget.select(); } }}
|
|
328
339
|
onChange={(e) => { setDraft(e.target.value); onDraft?.(e.target.value); }}
|
|
329
340
|
onBlur={() => { setTyping(false); selectOnUp.current = false; onChange(draft); }}
|
|
330
341
|
onKeyDown={(e) => { selectOnUp.current = false; blurOnEnter(e); }} />
|
|
331
|
-
{
|
|
342
|
+
{boxName && !typing ? <span className="gemboss-ei-color-name" aria-hidden="true"><span className="gemboss-ei-color-name__text">{boxName}</span><span> · {boxKind}</span></span> : null}
|
|
332
343
|
</span>
|
|
333
344
|
{/* A fixed narrow box beside the wide one: its width is editor-color.css's (64px, 72px at a phone's 16px type, where "100%" did
|
|
334
345
|
not fit 64: Control UI C10). */}
|
package/src/editor/index.ts
CHANGED
|
@@ -41,7 +41,7 @@ export {
|
|
|
41
41
|
} from "./controls";
|
|
42
42
|
// 27/10/2026: a control takes a value from outside in the render that brings it, not an effect later (new-value.ts).
|
|
43
43
|
export { useOnNewValue } from "./new-value";
|
|
44
|
-
export { opacityOf, parseColor, pickSwatch, swatchState, swatchWhy, themeColorChoices, withOpacity, type Rgba, type SwatchState } from "./swatch";
|
|
44
|
+
export { mixColor, mixName, mixOf, mixSides, opacityOf, parseColor, pickSwatch, swatchState, swatchWhy, themeColorChoices, withOpacity, type MixPart, type Rgba, type SwatchState } from "./swatch";
|
|
45
45
|
export { cssUrl } from "./css-url";
|
|
46
46
|
// Step 4 (0.22.0): the page's layers and the drawer (`layers`, stateless; the page editor draws them), a list whose rows
|
|
47
47
|
// reorder (`sortable`, "use client": a drag holds state; no admin screen uses it), and the element outline (`tree`, the
|
|
@@ -55,6 +55,8 @@ export { SortableLayerList, type SortableLayerListProps, useRowDrag, dropIndex }
|
|
|
55
55
|
export { RepeaterList, useKeyedRows, type RepeaterListProps, type KeyedRows } from "./repeater";
|
|
56
56
|
// 16/10/2026: a closed choice of shapes (an image's ratio, a layout) as picture tiles; its own CSS part, editor-tiles.css.
|
|
57
57
|
export { ChoiceTiles, tileShapeStyle, type ChoiceTile, type ChoiceTilesProps } from "./tiles";
|
|
58
|
+
// 31/10/2026: a run of groups where one holding nothing is a chip (Control UI C32 slice 3); its own CSS part, editor-chips.css.
|
|
59
|
+
export { InspectorChips, type InspectorChipsProps } from "./chips";
|
|
58
60
|
// 24/10/2026: a setting's small panel beside the settings column (top layer; a sheet at phone width); its own CSS part.
|
|
59
61
|
export { Popover, type PopoverProps } from "./popover";
|
|
60
62
|
// 24/10/2026: the colour picker ColorControl's swatch opens (square, hue, opacity, hex, eyedropper, theme/recent/None).
|
package/src/editor/picker.tsx
CHANGED
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
// · `.gemboss-ei-pick-row[role=option]`: a 40px picture (a photo, or an icon for a page or a section), the title (20px line,
|
|
13
13
|
// 650) with a status pill (`ui-tag`), a second line; the row now chosen has a check and `aria-selected`; one click picks;
|
|
14
14
|
// · the second line puts a NOTE first, in its own box the ellipsis never reaches (review of gemboss #5283: "Opens the popup"
|
|
15
|
-
// at the end of a long line was cut off), then the rest, cut with "…";
|
|
15
|
+
// at the end of a long line was cut off), then the rest, cut with "…"; a note longer than the whole line wraps, whole, and
|
|
16
|
+
// the rest gives way, as it did when the note filled the line (a locked row's reason in a phone's dialog, 02/11/2026: it read
|
|
17
|
+
// "Draft: shoppers can't …" at 320 px); every other row keeps its one line (the rows' 56 px);
|
|
16
18
|
// · a row that cannot be picked is shown, says why (its note), and does nothing (`aria-disabled`);
|
|
17
19
|
// · states (the kit's collection states): loading keeps the rows' place with skeletons; RELOADING keeps the rows of the last
|
|
18
20
|
// answer dimmed and `aria-busy`, and nothing is picked from them (they answer another search: an Enter there wrote the
|
|
@@ -64,6 +66,9 @@ export interface PickerListProps {
|
|
|
64
66
|
pinned?: readonly PickerItem[];
|
|
65
67
|
/** The key now chosen: its row has the check (a drill row: the tint), and is the one highlighted first. */
|
|
66
68
|
current?: string | null;
|
|
69
|
+
/** Several chosen at once (a list's "Add products"): the list is `aria-multiselectable`, each row in the set has the check and
|
|
70
|
+
* `aria-selected`, and a pick is the caller's tick or untick (`current` is then only where the highlight starts). */
|
|
71
|
+
checked?: ReadonlySet<string>;
|
|
67
72
|
onPick: (key: string) => void;
|
|
68
73
|
/** The search box above the list; leave it out for a short list. The caller filters `items` (or asks a server). `autoFocus`:
|
|
69
74
|
* the box takes the focus when the list appears, and is the `[data-autofocus]` the kit's Dialog and Popover focus on opening
|
|
@@ -176,7 +181,7 @@ const TONE: Record<PickerTone, string> = { neutral: "ui-tag", info: "ui-tag ui-t
|
|
|
176
181
|
|
|
177
182
|
const NO_ROWS: readonly PickerItem[] = [];
|
|
178
183
|
|
|
179
|
-
export function PickerList({ label, items, pinned = NO_ROWS, current = null, onPick, search, state = "ready", error, empty, more, loadingRows = 4 }: PickerListProps) {
|
|
184
|
+
export function PickerList({ label, items, pinned = NO_ROWS, current = null, checked, onPick, search, state = "ready", error, empty, more, loadingRows = 4 }: PickerListProps) {
|
|
180
185
|
const base = useId();
|
|
181
186
|
const boxRef = useRef<HTMLInputElement>(null);
|
|
182
187
|
// Reloading with nothing to keep is a first read: skeletons, not "nothing here".
|
|
@@ -229,9 +234,10 @@ export function PickerList({ label, items, pinned = NO_ROWS, current = null, onP
|
|
|
229
234
|
|
|
230
235
|
{hasList ? (
|
|
231
236
|
<ul id={listId} className={`gemboss-ei-pick-list${live || pinned.length ? "" : " is-reloading"}`} role="listbox" aria-label={label} aria-busy={live ? undefined : true}
|
|
237
|
+
aria-multiselectable={checked ? true : undefined}
|
|
232
238
|
tabIndex={search ? -1 : 0} aria-activedescendant={search ? undefined : activeId} onKeyDown={search ? undefined : (e) => keyDown(e, false)}>
|
|
233
239
|
{shown.map((it, i) => {
|
|
234
|
-
const chosen = it.key === current;
|
|
240
|
+
const chosen = checked ? checked.has(it.key) : it.key === current;
|
|
235
241
|
const note = it.disabledReason ?? it.note;
|
|
236
242
|
return (
|
|
237
243
|
<li key={it.key} id={optionId(i)} role="option" aria-selected={chosen} aria-disabled={it.disabledReason || !rowLive(i) ? true : undefined}
|
package/src/editor/repeater.tsx
CHANGED
|
@@ -46,7 +46,8 @@ export interface KeyedRows<T> {
|
|
|
46
46
|
/** A copy right after it, with a key of its own. */
|
|
47
47
|
duplicate: (index: number) => void;
|
|
48
48
|
remove: (index: number) => void;
|
|
49
|
-
|
|
49
|
+
/** Rows at the end, in ONE write: several added together are one save, so one step to undo (a picker's "Add 3 products"). */
|
|
50
|
+
add: (...rows: T[]) => void;
|
|
50
51
|
/**
|
|
51
52
|
* Change the row with this KEY, from its latest version: `change` gets the row as it is now, not as it was when the field
|
|
52
53
|
* was drawn. A control that commits late (a colour or a slider holds its write 250 ms, and flushes it when it unmounts)
|
|
@@ -66,8 +67,12 @@ export interface KeyedRows<T> {
|
|
|
66
67
|
* shown (review of #4506: a row added to an unset list vanished).
|
|
67
68
|
* · a stored list equal to one of our writes is that write coming back: what is shown (maybe newer) stays; any other is a
|
|
68
69
|
* change from elsewhere (an undo, the chat) and replaces it, the keys kept by position.
|
|
70
|
+
* · `commit` is told where each row came from (`how.from[i]`: the place row i had in the list before this change, -1 for a new
|
|
71
|
+
* one; a duplicate names its original) and how many rows there were (`how.was`), so a host that keeps something per row (a
|
|
72
|
+
* tab's column of elements, Control UI C41) moves it with the row instead of guessing from the rows' words.
|
|
69
73
|
*/
|
|
70
|
-
export
|
|
74
|
+
export type KeyedChange = { from: number[]; was: number };
|
|
75
|
+
export function useKeyedRows<T>(value: readonly T[], commit: (next: T[], how: KeyedChange) => false | void | PromiseLike<unknown>): KeyedRows<T> {
|
|
71
76
|
const [state, setState] = useState(() => ({ rows: value.slice(), keys: value.map(() => freshKey()) }));
|
|
72
77
|
const latest = useRef(state);
|
|
73
78
|
latest.current = state;
|
|
@@ -100,13 +105,13 @@ export function useKeyedRows<T>(value: readonly T[], commit: (next: T[]) => fals
|
|
|
100
105
|
latest.current = { rows: stored.current.rows.slice(), keys: stored.current.keys.slice() };
|
|
101
106
|
setState(latest.current);
|
|
102
107
|
};
|
|
103
|
-
const write = (rows: T[], keys: string[]) => {
|
|
108
|
+
const write = (rows: T[], keys: string[], from: number[]) => {
|
|
104
109
|
const before = latest.current, previousWrite = writes.current;
|
|
105
110
|
const n = ++writeSequence.current; writes.current = n;
|
|
106
111
|
pending.current.push({ n, json: JSON.stringify(rows), keys });
|
|
107
112
|
latest.current = { rows, keys };
|
|
108
113
|
setState(latest.current);
|
|
109
|
-
const answer = commit(rows);
|
|
114
|
+
const answer = commit(rows, { from, was: before.rows.length });
|
|
110
115
|
if (answer === false) {
|
|
111
116
|
pending.current = pending.current.filter((p) => p.n !== n);
|
|
112
117
|
if (n !== writes.current) return; // a reentrant newer write still decides
|
|
@@ -126,27 +131,32 @@ export function useKeyedRows<T>(value: readonly T[], commit: (next: T[]) => fals
|
|
|
126
131
|
move: (from, to) => {
|
|
127
132
|
const { rows, keys } = latest.current;
|
|
128
133
|
if (from === to || to < 0 || to >= rows.length) return;
|
|
129
|
-
const
|
|
130
|
-
|
|
134
|
+
const places = rows.map((_, n) => n);
|
|
135
|
+
const r = splice(rows, from, 1), k = splice(keys, from, 1), p = splice(places, from, 1);
|
|
136
|
+
write(splice(r, to, 0, rows[from]!), splice(k, to, 0, keys[from]!), splice(p, to, 0, from));
|
|
131
137
|
},
|
|
132
138
|
duplicate: (index) => {
|
|
133
139
|
const { rows, keys } = latest.current;
|
|
134
140
|
if (index < 0 || index >= rows.length) return;
|
|
135
|
-
write(splice(rows, index + 1, 0, JSON.parse(JSON.stringify(rows[index])) as T), splice(keys, index + 1, 0, freshKey()));
|
|
141
|
+
write(splice(rows, index + 1, 0, JSON.parse(JSON.stringify(rows[index])) as T), splice(keys, index + 1, 0, freshKey()), splice(rows.map((_, n) => n), index + 1, 0, index));
|
|
136
142
|
},
|
|
137
143
|
remove: (index) => {
|
|
138
144
|
const { rows, keys } = latest.current;
|
|
139
145
|
if (index < 0 || index >= rows.length) return;
|
|
140
|
-
write(rows.filter((_, n) => n !== index), keys.filter((_, n) => n !== index));
|
|
146
|
+
write(rows.filter((_, n) => n !== index), keys.filter((_, n) => n !== index), rows.map((_, n) => n).filter((n) => n !== index));
|
|
147
|
+
},
|
|
148
|
+
add: (...added) => {
|
|
149
|
+
if (!added.length) return;
|
|
150
|
+
const { rows, keys } = latest.current;
|
|
151
|
+
write([...rows, ...added], [...keys, ...added.map(() => freshKey())], [...rows.map((_, n) => n), ...added.map(() => -1)]);
|
|
141
152
|
},
|
|
142
|
-
add: (row) => { const { rows, keys } = latest.current; write([...rows, row], [...keys, freshKey()]); },
|
|
143
153
|
patch: (key, change) => {
|
|
144
154
|
const { rows, keys } = latest.current;
|
|
145
155
|
const at = keys.indexOf(key);
|
|
146
156
|
if (at < 0) return;
|
|
147
157
|
const next = change(rows[at]!);
|
|
148
158
|
if (JSON.stringify(next) === JSON.stringify(rows[at])) return;
|
|
149
|
-
write(rows.map((r, n) => (n === at ? next : r)), keys.slice());
|
|
159
|
+
write(rows.map((r, n) => (n === at ? next : r)), keys.slice(), rows.map((_, n) => n));
|
|
150
160
|
},
|
|
151
161
|
};
|
|
152
162
|
}
|
|
@@ -160,8 +170,10 @@ export interface RepeaterListProps {
|
|
|
160
170
|
keys: readonly string[];
|
|
161
171
|
/** A row's name in its header (its first field); empty says "Item N". */
|
|
162
172
|
title: (index: number) => string;
|
|
163
|
-
/** A row's controls, drawn while it is open.
|
|
164
|
-
|
|
173
|
+
/** A row's controls, drawn while it is open. `close` puts the row's layer away (popover mode; inline, the row stays open): a control
|
|
174
|
+
* that opens something of the host's, not in the top layer (the insert menu a tab's "Add element" opens), does it first, or that
|
|
175
|
+
* menu is drawn under the layer. */
|
|
176
|
+
body: (index: number, close: () => void) => React.ReactNode;
|
|
165
177
|
/** `to` is the index after the move. Absent: the rows keep their order (no grip, no ↑ ↓, no Alt+arrows): a list whose order
|
|
166
178
|
* is kept elsewhere (items read from Content, in Content's order). */
|
|
167
179
|
onMove?: (from: number, to: number) => void;
|
|
@@ -339,7 +351,7 @@ export function RepeaterList({ label, hint, keys, title, body, onMove, onRemove,
|
|
|
339
351
|
</span>
|
|
340
352
|
) : null}
|
|
341
353
|
</div>
|
|
342
|
-
{isOpen ? <div id={bodyId} className="gemboss-ei-rep-body" role="group" aria-label={name}>{body(i)}</div> : null}
|
|
354
|
+
{isOpen ? <div id={bodyId} className="gemboss-ei-rep-body" role="group" aria-label={name}>{body(i, () => {})}</div> : null}
|
|
343
355
|
</div>
|
|
344
356
|
);
|
|
345
357
|
})}
|
|
@@ -358,7 +370,7 @@ export function RepeaterList({ label, hint, keys, title, body, onMove, onRemove,
|
|
|
358
370
|
<span className="gemboss-ei-rep-popat">{i + 1} / {keys.length}</span>
|
|
359
371
|
<button type="button" aria-label={`Close ${name}`} onClick={closeLayer}>✕</button>
|
|
360
372
|
</div>
|
|
361
|
-
{body(i)}
|
|
373
|
+
{body(i, () => pick(null))}
|
|
362
374
|
</div>
|
|
363
375
|
);
|
|
364
376
|
})() : null}
|
package/src/editor/swatch.ts
CHANGED
|
@@ -181,6 +181,87 @@ export function themeColorChoices(palette: Readonly<Record<string, string>> | nu
|
|
|
181
181
|
.map((t) => ({ value: `var(--gem-color-${t})`, label: TOKEN_NAMES[t]!, swatch: palette[t]!.trim() }));
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
+
/** One side of an sRGB `color-mix` as written, and the share of the mix it makes (0–100). */
|
|
185
|
+
export type MixPart = { color: string; share: number };
|
|
186
|
+
/**
|
|
187
|
+
* The two sides of an sRGB `color-mix`, each with its share, as CSS reads them: a share written before or after the colour, on one side
|
|
188
|
+
* (the other is the rest) or on both when they make 100, none for half each; `weighted` when a share is written. Null for anything
|
|
189
|
+
* else, shares that do not make 100 among it (CSS changes the alpha then). The one reading of these rules: the colour box names and
|
|
190
|
+
* paints with it (`mixOf`), and the admin's gradient Add reads a mix down to its colours with it (gradient-value.ts).
|
|
191
|
+
*/
|
|
192
|
+
export function mixSides(value: string): { parts: [MixPart, MixPart]; weighted: boolean } | null {
|
|
193
|
+
const m = /^color-mix\(\s*in\s+srgb\s*,\s*(.+)\)$/i.exec(value.trim());
|
|
194
|
+
if (!m) return null;
|
|
195
|
+
let depth = 0, cut = -1;
|
|
196
|
+
for (let i = 0; i < m[1]!.length; i++) {
|
|
197
|
+
const ch = m[1]![i];
|
|
198
|
+
if (ch === "(") depth++;
|
|
199
|
+
else if (ch === ")") { if (--depth < 0) return null; }
|
|
200
|
+
else if (ch === "," && depth === 0) { if (cut >= 0) return null; cut = i; }
|
|
201
|
+
}
|
|
202
|
+
if (cut < 0 || depth !== 0) return null;
|
|
203
|
+
const side = (raw: string) => {
|
|
204
|
+
const t = raw.trim();
|
|
205
|
+
const after = /^(.+?)\s+(\d+(?:\.\d+)?)%$/.exec(t), before = /^(\d+(?:\.\d+)?)%\s+(.+)$/.exec(t);
|
|
206
|
+
if (after && before) return null;
|
|
207
|
+
return after ? { color: after[1]!, share: Number(after[2]) } : before ? { color: before[2]!, share: Number(before[1]) } : { color: t, share: null };
|
|
208
|
+
};
|
|
209
|
+
const a = side(m[1]!.slice(0, cut)), b = side(m[1]!.slice(cut + 1));
|
|
210
|
+
if (!a || !b || !a.color || !b.color) return null;
|
|
211
|
+
const sa = a.share ?? (b.share !== null ? 100 - b.share : 50), sb = b.share ?? 100 - sa;
|
|
212
|
+
if (Math.abs(sa + sb - 100) > 1e-6 || sa < 0 || sb < 0) return null;
|
|
213
|
+
return { parts: [{ color: a.color, share: sa }, { color: b.color, share: sb }], weighted: a.share !== null || b.share !== null };
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/** One side of a two-colour mix, as a seller reads it: a theme colour's name ("Border") or the colour as written ("#eeeeee"), and the
|
|
217
|
+
* share of the mix it makes (0–100). `weighted` when the value writes a share. */
|
|
218
|
+
type MixSide = { value: string; name: string; share: number; weighted: boolean };
|
|
219
|
+
/**
|
|
220
|
+
* A TWO-COLOUR MIX (Control UI C13, 03/11/2026): `color-mix(in srgb, A, B)`, half of each, as a gradient's "+ Add color" writes the
|
|
221
|
+
* colour between two theme colours (the browser mixes them, so it follows the theme). Its two sides when each is a theme colour or one
|
|
222
|
+
* colour; null for anything else (another space, a nested mix). Measured on prod: the box read the whole
|
|
223
|
+
* `color-mix(in srgb, var(--gem-color-border), #eeeeee)` with "Kept as written", and the swatch was empty.
|
|
224
|
+
*
|
|
225
|
+
* At SHARES too (`mixSides`): `color-mix(in srgb, var(--gem-color-border) 75%, #eeeeee)` is what "+ Add color" writes beside a mix,
|
|
226
|
+
* which used to be a mix of a mix the box could not read (prod, 03/11/2026).
|
|
227
|
+
*/
|
|
228
|
+
export function mixOf(value: string): [MixSide, MixSide] | null {
|
|
229
|
+
const mix = mixSides(value);
|
|
230
|
+
if (!mix) return null;
|
|
231
|
+
const [a, b] = mix.parts.map(({ color, share }) => {
|
|
232
|
+
const name = themeColorName(color) ?? (parseColor(color) ? color : null);
|
|
233
|
+
return name ? { value: color, name, share, weighted: mix.weighted } : null;
|
|
234
|
+
});
|
|
235
|
+
return a && b ? [a, b] : null;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/** A mix's name, "Border + #eeeeee" half and half, "Border 75% + #eeeeee 25%" otherwise; null when `mixOf` does not read it. */
|
|
239
|
+
export function mixName(value: string | ReturnType<typeof mixOf>): string | null {
|
|
240
|
+
const mix = typeof value === "string" ? mixOf(value) : value;
|
|
241
|
+
if (!mix) return null;
|
|
242
|
+
// Rounded past float noise: 100 - 93.8 is 6.200000000000003, and the box would print it.
|
|
243
|
+
const pct = (n: number) => `${Number(n.toFixed(2))}%`;
|
|
244
|
+
return mix[0].share === 50 ? `${mix[0].name} + ${mix[1].name}` : `${mix[0].name} ${pct(mix[0].share)} + ${mix[1].name} ${pct(mix[1].share)}`;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/** The colour a mix draws, each side at its share, when both are known: a theme colour through `palette`, asked by its own token
|
|
248
|
+
* (`var(--gem-color-<role>)`, however the value spells it), any other as written. Mixed as CSS mixes, with premultiplied alpha:
|
|
249
|
+
* half of transparent and white is half-transparent white, not grey. Null when a side's colour is not known here. */
|
|
250
|
+
export function mixColor(value: string, palette: (token: string) => string | null): Rgba | null {
|
|
251
|
+
const mix = mixOf(value);
|
|
252
|
+
if (!mix) return null;
|
|
253
|
+
const colour = (v: string) => {
|
|
254
|
+
const role = /^var\(\s*--gem-color-([a-z-]+)\s*\)$/i.exec(v)?.[1]?.toLowerCase();
|
|
255
|
+
return parseColor((role ? palette(`var(--gem-color-${role})`) : v) ?? "");
|
|
256
|
+
};
|
|
257
|
+
const [a, b] = mix.map((s) => colour(s.value));
|
|
258
|
+
if (!a || !b) return null;
|
|
259
|
+
const wa = mix[0].share / 100, wb = mix[1].share / 100;
|
|
260
|
+
const alpha = a.a * wa + b.a * wb;
|
|
261
|
+
const ch = (x: number, y: number) => (alpha > 0 ? (x * a.a * wa + y * b.a * wb) / alpha : x * wa + y * wb);
|
|
262
|
+
return { r: ch(a.r, b.r), g: ch(a.g, b.g), b: ch(a.b, b.b), a: alpha };
|
|
263
|
+
}
|
|
264
|
+
|
|
184
265
|
/**
|
|
185
266
|
* WHY THE SWATCH IS OFF, said where a seller sees it (Claude Design: a disabled control says why). The editors' selection toolbar
|
|
186
267
|
* writes the theme's own colours as tokens (`var(--gem-color-accent)`), so every colour picked there turned its field's swatch grey,
|
|
@@ -193,5 +274,10 @@ export function swatchWhy(value: string): string | null {
|
|
|
193
274
|
const token = /^var\(\s*--gem-color-([a-z-]+)\s*\)$/i.exec(v)?.[1]?.toLowerCase();
|
|
194
275
|
if (token) return `Theme color: ${tokenName(token)}. Type a color to use your own.`;
|
|
195
276
|
if (/^var\(/i.test(v)) return "A theme value. Type a color to use your own.";
|
|
277
|
+
// Names a half-and-half mix only, as editor-plain.js does (its weight is at its ceiling); any other mix is still a mix, not "Kept as
|
|
278
|
+
// written … not a name" (review: a mix at shares whose theme colours the chips do not say).
|
|
279
|
+
const mix = mixOf(v);
|
|
280
|
+
if (mix && !mix[0].weighted) return `A mix of ${mixName(mix)!.replace(" + ", " and ")}, half of each. Type a color to use your own.`;
|
|
281
|
+
if (/^color-mix\(/i.test(v)) return "A mix of colors. Type a color to use your own.";
|
|
196
282
|
return "Kept as written: the swatch shows one color (hex, rgb, hsl or oklch), not a gradient or a name.";
|
|
197
283
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.gemboss-ei-chips{display:flex;flex-wrap:wrap;align-items:flex-start;column-gap:8px}.gemboss-ei-chips>*{flex:1 0 100%;min-width:0}.gemboss-ei-chips>.gemboss-ei-grp:last-child:not([data-chip]){border-bottom:1px solid var(--gemboss-divider-soft,#eceef2)}.gemboss-ei-chips>[data-chip]{flex:none;margin:8px 0 0;padding:0;border:0}.gemboss-ei-chips>[data-chip]:last-child{margin-bottom:8px}.gemboss-ei-chips>[data-chip]>:first-child{display:inline-flex;align-items:center;gap:4px;width:auto;min-height:28px;margin:0;padding:0 12px;border:1px solid var(--gemboss-divider,#e5e7ea);border-radius:999px;background:var(--gemboss-surface,#fff);color:var(--gemboss-text,#1b1c1e);font-size:13px;line-height:16px;font-weight:400}.gemboss-ei-chips>[data-chip]>:first-child:hover:not(:disabled){background:var(--gemboss-hover,#eceef2)}.gemboss-ei-chips>[data-chip] .gemboss-ei-chev{display:none}@media (pointer: coarse),(max-width:47.9975em){.gemboss-ei-chips>[data-chip]>:first-child{min-height:44px}}
|
package/src/editor-color.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.gemboss-ei-swatch{display:grid;padding:2px}.gemboss-ei-swatch-fill{display:block;border-radius:6px;background:linear-gradient(var(--sw,#fff),var(--sw,#fff)),conic-gradient(#d8dbe0 25%,#fff 0 50%,#d8dbe0 0 75%,#fff 0) 0 0/8px 8px}.gemboss-ei-swatch[data-empty] .gemboss-ei-swatch-fill{background:linear-gradient(to top right,#0000 46%,var(--ui-text-muted,#686b71) 46% 54%,#0000 54%),#fff}.gemboss-ei-swatch[aria-expanded=true]{border-color:var(--ui-focus,#5661f5);box-shadow:0 0 0 1px var(--ui-focus,#5661f5)}.gemboss-ei-swatch:focus-visible{outline:2px solid var(--ui-focus,#5661f5);outline-offset:2px}.gemboss-ei-cp{display:flex;flex-direction:column;gap:var(--ui-space-3,12px);min-width:0}.gemboss-ei-cp-area{position:relative;height:160px;border-radius:var(--ui-radius-md,8px);background:linear-gradient(to top,#000,#0000),linear-gradient(to right,#fff,var(--cp-hue,red));cursor:crosshair;touch-action:none;outline:none}.gemboss-ei-cp-area:focus-visible{box-shadow:0 0 0 2px var(--ui-surface,#fff),0 0 0 4px var(--ui-focus,#5661f5)}.gemboss-ei-cp-thumb{position:absolute;width:14px;height:14px;box-sizing:border-box;border:2px solid #fff;border-radius:50%;background:var(--cp-now,#fff);box-shadow:0 0 0 1px #0000004d,inset 0 0 0 1px #0000004d;transform:translate(-50%,-50%);pointer-events:none}.gemboss-ei-cp :is(.gemboss-ei-cp-hue,.gemboss-ei-cp-alpha){-webkit-appearance:none;appearance:none;display:block;width:100%;height:12px;margin:0;border-radius:6px;cursor:pointer;outline:none}.gemboss-ei-cp-hue{background:linear-gradient(to right,red,#ff0 17%,#0f0 33%,#0ff,#00f 67%,#f0f 83%,red)}.gemboss-ei-cp-alpha{background:linear-gradient(to right,#0000,var(--cp-now,#000)),conic-gradient(#d8dbe0 25%,#fff 0 50%,#d8dbe0 0 75%,#fff 0) 0 0/8px 8px}.gemboss-ei-cp-alpha:disabled{opacity:.4;cursor:default}.gemboss-ei-cp :is(.gemboss-ei-cp-hue,.gemboss-ei-cp-alpha)::-webkit-slider-thumb{-webkit-appearance:none;width:16px;height:16px;border:2px solid #fff;border-radius:50%;background:transparent;box-shadow:0 0 0 1px #00000059,inset 0 0 0 1px #00000059}.gemboss-ei-cp :is(.gemboss-ei-cp-hue,.gemboss-ei-cp-alpha)::-moz-range-thumb{width:12px;height:12px;border:2px solid #fff;border-radius:50%;background:transparent;box-shadow:0 0 0 1px #00000059}.gemboss-ei-cp :is(.gemboss-ei-cp-hue,.gemboss-ei-cp-alpha):focus-visible{box-shadow:0 0 0 2px var(--ui-surface,#fff),0 0 0 4px var(--ui-focus,#5661f5)}.gemboss-ei-cp-row{display:flex;align-items:center;gap:var(--ui-space-2,8px)}.gemboss-ei-cp-now{flex:none;width:32px;height:32px;box-sizing:border-box;border:1px solid var(--ui-border,#e5e7ea);border-radius:var(--ui-radius-md,8px);background:linear-gradient(var(--cp-now,#fff),var(--cp-now,#fff)),conic-gradient(#d8dbe0 25%,#fff 0 50%,#d8dbe0 0 75%,#fff 0) 0 0/8px 8px}.gemboss-ei-cp-hex{flex:1;min-width:0;font-variant-numeric:tabular-nums;text-transform:uppercase}.gemboss-ei-cp-pct{flex:none;min-width:36px;text-align:right;font-size:var(--ui-fs-caption,12px);color:var(--ui-text-muted,#686b71);font-variant-numeric:tabular-nums}.gemboss-ei-cp-drop{flex:none;display:grid;place-items:center;width:32px;height:32px;padding:0;border:1px solid var(--ui-border,#e5e7ea);border-radius:var(--ui-radius-md,8px);background:var(--ui-surface,#fff);color:var(--ui-text-strong,#1b1c1e);cursor:pointer}.gemboss-ei-cp-drop:hover{background:var(--ui-surface-2,#eceef2)}.gemboss-ei-cp-drop:focus-visible{outline:2px solid var(--ui-focus,#5661f5);outline-offset:1px}.gemboss-ei-cp-group{display:flex;flex-direction:column;gap:6px}.gemboss-ei-cp-label{font-size:var(--ui-fs-caption,12px);line-height:16px;font-weight:550;color:var(--ui-text-muted,#686b71)}.gemboss-ei-cp-chips{display:flex;flex-wrap:wrap;gap:var(--ui-space-2,8px)}.gemboss-ei-cp-none{align-self:flex-start;display:inline-flex;align-items:center;gap:6px;min-height:28px;padding:0 10px 0 6px;border:1px solid var(--ui-border,#e5e7ea);border-radius:var(--ui-radius-md,8px);background:var(--ui-surface,#fff);font:inherit;font-size:var(--ui-fs-caption,12px);font-weight:550;color:var(--ui-text-strong,#1b1c1e);cursor:pointer}.gemboss-ei-cp-none[aria-pressed=true]{border-color:var(--ui-focus,#5661f5);box-shadow:inset 0 0 0 1px var(--ui-focus,#5661f5)}.gemboss-ei-cp-none:focus-visible{outline:2px solid var(--ui-focus,#5661f5);outline-offset:1px}.gemboss-ei-cp-none-sw{width:16px;height:16px;box-sizing:border-box;border:1px solid var(--ui-border,#e5e7ea);border-radius:4px;background:linear-gradient(to top right,#0000 44%,var(--gemboss-danger,#d72c0d) 44% 56%,#0000 56%),#fff}.gemboss-ei-color-box{position:relative;display:flex;flex:1;min-width:0;container-type:inline-size}.gemboss-ei-color-name{position:absolute;inset:1px;display:flex;align-items:center;padding:0 12px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;pointer-events:none;font-size:var(--p-font-size-325,13px);color:var(--ui-text,#1b1c1e)}.gemboss-ei-color-name>span{color:var(--ui-text-muted,#686b71);white-space:pre}@container (max-width:150px){.gemboss-ei-color-name>span{display:none}}.gemboss-ei-color-box>[data-theme-colour]{color:transparent}.gemboss-ei-color>.gemboss-ei-inp[data-alpha]{flex:0 0 64px}@media (pointer:coarse),(max-width:47.9975em){.gemboss-ei-color-name{font-size:16px}@container (max-width:200px){.gemboss-ei-color-name>span{display:none}}.gemboss-ei-color .gemboss-ei-swatch{width:44px;height:44px}.gemboss-ei-color-box{flex-basis:96px}.gemboss-ei-color>.gemboss-ei-inp[data-alpha]{flex-basis:72px}.gemboss-ei-cp :is(.gemboss-ei-cp-hue,.gemboss-ei-cp-alpha){height:44px;border-radius:0;background-clip:content-box;padding:16px 0;box-sizing:border-box}.gemboss-ei-cp-hue{background:linear-gradient(to right,red,#ff0 17%,#0f0 33%,#0ff,#00f 67%,#f0f 83%,red) content-box}.gemboss-ei-cp :is(.gemboss-ei-cp-hue,.gemboss-ei-cp-alpha)::-webkit-slider-thumb{width:24px;height:24px}.gemboss-ei-cp-drop,.gemboss-ei-cp-now{width:44px;height:44px}.gemboss-ei-cp-none{min-height:44px}}
|
|
1
|
+
.gemboss-ei-swatch{display:grid;padding:2px}.gemboss-ei-swatch-fill{display:block;border-radius:6px;background:linear-gradient(var(--sw,#fff),var(--sw,#fff)),conic-gradient(#d8dbe0 25%,#fff 0 50%,#d8dbe0 0 75%,#fff 0) 0 0/8px 8px}.gemboss-ei-swatch[data-empty] .gemboss-ei-swatch-fill{background:linear-gradient(to top right,#0000 46%,var(--ui-text-muted,#686b71) 46% 54%,#0000 54%),#fff}.gemboss-ei-swatch[aria-expanded=true]{border-color:var(--ui-focus,#5661f5);box-shadow:0 0 0 1px var(--ui-focus,#5661f5)}.gemboss-ei-swatch:focus-visible{outline:2px solid var(--ui-focus,#5661f5);outline-offset:2px}.gemboss-ei-cp{display:flex;flex-direction:column;gap:var(--ui-space-3,12px);min-width:0}.gemboss-ei-cp-area{position:relative;height:160px;border-radius:var(--ui-radius-md,8px);background:linear-gradient(to top,#000,#0000),linear-gradient(to right,#fff,var(--cp-hue,red));cursor:crosshair;touch-action:none;outline:none}.gemboss-ei-cp-area:focus-visible{box-shadow:0 0 0 2px var(--ui-surface,#fff),0 0 0 4px var(--ui-focus,#5661f5)}.gemboss-ei-cp-thumb{position:absolute;width:14px;height:14px;box-sizing:border-box;border:2px solid #fff;border-radius:50%;background:var(--cp-now,#fff);box-shadow:0 0 0 1px #0000004d,inset 0 0 0 1px #0000004d;transform:translate(-50%,-50%);pointer-events:none}.gemboss-ei-cp :is(.gemboss-ei-cp-hue,.gemboss-ei-cp-alpha){-webkit-appearance:none;appearance:none;display:block;width:100%;height:12px;margin:0;border-radius:6px;cursor:pointer;outline:none}.gemboss-ei-cp-hue{background:linear-gradient(to right,red,#ff0 17%,#0f0 33%,#0ff,#00f 67%,#f0f 83%,red)}.gemboss-ei-cp-alpha{background:linear-gradient(to right,#0000,var(--cp-now,#000)),conic-gradient(#d8dbe0 25%,#fff 0 50%,#d8dbe0 0 75%,#fff 0) 0 0/8px 8px}.gemboss-ei-cp-alpha:disabled{opacity:.4;cursor:default}.gemboss-ei-cp :is(.gemboss-ei-cp-hue,.gemboss-ei-cp-alpha)::-webkit-slider-thumb{-webkit-appearance:none;width:16px;height:16px;border:2px solid #fff;border-radius:50%;background:transparent;box-shadow:0 0 0 1px #00000059,inset 0 0 0 1px #00000059}.gemboss-ei-cp :is(.gemboss-ei-cp-hue,.gemboss-ei-cp-alpha)::-moz-range-thumb{width:12px;height:12px;border:2px solid #fff;border-radius:50%;background:transparent;box-shadow:0 0 0 1px #00000059}.gemboss-ei-cp :is(.gemboss-ei-cp-hue,.gemboss-ei-cp-alpha):focus-visible{box-shadow:0 0 0 2px var(--ui-surface,#fff),0 0 0 4px var(--ui-focus,#5661f5)}.gemboss-ei-cp-row{display:flex;align-items:center;gap:var(--ui-space-2,8px)}.gemboss-ei-cp-now{flex:none;width:32px;height:32px;box-sizing:border-box;border:1px solid var(--ui-border,#e5e7ea);border-radius:var(--ui-radius-md,8px);background:linear-gradient(var(--cp-now,#fff),var(--cp-now,#fff)),conic-gradient(#d8dbe0 25%,#fff 0 50%,#d8dbe0 0 75%,#fff 0) 0 0/8px 8px}.gemboss-ei-cp-hex{flex:1;min-width:0;font-variant-numeric:tabular-nums;text-transform:uppercase}.gemboss-ei-cp-pct{flex:none;min-width:36px;text-align:right;font-size:var(--ui-fs-caption,12px);color:var(--ui-text-muted,#686b71);font-variant-numeric:tabular-nums}.gemboss-ei-cp-drop{flex:none;display:grid;place-items:center;width:32px;height:32px;padding:0;border:1px solid var(--ui-border,#e5e7ea);border-radius:var(--ui-radius-md,8px);background:var(--ui-surface,#fff);color:var(--ui-text-strong,#1b1c1e);cursor:pointer}.gemboss-ei-cp-drop:hover{background:var(--ui-surface-2,#eceef2)}.gemboss-ei-cp-drop:focus-visible{outline:2px solid var(--ui-focus,#5661f5);outline-offset:1px}.gemboss-ei-cp-group{display:flex;flex-direction:column;gap:6px}.gemboss-ei-cp-label{font-size:var(--ui-fs-caption,12px);line-height:16px;font-weight:550;color:var(--ui-text-muted,#686b71)}.gemboss-ei-cp-chips{display:flex;flex-wrap:wrap;gap:var(--ui-space-2,8px)}.gemboss-ei-cp-none{align-self:flex-start;display:inline-flex;align-items:center;gap:6px;min-height:28px;padding:0 10px 0 6px;border:1px solid var(--ui-border,#e5e7ea);border-radius:var(--ui-radius-md,8px);background:var(--ui-surface,#fff);font:inherit;font-size:var(--ui-fs-caption,12px);font-weight:550;color:var(--ui-text-strong,#1b1c1e);cursor:pointer}.gemboss-ei-cp-none[aria-pressed=true]{border-color:var(--ui-focus,#5661f5);box-shadow:inset 0 0 0 1px var(--ui-focus,#5661f5)}.gemboss-ei-cp-none:focus-visible{outline:2px solid var(--ui-focus,#5661f5);outline-offset:1px}.gemboss-ei-cp-none-sw{width:16px;height:16px;box-sizing:border-box;border:1px solid var(--ui-border,#e5e7ea);border-radius:4px;background:linear-gradient(to top right,#0000 44%,var(--gemboss-danger,#d72c0d) 44% 56%,#0000 56%),#fff}.gemboss-ei-color-box{position:relative;display:flex;flex:1;min-width:0;container-type:inline-size}.gemboss-ei-color-name{position:absolute;inset:1px;display:flex;align-items:center;padding:0 12px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;pointer-events:none;font-size:var(--p-font-size-325,13px);color:var(--ui-text,#1b1c1e)}.gemboss-ei-color-name>span:not(.gemboss-ei-color-name__text){flex:none;color:var(--ui-text-muted,#686b71);white-space:pre}.gemboss-ei-color-name__text{min-width:0;overflow:hidden;text-overflow:ellipsis}@container (max-width:150px){.gemboss-ei-color-name>span:not(.gemboss-ei-color-name__text){display:none}}.gemboss-ei-color-box>[data-theme-colour]{color:transparent}.gemboss-ei-color>.gemboss-ei-inp[data-alpha]{flex:0 0 64px}@media (pointer:coarse),(max-width:47.9975em){.gemboss-ei-color-name{font-size:16px}@container (max-width:200px){.gemboss-ei-color-name>span:not(.gemboss-ei-color-name__text){display:none}}.gemboss-ei-color .gemboss-ei-swatch{width:44px;height:44px}.gemboss-ei-color-box{flex-basis:96px}.gemboss-ei-color>.gemboss-ei-inp[data-alpha]{flex-basis:72px}.gemboss-ei-cp :is(.gemboss-ei-cp-hue,.gemboss-ei-cp-alpha){height:44px;border-radius:0;background-clip:content-box;padding:16px 0;box-sizing:border-box}.gemboss-ei-cp-hue{background:linear-gradient(to right,red,#ff0 17%,#0f0 33%,#0ff,#00f 67%,#f0f 83%,red) content-box}.gemboss-ei-cp :is(.gemboss-ei-cp-hue,.gemboss-ei-cp-alpha)::-webkit-slider-thumb{width:24px;height:24px}.gemboss-ei-cp-drop,.gemboss-ei-cp-now{width:44px;height:44px}.gemboss-ei-cp-none{min-height:44px}}
|
package/src/editor-picker.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.gemboss-ei-pick{display:flex;flex-direction:column;gap:var(--ui-space-3,12px);min-width:0}.gemboss-ei-pick-search{flex:none}.gemboss-ei-pick-search-icon{flex:none;color:var(--ui-text-muted,#686b71)}.gemboss-ei-pick-clear{flex:none;display:grid;place-items:center;width:24px;height:24px;margin-right:var(--ui-space-1,4px);padding:0;border:0;border-radius:var(--ui-radius-sm,6px);background:none;color:var(--ui-text-muted,#686b71);cursor:pointer}.gemboss-ei-pick-clear:hover{background:var(--ui-surface-2,#eceef2);color:var(--ui-text-strong,#1b1c1e)}.gemboss-ei-pick-clear:focus-visible{outline:2px solid var(--ui-focus,#5661f5);outline-offset:0}.gemboss-ei-pick-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;max-height:min(50vh,420px);overflow-y:auto;outline:none}.gemboss-ei-pick-row{flex:none;display:flex;align-items:center;gap:var(--ui-space-3,12px);min-height:44px;padding:var(--ui-space-2,8px);border-radius:var(--ui-radius-md,8px);cursor:pointer;color:inherit}.gemboss-ei-pick-row:hover:not([aria-disabled=true]),.gemboss-ei-pick:focus-within .gemboss-ei-pick-row.is-active:not([aria-disabled=true]){background:var(--ui-surface-2,#eceef2)}.gemboss-ei-pick-row[aria-selected=true]{background:var(--gemboss-accent-soft,#eef0fe)}.gemboss-ei-pick-row[aria-selected=true]:hover:not([aria-disabled=true]),.gemboss-ei-pick:focus-within .gemboss-ei-pick-row[aria-selected=true].is-active:not([aria-disabled=true]){background:color-mix(in srgb,var(--ui-focus,#5661f5) 6%,var(--gemboss-accent-soft,#eef0fe))}.gemboss-ei-pick-list:focus-visible>.gemboss-ei-pick-row.is-active{outline:2px solid var(--ui-focus,#5661f5);outline-offset:-2px}.gemboss-ei-pick-row[aria-disabled=true]{cursor:default}.gemboss-ei-pick-list:not(.is-reloading) .gemboss-ei-pick-row[aria-disabled=true]:not(.is-stale) :is(.gemboss-ei-pick-title,.gemboss-ei-pick-media){opacity:.55}.gemboss-ei-pick-list.is-reloading,.gemboss-ei-pick-row.is-stale{opacity:.55}.gemboss-ei-pick-media{flex:none;display:grid;place-items:center;width:40px;height:40px;box-sizing:border-box;border:1px solid var(--ui-border,#e5e7ea);border-radius:var(--ui-radius-md,8px);background:var(--ui-surface-2,#eceef2);object-fit:cover;color:var(--ui-text-muted,#686b71)}.gemboss-ei-pick-text{flex:1 1 auto;min-width:0;display:flex;flex-direction:column}.gemboss-ei-pick-head{display:flex;align-items:center;gap:var(--ui-space-2,8px);min-width:0}.gemboss-ei-pick-title{flex:0 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:var(--ui-fs-body,13px);line-height:20px;font-weight:650;color:var(--ui-text-strong,#1b1c1e)}.gemboss-ei-pick-head>.ui-tag{flex:none}.gemboss-ei-pick-sub{display:flex;min-width:0;font-size:var(--ui-fs-body,13px);line-height:20px;color:var(--ui-text-muted,#686b71);white-space:nowrap}.gemboss-ei-pick-note{flex:0 0 auto;max-width:100%;
|
|
1
|
+
.gemboss-ei-pick{display:flex;flex-direction:column;gap:var(--ui-space-3,12px);min-width:0}.gemboss-ei-pick-search{flex:none}.gemboss-ei-pick-search-icon{flex:none;color:var(--ui-text-muted,#686b71)}.gemboss-ei-pick-clear{flex:none;display:grid;place-items:center;width:24px;height:24px;margin-right:var(--ui-space-1,4px);padding:0;border:0;border-radius:var(--ui-radius-sm,6px);background:none;color:var(--ui-text-muted,#686b71);cursor:pointer}.gemboss-ei-pick-clear:hover{background:var(--ui-surface-2,#eceef2);color:var(--ui-text-strong,#1b1c1e)}.gemboss-ei-pick-clear:focus-visible{outline:2px solid var(--ui-focus,#5661f5);outline-offset:0}.gemboss-ei-pick-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;max-height:min(50vh,420px);overflow-y:auto;outline:none}.gemboss-ei-pick-row{flex:none;display:flex;align-items:center;gap:var(--ui-space-3,12px);min-height:44px;padding:var(--ui-space-2,8px);border-radius:var(--ui-radius-md,8px);cursor:pointer;color:inherit}.gemboss-ei-pick-row:hover:not([aria-disabled=true]),.gemboss-ei-pick:focus-within .gemboss-ei-pick-row.is-active:not([aria-disabled=true]){background:var(--ui-surface-2,#eceef2)}.gemboss-ei-pick-row[aria-selected=true]{background:var(--gemboss-accent-soft,#eef0fe)}.gemboss-ei-pick-row[aria-selected=true]:hover:not([aria-disabled=true]),.gemboss-ei-pick:focus-within .gemboss-ei-pick-row[aria-selected=true].is-active:not([aria-disabled=true]){background:color-mix(in srgb,var(--ui-focus,#5661f5) 6%,var(--gemboss-accent-soft,#eef0fe))}.gemboss-ei-pick-list:focus-visible>.gemboss-ei-pick-row.is-active{outline:2px solid var(--ui-focus,#5661f5);outline-offset:-2px}.gemboss-ei-pick-row[aria-disabled=true]{cursor:default}.gemboss-ei-pick-list:not(.is-reloading) .gemboss-ei-pick-row[aria-disabled=true]:not(.is-stale) :is(.gemboss-ei-pick-title,.gemboss-ei-pick-media){opacity:.55}.gemboss-ei-pick-list.is-reloading,.gemboss-ei-pick-row.is-stale{opacity:.55}.gemboss-ei-pick-media{flex:none;display:grid;place-items:center;width:40px;height:40px;box-sizing:border-box;border:1px solid var(--ui-border,#e5e7ea);border-radius:var(--ui-radius-md,8px);background:var(--ui-surface-2,#eceef2);object-fit:cover;color:var(--ui-text-muted,#686b71)}.gemboss-ei-pick-text{flex:1 1 auto;min-width:0;display:flex;flex-direction:column}.gemboss-ei-pick-head{display:flex;align-items:center;gap:var(--ui-space-2,8px);min-width:0}.gemboss-ei-pick-title{flex:0 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:var(--ui-fs-body,13px);line-height:20px;font-weight:650;color:var(--ui-text-strong,#1b1c1e)}.gemboss-ei-pick-head>.ui-tag{flex:none}.gemboss-ei-pick-sub{display:flex;min-width:0;font-size:var(--ui-fs-body,13px);line-height:20px;color:var(--ui-text-muted,#686b71);white-space:nowrap}.gemboss-ei-pick-note{flex:0 0 auto;max-width:100%;white-space:normal;overflow-wrap:anywhere}.gemboss-ei-pick-note.is-blocked{color:var(--gemboss-danger-strong,var(--gemboss-danger,#c4291c))}.gemboss-ei-pick-rest{flex:1 1 0;min-width:0;overflow:hidden;text-overflow:ellipsis}.gemboss-ei-pick-note+.gemboss-ei-pick-rest{margin-left:.25em}.gemboss-ei-pick-check{flex:none;color:var(--ui-focus,#5661f5)}.gemboss-ei-pick-drill{flex:none;color:var(--ui-text-muted,#686b71)}.gemboss-ei-pick-error{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:var(--ui-space-3,12px)}.gemboss-ei-pick-more>.ui-btn{width:100%}.gemboss-ei-pick-skeleton{display:flex;flex-direction:column}.gemboss-ei-pick-skeleton-row{display:flex;align-items:center;gap:var(--ui-space-3,12px);padding:var(--ui-space-2,8px)}.gemboss-ei-pick-skeleton-row>.gemboss-ei-pick-media{height:40px;border:0}.gemboss-ei-pick-skeleton-text{flex:1;display:flex;flex-direction:column;gap:var(--ui-space-2,8px)}.gemboss-ei-pick-skeleton-text>:first-child{width:40%}.gemboss-ei-pick-skeleton-text>:last-child{width:70%}@media (pointer:coarse),(max-width:47.9975em){.gemboss-ei-pick-clear{width:44px;height:44px;margin-right:0}}
|
package/src/editor-plain.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(k){"use strict";var g=k.gembossUI;if(!g){k.console&&k.console.error("@gemboss/ui editor-plain.js: load kit-plain.js first (it defines gembossUI)");return}if(g.initEditorFrame)return;var C=5,D=360,w=typeof WeakSet=="function"?new WeakSet:null,u=function(t,e,r){t.dispatchEvent(new CustomEvent(e,{bubbles:!0,detail:r}))},M=function(t,e){var r=Number(t);return isFinite(r)&&r>0?r:e};function d(t){return t.querySelector(".gemboss-editor-body")}function b(t){var e=d(t);return e&&e.querySelector(":scope > .gemboss-editor-resizer")}function h(t){var e=b(t);return{min:M(e&&e.getAttribute("aria-valuemin"),300),cap:M(e&&(e.getAttribute("data-gb-max")||e.getAttribute("aria-valuemax")),680)}}function N(t){var e=h(t),r=d(t),i=r?r.getBoundingClientRect().width:0;return i>0?Math.max(e.min,Math.min(e.cap,i-D-C)):e.cap}var S=typeof WeakMap=="function"?new WeakMap:null;function P(t){var e=S?S.get(t):t._gbWant;return e??E(t)}function O(t,e){S?S.set(t,e):t._gbWant=e}function v(t,e,r,i){var a=d(t),n=b(t);if(a){var s=i??N(t),l=h(t),o=Math.round(Math.min(s,Math.max(l.min,e)));if(a.style.setProperty("--gemboss-chat-w",o+"px"),n&&(n.setAttribute("aria-valuenow",String(o)),n.setAttribute("aria-valuemax",String(s))),r){O(t,o);var f=a.getAttribute("data-gb-storage");if(f)try{localStorage.setItem(f,String(o))}catch{}u(t,"gemboss:editor-split",{width:o})}return o}}function E(t){var e=b(t);return M(e&&e.getAttribute("aria-valuenow"),384)}function K(t){var e=d(t),r=b(t);if(!(!e||!r)){r.hasAttribute("data-gb-max")||r.setAttribute("data-gb-max",r.getAttribute("aria-valuemax")||"680");var i=e.getAttribute("data-gb-storage"),a=E(t);if(i)try{var n=Number(localStorage.getItem(i));n>=h(t).min&&n<=h(t).cap&&(a=n)}catch{}O(t,a),e.classList.contains("is-chat-collapsed")||v(t,a,!1)}}function j(t,e){var r=d(t);if(r&&!(e.button!==0||e.isPrimary===!1)){e.preventDefault();var i=r.getBoundingClientRect().left,a=N(t),n=0,s=E(t);document.body.classList.add("ui-resizing");var l=function(f){s=f.clientX-i-C,n||(n=requestAnimationFrame(function(){n=0,v(t,s,!1,a)}))},o=function(){n&&cancelAnimationFrame(n),document.body.classList.remove("ui-resizing"),removeEventListener("pointermove",l),removeEventListener("pointerup",o),removeEventListener("pointercancel",o),removeEventListener("blur",o),v(t,s,!0,a)};addEventListener("pointermove",l),addEventListener("pointerup",o),addEventListener("pointercancel",o),addEventListener("blur",o)}}function H(t,e){if(!(e.altKey||e.metaKey||e.ctrlKey)){var r=e.shiftKey?64:16,i=E(t),a=h(t);if(e.key==="ArrowLeft")i-=r;else if(e.key==="ArrowRight")i+=r;else if(e.key==="Home")i=a.min;else if(e.key==="End")i=N(t);else return;e.preventDefault(),v(t,i,!0)}}function G(t,e){var r=d(t);if(r){var i=!r.classList.contains("is-chat-collapsed");r.classList.toggle("is-chat-collapsed",i),i?r.style.setProperty("--gemboss-chat-w","0px"):v(t,P(t),!1),e.classList.toggle("collapsed",i),e.setAttribute("aria-pressed",String(i)),e.setAttribute("aria-label",i?"Show chat panel":"Hide chat panel"),e.title=i?"Show chat panel":"Hide chat \u2014 full-width preview";var a=e.querySelector("rect[fill='currentColor']");a&&(a.style.display=i?"none":""),u(t,"gemboss:editor-chat",{collapsed:i})}}function V(t,e){var r=e.closest(".gemboss-pv-devices");r&&(r.querySelectorAll(".gemboss-pv-device").forEach(function(i){var a=i===e;i.classList.toggle("active",a),i.setAttribute("aria-pressed",String(a))}),u(t,"gemboss:editor-device",{device:e.getAttribute("data-device")||(e.title||"").toLowerCase()}))}function X(t,e){var r=e.getAttribute("data-pane")||(Array.prototype.indexOf.call(e.parentNode.children,e)===0?"chat":"preview"),i=d(t);i&&(i.setAttribute("data-mobile-pane",r),e.parentNode.querySelectorAll(".gemboss-editor-mobile-tab").forEach(function(a){var n=a===e;a.classList.toggle("active",n),a.setAttribute("aria-selected",String(n))}),u(t,"gemboss:editor-pane",{pane:r}))}var c=null;function I(t){var e=t.trigger.getBoundingClientRect();t.menu.style.top=e.bottom+6+"px",t.menu.style.right=Math.max(8,innerWidth-e.right)+"px";var r=t.menu.getBoundingClientRect(),i=e.right-r.right;r.left+i<8&&(i=8-r.left),Math.abs(i)>=.5&&(t.menu.style.right=parseFloat(t.menu.style.right)-i+"px")}function y(t){var e=c;e&&(c=null,e.menu.hidden=!0,e.trigger.setAttribute("aria-expanded","false"),e.trigger.classList.remove("active"),t&&e.trigger.focus(),u(e.root,"gemboss:editor-menu",{open:!1,menu:e.menu}))}function J(t,e){var r=e.nextElementSibling;if(!r||!r.classList.contains("gemboss-editor-menu"))return!1;var i=c&&c.trigger===e;return y(!1),i||(c={root:t,trigger:e,menu:r},r.hidden=!1,e.setAttribute("aria-expanded","true"),e.classList.add("active"),I(c),u(t,"gemboss:editor-menu",{open:!0,menu:r})),!0}var B=!1;function Q(){B||(B=!0,document.addEventListener("pointerdown",function(t){c&&!c.menu.contains(t.target)&&!c.trigger.contains(t.target)&&y(!1)}),addEventListener("keydown",function(t){t.key!=="Escape"||!c||t.isComposing||t.keyCode===229||(t.preventDefault(),t.stopImmediatePropagation(),y(!0))},!0),addEventListener("resize",function(){c&&I(c)}),addEventListener("blur",function(){y(!1)}))}function Y(t){var e=t&&t.classList&&t.classList.contains("gemboss-editor")?[t]:Array.prototype.slice.call((t||document).querySelectorAll(".gemboss-editor"));return Q(),e.forEach(function(r){if(!(w?w.has(r):r._gbEditor)){w?w.add(r):r._gbEditor=!0,K(r);var i=d(r);i&&typeof ResizeObserver=="function"&&new ResizeObserver(function(){i.classList.contains("is-chat-collapsed")||v(r,P(r),!1)}).observe(i),r.addEventListener("pointerdown",function(a){var n=a.target.closest(".gemboss-editor-resizer");n&&n===b(r)&&j(r,a)}),r.addEventListener("keydown",function(a){a.target.classList&&a.target.classList.contains("gemboss-editor-resizer")&&a.target===b(r)&&H(r,a)}),r.addEventListener("click",function(a){var n=a.target,s;if(s=n.closest(".gemboss-editor-chat-toggle"))return G(r,s);if(s=n.closest(".gemboss-pv-devices .gemboss-pv-device"))return V(r,s);if(s=n.closest(".gemboss-editor-mobile-tab"))return X(r,s);if((s=n.closest('[aria-haspopup="menu"]'))&&J(r,s)){a.stopPropagation();return}c&&(s=n.closest(".gemboss-editor-menu-item"))&&c.menu.contains(s)&&y(!0)})}}),e.length}g.initEditorFrame=Y;function m(t){if(!t||t!==t.trim())return null;var e=/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.exec(t),r,i,a,n;if(e){var s=e[1].length<=4?e[1].replace(/./g,"$&$&"):e[1];return n=function(ce){return parseInt(s.substr(ce,2),16)},{r:n(0),g:n(2),b:n(4),a:s.length===8?Math.round(n(6)/255*1e3)/1e3:1}}if(r=/^rgba?\(\s*([^()]*?)\s*\)$/i.exec(t),!r)return null;var l=r[1].split("/");if(i=l[0].indexOf(",")>=0?l[0].split(","):l[0].trim().split(/\s+/),l.length===2&&i.push(l[1]),l.length>2||i.length<3||i.length>4)return null;var o=[];for(a=0;a<i.length;a++){var f=i[a].trim(),p=/^[+-]?(\d+\.?\d*|\.\d+)(e[+-]?\d+)?%?$/i.test(f)?parseFloat(f):f==="none"?0:NaN;if(isNaN(p))return null;/%$/.test(f)&&(p=p/100*(a<3?255:1)),o.push(a<3?Math.min(255,Math.max(0,Math.round(p))):Math.min(1,Math.max(0,p)))}return{r:o[0],g:o[1],b:o[2],a:o.length===4?o[3]:1}}function q(t){return"#"+[t.r,t.g,t.b].map(function(e){return(e<16?"0":"")+e.toString(16)}).join("")}function T(t,e,r){return r<1?"rgba("+e.r+", "+e.g+", "+e.b+", "+Math.round(r*100)/100+")":/^#/.test(t)||!t?q(e):"rgb("+e.r+", "+e.g+", "+e.b+")"}function W(t,e){var r=m(e),i=m(t);return r?T(t,r,i?i.a:1):t}function _(t,e){var r=m(t);return r&&isFinite(e)?T(t,r,Math.min(100,Math.max(0,Math.round(e)))/100):t}g.colorOf=m,g.pickSwatch=W,g.withOpacity=_;var F=function(t){var e=t.getAttribute("data-value");return e??(t.textContent||"").trim()},R=function(t){return Array.prototype.filter.call(t.children,function(e){return e.getAttribute("role")==="tab"})};function z(t,e){var r=t.parentNode,i=R(r),a=i.some(function(n){return n.hasAttribute("tabindex")});i.forEach(function(n){var s=n===t;n.setAttribute("aria-selected",String(s)),n.classList.contains("gemboss-ei-tab")&&n.classList.toggle("on",s),a&&n.setAttribute("tabindex",s?"0":"-1");var l=n.getAttribute("aria-controls"),o=l&&document.getElementById(l);o&&(o.hidden=!s)}),e&&t.focus(),u(t,"gemboss:editor-tab",{tab:F(t),index:i.indexOf(t)})}function Z(t,e){if(!(e.key!=="ArrowRight"&&e.key!=="ArrowLeft")){var r=R(t);if(r.some(function(n){return n.hasAttribute("tabindex")})){var i=r.findIndex(function(n){return n.getAttribute("aria-selected")==="true"}),a=e.key==="ArrowRight"?(i+1)%r.length:(i-1+r.length)%r.length;e.preventDefault(),z(r[a],!0)}}}function ee(t){var e=t.getAttribute("data-open")!=="open";t.setAttribute("data-open",e?"open":"closed"),t.setAttribute("aria-expanded",String(e));var r=t.querySelector(".gemboss-ei-chev");r&&(r.textContent=e?"\u25BE":"\u25B8"),u(t,"gemboss:editor-group",{open:e})}function te(t){var e=t.closest(".gemboss-ei-seg");Array.prototype.forEach.call(e.querySelectorAll("button"),function(r){var i=r===t;r.classList.toggle("active",i),r.classList.toggle("on",i),r.hasAttribute("aria-pressed")&&r.setAttribute("aria-pressed",String(i))}),u(e,"gemboss:editor-seg",{value:F(t)})}var re={text:"Text",accent:"Accent","accent-text":"Accent text",muted:"Muted",background:"Background",surface:"Surface",border:"Border",success:"Success",warning:"Warning",danger:"Danger"},ie=0;function ae(t){var e=t.trim(),r=/^var\(\s*--gem-color-([a-z-]+)\s*\)$/i.exec(e);if(r){var i=r[1].toLowerCase();return"Theme color: "+(re[i]||i.charAt(0).toUpperCase()+i.slice(1).replace(/-/g," "))+". Type a color to use your own."}return/^var\(/i.test(e)?"A theme value. Type a color to use your own.":"Kept as written: the swatch shows one color (hex, rgb, hsl or oklch), not a gradient or a name."}function A(t){var e=t.querySelector(".gemboss-ei-swatch"),r=t.querySelector("input:not([type=color]):not([data-alpha])");if(!(!e||!r)){var i=r.value,a=m(i),n=!i||!!a;if(e.tagName==="BUTTON"){var s=e.querySelector(".gemboss-ei-swatch-fill");s&&(a?s.style.setProperty("--sw","rgba("+a.r+", "+a.g+", "+a.b+", "+a.a+")"):s.style.removeProperty("--sw")),i?e.removeAttribute("data-empty"):e.setAttribute("data-empty","")}else e.value=a?q(a):"#000000";var l=t.querySelector("input[data-alpha]");a&&!l&&(l=document.createElement("input"),l.className="gemboss-field gemboss-ei-inp",l.setAttribute("data-alpha",""),l.setAttribute("inputmode","numeric"),l.setAttribute("aria-label",(e.getAttribute("aria-label")||"Color swatch").replace(/ swatch$/,"")+" opacity"),r.parentNode.insertBefore(l,r.nextSibling)),l&&(l.hidden=!a,a&&(l.value=Math.round(a.a*100)+"%"),l.disabled=r.disabled),e.disabled=r.disabled||!n;var o=t.querySelector(".gemboss-ei-color-why");if(n){e.removeAttribute("title"),e.removeAttribute("aria-describedby"),o&&o.parentNode.removeChild(o);return}var f=ae(i);e.title=f,o||(o=document.createElement("p"),o.className="gemboss-ei-color-why",t.appendChild(o)),o.id||(o.id="gemboss-ei-color-why-"+ ++ie),o.textContent=f,e.setAttribute("aria-describedby",o.id)}}function ne(t){for(var e=t.labels||[],r=null,i=0;i<e.length&&!r;i++)r=e[i].querySelector(".gemboss-ei-rangeval");r&&(r.textContent=t.value+(r.getAttribute("data-suffix")||""))}function se(t){var e={},r=["t","r","b","l"];return Array.prototype.forEach.call(t.querySelectorAll("input"),function(i,a){e[r[a]]=i.value.trim()}),e}function U(t){return'url("'+t.replace(/["\\]/g,"\\$&").replace(/[\u0000-\u001f\u007f]/g,function(e){return"\\"+e.charCodeAt(0).toString(16)+" "})+'")'}g.cssUrl=U;function oe(t,e){var r=t.querySelector(".gemboss-ei-img-thumb");r&&(r.style.backgroundImage=e?U(e):"",r.textContent=e?"":"\u2014")}function $(t,e){var r=t.getAttribute("data-gb-value")!=null?t.getAttribute("data-gb-value"):e.defaultValue;e.value!==r&&(t.setAttribute("data-gb-value",e.value),oe(t,e.value),u(t,"gemboss:editor-image",{value:e.value}))}var L=typeof WeakSet=="function"?new WeakSet:null,x=function(t){return t.__gbPanel?!1:(t.__gbPanel=!0,!0)};function le(t){var e=t.closest(".gemboss-ei-color");if(e){var r=e.querySelector("input:not([type=color]):not([data-alpha])"),i=e.querySelector("input[data-gb-swatch-native]");i||(i=document.createElement("input"),i.type="color",i.setAttribute("data-gb-swatch-native",""),i.tabIndex=-1,i.setAttribute("aria-hidden","true"),i.style.cssText="position:absolute;width:1px;height:1px;opacity:0;pointer-events:none",t.parentNode.insertBefore(i,t.nextSibling));var a=r&&m(r.value);i.value=a?q(a):"#ffffff";try{i.showPicker?i.showPicker():i.click()}catch{i.click()}}}function ue(t){var e=t||document;return(L?L.has(e):e._gbPanel)?0:(L?L.add(e):e._gbPanel=!0,Array.prototype.forEach.call(e.querySelectorAll(".gemboss-ei-color"),A),e.addEventListener("click",function(r){var i=r.target,a;if(!(!i.closest||!x(r))){if(a=i.closest('.gemboss-ec-tabs > [role="tab"], .gemboss-ei-tabs > [role="tab"]'))return z(a,!1);if(a=i.closest(".gemboss-ei-gh"))return ee(a);if((a=i.closest(".gemboss-ei-seg button"))&&!a.disabled)return te(a);if((a=i.closest("button.gemboss-ei-swatch"))&&!a.disabled)return le(a);if((a=i.closest("[data-gb-image-clear]"))&&!a.disabled){var n=a.closest(".gemboss-ei-img"),s=n&&n.querySelector(".gemboss-ei-img-ctl input");s&&(s.value="",$(n,s))}}}),e.addEventListener("keydown",function(r){var i=r.target;if(!(!i.closest||!x(r))){var a=i.closest('.gemboss-ec-tabs[role="tablist"], .gemboss-ei-tabs[role="tablist"]');if(a&&i.getAttribute("role")==="tab")return Z(a,r);r.key==="Enter"&&i.tagName==="INPUT"&&i.type!=="color"&&i.type!=="range"&&i.closest(".gemboss-ei-color, .gemboss-ei-edgebox, .gemboss-ei-img")&&(r.preventDefault(),i.blur())}}),e.addEventListener("input",function(r){var i=r.target;if(!(!i.closest||!x(r))){if(i.classList.contains("gemboss-ei-range")){ne(i),u(i,"gemboss:editor-range",{value:Number(i.value)});return}if(i.classList.contains("gemboss-ei-swatch")||i.hasAttribute("data-gb-swatch-native")){var a=i.closest(".gemboss-ei-color"),n=a&&a.querySelector("input:not([type=color]):not([data-alpha])"),s=n?W(n.value,i.value):i.value;n&&(n.value=s),a&&i.hasAttribute("data-gb-swatch-native")&&A(a),u(a||i,"gemboss:editor-color",{value:s})}}}),e.addEventListener("focusout",function(r){var i=r.target;if(!(!i.closest||i.tagName!=="INPUT"||!x(r))){var a;if(i.hasAttribute("data-alpha")&&(a=i.closest(".gemboss-ei-color"))){var n=a.querySelector("input:not([type=color]):not([data-alpha])"),s=Number(String(i.value).replace(/%/g,"").trim()),l=n&&String(i.value).trim()&&isFinite(s)?_(n.value,s):null;l&&l!==n.value?(n.value=l,A(a),u(a,"gemboss:editor-color",{value:l})):A(a);return}if(i.type!=="color"&&(a=i.closest(".gemboss-ei-color"))){A(a),u(a,"gemboss:editor-color",{value:i.value});return}if(a=i.closest(".gemboss-ei-edgebox")){u(a,"gemboss:editor-edges",se(a));return}(a=i.closest(".gemboss-ei-img"))&&$(a,i)}}),1)}g.initEditorPanel=ue})(typeof globalThis<"u"?globalThis:this);
|
|
1
|
+
(function(k){"use strict";var g=k.gembossUI;if(!g){k.console&&k.console.error("@gemboss/ui editor-plain.js: load kit-plain.js first (it defines gembossUI)");return}if(g.initEditorFrame)return;var C=5,j=360,w=typeof WeakSet=="function"?new WeakSet:null,u=function(t,e,r){t.dispatchEvent(new CustomEvent(e,{bubbles:!0,detail:r}))},N=function(t,e){var r=Number(t);return isFinite(r)&&r>0?r:e};function d(t){return t.querySelector(".gemboss-editor-body")}function m(t){var e=d(t);return e&&e.querySelector(":scope > .gemboss-editor-resizer")}function h(t){var e=m(t);return{min:N(e&&e.getAttribute("aria-valuemin"),300),cap:N(e&&(e.getAttribute("data-gb-max")||e.getAttribute("aria-valuemax")),680)}}function M(t){var e=h(t),r=d(t),i=r?r.getBoundingClientRect().width:0;return i>0?Math.max(e.min,Math.min(e.cap,i-j-C)):e.cap}var S=typeof WeakMap=="function"?new WeakMap:null;function P(t){var e=S?S.get(t):t._gbWant;return e??E(t)}function I(t,e){S?S.set(t,e):t._gbWant=e}function v(t,e,r,i){var a=d(t),n=m(t);if(a){var s=i??M(t),l=h(t),o=Math.round(Math.min(s,Math.max(l.min,e)));if(a.style.setProperty("--gemboss-chat-w",o+"px"),n&&(n.setAttribute("aria-valuenow",String(o)),n.setAttribute("aria-valuemax",String(s))),r){I(t,o);var f=a.getAttribute("data-gb-storage");if(f)try{localStorage.setItem(f,String(o))}catch{}u(t,"gemboss:editor-split",{width:o})}return o}}function E(t){var e=m(t);return N(e&&e.getAttribute("aria-valuenow"),384)}function H(t){var e=d(t),r=m(t);if(!(!e||!r)){r.hasAttribute("data-gb-max")||r.setAttribute("data-gb-max",r.getAttribute("aria-valuemax")||"680");var i=e.getAttribute("data-gb-storage"),a=E(t);if(i)try{var n=Number(localStorage.getItem(i));n>=h(t).min&&n<=h(t).cap&&(a=n)}catch{}I(t,a),e.classList.contains("is-chat-collapsed")||v(t,a,!1)}}function G(t,e){var r=d(t);if(r&&!(e.button!==0||e.isPrimary===!1)){e.preventDefault();var i=r.getBoundingClientRect().left,a=M(t),n=0,s=E(t);document.body.classList.add("ui-resizing");var l=function(f){s=f.clientX-i-C,n||(n=requestAnimationFrame(function(){n=0,v(t,s,!1,a)}))},o=function(){n&&cancelAnimationFrame(n),document.body.classList.remove("ui-resizing"),removeEventListener("pointermove",l),removeEventListener("pointerup",o),removeEventListener("pointercancel",o),removeEventListener("blur",o),v(t,s,!0,a)};addEventListener("pointermove",l),addEventListener("pointerup",o),addEventListener("pointercancel",o),addEventListener("blur",o)}}function V(t,e){if(!(e.altKey||e.metaKey||e.ctrlKey)){var r=e.shiftKey?64:16,i=E(t),a=h(t);if(e.key==="ArrowLeft")i-=r;else if(e.key==="ArrowRight")i+=r;else if(e.key==="Home")i=a.min;else if(e.key==="End")i=M(t);else return;e.preventDefault(),v(t,i,!0)}}function X(t,e){var r=d(t);if(r){var i=!r.classList.contains("is-chat-collapsed");r.classList.toggle("is-chat-collapsed",i),i?r.style.setProperty("--gemboss-chat-w","0px"):v(t,P(t),!1),e.classList.toggle("collapsed",i),e.setAttribute("aria-pressed",String(i)),e.setAttribute("aria-label",i?"Show chat panel":"Hide chat panel"),e.title=i?"Show chat panel":"Hide chat \u2014 full-width preview";var a=e.querySelector("rect[fill='currentColor']");a&&(a.style.display=i?"none":""),u(t,"gemboss:editor-chat",{collapsed:i})}}function J(t,e){var r=e.closest(".gemboss-pv-devices");r&&(r.querySelectorAll(".gemboss-pv-device").forEach(function(i){var a=i===e;i.classList.toggle("active",a),i.setAttribute("aria-pressed",String(a))}),u(t,"gemboss:editor-device",{device:e.getAttribute("data-device")||(e.title||"").toLowerCase()}))}function Q(t,e){var r=e.getAttribute("data-pane")||(Array.prototype.indexOf.call(e.parentNode.children,e)===0?"chat":"preview"),i=d(t);i&&(i.setAttribute("data-mobile-pane",r),e.parentNode.querySelectorAll(".gemboss-editor-mobile-tab").forEach(function(a){var n=a===e;a.classList.toggle("active",n),a.setAttribute("aria-selected",String(n))}),u(t,"gemboss:editor-pane",{pane:r}))}var c=null;function O(t){var e=t.trigger.getBoundingClientRect();t.menu.style.top=e.bottom+6+"px",t.menu.style.right=Math.max(8,innerWidth-e.right)+"px";var r=t.menu.getBoundingClientRect(),i=e.right-r.right;r.left+i<8&&(i=8-r.left),Math.abs(i)>=.5&&(t.menu.style.right=parseFloat(t.menu.style.right)-i+"px")}function y(t){var e=c;e&&(c=null,e.menu.hidden=!0,e.trigger.setAttribute("aria-expanded","false"),e.trigger.classList.remove("active"),t&&e.trigger.focus(),u(e.root,"gemboss:editor-menu",{open:!1,menu:e.menu}))}function Y(t,e){var r=e.nextElementSibling;if(!r||!r.classList.contains("gemboss-editor-menu"))return!1;var i=c&&c.trigger===e;return y(!1),i||(c={root:t,trigger:e,menu:r},r.hidden=!1,e.setAttribute("aria-expanded","true"),e.classList.add("active"),O(c),u(t,"gemboss:editor-menu",{open:!0,menu:r})),!0}var T=!1;function Z(){T||(T=!0,document.addEventListener("pointerdown",function(t){c&&!c.menu.contains(t.target)&&!c.trigger.contains(t.target)&&y(!1)}),addEventListener("keydown",function(t){t.key!=="Escape"||!c||t.isComposing||t.keyCode===229||(t.preventDefault(),t.stopImmediatePropagation(),y(!0))},!0),addEventListener("resize",function(){c&&O(c)}),addEventListener("blur",function(){y(!1)}))}function ee(t){var e=t&&t.classList&&t.classList.contains("gemboss-editor")?[t]:Array.prototype.slice.call((t||document).querySelectorAll(".gemboss-editor"));return Z(),e.forEach(function(r){if(!(w?w.has(r):r._gbEditor)){w?w.add(r):r._gbEditor=!0,H(r);var i=d(r);i&&typeof ResizeObserver=="function"&&new ResizeObserver(function(){i.classList.contains("is-chat-collapsed")||v(r,P(r),!1)}).observe(i),r.addEventListener("pointerdown",function(a){var n=a.target.closest(".gemboss-editor-resizer");n&&n===m(r)&&G(r,a)}),r.addEventListener("keydown",function(a){a.target.classList&&a.target.classList.contains("gemboss-editor-resizer")&&a.target===m(r)&&V(r,a)}),r.addEventListener("click",function(a){var n=a.target,s;if(s=n.closest(".gemboss-editor-chat-toggle"))return X(r,s);if(s=n.closest(".gemboss-pv-devices .gemboss-pv-device"))return J(r,s);if(s=n.closest(".gemboss-editor-mobile-tab"))return Q(r,s);if((s=n.closest('[aria-haspopup="menu"]'))&&Y(r,s)){a.stopPropagation();return}c&&(s=n.closest(".gemboss-editor-menu-item"))&&c.menu.contains(s)&&y(!0)})}}),e.length}g.initEditorFrame=ee;function b(t){if(!t||t!==t.trim())return null;var e=/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.exec(t),r,i,a,n;if(e){var s=e[1].length<=4?e[1].replace(/./g,"$&$&"):e[1];return n=function(de){return parseInt(s.substr(de,2),16)},{r:n(0),g:n(2),b:n(4),a:s.length===8?Math.round(n(6)/255*1e3)/1e3:1}}if(r=/^rgba?\(\s*([^()]*?)\s*\)$/i.exec(t),!r)return null;var l=r[1].split("/");if(i=l[0].indexOf(",")>=0?l[0].split(","):l[0].trim().split(/\s+/),l.length===2&&i.push(l[1]),l.length>2||i.length<3||i.length>4)return null;var o=[];for(a=0;a<i.length;a++){var f=i[a].trim(),p=/^[+-]?(\d+\.?\d*|\.\d+)(e[+-]?\d+)?%?$/i.test(f)?parseFloat(f):f==="none"?0:NaN;if(isNaN(p))return null;/%$/.test(f)&&(p=p/100*(a<3?255:1)),o.push(a<3?Math.min(255,Math.max(0,Math.round(p))):Math.min(1,Math.max(0,p)))}return{r:o[0],g:o[1],b:o[2],a:o.length===4?o[3]:1}}function q(t){return"#"+[t.r,t.g,t.b].map(function(e){return(e<16?"0":"")+e.toString(16)}).join("")}function B(t,e,r){return r<1?"rgba("+e.r+", "+e.g+", "+e.b+", "+Math.round(r*100)/100+")":/^#/.test(t)||!t?q(e):"rgb("+e.r+", "+e.g+", "+e.b+")"}function W(t,e){var r=b(e),i=b(t);return r?B(t,r,i?i.a:1):t}function _(t,e){var r=b(t);return r&&isFinite(e)?B(t,r,Math.min(100,Math.max(0,Math.round(e)))/100):t}g.colorOf=b,g.pickSwatch=W,g.withOpacity=_;var $=function(t){var e=t.getAttribute("data-value");return e??(t.textContent||"").trim()},R=function(t){return Array.prototype.filter.call(t.children,function(e){return e.getAttribute("role")==="tab"})};function z(t,e){var r=t.parentNode,i=R(r),a=i.some(function(n){return n.hasAttribute("tabindex")});i.forEach(function(n){var s=n===t;n.setAttribute("aria-selected",String(s)),n.classList.contains("gemboss-ei-tab")&&n.classList.toggle("on",s),a&&n.setAttribute("tabindex",s?"0":"-1");var l=n.getAttribute("aria-controls"),o=l&&document.getElementById(l);o&&(o.hidden=!s)}),e&&t.focus(),u(t,"gemboss:editor-tab",{tab:$(t),index:i.indexOf(t)})}function te(t,e){if(!(e.key!=="ArrowRight"&&e.key!=="ArrowLeft")){var r=R(t);if(r.some(function(n){return n.hasAttribute("tabindex")})){var i=r.findIndex(function(n){return n.getAttribute("aria-selected")==="true"}),a=e.key==="ArrowRight"?(i+1)%r.length:(i-1+r.length)%r.length;e.preventDefault(),z(r[a],!0)}}}function re(t){var e=t.getAttribute("data-open")!=="open";t.setAttribute("data-open",e?"open":"closed"),t.setAttribute("aria-expanded",String(e));var r=t.querySelector(".gemboss-ei-chev");r&&(r.textContent=e?"\u25BE":"\u25B8"),u(t,"gemboss:editor-group",{open:e})}function ie(t){var e=t.closest(".gemboss-ei-seg");Array.prototype.forEach.call(e.querySelectorAll("button"),function(r){var i=r===t;r.classList.toggle("active",i),r.classList.toggle("on",i),r.hasAttribute("aria-pressed")&&r.setAttribute("aria-pressed",String(i))}),u(e,"gemboss:editor-seg",{value:$(t)})}var ae={text:"Text",accent:"Accent","accent-text":"Accent text",muted:"Muted",background:"Background",surface:"Surface",border:"Border",success:"Success",warning:"Warning",danger:"Danger"},ne=0;function F(t){return ae[t]||t.charAt(0).toUpperCase()+t.slice(1).replace(/-/g," ")}function se(t){var e=t.trim(),r=/^var\(\s*--gem-color-([a-z-]+)\s*\)$/i.exec(e);if(r)return"Theme color: "+F(r[1].toLowerCase())+". Type a color to use your own.";if(/^var\(/i.test(e))return"A theme value. Type a color to use your own.";var i=oe(e);return i?"A mix of "+i.replace(" + "," and ")+", half of each. Type a color to use your own.":/^color-mix\(/i.test(e)?"A mix of colors. Type a color to use your own.":"Kept as written: the swatch shows one color (hex, rgb, hsl or oklch), not a gradient or a name."}var D="(var\\([^()]*\\)|[^,()]+(?:\\([^()]*\\))?)";function oe(t){var e=new RegExp("^color-mix\\(\\s*in\\s+srgb\\s*,"+D+","+D+"\\)$","i").exec(t);function r(n){n=n.trim();var s=/^var\(\s*--gem-color-([a-z-]+)\s*\)$/i.exec(n);return s?F(s[1].toLowerCase()):b(n)||/^(hsla?|oklch)\([^()]*\)$/i.test(n)?n:null}var i=e&&r(e[1]),a=e&&r(e[2]);return i&&a?i+" + "+a:null}function A(t){var e=t.querySelector(".gemboss-ei-swatch"),r=t.querySelector("input:not([type=color]):not([data-alpha])");if(!(!e||!r)){var i=r.value,a=b(i),n=!i||!!a;if(e.tagName==="BUTTON"){var s=e.querySelector(".gemboss-ei-swatch-fill");s&&(a?s.style.setProperty("--sw","rgba("+a.r+", "+a.g+", "+a.b+", "+a.a+")"):s.style.removeProperty("--sw")),i?e.removeAttribute("data-empty"):e.setAttribute("data-empty","")}else e.value=a?q(a):"#000000";var l=t.querySelector("input[data-alpha]");a&&!l&&(l=document.createElement("input"),l.className="gemboss-field gemboss-ei-inp",l.setAttribute("data-alpha",""),l.setAttribute("inputmode","numeric"),l.setAttribute("aria-label",(e.getAttribute("aria-label")||"Color swatch").replace(/ swatch$/,"")+" opacity"),r.parentNode.insertBefore(l,r.nextSibling)),l&&(l.hidden=!a,a&&(l.value=Math.round(a.a*100)+"%"),l.disabled=r.disabled),e.disabled=r.disabled||!n;var o=t.querySelector(".gemboss-ei-color-why");if(n){e.removeAttribute("title"),e.removeAttribute("aria-describedby"),o&&o.parentNode.removeChild(o);return}var f=se(i);e.title=f,o||(o=document.createElement("p"),o.className="gemboss-ei-color-why",t.appendChild(o)),o.id||(o.id="gemboss-ei-color-why-"+ ++ne),o.textContent=f,e.setAttribute("aria-describedby",o.id)}}function le(t){for(var e=t.labels||[],r=null,i=0;i<e.length&&!r;i++)r=e[i].querySelector(".gemboss-ei-rangeval");r&&(r.textContent=t.value+(r.getAttribute("data-suffix")||""))}function ue(t){var e={},r=["t","r","b","l"];return Array.prototype.forEach.call(t.querySelectorAll("input"),function(i,a){e[r[a]]=i.value.trim()}),e}function U(t){return'url("'+t.replace(/["\\]/g,"\\$&").replace(/[\u0000-\u001f\u007f]/g,function(e){return"\\"+e.charCodeAt(0).toString(16)+" "})+'")'}g.cssUrl=U;function ce(t,e){var r=t.querySelector(".gemboss-ei-img-thumb");r&&(r.style.backgroundImage=e?U(e):"",r.textContent=e?"":"\u2014")}function K(t,e){var r=t.getAttribute("data-gb-value")!=null?t.getAttribute("data-gb-value"):e.defaultValue;e.value!==r&&(t.setAttribute("data-gb-value",e.value),ce(t,e.value),u(t,"gemboss:editor-image",{value:e.value}))}var L=typeof WeakSet=="function"?new WeakSet:null,x=function(t){return t.__gbPanel?!1:(t.__gbPanel=!0,!0)};function fe(t){var e=t.closest(".gemboss-ei-color");if(e){var r=e.querySelector("input:not([type=color]):not([data-alpha])"),i=e.querySelector("input[data-gb-swatch-native]");i||(i=document.createElement("input"),i.type="color",i.setAttribute("data-gb-swatch-native",""),i.tabIndex=-1,i.setAttribute("aria-hidden","true"),i.style.cssText="position:absolute;width:1px;height:1px;opacity:0;pointer-events:none",t.parentNode.insertBefore(i,t.nextSibling));var a=r&&b(r.value);i.value=a?q(a):"#ffffff";try{i.showPicker?i.showPicker():i.click()}catch{i.click()}}}function ge(t){var e=t||document;return(L?L.has(e):e._gbPanel)?0:(L?L.add(e):e._gbPanel=!0,Array.prototype.forEach.call(e.querySelectorAll(".gemboss-ei-color"),A),e.addEventListener("click",function(r){var i=r.target,a;if(!(!i.closest||!x(r))){if(a=i.closest('.gemboss-ec-tabs > [role="tab"], .gemboss-ei-tabs > [role="tab"]'))return z(a,!1);if(a=i.closest(".gemboss-ei-gh"))return re(a);if((a=i.closest(".gemboss-ei-seg button"))&&!a.disabled)return ie(a);if((a=i.closest("button.gemboss-ei-swatch"))&&!a.disabled)return fe(a);if((a=i.closest("[data-gb-image-clear]"))&&!a.disabled){var n=a.closest(".gemboss-ei-img"),s=n&&n.querySelector(".gemboss-ei-img-ctl input");s&&(s.value="",K(n,s))}}}),e.addEventListener("keydown",function(r){var i=r.target;if(!(!i.closest||!x(r))){var a=i.closest('.gemboss-ec-tabs[role="tablist"], .gemboss-ei-tabs[role="tablist"]');if(a&&i.getAttribute("role")==="tab")return te(a,r);r.key==="Enter"&&i.tagName==="INPUT"&&i.type!=="color"&&i.type!=="range"&&i.closest(".gemboss-ei-color, .gemboss-ei-edgebox, .gemboss-ei-img")&&(r.preventDefault(),i.blur())}}),e.addEventListener("input",function(r){var i=r.target;if(!(!i.closest||!x(r))){if(i.classList.contains("gemboss-ei-range")){le(i),u(i,"gemboss:editor-range",{value:Number(i.value)});return}if(i.classList.contains("gemboss-ei-swatch")||i.hasAttribute("data-gb-swatch-native")){var a=i.closest(".gemboss-ei-color"),n=a&&a.querySelector("input:not([type=color]):not([data-alpha])"),s=n?W(n.value,i.value):i.value;n&&(n.value=s),a&&i.hasAttribute("data-gb-swatch-native")&&A(a),u(a||i,"gemboss:editor-color",{value:s})}}}),e.addEventListener("focusout",function(r){var i=r.target;if(!(!i.closest||i.tagName!=="INPUT"||!x(r))){var a;if(i.hasAttribute("data-alpha")&&(a=i.closest(".gemboss-ei-color"))){var n=a.querySelector("input:not([type=color]):not([data-alpha])"),s=Number(String(i.value).replace(/%/g,"").trim()),l=n&&String(i.value).trim()&&isFinite(s)?_(n.value,s):null;l&&l!==n.value?(n.value=l,A(a),u(a,"gemboss:editor-color",{value:l})):A(a);return}if(i.type!=="color"&&(a=i.closest(".gemboss-ei-color"))){A(a),u(a,"gemboss:editor-color",{value:i.value});return}if(a=i.closest(".gemboss-ei-edgebox")){u(a,"gemboss:editor-edges",ue(a));return}(a=i.closest(".gemboss-ei-img"))&&K(a,i)}}),1)}g.initEditorPanel=ge})(typeof globalThis<"u"?globalThis:this);
|
package/src/editor-popover.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.gemboss-ei-pop[popover]{position:fixed;inset:auto;margin:0;padding:0;overflow:auto;color:inherit}.gemboss-ei-pop[popover]:not(:popover-open){display:none}.gemboss-ei-pop{box-sizing:border-box;display:flex;flex-direction:column;outline:none;z-index:40}.gemboss-ei-pop--inline{position:static;flex-basis:100%;margin-top:var(--ui-space-2,8px)}.gemboss-ei-pop-head{display:flex;align-items:center;gap:var(--ui-space-1,4px);min-height:44px;padding:0 var(--ui-space-2,8px) 0 var(--ui-space-3,12px);border-bottom:1px solid var(--ui-border,#e5e7ea)}.gemboss-ei-pop-title{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:var(--ui-fs-body,13px);line-height:20px;font-weight:650;color:var(--ui-text-strong,#1b1c1e)}.gemboss-ei-pop-btn{flex:none;display:grid;place-items:center;width:28px;height:28px;padding:0;border:0;border-radius:var(--ui-radius-sm,6px);background:none;color:var(--ui-text-muted,#686b71);cursor:pointer}.gemboss-ei-pop-btn:hover{background:var(--ui-surface-2,#eceef2);color:var(--ui-text-strong,#1b1c1e)}.gemboss-ei-pop-btn:focus-visible{outline:2px solid var(--ui-focus,#5661f5);outline-offset:0}.gemboss-ei-pop-body{padding:var(--ui-space-3,12px);overflow:auto}@media (pointer:coarse),(max-width:47.9975em){.gemboss-ei-pop-btn{width:44px;height:44px}}@media (max-width:47.9975em){.gemboss-ei-pop[popover]{inset:auto 0 0;width:auto!important;max-height:85dvh;border-bottom-left-radius:0;border-bottom-right-radius:0;padding-bottom:env(safe-area-inset-bottom,0px)}}
|
|
1
|
+
.gemboss-ei-pop[popover]{position:fixed;inset:auto;margin:0;padding:0;overflow:auto;color:inherit}.gemboss-ei-pop[popover]:not(:popover-open){display:none}.gemboss-ei-pop{box-sizing:border-box;display:flex;flex-direction:column;outline:none;z-index:40}.gemboss-ei-pop--inline{position:static;flex-basis:100%;margin-top:var(--ui-space-2,8px)}.gemboss-ei-fld.gemboss-ei-fld--row>.gemboss-ei-pop.gemboss-ei-pop--inline{grid-column:1/-1}.gemboss-ei-pop-head{display:flex;align-items:center;gap:var(--ui-space-1,4px);min-height:44px;padding:0 var(--ui-space-2,8px) 0 var(--ui-space-3,12px);border-bottom:1px solid var(--ui-border,#e5e7ea)}.gemboss-ei-pop-title{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:var(--ui-fs-body,13px);line-height:20px;font-weight:650;color:var(--ui-text-strong,#1b1c1e)}.gemboss-ei-pop-btn{flex:none;display:grid;place-items:center;width:28px;height:28px;padding:0;border:0;border-radius:var(--ui-radius-sm,6px);background:none;color:var(--ui-text-muted,#686b71);cursor:pointer}.gemboss-ei-pop-btn:hover{background:var(--ui-surface-2,#eceef2);color:var(--ui-text-strong,#1b1c1e)}.gemboss-ei-pop-btn:focus-visible{outline:2px solid var(--ui-focus,#5661f5);outline-offset:0}.gemboss-ei-pop-body{padding:var(--ui-space-3,12px);overflow:auto}@media (pointer:coarse),(max-width:47.9975em){.gemboss-ei-pop-btn{width:44px;height:44px}}@media (max-width:47.9975em){.gemboss-ei-pop[popover]{inset:auto 0 0;width:auto!important;max-height:85dvh;border-bottom-left-radius:0;border-bottom-right-radius:0;padding-bottom:env(safe-area-inset-bottom,0px)}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.gemboss-editor-rail-foot{display:none}@media (min-width:761px){.gemboss-pageedit.gemboss-pageedit--rail,.gemboss-pageedit--rail .gemboss-layers{left:56px}body:not(.gemboss-editor-rail) .gemboss-pageedit--rail{box-shadow:-1px 0 0 var(--gemboss-divider),-56px 0 0 var(--gemboss-nav-bg)}body.gemboss-editor-rail nav.icon-nav{display:flex!important;top:0;height:100dvh;width:56px;padding-top:6px;z-index:310}body.gemboss-editor-rail nav.icon-nav:focus-within,body.gemboss-editor-rail.gemboss-editor-rail-open nav.icon-nav{z-index:330}body.gemboss-editor-rail .icon-nav>.gnav-bottom{padding-bottom:0}body.gemboss-editor-rail .gemboss-editor-rail-foot{display:block;padding:0 12px 12px}body.gemboss-editor-rail:not(.gemboss-editor-rail-open) .icon-nav{border-right:0;box-shadow:inset -1px 0 0 var(--gemboss-divider)}body.gemboss-editor-rail:not(.gemboss-editor-rail-open) .icon-nav :is(.gnav-scroll,.gnav-bottom,.gemboss-editor-rail-foot){padding-inline:12px}body.gemboss-editor-rail:not(.gemboss-editor-rail-open) .icon-nav .gnav-item{position:relative;justify-content:center;gap:0;padding:6px}body.gemboss-editor-rail:not(.gemboss-editor-rail-open) .icon-nav .gnav-sub{display:none}body.gemboss-editor-rail:not(.gemboss-editor-rail-open) .icon-nav .gnav-label{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}body.gemboss-editor-rail:not(.gemboss-editor-rail-open) .icon-nav .gnav-item:focus-visible .gnav-label{position:fixed;left:64px;width:auto;height:auto;overflow:visible;clip-path:none;padding:4px 8px;border-radius:var(--gemboss-radius-md);background:var(--gemboss-text);color:var(--gemboss-surface);font-size:var(--gemboss-fs-caption);pointer-events:none}body.gemboss-editor-rail:not(.gemboss-editor-rail-open) .icon-nav .gnav-item>:not(.gnav-ico,.gnav-label){position:absolute;top:2px;right:0}body.gemboss-editor-rail:not(.gemboss-editor-rail-open) .icon-nav .gnav-scroll{scrollbar-width:none;background:linear-gradient(var(--gemboss-nav-bg) 30%,transparent) 0 0/ calc(100% - 1px) 24px no-repeat local,linear-gradient(transparent,var(--gemboss-nav-bg) 70%) 0 100%/ calc(100% - 1px) 24px no-repeat local,radial-gradient(farthest-side at 50% 0,rgba(31,30,29,.22),transparent) 0 0/ calc(100% - 1px) 8px no-repeat scroll,radial-gradient(farthest-side at 50% 100%,rgba(31,30,29,.22),transparent) 0 100%/ calc(100% - 1px) 8px no-repeat scroll}body.gemboss-editor-rail.gemboss-editor-rail-open nav.icon-nav{width:240px;box-shadow:2px 0 26px #1f1e1d33}@media (min-width:1001px) and (max-width:1056px){.gemboss-pageedit--rail .gemboss-editor-body{flex-direction:column;gap:var(--gemboss-editor-inset)}.gemboss-pageedit--rail .gemboss-editor-resizer{display:none}.gemboss-pageedit--rail .gemboss-editor-body.is-chat-collapsed .gemboss-ec{max-height:0;min-height:0}.gemboss-pageedit--rail .gemboss-editor-body>.gemboss-ec{width:auto;flex:0 0 auto;height:44%;min-height:min(520px,76%);max-height:76%}}@media (min-width:1201px) and (max-width:1256px){.gemboss-pageedit--rail .gemboss-pageedit-scope{display:none}}}@media (min-width:761px) and (pointer:coarse),(min-width:761px) and (max-width:47.9975em){body.gemboss-editor-rail:not(.gemboss-editor-rail-open) .icon-nav :is(.gnav-scroll,.gnav-bottom,.gemboss-editor-rail-foot){padding-inline:6px}body.gemboss-editor-rail:not(.gemboss-editor-rail-open) .icon-nav .gnav-item{padding:12px}}
|