@gemboss/ui 0.57.0 → 0.58.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -46,7 +46,8 @@ export interface KeyedRows<T> {
46
46
  /** A copy right after it, with a key of its own. */
47
47
  duplicate: (index: number) => void;
48
48
  remove: (index: number) => void;
49
- add: (row: T) => void;
49
+ /** Rows at the end, in ONE write: several added together are one save, so one step to undo (a picker's "Add 3 products"). */
50
+ add: (...rows: T[]) => void;
50
51
  /**
51
52
  * Change the row with this KEY, from its latest version: `change` gets the row as it is now, not as it was when the field
52
53
  * was drawn. A control that commits late (a colour or a slider holds its write 250 ms, and flushes it when it unmounts)
@@ -66,8 +67,12 @@ export interface KeyedRows<T> {
66
67
  * shown (review of #4506: a row added to an unset list vanished).
67
68
  * · a stored list equal to one of our writes is that write coming back: what is shown (maybe newer) stays; any other is a
68
69
  * change from elsewhere (an undo, the chat) and replaces it, the keys kept by position.
70
+ * · `commit` is told where each row came from (`how.from[i]`: the place row i had in the list before this change, -1 for a new
71
+ * one; a duplicate names its original) and how many rows there were (`how.was`), so a host that keeps something per row (a
72
+ * tab's column of elements, Control UI C41) moves it with the row instead of guessing from the rows' words.
69
73
  */
70
- export function useKeyedRows<T>(value: readonly T[], commit: (next: T[]) => false | void | PromiseLike<unknown>): KeyedRows<T> {
74
+ export type KeyedChange = { from: number[]; was: number };
75
+ export function useKeyedRows<T>(value: readonly T[], commit: (next: T[], how: KeyedChange) => false | void | PromiseLike<unknown>): KeyedRows<T> {
71
76
  const [state, setState] = useState(() => ({ rows: value.slice(), keys: value.map(() => freshKey()) }));
72
77
  const latest = useRef(state);
73
78
  latest.current = state;
@@ -100,13 +105,13 @@ export function useKeyedRows<T>(value: readonly T[], commit: (next: T[]) => fals
100
105
  latest.current = { rows: stored.current.rows.slice(), keys: stored.current.keys.slice() };
101
106
  setState(latest.current);
102
107
  };
103
- const write = (rows: T[], keys: string[]) => {
108
+ const write = (rows: T[], keys: string[], from: number[]) => {
104
109
  const before = latest.current, previousWrite = writes.current;
105
110
  const n = ++writeSequence.current; writes.current = n;
106
111
  pending.current.push({ n, json: JSON.stringify(rows), keys });
107
112
  latest.current = { rows, keys };
108
113
  setState(latest.current);
109
- const answer = commit(rows);
114
+ const answer = commit(rows, { from, was: before.rows.length });
110
115
  if (answer === false) {
111
116
  pending.current = pending.current.filter((p) => p.n !== n);
112
117
  if (n !== writes.current) return; // a reentrant newer write still decides
@@ -126,27 +131,32 @@ export function useKeyedRows<T>(value: readonly T[], commit: (next: T[]) => fals
126
131
  move: (from, to) => {
127
132
  const { rows, keys } = latest.current;
128
133
  if (from === to || to < 0 || to >= rows.length) return;
129
- const r = splice(rows, from, 1), k = splice(keys, from, 1);
130
- write(splice(r, to, 0, rows[from]!), splice(k, to, 0, keys[from]!));
134
+ const places = rows.map((_, n) => n);
135
+ const r = splice(rows, from, 1), k = splice(keys, from, 1), p = splice(places, from, 1);
136
+ write(splice(r, to, 0, rows[from]!), splice(k, to, 0, keys[from]!), splice(p, to, 0, from));
131
137
  },
132
138
  duplicate: (index) => {
133
139
  const { rows, keys } = latest.current;
134
140
  if (index < 0 || index >= rows.length) return;
135
- write(splice(rows, index + 1, 0, JSON.parse(JSON.stringify(rows[index])) as T), splice(keys, index + 1, 0, freshKey()));
141
+ write(splice(rows, index + 1, 0, JSON.parse(JSON.stringify(rows[index])) as T), splice(keys, index + 1, 0, freshKey()), splice(rows.map((_, n) => n), index + 1, 0, index));
136
142
  },
137
143
  remove: (index) => {
138
144
  const { rows, keys } = latest.current;
139
145
  if (index < 0 || index >= rows.length) return;
140
- write(rows.filter((_, n) => n !== index), keys.filter((_, n) => n !== index));
146
+ write(rows.filter((_, n) => n !== index), keys.filter((_, n) => n !== index), rows.map((_, n) => n).filter((n) => n !== index));
147
+ },
148
+ add: (...added) => {
149
+ if (!added.length) return;
150
+ const { rows, keys } = latest.current;
151
+ write([...rows, ...added], [...keys, ...added.map(() => freshKey())], [...rows.map((_, n) => n), ...added.map(() => -1)]);
141
152
  },
142
- add: (row) => { const { rows, keys } = latest.current; write([...rows, row], [...keys, freshKey()]); },
143
153
  patch: (key, change) => {
144
154
  const { rows, keys } = latest.current;
145
155
  const at = keys.indexOf(key);
146
156
  if (at < 0) return;
147
157
  const next = change(rows[at]!);
148
158
  if (JSON.stringify(next) === JSON.stringify(rows[at])) return;
149
- write(rows.map((r, n) => (n === at ? next : r)), keys.slice());
159
+ write(rows.map((r, n) => (n === at ? next : r)), keys.slice(), rows.map((_, n) => n));
150
160
  },
151
161
  };
152
162
  }
@@ -160,8 +170,10 @@ export interface RepeaterListProps {
160
170
  keys: readonly string[];
161
171
  /** A row's name in its header (its first field); empty says "Item N". */
162
172
  title: (index: number) => string;
163
- /** A row's controls, drawn while it is open. */
164
- body: (index: number) => React.ReactNode;
173
+ /** A row's controls, drawn while it is open. `close` puts the row's layer away (popover mode; inline, the row stays open): a control
174
+ * that opens something of the host's, not in the top layer (the insert menu a tab's "Add element" opens), does it first, or that
175
+ * menu is drawn under the layer. */
176
+ body: (index: number, close: () => void) => React.ReactNode;
165
177
  /** `to` is the index after the move. Absent: the rows keep their order (no grip, no ↑ ↓, no Alt+arrows): a list whose order
166
178
  * is kept elsewhere (items read from Content, in Content's order). */
167
179
  onMove?: (from: number, to: number) => void;
@@ -339,7 +351,7 @@ export function RepeaterList({ label, hint, keys, title, body, onMove, onRemove,
339
351
  </span>
340
352
  ) : null}
341
353
  </div>
342
- {isOpen ? <div id={bodyId} className="gemboss-ei-rep-body" role="group" aria-label={name}>{body(i)}</div> : null}
354
+ {isOpen ? <div id={bodyId} className="gemboss-ei-rep-body" role="group" aria-label={name}>{body(i, () => {})}</div> : null}
343
355
  </div>
344
356
  );
345
357
  })}
@@ -358,7 +370,7 @@ export function RepeaterList({ label, hint, keys, title, body, onMove, onRemove,
358
370
  <span className="gemboss-ei-rep-popat">{i + 1} / {keys.length}</span>
359
371
  <button type="button" aria-label={`Close ${name}`} onClick={closeLayer}>✕</button>
360
372
  </div>
361
- {body(i)}
373
+ {body(i, () => pick(null))}
362
374
  </div>
363
375
  );
364
376
  })() : null}
@@ -181,6 +181,87 @@ export function themeColorChoices(palette: Readonly<Record<string, string>> | nu
181
181
  .map((t) => ({ value: `var(--gem-color-${t})`, label: TOKEN_NAMES[t]!, swatch: palette[t]!.trim() }));
182
182
  }
183
183
 
