@gemboss/ui 0.55.1 → 0.57.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 +412 -0
- package/README.md +16 -9
- package/catalog/editor.html +58 -34
- package/catalog/index.html +5 -5
- package/gemboss-ui.css +3 -3
- package/package.json +7 -1
- package/parts/components.css +2 -2
- package/parts/core.css +1 -1
- package/parts/shell.css +1 -1
- package/src/assistant/host.tsx +49 -2
- package/src/assistant/provider.tsx +18 -7
- package/src/assistant-chat.css +1 -1
- package/src/assistant-plain.js +1 -1
- package/src/assistant.css +1 -1
- package/src/chat.css +1 -1
- package/src/collections.css +1 -1
- package/src/collections.tsx +21 -4
- package/src/create-shell.css +1 -1
- package/src/create-shell.tsx +24 -9
- package/src/editor/chips.tsx +24 -0
- package/src/editor/color-picker.tsx +8 -4
- package/src/editor/controls.tsx +404 -58
- package/src/editor/index.ts +7 -3
- package/src/editor/layers.tsx +1 -1
- package/src/editor/new-value.ts +27 -0
- package/src/editor/panel.tsx +22 -9
- package/src/editor/repeater.tsx +66 -29
- package/src/editor/swatch.ts +7 -0
- package/src/editor/tiles.tsx +5 -3
- package/src/editor-chips.css +1 -0
- package/src/editor-color.css +1 -1
- package/src/editor-plain.js +1 -1
- package/src/editor-rail.css +1 -0
- package/src/editor-repeater.css +1 -1
- package/src/editor-tiles.css +1 -1
- package/src/editor.css +1 -1
- package/src/gem-holo.css +1 -0
- package/src/gem-holo.tsx +31 -0
- package/src/gemboss-field.css +1 -1
- package/src/gems.css +1 -0
- package/src/index-table.tsx +1 -1
- package/src/index.ts +3 -1
- package/src/kit-plain.css +1 -1
- package/src/list-page.tsx +6 -3
- package/src/menu.tsx +3 -1
- package/src/page-tabs.tsx +14 -0
- package/src/pager-extras.css +1 -1
- package/src/screens-arriving.ts +65 -0
- package/src/segmented.tsx +28 -4
- package/src/stage.css +1 -1
- package/src/stage.tsx +11 -4
- package/src/starting-point.tsx +25 -9
- package/src/ui.css +1 -1
package/src/editor/index.ts
CHANGED
|
@@ -36,9 +36,11 @@ export {
|
|
|
36
36
|
type FieldProps, type InspectorGroupProps, type PanelHeaderProps, type PanelTab, type PanelTabsProps,
|
|
37
37
|
} from "./panel";
|
|
38
38
|
export {
|
|
39
|
-
ChipButton, ColorControl, EdgeBox, ImageControl, RangeControl, Seg, UnitField, ValueControl,
|
|
40
|
-
type ColorChoice, type ColorControlProps, type EdgeBoxProps, type EdgeSide, type ImageControlProps, type RangeControlProps, type SegOption, type SegProps, type UnitFieldProps, type ValueControlProps,
|
|
39
|
+
ChipButton, ColorControl, EdgeBox, fileSizeWords, ImageControl, imageFileName, MediaCard, PickButton, RangeControl, Seg, UnitField, ValueControl,
|
|
40
|
+
type ColorChoice, type ColorControlProps, type EdgeBoxProps, type EdgeSide, type ImageControlProps, type MediaCardProps, type PickButtonProps, type RangeControlProps, type SegOption, type SegProps, type UnitFieldProps, type ValueControlProps,
|
|
41
41
|
} from "./controls";
|
|
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
|
+
export { useOnNewValue } from "./new-value";
|
|
42
44
|
export { opacityOf, parseColor, pickSwatch, swatchState, swatchWhy, themeColorChoices, withOpacity, type Rgba, type SwatchState } from "./swatch";
|
|
43
45
|
export { cssUrl } from "./css-url";
|
|
44
46
|
// Step 4 (0.22.0): the page's layers and the drawer (`layers`, stateless; the page editor draws them), a list whose rows
|
|
@@ -52,7 +54,9 @@ export { SortableLayerList, type SortableLayerListProps, useRowDrag, dropIndex }
|
|
|
52
54
|
// 16/10/2026: a setting that is a list, as rows (drag, duplicate, fold); its own CSS part, editor-repeater.css.
|
|
53
55
|
export { RepeaterList, useKeyedRows, type RepeaterListProps, type KeyedRows } from "./repeater";
|
|
54
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.
|
|
55
|
-
export { ChoiceTiles, type ChoiceTile, type ChoiceTilesProps } from "./tiles";
|
|
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";
|
|
56
60
|
// 24/10/2026: a setting's small panel beside the settings column (top layer; a sheet at phone width); its own CSS part.
|
|
57
61
|
export { Popover, type PopoverProps } from "./popover";
|
|
58
62
|
// 24/10/2026: the colour picker ColorControl's swatch opens (square, hue, opacity, hex, eyedropper, theme/recent/None).
|
package/src/editor/layers.tsx
CHANGED
|
@@ -109,7 +109,7 @@ export interface EditorDrawerProps {
|
|
|
109
109
|
before?: React.ReactNode;
|
|
110
110
|
/** The drawer's buttons, right-aligned at the bottom (`.gemboss-settings-foot`). */
|
|
111
111
|
footer?: React.ReactNode;
|
|
112
|
-
/** The body: a `.gemboss-settings-body` of
|
|
112
|
+
/** The body: a `.gemboss-settings-body` of the kit's `Field`s, a LayerList, … */
|
|
113
113
|
children?: React.ReactNode;
|
|
114
114
|
}
|
|
115
115
|
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
// A CONTROL TAKES A NEW VALUE IN THE RENDER THAT BRINGS IT (27/10/2026). A control that holds a draft (what is typed, a tile
|
|
3
|
+
// pressed before the save lands, an error) and takes a value from outside (a save landing, Undo, Take latest, the chat's write)
|
|
4
|
+
// did it in an effect: `useEffect(() => setDraft(value), [value])`. An effect runs after the commit, so for one commit the rest of
|
|
5
|
+
// the panel shows the new value and the control still shows the old one. gemboss #5577: after Take latest the held row was gone
|
|
6
|
+
// while the box still showed the seller's typing, and the gate that reads the box in that commit went red on CI only.
|
|
7
|
+
//
|
|
8
|
+
// `useOnNewValue(take, deps)` runs `take` WHILE the component renders, whenever `deps` differ from the last render's (each
|
|
9
|
+
// compared with Object.is, as an effect's deps are). React throws that render away and renders again with the state `take` set,
|
|
10
|
+
// before anything is drawn (react.dev, "Adjusting some state when a prop changes").
|
|
11
|
+
//
|
|
12
|
+
// · `take` sets this component's state only. It may READ a ref an event writes (a drag in progress, a write not sent yet);
|
|
13
|
+
// a ref it would WRITE stays in an effect, since a render can be thrown away.
|
|
14
|
+
// · `deps` are props, or primitives worked out from them: an object made in this render is new each time, never equal to the
|
|
15
|
+
// last, and the component would render again for ever.
|
|
16
|
+
//
|
|
17
|
+
// apps/admin's `a-control-takes-a-new-value-in-the-render-that-brings-it.test.ts` holds every control in the admin and in this
|
|
18
|
+
// package to it.
|
|
19
|
+
import { useState } from "react";
|
|
20
|
+
|
|
21
|
+
export function useOnNewValue(take: () => void, deps: readonly unknown[]): void {
|
|
22
|
+
const [had, setHad] = useState(deps);
|
|
23
|
+
if (deps.length !== had.length || deps.some((d, i) => !Object.is(d, had[i]))) {
|
|
24
|
+
setHad(deps);
|
|
25
|
+
take();
|
|
26
|
+
}
|
|
27
|
+
}
|
package/src/editor/panel.tsx
CHANGED
|
@@ -24,7 +24,8 @@ export interface PanelTabsProps<T extends string = string> {
|
|
|
24
24
|
value: T;
|
|
25
25
|
onChange: (id: T) => void;
|
|
26
26
|
/**
|
|
27
|
-
* `column`: the left column's row (`.gemboss-ec-tabs`, Configure · Chat
|
|
27
|
+
* `column`: the left column's row (`.gemboss-ec-tabs`, Configure · Chat): 32px tabs, the selected one bordered with a 2px
|
|
28
|
+
* primary underline (the look of #702, back on 30/10/2026 after a grey track with a pill in Control UI C31).
|
|
28
29
|
* `inspector`: the settings panel's segmented row (`.gemboss-ei-tabs`, Content · Design · Advanced · Elements).
|
|
29
30
|
*/
|
|
30
31
|
variant?: "column" | "inspector";
|
|
@@ -123,7 +124,7 @@ export interface InspectorGroupProps {
|
|
|
123
124
|
onOpenChange?: (open: boolean) => void;
|
|
124
125
|
/**
|
|
125
126
|
* Default true: the inspector's group, `.gemboss-ei-grp` with a header BUTTON (▾ / ▸, `aria-expanded`); closed, CSS
|
|
126
|
-
* hides everything after the header (`.gemboss-ei-gh[data-open="closed"]
|
|
127
|
+
* hides everything after the header (`.gemboss-ei-grp>.gemboss-ei-gh[data-open="closed"]~*`), so the body stays mounted.
|
|
127
128
|
* `false`: the schema form's static group, `section.gemboss-ei-group` with an `h4.gemboss-ei-grouphead` (no toggle).
|
|
128
129
|
*/
|
|
129
130
|
collapsible?: boolean;
|
|
@@ -179,9 +180,17 @@ export interface FieldProps {
|
|
|
179
180
|
/** A one-value setting (a number, a select, a colour, chips): inside an inspector group the label goes LEFT and the control
|
|
180
181
|
* right, one row (0.39.0). Outside a group nothing changes. */
|
|
181
182
|
row?: boolean;
|
|
183
|
+
/** A control that belongs to the label line, at its right (a spacing field's mode switch, Control UI C02). Beside the label, not
|
|
184
|
+
* in it: a label may hold no other control. */
|
|
185
|
+
aside?: React.ReactNode;
|
|
186
|
+
/** A small control right after the label, before its ?: a mark on the value (set for this screen, Control UI C30). Beside the label,
|
|
187
|
+
* not in it: a label may hold no other control. */
|
|
188
|
+
mark?: React.ReactNode;
|
|
182
189
|
/** Added to `.gemboss-ei-fld` (the admin's `togrow`). */
|
|
183
190
|
className?: string;
|
|
184
191
|
style?: React.CSSProperties;
|
|
192
|
+
/** Refuse a descendant's pending blur commit on this existing field root, without inserting a DOM wrapper. */
|
|
193
|
+
onBlurCapture?: React.FocusEventHandler<HTMLDivElement>;
|
|
185
194
|
children?: React.ReactNode;
|
|
186
195
|
}
|
|
187
196
|
|
|
@@ -195,7 +204,7 @@ export interface FieldProps {
|
|
|
195
204
|
* is behind a ? (GemPages, PageFly). Outside a group, a plugin's settings form, a help line under a wide field is the
|
|
196
205
|
* Polaris form and stays.
|
|
197
206
|
*/
|
|
198
|
-
export function Field({ label, htmlFor, labelValue, hint, row = false, className, style, children }: FieldProps) {
|
|
207
|
+
export function Field({ label, htmlFor, labelValue, hint, row = false, aside, mark, className, style, onBlurCapture, children }: FieldProps) {
|
|
199
208
|
const helpId = useId();
|
|
200
209
|
const [helpOpen, setHelpOpen] = useState(false);
|
|
201
210
|
const cls = ["gemboss-ei-fld", row && label != null ? "gemboss-ei-fld--row" : "", className].filter(Boolean).join(" ");
|
|
@@ -203,15 +212,19 @@ export function Field({ label, htmlFor, labelValue, hint, row = false, className
|
|
|
203
212
|
<label htmlFor={htmlFor}>{label}{labelValue != null ? <span className="gemboss-ei-rangeval">{labelValue}</span> : null}</label>
|
|
204
213
|
) : null;
|
|
205
214
|
return (
|
|
206
|
-
<div className={cls} style={style}>
|
|
207
|
-
{/* A ? is a button, so it sits BESIDE the label, not in it (a label may hold no other labelable element). */}
|
|
208
|
-
{hint && labelNode ? (
|
|
215
|
+
<div className={cls} style={style} onBlurCapture={onBlurCapture}>
|
|
216
|
+
{/* A ? is a button, so it sits BESIDE the label, not in it (a label may hold no other labelable element); so does an aside. */}
|
|
217
|
+
{(hint || aside || mark) && labelNode ? (
|
|
209
218
|
<div className="gemboss-ei-lbl">
|
|
210
219
|
{labelNode}
|
|
211
|
-
<
|
|
212
|
-
|
|
220
|
+
{mark ? <span className="gemboss-ei-lbl-mark">{mark}</span> : null}
|
|
221
|
+
{hint ? (
|
|
222
|
+
<button type="button" className="gemboss-ei-help" aria-label={typeof label === "string" ? `About ${label}` : "About this setting"} aria-describedby={helpId} aria-expanded={helpOpen}
|
|
223
|
+
onClick={() => setHelpOpen((o) => !o)} onKeyDown={(e) => { if (e.key === "Escape") setHelpOpen(false); }}>?</button>
|
|
224
|
+
) : null}
|
|
225
|
+
{aside ? <div className="gemboss-ei-lbl-aside">{aside}</div> : null}
|
|
213
226
|
</div>
|
|
214
|
-
) : labelNode}
|
|
227
|
+
) : labelNode ?? (aside ? <div className="gemboss-ei-lbl"><div className="gemboss-ei-lbl-aside">{aside}</div></div> : null)}
|
|
215
228
|
{children}
|
|
216
229
|
{hint ? <p className="gemboss-ei-hint gemboss-ei-help-text" id={helpId}>{hint}</p> : null}
|
|
217
230
|
</div>
|
package/src/editor/repeater.tsx
CHANGED
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
// at a time with ↑ ↓. PageFly and GemPages draw it as rows: a grip to drag, the row's name, duplicate, delete, folded until
|
|
6
6
|
// opened. This is that, for every repeater the admin draws (the Canvas panel and the page editor), one look.
|
|
7
7
|
//
|
|
8
|
-
// · the header is the row: a grip (drag it; HTML drag and drop does not start from a touch, so
|
|
9
|
-
// first field, else "Item N") as the button that folds it, then
|
|
8
|
+
// · the header is the row: a grip (drag it; HTML drag and drop does not start from a touch, so Move up / down stay), the name
|
|
9
|
+
// (its first field, else "Item N") as the button that folds it, then one ⋯: Move up, Move down, Duplicate, Remove
|
|
10
|
+
// (Control UI C26, slice 2; until then four buttons on every row);
|
|
10
11
|
// · with more than one row the list opens folded; a row that arrives later (added, duplicated) opens, it is the one
|
|
11
12
|
// being written;
|
|
12
13
|
// · Alt+↑ / Alt+↓ on a row's name move it, and the focus stays on it;
|
|
@@ -30,6 +31,7 @@ import "../editor-repeater.css"; // its own part (16/10/2026): a surface that ne
|
|
|
30
31
|
import { useEffect, useId, useLayoutEffect, useRef, useState } from "react";
|
|
31
32
|
import type React from "react";
|
|
32
33
|
import { canFloatMenus, placeFloating } from "../menu-layer";
|
|
34
|
+
import { Menu, MenuItem } from "../menu";
|
|
33
35
|
import { useRowDrag } from "./sortable";
|
|
34
36
|
|
|
35
37
|
let lastKey = 0;
|
|
@@ -57,14 +59,15 @@ export interface KeyedRows<T> {
|
|
|
57
59
|
/**
|
|
58
60
|
* A stored list with a stable key per row. Each change writes the WHOLE list (`commit`) and shows it at once.
|
|
59
61
|
*
|
|
60
|
-
* · `commit` may
|
|
62
|
+
* · `commit` may refuse synchronously with `false`, before the next keyed operation. A Promise that answers `false` or a
|
|
63
|
+
* rejection puts the stored list back, unless a later write is on its way
|
|
61
64
|
* (its answer decides). Without an answer what was written stays shown until the stored list says otherwise.
|
|
62
65
|
* · the stored list is read by CONTENT: a caller that hands a new array each render (`rows ?? []`) does not reset what is
|
|
63
66
|
* shown (review of #4506: a row added to an unset list vanished).
|
|
64
67
|
* · a stored list equal to one of our writes is that write coming back: what is shown (maybe newer) stays; any other is a
|
|
65
68
|
* change from elsewhere (an undo, the chat) and replaces it, the keys kept by position.
|
|
66
69
|
*/
|
|
67
|
-
export function useKeyedRows<T>(value: readonly T[], commit: (next: T[]) => void | PromiseLike<unknown>): KeyedRows<T> {
|
|
70
|
+
export function useKeyedRows<T>(value: readonly T[], commit: (next: T[]) => false | void | PromiseLike<unknown>): KeyedRows<T> {
|
|
68
71
|
const [state, setState] = useState(() => ({ rows: value.slice(), keys: value.map(() => freshKey()) }));
|
|
69
72
|
const latest = useRef(state);
|
|
70
73
|
latest.current = state;
|
|
@@ -74,6 +77,7 @@ export function useKeyedRows<T>(value: readonly T[], commit: (next: T[]) => void
|
|
|
74
77
|
// Our writes on their way, oldest first.
|
|
75
78
|
const pending = useRef<Array<{ n: number; json: string; keys: string[] }>>([]);
|
|
76
79
|
const writes = useRef(0);
|
|
80
|
+
const writeSequence = useRef(0); // attempts keep unique IDs even when one is refused synchronously
|
|
77
81
|
useEffect(() => {
|
|
78
82
|
if (seen === stored.current.json) return;
|
|
79
83
|
const mine = pending.current.findIndex((p) => p.json === seen);
|
|
@@ -97,12 +101,21 @@ export function useKeyedRows<T>(value: readonly T[], commit: (next: T[]) => void
|
|
|
97
101
|
setState(latest.current);
|
|
98
102
|
};
|
|
99
103
|
const write = (rows: T[], keys: string[]) => {
|
|
100
|
-
const
|
|
104
|
+
const before = latest.current, previousWrite = writes.current;
|
|
105
|
+
const n = ++writeSequence.current; writes.current = n;
|
|
101
106
|
pending.current.push({ n, json: JSON.stringify(rows), keys });
|
|
102
107
|
latest.current = { rows, keys };
|
|
103
108
|
setState(latest.current);
|
|
104
109
|
const answer = commit(rows);
|
|
105
|
-
if (answer
|
|
110
|
+
if (answer === false) {
|
|
111
|
+
pending.current = pending.current.filter((p) => p.n !== n);
|
|
112
|
+
if (n !== writes.current) return; // a reentrant newer write still decides
|
|
113
|
+
// This attempt never reached persistence. Keep an earlier accepted or in-flight
|
|
114
|
+
// keyed state, and let that earlier Promise still decide its own result.
|
|
115
|
+
writes.current = previousWrite;
|
|
116
|
+
latest.current = before;
|
|
117
|
+
setState(before);
|
|
118
|
+
} else if (answer && typeof (answer as PromiseLike<unknown>).then === "function") {
|
|
106
119
|
(answer as PromiseLike<unknown>).then((ok) => { if (ok === false) refused(n); }, () => refused(n));
|
|
107
120
|
}
|
|
108
121
|
};
|
|
@@ -139,7 +152,7 @@ export function useKeyedRows<T>(value: readonly T[], commit: (next: T[]) => void
|
|
|
139
152
|
}
|
|
140
153
|
|
|
141
154
|
export interface RepeaterListProps {
|
|
142
|
-
/** The list's name ("Cards"), and the noun of
|
|
155
|
+
/** The list's name ("Cards"), and the noun of a row's ⋯ without `item` ("More actions for Cards item 2"). */
|
|
143
156
|
label: string;
|
|
144
157
|
/** Under the name: the setting's sentence. */
|
|
145
158
|
hint?: React.ReactNode;
|
|
@@ -158,7 +171,10 @@ export interface RepeaterListProps {
|
|
|
158
171
|
onDuplicate?: (index: number) => void;
|
|
159
172
|
/** Absent: no add button. */
|
|
160
173
|
onAdd?: () => void;
|
|
161
|
-
/**
|
|
174
|
+
/** What one row is ("question", "plan"): a row with no name reads "Question 3", its ⋯ "More actions for question 3", the add
|
|
175
|
+
* button "+ Add question" unless `addLabel` says otherwise (Control UI C26). Default: the list's label and "item", as before. */
|
|
176
|
+
item?: string;
|
|
177
|
+
/** Default "+ Add item" ("+ Add <item>" with `item`). */
|
|
162
178
|
addLabel?: string;
|
|
163
179
|
/** False: the add and duplicate buttons are off (a list at its limit). */
|
|
164
180
|
canAdd?: boolean;
|
|
@@ -178,12 +194,12 @@ export interface RepeaterListProps {
|
|
|
178
194
|
onActive?: (index: number | null) => void;
|
|
179
195
|
}
|
|
180
196
|
|
|
181
|
-
// A function, not an element built at import: a page that compiles JSX against a global React (the admin's gates) sets that
|
|
182
|
-
// global after its imports run.
|
|
183
|
-
const DuplicateIcon = () => <svg viewBox="0 0 16 16" width="13" height="13" aria-hidden fill="none" stroke="currentColor" strokeWidth="1.4"><rect x="5.5" y="5.5" width="8" height="8" rx="1.5" /><path d="M10.5 3.5v-.5A1.5 1.5 0 0 0 9 1.5H4A1.5 1.5 0 0 0 2.5 3v5A1.5 1.5 0 0 0 4 9.5h.5" /></svg>;
|
|
184
197
|
|
|
185
198
|
/** `.gemboss-ei-fld.gemboss-ei-rep` › label (+ count) › `.gemboss-ei-rep-list` › one `.gemboss-ei-rep-item` per row › add. */
|
|
186
|
-
export function RepeaterList({ label, hint, keys, title, body, onMove, onRemove, onDuplicate, onAdd, addLabel = "+ Add item", canAdd = true, disabled, empty, rowAttrs, touch, thumb, editIn = "inline", onActive }: RepeaterListProps) {
|
|
199
|
+
export function RepeaterList({ label, hint, keys, title, body, onMove, onRemove, onDuplicate, onAdd, item, addLabel = item ? `+ Add ${item}` : "+ Add item", canAdd = true, disabled, empty, rowAttrs, touch, thumb, editIn = "inline", onActive }: RepeaterListProps) {
|
|
200
|
+
// A row by its number: "Question 3" / "question 3" with `item`, else "Item 3" / "Plans item 3".
|
|
201
|
+
const nth = (i: number) => (item ? `${item.charAt(0).toUpperCase()}${item.slice(1)} ${i + 1}` : `Item ${i + 1}`);
|
|
202
|
+
const ofRow = (i: number) => (item ? `${item} ${i + 1}` : `${label} item ${i + 1}`);
|
|
187
203
|
const uid = useId();
|
|
188
204
|
// The layer only where there is a row to choose: a list of one shows it in place.
|
|
189
205
|
const popover = editIn === "popover" && keys.length > 1;
|
|
@@ -209,18 +225,35 @@ export function RepeaterList({ label, hint, keys, title, body, onMove, onRemove,
|
|
|
209
225
|
? pick(activeKey === key ? null : key)
|
|
210
226
|
: setOpen((o) => { const next = new Set(o); if (!next.delete(key)) next.add(key); return next; });
|
|
211
227
|
const drag = useRowDrag(keys, onMove ?? (() => {}));
|
|
212
|
-
//
|
|
213
|
-
|
|
228
|
+
// WHERE THE FOCUS GOES once the rows have changed. A row moved by Alt+↑ / ↓ keeps it on its name (as SortableLayerList). A
|
|
229
|
+
// removed row takes it with it (the menu hands it to its ⋯ first): it goes to the next row's ⋯, else the one before, else the
|
|
230
|
+
// add button while it takes the focus, else the list itself. (A row moved from its ⋯ keeps it there: measured in Chromium and
|
|
231
|
+
// WebKit, React's move of the row's node does not drop it.) Armed for the change it asks for, in this task only: a refused
|
|
232
|
+
// change (the rows as they were) disarms it, so a later change from elsewhere (an undo, the chat) moves no focus.
|
|
233
|
+
type Refocus = { key: string; from: number } | { gone: string; to: string | null };
|
|
234
|
+
const refocus = useRef<Refocus | null>(null);
|
|
235
|
+
const arm = (r: Refocus) => { refocus.current = r; setTimeout(() => { if (refocus.current === r) refocus.current = null; }, 0); };
|
|
236
|
+
const rootRef = useRef<HTMLDivElement>(null);
|
|
237
|
+
const addRef = useRef<HTMLButtonElement>(null);
|
|
214
238
|
const listRef = useRef<HTMLDivElement>(null);
|
|
215
239
|
useEffect(() => {
|
|
216
240
|
const want = refocus.current;
|
|
217
241
|
if (!want) return;
|
|
242
|
+
const rowOf = (key: string | null) => ([...(listRef.current?.children ?? [])] as HTMLElement[]).find((r) => r.dataset.key === key);
|
|
243
|
+
if ("gone" in want) {
|
|
244
|
+
if (keys.includes(want.gone)) return;
|
|
245
|
+
refocus.current = null;
|
|
246
|
+
const next = rowOf(want.to)?.querySelector<HTMLElement>(".gemboss-ei-rep-acts summary");
|
|
247
|
+
const add = addRef.current && !addRef.current.disabled ? addRef.current : null;
|
|
248
|
+
const root = rootRef.current;
|
|
249
|
+
if (next) next.focus(); else if (add) add.focus(); else if (root) { root.tabIndex = -1; root.focus(); }
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
218
252
|
const at = keys.indexOf(want.key);
|
|
219
253
|
if (at === want.from) return;
|
|
220
254
|
refocus.current = null;
|
|
221
255
|
if (at < 0) return;
|
|
222
|
-
|
|
223
|
-
row?.querySelector<HTMLButtonElement>(".gemboss-ei-rep-toggle")?.focus();
|
|
256
|
+
rowOf(want.key)?.querySelector<HTMLElement>(".gemboss-ei-rep-toggle")?.focus();
|
|
224
257
|
}, [keys]);
|
|
225
258
|
// The layer under the list: in the top layer, as wide as the list, placed again when the panel or the page scrolls or the
|
|
226
259
|
// window resizes (a scroll inside the layer does not count), so it never floats away from its list.
|
|
@@ -251,7 +284,7 @@ export function RepeaterList({ label, hint, keys, title, body, onMove, onRemove,
|
|
|
251
284
|
const rootClass = ["gemboss-ei-fld gemboss-ei-rep", touch ? "gemboss-ei-rep--touch" : "", popover ? "gemboss-ei-rep--pop" : ""].filter(Boolean).join(" ");
|
|
252
285
|
|
|
253
286
|
return (
|
|
254
|
-
<div className={rootClass}>
|
|
287
|
+
<div ref={rootRef} className={rootClass}>
|
|
255
288
|
<label>{label}{keys.length ? <span className="gemboss-ei-rep-count">{keys.length}</span> : null}</label>
|
|
256
289
|
{hint}
|
|
257
290
|
{keys.length === 0 ? (empty ?? <p className="gemboss-ei-hint">No items yet.</p>) : (
|
|
@@ -260,7 +293,7 @@ export function RepeaterList({ label, hint, keys, title, body, onMove, onRemove,
|
|
|
260
293
|
const picked = popover && activeKey === key;
|
|
261
294
|
// Inline: its own fold. Popover: the row picked opens in place only where nothing can float.
|
|
262
295
|
const isOpen = popover ? picked && !canFloat : open.has(key);
|
|
263
|
-
const name = title(i) ||
|
|
296
|
+
const name = title(i) || nth(i);
|
|
264
297
|
const bodyId = `${uid}-${key}`;
|
|
265
298
|
const src = thumb?.(i);
|
|
266
299
|
return (
|
|
@@ -283,22 +316,26 @@ export function RepeaterList({ label, hint, keys, title, body, onMove, onRemove,
|
|
|
283
316
|
const to = e.key === "ArrowUp" ? i - 1 : i + 1;
|
|
284
317
|
if (to < 0 || to >= keys.length) return;
|
|
285
318
|
e.preventDefault();
|
|
286
|
-
|
|
319
|
+
arm({ key, from: i });
|
|
287
320
|
onMove(i, to);
|
|
288
321
|
}}>
|
|
289
322
|
{src ? <img className="gemboss-ei-rep-thumb" src={src} alt="" loading="lazy" /> : null}
|
|
290
323
|
<span className="gemboss-ei-rep-title">{name}</span>
|
|
291
324
|
</button>
|
|
292
325
|
{onMove || onDuplicate || onRemove ? (
|
|
326
|
+
// ONE ⋯ PER ROW (Control UI C26, slice 2): ↑ ↓ ⎘ ✕ were four buttons on every row, 182px of a 320px panel,
|
|
327
|
+
// which left an item's name 66px, and a slip beside the name removed it. Their work is the menu's rows; the
|
|
328
|
+
// grip and Alt+↑ / ↓ still move a row without opening it.
|
|
293
329
|
<span className="gemboss-ei-rep-acts">
|
|
294
|
-
{
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
330
|
+
<Menu label={`More actions for ${ofRow(i)}`} end disabled={disabled}>
|
|
331
|
+
{onMove ? <>
|
|
332
|
+
<MenuItem disabled={i === 0} onClick={() => onMove(i, i - 1)}>Move up</MenuItem>
|
|
333
|
+
<MenuItem disabled={i === keys.length - 1} onClick={() => onMove(i, i + 1)}>Move down</MenuItem>
|
|
334
|
+
</> : null}
|
|
335
|
+
{/* A list at its limit: the row says why it is off (§13: a locked control says its reason). */}
|
|
336
|
+
{onDuplicate ? <MenuItem disabled={!canAdd} hint={canAdd ? undefined : "List is full"} onClick={() => onDuplicate(i)}>Duplicate</MenuItem> : null}
|
|
337
|
+
{onRemove ? <MenuItem danger onClick={() => { arm({ gone: key, to: keys[i + 1] ?? keys[i - 1] ?? null }); onRemove(i); }}>Remove</MenuItem> : null}
|
|
338
|
+
</Menu>
|
|
302
339
|
</span>
|
|
303
340
|
) : null}
|
|
304
341
|
</div>
|
|
@@ -308,10 +345,10 @@ export function RepeaterList({ label, hint, keys, title, body, onMove, onRemove,
|
|
|
308
345
|
})}
|
|
309
346
|
</div>
|
|
310
347
|
)}
|
|
311
|
-
{onAdd ? <button type="button" className="ui-btn gemboss-ei-rep-add" disabled={disabled || !canAdd} onClick={onAdd}>{addLabel}</button> : null}
|
|
348
|
+
{onAdd ? <button ref={addRef} type="button" className="ui-btn gemboss-ei-rep-add" disabled={disabled || !canAdd} onClick={onAdd}>{addLabel}</button> : null}
|
|
312
349
|
{floating && activeKey !== null ? (() => {
|
|
313
350
|
const i = keys.indexOf(activeKey);
|
|
314
|
-
const name = title(i) ||
|
|
351
|
+
const name = title(i) || nth(i);
|
|
315
352
|
return (
|
|
316
353
|
// A child of the list in the DOM (Tab order, React context, the host's providers), painted in the top layer.
|
|
317
354
|
<div ref={popRef} id={`${uid}-pop`} className="gemboss-ei-rep-pop gemboss-popover-surface" role="dialog" aria-label={name} tabIndex={-1}
|
package/src/editor/swatch.ts
CHANGED
|
@@ -165,6 +165,13 @@ const TOKEN_NAMES: Record<string, string> = { text: "Text", accent: "Accent", "a
|
|
|
165
165
|
surface: "Surface", border: "Border", success: "Success", warning: "Warning", danger: "Danger" };
|
|
166
166
|
const tokenName = (t: string) => TOKEN_NAMES[t] ?? t.charAt(0).toUpperCase() + t.slice(1).replace(/-/g, " ");
|
|
167
167
|
|
|
168
|
+
/** A theme colour's name ("Accent") for a `var(--gem-color-<role>)` value, read as swatchWhy reads it (any case, spaces inside the
|
|
169
|
+
* brackets); null for anything else. No palette needed: the colour box names it before a frame says its colours (Control UI C13). */
|
|
170
|
+
export function themeColorName(value: string): string | null {
|
|
171
|
+
const token = /^var\(\s*--gem-color-([a-z-]+)\s*\)$/i.exec(value.trim())?.[1]?.toLowerCase();
|
|
172
|
+
return token ? tokenName(token) : null;
|
|
173
|
+
}
|
|
174
|
+
|
|
168
175
|
/** The theme's colours as ColorControl chips (A4b), in the theme's own order and names, for the roles `palette` has: each writes
|
|
169
176
|
* `var(--gem-color-<role>)` and paints the colour the page draws for it (a frame's palette, gemsite InspectorBridge). A role the
|
|
170
177
|
* palette does not say, or says as something that is not one colour, has no chip. */
|
package/src/editor/tiles.tsx
CHANGED
|
@@ -31,8 +31,10 @@ export interface ChoiceTilesProps {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
const BOX = 26;
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
/** A w×h rectangle fitted to a `box`-px square: a tile's shape (26px), and the same shape where a row shows the one chosen (RatioField's
|
|
35
|
+
* PickButton, 18px). One rule for both, so the row and the tile draw a ratio alike. */
|
|
36
|
+
export const tileShapeStyle = ({ w, h }: { w: number; h: number }, box = BOX): React.CSSProperties =>
|
|
37
|
+
w >= h ? { width: box, height: Math.max(4, Math.round((box * h) / w)) } : { height: box, width: Math.max(4, Math.round((box * w) / h)) };
|
|
36
38
|
|
|
37
39
|
export function ChoiceTiles({ label, options, value, onChange, disabled }: ChoiceTilesProps) {
|
|
38
40
|
return (
|
|
@@ -41,7 +43,7 @@ export function ChoiceTiles({ label, options, value, onChange, disabled }: Choic
|
|
|
41
43
|
<button key={o.value} type="button" className="gemboss-ei-tile" aria-pressed={o.value === value} disabled={disabled}
|
|
42
44
|
data-value={o.value} onClick={() => onChange(o.value)}>
|
|
43
45
|
<span className="gemboss-ei-tile-pic" aria-hidden>
|
|
44
|
-
{o.picture ?? (o.shape ? <span className="gemboss-ei-tile-shape" style={
|
|
46
|
+
{o.picture ?? (o.shape ? <span className="gemboss-ei-tile-shape" style={tileShapeStyle(o.shape)} /> : null)}
|
|
45
47
|
</span>
|
|
46
48
|
<span className="gemboss-ei-tile-label">{o.label}</span>
|
|
47
49
|
</button>
|
|
@@ -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-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}@media (pointer:coarse),(max-width:47.9975em){.gemboss-ei-color .gemboss-ei-swatch{width:44px;height:44px}.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{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}}
|
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"),l.style.flex="0 0 64px",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,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);
|
|
@@ -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}}
|
package/src/editor-repeater.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.gemboss-ei-rep>label{display:flex;align-items:center;gap:6px}.gemboss-ei-rep-count{min-width:18px;padding:0 6px;border-radius:9px;background:var(--gemboss-hover,#eceef2);color:var(--gemboss-text-muted,#686b71);font-size:11px;line-height:18px;font-weight:550;text-align:center}.gemboss-ei-rep-list{display:flex;flex-direction:column;gap:6px;margin-bottom:8px}.gemboss-ei-rep-item{border:1px solid var(--gemboss-divider,#e5e7ea);border-radius:8px;background:var(--gemboss-surface,#fff)}.gemboss-ei-rep-item.is-dragging{opacity:.4}.gemboss-ei-rep-item[data-drop=before]{box-shadow:0 -2px 0 var(--gemboss-primary,#1b1c1e)}.gemboss-ei-rep-item[data-drop=after]{box-shadow:0 2px 0 var(--gemboss-primary,#1b1c1e)}.gemboss-ei-rep-head{display:flex;align-items:center;gap:2px;padding:2px 4px 2px 2px}.gemboss-ei-rep-grip{flex:none;width:16px;color:var(--gemboss-text-muted,#686b71);font-size:11px;letter-spacing:-2px;line-height:1;text-align:center;cursor:grab;user-select:none}.gemboss-ei-rep-grip[draggable=false]{opacity:.3;cursor:default}.gemboss-ei-rep-toggle{flex:1;min-width:0;display:flex;align-items:center;gap:8px;min-height:28px;padding:0 6px;border:0;border-radius:8px;background:none;color:var(--gemboss-text,#1b1c1e);font:inherit;font-size:13px;text-align:left;cursor:pointer}.gemboss-ei-rep-toggle:before{content:"";flex:none;width:5px;height:5px;margin:0 2px;border:solid currentColor;border-width:0 1.5px 1.5px 0;transform:rotate(-45deg);opacity:.6;transition:transform .12s}.gemboss-ei-rep-toggle[aria-expanded=true]:before{transform:rotate(45deg)}.gemboss-ei-rep-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.gemboss-ei-rep-acts{display:flex;
|
|
1
|
+
.gemboss-ei-rep>label{display:flex;align-items:center;gap:6px}.gemboss-ei-rep-count{min-width:18px;padding:0 6px;border-radius:9px;background:var(--gemboss-hover,#eceef2);color:var(--gemboss-text-muted,#686b71);font-size:11px;line-height:18px;font-weight:550;text-align:center}.gemboss-ei-rep-list{display:flex;flex-direction:column;gap:6px;margin-bottom:8px}.gemboss-ei-rep-item{border:1px solid var(--gemboss-divider,#e5e7ea);border-radius:8px;background:var(--gemboss-surface,#fff)}.gemboss-ei-rep-item.is-dragging{opacity:.4}.gemboss-ei-rep-item[data-drop=before]{box-shadow:0 -2px 0 var(--gemboss-primary,#1b1c1e)}.gemboss-ei-rep-item[data-drop=after]{box-shadow:0 2px 0 var(--gemboss-primary,#1b1c1e)}.gemboss-ei-rep-head{display:flex;align-items:center;gap:2px;padding:2px 4px 2px 2px}.gemboss-ei-rep-grip{flex:none;width:16px;color:var(--gemboss-text-muted,#686b71);font-size:11px;letter-spacing:-2px;line-height:1;text-align:center;cursor:grab;user-select:none}.gemboss-ei-rep-grip[draggable=false]{opacity:.3;cursor:default}.gemboss-ei-rep-toggle{flex:1;min-width:0;display:flex;align-items:center;gap:8px;min-height:28px;padding:0 6px;border:0;border-radius:8px;background:none;color:var(--gemboss-text,#1b1c1e);font:inherit;font-size:13px;text-align:left;cursor:pointer}.gemboss-ei-rep-toggle:before{content:"";flex:none;width:5px;height:5px;margin:0 2px;border:solid currentColor;border-width:0 1.5px 1.5px 0;transform:rotate(-45deg);opacity:.6;transition:transform .12s}.gemboss-ei-rep-toggle[aria-expanded=true]:before{transform:rotate(45deg)}.gemboss-ei-rep-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.gemboss-ei-rep-acts{display:flex;flex:none}.gemboss-ei-rep-acts>.ui-menu>summary{display:grid;place-items:center;width:28px;height:28px;padding:0;border:0;border-radius:8px;background:none;box-shadow:none;color:var(--gemboss-text-muted,#686b71)}.gemboss-ei-rep-acts>.ui-menu>summary:hover:not([aria-disabled]),.gemboss-ei-rep-acts>.ui-menu[open]>summary,.gemboss-ei-rep-toggle:hover{background:var(--gemboss-hover,#eceef2)}:is(.gemboss-ei-rep-acts>.ui-menu>summary,.gemboss-ei-rep-toggle):focus-visible{outline:2px solid var(--ui-focus,#5661f5);outline-offset:-2px}.gemboss-ei-rep-acts>.ui-menu>summary[aria-disabled]{opacity:.3;cursor:default}.gemboss-ei-rep-body{padding:8px 10px 10px;border-top:1px solid var(--gemboss-divider-soft,#edeff2)}.gemboss-ei-rep-add{width:100%}.gemboss-ei-rep--touch .gemboss-ei-rep-acts>.ui-menu>summary{width:44px;height:44px}.gemboss-ei-rep--touch :is(.gemboss-ei-rep-toggle,.gemboss-ei-rep-add){min-height:44px}@media (prefers-reduced-motion:reduce){.gemboss-ei-rep-toggle:before{transition:none}}.gemboss-ei-rep--pop .gemboss-ei-rep-toggle:before{display:none}.gemboss-ei-rep-item.is-active{border-color:var(--gemboss-primary,#1b1c1e)}.gemboss-ei-rep-thumb{flex:none;width:20px;height:20px;border-radius:4px;object-fit:cover;background:var(--gemboss-hover,#eceef2)}.gemboss-ei-rep-pop[popover]{position:fixed;inset:auto;margin:0;overflow:auto;max-height:calc(100vh - 16px)}.gemboss-ei-rep-pop[popover]:not(:popover-open){display:none}:where(.gemboss-ei-rep-pop[popover]){border:0;background:none;color:inherit}.gemboss-ei-rep-pop{box-sizing:border-box;padding:4px 12px 12px}.gemboss-ei-rep-pophead{display:flex;align-items:center;gap:8px;min-height:36px;font-size:13px;font-weight:650}.gemboss-ei-rep-popat{margin-left:auto;color:var(--gemboss-text-muted,#686b71);font-size:12px;font-weight:450}.gemboss-ei-rep-pophead button{display:grid;place-items:center;width:28px;height:28px;padding:0;border:0;border-radius:8px;background:none;color:var(--gemboss-text-muted,#686b71);font:inherit;cursor:pointer}.gemboss-ei-rep-pophead button:hover{background:var(--gemboss-hover,#eceef2)}.gemboss-ei-rep-pophead button:focus-visible{outline:2px solid var(--ui-focus,#5661f5);outline-offset:-2px}
|
package/src/editor-tiles.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.gemboss-ei-tiles{display:grid;grid-template-columns:repeat(auto-fit,minmax(72px,1fr));gap:6px}.gemboss-ei-tile{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;min-width:0;min-height:56px;padding:6px 4px;border:1px solid var(--gemboss-divider,#e5e7ea);border-radius:8px;background:var(--gemboss-surface,#fff);color:var(--gemboss-text,#1b1c1e);font:inherit;font-size:12px;line-height:16px;cursor:pointer}.gemboss-ei-tile:hover:not(:disabled){background:var(--gemboss-hover,#eceef2)}.gemboss-ei-tile[aria-pressed=true]{border-color:var(--gemboss-primary,#1b1c1e);box-shadow:inset 0 0 0 1px var(--gemboss-primary,#1b1c1e);font-weight:550}.gemboss-ei-tile:focus-visible{outline:2px solid var(--
|
|
1
|
+
.gemboss-ei-tiles{display:grid;grid-template-columns:repeat(auto-fit,minmax(72px,1fr));gap:6px}.gemboss-ei-tile{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;min-width:0;min-height:56px;padding:6px 4px;border:1px solid var(--gemboss-divider,#e5e7ea);border-radius:8px;background:var(--gemboss-surface,#fff);color:var(--gemboss-text,#1b1c1e);font:inherit;font-size:12px;line-height:16px;cursor:pointer}.gemboss-ei-tile:hover:not(:disabled){background:var(--gemboss-hover,#eceef2)}.gemboss-ei-tile[aria-pressed=true]{border-color:var(--gemboss-primary,#1b1c1e);box-shadow:inset 0 0 0 1px var(--gemboss-primary,#1b1c1e);font-weight:550}.gemboss-ei-tile:focus-visible{outline:2px solid var(--ui-focus,#5661f5);outline-offset:2px}.gemboss-ei-tile:disabled{opacity:.4;cursor:default}.gemboss-ei-tile-pic{display:grid;place-items:center;width:26px;height:26px}.gemboss-ei-tile-shape{display:block;box-sizing:border-box;border:1.5px solid currentColor;border-radius:3px;opacity:.75}.gemboss-ei-tile-label{max-width:100%;overflow:hidden;text-align:center;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}
|