@gemboss/ui 0.66.0 → 0.68.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 +217 -2
- package/README.md +9 -4
- package/catalog/editor.html +1 -1
- package/catalog/index.html +3 -3
- package/gemboss-ui.css +3 -3
- package/package.json +5 -1
- package/parts/components.css +2 -2
- package/parts/core.css +1 -1
- package/parts/shell.css +1 -1
- package/src/assistant/engine.tsx +2 -18
- package/src/board-auto-more.tsx +168 -0
- package/src/collections.tsx +10 -1
- package/src/confirm-buttons.ts +4 -2
- package/src/confirm-dialog.tsx +7 -3
- package/src/copy-field.css +1 -0
- package/src/copy-field.tsx +48 -0
- package/src/copy-text.ts +20 -0
- package/src/create-shell.css +1 -1
- package/src/dialog.tsx +68 -11
- package/src/editor/choice-cards.tsx +71 -0
- package/src/editor/controls.tsx +10 -5
- package/src/editor/field-control.tsx +117 -57
- package/src/editor/field-spec.ts +45 -9
- package/src/editor/grow-to-text.ts +51 -0
- package/src/editor/index.ts +11 -2
- package/src/editor/items-field.tsx +185 -0
- package/src/editor/items.ts +126 -0
- package/src/editor/label-side.ts +2 -1
- package/src/editor/repeater.tsx +37 -7
- package/src/editor/secret-field.tsx +5 -3
- package/src/editor/switch.tsx +34 -0
- package/src/editor-grow.css +1 -0
- package/src/editor-insert.css +1 -1
- package/src/editor-repeater.css +1 -1
- package/src/editor-switch.css +1 -0
- package/src/editor.css +1 -1
- package/src/gemboss-field.css +1 -1
- package/src/index.ts +3 -0
- package/src/kit-plain.css +1 -1
- package/src/segmented.tsx +4 -2
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
// THE ITEMS CONTROL (09/11/2026; Chris: "one shared control set", fast and handy, clicks before typing). Every list setting is drawn with it:
|
|
3
|
+
// a schema's `repeater` field (FieldControl), a library section's rows (gemboss's page editor), any other list. Built on the kit's list
|
|
4
|
+
// parts (RepeaterList, useKeyedRows), its rows' fields drawn by FieldRows, so a row's labels sit where every other setting's do.
|
|
5
|
+
//
|
|
6
|
+
// · each item one line: its picture or its words, a ⋯ (Move up, Move down, Duplicate, Remove); its grip drags it, Alt+↑ / ↓ moves it;
|
|
7
|
+
// · a click opens that item's fields in place, one item at a time, each label beside its control where it fits (label-side.ts);
|
|
8
|
+
// · "+ Add <item>" puts in the list's starter row, so the item shows at once, and opens it;
|
|
9
|
+
// · Remove asks nothing: every host that draws a list can undo it (the page's history, the theme editor's Undo, a form's Save);
|
|
10
|
+
// · the list's bounds hold: at its most, Add and Duplicate are off and say why; at its least, Remove is.
|
|
11
|
+
//
|
|
12
|
+
// ONE WRITE PER CHANGE: the whole list (`onChange`), as stored, every row's other keys kept (items.ts). A row the host cannot save yet
|
|
13
|
+
// (`rowHolds`: a library section's row with none of the words it needs) stays in its place in the list, said so, and is not written,
|
|
14
|
+
// while every other row is. A refused write puts the stored list back (useKeyedRows).
|
|
15
|
+
import "../editor.css";
|
|
16
|
+
import "../editor-repeater.css";
|
|
17
|
+
import { useEffect, useId, useMemo, useRef, useState, type ReactNode } from "react";
|
|
18
|
+
import { RepeaterList, spelled, useKeyedRows, type KeyedChange } from "./repeater";
|
|
19
|
+
import { FieldRows, type FieldGlyphs, type FieldKinds } from "./field-control";
|
|
20
|
+
import { labelize } from "./field-spec";
|
|
21
|
+
import { blank, itemLimits, rowFieldEditable, rowFields, rowThumb, rowTitle, rowValues, starterRow, storedRows, withRowValue, type ItemsSpec } from "./items";
|
|
22
|
+
|
|
23
|
+
export interface ItemsFieldProps {
|
|
24
|
+
/** The list's spec: its label, its rows' fields, its bounds, its starter row. */
|
|
25
|
+
field: ItemsSpec;
|
|
26
|
+
/** The list as stored (anything that is not a list reads as none). */
|
|
27
|
+
value: unknown;
|
|
28
|
+
/** ONE write: the whole list after the change, and where each row came from (useKeyedRows). `false`, or a Promise answering `false`,
|
|
29
|
+
* puts the stored list back. */
|
|
30
|
+
onChange: (next: unknown[], how: KeyedChange) => false | void | PromiseLike<unknown>;
|
|
31
|
+
/** The list's name as drawn (FieldControl's, with a host's mark); default the spec's label. */
|
|
32
|
+
label?: string;
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
/** Why one row cannot be saved yet, or null. Such a row stays in the list after the saved ones, said so, and is not written. */
|
|
35
|
+
rowHolds?: (row: unknown, index: number) => string | null;
|
|
36
|
+
/** A row opened (its index) or the open one folded (null): a host that shows that item on its page. */
|
|
37
|
+
onActive?: (index: number | null) => void;
|
|
38
|
+
/** Open item `index` (its place in the STORED list) from outside (an item picked on the canvas), brought into view, its `field` marked
|
|
39
|
+
* (`data-canvas-focus`, the focus left where it is); a new `seq` asks again. `onActive` answers in the same places: a row the store
|
|
40
|
+
* does not hold yet (rowHolds) is no item of the page, so it is heard as null. */
|
|
41
|
+
open?: { index: number; field?: string; seq: number } | null;
|
|
42
|
+
/** Where this list's unsaved rows (rowHolds) are kept, so they outlive this control: a panel drawn again (another part of the item
|
|
43
|
+
* picked) and another control of the same list (the band's Content, a part's Items) show them. Absent: kept by this control alone. */
|
|
44
|
+
keepDraftsAs?: string;
|
|
45
|
+
/** 44px buttons with a mouse too (a surface whose every control is). */
|
|
46
|
+
touch?: boolean;
|
|
47
|
+
/** The controls' ids start with it (a host whose list is mounted twice). */
|
|
48
|
+
idPrefix?: string;
|
|
49
|
+
/** For a row's fields: the shop an app's kinds read, the media library, the app's kinds and glyphs. */
|
|
50
|
+
shopId?: string;
|
|
51
|
+
onPickImage?: (id: string, current: string) => void;
|
|
52
|
+
kinds?: FieldKinds;
|
|
53
|
+
glyphs?: FieldGlyphs;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** JSON in one key order: the store may hand a row back with its keys reordered (Postgres JSONB), and it is still the row written. */
|
|
57
|
+
/** Two values of one field are one value: empty and unset alike, and a stored 5 is the "5" its box gives back (a text box returns words).
|
|
58
|
+
* Without it a field left untouched wrote its own value back as words on every blur, a number turned into text. */
|
|
59
|
+
const sameValue = (a: unknown, b: unknown) => (blank(a) && blank(b)) || a === b
|
|
60
|
+
|| ((typeof a === "string" || typeof a === "number" || typeof a === "boolean") && (typeof b === "string" || typeof b === "number" || typeof b === "boolean") && String(a) === String(b));
|
|
61
|
+
|
|
62
|
+
/** Unsaved rows by list (ItemsField `keepDraftsAs`), for the page's life: the list as the seller left it, held rows in their places. */
|
|
63
|
+
const DRAFTS = new Map<string, unknown[]>();
|
|
64
|
+
|
|
65
|
+
export function ItemsField({ field, value, onChange, label, disabled, rowHolds, onActive, open = null, keepDraftsAs, touch, idPrefix, shopId, onPickImage, kinds, glyphs }: ItemsFieldProps) {
|
|
66
|
+
const fields = useMemo(() => rowFields(field), [field]);
|
|
67
|
+
const stored = useMemo(() => storedRows(value), [value]);
|
|
68
|
+
const uid = useId();
|
|
69
|
+
const heldIn = (rows: readonly unknown[]) => new Set(rowHolds ? rows.flatMap((r, i) => (rowHolds(r, i) !== null ? [i] : [])) : []);
|
|
70
|
+
// ROWS THE HOST CANNOT SAVE YET (rowHolds), IN THEIR PLACES: the list as the seller last left it, drawn while the stored list is that list
|
|
71
|
+
// without them. Any other stored list (an Undo, the chat, a refused write) is drawn as it is, the unsaved rows with it gone.
|
|
72
|
+
const [view, setViewHere] = useState<unknown[] | null>(() => (keepDraftsAs ? DRAFTS.get(keepDraftsAs) ?? null : null));
|
|
73
|
+
const setView = (next: unknown[] | null) => {
|
|
74
|
+
setViewHere(next);
|
|
75
|
+
if (keepDraftsAs) { if (next) DRAFTS.set(keepDraftsAs, next); else DRAFTS.delete(keepDraftsAs); }
|
|
76
|
+
};
|
|
77
|
+
const shown = useMemo(() => {
|
|
78
|
+
if (!view) return stored;
|
|
79
|
+
const held = heldIn(view);
|
|
80
|
+
return spelled(view.filter((_r, i) => !held.has(i))) === spelled(stored) ? view : stored;
|
|
81
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- heldIn reads rowHolds
|
|
82
|
+
}, [view, stored, rowHolds]);
|
|
83
|
+
// The rows a write starts from (useKeyedRows' latest), to say where each saved row came from in the saved list's places.
|
|
84
|
+
const lastRows = useRef<readonly unknown[]>(shown);
|
|
85
|
+
const list = useKeyedRows<unknown>(shown, (next, how) => {
|
|
86
|
+
const prev = lastRows.current;
|
|
87
|
+
lastRows.current = next;
|
|
88
|
+
if (!rowHolds) return onChange(next, how);
|
|
89
|
+
const held = heldIn(next), wasHeld = heldIn(prev);
|
|
90
|
+
const saved = next.filter((_r, i) => !held.has(i));
|
|
91
|
+
setView(held.size ? next : null);
|
|
92
|
+
// Only an unsaved row changed (added, typed into but still short, removed): nothing to write.
|
|
93
|
+
if (spelled(saved) === spelled(stored)) return;
|
|
94
|
+
let n = 0;
|
|
95
|
+
const place = prev.map((_r, i) => (wasHeld.has(i) ? -1 : n++));
|
|
96
|
+
const from = how.from.filter((_f, i) => !held.has(i)).map((o) => (o >= 0 ? place[o] ?? -1 : -1));
|
|
97
|
+
const answer = onChange(saved, { from, was: n });
|
|
98
|
+
const drop = () => setView(null);
|
|
99
|
+
if (answer === false) drop();
|
|
100
|
+
else if (answer && typeof (answer as PromiseLike<unknown>).then === "function") (answer as PromiseLike<unknown>).then((ok) => { if (ok === false) drop(); }, drop);
|
|
101
|
+
return answer;
|
|
102
|
+
});
|
|
103
|
+
lastRows.current = list.rows;
|
|
104
|
+
// Add and Duplicate count every row shown (an unsaved one becomes an item once filled); Remove counts the rows the store holds.
|
|
105
|
+
const limits = itemLimits(field, list.rows.length);
|
|
106
|
+
const least = itemLimits(field, list.rows.length - heldIn(list.rows).size);
|
|
107
|
+
const prefix = idPrefix ?? uid;
|
|
108
|
+
// "+ Add": the new item opens, its first field takes the focus, so its words are typed at once. Armed with the count before the Add, so
|
|
109
|
+
// an Add the host refused (no new row) moves no focus later.
|
|
110
|
+
const focusFrom = useRef<number | null>(null);
|
|
111
|
+
useEffect(() => {
|
|
112
|
+
const from = focusFrom.current;
|
|
113
|
+
if (from === null) return;
|
|
114
|
+
focusFrom.current = null;
|
|
115
|
+
if (list.keys.length <= from) return;
|
|
116
|
+
const key = list.keys.at(-1), first = fields.find((f) => rowFieldEditable(list.rows.at(-1), f));
|
|
117
|
+
if (key && first) document.getElementById(`${prefix}-${key}-${first.id}`)?.focus();
|
|
118
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- once, after the Add's row is drawn
|
|
119
|
+
}, [list.keys]);
|
|
120
|
+
// AN ITEM PICKED ELSEWHERE (the canvas): its row opened, and the field that shows the part picked marked, as a picked part's field is
|
|
121
|
+
// everywhere in the editor (part-field-focus.ts): marked and in view, never taking the focus from where the seller is.
|
|
122
|
+
// Places: the shown list keeps unsaved rows where they are; the page's items are the stored list's. Item s of the store is the s-th
|
|
123
|
+
// row that is not held; a held row is no item.
|
|
124
|
+
const heldNow = heldIn(list.rows);
|
|
125
|
+
const shownOf = (s: number) => { let n = -1; for (let i = 0; i < list.rows.length; i++) if (!heldNow.has(i) && ++n === s) return i; return -1; };
|
|
126
|
+
const storedOf = (i: number) => (heldNow.has(i) ? null : [...Array(i).keys()].filter((j) => !heldNow.has(j)).length);
|
|
127
|
+
// The row the pick names, read ONCE per pick (its `seq`): moving, removing or adding rows afterwards does not open another one.
|
|
128
|
+
const asked = useRef<{ key: string; seq: number } | null>(null);
|
|
129
|
+
if (open && open.index >= 0 && asked.current?.seq !== open.seq) {
|
|
130
|
+
const key = list.keys[shownOf(open.index)];
|
|
131
|
+
if (key) asked.current = { key, seq: open.seq };
|
|
132
|
+
}
|
|
133
|
+
const openRequest = open && asked.current?.seq === open.seq ? asked.current : null;
|
|
134
|
+
useEffect(() => {
|
|
135
|
+
if (!openRequest || !open?.field) return;
|
|
136
|
+
const id = `${prefix}-${openRequest.key}-${open.field}`;
|
|
137
|
+
// The row opens in the list's own render after this one: its field is looked for a few frames.
|
|
138
|
+
let frame = 0, tries = 0;
|
|
139
|
+
const markIt = () => {
|
|
140
|
+
const fld = document.getElementById(id)?.closest<HTMLElement>(".gemboss-ei-fld");
|
|
141
|
+
if (!fld) { if (++tries < 20) frame = requestAnimationFrame(markIt); return; }
|
|
142
|
+
fld.closest(".gemboss-ei-rep")?.querySelectorAll("[data-canvas-focus]").forEach((el) => el.removeAttribute("data-canvas-focus"));
|
|
143
|
+
fld.setAttribute("data-canvas-focus", "");
|
|
144
|
+
fld.scrollIntoView?.({ block: "nearest" });
|
|
145
|
+
};
|
|
146
|
+
frame = requestAnimationFrame(markIt);
|
|
147
|
+
return () => cancelAnimationFrame(frame);
|
|
148
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- once per request
|
|
149
|
+
}, [openRequest]);
|
|
150
|
+
const draftNote = rowHolds ? list.rows.map((r, i) => rowHolds(r, i)).find((w): w is string => !!w) ?? null : null;
|
|
151
|
+
const noun = field.noun;
|
|
152
|
+
const listLabel = label ?? field.label ?? labelize(field.id);
|
|
153
|
+
const hint: ReactNode = field.hint || !limits.canAdd || draftNote ? <>
|
|
154
|
+
{field.hint || !limits.canAdd ? <p className="gemboss-ei-hint">{[limits.full, field.hint].filter(Boolean).join(" ")}</p> : null}
|
|
155
|
+
{draftNote ? <p className="gemboss-ei-hint" role="status" data-list-draft="">Not saved yet. {draftNote}</p> : null}
|
|
156
|
+
</> : undefined;
|
|
157
|
+
return (
|
|
158
|
+
<RepeaterList label={listLabel} hint={hint} keys={list.keys} disabled={disabled} item={noun} addLabel={field.addLabel ? `+ ${field.addLabel.replace(/^[++]\s*/, "")}` : undefined}
|
|
159
|
+
single touch={touch} canAdd={limits.canAdd} canRemove={least.canRemove} removeWhy={least.least ?? undefined}
|
|
160
|
+
rowAttrs={(i) => ({ "data-item-index": i })}
|
|
161
|
+
title={(i) => rowTitle(list.rows[i], field, fields).slice(0, 60)} thumb={(i) => rowThumb(list.rows[i], field, fields)}
|
|
162
|
+
onMove={list.move} onRemove={list.remove} onDuplicate={(i) => { if (limits.canAdd) list.duplicate(i); }}
|
|
163
|
+
onAdd={() => { if (!limits.canAdd) return; focusFrom.current = list.keys.length; list.add(starterRow(field, fields)); }}
|
|
164
|
+
onActive={onActive ? (i) => onActive(i === null ? null : storedOf(i)) : undefined} openRequest={openRequest}
|
|
165
|
+
body={(i) => {
|
|
166
|
+
const key = list.keys[i]!;
|
|
167
|
+
const row = list.rows[i];
|
|
168
|
+
const editable = fields.filter((f) => rowFieldEditable(row, f));
|
|
169
|
+
const kept = fields.filter((f) => !rowFieldEditable(row, f));
|
|
170
|
+
const values = rowValues(row, fields);
|
|
171
|
+
return <>
|
|
172
|
+
<FieldRows fields={editable} values={values} disabled={disabled} idPrefix={`${prefix}-${key}-`}
|
|
173
|
+
shopId={shopId} onPickImage={onPickImage} kinds={kinds} glyphs={glyphs}
|
|
174
|
+
// By the row's KEY, onto its latest version (useKeyedRows.patch): a field that commits late changes the right row after a move.
|
|
175
|
+
onChange={(id, v) => {
|
|
176
|
+
const f = fields.find((x) => x.id === id);
|
|
177
|
+
if (!f || sameValue(v, values[id])) return;
|
|
178
|
+
list.patch(key, (r) => withRowValue(r, f, v, fields) as never);
|
|
179
|
+
}} />
|
|
180
|
+
{/* A value this item's control cannot show (an object where words go): named and kept, never drawn as "[object Object]". */}
|
|
181
|
+
{kept.length ? <p className="gemboss-ei-hint" data-item-kept={kept.map((f) => f.id).join(" ")}>{kept.map((f) => f.label ?? labelize(f.id)).join(", ")}: kept as it is.</p> : null}
|
|
182
|
+
</>;
|
|
183
|
+
}} />
|
|
184
|
+
);
|
|
185
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
// A LIST'S ROWS, READ AND WRITTEN AS THEY ARE STORED (09/11/2026, the Items editor: Chris "one shared control set", every list setting
|
|
2
|
+
// draws the kit's ItemsField). What a row of a list setting is varies by who wrote it: an object of words (a benefit's heading and text),
|
|
3
|
+
// an object with keys this editor does not know (kept), a picture stored as an address or as `{ url, altText }` (a product's images), a
|
|
4
|
+
// plain string where the list is lines. The control edits one field of one row at a time, and a write must leave everything else of the
|
|
5
|
+
// row exactly as stored: page_40e6aa38's gallery lost its alt text and two pictures to a field that rebuilt the value (gemboss #7081).
|
|
6
|
+
//
|
|
7
|
+
// Pure, no React and no runtime import (only `import type`): a node test reads it as it is.
|
|
8
|
+
import type { FieldSpec, RowFieldSpec } from "./field-spec";
|
|
9
|
+
|
|
10
|
+
/** A list setting's spec (FieldSpec `repeater`). */
|
|
11
|
+
export type ItemsSpec = Extract<FieldSpec, { kind: "repeater" }>;
|
|
12
|
+
/** One field of a row: the kit's or an app's kind; `from` names older keys the same value is stored under (read from the first that holds
|
|
13
|
+
* one, written back where it was read). */
|
|
14
|
+
export type RowField = RowFieldSpec;
|
|
15
|
+
|
|
16
|
+
type Rec = Record<string, unknown>;
|
|
17
|
+
const isRecord = (v: unknown): v is Rec => !!v && typeof v === "object" && !Array.isArray(v);
|
|
18
|
+
/** Empty and unset are one value. */
|
|
19
|
+
export const blank = (v: unknown) => v === undefined || v === null || v === "";
|
|
20
|
+
|
|
21
|
+
/** The list a stored value holds: a list as it is, anything else none. */
|
|
22
|
+
export const storedRows = (value: unknown): unknown[] => (Array.isArray(value) ? value : []);
|
|
23
|
+
|
|
24
|
+
/** The fields a row has: the spec's `fields`, else its older `item` keys (a text box each, `long` a text area). */
|
|
25
|
+
export function rowFields(spec: ItemsSpec): RowField[] {
|
|
26
|
+
if (spec.fields?.length) return spec.fields as RowField[];
|
|
27
|
+
return spec.item.map((i): RowField => ({ kind: i.long ? "textarea" : "text", id: i.key, ...(i.label ? { label: i.label } : {}) }));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** The field a string row's words are: the first that holds words (text, a text area), else the first. */
|
|
31
|
+
const wordsField = (fields: readonly RowField[]) => fields.find((f) => f.kind === "text" || f.kind === "textarea") ?? fields[0];
|
|
32
|
+
|
|
33
|
+
/** The keys an image object keeps its address under, in the order a reader takes them (gemboss page-plan-sections mediaList). */
|
|
34
|
+
export const IMAGE_URL_KEYS = ["url", "src", "image", "image_url"] as const;
|
|
35
|
+
const urlKeyOf = (o: Rec) => IMAGE_URL_KEYS.find((k) => typeof o[k] === "string");
|
|
36
|
+
|
|
37
|
+
/** Where a field's value is stored in an object row: the first of its id and its older keys the row holds, else its id. */
|
|
38
|
+
const keyOf = (row: Rec, f: RowField) => [f.id, ...(f.from ?? [])].find((k) => Object.hasOwn(row, k) && !blank(row[k])) ?? f.id;
|
|
39
|
+
|
|
40
|
+
/** A field's value as its control shows it: a picture's address (whatever shape holds it), any other value as stored. */
|
|
41
|
+
function shown(f: RowField, v: unknown): unknown {
|
|
42
|
+
if (f.kind !== "image") return v;
|
|
43
|
+
if (typeof v === "string") return v;
|
|
44
|
+
if (isRecord(v)) { const k = urlKeyOf(v); return k ? v[k] : ""; }
|
|
45
|
+
if (Array.isArray(v)) return shown(f, v.find((x) => !blank(shown(f, x))));
|
|
46
|
+
return "";
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** A row's values by field id, as its controls show them. */
|
|
50
|
+
export function rowValues(row: unknown, fields: readonly RowField[]): Rec {
|
|
51
|
+
if (typeof row === "string") { const w = wordsField(fields); return w ? { [w.id]: row } : {}; }
|
|
52
|
+
if (!isRecord(row)) return {};
|
|
53
|
+
return Object.fromEntries(fields.map((f) => [f.id, shown(f, row[keyOf(row, f)])]));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** Kinds whose control writes a plain value (words, a number, a choice, on / off, a colour, a link). An object there is a value the control
|
|
57
|
+
* cannot show: drawn as text it read "[object Object]", and a save stored those words over it (#7081). */
|
|
58
|
+
const PLAIN = (v: unknown) => v === undefined || v === null || typeof v === "string" || typeof v === "number" || typeof v === "boolean";
|
|
59
|
+
|
|
60
|
+
/** Whether a field of this row can be edited with its control without losing what is stored: a plain value, or a picture's address. */
|
|
61
|
+
export function rowFieldEditable(row: unknown, f: RowField): boolean {
|
|
62
|
+
if (typeof row === "string" || !isRecord(row)) return true;
|
|
63
|
+
const v = row[keyOf(row, f)];
|
|
64
|
+
if (f.kind === "image") return PLAIN(v) || (isRecord(v) && (urlKeyOf(v) !== undefined || !IMAGE_URL_KEYS.some((k) => k in v)));
|
|
65
|
+
return PLAIN(v);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* The row with one field changed, everything else as stored:
|
|
70
|
+
* · an object keeps every other key, the field written under the key it was read from (an older name stays that name);
|
|
71
|
+
* · a picture stored as an object keeps its alt text and the rest, the address written under the key it was read from (`url` else);
|
|
72
|
+
* · a string row stays a string while it is the words that change; another field turns it into an object holding both;
|
|
73
|
+
* · emptying a field the row does not hold changes nothing (empty and unset are one value).
|
|
74
|
+
*/
|
|
75
|
+
export function withRowValue(row: unknown, f: RowField, value: unknown, fields: readonly RowField[]): unknown {
|
|
76
|
+
if (typeof row === "string") {
|
|
77
|
+
const w = wordsField(fields);
|
|
78
|
+
if (w && f.id === w.id) return value === undefined || value === null ? "" : typeof value === "string" ? value : String(value);
|
|
79
|
+
if (blank(value)) return row;
|
|
80
|
+
return w ? { [w.id]: row, [f.id]: value } : { [f.id]: value };
|
|
81
|
+
}
|
|
82
|
+
const base: Rec = isRecord(row) ? row : {};
|
|
83
|
+
const key = keyOf(base, f);
|
|
84
|
+
if (blank(value) && !Object.hasOwn(base, key)) return row;
|
|
85
|
+
const was = base[key];
|
|
86
|
+
if (f.kind === "image" && isRecord(was)) return { ...base, [key]: { ...was, [urlKeyOf(was) ?? "url"]: value } };
|
|
87
|
+
return { ...base, [key]: value };
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** A row's name in the list: its `title` field's words, else the first words it holds. Never an object's text. */
|
|
91
|
+
export function rowTitle(row: unknown, spec: ItemsSpec, fields: readonly RowField[] = rowFields(spec)): string {
|
|
92
|
+
const values = rowValues(row, fields);
|
|
93
|
+
const words = (id: string | undefined) => { const v = id ? values[id] : undefined; return typeof v === "string" ? v.trim() : typeof v === "number" ? String(v) : ""; };
|
|
94
|
+
const own = words(spec.title);
|
|
95
|
+
if (own) return own;
|
|
96
|
+
// Words first: a review's "5" (its rating) is no name when its title is there.
|
|
97
|
+
const wordy = fields.filter((f) => f.kind === "text" || f.kind === "textarea").map((f) => words(f.id)).filter(Boolean);
|
|
98
|
+
return wordy.find((w) => /\p{L}/u.test(w)) ?? wordy[0] ?? "";
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** A row's picture in the list: its `thumb` field, else its first picture. */
|
|
102
|
+
export function rowThumb(row: unknown, spec: ItemsSpec, fields: readonly RowField[] = rowFields(spec)): string | undefined {
|
|
103
|
+
const values = rowValues(row, fields);
|
|
104
|
+
const id = spec.thumb ?? fields.find((f) => f.kind === "image")?.id;
|
|
105
|
+
const v = id ? values[id] : undefined;
|
|
106
|
+
return typeof v === "string" && /^(https?:)?\/\//.test(v.trim()) ? v.trim() : undefined;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/** The row "+ Add" puts in: the spec's `starter` (a copy), else every field empty (what the list always added). */
|
|
110
|
+
export function starterRow(spec: ItemsSpec, fields: readonly RowField[] = rowFields(spec)): unknown {
|
|
111
|
+
if (spec.starter !== undefined) return JSON.parse(JSON.stringify(spec.starter));
|
|
112
|
+
return Object.fromEntries(fields.map((f) => [f.id, ""]));
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** What the list's bounds allow with `count` rows, and why a button is off: a full list takes no more (Add, Duplicate), one at its least
|
|
116
|
+
* loses none (Remove). A bound the spec does not set is none. */
|
|
117
|
+
export function itemLimits(spec: Pick<ItemsSpec, "min" | "max">, count: number): { canAdd: boolean; full: string | null; canRemove: boolean; least: string | null } {
|
|
118
|
+
const max = typeof spec.max === "number" && spec.max > 0 ? Math.floor(spec.max) : Infinity;
|
|
119
|
+
const min = typeof spec.min === "number" && spec.min > 0 ? Math.floor(spec.min) : 0;
|
|
120
|
+
const canAdd = count < max;
|
|
121
|
+
const canRemove = count > min;
|
|
122
|
+
return {
|
|
123
|
+
canAdd, full: canAdd ? null : `Holds at most ${max} ${max === 1 ? "item" : "items"}.`,
|
|
124
|
+
canRemove, least: canRemove ? null : `Needs at least ${min} ${min === 1 ? "item" : "items"}.`,
|
|
125
|
+
};
|
|
126
|
+
}
|
package/src/editor/label-side.ts
CHANGED
|
@@ -60,7 +60,8 @@ export const LABEL_SIDE = {
|
|
|
60
60
|
gradient: "above",
|
|
61
61
|
/** A shape drawn on a picture (a print area). */
|
|
62
62
|
drawing: "above",
|
|
63
|
-
/** A line of code (a condition's expression)
|
|
63
|
+
/** A line of code (a condition's expression), or a CSS value that runs long (a text field's `code`: a font stack, a border): it reads
|
|
64
|
+
* whole across the field, wrapping, not cut in the control column. */
|
|
64
65
|
code: "above",
|
|
65
66
|
/** A sentence in place of a control: a value filled from elsewhere (the section's copy, a product's metafield, a list's content
|
|
66
67
|
* source), or a setting edited in another place. A sentence reads across the field; beside, it is four lines in the control column. */
|
package/src/editor/repeater.tsx
CHANGED
|
@@ -76,7 +76,7 @@ export type KeyedChange = { from: number[]; was: number };
|
|
|
76
76
|
/** A list's text with each object's keys in one order. The store may answer a row in its own spelling (Postgres JSONB orders an
|
|
77
77
|
* object's keys by length), and that is still our write coming back: read as a change from elsewhere, it dropped the newer
|
|
78
78
|
* write still on its way, so of two quick Adds one was lost (the page editor's elements fold, 07/11/2026). */
|
|
79
|
-
const spelled = (value: unknown): string => JSON.stringify(value, (_key, v: unknown) => v && typeof v === "object" && !Array.isArray(v)
|
|
79
|
+
export const spelled = (value: unknown): string => JSON.stringify(value, (_key, v: unknown) => v && typeof v === "object" && !Array.isArray(v)
|
|
80
80
|
? Object.fromEntries(Object.keys(v).sort().map((k) => [k, (v as Record<string, unknown>)[k]])) : v);
|
|
81
81
|
export function useKeyedRows<T>(value: readonly T[], commit: (next: T[], how: KeyedChange) => false | void | PromiseLike<unknown>): KeyedRows<T> {
|
|
82
82
|
const [state, setState] = useState(() => ({ rows: value.slice(), keys: value.map(() => freshKey()) }));
|
|
@@ -210,11 +210,19 @@ export interface RepeaterListProps {
|
|
|
210
210
|
editIn?: "inline" | "popover";
|
|
211
211
|
/** Popover mode: the row picked (null when none), so the host can show that item. */
|
|
212
212
|
onActive?: (index: number | null) => void;
|
|
213
|
+
/** Inline: one row open at a time (the Items control, items-field.tsx): opening one folds the one open, and a row that arrives opens
|
|
214
|
+
* alone; `onActive` hears each row opened (its index) and the open one folded (null). Default: each row folds on its own. */
|
|
215
|
+
single?: boolean;
|
|
216
|
+
/** Open this row from outside (an item picked on the canvas), brought into view; a new `seq` asks again for the same row. Inline. */
|
|
217
|
+
openRequest?: { key: string; seq: number } | null;
|
|
218
|
+
/** False: Remove is off, its reason beside it (`removeWhy`: a list at its fewest rows). */
|
|
219
|
+
canRemove?: boolean;
|
|
220
|
+
removeWhy?: string;
|
|
213
221
|
}
|
|
214
222
|
|
|
215
223
|
|
|
216
224
|
/** `.gemboss-ei-fld.gemboss-ei-rep` › label (+ count) › `.gemboss-ei-rep-list` › one `.gemboss-ei-rep-item` per row › add. */
|
|
217
|
-
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) {
|
|
225
|
+
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, single = false, openRequest = null, canRemove = true, removeWhy }: RepeaterListProps) {
|
|
218
226
|
// A row by its number: "Question 3" / "question 3" with `item`, else "Item 3" / "Plans item 3".
|
|
219
227
|
const nth = (i: number) => (item ? `${item.charAt(0).toUpperCase()}${item.slice(1)} ${i + 1}` : `Item ${i + 1}`);
|
|
220
228
|
const ofRow = (i: number) => (item ? `${item} ${i + 1}` : `${label} item ${i + 1}`);
|
|
@@ -234,14 +242,36 @@ export function RepeaterList({ label, hint, keys, title, body, onMove, onRemove,
|
|
|
234
242
|
const [open, setOpen] = useState<ReadonlySet<string>>(() => new Set(keys.length <= 1 ? keys : []));
|
|
235
243
|
// A row that arrives after the list was drawn opens. Compared by content: a caller may hand a new array each render.
|
|
236
244
|
const [seen, setSeen] = useState<readonly string[]>(keys);
|
|
245
|
+
// With `single`: a row that opened by itself (added, duplicated) is heard as a row opened, once it is drawn.
|
|
246
|
+
const freshOpened = useRef<string | null>(null);
|
|
247
|
+
useEffect(() => {
|
|
248
|
+
const key = freshOpened.current;
|
|
249
|
+
if (key === null) return;
|
|
250
|
+
freshOpened.current = null;
|
|
251
|
+
if (keys.includes(key)) onActive?.(keys.indexOf(key));
|
|
252
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- once per row that opened
|
|
253
|
+
}, [keys]);
|
|
237
254
|
if (seen.join("\n") !== keys.join("\n")) {
|
|
238
255
|
const fresh = keys.filter((k) => !seen.includes(k));
|
|
239
256
|
setSeen(keys);
|
|
240
|
-
if (fresh.length)
|
|
257
|
+
if (fresh.length) {
|
|
258
|
+
setOpen((o) => (single ? new Set([fresh.at(-1)!]) : new Set([...o, ...fresh])));
|
|
259
|
+
if (single) freshOpened.current = fresh.at(-1)!;
|
|
260
|
+
}
|
|
241
261
|
}
|
|
242
|
-
const toggle = (key: string) =>
|
|
243
|
-
|
|
244
|
-
|
|
262
|
+
const toggle = (key: string) => {
|
|
263
|
+
if (popover) { pick(activeKey === key ? null : key); return; }
|
|
264
|
+
const opening = !open.has(key);
|
|
265
|
+
setOpen((o) => { if (single) return o.has(key) ? new Set() : new Set([key]); const next = new Set(o); if (!next.delete(key)) next.add(key); return next; });
|
|
266
|
+
if (single) onActive?.(opening ? keys.indexOf(key) : null);
|
|
267
|
+
};
|
|
268
|
+
// A row asked open from outside: it alone (single), brought into view. Not heard back through onActive (the host asked for it).
|
|
269
|
+
useEffect(() => {
|
|
270
|
+
if (!openRequest || popover || !keys.includes(openRequest.key)) return;
|
|
271
|
+
setOpen((o) => (single ? new Set([openRequest.key]) : new Set([...o, openRequest.key])));
|
|
272
|
+
requestAnimationFrame(() => ([...(listRef.current?.children ?? [])] as HTMLElement[]).find((r) => r.dataset.key === openRequest.key)?.scrollIntoView?.({ block: "nearest" }));
|
|
273
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- once per request
|
|
274
|
+
}, [openRequest?.seq, openRequest?.key]);
|
|
245
275
|
const drag = useRowDrag(keys, onMove ?? (() => {}));
|
|
246
276
|
// WHERE THE FOCUS GOES once the rows have changed. A row moved by Alt+↑ / ↓ keeps it on its name (as SortableLayerList). A
|
|
247
277
|
// 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
|
|
@@ -352,7 +382,7 @@ export function RepeaterList({ label, hint, keys, title, body, onMove, onRemove,
|
|
|
352
382
|
</> : null}
|
|
353
383
|
{/* A list at its limit: the row says why it is off (§13: a locked control says its reason). */}
|
|
354
384
|
{onDuplicate ? <MenuItem disabled={!canAdd} hint={canAdd ? undefined : "List is full"} onClick={() => onDuplicate(i)}>Duplicate</MenuItem> : null}
|
|
355
|
-
{onRemove ? <MenuItem danger onClick={() => { arm({ gone: key, to: keys[i + 1] ?? keys[i - 1] ?? null }); onRemove(i); }}>Remove</MenuItem> : null}
|
|
385
|
+
{onRemove ? <MenuItem danger disabled={!canRemove} hint={canRemove ? undefined : removeWhy} onClick={() => { arm({ gone: key, to: keys[i + 1] ?? keys[i - 1] ?? null }); onRemove(i); }}>Remove</MenuItem> : null}
|
|
356
386
|
</Menu>
|
|
357
387
|
</span>
|
|
358
388
|
) : null}
|
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
// or a raw input, each with its own words for "it is stored"). One box for an API token, a private key, an access token:
|
|
4
4
|
// · typed or pasted (Paste reads the clipboard), masked, with Show / Hide for checking what was pasted;
|
|
5
5
|
// · never copied or dragged out of the box (copy, cut and a drag do nothing): a secret goes in, it does not come back out;
|
|
6
|
-
// · autocomplete
|
|
7
|
-
//
|
|
6
|
+
// · autocomplete="new-password" (09/11/2026, was "off"): Chrome ignores "off" on a password box and fills a saved login into it, so a
|
|
7
|
+
// seller's admin.gemboss.ai password could be saved as a partner's key and sent to that partner; "new-password" is the one value it
|
|
8
|
+
// never fills (Chrome may offer to suggest a password: a nuisance, not a leak). 1Password / LastPass are told to stay out. A browser
|
|
9
|
+
// may still offer to SAVE what was typed, which no attribute reliably stops. password-autocomplete.test.tsx holds both;
|
|
8
10
|
// · once stored, the box is gone and the field says "Saved", with the last characters when the host knows them, never the secret itself
|
|
9
11
|
// (the host hands only its tail; the kit keeps four characters of it at most). Replace opens an empty box; Cancel closes it.
|
|
10
12
|
// Its label is beside the box (the label-side table: `secret`), the box and its two buttons in the control column, the buttons under the box
|
|
@@ -96,7 +98,7 @@ export function SecretField({ id, label, labelHidden = false, value, onChange, o
|
|
|
96
98
|
<Field label={named} htmlFor={id} control="secret" hint={hint}>
|
|
97
99
|
<div className="gemboss-ei-secret">
|
|
98
100
|
<input id={id} className="gemboss-field gemboss-ei-inp gemboss-ei-secret-box" type={shown ? "text" : "password"} value={value} disabled={disabled}
|
|
99
|
-
placeholder={placeholder} aria-label={labelHidden ? label : undefined} autoComplete="
|
|
101
|
+
placeholder={placeholder} aria-label={labelHidden ? label : undefined} autoComplete="new-password" autoCapitalize="off" autoCorrect="off" spellCheck={false}
|
|
100
102
|
data-1p-ignore="" data-lpignore="true" onCopy={noCopy} onCut={noCopy} onDragStart={noDrag}
|
|
101
103
|
onChange={(e) => { setPasteRefused(false); onChange(e.target.value); }}
|
|
102
104
|
onKeyDown={(e: KeyboardEvent<HTMLInputElement>) => { if (e.key === "Enter" && onSubmit) { e.preventDefault(); onSubmit(); } }} />
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
// ON / OFF IN PLACE: the kit's Switch. Its own part (`editor-switch.css`): only a surface that draws a switch loads it (editor.css sits at
|
|
3
|
+
// its weight ceiling).
|
|
4
|
+
import "../editor-switch.css";
|
|
5
|
+
import type { ReactNode } from "react";
|
|
6
|
+
|
|
7
|
+
export interface SwitchProps {
|
|
8
|
+
/** Its words, beside the track (the box and its words are one control); a `ui-sr-only` span where the place already says it. */
|
|
9
|
+
label: ReactNode;
|
|
10
|
+
checked: boolean;
|
|
11
|
+
onChange: (on: boolean) => void;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
id?: string;
|
|
14
|
+
describedBy?: string;
|
|
15
|
+
/** Why it is off, while it is (`disabled`): in its tooltip. */
|
|
16
|
+
why?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* ON / OFF IN PLACE (09/11/2026, one control set): a switch that applies at once where a field's On / Off pair does not fit, a part's
|
|
21
|
+
* switch on the cart canvas's tag. The plain kit's `.ui-switch` (a checkbox with `role="switch"`, track 32×20, thumb 16, the accent
|
|
22
|
+
* when on), drawn for a host that cannot load kit-plain.css (the admin): `.gemboss-ei-switch` in its own entry, editor-switch.css, carries its numbers. Its
|
|
23
|
+
* row is a 44px target under a finger and at least 24px under a mouse (Gems/CLAUDE.md §9.1), so it sits in a 32px tag. A setting in a
|
|
24
|
+
* settings panel stays FieldControl's `toggle`.
|
|
25
|
+
*/
|
|
26
|
+
export function Switch({ label, checked, onChange, disabled, id, describedBy, why }: SwitchProps) {
|
|
27
|
+
return (
|
|
28
|
+
<label className="gemboss-ei-switch" data-disabled={disabled ? "" : undefined} title={disabled && why ? why : undefined}>
|
|
29
|
+
<input type="checkbox" role="switch" className="gemboss-ei-switch-input" id={id} checked={checked} disabled={disabled}
|
|
30
|
+
aria-describedby={describedBy} onChange={(e) => onChange(e.target.checked)} />
|
|
31
|
+
<span className="gemboss-ei-check-words">{label}</span>
|
|
32
|
+
</label>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
textarea.gemboss-field.gemboss-ei-grow{resize:none;overflow:hidden;field-sizing:content}textarea.gemboss-field.gemboss-ei-code-line{overflow-wrap:anywhere}
|
package/src/editor-insert.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.gemboss-editor-insert{position:fixed;z-index:500;display:flex;gap:8px;align-items:flex-start}.gemboss-editor-insert--flip{flex-direction:row-reverse}.gemboss-editor-insert-main{width:300px;padding:8px;display:flex;flex-direction:column;gap:6px;max-height:min(440px,calc(100vh - 32px))}
|
|
1
|
+
.gemboss-editor-insert{position:fixed;z-index:500;display:flex;gap:8px;align-items:flex-start}.gemboss-editor-insert--flip{flex-direction:row-reverse}.gemboss-editor-insert-main{width:300px;padding:8px;display:flex;flex-direction:column;gap:6px;max-height:min(440px,calc(100vh - 32px))}.gemboss-editor-insert-main>:not(.gemboss-editor-insert-list){flex:none}.gemboss-editor-insert-place{margin:0;padding:0 4px;font-size:var(--gemboss-fs-caption);color:var(--gemboss-text-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.gemboss-editor-insert-list{flex:1;min-height:0;overflow-y:auto;display:flex;flex-direction:column;gap:1px;scrollbar-width:thin;scrollbar-color:rgba(31,30,29,.22) transparent}.gemboss-editor-insert-group{margin:0;padding:8px 8px 4px;font-size:var(--gemboss-fs-caption);font-weight:600;color:var(--gemboss-text-muted);text-transform:uppercase;letter-spacing:.04em}.gemboss-editor-insert-row{flex:none;display:flex;flex-direction:column;gap:0;box-sizing:border-box;min-height:32px;justify-content:center;padding:6px 8px;border-radius:var(--gemboss-radius-md);cursor:pointer}.gemboss-editor-insert-row[aria-selected=true]{background:var(--gemboss-hover, rgba(0,0,0,.05))}.gemboss-editor-insert-row[aria-disabled=true]{cursor:not-allowed;color:var(--gemboss-text-muted)}.gemboss-editor-insert-name{font-size:var(--gemboss-fs-body);color:inherit}.gemboss-editor-insert-ask .gemboss-editor-insert-name{color:var(--gemboss-accent);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.gemboss-editor-insert-ask[aria-selected=true]{background:var(--gemboss-accent-wash, var(--gemboss-hover))}.gemboss-editor-insert-about{display:none;font-size:var(--gemboss-fs-caption);color:var(--gemboss-text-muted)}.gemboss-editor-insert-row[aria-disabled=true] .gemboss-editor-insert-about{display:block}.gemboss-editor-insert-empty{margin:0;padding:12px 8px;font-size:var(--gemboss-fs-body);color:var(--gemboss-text-muted)}.gemboss-editor-insert-section{flex:none;width:100%;min-height:32px;box-sizing:border-box;padding:6px 8px;border:0;border-top:1px solid var(--gemboss-divider);border-radius:0;background:transparent;text-align:left;cursor:pointer;font:inherit;font-size:var(--gemboss-fs-body);color:var(--gemboss-text)}.gemboss-editor-insert-section:hover,.gemboss-editor-insert-section:focus-visible{background:var(--gemboss-hover, rgba(0,0,0,.05));outline:none}@media (pointer: coarse),(max-width: 47.9975em){.gemboss-editor-insert-section{min-height:44px}}.gemboss-editor-insert-keys{margin:0;padding:4px 4px 0;border-top:1px solid var(--gemboss-divider);font-size:var(--gemboss-fs-caption);color:var(--gemboss-text-muted)}.gemboss-editor-insert-back{align-self:flex-start;min-height:24px;padding:2px 4px;border:0;border-radius:var(--gemboss-radius-md);background:transparent;font:inherit;font-size:var(--gemboss-fs-caption);color:var(--gemboss-text-muted);cursor:pointer}.gemboss-editor-insert-back:hover,.gemboss-editor-insert-back:focus-visible{background:var(--gemboss-hover, rgba(0,0,0,.05));outline:none}.gemboss-editor-insert-row--item{flex-direction:row;align-items:center;justify-content:flex-start;gap:8px}.gemboss-editor-insert-text{display:flex;flex-direction:column;min-width:0}.gemboss-editor-insert-list[aria-busy=true] .gemboss-editor-insert-row--item{opacity:.6}.gemboss-editor-insert-row--item .gemboss-editor-insert-name{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.gemboss-editor-insert-thumb{flex:none;width:24px;height:24px;border-radius:4px;object-fit:cover;background:var(--gemboss-divider)}.gemboss-editor-insert-peek-photo{display:block;width:100%;height:120px;object-fit:contain;border-radius:var(--gemboss-radius-md);background:var(--gemboss-hover, rgba(0,0,0,.04))}.gemboss-editor-insert-peek{width:220px;padding:12px;display:flex;flex-direction:column;gap:4px}.gemboss-editor-insert-peek p{margin:0}.gemboss-editor-insert-peek-pic{display:block;width:100%;height:auto;max-height:150px;object-fit:contain;object-position:top center;border:1px solid var(--gemboss-divider);border-radius:var(--gemboss-radius-md);background:var(--gemboss-surface, #fff)}.gemboss-editor-insert-peek-name{font-size:var(--gemboss-fs-body);font-weight:600;color:var(--gemboss-text)}.gemboss-editor-insert-peek-about,.gemboss-editor-insert-peek-place{font-size:var(--gemboss-fs-caption);color:var(--gemboss-text-muted)}.gemboss-editor-insert-peek-why{font-size:var(--gemboss-fs-caption);color:var(--gemboss-warning)}@media (pointer: coarse),(max-width: 47.9975em){.gemboss-editor-insert-row,.gemboss-editor-insert-back{min-height:44px}.gemboss-editor-insert-about{display:block}.gemboss-editor-insert-peek{display:none}}.gemboss-editor-insert--sheet{inset:auto 16px 16px}.gemboss-editor-insert--sheet .gemboss-editor-insert-main{width:100%;max-height:70vh}
|
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;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}
|
|
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}.gemboss-ei-rep-body .gemboss-ei-fld[data-canvas-focus]{outline:2px solid var(--ui-focus,#5661f5);outline-offset:4px;border-radius:6px}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.gemboss-ei-switch .gemboss-ei-check-words{min-width:0}.gemboss-ei-switch{display:inline-flex;align-items:center;gap:8px;min-height:24px;max-width:100%;cursor:pointer;color:inherit}.gemboss-ei-switch[data-disabled]{opacity:.5;cursor:not-allowed}@media (pointer:coarse),(max-width:47.9975em){.gemboss-ei-switch{min-height:44px}}.gemboss-ei-switch-input{appearance:none;-webkit-appearance:none;flex:none;position:relative;width:32px;height:20px;margin:0;border-radius:var(--gemboss-radius-full);background:var(--gemboss-field-line);cursor:inherit;transition:background-color var(--gemboss-transition-fast) ease}.gemboss-ei-switch-input:before{content:"";position:absolute;top:2px;left:2px;width:16px;height:16px;border-radius:50%;background:var(--gemboss-surface);box-shadow:0 1px 2px #0003;transition:transform var(--gemboss-transition-fast) ease}.gemboss-ei-switch-input:checked{background:var(--ui-accent,#1b1c1e)}.gemboss-ei-switch-input:checked:before{transform:translate(12px)}.gemboss-ei-switch-input:focus-visible{outline:2px solid var(--ui-focus,currentColor);outline-offset:2px}@media (prefers-reduced-motion:reduce){.gemboss-ei-switch-input,.gemboss-ei-switch-input:before{transition:none}}
|