184
+ /** One side of an sRGB `color-mix` as written, and the share of the mix it makes (0–100). */
185
+ export type MixPart = { color: string; share: number };
186
+ /**
187
+ * The two sides of an sRGB `color-mix`, each with its share, as CSS reads them: a share written before or after the colour, on one side
188
+ * (the other is the rest) or on both when they make 100, none for half each; `weighted` when a share is written. Null for anything
189
+ * else, shares that do not make 100 among it (CSS changes the alpha then). The one reading of these rules: the colour box names and
190
+ * paints with it (`mixOf`), and the admin's gradient Add reads a mix down to its colours with it (gradient-value.ts).
191
+ */
192
+ export function mixSides(value: string): { parts: [MixPart, MixPart]; weighted: boolean } | null {
193
+ const m = /^color-mix\(\s*in\s+srgb\s*,\s*(.+)\)$/i.exec(value.trim());
194
+ if (!m) return null;
195
+ let depth = 0, cut = -1;
196
+ for (let i = 0; i < m[1]!.length; i++) {
197
+ const ch = m[1]![i];
198
+ if (ch === "(") depth++;
199
+ else if (ch === ")") { if (--depth < 0) return null; }
200
+ else if (ch === "," && depth === 0) { if (cut >= 0) return null; cut = i; }
201
+ }
202
+ if (cut < 0 || depth !== 0) return null;
203
+ const side = (raw: string) => {
204
+ const t = raw.trim();
205
+ const after = /^(.+?)\s+(\d+(?:\.\d+)?)%$/.exec(t), before = /^(\d+(?:\.\d+)?)%\s+(.+)$/.exec(t);
206
+ if (after && before) return null;
207
+ return after ? { color: after[1]!, share: Number(after[2]) } : before ? { color: before[2]!, share: Number(before[1]) } : { color: t, share: null };
208
+ };
209
+ const a = side(m[1]!.slice(0, cut)), b = side(m[1]!.slice(cut + 1));
210
+ if (!a || !b || !a.color || !b.color) return null;
211
+ const sa = a.share ?? (b.share !== null ? 100 - b.share : 50), sb = b.share ?? 100 - sa;
212
+ if (Math.abs(sa + sb - 100) > 1e-6 || sa < 0 || sb < 0) return null;
213
+ return { parts: [{ color: a.color, share: sa }, { color: b.color, share: sb }], weighted: a.share !== null || b.share !== null };
214
+ }
215
+
216
+ /** One side of a two-colour mix, as a seller reads it: a theme colour's name ("Border") or the colour as written ("#eeeeee"), and the
217
+ * share of the mix it makes (0–100). `weighted` when the value writes a share. */
218
+ type MixSide = { value: string; name: string; share: number; weighted: boolean };
219
+ /**
220
+ * A TWO-COLOUR MIX (Control UI C13, 03/11/2026): `color-mix(in srgb, A, B)`, half of each, as a gradient's "+ Add color" writes the
221
+ * colour between two theme colours (the browser mixes them, so it follows the theme). Its two sides when each is a theme colour or one
222
+ * colour; null for anything else (another space, a nested mix). Measured on prod: the box read the whole
223
+ * `color-mix(in srgb, var(--gem-color-border), #eeeeee)` with "Kept as written", and the swatch was empty.
224
+ *
225
+ * At SHARES too (`mixSides`): `color-mix(in srgb, var(--gem-color-border) 75%, #eeeeee)` is what "+ Add color" writes beside a mix,
226
+ * which used to be a mix of a mix the box could not read (prod, 03/11/2026).
227
+ */
228
+ export function mixOf(value: string): [MixSide, MixSide] | null {
229
+ const mix = mixSides(value);
230
+ if (!mix) return null;
231
+ const [a, b] = mix.parts.map(({ color, share }) => {
232
+ const name = themeColorName(color) ?? (parseColor(color) ? color : null);
233
+ return name ? { value: color, name, share, weighted: mix.weighted } : null;
234
+ });
235
+ return a && b ? [a, b] : null;
236
+ }
237
+
238
+ /** A mix's name, "Border + #eeeeee" half and half, "Border 75% + #eeeeee 25%" otherwise; null when `mixOf` does not read it. */
239
+ export function mixName(value: string | ReturnType<typeof mixOf>): string | null {
240
+ const mix = typeof value === "string" ? mixOf(value) : value;
241
+ if (!mix) return null;
242
+ // Rounded past float noise: 100 - 93.8 is 6.200000000000003, and the box would print it.
243
+ const pct = (n: number) => `${Number(n.toFixed(2))}%`;
244
+ return mix[0].share === 50 ? `${mix[0].name} + ${mix[1].name}` : `${mix[0].name} ${pct(mix[0].share)} + ${mix[1].name} ${pct(mix[1].share)}`;
245
+ }
246
+
247
+ /** The colour a mix draws, each side at its share, when both are known: a theme colour through `palette`, asked by its own token
248
+ * (`var(--gem-color-<role>)`, however the value spells it), any other as written. Mixed as CSS mixes, with premultiplied alpha:
249
+ * half of transparent and white is half-transparent white, not grey. Null when a side's colour is not known here. */
250
+ export function mixColor(value: string, palette: (token: string) => string | null): Rgba | null {
251
+ const mix = mixOf(value);
252
+ if (!mix) return null;
253
+ const colour = (v: string) => {
254
+ const role = /^var\(\s*--gem-color-([a-z-]+)\s*\)$/i.exec(v)?.[1]?.toLowerCase();
255
+ return parseColor((role ? palette(`var(--gem-color-${role})`) : v) ?? "");
256
+ };
257
+ const [a, b] = mix.map((s) => colour(s.value));
258
+ if (!a || !b) return null;
259
+ const wa = mix[0].share / 100, wb = mix[1].share / 100;
260
+ const alpha = a.a * wa + b.a * wb;
261
+ const ch = (x: number, y: number) => (alpha > 0 ? (x * a.a * wa + y * b.a * wb) / alpha : x * wa + y * wb);
262
+ return { r: ch(a.r, b.r), g: ch(a.g, b.g), b: ch(a.b, b.b), a: alpha };
263
+ }
264
+
184
265
  /**
185
266
  * WHY THE SWATCH IS OFF, said where a seller sees it (Claude Design: a disabled control says why). The editors' selection toolbar
186
267
  * writes the theme's own colours as tokens (`var(--gem-color-accent)`), so every colour picked there turned its field's swatch grey,
@@ -193,5 +274,10 @@ export function swatchWhy(value: string): string | null {
193
274
  const token = /^var\(\s*--gem-color-([a-z-]+)\s*\)$/i.exec(v)?.[1]?.toLowerCase();
194
275
  if (token) return `Theme color: ${tokenName(token)}. Type a color to use your own.`;
195
276
  if (/^var\(/i.test(v)) return "A theme value. Type a color to use your own.";
277
+ // Names a half-and-half mix only, as editor-plain.js does (its weight is at its ceiling); any other mix is still a mix, not "Kept as
278
+ // written … not a name" (review: a mix at shares whose theme colours the chips do not say).
279
+ const mix = mixOf(v);
280
+ if (mix && !mix[0].weighted) return `A mix of ${mixName(mix)!.replace(" + ", " and ")}, half of each. Type a color to use your own.`;
281
+ if (/^color-mix\(/i.test(v)) return "A mix of colors. Type a color to use your own.";
196
282
  return "Kept as written: the swatch shows one color (hex, rgb, hsl or oklch), not a gradient or a name.";
197
283
  }
@@ -1 +1 @@
1
- .gemboss-ei-swatch{display:grid;padding:2px}.gemboss-ei-swatch-fill{display:block;border-radius:6px;background:linear-gradient(var(--sw,#fff),var(--sw,#fff)),conic-gradient(#d8dbe0 25%,#fff 0 50%,#d8dbe0 0 75%,#fff 0) 0 0/8px 8px}.gemboss-ei-swatch[data-empty] .gemboss-ei-swatch-fill{background:linear-gradient(to top right,#0000 46%,var(--ui-text-muted,#686b71) 46% 54%,#0000 54%),#fff}.gemboss-ei-swatch[aria-expanded=true]{border-color:var(--ui-focus,#5661f5);box-shadow:0 0 0 1px var(--ui-focus,#5661f5)}.gemboss-ei-swatch:focus-visible{outline:2px solid var(--ui-focus,#5661f5);outline-offset:2px}.gemboss-ei-cp{display:flex;flex-direction:column;gap:var(--ui-space-3,12px);min-width:0}.gemboss-ei-cp-area{position:relative;height:160px;border-radius:var(--ui-radius-md,8px);background:linear-gradient(to top,#000,#0000),linear-gradient(to right,#fff,var(--cp-hue,red));cursor:crosshair;touch-action:none;outline:none}.gemboss-ei-cp-area:focus-visible{box-shadow:0 0 0 2px var(--ui-surface,#fff),0 0 0 4px var(--ui-focus,#5661f5)}.gemboss-ei-cp-thumb{position:absolute;width:14px;height:14px;box-sizing:border-box;border:2px solid #fff;border-radius:50%;background:var(--cp-now,#fff);box-shadow:0 0 0 1px #0000004d,inset 0 0 0 1px #0000004d;transform:translate(-50%,-50%);pointer-events:none}.gemboss-ei-cp :is(.gemboss-ei-cp-hue,.gemboss-ei-cp-alpha){-webkit-appearance:none;appearance:none;display:block;width:100%;height:12px;margin:0;border-radius:6px;cursor:pointer;outline:none}.gemboss-ei-cp-hue{background:linear-gradient(to right,red,#ff0 17%,#0f0 33%,#0ff,#00f 67%,#f0f 83%,red)}.gemboss-ei-cp-alpha{background:linear-gradient(to right,#0000,var(--cp-now,#000)),conic-gradient(#d8dbe0 25%,#fff 0 50%,#d8dbe0 0 75%,#fff 0) 0 0/8px 8px}.gemboss-ei-cp-alpha:disabled{opacity:.4;cursor:default}.gemboss-ei-cp :is(.gemboss-ei-cp-hue,.gemboss-ei-cp-alpha)::-webkit-slider-thumb{-webkit-appearance:none;width:16px;height:16px;border:2px solid #fff;border-radius:50%;background:transparent;box-shadow:0 0 0 1px #00000059,inset 0 0 0 1px #00000059}.gemboss-ei-cp :is(.gemboss-ei-cp-hue,.gemboss-ei-cp-alpha)::-moz-range-thumb{width:12px;height:12px;border:2px solid #fff;border-radius:50%;background:transparent;box-shadow:0 0 0 1px #00000059}.gemboss-ei-cp :is(.gemboss-ei-cp-hue,.gemboss-ei-cp-alpha):focus-visible{box-shadow:0 0 0 2px var(--ui-surface,#fff),0 0 0 4px var(--ui-focus,#5661f5)}.gemboss-ei-cp-row{display:flex;align-items:center;gap:var(--ui-space-2,8px)}.gemboss-ei-cp-now{flex:none;width:32px;height:32px;box-sizing:border-box;border:1px solid var(--ui-border,#e5e7ea);border-radius:var(--ui-radius-md,8px);background:linear-gradient(var(--cp-now,#fff),var(--cp-now,#fff)),conic-gradient(#d8dbe0 25%,#fff 0 50%,#d8dbe0 0 75%,#fff 0) 0 0/8px 8px}.gemboss-ei-cp-hex{flex:1;min-width:0;font-variant-numeric:tabular-nums;text-transform:uppercase}.gemboss-ei-cp-pct{flex:none;min-width:36px;text-align:right;font-size:var(--ui-fs-caption,12px);color:var(--ui-text-muted,#686b71);font-variant-numeric:tabular-nums}.gemboss-ei-cp-drop{flex:none;display:grid;place-items:center;width:32px;height:32px;padding:0;border:1px solid var(--ui-border,#e5e7ea);border-radius:var(--ui-radius-md,8px);background:var(--ui-surface,#fff);color:var(--ui-text-strong,#1b1c1e);cursor:pointer}.gemboss-ei-cp-drop:hover{background:var(--ui-surface-2,#eceef2)}.gemboss-ei-cp-drop:focus-visible{outline:2px solid var(--ui-focus,#5661f5);outline-offset:1px}.gemboss-ei-cp-group{display:flex;flex-direction:column;gap:6px}.gemboss-ei-cp-label{font-size:var(--ui-fs-caption,12px);line-height:16px;font-weight:550;color:var(--ui-text-muted,#686b71)}.gemboss-ei-cp-chips{display:flex;flex-wrap:wrap;gap:var(--ui-space-2,8px)}.gemboss-ei-cp-none{align-self:flex-start;display:inline-flex;align-items:center;gap:6px;min-height:28px;padding:0 10px 0 6px;border:1px solid var(--ui-border,#e5e7ea);border-radius:var(--ui-radius-md,8px);background:var(--ui-surface,#fff);font:inherit;font-size:var(--ui-fs-caption,12px);font-weight:550;color:var(--ui-text-strong,#1b1c1e);cursor:pointer}.gemboss-ei-cp-none[aria-pressed=true]{border-color:var(--ui-focus,#5661f5);box-shadow:inset 0 0 0 1px var(--ui-focus,#5661f5)}.gemboss-ei-cp-none:focus-visible{outline:2px solid var(--ui-focus,#5661f5);outline-offset:1px}.gemboss-ei-cp-none-sw{width:16px;height:16px;box-sizing:border-box;border:1px solid var(--ui-border,#e5e7ea);border-radius:4px;background:linear-gradient(to top right,#0000 44%,var(--gemboss-danger,#d72c0d) 44% 56%,#0000 56%),#fff}.gemboss-ei-color-box{position:relative;display:flex;flex:1;min-width:0;container-type:inline-size}.gemboss-ei-color-name{position:absolute;inset:1px;display:flex;align-items:center;padding:0 12px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;pointer-events:none;font-size:var(--p-font-size-325,13px);color:var(--ui-text,#1b1c1e)}.gemboss-ei-color-name>span{color:var(--ui-text-muted,#686b71);white-space:pre}@container (max-width:150px){.gemboss-ei-color-name>span{display:none}}.gemboss-ei-color-box>[data-theme-colour]{color:transparent}.gemboss-ei-color>.gemboss-ei-inp[data-alpha]{flex:0 0 64px}@media (pointer:coarse),(max-width:47.9975em){.gemboss-ei-color-name{font-size:16px}@container (max-width:200px){.gemboss-ei-color-name>span{display:none}}.gemboss-ei-color .gemboss-ei-swatch{width:44px;height:44px}.gemboss-ei-color-box{flex-basis:96px}.gemboss-ei-color>.gemboss-ei-inp[data-alpha]{flex-basis:72px}.gemboss-ei-cp :is(.gemboss-ei-cp-hue,.gemboss-ei-cp-alpha){height:44px;border-radius:0;background-clip:content-box;padding:16px 0;box-sizing:border-box}.gemboss-ei-cp-hue{background:linear-gradient(to right,red,#ff0 17%,#0f0 33%,#0ff,#00f 67%,#f0f 83%,red) content-box}.gemboss-ei-cp :is(.gemboss-ei-cp-hue,.gemboss-ei-cp-alpha)::-webkit-slider-thumb{width:24px;height:24px}.gemboss-ei-cp-drop,.gemboss-ei-cp-now{width:44px;height:44px}.gemboss-ei-cp-none{min-height:44px}}
1
+ .gemboss-ei-swatch{display:grid;padding:2px}.gemboss-ei-swatch-fill{display:block;border-radius:6px;background:linear-gradient(var(--sw,#fff),var(--sw,#fff)),conic-gradient(#d8dbe0 25%,#fff 0 50%,#d8dbe0 0 75%,#fff 0) 0 0/8px 8px}.gemboss-ei-swatch[data-empty] .gemboss-ei-swatch-fill{background:linear-gradient(to top right,#0000 46%,var(--ui-text-muted,#686b71) 46% 54%,#0000 54%),#fff}.gemboss-ei-swatch[aria-expanded=true]{border-color:var(--ui-focus,#5661f5);box-shadow:0 0 0 1px var(--ui-focus,#5661f5)}.gemboss-ei-swatch:focus-visible{outline:2px solid var(--ui-focus,#5661f5);outline-offset:2px}.gemboss-ei-cp{display:flex;flex-direction:column;gap:var(--ui-space-3,12px);min-width:0}.gemboss-ei-cp-area{position:relative;height:160px;border-radius:var(--ui-radius-md,8px);background:linear-gradient(to top,#000,#0000),linear-gradient(to right,#fff,var(--cp-hue,red));cursor:crosshair;touch-action:none;outline:none}.gemboss-ei-cp-area:focus-visible{box-shadow:0 0 0 2px var(--ui-surface,#fff),0 0 0 4px var(--ui-focus,#5661f5)}.gemboss-ei-cp-thumb{position:absolute;width:14px;height:14px;box-sizing:border-box;border:2px solid #fff;border-radius:50%;background:var(--cp-now,#fff);box-shadow:0 0 0 1px #0000004d,inset 0 0 0 1px #0000004d;transform:translate(-50%,-50%);pointer-events:none}.gemboss-ei-cp :is(.gemboss-ei-cp-hue,.gemboss-ei-cp-alpha){-webkit-appearance:none;appearance:none;display:block;width:100%;height:12px;margin:0;border-radius:6px;cursor:pointer;outline:none}.gemboss-ei-cp-hue{background:linear-gradient(to right,red,#ff0 17%,#0f0 33%,#0ff,#00f 67%,#f0f 83%,red)}.gemboss-ei-cp-alpha{background:linear-gradient(to right,#0000,var(--cp-now,#000)),conic-gradient(#d8dbe0 25%,#fff 0 50%,#d8dbe0 0 75%,#fff 0) 0 0/8px 8px}.gemboss-ei-cp-alpha:disabled{opacity:.4;cursor:default}.gemboss-ei-cp :is(.gemboss-ei-cp-hue,.gemboss-ei-cp-alpha)::-webkit-slider-thumb{-webkit-appearance:none;width:16px;height:16px;border:2px solid #fff;border-radius:50%;background:transparent;box-shadow:0 0 0 1px #00000059,inset 0 0 0 1px #00000059}.gemboss-ei-cp :is(.gemboss-ei-cp-hue,.gemboss-ei-cp-alpha)::-moz-range-thumb{width:12px;height:12px;border:2px solid #fff;border-radius:50%;background:transparent;box-shadow:0 0 0 1px #00000059}.gemboss-ei-cp :is(.gemboss-ei-cp-hue,.gemboss-ei-cp-alpha):focus-visible{box-shadow:0 0 0 2px var(--ui-surface,#fff),0 0 0 4px var(--ui-focus,#5661f5)}.gemboss-ei-cp-row{display:flex;align-items:center;gap:var(--ui-space-2,8px)}.gemboss-ei-cp-now{flex:none;width:32px;height:32px;box-sizing:border-box;border:1px solid var(--ui-border,#e5e7ea);border-radius:var(--ui-radius-md,8px);background:linear-gradient(var(--cp-now,#fff),var(--cp-now,#fff)),conic-gradient(#d8dbe0 25%,#fff 0 50%,#d8dbe0 0 75%,#fff 0) 0 0/8px 8px}.gemboss-ei-cp-hex{flex:1;min-width:0;font-variant-numeric:tabular-nums;text-transform:uppercase}.gemboss-ei-cp-pct{flex:none;min-width:36px;text-align:right;font-size:var(--ui-fs-caption,12px);color:var(--ui-text-muted,#686b71);font-variant-numeric:tabular-nums}.gemboss-ei-cp-drop{flex:none;display:grid;place-items:center;width:32px;height:32px;padding:0;border:1px solid var(--ui-border,#e5e7ea);border-radius:var(--ui-radius-md,8px);background:var(--ui-surface,#fff);color:var(--ui-text-strong,#1b1c1e);cursor:pointer}.gemboss-ei-cp-drop:hover{background:var(--ui-surface-2,#eceef2)}.gemboss-ei-cp-drop:focus-visible{outline:2px solid var(--ui-focus,#5661f5);outline-offset:1px}.gemboss-ei-cp-group{display:flex;flex-direction:column;gap:6px}.gemboss-ei-cp-label{font-size:var(--ui-fs-caption,12px);line-height:16px;font-weight:550;color:var(--ui-text-muted,#686b71)}.gemboss-ei-cp-chips{display:flex;flex-wrap:wrap;gap:var(--ui-space-2,8px)}.gemboss-ei-cp-none{align-self:flex-start;display:inline-flex;align-items:center;gap:6px;min-height:28px;padding:0 10px 0 6px;border:1px solid var(--ui-border,#e5e7ea);border-radius:var(--ui-radius-md,8px);background:var(--ui-surface,#fff);font:inherit;font-size:var(--ui-fs-caption,12px);font-weight:550;color:var(--ui-text-strong,#1b1c1e);cursor:pointer}.gemboss-ei-cp-none[aria-pressed=true]{border-color:var(--ui-focus,#5661f5);box-shadow:inset 0 0 0 1px var(--ui-focus,#5661f5)}.gemboss-ei-cp-none:focus-visible{outline:2px solid var(--ui-focus,#5661f5);outline-offset:1px}.gemboss-ei-cp-none-sw{width:16px;height:16px;box-sizing:border-box;border:1px solid var(--ui-border,#e5e7ea);border-radius:4px;background:linear-gradient(to top right,#0000 44%,var(--gemboss-danger,#d72c0d) 44% 56%,#0000 56%),#fff}.gemboss-ei-color-box{position:relative;display:flex;flex:1;min-width:0;container-type:inline-size}.gemboss-ei-color-name{position:absolute;inset:1px;display:flex;align-items:center;padding:0 12px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;pointer-events:none;font-size:var(--p-font-size-325,13px);color:var(--ui-text,#1b1c1e)}.gemboss-ei-color-name>span:not(.gemboss-ei-color-name__text){flex:none;color:var(--ui-text-muted,#686b71);white-space:pre}.gemboss-ei-color-name__text{min-width:0;overflow:hidden;text-overflow:ellipsis}@container (max-width:150px){.gemboss-ei-color-name>span:not(.gemboss-ei-color-name__text){display:none}}.gemboss-ei-color-box>[data-theme-colour]{color:transparent}.gemboss-ei-color>.gemboss-ei-inp[data-alpha]{flex:0 0 64px}@media (pointer:coarse),(max-width:47.9975em){.gemboss-ei-color-name{font-size:16px}@container (max-width:200px){.gemboss-ei-color-name>span:not(.gemboss-ei-color-name__text){display:none}}.gemboss-ei-color .gemboss-ei-swatch{width:44px;height:44px}.gemboss-ei-color-box{flex-basis:96px}.gemboss-ei-color>.gemboss-ei-inp[data-alpha]{flex-basis:72px}.gemboss-ei-cp :is(.gemboss-ei-cp-hue,.gemboss-ei-cp-alpha){height:44px;border-radius:0;background-clip:content-box;padding:16px 0;box-sizing:border-box}.gemboss-ei-cp-hue{background:linear-gradient(to right,red,#ff0 17%,#0f0 33%,#0ff,#00f 67%,#f0f 83%,red) content-box}.gemboss-ei-cp :is(.gemboss-ei-cp-hue,.gemboss-ei-cp-alpha)::-webkit-slider-thumb{width:24px;height:24px}.gemboss-ei-cp-drop,.gemboss-ei-cp-now{width:44px;height:44px}.gemboss-ei-cp-none{min-height:44px}}
@@ -1 +1 @@
1
- .gemboss-ei-pick{display:flex;flex-direction:column;gap:var(--ui-space-3,12px);min-width:0}.gemboss-ei-pick-search{flex:none}.gemboss-ei-pick-search-icon{flex:none;color:var(--ui-text-muted,#686b71)}.gemboss-ei-pick-clear{flex:none;display:grid;place-items:center;width:24px;height:24px;margin-right:var(--ui-space-1,4px);padding:0;border:0;border-radius:var(--ui-radius-sm,6px);background:none;color:var(--ui-text-muted,#686b71);cursor:pointer}.gemboss-ei-pick-clear:hover{background:var(--ui-surface-2,#eceef2);color:var(--ui-text-strong,#1b1c1e)}.gemboss-ei-pick-clear:focus-visible{outline:2px solid var(--ui-focus,#5661f5);outline-offset:0}.gemboss-ei-pick-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;max-height:min(50vh,420px);overflow-y:auto;outline:none}.gemboss-ei-pick-row{flex:none;display:flex;align-items:center;gap:var(--ui-space-3,12px);min-height:44px;padding:var(--ui-space-2,8px);border-radius:var(--ui-radius-md,8px);cursor:pointer;color:inherit}.gemboss-ei-pick-row:hover:not([aria-disabled=true]),.gemboss-ei-pick:focus-within .gemboss-ei-pick-row.is-active:not([aria-disabled=true]){background:var(--ui-surface-2,#eceef2)}.gemboss-ei-pick-row[aria-selected=true]{background:var(--gemboss-accent-soft,#eef0fe)}.gemboss-ei-pick-row[aria-selected=true]:hover:not([aria-disabled=true]),.gemboss-ei-pick:focus-within .gemboss-ei-pick-row[aria-selected=true].is-active:not([aria-disabled=true]){background:color-mix(in srgb,var(--ui-focus,#5661f5) 6%,var(--gemboss-accent-soft,#eef0fe))}.gemboss-ei-pick-list:focus-visible>.gemboss-ei-pick-row.is-active{outline:2px solid var(--ui-focus,#5661f5);outline-offset:-2px}.gemboss-ei-pick-row[aria-disabled=true]{cursor:default}.gemboss-ei-pick-list:not(.is-reloading) .gemboss-ei-pick-row[aria-disabled=true]:not(.is-stale) :is(.gemboss-ei-pick-title,.gemboss-ei-pick-media){opacity:.55}.gemboss-ei-pick-list.is-reloading,.gemboss-ei-pick-row.is-stale{opacity:.55}.gemboss-ei-pick-media{flex:none;display:grid;place-items:center;width:40px;height:40px;box-sizing:border-box;border:1px solid var(--ui-border,#e5e7ea);border-radius:var(--ui-radius-md,8px);background:var(--ui-surface-2,#eceef2);object-fit:cover;color:var(--ui-text-muted,#686b71)}.gemboss-ei-pick-text{flex:1 1 auto;min-width:0;display:flex;flex-direction:column}.gemboss-ei-pick-head{display:flex;align-items:center;gap:var(--ui-space-2,8px);min-width:0}.gemboss-ei-pick-title{flex:0 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:var(--ui-fs-body,13px);line-height:20px;font-weight:650;color:var(--ui-text-strong,#1b1c1e)}.gemboss-ei-pick-head>.ui-tag{flex:none}.gemboss-ei-pick-sub{display:flex;min-width:0;font-size:var(--ui-fs-body,13px);line-height:20px;color:var(--ui-text-muted,#686b71);white-space:nowrap}.gemboss-ei-pick-note{flex:0 0 auto;max-width:100%;overflow:hidden;text-overflow:ellipsis}.gemboss-ei-pick-note.is-blocked{color:var(--gemboss-danger-strong,var(--gemboss-danger,#c4291c))}.gemboss-ei-pick-rest{flex:1 1 0;min-width:0;overflow:hidden;text-overflow:ellipsis}.gemboss-ei-pick-note+.gemboss-ei-pick-rest{margin-left:.25em}.gemboss-ei-pick-check{flex:none;color:var(--ui-focus,#5661f5)}.gemboss-ei-pick-drill{flex:none;color:var(--ui-text-muted,#686b71)}.gemboss-ei-pick-error{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:var(--ui-space-3,12px)}.gemboss-ei-pick-more>.ui-btn{width:100%}.gemboss-ei-pick-skeleton{display:flex;flex-direction:column}.gemboss-ei-pick-skeleton-row{display:flex;align-items:center;gap:var(--ui-space-3,12px);padding:var(--ui-space-2,8px)}.gemboss-ei-pick-skeleton-row>.gemboss-ei-pick-media{height:40px;border:0}.gemboss-ei-pick-skeleton-text{flex:1;display:flex;flex-direction:column;gap:var(--ui-space-2,8px)}.gemboss-ei-pick-skeleton-text>:first-child{width:40%}.gemboss-ei-pick-skeleton-text>:last-child{width:70%}@media (pointer:coarse),(max-width:47.9975em){.gemboss-ei-pick-clear{width:44px;height:44px;margin-right:0}}
1
+ .gemboss-ei-pick{display:flex;flex-direction:column;gap:var(--ui-space-3,12px);min-width:0}.gemboss-ei-pick-search{flex:none}.gemboss-ei-pick-search-icon{flex:none;color:var(--ui-text-muted,#686b71)}.gemboss-ei-pick-clear{flex:none;display:grid;place-items:center;width:24px;height:24px;margin-right:var(--ui-space-1,4px);padding:0;border:0;border-radius:var(--ui-radius-sm,6px);background:none;color:var(--ui-text-muted,#686b71);cursor:pointer}.gemboss-ei-pick-clear:hover{background:var(--ui-surface-2,#eceef2);color:var(--ui-text-strong,#1b1c1e)}.gemboss-ei-pick-clear:focus-visible{outline:2px solid var(--ui-focus,#5661f5);outline-offset:0}.gemboss-ei-pick-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;max-height:min(50vh,420px);overflow-y:auto;outline:none}.gemboss-ei-pick-row{flex:none;display:flex;align-items:center;gap:var(--ui-space-3,12px);min-height:44px;padding:var(--ui-space-2,8px);border-radius:var(--ui-radius-md,8px);cursor:pointer;color:inherit}.gemboss-ei-pick-row:hover:not([aria-disabled=true]),.gemboss-ei-pick:focus-within .gemboss-ei-pick-row.is-active:not([aria-disabled=true]){background:var(--ui-surface-2,#eceef2)}.gemboss-ei-pick-row[aria-selected=true]{background:var(--gemboss-accent-soft,#eef0fe)}.gemboss-ei-pick-row[aria-selected=true]:hover:not([aria-disabled=true]),.gemboss-ei-pick:focus-within .gemboss-ei-pick-row[aria-selected=true].is-active:not([aria-disabled=true]){background:color-mix(in srgb,var(--ui-focus,#5661f5) 6%,var(--gemboss-accent-soft,#eef0fe))}.gemboss-ei-pick-list:focus-visible>.gemboss-ei-pick-row.is-active{outline:2px solid var(--ui-focus,#5661f5);outline-offset:-2px}.gemboss-ei-pick-row[aria-disabled=true]{cursor:default}.gemboss-ei-pick-list:not(.is-reloading) .gemboss-ei-pick-row[aria-disabled=true]:not(.is-stale) :is(.gemboss-ei-pick-title,.gemboss-ei-pick-media){opacity:.55}.gemboss-ei-pick-list.is-reloading,.gemboss-ei-pick-row.is-stale{opacity:.55}.gemboss-ei-pick-media{flex:none;display:grid;place-items:center;width:40px;height:40px;box-sizing:border-box;border:1px solid var(--ui-border,#e5e7ea);border-radius:var(--ui-radius-md,8px);background:var(--ui-surface-2,#eceef2);object-fit:cover;color:var(--ui-text-muted,#686b71)}.gemboss-ei-pick-text{flex:1 1 auto;min-width:0;display:flex;flex-direction:column}.gemboss-ei-pick-head{display:flex;align-items:center;gap:var(--ui-space-2,8px);min-width:0}.gemboss-ei-pick-title{flex:0 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:var(--ui-fs-body,13px);line-height:20px;font-weight:650;color:var(--ui-text-strong,#1b1c1e)}.gemboss-ei-pick-head>.ui-tag{flex:none}.gemboss-ei-pick-sub{display:flex;min-width:0;font-size:var(--ui-fs-body,13px);line-height:20px;color:var(--ui-text-muted,#686b71);white-space:nowrap}.gemboss-ei-pick-note{flex:0 0 auto;max-width:100%;white-space:normal;overflow-wrap:anywhere}.gemboss-ei-pick-note.is-blocked{color:var(--gemboss-danger-strong,var(--gemboss-danger,#c4291c))}.gemboss-ei-pick-rest{flex:1 1 0;min-width:0;overflow:hidden;text-overflow:ellipsis}.gemboss-ei-pick-note+.gemboss-ei-pick-rest{margin-left:.25em}.gemboss-ei-pick-check{flex:none;color:var(--ui-focus,#5661f5)}.gemboss-ei-pick-drill{flex:none;color:var(--ui-text-muted,#686b71)}.gemboss-ei-pick-error{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:var(--ui-space-3,12px)}.gemboss-ei-pick-more>.ui-btn{width:100%}.gemboss-ei-pick-skeleton{display:flex;flex-direction:column}.gemboss-ei-pick-skeleton-row{display:flex;align-items:center;gap:var(--ui-space-3,12px);padding:var(--ui-space-2,8px)}.gemboss-ei-pick-skeleton-row>.gemboss-ei-pick-media{height:40px;border:0}.gemboss-ei-pick-skeleton-text{flex:1;display:flex;flex-direction:column;gap:var(--ui-space-2,8px)}.gemboss-ei-pick-skeleton-text>:first-child{width:40%}.gemboss-ei-pick-skeleton-text>:last-child{width:70%}@media (pointer:coarse),(max-width:47.9975em){.gemboss-ei-pick-clear{width:44px;height:44px;margin-right:0}}
@@ -1 +1 @@
1
- (function(k){"use strict";var g=k.gembossUI;if(!g){k.console&&k.console.error("@gemboss/ui editor-plain.js: load kit-plain.js first (it defines gembossUI)");return}if(g.initEditorFrame)return;var C=5,D=360,w=typeof WeakSet=="function"?new WeakSet:null,u=function(t,e,r){t.dispatchEvent(new CustomEvent(e,{bubbles:!0,detail:r}))},M=function(t,e){var r=Number(t);return isFinite(r)&&r>0?r:e};function d(t){return t.querySelector(".gemboss-editor-body")}function b(t){var e=d(t);return e&&e.querySelector(":scope > .gemboss-editor-resizer")}function h(t){var e=b(t);return{min:M(e&&e.getAttribute("aria-valuemin"),300),cap:M(e&&(e.getAttribute("data-gb-max")||e.getAttribute("aria-valuemax")),680)}}function N(t){var e=h(t),r=d(t),i=r?r.getBoundingClientRect().width:0;return i>0?Math.max(e.min,Math.min(e.cap,i-D-C)):e.cap}var S=typeof WeakMap=="function"?new WeakMap:null;function P(t){var e=S?S.get(t):t._gbWant;return e??E(t)}function O(t,e){S?S.set(t,e):t._gbWant=e}function v(t,e,r,i){var a=d(t),n=b(t);if(a){var s=i??N(t),l=h(t),o=Math.round(Math.min(s,Math.max(l.min,e)));if(a.style.setProperty("--gemboss-chat-w",o+"px"),n&&(n.setAttribute("aria-valuenow",String(o)),n.setAttribute("aria-valuemax",String(s))),r){O(t,o);var f=a.getAttribute("data-gb-storage");if(f)try{localStorage.setItem(f,String(o))}catch{}u(t,"gemboss:editor-split",{width:o})}return o}}function E(t){var e=b(t);return M(e&&e.getAttribute("aria-valuenow"),384)}function K(t){var e=d(t),r=b(t);if(!(!e||!r)){r.hasAttribute("data-gb-max")||r.setAttribute("data-gb-max",r.getAttribute("aria-valuemax")||"680");var i=e.getAttribute("data-gb-storage"),a=E(t);if(i)try{var n=Number(localStorage.getItem(i));n>=h(t).min&&n<=h(t).cap&&(a=n)}catch{}O(t,a),e.classList.contains("is-chat-collapsed")||v(t,a,!1)}}function j(t,e){var r=d(t);if(r&&!(e.button!==0||e.isPrimary===!1)){e.preventDefault();var i=r.getBoundingClientRect().left,a=N(t),n=0,s=E(t);document.body.classList.add("ui-resizing");var l=function(f){s=f.clientX-i-C,n||(n=requestAnimationFrame(function(){n=0,v(t,s,!1,a)}))},o=function(){n&&cancelAnimationFrame(n),document.body.classList.remove("ui-resizing"),removeEventListener("pointermove",l),removeEventListener("pointerup",o),removeEventListener("pointercancel",o),removeEventListener("blur",o),v(t,s,!0,a)};addEventListener("pointermove",l),addEventListener("pointerup",o),addEventListener("pointercancel",o),addEventListener("blur",o)}}function H(t,e){if(!(e.altKey||e.metaKey||e.ctrlKey)){var r=e.shiftKey?64:16,i=E(t),a=h(t);if(e.key==="ArrowLeft")i-=r;else if(e.key==="ArrowRight")i+=r;else if(e.key==="Home")i=a.min;else if(e.key==="End")i=N(t);else return;e.preventDefault(),v(t,i,!0)}}function G(t,e){var r=d(t);if(r){var i=!r.classList.contains("is-chat-collapsed");r.classList.toggle("is-chat-collapsed",i),i?r.style.setProperty("--gemboss-chat-w","0px"):v(t,P(t),!1),e.classList.toggle("collapsed",i),e.setAttribute("aria-pressed",String(i)),e.setAttribute("aria-label",i?"Show chat panel":"Hide chat panel"),e.title=i?"Show chat panel":"Hide chat \u2014 full-width preview";var a=e.querySelector("rect[fill='currentColor']");a&&(a.style.display=i?"none":""),u(t,"gemboss:editor-chat",{collapsed:i})}}function V(t,e){var r=e.closest(".gemboss-pv-devices");r&&(r.querySelectorAll(".gemboss-pv-device").forEach(function(i){var a=i===e;i.classList.toggle("active",a),i.setAttribute("aria-pressed",String(a))}),u(t,"gemboss:editor-device",{device:e.getAttribute("data-device")||(e.title||"").toLowerCase()}))}function X(t,e){var r=e.getAttribute("data-pane")||(Array.prototype.indexOf.call(e.parentNode.children,e)===0?"chat":"preview"),i=d(t);i&&(i.setAttribute("data-mobile-pane",r),e.parentNode.querySelectorAll(".gemboss-editor-mobile-tab").forEach(function(a){var n=a===e;a.classList.toggle("active",n),a.setAttribute("aria-selected",String(n))}),u(t,"gemboss:editor-pane",{pane:r}))}var c=null;function I(t){var e=t.trigger.getBoundingClientRect();t.menu.style.top=e.bottom+6+"px",t.menu.style.right=Math.max(8,innerWidth-e.right)+"px";var r=t.menu.getBoundingClientRect(),i=e.right-r.right;r.left+i<8&&(i=8-r.left),Math.abs(i)>=.5&&(t.menu.style.right=parseFloat(t.menu.style.right)-i+"px")}function y(t){var e=c;e&&(c=null,e.menu.hidden=!0,e.trigger.setAttribute("aria-expanded","false"),e.trigger.classList.remove("active"),t&&e.trigger.focus(),u(e.root,"gemboss:editor-menu",{open:!1,menu:e.menu}))}function J(t,e){var r=e.nextElementSibling;if(!r||!r.classList.contains("gemboss-editor-menu"))return!1;var i=c&&c.trigger===e;return y(!1),i||(c={root:t,trigger:e,menu:r},r.hidden=!1,e.setAttribute("aria-expanded","true"),e.classList.add("active"),I(c),u(t,"gemboss:editor-menu",{open:!0,menu:r})),!0}var B=!1;function Q(){B||(B=!0,document.addEventListener("pointerdown",function(t){c&&!c.menu.contains(t.target)&&!c.trigger.contains(t.target)&&y(!1)}),addEventListener("keydown",function(t){t.key!=="Escape"||!c||t.isComposing||t.keyCode===229||(t.preventDefault(),t.stopImmediatePropagation(),y(!0))},!0),addEventListener("resize",function(){c&&I(c)}),addEventListener("blur",function(){y(!1)}))}function Y(t){var e=t&&t.classList&&t.classList.contains("gemboss-editor")?[t]:Array.prototype.slice.call((t||document).querySelectorAll(".gemboss-editor"));return Q(),e.forEach(function(r){if(!(w?w.has(r):r._gbEditor)){w?w.add(r):r._gbEditor=!0,K(r);var i=d(r);i&&typeof ResizeObserver=="function"&&new ResizeObserver(function(){i.classList.contains("is-chat-collapsed")||v(r,P(r),!1)}).observe(i),r.addEventListener("pointerdown",function(a){var n=a.target.closest(".gemboss-editor-resizer");n&&n===b(r)&&j(r,a)}),r.addEventListener("keydown",function(a){a.target.classList&&a.target.classList.contains("gemboss-editor-resizer")&&a.target===b(r)&&H(r,a)}),r.addEventListener("click",function(a){var n=a.target,s;if(s=n.closest(".gemboss-editor-chat-toggle"))return G(r,s);if(s=n.closest(".gemboss-pv-devices .gemboss-pv-device"))return V(r,s);if(s=n.closest(".gemboss-editor-mobile-tab"))return X(r,s);if((s=n.closest('[aria-haspopup="menu"]'))&&J(r,s)){a.stopPropagation();return}c&&(s=n.closest(".gemboss-editor-menu-item"))&&c.menu.contains(s)&&y(!0)})}}),e.length}g.initEditorFrame=Y;function m(t){if(!t||t!==t.trim())return null;var e=/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.exec(t),r,i,a,n;if(e){var s=e[1].length<=4?e[1].replace(/./g,"$&$&"):e[1];return n=function(ce){return parseInt(s.substr(ce,2),16)},{r:n(0),g:n(2),b:n(4),a:s.length===8?Math.round(n(6)/255*1e3)/1e3:1}}if(r=/^rgba?\(\s*([^()]*?)\s*\)$/i.exec(t),!r)return null;var l=r[1].split("/");if(i=l[0].indexOf(",")>=0?l[0].split(","):l[0].trim().split(/\s+/),l.length===2&&i.push(l[1]),l.length>2||i.length<3||i.length>4)return null;var o=[];for(a=0;a<i.length;a++){var f=i[a].trim(),p=/^[+-]?(\d+\.?\d*|\.\d+)(e[+-]?\d+)?%?$/i.test(f)?parseFloat(f):f==="none"?0:NaN;if(isNaN(p))return null;/%$/.test(f)&&(p=p/100*(a<3?255:1)),o.push(a<3?Math.min(255,Math.max(0,Math.round(p))):Math.min(1,Math.max(0,p)))}return{r:o[0],g:o[1],b:o[2],a:o.length===4?o[3]:1}}function q(t){return"#"+[t.r,t.g,t.b].map(function(e){return(e<16?"0":"")+e.toString(16)}).join("")}function T(t,e,r){return r<1?"rgba("+e.r+", "+e.g+", "+e.b+", "+Math.round(r*100)/100+")":/^#/.test(t)||!t?q(e):"rgb("+e.r+", "+e.g+", "+e.b+")"}function W(t,e){var r=m(e),i=m(t);return r?T(t,r,i?i.a:1):t}function _(t,e){var r=m(t);return r&&isFinite(e)?T(t,r,Math.min(100,Math.max(0,Math.round(e)))/100):t}g.colorOf=m,g.pickSwatch=W,g.withOpacity=_;var F=function(t){var e=t.getAttribute("data-value");return e??(t.textContent||"").trim()},R=function(t){return Array.prototype.filter.call(t.children,function(e){return e.getAttribute("role")==="tab"})};function z(t,e){var r=t.parentNode,i=R(r),a=i.some(function(n){return n.hasAttribute("tabindex")});i.forEach(function(n){var s=n===t;n.setAttribute("aria-selected",String(s)),n.classList.contains("gemboss-ei-tab")&&n.classList.toggle("on",s),a&&n.setAttribute("tabindex",s?"0":"-1");var l=n.getAttribute("aria-controls"),o=l&&document.getElementById(l);o&&(o.hidden=!s)}),e&&t.focus(),u(t,"gemboss:editor-tab",{tab:F(t),index:i.indexOf(t)})}function Z(t,e){if(!(e.key!=="ArrowRight"&&e.key!=="ArrowLeft")){var r=R(t);if(r.some(function(n){return n.hasAttribute("tabindex")})){var i=r.findIndex(function(n){return n.getAttribute("aria-selected")==="true"}),a=e.key==="ArrowRight"?(i+1)%r.length:(i-1+r.length)%r.length;e.preventDefault(),z(r[a],!0)}}}function ee(t){var e=t.getAttribute("data-open")!=="open";t.setAttribute("data-open",e?"open":"closed"),t.setAttribute("aria-expanded",String(e));var r=t.querySelector(".gemboss-ei-chev");r&&(r.textContent=e?"\u25BE":"\u25B8"),u(t,"gemboss:editor-group",{open:e})}function te(t){var e=t.closest(".gemboss-ei-seg");Array.prototype.forEach.call(e.querySelectorAll("button"),function(r){var i=r===t;r.classList.toggle("active",i),r.classList.toggle("on",i),r.hasAttribute("aria-pressed")&&r.setAttribute("aria-pressed",String(i))}),u(e,"gemboss:editor-seg",{value:F(t)})}var re={text:"Text",accent:"Accent","accent-text":"Accent text",muted:"Muted",background:"Background",surface:"Surface",border:"Border",success:"Success",warning:"Warning",danger:"Danger"},ie=0;function ae(t){var e=t.trim(),r=/^var\(\s*--gem-color-([a-z-]+)\s*\)$/i.exec(e);if(r){var i=r[1].toLowerCase();return"Theme color: "+(re[i]||i.charAt(0).toUpperCase()+i.slice(1).replace(/-/g," "))+". Type a color to use your own."}return/^var\(/i.test(e)?"A theme value. Type a color to use your own.":"Kept as written: the swatch shows one color (hex, rgb, hsl or oklch), not a gradient or a name."}function A(t){var e=t.querySelector(".gemboss-ei-swatch"),r=t.querySelector("input:not([type=color]):not([data-alpha])");if(!(!e||!r)){var i=r.value,a=m(i),n=!i||!!a;if(e.tagName==="BUTTON"){var s=e.querySelector(".gemboss-ei-swatch-fill");s&&(a?s.style.setProperty("--sw","rgba("+a.r+", "+a.g+", "+a.b+", "+a.a+")"):s.style.removeProperty("--sw")),i?e.removeAttribute("data-empty"):e.setAttribute("data-empty","")}else e.value=a?q(a):"#000000";var l=t.querySelector("input[data-alpha]");a&&!l&&(l=document.createElement("input"),l.className="gemboss-field gemboss-ei-inp",l.setAttribute("data-alpha",""),l.setAttribute("inputmode","numeric"),l.setAttribute("aria-label",(e.getAttribute("aria-label")||"Color swatch").replace(/ swatch$/,"")+" opacity"),r.parentNode.insertBefore(l,r.nextSibling)),l&&(l.hidden=!a,a&&(l.value=Math.round(a.a*100)+"%"),l.disabled=r.disabled),e.disabled=r.disabled||!n;var o=t.querySelector(".gemboss-ei-color-why");if(n){e.removeAttribute("title"),e.removeAttribute("aria-describedby"),o&&o.parentNode.removeChild(o);return}var f=ae(i);e.title=f,o||(o=document.createElement("p"),o.className="gemboss-ei-color-why",t.appendChild(o)),o.id||(o.id="gemboss-ei-color-why-"+ ++ie),o.textContent=f,e.setAttribute("aria-describedby",o.id)}}function ne(t){for(var e=t.labels||[],r=null,i=0;i<e.length&&!r;i++)r=e[i].querySelector(".gemboss-ei-rangeval");r&&(r.textContent=t.value+(r.getAttribute("data-suffix")||""))}function se(t){var e={},r=["t","r","b","l"];return Array.prototype.forEach.call(t.querySelectorAll("input"),function(i,a){e[r[a]]=i.value.trim()}),e}function U(t){return'url("'+t.replace(/["\\]/g,"\\$&").replace(/[\u0000-\u001f\u007f]/g,function(e){return"\\"+e.charCodeAt(0).toString(16)+" "})+'")'}g.cssUrl=U;function oe(t,e){var r=t.querySelector(".gemboss-ei-img-thumb");r&&(r.style.backgroundImage=e?U(e):"",r.textContent=e?"":"\u2014")}function $(t,e){var r=t.getAttribute("data-gb-value")!=null?t.getAttribute("data-gb-value"):e.defaultValue;e.value!==r&&(t.setAttribute("data-gb-value",e.value),oe(t,e.value),u(t,"gemboss:editor-image",{value:e.value}))}var L=typeof WeakSet=="function"?new WeakSet:null,x=function(t){return t.__gbPanel?!1:(t.__gbPanel=!0,!0)};function le(t){var e=t.closest(".gemboss-ei-color");if(e){var r=e.querySelector("input:not([type=color]):not([data-alpha])"),i=e.querySelector("input[data-gb-swatch-native]");i||(i=document.createElement("input"),i.type="color",i.setAttribute("data-gb-swatch-native",""),i.tabIndex=-1,i.setAttribute("aria-hidden","true"),i.style.cssText="position:absolute;width:1px;height:1px;opacity:0;pointer-events:none",t.parentNode.insertBefore(i,t.nextSibling));var a=r&&m(r.value);i.value=a?q(a):"#ffffff";try{i.showPicker?i.showPicker():i.click()}catch{i.click()}}}function ue(t){var e=t||document;return(L?L.has(e):e._gbPanel)?0:(L?L.add(e):e._gbPanel=!0,Array.prototype.forEach.call(e.querySelectorAll(".gemboss-ei-color"),A),e.addEventListener("click",function(r){var i=r.target,a;if(!(!i.closest||!x(r))){if(a=i.closest('.gemboss-ec-tabs > [role="tab"], .gemboss-ei-tabs > [role="tab"]'))return z(a,!1);if(a=i.closest(".gemboss-ei-gh"))return ee(a);if((a=i.closest(".gemboss-ei-seg button"))&&!a.disabled)return te(a);if((a=i.closest("button.gemboss-ei-swatch"))&&!a.disabled)return le(a);if((a=i.closest("[data-gb-image-clear]"))&&!a.disabled){var n=a.closest(".gemboss-ei-img"),s=n&&n.querySelector(".gemboss-ei-img-ctl input");s&&(s.value="",$(n,s))}}}),e.addEventListener("keydown",function(r){var i=r.target;if(!(!i.closest||!x(r))){var a=i.closest('.gemboss-ec-tabs[role="tablist"], .gemboss-ei-tabs[role="tablist"]');if(a&&i.getAttribute("role")==="tab")return Z(a,r);r.key==="Enter"&&i.tagName==="INPUT"&&i.type!=="color"&&i.type!=="range"&&i.closest(".gemboss-ei-color, .gemboss-ei-edgebox, .gemboss-ei-img")&&(r.preventDefault(),i.blur())}}),e.addEventListener("input",function(r){var i=r.target;if(!(!i.closest||!x(r))){if(i.classList.contains("gemboss-ei-range")){ne(i),u(i,"gemboss:editor-range",{value:Number(i.value)});return}if(i.classList.contains("gemboss-ei-swatch")||i.hasAttribute("data-gb-swatch-native")){var a=i.closest(".gemboss-ei-color"),n=a&&a.querySelector("input:not([type=color]):not([data-alpha])"),s=n?W(n.value,i.value):i.value;n&&(n.value=s),a&&i.hasAttribute("data-gb-swatch-native")&&A(a),u(a||i,"gemboss:editor-color",{value:s})}}}),e.addEventListener("focusout",function(r){var i=r.target;if(!(!i.closest||i.tagName!=="INPUT"||!x(r))){var a;if(i.hasAttribute("data-alpha")&&(a=i.closest(".gemboss-ei-color"))){var n=a.querySelector("input:not([type=color]):not([data-alpha])"),s=Number(String(i.value).replace(/%/g,"").trim()),l=n&&String(i.value).trim()&&isFinite(s)?_(n.value,s):null;l&&l!==n.value?(n.value=l,A(a),u(a,"gemboss:editor-color",{value:l})):A(a);return}if(i.type!=="color"&&(a=i.closest(".gemboss-ei-color"))){A(a),u(a,"gemboss:editor-color",{value:i.value});return}if(a=i.closest(".gemboss-ei-edgebox")){u(a,"gemboss:editor-edges",se(a));return}(a=i.closest(".gemboss-ei-img"))&&$(a,i)}}),1)}g.initEditorPanel=ue})(typeof globalThis<"u"?globalThis:this);
1
+ (function(k){"use strict";var g=k.gembossUI;if(!g){k.console&&k.console.error("@gemboss/ui editor-plain.js: load kit-plain.js first (it defines gembossUI)");return}if(g.initEditorFrame)return;var C=5,j=360,w=typeof WeakSet=="function"?new WeakSet:null,u=function(t,e,r){t.dispatchEvent(new CustomEvent(e,{bubbles:!0,detail:r}))},N=function(t,e){var r=Number(t);return isFinite(r)&&r>0?r:e};function d(t){return t.querySelector(".gemboss-editor-body")}function m(t){var e=d(t);return e&&e.querySelector(":scope > .gemboss-editor-resizer")}function h(t){var e=m(t);return{min:N(e&&e.getAttribute("aria-valuemin"),300),cap:N(e&&(e.getAttribute("data-gb-max")||e.getAttribute("aria-valuemax")),680)}}function M(t){var e=h(t),r=d(t),i=r?r.getBoundingClientRect().width:0;return i>0?Math.max(e.min,Math.min(e.cap,i-j-C)):e.cap}var S=typeof WeakMap=="function"?new WeakMap:null;function P(t){var e=S?S.get(t):t._gbWant;return e??E(t)}function I(t,e){S?S.set(t,e):t._gbWant=e}function v(t,e,r,i){var a=d(t),n=m(t);if(a){var s=i??M(t),l=h(t),o=Math.round(Math.min(s,Math.max(l.min,e)));if(a.style.setProperty("--gemboss-chat-w",o+"px"),n&&(n.setAttribute("aria-valuenow",String(o)),n.setAttribute("aria-valuemax",String(s))),r){I(t,o);var f=a.getAttribute("data-gb-storage");if(f)try{localStorage.setItem(f,String(o))}catch{}u(t,"gemboss:editor-split",{width:o})}return o}}function E(t){var e=m(t);return N(e&&e.getAttribute("aria-valuenow"),384)}function H(t){var e=d(t),r=m(t);if(!(!e||!r)){r.hasAttribute("data-gb-max")||r.setAttribute("data-gb-max",r.getAttribute("aria-valuemax")||"680");var i=e.getAttribute("data-gb-storage"),a=E(t);if(i)try{var n=Number(localStorage.getItem(i));n>=h(t).min&&n<=h(t).cap&&(a=n)}catch{}I(t,a),e.classList.contains("is-chat-collapsed")||v(t,a,!1)}}function G(t,e){var r=d(t);if(r&&!(e.button!==0||e.isPrimary===!1)){e.preventDefault();var i=r.getBoundingClientRect().left,a=M(t),n=0,s=E(t);document.body.classList.add("ui-resizing");var l=function(f){s=f.clientX-i-C,n||(n=requestAnimationFrame(function(){n=0,v(t,s,!1,a)}))},o=function(){n&&cancelAnimationFrame(n),document.body.classList.remove("ui-resizing"),removeEventListener("pointermove",l),removeEventListener("pointerup",o),removeEventListener("pointercancel",o),removeEventListener("blur",o),v(t,s,!0,a)};addEventListener("pointermove",l),addEventListener("pointerup",o),addEventListener("pointercancel",o),addEventListener("blur",o)}}function V(t,e){if(!(e.altKey||e.metaKey||e.ctrlKey)){var r=e.shiftKey?64:16,i=E(t),a=h(t);if(e.key==="ArrowLeft")i-=r;else if(e.key==="ArrowRight")i+=r;else if(e.key==="Home")i=a.min;else if(e.key==="End")i=M(t);else return;e.preventDefault(),v(t,i,!0)}}function X(t,e){var r=d(t);if(r){var i=!r.classList.contains("is-chat-collapsed");r.classList.toggle("is-chat-collapsed",i),i?r.style.setProperty("--gemboss-chat-w","0px"):v(t,P(t),!1),e.classList.toggle("collapsed",i),e.setAttribute("aria-pressed",String(i)),e.setAttribute("aria-label",i?"Show chat panel":"Hide chat panel"),e.title=i?"Show chat panel":"Hide chat \u2014 full-width preview";var a=e.querySelector("rect[fill='currentColor']");a&&(a.style.display=i?"none":""),u(t,"gemboss:editor-chat",{collapsed:i})}}function J(t,e){var r=e.closest(".gemboss-pv-devices");r&&(r.querySelectorAll(".gemboss-pv-device").forEach(function(i){var a=i===e;i.classList.toggle("active",a),i.setAttribute("aria-pressed",String(a))}),u(t,"gemboss:editor-device",{device:e.getAttribute("data-device")||(e.title||"").toLowerCase()}))}function Q(t,e){var r=e.getAttribute("data-pane")||(Array.prototype.indexOf.call(e.parentNode.children,e)===0?"chat":"preview"),i=d(t);i&&(i.setAttribute("data-mobile-pane",r),e.parentNode.querySelectorAll(".gemboss-editor-mobile-tab").forEach(function(a){var n=a===e;a.classList.toggle("active",n),a.setAttribute("aria-selected",String(n))}),u(t,"gemboss:editor-pane",{pane:r}))}var c=null;function O(t){var e=t.trigger.getBoundingClientRect();t.menu.style.top=e.bottom+6+"px",t.menu.style.right=Math.max(8,innerWidth-e.right)+"px";var r=t.menu.getBoundingClientRect(),i=e.right-r.right;r.left+i<8&&(i=8-r.left),Math.abs(i)>=.5&&(t.menu.style.right=parseFloat(t.menu.style.right)-i+"px")}function y(t){var e=c;e&&(c=null,e.menu.hidden=!0,e.trigger.setAttribute("aria-expanded","false"),e.trigger.classList.remove("active"),t&&e.trigger.focus(),u(e.root,"gemboss:editor-menu",{open:!1,menu:e.menu}))}function Y(t,e){var r=e.nextElementSibling;if(!r||!r.classList.contains("gemboss-editor-menu"))return!1;var i=c&&c.trigger===e;return y(!1),i||(c={root:t,trigger:e,menu:r},r.hidden=!1,e.setAttribute("aria-expanded","true"),e.classList.add("active"),O(c),u(t,"gemboss:editor-menu",{open:!0,menu:r})),!0}var T=!1;function Z(){T||(T=!0,document.addEventListener("pointerdown",function(t){c&&!c.menu.contains(t.target)&&!c.trigger.contains(t.target)&&y(!1)}),addEventListener("keydown",function(t){t.key!=="Escape"||!c||t.isComposing||t.keyCode===229||(t.preventDefault(),t.stopImmediatePropagation(),y(!0))},!0),addEventListener("resize",function(){c&&O(c)}),addEventListener("blur",function(){y(!1)}))}function ee(t){var e=t&&t.classList&&t.classList.contains("gemboss-editor")?[t]:Array.prototype.slice.call((t||document).querySelectorAll(".gemboss-editor"));return Z(),e.forEach(function(r){if(!(w?w.has(r):r._gbEditor)){w?w.add(r):r._gbEditor=!0,H(r);var i=d(r);i&&typeof ResizeObserver=="function"&&new ResizeObserver(function(){i.classList.contains("is-chat-collapsed")||v(r,P(r),!1)}).observe(i),r.addEventListener("pointerdown",function(a){var n=a.target.closest(".gemboss-editor-resizer");n&&n===m(r)&&G(r,a)}),r.addEventListener("keydown",function(a){a.target.classList&&a.target.classList.contains("gemboss-editor-resizer")&&a.target===m(r)&&V(r,a)}),r.addEventListener("click",function(a){var n=a.target,s;if(s=n.closest(".gemboss-editor-chat-toggle"))return X(r,s);if(s=n.closest(".gemboss-pv-devices .gemboss-pv-device"))return J(r,s);if(s=n.closest(".gemboss-editor-mobile-tab"))return Q(r,s);if((s=n.closest('[aria-haspopup="menu"]'))&&Y(r,s)){a.stopPropagation();return}c&&(s=n.closest(".gemboss-editor-menu-item"))&&c.menu.contains(s)&&y(!0)})}}),e.length}g.initEditorFrame=ee;function b(t){if(!t||t!==t.trim())return null;var e=/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.exec(t),r,i,a,n;if(e){var s=e[1].length<=4?e[1].replace(/./g,"$&$&"):e[1];return n=function(de){return parseInt(s.substr(de,2),16)},{r:n(0),g:n(2),b:n(4),a:s.length===8?Math.round(n(6)/255*1e3)/1e3:1}}if(r=/^rgba?\(\s*([^()]*?)\s*\)$/i.exec(t),!r)return null;var l=r[1].split("/");if(i=l[0].indexOf(",")>=0?l[0].split(","):l[0].trim().split(/\s+/),l.length===2&&i.push(l[1]),l.length>2||i.length<3||i.length>4)return null;var o=[];for(a=0;a<i.length;a++){var f=i[a].trim(),p=/^[+-]?(\d+\.?\d*|\.\d+)(e[+-]?\d+)?%?$/i.test(f)?parseFloat(f):f==="none"?0:NaN;if(isNaN(p))return null;/%$/.test(f)&&(p=p/100*(a<3?255:1)),o.push(a<3?Math.min(255,Math.max(0,Math.round(p))):Math.min(1,Math.max(0,p)))}return{r:o[0],g:o[1],b:o[2],a:o.length===4?o[3]:1}}function q(t){return"#"+[t.r,t.g,t.b].map(function(e){return(e<16?"0":"")+e.toString(16)}).join("")}function B(t,e,r){return r<1?"rgba("+e.r+", "+e.g+", "+e.b+", "+Math.round(r*100)/100+")":/^#/.test(t)||!t?q(e):"rgb("+e.r+", "+e.g+", "+e.b+")"}function W(t,e){var r=b(e),i=b(t);return r?B(t,r,i?i.a:1):t}function _(t,e){var r=b(t);return r&&isFinite(e)?B(t,r,Math.min(100,Math.max(0,Math.round(e)))/100):t}g.colorOf=b,g.pickSwatch=W,g.withOpacity=_;var $=function(t){var e=t.getAttribute("data-value");return e??(t.textContent||"").trim()},R=function(t){return Array.prototype.filter.call(t.children,function(e){return e.getAttribute("role")==="tab"})};function z(t,e){var r=t.parentNode,i=R(r),a=i.some(function(n){return n.hasAttribute("tabindex")});i.forEach(function(n){var s=n===t;n.setAttribute("aria-selected",String(s)),n.classList.contains("gemboss-ei-tab")&&n.classList.toggle("on",s),a&&n.setAttribute("tabindex",s?"0":"-1");var l=n.getAttribute("aria-controls"),o=l&&document.getElementById(l);o&&(o.hidden=!s)}),e&&t.focus(),u(t,"gemboss:editor-tab",{tab:$(t),index:i.indexOf(t)})}function te(t,e){if(!(e.key!=="ArrowRight"&&e.key!=="ArrowLeft")){var r=R(t);if(r.some(function(n){return n.hasAttribute("tabindex")})){var i=r.findIndex(function(n){return n.getAttribute("aria-selected")==="true"}),a=e.key==="ArrowRight"?(i+1)%r.length:(i-1+r.length)%r.length;e.preventDefault(),z(r[a],!0)}}}function re(t){var e=t.getAttribute("data-open")!=="open";t.setAttribute("data-open",e?"open":"closed"),t.setAttribute("aria-expanded",String(e));var r=t.querySelector(".gemboss-ei-chev");r&&(r.textContent=e?"\u25BE":"\u25B8"),u(t,"gemboss:editor-group",{open:e})}function ie(t){var e=t.closest(".gemboss-ei-seg");Array.prototype.forEach.call(e.querySelectorAll("button"),function(r){var i=r===t;r.classList.toggle("active",i),r.classList.toggle("on",i),r.hasAttribute("aria-pressed")&&r.setAttribute("aria-pressed",String(i))}),u(e,"gemboss:editor-seg",{value:$(t)})}var ae={text:"Text",accent:"Accent","accent-text":"Accent text",muted:"Muted",background:"Background",surface:"Surface",border:"Border",success:"Success",warning:"Warning",danger:"Danger"},ne=0;function F(t){return ae[t]||t.charAt(0).toUpperCase()+t.slice(1).replace(/-/g," ")}function se(t){var e=t.trim(),r=/^var\(\s*--gem-color-([a-z-]+)\s*\)$/i.exec(e);if(r)return"Theme color: "+F(r[1].toLowerCase())+". Type a color to use your own.";if(/^var\(/i.test(e))return"A theme value. Type a color to use your own.";var i=oe(e);return i?"A mix of "+i.replace(" + "," and ")+", half of each. Type a color to use your own.":/^color-mix\(/i.test(e)?"A mix of colors. Type a color to use your own.":"Kept as written: the swatch shows one color (hex, rgb, hsl or oklch), not a gradient or a name."}var D="(var\\([^()]*\\)|[^,()]+(?:\\([^()]*\\))?)";function oe(t){var e=new RegExp("^color-mix\\(\\s*in\\s+srgb\\s*,"+D+","+D+"\\)$","i").exec(t);function r(n){n=n.trim();var s=/^var\(\s*--gem-color-([a-z-]+)\s*\)$/i.exec(n);return s?F(s[1].toLowerCase()):b(n)||/^(hsla?|oklch)\([^()]*\)$/i.test(n)?n:null}var i=e&&r(e[1]),a=e&&r(e[2]);return i&&a?i+" + "+a:null}function A(t){var e=t.querySelector(".gemboss-ei-swatch"),r=t.querySelector("input:not([type=color]):not([data-alpha])");if(!(!e||!r)){var i=r.value,a=b(i),n=!i||!!a;if(e.tagName==="BUTTON"){var s=e.querySelector(".gemboss-ei-swatch-fill");s&&(a?s.style.setProperty("--sw","rgba("+a.r+", "+a.g+", "+a.b+", "+a.a+")"):s.style.removeProperty("--sw")),i?e.removeAttribute("data-empty"):e.setAttribute("data-empty","")}else e.value=a?q(a):"#000000";var l=t.querySelector("input[data-alpha]");a&&!l&&(l=document.createElement("input"),l.className="gemboss-field gemboss-ei-inp",l.setAttribute("data-alpha",""),l.setAttribute("inputmode","numeric"),l.setAttribute("aria-label",(e.getAttribute("aria-label")||"Color swatch").replace(/ swatch$/,"")+" opacity"),r.parentNode.insertBefore(l,r.nextSibling)),l&&(l.hidden=!a,a&&(l.value=Math.round(a.a*100)+"%"),l.disabled=r.disabled),e.disabled=r.disabled||!n;var o=t.querySelector(".gemboss-ei-color-why");if(n){e.removeAttribute("title"),e.removeAttribute("aria-describedby"),o&&o.parentNode.removeChild(o);return}var f=se(i);e.title=f,o||(o=document.createElement("p"),o.className="gemboss-ei-color-why",t.appendChild(o)),o.id||(o.id="gemboss-ei-color-why-"+ ++ne),o.textContent=f,e.setAttribute("aria-describedby",o.id)}}function le(t){for(var e=t.labels||[],r=null,i=0;i<e.length&&!r;i++)r=e[i].querySelector(".gemboss-ei-rangeval");r&&(r.textContent=t.value+(r.getAttribute("data-suffix")||""))}function ue(t){var e={},r=["t","r","b","l"];return Array.prototype.forEach.call(t.querySelectorAll("input"),function(i,a){e[r[a]]=i.value.trim()}),e}function U(t){return'url("'+t.replace(/["\\]/g,"\\$&").replace(/[\u0000-\u001f\u007f]/g,function(e){return"\\"+e.charCodeAt(0).toString(16)+" "})+'")'}g.cssUrl=U;function ce(t,e){var r=t.querySelector(".gemboss-ei-img-thumb");r&&(r.style.backgroundImage=e?U(e):"",r.textContent=e?"":"\u2014")}function K(t,e){var r=t.getAttribute("data-gb-value")!=null?t.getAttribute("data-gb-value"):e.defaultValue;e.value!==r&&(t.setAttribute("data-gb-value",e.value),ce(t,e.value),u(t,"gemboss:editor-image",{value:e.value}))}var L=typeof WeakSet=="function"?new WeakSet:null,x=function(t){return t.__gbPanel?!1:(t.__gbPanel=!0,!0)};function fe(t){var e=t.closest(".gemboss-ei-color");if(e){var r=e.querySelector("input:not([type=color]):not([data-alpha])"),i=e.querySelector("input[data-gb-swatch-native]");i||(i=document.createElement("input"),i.type="color",i.setAttribute("data-gb-swatch-native",""),i.tabIndex=-1,i.setAttribute("aria-hidden","true"),i.style.cssText="position:absolute;width:1px;height:1px;opacity:0;pointer-events:none",t.parentNode.insertBefore(i,t.nextSibling));var a=r&&b(r.value);i.value=a?q(a):"#ffffff";try{i.showPicker?i.showPicker():i.click()}catch{i.click()}}}function ge(t){var e=t||document;return(L?L.has(e):e._gbPanel)?0:(L?L.add(e):e._gbPanel=!0,Array.prototype.forEach.call(e.querySelectorAll(".gemboss-ei-color"),A),e.addEventListener("click",function(r){var i=r.target,a;if(!(!i.closest||!x(r))){if(a=i.closest('.gemboss-ec-tabs > [role="tab"], .gemboss-ei-tabs > [role="tab"]'))return z(a,!1);if(a=i.closest(".gemboss-ei-gh"))return re(a);if((a=i.closest(".gemboss-ei-seg button"))&&!a.disabled)return ie(a);if((a=i.closest("button.gemboss-ei-swatch"))&&!a.disabled)return fe(a);if((a=i.closest("[data-gb-image-clear]"))&&!a.disabled){var n=a.closest(".gemboss-ei-img"),s=n&&n.querySelector(".gemboss-ei-img-ctl input");s&&(s.value="",K(n,s))}}}),e.addEventListener("keydown",function(r){var i=r.target;if(!(!i.closest||!x(r))){var a=i.closest('.gemboss-ec-tabs[role="tablist"], .gemboss-ei-tabs[role="tablist"]');if(a&&i.getAttribute("role")==="tab")return te(a,r);r.key==="Enter"&&i.tagName==="INPUT"&&i.type!=="color"&&i.type!=="range"&&i.closest(".gemboss-ei-color, .gemboss-ei-edgebox, .gemboss-ei-img")&&(r.preventDefault(),i.blur())}}),e.addEventListener("input",function(r){var i=r.target;if(!(!i.closest||!x(r))){if(i.classList.contains("gemboss-ei-range")){le(i),u(i,"gemboss:editor-range",{value:Number(i.value)});return}if(i.classList.contains("gemboss-ei-swatch")||i.hasAttribute("data-gb-swatch-native")){var a=i.closest(".gemboss-ei-color"),n=a&&a.querySelector("input:not([type=color]):not([data-alpha])"),s=n?W(n.value,i.value):i.value;n&&(n.value=s),a&&i.hasAttribute("data-gb-swatch-native")&&A(a),u(a||i,"gemboss:editor-color",{value:s})}}}),e.addEventListener("focusout",function(r){var i=r.target;if(!(!i.closest||i.tagName!=="INPUT"||!x(r))){var a;if(i.hasAttribute("data-alpha")&&(a=i.closest(".gemboss-ei-color"))){var n=a.querySelector("input:not([type=color]):not([data-alpha])"),s=Number(String(i.value).replace(/%/g,"").trim()),l=n&&String(i.value).trim()&&isFinite(s)?_(n.value,s):null;l&&l!==n.value?(n.value=l,A(a),u(a,"gemboss:editor-color",{value:l})):A(a);return}if(i.type!=="color"&&(a=i.closest(".gemboss-ei-color"))){A(a),u(a,"gemboss:editor-color",{value:i.value});return}if(a=i.closest(".gemboss-ei-edgebox")){u(a,"gemboss:editor-edges",ue(a));return}(a=i.closest(".gemboss-ei-img"))&&K(a,i)}}),1)}g.initEditorPanel=ge})(typeof globalThis<"u"?globalThis:this);
@@ -1 +1 @@
1
- .gemboss-ei-pop[popover]{position:fixed;inset:auto;margin:0;padding:0;overflow:auto;color:inherit}.gemboss-ei-pop[popover]:not(:popover-open){display:none}.gemboss-ei-pop{box-sizing:border-box;display:flex;flex-direction:column;outline:none;z-index:40}.gemboss-ei-pop--inline{position:static;flex-basis:100%;margin-top:var(--ui-space-2,8px)}.gemboss-ei-pop-head{display:flex;align-items:center;gap:var(--ui-space-1,4px);min-height:44px;padding:0 var(--ui-space-2,8px) 0 var(--ui-space-3,12px);border-bottom:1px solid var(--ui-border,#e5e7ea)}.gemboss-ei-pop-title{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:var(--ui-fs-body,13px);line-height:20px;font-weight:650;color:var(--ui-text-strong,#1b1c1e)}.gemboss-ei-pop-btn{flex:none;display:grid;place-items:center;width:28px;height:28px;padding:0;border:0;border-radius:var(--ui-radius-sm,6px);background:none;color:var(--ui-text-muted,#686b71);cursor:pointer}.gemboss-ei-pop-btn:hover{background:var(--ui-surface-2,#eceef2);color:var(--ui-text-strong,#1b1c1e)}.gemboss-ei-pop-btn:focus-visible{outline:2px solid var(--ui-focus,#5661f5);outline-offset:0}.gemboss-ei-pop-body{padding:var(--ui-space-3,12px);overflow:auto}@media (pointer:coarse),(max-width:47.9975em){.gemboss-ei-pop-btn{width:44px;height:44px}}@media (max-width:47.9975em){.gemboss-ei-pop[popover]{inset:auto 0 0;width:auto!important;max-height:85dvh;border-bottom-left-radius:0;border-bottom-right-radius:0;padding-bottom:env(safe-area-inset-bottom,0px)}}
1
+ .gemboss-ei-pop[popover]{position:fixed;inset:auto;margin:0;padding:0;overflow:auto;color:inherit}.gemboss-ei-pop[popover]:not(:popover-open){display:none}.gemboss-ei-pop{box-sizing:border-box;display:flex;flex-direction:column;outline:none;z-index:40}.gemboss-ei-pop--inline{position:static;flex-basis:100%;margin-top:var(--ui-space-2,8px)}.gemboss-ei-fld.gemboss-ei-fld--row>.gemboss-ei-pop.gemboss-ei-pop--inline{grid-column:1/-1}.gemboss-ei-pop-head{display:flex;align-items:center;gap:var(--ui-space-1,4px);min-height:44px;padding:0 var(--ui-space-2,8px) 0 var(--ui-space-3,12px);border-bottom:1px solid var(--ui-border,#e5e7ea)}.gemboss-ei-pop-title{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:var(--ui-fs-body,13px);line-height:20px;font-weight:650;color:var(--ui-text-strong,#1b1c1e)}.gemboss-ei-pop-btn{flex:none;display:grid;place-items:center;width:28px;height:28px;padding:0;border:0;border-radius:var(--ui-radius-sm,6px);background:none;color:var(--ui-text-muted,#686b71);cursor:pointer}.gemboss-ei-pop-btn:hover{background:var(--ui-surface-2,#eceef2);color:var(--ui-text-strong,#1b1c1e)}.gemboss-ei-pop-btn:focus-visible{outline:2px solid var(--ui-focus,#5661f5);outline-offset:0}.gemboss-ei-pop-body{padding:var(--ui-space-3,12px);overflow:auto}@media (pointer:coarse),(max-width:47.9975em){.gemboss-ei-pop-btn{width:44px;height:44px}}@media (max-width:47.9975em){.gemboss-ei-pop[popover]{inset:auto 0 0;width:auto!important;max-height:85dvh;border-bottom-left-radius:0;border-bottom-right-radius:0;padding-bottom:env(safe-area-inset-bottom,0px)}}
package/src/index.ts CHANGED
@@ -68,6 +68,8 @@ export { ActionCard, ActionCardItem, ActionCardSection, ActionChange, type Actio
68
68
  // 0.43.0 (the Market redesign, 21/10/2026): the assistant asks one question and a person only confirms, and the pieces around it.
69
69
  export { QuestionCard, MAX_QUESTION_CHOICES, type QuestionCardProps, type QuestionChoice, type QuestionChoices } from "./question-card";
70
70
  export { BriefingCard, type BriefingCardProps } from "./briefing-card";
71
+ // KIT-004 (03/11/2026): the bar above a form that holds what it has not saved, Discard beside Save (canvas frame-save-toast).
72
+ export { SaveBar, type SaveBarProps } from "./save-bar";
71
73
  export { RangeBar, rangeBarGeometry, type RangeBarGeometry, type RangeBarProps } from "./range-bar";
72
74
  export { ProgressRing, progressRingGeometry, RING_BOX, type ProgressRingGeometry, type ProgressRingProps } from "./progress-ring";
73
75
  export { SpotArt, SPOT_ART_NAMES, type SpotArtName, type SpotArtProps } from "./spot-art";
@@ -89,6 +91,11 @@ export { StagePath, stagePathDone, type StagePathProps, type StagePathStage } fr
89
91
  export { StatusMatrix, statusMatrixTone, type StatusMatrixCell, type StatusMatrixColumn, type StatusMatrixLabels, type StatusMatrixProps, type StatusMatrixRow, type StatusMatrixTone } from "./status-matrix";
90
92
  export { TranslationRow, TRANSLATION_STATE_LABELS, translationRowId, type TranslationRowIds, type TranslationRowProps, type TranslationState } from "./translation-row";
91
93
  export { StatusList, type StatusListItem, type StatusListProps, type StatusListTone } from "./status-list";
94
+ // The shared skills UI (03/11/2026, plan "Clone cả store" S5): a background job pinned in a chat, one skill in a popup, how a
95
+ // skill is used. The flow canvas is NOT here: it is `@gemboss/ui/skill-flow`, loaded lazily (React Flow and dagre stay out of this index).
96
+ export { JobCard, JOB_CARD_LABELS, jobProgressShare, jobStepWindow, type JobCardAction, type JobCardLabels, type JobCardProps, type JobStep, type JobStepStatus } from "./job-card";
97
+ export { SkillView, SkillViewSection, SkillRuleList, SkillCard, SkillGroup, SKILL_VIEW_TABS, type SkillRule, type SkillRuleHold, type SkillViewProps, type SkillViewTab } from "./skill-view";
98
+ export { SkillStats, SKILL_STATS_LABELS, SKILL_ENGINES, engineParts, pct as skillStatsPercent, type SkillEngine, type SkillOutcome, type SkillStatsLabels, type SkillStatsProps, type SkillUsage } from "./skill-stats";
92
99
  export { FREQUENT_MAX, frequentReactions, isReactionEmoji, QUICK_REACTIONS, REACTION_EMOJI, REACTION_GROUPS, reactionLabel, reactionWords, searchReactions, SUGGESTED_REACTIONS, toggleReaction, type Reaction } from "./reactions-data";
93
100
  // The team chat layer (20/10/2026, README "The team chat layer"): GemCare's channel chat for every surface, with
94
101
  // team-chat.css its own entry. The row rules (turns, day separators, the "New messages" line) are plain data.
@@ -0,0 +1 @@
1
+ .ui-jobcard{display:grid;gap:10px;min-width:0;box-sizing:border-box;padding:12px;border:1px solid var(--gemboss-divider, #e5e7ea);border-radius:12px;background:var(--gemboss-primary-soft, #f2f3f5);color:var(--gemboss-text, #1b1c1e);font-size:12px;line-height:18px}.ui-jobcard__head{display:flex;flex-wrap:wrap;align-items:baseline;justify-content:space-between;gap:2px 8px;min-width:0}.ui-jobcard__title{min-width:0;font-size:14px;line-height:20px;font-weight:600;overflow-wrap:anywhere}.ui-jobcard__meta{flex:none;font-size:12px;color:var(--gemboss-text-muted, #686b71);font-variant-numeric:tabular-nums;white-space:nowrap}.ui-jobcard__bar{height:4px;border-radius:999px;background:var(--gemboss-divider, #e5e7ea);overflow:hidden}.ui-jobcard__fill{display:block;height:100%;border-radius:999px;background:var(--gemboss-accent, #5661f5);transition:width .3s ease}@media (prefers-reduced-motion: reduce){.ui-jobcard__fill{transition:none}}.ui-jobcard__steps{display:grid;gap:6px;margin:0;padding:0;list-style:none}.ui-jobcard__step{display:flex;align-items:center;gap:8px;min-width:0}.ui-jobcard__dot{flex:none;width:7px;height:7px;box-sizing:border-box;border-radius:50%;border:1.5px solid var(--gemboss-chip-line, #cfd6ce)}.ui-jobcard__label{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ui-jobcard__state{flex:none;margin-left:auto;font-size:12px;color:var(--gemboss-text-muted, #686b71)}.ui-jobcard__step--done .ui-jobcard__dot{border-color:var(--gemboss-success, #007f5f);background:var(--gemboss-success, #007f5f)}.ui-jobcard__step--running .ui-jobcard__dot{border-color:var(--gemboss-accent, #5661f5);background:var(--gemboss-accent, #5661f5);box-shadow:0 0 0 3px var(--gemboss-accent-soft, #eef0fe)}.ui-jobcard__step--running .ui-jobcard__label{font-weight:600}.ui-jobcard__step--failed .ui-jobcard__dot{border-color:var(--gemboss-danger, #d72c0d);background:var(--gemboss-danger, #d72c0d)}.ui-jobcard__step--failed .ui-jobcard__state{color:var(--gemboss-danger-strong, #b42318)}.ui-jobcard__step--skipped .ui-jobcard__dot{border-style:dashed}.ui-jobcard__step--skipped .ui-jobcard__label{color:var(--gemboss-text-muted, #686b71)}.ui-jobcard .ui-jobcard__more{justify-self:start;margin:-4px 0 0;padding:2px 0;border:0;background:transparent;font:inherit;font-size:12px;color:var(--gemboss-text-muted, #686b71);cursor:pointer;border-radius:4px}.ui-jobcard .ui-jobcard__more:hover,.ui-jobcard .ui-jobcard__more:active{background:transparent;color:var(--gemboss-text, #1b1c1e);text-decoration:underline}.ui-jobcard .ui-jobcard__more:focus-visible{outline:2px solid var(--ui-focus, #5661f5);outline-offset:2px}.ui-jobcard__actions{display:flex;flex-wrap:wrap;gap:8px}@media (pointer: coarse),(max-width: 47.9975em){.ui-jobcard .ui-jobcard__more{min-height:44px;margin:-12px 0 -8px}}
@@ -0,0 +1,130 @@
1
+ "use client";
2
+
3
+ /**
4
+ * JobCard — @gemboss/ui, unreleased (03/11/2026, Chris approved the shared skills UI: plan "Clone cả store", S5). A job that runs in
5
+ * the background, pinned at the top of a narrow chat panel (≥ 340px) or a phone: a title, one short line, a thin bar, its steps as
6
+ * small dots, and one or two actions. GemBoss's Gem chat pins it over the conversation while a store clone runs; content-radar's
7
+ * writer can pin the same card for an article being written.
8
+ *
9
+ * Quiet by design (Chris's rules: one accent, status as small dots, extras collapsed with a count, empty things hidden):
10
+ * - the bar is the only iris fill; a running step's dot is iris with a soft ring, a done one ink-green, a failed one red, a queued
11
+ * one an empty ring, a skipped one a muted ring; every dot is said in words beside it, so colour never stands alone;
12
+ * - at most `maxSteps` steps (4 by default), chosen round the step that runs now so the reader sees what just finished and what
13
+ * is next; the rest are "+N more", a button that opens the whole list;
14
+ * - no steps and no progress: a title and its line, nothing empty drawn.
15
+ * Presentational: no data fetching, no polling (the surface owns both). `job-card.css` is its own entry.
16
+ */
17
+ import "./job-card.css";
18
+ import React, { useId, useState } from "react";
19
+
20
+ const cx = (...p: Array<string | false | null | undefined>) => p.filter(Boolean).join(" ");
21
+
22
+ export type JobStepStatus = "queued" | "running" | "done" | "failed" | "skipped";
23
+ export interface JobStep { label: string; status: JobStepStatus; key?: string }
24
+ export interface JobCardAction { label: string; onClick: () => void; primary?: boolean; href?: string }
25
+
26
+ export interface JobCardLabels {
27
+ status: Record<JobStepStatus, string>;
28
+ more: (n: number) => string;
29
+ fewer: string;
30
+ progress: (done: number, total: number) => string;
31
+ }
32
+ export const JOB_CARD_LABELS: JobCardLabels = {
33
+ status: { queued: "Waiting", running: "Working", done: "Done", failed: "Failed", skipped: "Skipped" },
34
+ more: (n) => `+${n} more`,
35
+ fewer: "Show fewer",
36
+ progress: (done, total) => `${done}/${total}`,
37
+ };
38
+
39
+ export interface JobCardProps {
40
+ title: string;
41
+ /** One short line under the title: "~3 min left", "glp1sos.com". The count `done/total` is added when `progress` is given. */
42
+ meta?: string;
43
+ progress?: { done: number; total: number };
44
+ steps?: readonly JobStep[];
45
+ /** How many steps show before "+N more" (default 4). */
46
+ maxSteps?: number;
47
+ actions?: readonly JobCardAction[];
48
+ labels?: Partial<JobCardLabels>;
49
+ className?: string;
50
+ }
51
+
52
+ const DOT: Record<JobStepStatus, string> = {
53
+ queued: "ui-jobcard__step ui-jobcard__step--queued",
54
+ running: "ui-jobcard__step ui-jobcard__step--running",
55
+ done: "ui-jobcard__step ui-jobcard__step--done",
56
+ failed: "ui-jobcard__step ui-jobcard__step--failed",
57
+ skipped: "ui-jobcard__step ui-jobcard__step--skipped",
58
+ };
59
+
60
+ /**
61
+ * Which steps show when there are more than `max`: a window round the step that matters now (the running one, else the first
62
+ * that has not finished, else the last), with up to `max - 2` before it and the rest after, so the reader sees what just ended and
63
+ * what comes next. Pure, for the tests and for a surface drawing the card by hand.
64
+ */
65
+ export function jobStepWindow(steps: readonly Pick<JobStep, "status">[], max = 4): { start: number; end: number; hidden: number } {
66
+ const n = steps.length;
67
+ const m = Math.max(1, Math.floor(max));
68
+ if (n <= m) return { start: 0, end: n, hidden: 0 };
69
+ let cur = steps.findIndex((s) => s.status === "running");
70
+ if (cur < 0) cur = steps.findIndex((s) => s.status === "queued" || s.status === "failed");
71
+ if (cur < 0) cur = n - 1;
72
+ const start = Math.min(Math.max(0, cur - Math.max(0, m - 2)), n - m);
73
+ return { start, end: start + m, hidden: n - m };
74
+ }
75
+
76
+ /** done/total held to 0…1; a total of 0 or less is no bar. */
77
+ export const jobProgressShare = (p?: { done: number; total: number }) =>
78
+ p && p.total > 0 ? Math.min(1, Math.max(0, p.done / p.total)) : null;
79
+
80
+ export function JobCard({ title, meta, progress, steps = [], maxSteps = 4, actions = [], labels, className }: JobCardProps) {
81
+ const L = { ...JOB_CARD_LABELS, ...labels };
82
+ const [open, setOpen] = useState(false);
83
+ const listId = useId();
84
+ const share = jobProgressShare(progress);
85
+ const win = jobStepWindow(steps, maxSteps);
86
+ const shown = open ? steps : steps.slice(win.start, win.end);
87
+ const count = progress && progress.total > 0 ? L.progress(Math.max(0, Math.min(progress.done, progress.total)), progress.total) : null;
88
+ const line = [count, meta].filter(Boolean).join(" · ");
89
+ const running = steps.some((s) => s.status === "running");
90
+ return (
91
+ <section className={cx("ui-jobcard", className)} aria-label={title} aria-busy={running || undefined}>
92
+ <div className="ui-jobcard__head">
93
+ <b className="ui-jobcard__title">{title}</b>
94
+ {line ? <span className="ui-jobcard__meta">{line}</span> : null}
95
+ </div>
96
+ {share !== null ? (
97
+ <div className="ui-jobcard__bar" role="progressbar" aria-valuemin={0} aria-valuemax={progress!.total} aria-valuenow={Math.min(progress!.done, progress!.total)}
98
+ aria-label={title}>
99
+ <i className="ui-jobcard__fill" style={{ width: `${Math.round(share * 1000) / 10}%` }} />
100
+ </div>
101
+ ) : null}
102
+ {shown.length ? (
103
+ <ul className="ui-jobcard__steps" id={listId}>
104
+ {shown.map((s, i) => (
105
+ <li key={s.key ?? `${i}:${s.label}`} className={DOT[s.status] ?? DOT.queued}>
106
+ <span className="ui-jobcard__dot" aria-hidden="true" />
107
+ <span className="ui-jobcard__label">{s.label}</span>
108
+ <span className="ui-jobcard__state">{L.status[s.status] ?? s.status}</span>
109
+ </li>
110
+ ))}
111
+ </ul>
112
+ ) : null}
113
+ {win.hidden ? (
114
+ <button type="button" className="ui-jobcard__more" aria-expanded={open} aria-controls={listId} onClick={() => setOpen((v) => !v)}>
115
+ {open ? L.fewer : L.more(win.hidden)}
116
+ </button>
117
+ ) : null}
118
+ {actions.length ? (
119
+ <div className="ui-jobcard__actions">
120
+ {actions.map((a) => (a.href ? (
121
+ <a key={a.label} href={a.href} className={cx("ui-btn ui-btn--sm", a.primary && "ui-btn--primary")}
122
+ onClick={(e) => { if (e.metaKey || e.ctrlKey || e.shiftKey || e.button !== 0) return; e.preventDefault(); a.onClick(); }}>{a.label}</a>
123
+ ) : (
124
+ <button key={a.label} type="button" className={cx("ui-btn ui-btn--sm", a.primary && "ui-btn--primary")} onClick={a.onClick}>{a.label}</button>
125
+ )))}
126
+ </div>
127
+ ) : null}
128
+ </section>
129
+ );
130
+ }
@@ -0,0 +1 @@
1
+ .gemboss-narr-link{font:inherit;color:inherit;background:none;border:0;padding:0 4px;margin:0 -4px;border-radius:4px;text-align:start;cursor:pointer;min-height:24px}.gemboss-narr-link:hover,.gemboss-narr-link:focus-visible{text-decoration:underline;text-underline-offset:2px}.gemboss-narr-link:active{background:var(--gemboss-active-bg)}.gemboss-narr-link:focus-visible{outline:2px solid var(--ui-focus, #5661f5);outline-offset:0}.gemboss-narr-undo{margin-inline-start:auto;flex:0 0 auto;font:inherit;font-size:var(--gemboss-fs-caption);color:var(--gemboss-text-muted);background:none;border:0;padding:0 4px;border-radius:4px;min-height:24px;cursor:pointer;opacity:0;pointer-events:none}.gemboss-narr-row:hover .gemboss-narr-undo,.gemboss-narr-row:focus-within .gemboss-narr-undo,.gemboss-narr-undo[aria-busy=true]{opacity:1;pointer-events:auto}.gemboss-narr-undo:hover{color:var(--gemboss-text);text-decoration:underline;text-underline-offset:2px}.gemboss-narr-undo:active{background:var(--gemboss-active-bg)}.gemboss-narr-undo:focus-visible{outline:2px solid var(--ui-focus, #5661f5);outline-offset:0}.gemboss-narr-undo:disabled{cursor:default}.gemboss-narr-row:has(>.gemboss-narr-undo-said){flex-wrap:wrap}.gemboss-narr-undo-said{flex:1 0 100%;padding-inline-start:24px;font-size:var(--gemboss-fs-caption);color:var(--gemboss-text-muted)}@media (pointer: coarse),(max-width:47.9975em){.gemboss-narr-undo{opacity:1;pointer-events:auto;min-height:44px}}.gemboss-narr-plan{list-style:none;margin:0;padding:8px 12px;border:1px solid var(--gemboss-divider);border-radius:8px;background:var(--gemboss-surface, #fff)}.gemboss-narr-plan-head{margin:0 0 4px;font-size:var(--gemboss-fs-caption);font-weight:600;color:var(--gemboss-text)}.gemboss-narr-plan-count{font-weight:400;color:var(--gemboss-text-muted)}.gemboss-narr-plan-steps{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:4px}.gemboss-narr-plan-step{display:flex;gap:8px;align-items:baseline;font-size:var(--gemboss-fs-caption);color:var(--gemboss-text-muted)}.gemboss-narr-plan-step.done{color:var(--gemboss-text)}.gemboss-narr-plan-step.current{color:var(--gemboss-text);font-weight:600}.gemboss-narr-plan-mark{flex:0 0 16px;text-align:center}.gemboss-narr-plan-wait,.gemboss-narr-steer-note{font-weight:400;color:var(--gemboss-text-muted)}.gemboss-narr-row.steer.failed .gemboss-narr-steer-note{color:var(--gemboss-danger)}
@@ -0,0 +1 @@
1
+ .ui-savebar{position:sticky;top:0;z-index:2;display:flex;flex-wrap:wrap;align-items:center;gap:8px;min-height:44px;box-sizing:border-box;padding:6px 8px 6px 16px;border-radius:var(--ui-radius-lg);background:var(--ui-text-strong);color:var(--ui-surface);font-weight:650}.ui-savebar__msg{min-width:0}.ui-savebar__error{min-width:0;font-weight:450;opacity:.85}.ui-savebar__actions{display:flex;align-items:center;gap:8px;margin-left:auto}.ui-savebar__btn{display:inline-flex;align-items:center;min-height:32px;padding:0 12px;border:1px solid color-mix(in srgb,var(--ui-surface) 30%,transparent);border-radius:var(--ui-radius-md);background:transparent;color:inherit;font:inherit;font-size:12px;font-weight:550;cursor:pointer}.ui-savebar__btn--save{border-color:var(--ui-surface);background:var(--ui-surface);color:var(--ui-text-strong)}.ui-savebar__btn:disabled{opacity:.6;cursor:default}.ui-savebar__btn:focus-visible{outline:2px solid var(--ui-surface);outline-offset:2px}@media (pointer: coarse){.ui-savebar__btn{min-height:44px}}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Save bar (unreleased, after 0.57.0; KIT-004, canvas frame-save-toast). The one bar for a form that holds what it has not saved: most
3
+ * screens write a draft as each field changes and need none, but a form saved on its own route (a plugin's service, GemSeel's box) keeps
4
+ * its edits until Save. It stands above the form while there is something to save, says so, and offers Discard beside Save; with
5
+ * nothing to save it is not drawn at all, so it never says "Saved" in place of a toast. What a press did is the surface's to say (a
6
+ * toast, whose ✕ dismisses it): the bar only holds the two buttons and, when the last Save was refused, the reason (`error`).
7
+ *
8
+ * The admin's Focus frame drew it first as its own part (`FocusSaveBar`, backlog/frame.md); this takes its place, same words, same
9
+ * behaviour: both buttons are off while a save runs, and Save reads "Saving…".
10
+ *
11
+ * Presentational and controlled: no state of its own, so it renders on the server. Its stylesheet travels with it (`save-bar.css`, own
12
+ * entry; `@gemboss/ui/save-bar.css` for a plain-HTML surface that writes the same classes).
13
+ */
14
+ import "./save-bar.css";
15
+ import React, { type ReactNode } from "react";
16
+
17
+ const cx = (...p: Array<string | false | null | undefined>) => p.filter(Boolean).join(" ");
18
+
19
+ export interface SaveBarProps {
20
+ /** Something waits to be saved. False draws nothing. */
21
+ dirty: boolean;
22
+ /** A save is running: both buttons are off, and Save says so. */
23
+ saving?: boolean;
24
+ onSave: () => void;
25
+ onDiscard: () => void;
26
+ /** The words on the left, and the region's name. Default "Unsaved changes". */
27
+ message?: string;
28
+ saveLabel?: string;
29
+ discardLabel?: string;
30
+ /** Why the last Save did not take, in the person's words ("Only the Owner or a Manager can change this."). Said in the bar, as an
31
+ * alert, until the surface clears it; the edits stay, so Save can be pressed again. */
32
+ error?: ReactNode;
33
+ className?: string;
34
+ }
35
+
36
+ export function SaveBar({ dirty, saving = false, onSave, onDiscard, message = "Unsaved changes", saveLabel = "Save", discardLabel = "Discard", error, className }: SaveBarProps) {
37
+ if (!dirty) return null;
38
+ return (
39
+ <div className={cx("ui-savebar", className)} role="region" aria-label={message}>
40
+ <span className="ui-savebar__msg">{message}</span>
41
+ {error ? <span className="ui-savebar__error" role="alert">{error}</span> : null}
42
+ <span className="ui-savebar__actions">
43
+ <button type="button" className="ui-savebar__btn" disabled={saving} onClick={onDiscard}>{discardLabel}</button>
44
+ <button type="button" className="ui-savebar__btn ui-savebar__btn--save" disabled={saving} aria-busy={saving || undefined} onClick={onSave}>
45
+ {saving ? "Saving…" : saveLabel}
46
+ </button>
47
+ </span>
48
+ </div>
49
+ );
50
+ }