@gemboss/ui 0.67.0 → 0.69.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 +179 -4
- package/README.md +89 -9
- package/catalog/editor.html +10 -8
- package/catalog/index.html +615 -564
- package/gemboss-ui.css +3 -3
- package/package.json +5 -2
- package/parts/components.css +1 -1
- package/parts/core.css +1 -1
- package/parts/shell.css +1 -1
- package/src/assistant/attachments.tsx +486 -0
- package/src/assistant/chat-cards.tsx +343 -0
- package/src/assistant/chat.tsx +29 -6
- package/src/assistant/host.tsx +8 -11
- package/src/assistant/index.ts +8 -1
- package/src/assistant-chat.css +1 -1
- package/src/assistant-plain.js +1 -1
- package/src/assistant.css +1 -1
- package/src/auth-field.css +1 -1
- package/src/auth.tsx +4 -2
- package/src/chat-attachments.css +1 -0
- package/src/chat-cards.css +1 -0
- package/src/chat-plain.js +5 -5
- package/src/collections.tsx +8 -1
- package/src/dialog.tsx +68 -11
- package/src/editor/controls.tsx +51 -10
- package/src/editor/field-control.tsx +26 -51
- package/src/editor/field-frame.tsx +4 -10
- package/src/editor/field-spec.ts +4 -2
- package/src/editor/grow-to-text.ts +51 -0
- package/src/editor/index.ts +2 -4
- package/src/editor/inspector-frame.tsx +143 -32
- package/src/editor/items-field.tsx +8 -3
- package/src/editor/items.ts +30 -6
- package/src/editor/panel.tsx +4 -5
- package/src/editor-grow.css +1 -1
- package/src/editor-inspector-frame.css +1 -1
- package/src/editor-media.css +1 -0
- package/src/editor-plain.js +1 -1
- package/src/editor-rail.css +1 -1
- package/src/editor.css +1 -1
- package/src/email-editor/editor.tsx +96 -69
- package/src/email-editor.css +1 -1
- package/src/gem-at-work.css +1 -1
- package/src/gem-at-work.ts +177 -33
- package/src/gem-holo.css +1 -1
- package/src/icons.tsx +42 -0
- package/src/index-table-extras.css +1 -0
- package/src/index-table.tsx +37 -16
- package/src/menu.tsx +7 -3
- package/src/narration.css +1 -1
- package/src/selection.tsx +22 -12
- package/src/editor/chips.tsx +0 -24
- package/src/editor-chips.css +0 -1
package/src/gem-at-work.ts
CHANGED
|
@@ -77,8 +77,15 @@ export interface GemActivity {
|
|
|
77
77
|
/** How far the turn's goal is, measured, not guessed (a clone's likeness to its original, sections built): drawn as a meter
|
|
78
78
|
* with where it started this turn. `unit: "%"` reads `done` as a percent of `total`. */
|
|
79
79
|
goal?: { label: string; done: number; total: number; unit?: "%" };
|
|
80
|
+
/** What a check found, on the blocks it found it on (Chris 08/11: "lỗi nằm đâu"): a dot in its trade's colour with the finding,
|
|
81
|
+
* turned ✓ when a later check finds that block right. The reader names each by its `target`; `source` is the original's
|
|
82
|
+
* section a comparison names, for the editor to put a target to (gem-activity-relay.ts). */
|
|
83
|
+
pins?: GemPin[];
|
|
80
84
|
}
|
|
81
85
|
|
|
86
|
+
/** One finding of a check, on the block it is about. */
|
|
87
|
+
export interface GemPin { target?: GemActivityTarget; source?: number; say: string; trade?: GemTrade; ok?: boolean }
|
|
88
|
+
|
|
82
89
|
/** The crew's trades, as an activity names them (`trades`). */
|
|
83
90
|
export type GemTrade = "copy" | "layout" | "image" | "cro" | "check" | "style";
|
|
84
91
|
|
|
@@ -164,6 +171,15 @@ const HEAT_MIN = 0.75;
|
|
|
164
171
|
const BUILD_LANES = 8;
|
|
165
172
|
const HANDS_MAX = 6;
|
|
166
173
|
const BUILD_PACE = 1.6;
|
|
174
|
+
/** THE STRUCTURE FIRST (Chris 08/11, the reels "Agentic Build" and "AI Agents build my website"): each band of a section built is
|
|
175
|
+
* first blocked out, every block's box dragged out in its kind's colour (a picture's crossed, with its size; words as grey lines),
|
|
176
|
+
* then each step fills its boxes. Words are typed in at BUILD_CPS, a block's typing never longer than TYPE_MAX_MS. */
|
|
177
|
+
const WIRE: Record<BlockKind, string> = { frame: "#c084fc", picture: "#60a5fa", heading: "#facc15", words: "#4ade80", action: "#fb923c" };
|
|
178
|
+
const BUILD_CPS = 70;
|
|
179
|
+
const TYPE_MAX_MS = 1100;
|
|
180
|
+
/** What the extra hands are called, by trade: short names of the work, as the reels' agents are ("Copy", "Palette", "Render"). */
|
|
181
|
+
const HAND_NAMES: Record<Role, readonly string[]> = { lead: ["Gem"], copy: ["Copy", "Typeset", "Headline"], layout: ["Grid", "Spacing", "Layout"],
|
|
182
|
+
image: ["Image", "Render", "Crop"], cro: ["Buttons", "CTA"], check: ["QA", "Lint"], style: ["Palette", "Shadow", "Fonts"] };
|
|
167
183
|
/** What one of the crew says while it goes over a block (`inspect`): its own trade's look at it (the copy expert reads the words). */
|
|
168
184
|
const LOOKING: Record<Role, string> = { lead: "working", copy: "reading", layout: "checking the spacing", image: "checking the picture", cro: "checking the button", check: "checking", style: "checking the look" };
|
|
169
185
|
const FIXING: Record<Role, string> = { lead: "working", copy: "fixing the words", layout: "fixing the layout", image: "fixing the pictures", cro: "fixing the buttons", check: "checking again", style: "fixing the look" };
|
|
@@ -200,7 +216,8 @@ const CREW: ReadonlyArray<{ role: Role; name: string; doing: string; c: string;
|
|
|
200
216
|
{ role: "check", name: "QA", doing: "auto-checking", c: "#5EEAD4", ink: "#16171a" },
|
|
201
217
|
{ role: "style", name: "Smart styling", doing: "tuning", c: "#A3E635", ink: "#16171a" },
|
|
202
218
|
];
|
|
203
|
-
type Member = { role: Role; name: string; doing: string; el: HTMLElement; tag: HTMLElement; x: number; y: number; anim: Animation | null; fade: Animation | null; resting: boolean
|
|
219
|
+
type Member = { role: Role; name: string; doing: string; el: HTMLElement; tag: HTMLElement; x: number; y: number; anim: Animation | null; fade: Animation | null; resting: boolean;
|
|
220
|
+
/** An extra hand: its tag is its name alone. */ quiet?: true };
|
|
204
221
|
/** Buttons, prices and offers are conversion work; pictures the image expert's; colours and fonts smart styling's; words the copy
|
|
205
222
|
* expert's; the rest is layout. */
|
|
206
223
|
const CRO = /^(Button|Cta|Call to action|Price|Offer|Discount|Bundle|Upsell|Countdown)/i;
|
|
@@ -325,11 +342,16 @@ export function createGemAtWork(options: GemAtWorkOptions = {}): GemAtWork {
|
|
|
325
342
|
let ruler: HTMLElement | null = null, counter: HTMLElement | null = null;
|
|
326
343
|
let built = { done: 0, total: 0 };
|
|
327
344
|
const plus = new Map<HTMLElement, HTMLElement>();
|
|
345
|
+
/** Each block's box blocked out ahead of its fill, and the words being typed in (to put back on a skip). */
|
|
346
|
+
const wires = new Map<HTMLElement, HTMLElement>();
|
|
347
|
+
const typedOver = new Map<Text, string>();
|
|
328
348
|
const looked = new Map<Role, number>();
|
|
329
349
|
/** The line by the work (`say`), and the goal's meter in the corner (`goal`) with what it read when the turn first said it. */
|
|
330
350
|
let sayEl: HTMLElement | null = null;
|
|
331
351
|
let goalEl: HTMLElement | null = null;
|
|
332
352
|
let goalAt: { label: string; from: number; frac: number } | null = null;
|
|
353
|
+
/** The findings pinned on the page, by the block they are on. */
|
|
354
|
+
const pinned = new Map<string, HTMLElement>();
|
|
333
355
|
/** The one at work on the stage now, and QA while it rides a sweep to its end. */
|
|
334
356
|
let atWork: Member | undefined;
|
|
335
357
|
let riding: Member | null = null;
|
|
@@ -350,6 +372,8 @@ export function createGemAtWork(options: GemAtWorkOptions = {}): GemAtWork {
|
|
|
350
372
|
let draining = false;
|
|
351
373
|
let epoch = 0;
|
|
352
374
|
let waiting: Array<() => void> = [];
|
|
375
|
+
/** reveal()'s callers, let go by a skip: the build's timers go with the skip, so it would never end by itself. */
|
|
376
|
+
let revealsOut: Array<() => void> = [];
|
|
353
377
|
/** The words written so far in each field: its next draft carries on from them. */
|
|
354
378
|
const typed = new Map<string, string>();
|
|
355
379
|
let handsOn = -Infinity;
|
|
@@ -449,7 +473,7 @@ export function createGemAtWork(options: GemAtWorkOptions = {}): GemAtWork {
|
|
|
449
473
|
}
|
|
450
474
|
return crew;
|
|
451
475
|
}
|
|
452
|
-
function say(m: Member, doing?: string) { m.tag.textContent = m.role === "lead" && !doing ? m.name : `${m.name} · ${doing ?? m.doing}`; }
|
|
476
|
+
function say(m: Member, doing?: string) { m.tag.textContent = m.quiet || (m.role === "lead" && !doing) ? m.name : `${m.name} · ${doing ?? m.doing}`; }
|
|
453
477
|
/** How much work a trade has had lately, as of now. */
|
|
454
478
|
function heatOf(role: Role, t = now()): number {
|
|
455
479
|
const h = heat.get(role);
|
|
@@ -886,6 +910,7 @@ export function createGemAtWork(options: GemAtWorkOptions = {}): GemAtWork {
|
|
|
886
910
|
if (!queue.length) hideSkip();
|
|
887
911
|
// The last line and the goal stay a moment past the light, then go with the crew.
|
|
888
912
|
unnarrate(1200);
|
|
913
|
+
unpin(1200);
|
|
889
914
|
leave();
|
|
890
915
|
}
|
|
891
916
|
function leave() {
|
|
@@ -955,6 +980,8 @@ export function createGemAtWork(options: GemAtWorkOptions = {}): GemAtWork {
|
|
|
955
980
|
for (const band of bandsOf([...kinds.keys()])) {
|
|
956
981
|
const area = bandBox(band);
|
|
957
982
|
follow(area);
|
|
983
|
+
// The structure first: every block of the band blocked out, many hands at once; then each step fills its boxes.
|
|
984
|
+
if (pace && mode === "full") await blueprint(readingOrder(band), kinds, quick, was);
|
|
958
985
|
for (const { kind, step } of BUILD_ORDER) {
|
|
959
986
|
const group = readingOrder(band.filter((b) => kinds.get(b) === kind));
|
|
960
987
|
if (!group.length) continue;
|
|
@@ -1019,25 +1046,31 @@ export function createGemAtWork(options: GemAtWorkOptions = {}): GemAtWork {
|
|
|
1019
1046
|
}
|
|
1020
1047
|
function hand(kind: BlockKind): Member | undefined {
|
|
1021
1048
|
const free = arrive().filter((x) => !onBlock.has(x));
|
|
1049
|
+
// The counter says how many are live the moment one joins, not only when a block is done.
|
|
1050
|
+
const take = (m: Member) => { wake(m); count(0); return m; };
|
|
1022
1051
|
for (const role of TAKERS[kind]) {
|
|
1023
1052
|
const m = free.find((x) => x.role === role);
|
|
1024
|
-
if (m)
|
|
1053
|
+
if (m) return take(m);
|
|
1025
1054
|
}
|
|
1026
1055
|
// The crew all busy: one of the trade's extra hands, a free one or a new one flown in from the middle of the screen.
|
|
1027
1056
|
const role = TAKERS[kind][0];
|
|
1028
1057
|
const spare = hands.find((h) => h.role === role && !onBlock.has(h));
|
|
1029
|
-
if (spare)
|
|
1058
|
+
if (spare) return take(spare);
|
|
1030
1059
|
if (!crew.length || !pace || hands.length >= HANDS_MAX) return undefined;
|
|
1031
1060
|
const c = CREW.find((x) => x.role === role)!, v = view(), el = doc.createElement("div");
|
|
1032
1061
|
el.className = "gb-gaw__cursor is-hand";
|
|
1033
1062
|
el.style.setProperty("--c", c.c);
|
|
1034
|
-
el.
|
|
1063
|
+
el.style.setProperty("--ink", c.ink);
|
|
1064
|
+
el.innerHTML = `${ARROW}<span class="gb-gaw__tag"></span>`;
|
|
1035
1065
|
ensureLayer().append(el);
|
|
1036
1066
|
const x = v.x + v.w / 2, y = v.y + v.h / 2;
|
|
1037
1067
|
el.style.transform = `translate(${x}px,${y}px)`;
|
|
1038
1068
|
move(el, [{ opacity: "0" }, { opacity: "1" }], 200);
|
|
1039
|
-
const
|
|
1069
|
+
const names = HAND_NAMES[role], name = names[hands.filter((h) => h.role === role).length % names.length]!;
|
|
1070
|
+
const m: Member = { ...c, name, el, tag: el.querySelector(".gb-gaw__tag") as HTMLElement, x, y, anim: null, fade: null, resting: false, quiet: true };
|
|
1071
|
+
say(m);
|
|
1040
1072
|
hands.push(m);
|
|
1073
|
+
count(0);
|
|
1041
1074
|
return m;
|
|
1042
1075
|
}
|
|
1043
1076
|
/** A "+" at the corner of a block whose turn is next: where it is about to go. */
|
|
@@ -1053,10 +1086,11 @@ export function createGemAtWork(options: GemAtWorkOptions = {}): GemAtWork {
|
|
|
1053
1086
|
built.done += k;
|
|
1054
1087
|
if (!built.total || mode !== "full") return;
|
|
1055
1088
|
if (!counter) { counter = doc.createElement("div"); counter.className = "gb-gaw-count"; counter.setAttribute("aria-hidden", "true"); root.append(counter); }
|
|
1056
|
-
const at = [...crew.filter((m) => !m.resting)
|
|
1089
|
+
const at = [...crew, ...hands].filter((m) => !m.resting);
|
|
1057
1090
|
const dots = at.slice(0, 8).map((m) => { const d = doc.createElement("b"); d.style.background = CREW.find((c) => c.role === m.role)!.c; return d; });
|
|
1058
1091
|
const bar = doc.createElement("i");
|
|
1059
|
-
|
|
1092
|
+
const done = Math.min(built.done, built.total);
|
|
1093
|
+
counter.replaceChildren(...dots, doc.createTextNode(` ${at.length} agents live · ${done} / ${built.total} blocks · ${done >= built.total ? "done" : "building"}`), bar);
|
|
1060
1094
|
bar.style.transform = `scaleX(${Math.min(1, built.done / built.total)})`;
|
|
1061
1095
|
}
|
|
1062
1096
|
/** A pixel ruler across the top of the screen while sections are built, as a design tool has (under a bar that sticks to the top). */
|
|
@@ -1076,6 +1110,10 @@ export function createGemAtWork(options: GemAtWorkOptions = {}): GemAtWork {
|
|
|
1076
1110
|
hands = [];
|
|
1077
1111
|
for (const p of plus.values()) p.remove();
|
|
1078
1112
|
plus.clear();
|
|
1113
|
+
for (const w of wires.values()) w.remove();
|
|
1114
|
+
wires.clear();
|
|
1115
|
+
for (const [node, full] of typedOver) node.nodeValue = full;
|
|
1116
|
+
typedOver.clear();
|
|
1079
1117
|
ruler?.remove(); ruler = null;
|
|
1080
1118
|
counter?.remove(); counter = null;
|
|
1081
1119
|
built = { done: 0, total: 0 };
|
|
@@ -1090,6 +1128,18 @@ export function createGemAtWork(options: GemAtWorkOptions = {}): GemAtWork {
|
|
|
1090
1128
|
const worker = hand(kind);
|
|
1091
1129
|
if (worker) { onBlock.add(worker); say(worker, worker.role === TAKERS[kind][0] ? VERB[kind] : undefined); }
|
|
1092
1130
|
try {
|
|
1131
|
+
const wire = wires.get(b);
|
|
1132
|
+
if (wire) {
|
|
1133
|
+
// Its box is out already (blueprint): the hand goes into it and fills it; no second box over the first.
|
|
1134
|
+
if (worker) travel(worker, bx.x + 6, bx.y + 6, 240 / hurry);
|
|
1135
|
+
await wait(250 / hurry);
|
|
1136
|
+
boxOut();
|
|
1137
|
+
b.style.opacity = own;
|
|
1138
|
+
await fill(b, kind, hurry, worker, picture ? wire : null);
|
|
1139
|
+
wires.delete(b);
|
|
1140
|
+
gone(wire, 220);
|
|
1141
|
+
return;
|
|
1142
|
+
}
|
|
1093
1143
|
// To the corner.
|
|
1094
1144
|
if (worker) travel(worker, bx.x, bx.y, 320 / hurry);
|
|
1095
1145
|
await wait(340 / hurry);
|
|
@@ -1120,29 +1170,7 @@ export function createGemAtWork(options: GemAtWorkOptions = {}): GemAtWork {
|
|
|
1120
1170
|
sel.append(dim);
|
|
1121
1171
|
move(dim, [{ opacity: "0" }, { opacity: "1" }], 140);
|
|
1122
1172
|
b.style.opacity = own;
|
|
1123
|
-
|
|
1124
|
-
// The tint held a moment, then the picture comes up through it.
|
|
1125
|
-
if (typeof b.animate === "function") b.animate([{ opacity: 0 }, { opacity: 0, offset: 0.45 }, { opacity: 1 }], { duration: 1100 / hurry, easing: EASE });
|
|
1126
|
-
await wait(500 / hurry);
|
|
1127
|
-
gone(tint ?? undefined, 600 / hurry);
|
|
1128
|
-
await wait(700 / hurry);
|
|
1129
|
-
} else if (kind === "heading" || kind === "words") {
|
|
1130
|
-
const wipe = Math.max(500, Math.min(1300, words * 14)) / hurry;
|
|
1131
|
-
if (typeof b.animate === "function") b.animate([{ clipPath: "inset(-4px 100% -4px -4px)" }, { clipPath: "inset(-4px -4px -4px -4px)" }], { duration: wipe, easing: "linear" });
|
|
1132
|
-
const caret = piece("gb-gaw__caret", { x: bx.x, y: bx.y, w: 2, h: Math.min(bx.h, 60) });
|
|
1133
|
-
move(caret, [{ transform: "translateX(0)" }, { transform: `translateX(${bx.w}px)` }], wipe);
|
|
1134
|
-
if (worker) { worker.anim?.cancel(); travel(worker, bx.x + bx.w + 4, bx.y + Math.min(bx.h, 60) * 0.6, wipe); }
|
|
1135
|
-
await wait(wipe);
|
|
1136
|
-
caret.remove();
|
|
1137
|
-
} else if (kind === "action") {
|
|
1138
|
-
// A button: it arrives whole.
|
|
1139
|
-
if (typeof b.animate === "function") b.animate([{ opacity: 0, transform: "scale(.94)" }, { opacity: 1, transform: "scale(1)" }], { duration: 420 / hurry, easing: EASE });
|
|
1140
|
-
await wait(420 / hurry);
|
|
1141
|
-
} else {
|
|
1142
|
-
// The structure: its fill comes up in the box.
|
|
1143
|
-
if (typeof b.animate === "function") b.animate([{ opacity: 0 }, { opacity: 1 }], { duration: 420 / hurry, easing: EASE });
|
|
1144
|
-
await wait(420 / hurry);
|
|
1145
|
-
}
|
|
1173
|
+
await fill(b, kind, hurry, worker, tint);
|
|
1146
1174
|
gone(sel, 260);
|
|
1147
1175
|
await wait(160 / hurry);
|
|
1148
1176
|
} finally {
|
|
@@ -1151,6 +1179,89 @@ export function createGemAtWork(options: GemAtWorkOptions = {}): GemAtWork {
|
|
|
1151
1179
|
}
|
|
1152
1180
|
}
|
|
1153
1181
|
|
|
1182
|
+
/** A block's content comes into its box: a picture up through the tint, words typed in, a button whole, a frame's fill. */
|
|
1183
|
+
async function fill(b: HTMLElement, kind: BlockKind, hurry: number, worker: Member | undefined, tint: HTMLElement | null) {
|
|
1184
|
+
if (kind === "picture") {
|
|
1185
|
+
// The tint held a moment, then the picture comes up through it.
|
|
1186
|
+
if (typeof b.animate === "function") b.animate([{ opacity: 0 }, { opacity: 0, offset: 0.45 }, { opacity: 1 }], { duration: 1100 / hurry, easing: EASE });
|
|
1187
|
+
await wait(500 / hurry);
|
|
1188
|
+
gone(tint ?? undefined, 600 / hurry);
|
|
1189
|
+
await wait(700 / hurry);
|
|
1190
|
+
} else if (kind === "heading" || kind === "words") {
|
|
1191
|
+
await typeIn(b, hurry, worker);
|
|
1192
|
+
} else if (kind === "action") {
|
|
1193
|
+
// A button: it arrives whole.
|
|
1194
|
+
if (typeof b.animate === "function") b.animate([{ opacity: 0, transform: "scale(.94)" }, { opacity: 1, transform: "scale(1)" }], { duration: 420 / hurry, easing: EASE });
|
|
1195
|
+
await wait(420 / hurry);
|
|
1196
|
+
} else {
|
|
1197
|
+
// The structure: its fill comes up in the box.
|
|
1198
|
+
if (typeof b.animate === "function") b.animate([{ opacity: 0 }, { opacity: 1 }], { duration: 420 / hurry, easing: EASE });
|
|
1199
|
+
await wait(420 / hurry);
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1202
|
+
/** A block's words typed in a character at a time behind a caret at the end of what is typed (the reels' "Agentic Gr|"), then
|
|
1203
|
+
* exactly what they were; a skip puts them back (unbuild). A block with no words of its own comes up whole. */
|
|
1204
|
+
async function typeIn(b: HTMLElement, hurry: number, worker: Member | undefined) {
|
|
1205
|
+
const node = ownText(b), full = node?.nodeValue ?? "", run = revealing;
|
|
1206
|
+
if (!node || !full.trim()) {
|
|
1207
|
+
if (typeof b.animate === "function") b.animate([{ opacity: 0 }, { opacity: 1 }], { duration: 300 / hurry, easing: EASE });
|
|
1208
|
+
await wait(300 / hurry);
|
|
1209
|
+
return;
|
|
1210
|
+
}
|
|
1211
|
+
const ms = Math.max(300, Math.min(TYPE_MAX_MS, (full.length / BUILD_CPS) * 1000)) / hurry, steps = Math.max(2, Math.min(40, full.length));
|
|
1212
|
+
typedOver.set(node, full);
|
|
1213
|
+
const caret = piece("gb-gaw__caret"), end = doc.createRange();
|
|
1214
|
+
try {
|
|
1215
|
+
for (let i = 1; i <= steps && revealing === run; i++) {
|
|
1216
|
+
node.nodeValue = full.slice(0, Math.round((full.length * i) / steps));
|
|
1217
|
+
end.setStart(node, node.length);
|
|
1218
|
+
end.setEnd(node, node.length);
|
|
1219
|
+
const r = box(end);
|
|
1220
|
+
place(caret, { x: r.x, y: r.y, w: 2, h: Math.max(10, r.h) });
|
|
1221
|
+
if (worker && i % 5 === 1) travel(worker, r.x + 6, r.y + r.h * 0.7, 140);
|
|
1222
|
+
await wait(ms / steps);
|
|
1223
|
+
}
|
|
1224
|
+
} finally {
|
|
1225
|
+
node.nodeValue = full;
|
|
1226
|
+
typedOver.delete(node);
|
|
1227
|
+
caret.remove();
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1230
|
+
/** A band blocked out: every block's box dragged out in its kind's colour, eight hands at a time, each a moment after the last. */
|
|
1231
|
+
async function blueprint(blocks: HTMLElement[], kinds: Map<HTMLElement, BlockKind>, hurry: number, run: typeof revealing) {
|
|
1232
|
+
tellStep("laying out the structure");
|
|
1233
|
+
const going = new Set<Promise<void>>();
|
|
1234
|
+
for (const b of blocks) {
|
|
1235
|
+
if (revealing !== run) return;
|
|
1236
|
+
while (going.size >= BUILD_LANES) await Promise.race(going);
|
|
1237
|
+
const job: Promise<void> = wireBlock(b, kinds.get(b) ?? "frame", hurry).finally(() => { going.delete(job); });
|
|
1238
|
+
going.add(job);
|
|
1239
|
+
await wait(70 / hurry);
|
|
1240
|
+
}
|
|
1241
|
+
await Promise.all(going);
|
|
1242
|
+
}
|
|
1243
|
+
/** One block's box blocked out: to its corner, pressed, dragged out in its kind's colour; a picture's crossed with its size. */
|
|
1244
|
+
async function wireBlock(b: HTMLElement, kind: BlockKind, hurry: number) {
|
|
1245
|
+
const bx = box(b), worker = hand(kind);
|
|
1246
|
+
if (worker) { onBlock.add(worker); travel(worker, bx.x, bx.y, 220 / hurry); }
|
|
1247
|
+
try {
|
|
1248
|
+
await wait(230 / hurry);
|
|
1249
|
+
const w = piece(`gb-gaw__wire is-${kind}`, bx);
|
|
1250
|
+
w.style.setProperty("--c", WIRE[kind]);
|
|
1251
|
+
if (kind === "picture") { const size = doc.createElement("b"); size.textContent = `IMG · ${Math.round(bx.w)}×${Math.round(bx.h)}`; w.append(size); }
|
|
1252
|
+
const drag = Math.max(240, Math.min(520, 160 + (bx.w + bx.h) * 0.2)) / hurry;
|
|
1253
|
+
move(w, [{ clipPath: "inset(0 100% 100% 0)" }, { clipPath: "inset(0 0 0 0)" }], drag);
|
|
1254
|
+
if (worker) travel(worker, bx.x + bx.w + 4, bx.y + bx.h + 4, drag);
|
|
1255
|
+
// The guides a design tool draws while a box is dragged out, across the screen from its top and left edges.
|
|
1256
|
+
const v = view();
|
|
1257
|
+
for (const g of [piece("gb-gaw__guide", { x: v.x, y: bx.y, w: v.w, h: 1 }), piece("gb-gaw__guide", { x: bx.x, y: v.y, w: 1, h: v.h })]) later(() => gone(g, 240), drag + 200);
|
|
1258
|
+
wires.set(b, w);
|
|
1259
|
+
await wait(drag);
|
|
1260
|
+
} finally {
|
|
1261
|
+
if (worker) onBlock.delete(worker);
|
|
1262
|
+
}
|
|
1263
|
+
}
|
|
1264
|
+
|
|
1154
1265
|
function push(raw: unknown) {
|
|
1155
1266
|
if (mode === "off" || !isActivity(raw)) return;
|
|
1156
1267
|
// Skipped: the rest of this turn is not drawn; its landing ends the skip.
|
|
@@ -1231,6 +1342,32 @@ export function createGemAtWork(options: GemAtWorkOptions = {}): GemAtWork {
|
|
|
1231
1342
|
move(bar, [{ transform: `scaleX(${goalAt.frac})` }, { transform: `scaleX(${frac})` }], 700);
|
|
1232
1343
|
goalAt.frac = frac;
|
|
1233
1344
|
}
|
|
1345
|
+
/** What a check found, on the blocks it is about: a dot in its trade's colour by the block's top-right corner, the finding beside
|
|
1346
|
+
* it; one found right since turns ✓ and goes. A pin whose block is not on the page is left out. */
|
|
1347
|
+
function drawPins(list: readonly GemPin[]) {
|
|
1348
|
+
for (const p of list.slice(0, 24)) {
|
|
1349
|
+
if (!p || typeof p.say !== "string" || !p.target) continue;
|
|
1350
|
+
const key = keyOf(p.target), was = pinned.get(key);
|
|
1351
|
+
if (p.ok) { if (was) { was.classList.add("is-ok"); was.lastElementChild!.textContent = "✓ fixed"; pinned.delete(key); later(() => gone(was, 300), 2400); } continue; }
|
|
1352
|
+
const hit = find(p.target);
|
|
1353
|
+
if (!hit) continue;
|
|
1354
|
+
const r = box(hit.el), v = view();
|
|
1355
|
+
const el = was ?? piece("gb-gaw__pin");
|
|
1356
|
+
if (!was) {
|
|
1357
|
+
el.innerHTML = "<i></i><span></span>";
|
|
1358
|
+
el.style.setProperty("--c", CREW.find((c) => c.role === (p.trade ?? "check"))?.c ?? CREW[0]!.c);
|
|
1359
|
+
move(el, [{ opacity: "0" }, { opacity: "1" }], 220);
|
|
1360
|
+
pinned.set(key, el);
|
|
1361
|
+
}
|
|
1362
|
+
el.lastElementChild!.textContent = p.say.slice(0, 90);
|
|
1363
|
+
const x = Math.max(v.x + 8, Math.min(r.x + r.w - 12, v.x + v.w - 20) - 300), y = r.y + 10;
|
|
1364
|
+
el.style.transform = `translate(${Math.round(x)}px,${Math.round(y)}px)`;
|
|
1365
|
+
}
|
|
1366
|
+
}
|
|
1367
|
+
function unpin(after = 0) {
|
|
1368
|
+
for (const el of pinned.values()) if (after) gone(el, 300, after); else el.remove();
|
|
1369
|
+
pinned.clear();
|
|
1370
|
+
}
|
|
1234
1371
|
/** The line and the meter go: with the turn (after the light) or at once (Skip). */
|
|
1235
1372
|
function unnarrate(after = 0) {
|
|
1236
1373
|
if (sayEl) { if (after) gone(sayEl, 300, after); else sayEl.remove(); sayEl = null; }
|
|
@@ -1301,6 +1438,7 @@ export function createGemAtWork(options: GemAtWorkOptions = {}): GemAtWork {
|
|
|
1301
1438
|
if (a.kind !== "land") {
|
|
1302
1439
|
if (typeof a.say === "string" && a.say.trim()) narrate(a.say.trim().slice(0, 120)); else placeSay();
|
|
1303
1440
|
if (a.goal) showGoal(a.goal);
|
|
1441
|
+
if (Array.isArray(a.pins)) drawPins(a.pins);
|
|
1304
1442
|
}
|
|
1305
1443
|
} catch {
|
|
1306
1444
|
// The bottom of the ladder: the page as it is.
|
|
@@ -1315,6 +1453,7 @@ export function createGemAtWork(options: GemAtWorkOptions = {}): GemAtWork {
|
|
|
1315
1453
|
stopTicker();
|
|
1316
1454
|
hideSkip();
|
|
1317
1455
|
unnarrate();
|
|
1456
|
+
unpin();
|
|
1318
1457
|
unbuild();
|
|
1319
1458
|
// The calm clock stops where it is: nothing queued is drawn, and whoever waits on it is let go.
|
|
1320
1459
|
epoch += 1;
|
|
@@ -1324,6 +1463,7 @@ export function createGemAtWork(options: GemAtWorkOptions = {}): GemAtWork {
|
|
|
1324
1463
|
queue = [];
|
|
1325
1464
|
for (const item of left) item.done?.();
|
|
1326
1465
|
for (const done of waiting.splice(0)) done();
|
|
1466
|
+
for (const done of revealsOut.splice(0)) done();
|
|
1327
1467
|
for (const m of marks.values()) putBack(m);
|
|
1328
1468
|
if (revealing) { for (const { e, opacity, clip } of revealing) { for (const an of e.getAnimations()) an.cancel(); e.style.opacity = opacity; e.style.clipPath = clip; } revealing = null; }
|
|
1329
1469
|
lastStack = null;
|
|
@@ -1352,8 +1492,12 @@ export function createGemAtWork(options: GemAtWorkOptions = {}): GemAtWork {
|
|
|
1352
1492
|
|
|
1353
1493
|
function reveal(sections?: readonly string[]): Promise<void> {
|
|
1354
1494
|
if (mode === "off" || skipped) return Promise.resolve();
|
|
1355
|
-
|
|
1356
|
-
|
|
1495
|
+
return new Promise<void>((done) => {
|
|
1496
|
+
const finish = () => { revealsOut = revealsOut.filter((d) => d !== finish); done(); };
|
|
1497
|
+
revealsOut.push(finish);
|
|
1498
|
+
if (!calm) void showSaved(sections, 1).then(finish, finish);
|
|
1499
|
+
else { queue.push({ at: now(), reveal: sections, done: finish }); void drain(); }
|
|
1500
|
+
});
|
|
1357
1501
|
}
|
|
1358
1502
|
|
|
1359
1503
|
return {
|
package/src/gem-holo.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.ui-holo{--ui-holo-size: 32px;position:relative;display:inline-block;flex:none;width:var(--ui-holo-size);height:var(--ui-holo-size);isolation:isolate;vertical-align:middle}.ui-holo:before{content:"";position:absolute;inset:0;border-radius:42% 58% 63% 37%/41% 44% 56% 59%;background:conic-gradient(from 0deg,#8b93ff,#4fe0b4,#ffc861,#ff7a9c,#8b93ff);filter:blur(calc(var(--ui-holo-size) * .08)) saturate(1.3);animation:ui-holo-morph 9s ease-in-out infinite,ui-holo-turn 14s linear infinite}.ui-holo:after{content:"";position:absolute;inset:12%;border-radius:50%;background:radial-gradient(circle at 32% 28%,#fffffff2,#fff0 46%);mix-blend-mode:screen;animation:ui-holo-morph 9s ease-in-out infinite reverse}.ui-holo>svg{position:absolute;inset:22%;z-index:1;width:56%;height:56%}.ui-holo--busy:before{animation-duration:3s,5s}@keyframes ui-holo-morph{0%,to{border-radius:42% 58% 63% 37%/41% 44% 56% 59%}33%{border-radius:63% 37% 38% 62%/55% 62% 38% 45%}66%{border-radius:38% 62% 56% 44%/63% 37%}}@keyframes ui-holo-turn{to{transform:rotate(360deg)}}@media (prefers-reduced-motion: reduce){.ui-holo:before,.ui-holo:after{animation:none}}
|
|
1
|
+
.ui-holo{--ui-holo-size: 32px;position:relative;display:inline-block;flex:none;width:var(--ui-holo-size);height:var(--ui-holo-size);isolation:isolate;vertical-align:middle;background:none}.ui-holo:before{content:"";position:absolute;inset:0;border-radius:42% 58% 63% 37%/41% 44% 56% 59%;background:conic-gradient(from 0deg,#8b93ff,#4fe0b4,#ffc861,#ff7a9c,#8b93ff);filter:blur(calc(var(--ui-holo-size) * .08)) saturate(1.3);animation:ui-holo-morph 9s ease-in-out infinite,ui-holo-turn 14s linear infinite}.ui-holo:after{content:"";position:absolute;inset:12%;border-radius:50%;background:radial-gradient(circle at 32% 28%,#fffffff2,#fff0 46%);mix-blend-mode:screen;animation:ui-holo-morph 9s ease-in-out infinite reverse}.ui-holo>svg{position:absolute;inset:22%;z-index:1;width:56%;height:56%}.ui-holo--busy:before{animation-duration:3s,5s}@keyframes ui-holo-morph{0%,to{border-radius:42% 58% 63% 37%/41% 44% 56% 59%}33%{border-radius:63% 37% 38% 62%/55% 62% 38% 45%}66%{border-radius:38% 62% 56% 44%/63% 37%}}@keyframes ui-holo-turn{to{transform:rotate(360deg)}}@media (prefers-reduced-motion: reduce){.ui-holo:before,.ui-holo:after{animation:none}}
|
package/src/icons.tsx
CHANGED
|
@@ -97,6 +97,35 @@ const P = {
|
|
|
97
97
|
grip: <><circle cx="7.5" cy="5" r="1" /><circle cx="12.5" cy="5" r="1" /><circle cx="7.5" cy="10" r="1" /><circle cx="12.5" cy="10" r="1" /><circle cx="7.5" cy="15" r="1" /><circle cx="12.5" cy="15" r="1" /></>,
|
|
98
98
|
timer: <><path d="M5.5 3h9M5.5 17h9" /><path d="M6.5 3c0 3.5 3.5 4.5 3.5 7s-3.5 3.5-3.5 7M13.5 3c0 3.5-3.5 4.5-3.5 7s3.5 3.5 3.5 7" /></>,
|
|
99
99
|
target: <><circle cx="10" cy="10" r="7" /><circle cx="10" cy="10" r="4" /><circle cx="10" cy="10" r="1" /></>,
|
|
100
|
+
// THE CHAT FRAME (11/11/2026, Chris: "đổi icon các thứ cho đồng bộ", canvas board ChatKit): every glyph the assistant panel
|
|
101
|
+
// drew on its own (a 24px paperclip at 2px, a 24px mic at 1.8px, a filled Polaris arrow, header SVGs at 1.6/1.7px, ✕ ⏳ ✓ ✳ ❯ ⏺
|
|
102
|
+
// ☐ ☑ ▲ as text) now comes from this set. The panel's window controls: full screen and back (`expand`/`shrink`, the same
|
|
103
|
+
// diagonal axis, arrows out and in).
|
|
104
|
+
expand: <path d="M11 9l5-5M16 4h-3.5M16 4v3.5M9 11l-5 5M4 16h3.5M4 16v-3.5" />,
|
|
105
|
+
shrink: <path d="M16 4l-5 5M11 9h3.5M11 9V5.5M4 16l5-5M9 11H5.5M9 11v3.5" />,
|
|
106
|
+
// The composer: send (an arrow up, the board's; `send` stays the team chat's paper plane), stop (a filled square: the
|
|
107
|
+
// attribute on the child beats the <g>'s fill="none"), the microphone, and what the "+" menu offers: a file from this
|
|
108
|
+
// computer, a picture from the library, a screenshot, a mention.
|
|
109
|
+
arrowUp: <path d="M10 16V4.5M5 9.5l5-5 5 5" />,
|
|
110
|
+
stop: <rect x="5.5" y="5.5" width="9" height="9" rx="1.6" fill="currentColor" />,
|
|
111
|
+
mic: <><rect x="7.5" y="2.5" width="5" height="9.2" rx="2.5" /><path d="M4.2 9.2a5.8 5.8 0 0 0 11.6 0M10 15v2.5" /></>,
|
|
112
|
+
upload: <path d="M10 13V3.5M6 7.5l4-4 4 4M3.5 13v2.5c0 .6.4 1 1 1h11c.6 0 1-.4 1-1V13" />,
|
|
113
|
+
media: <><rect x="5.5" y="5.5" width="11.5" height="11" rx="1.6" /><path d="M3 13.5V4.6C3 3.7 3.7 3 4.6 3h8.9" /><path d="M6 15.5l3.2-3.2 2.3 2.3 1.7-1.7 3.3 3.3" /></>,
|
|
114
|
+
screenshot: <><path d="M3 6.5v-2A1.5 1.5 0 0 1 4.5 3h2M13.5 3h2A1.5 1.5 0 0 1 17 4.5v2M17 13.5v2a1.5 1.5 0 0 1-1.5 1.5h-2M6.5 17h-2A1.5 1.5 0 0 1 3 15.5v-2" /><rect x="6.5" y="7" width="7" height="6" rx="1" /></>,
|
|
115
|
+
at: <><circle cx="10" cy="10" r="2.8" /><path d="M12.8 10v1.2a2.2 2.2 0 0 0 4.4 0V10a7.2 7.2 0 1 0-2.8 5.7" /></>,
|
|
116
|
+
// A product in a mention list (a price tag).
|
|
117
|
+
tag: <><path d="M3 10.2V4c0-.6.4-1 1-1h6.2l6.8 6.8-7.2 7.2z" /><circle cx="6.8" cy="6.8" r="1" /></>,
|
|
118
|
+
// Under an answer: copy it, rate it; on a change card: undo it.
|
|
119
|
+
copy: <><rect x="7" y="7" width="9.5" height="9.5" rx="1.8" /><path d="M13 7V5.3c0-1-.8-1.8-1.8-1.8H5.3c-1 0-1.8.8-1.8 1.8v5.9c0 1 .8 1.8 1.8 1.8H7" /></>,
|
|
120
|
+
thumbsUp: <path d="M6.5 9v7.5H4a1 1 0 0 1-1-1V10a1 1 0 0 1 1-1zM6.5 9l3-5.5c1 0 2 .8 2 2V8h3.6a1.5 1.5 0 0 1 1.5 1.8l-1.1 5.5a1.5 1.5 0 0 1-1.5 1.2H6.5" />,
|
|
121
|
+
thumbsDown: <path d="M6.5 11V3.5H4a1 1 0 0 0-1 1V10a1 1 0 0 0 1 1zM6.5 11l3 5.5c1 0 2-.8 2-2V12h3.6a1.5 1.5 0 0 0 1.5-1.8l-1.1-5.5a1.5 1.5 0 0 0-1.5-1.2H6.5" />,
|
|
122
|
+
undo: <path d="M7.5 4.5 4 8l3.5 3.5M4 8h7.5a4.5 4.5 0 0 1 0 9H9" />,
|
|
123
|
+
// A step's state, the way the ChatKit board draws a plan: done `check`, failed `close`, running `dot`, waiting `circle`; a
|
|
124
|
+
// plan's own boxes `square` / `squareCheck` (☐ ☑ until 11/11).
|
|
125
|
+
dot: <circle cx="10" cy="10" r="2.6" fill="currentColor" />,
|
|
126
|
+
circle: <circle cx="10" cy="10" r="5" />,
|
|
127
|
+
square: <rect x="4" y="4" width="12" height="12" rx="2.2" />,
|
|
128
|
+
squareCheck: <><rect x="4" y="4" width="12" height="12" rx="2.2" /><path d="M7 10.2l2.1 2.1L13.2 8" /></>,
|
|
100
129
|
} satisfies Record<string, React.ReactNode>;
|
|
101
130
|
// `satisfies`, not a `Record<string, …>` annotation: the annotation widened `keyof` to `string`, so a
|
|
102
131
|
// typo (`name="setings"`) type-checked and drew an empty box (review #3474).
|
|
@@ -104,6 +133,19 @@ const P = {
|
|
|
104
133
|
export type IconName = keyof typeof P;
|
|
105
134
|
export const ICON_NAMES = Object.keys(P) as IconName[];
|
|
106
135
|
|
|
136
|
+
/**
|
|
137
|
+
* The chat frame's icons (11/11/2026). In <Icon> like every other name, but NOT in icons-plain.js: a plain page that draws a
|
|
138
|
+
* chat gets them inside the script that draws it (chat-plain.js, assistant-plain.js, checked against <Icon> by their tests), so
|
|
139
|
+
* GemNews' rail, the one page on icons-plain.js, does not carry eighteen glyphs it never draws (CLAUDE.md §9.4: shared weight
|
|
140
|
+
* only shrinks; measured: +134 B gzip over icons-plain.js' ceiling).
|
|
141
|
+
*/
|
|
142
|
+
export const CHAT_ICON_NAMES = [
|
|
143
|
+
"expand", "shrink", "arrowUp", "stop", "mic", "upload", "media", "screenshot", "at", "tag", "copy", "thumbsUp", "thumbsDown",
|
|
144
|
+
"undo", "dot", "circle", "square", "squareCheck",
|
|
145
|
+
] as const satisfies readonly IconName[];
|
|
146
|
+
/** What icons-plain.js carries: every name but the chat's, in icons.tsx order. */
|
|
147
|
+
export const PLAIN_ICON_NAMES = ICON_NAMES.filter((n) => !(CHAT_ICON_NAMES as readonly string[]).includes(n));
|
|
148
|
+
|
|
107
149
|
/** One icon from the GemBoss set. 20px by default; colour is `currentColor`. */
|
|
108
150
|
export function Icon({ name, size = 20, title, className }: { name: IconName; size?: number; title?: string; className?: string }) {
|
|
109
151
|
return (
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.ui-table.ui-table--index :is(th,td).ui-table__primary--fill{width:100%;max-width:0;--ui-trunc: none}.ui-table__primary--fill .ui-table__primary-inner>:first-child{flex:none}.ui-table.ui-table--index tbody td.ui-table__cell--wrap{white-space:normal;overflow-wrap:anywhere}.ui-table.ui-table--index :is(th,td)[data-show-from="848"]{display:none}.ui-bulkbar[data-idle=fold],.ui-index__when-folded{display:none}@container ui-index (min-width: 848px){.ui-table.ui-table--index :is(th,td)[data-show-from="848"]{display:table-cell}.ui-index__until-848{display:none}}@container ui-index (max-width: 768px){.ui-table.ui-table--index :is(th,td).ui-table__primary--fill{width:auto;max-width:none}.ui-bulkbar[data-idle=fold]{display:flex}.ui-index__when-folded{display:inline}.ui-index__when-table{display:none}.ui-table.ui-table--index tbody td:has(>.ui-index__when-table:only-child){display:none}}
|
package/src/index-table.tsx
CHANGED
|
@@ -13,12 +13,15 @@
|
|
|
13
13
|
* has no header), and Escape clears the selection.
|
|
14
14
|
* - Below 768 of ITS container the table folds into a list (collections.css): the title line, then the other cells on
|
|
15
15
|
* one caption line (`label` prefixes a value; `condensed: "hide"` leaves a cell out), checkbox and actions kept.
|
|
16
|
+
* - Column `width`, `wrap` and `showFrom`, and the classes `ui-index__when-table`, `ui-index__when-folded`, `ui-index__until-848`,
|
|
17
|
+
* are for a table with more columns than its room holds at one line each (index-table-extras.css, README "Collections").
|
|
16
18
|
*
|
|
17
19
|
* Every prop that describes the table is plain data (rows of rendered cells, `sortHref` strings), so a server
|
|
18
20
|
* component can render it; the callbacks (`onSort`, `onSelectionChange`, bulk `onAction`) need a client parent.
|
|
19
|
-
* Its own module, "use client":
|
|
21
|
+
* Its own module, "use client": the admin's budgeted first-load routes (the shell, the dashboard) do not pull it in.
|
|
20
22
|
*/
|
|
21
23
|
import "./collections.css"; // its own stylesheet travels with it (0.23.0): a surface that never renders it never loads it
|
|
24
|
+
import "./index-table-extras.css"; // what the table gained after collections.css reached its ceiling, born an entry
|
|
22
25
|
import React, { useEffect, useRef } from "react";
|
|
23
26
|
import { ariaSort, SortHeader, CollectionSkeleton, type CollectionColumn, type CollectionSort, type SortDirection, type SortLinkProps } from "./collections";
|
|
24
27
|
import { BulkBar, useSelection, type BulkAction } from "./selection";
|
|
@@ -45,6 +48,9 @@ export type IndexTableRow = {
|
|
|
45
48
|
cells: Record<string, React.ReactNode>;
|
|
46
49
|
/** One button and/or a ⋯ menu, at the end of the row. Never more than one visible button. */
|
|
47
50
|
actions?: React.ReactNode;
|
|
51
|
+
/** False: this row has no checkbox, and select-all and a Shift range pass over it (a row nothing can be done to, as a
|
|
52
|
+
* product that exists only as a sample). Its cell stays, so the columns line up. Default true. */
|
|
53
|
+
selectable?: boolean;
|
|
48
54
|
};
|
|
49
55
|
|
|
50
56
|
export type IndexTableProps = {
|
|
@@ -69,6 +75,13 @@ export type IndexTableProps = {
|
|
|
69
75
|
selectAllLabel?: string;
|
|
70
76
|
/** The ⋯ menu that takes the bulk actions which do not fit in the bar's row (0.33.0). */
|
|
71
77
|
moreActionsLabel?: string;
|
|
78
|
+
/** A bulk action is running: every box and action is off, Escape does not clear, and the bar says `bulkBusyLabel`. Answers
|
|
79
|
+
* arrive per row, so a selection changed halfway would no longer be what was pressed. */
|
|
80
|
+
bulkBusy?: boolean;
|
|
81
|
+
bulkBusyLabel?: React.ReactNode;
|
|
82
|
+
/** Keep select-all reachable where the table folds: the folded list has no header, so without this the box only appears
|
|
83
|
+
* once a row is ticked. Shows the bar, the box and `selectAllLabel`, from the first moment. Off by default. */
|
|
84
|
+
selectAllFolded?: boolean;
|
|
72
85
|
/** The link element for titles AND sort links (header and chips, 0.16.0): a Next `Link` from a client module, so
|
|
73
86
|
* opening a row and sorting both stay in the app instead of reloading the page. Default `<a>`. */
|
|
74
87
|
linkAs?: React.ElementType;
|
|
@@ -109,12 +122,18 @@ export function followRow(e: React.MouseEvent<HTMLElement>): void {
|
|
|
109
122
|
a.click();
|
|
110
123
|
}
|
|
111
124
|
|
|
125
|
+
/** A column's `width`, on its header cell. Also its floor: a table shares out its room by what cells can shrink to, so a width
|
|
126
|
+
* alone would give way to a column that fills. */
|
|
127
|
+
const widthStyle = (c: CollectionColumn): React.CSSProperties | undefined => (c.width == null || c.width === "fill" ? undefined : { width: c.width, minWidth: c.width });
|
|
128
|
+
|
|
112
129
|
export function IndexTable({ columns, mediaColumn, rows, label, sort, onSort, bulkActions, selected: selectedProp, onSelectionChange, selectedLabel = (n) => `${n} selected`,
|
|
113
|
-
selectAllLabel = "Select all", moreActionsLabel, linkAs: Link = "a", sortLinkProps, sortLabel = "Sort", state = "ready", stateSlot, loadingRows = 5, actionsColumn, flush, className }: IndexTableProps) {
|
|
114
|
-
|
|
115
|
-
|
|
130
|
+
selectAllLabel = "Select all", moreActionsLabel, bulkBusy, bulkBusyLabel, selectAllFolded, linkAs: Link = "a", sortLinkProps, sortLabel = "Sort", state = "ready", stateSlot, loadingRows = 5, actionsColumn, flush, className }: IndexTableProps) {
|
|
131
|
+
// Only the rows that can be picked take part in the selection. With rows and none of them pickable there is no box to draw:
|
|
132
|
+
// a checkbox column that selects nothing is the inert column this table exists to prevent.
|
|
133
|
+
const ids = rows.filter((r) => r.selectable !== false).map((r) => r.id);
|
|
134
|
+
const selectable = !!(bulkActions && bulkActions.length) && (rows.length === 0 || ids.length > 0);
|
|
116
135
|
// Own or controlled ids, Shift range, select-all, Escape (./selection: the same rules as SelectableResourceList).
|
|
117
|
-
const { rootRef, selSet, chosen, all, some, toggle, toggleAll } = useSelection<HTMLDivElement>(ids, selectedProp, onSelectionChange, selectable);
|
|
136
|
+
const { rootRef, selSet, chosen, all, some, toggle, toggleAll } = useSelection<HTMLDivElement>(ids, selectedProp, onSelectionChange, selectable && !bulkBusy);
|
|
118
137
|
const hasActions = rows.some((r) => r.actions);
|
|
119
138
|
const headBox = useRef<HTMLInputElement>(null);
|
|
120
139
|
useEffect(() => { if (headBox.current) headBox.current.indeterminate = some; }, [some]);
|
|
@@ -138,22 +157,22 @@ export function IndexTable({ columns, mediaColumn, rows, label, sort, onSort, bu
|
|
|
138
157
|
})}
|
|
139
158
|
</div>
|
|
140
159
|
) : null}
|
|
141
|
-
{selectable ? <BulkBar actions={bulkActions!} chosen={chosen} all={all} some={some} onToggleAll={toggleAll} selectedLabel={selectedLabel} selectAllLabel={selectAllLabel} moreActionsLabel={moreActionsLabel} idle="hide" /> : null}
|
|
160
|
+
{selectable ? <BulkBar actions={bulkActions!} chosen={chosen} all={all} some={some} onToggleAll={toggleAll} selectedLabel={selectedLabel} selectAllLabel={selectAllLabel} moreActionsLabel={moreActionsLabel} idle={selectAllFolded ? "fold" : "hide"} busy={!!bulkBusy} busyLabel={bulkBusyLabel} /> : null}
|
|
142
161
|
<div className={cx("ui-table-wrap", flush && "ui-table-wrap--flush")}>
|
|
143
162
|
<table className="ui-table ui-table--index">
|
|
144
163
|
<caption className="ui-sr-only">{label}</caption>
|
|
145
164
|
<thead>
|
|
146
165
|
<tr>
|
|
147
|
-
{selectable ? <th className="ui-table__check" scope="col"><label className="ui-table__checkbox"><input ref={headBox} type="checkbox" checked={all} aria-label={selectAllLabel} onChange={(e) => toggleAll(e.target.checked)} disabled={!showRows || !rows.length} /></label></th> : null}
|
|
166
|
+
{selectable ? <th className="ui-table__check" scope="col"><label className="ui-table__checkbox"><input ref={headBox} type="checkbox" checked={all} aria-label={selectAllLabel} onChange={(e) => toggleAll(e.target.checked)} disabled={!showRows || !rows.length || !!bulkBusy} /></label></th> : null}
|
|
148
167
|
{mediaColumn ? <th scope="col">{mediaColumn.header}</th> : null}
|
|
149
|
-
<th className="ui-table__primary" scope="col" aria-sort={ariaSort(primary, sort)}><SortHeader col={primary} sort={sort} onSort={onSort} linkAs={Link} linkProps={sortLinkProps} /></th>
|
|
150
|
-
{rest.map((c) => <th key={c.key} scope="col" className={c.numeric ? "is-num" : undefined} aria-sort={ariaSort(c, sort)}><SortHeader col={c} sort={sort} onSort={onSort} linkAs={Link} linkProps={sortLinkProps} /></th>)}
|
|
168
|
+
<th className={cx("ui-table__primary", primary.width === "fill" && "ui-table__primary--fill")} scope="col" style={widthStyle(primary)} aria-sort={ariaSort(primary, sort)}><SortHeader col={primary} sort={sort} onSort={onSort} linkAs={Link} linkProps={sortLinkProps} /></th>
|
|
169
|
+
{rest.map((c) => <th key={c.key} scope="col" className={c.numeric ? "is-num" : undefined} style={widthStyle(c)} data-show-from={c.showFrom} aria-sort={ariaSort(c, sort)}><SortHeader col={c} sort={sort} onSort={onSort} linkAs={Link} linkProps={sortLinkProps} /></th>)}
|
|
151
170
|
{hasActions ? <th className="ui-table__actions" scope="col"><span className="ui-sr-only">Actions</span></th> : null}
|
|
152
171
|
</tr>
|
|
153
172
|
</thead>
|
|
154
173
|
{showRows ? (
|
|
155
174
|
<tbody>
|
|
156
|
-
{rows.map((r
|
|
175
|
+
{rows.map((r) => {
|
|
157
176
|
const isSel = selSet.has(r.id);
|
|
158
177
|
const title = r.href
|
|
159
178
|
? <Link className="ui-table__title" href={r.href} target={r.target} rel={r.target === "_blank" ? "noopener" : undefined} title={r.titleText}>{r.title}</Link>
|
|
@@ -162,19 +181,21 @@ export function IndexTable({ columns, mediaColumn, rows, label, sort, onSort, bu
|
|
|
162
181
|
<tr key={r.id} className={cx(r.href && "is-linked", isSel && "is-selected")} aria-selected={selectable ? isSel : undefined} onClick={r.href ? followRow : undefined} onAuxClick={r.href ? followRow : undefined}>
|
|
163
182
|
{selectable ? (
|
|
164
183
|
<td className="ui-table__check" onClick={(e) => { if (e.target === e.currentTarget) (e.currentTarget.querySelector("input") as HTMLInputElement | null)?.click(); }}>
|
|
165
|
-
|
|
166
|
-
<
|
|
167
|
-
|
|
168
|
-
|
|
184
|
+
{r.selectable === false ? null : (
|
|
185
|
+
<label className="ui-table__checkbox">
|
|
186
|
+
<input type="checkbox" checked={isSel} disabled={!!bulkBusy} aria-label={`Select ${r.titleText ?? (typeof r.title === "string" ? r.title : r.id)}`}
|
|
187
|
+
onChange={(e) => toggle(ids.indexOf(r.id), e.target.checked, (e.nativeEvent as MouseEvent).shiftKey)} />
|
|
188
|
+
</label>
|
|
189
|
+
)}
|
|
169
190
|
</td>
|
|
170
191
|
) : null}
|
|
171
192
|
{mediaColumn ? <td data-condensed="hide">{r.media}</td> : null}
|
|
172
|
-
<td className={cx("ui-table__primary", primary.wrap && "ui-table__primary--wrap")} style={primary.truncate != null ? ({ ["--ui-trunc" as string]: typeof primary.truncate === "number" ? `${primary.truncate}px` : primary.truncate } as React.CSSProperties) : undefined}>
|
|
193
|
+
<td className={cx("ui-table__primary", primary.wrap && "ui-table__primary--wrap", primary.width === "fill" && "ui-table__primary--fill")} style={primary.truncate != null ? ({ ["--ui-trunc" as string]: typeof primary.truncate === "number" ? `${primary.truncate}px` : primary.truncate } as React.CSSProperties) : undefined}>
|
|
173
194
|
{r.media && !mediaColumn ? <div className="ui-table__primary-inner">{r.media}<div className="ui-table__primary-text">{title}{r.sub ? <span className="ui-sub">{r.sub}</span> : null}</div></div>
|
|
174
195
|
: <>{title}{r.sub ? <span className="ui-sub">{r.sub}</span> : null}</>}
|
|
175
196
|
</td>
|
|
176
197
|
{rest.map((c) => (
|
|
177
|
-
<td key={c.key} className={c.numeric
|
|
198
|
+
<td key={c.key} className={cx(c.numeric && "is-num", c.wrap && "ui-table__cell--wrap") || undefined} data-label={c.label} data-condensed={c.condensed === "hide" ? "hide" : undefined} data-show-from={c.showFrom}>
|
|
178
199
|
{c.truncate != null ? <span className="ui-trunc" style={{ ["--ui-trunc" as string]: typeof c.truncate === "number" ? `${c.truncate}px` : c.truncate } as React.CSSProperties}>{r.cells[c.key]}</span> : r.cells[c.key]}
|
|
179
200
|
</td>
|
|
180
201
|
))}
|
package/src/menu.tsx
CHANGED
|
@@ -27,8 +27,11 @@ import { chooseRow, closeMenu, focusRow, menuKeyDown, menuRows, openMenu, regist
|
|
|
27
27
|
* its name, `label` still names the list.
|
|
28
28
|
* `select` (04/11/2026, GemX New moment ubm-PZ-4w / 4t): a FIELD trigger instead, as wide as its column, the current choice and a
|
|
29
29
|
* chevron: a choice whose rows say more than an `<option>` can (parts, a mark, a line under the words, a row off with "Later").
|
|
30
|
-
* Named "label: choice" when the choice is words.
|
|
31
|
-
|
|
30
|
+
* Named "label: choice" when the choice is words.
|
|
31
|
+
* `ghost` (10/11/2026): the ⋯ without its border and fill, as the buttons beside it on a toolbar of ghost buttons (the funnel
|
|
32
|
+
* board's step toolbar: Edit page, Remove step, then ⋯). The icon trigger only: a `text` trigger is already drawn as a link and
|
|
33
|
+
* a `select` one is a field, so neither takes it. */
|
|
34
|
+
export function Menu({ label, icon, text, select, end, children, className, disabled, loading, ghost }: {
|
|
32
35
|
label: string;
|
|
33
36
|
icon?: React.ReactNode;
|
|
34
37
|
text?: React.ReactNode;
|
|
@@ -38,6 +41,7 @@ export function Menu({ label, icon, text, select, end, children, className, disa
|
|
|
38
41
|
className?: string;
|
|
39
42
|
disabled?: boolean;
|
|
40
43
|
loading?: boolean;
|
|
44
|
+
ghost?: boolean;
|
|
41
45
|
}) {
|
|
42
46
|
const ref = useRef<HTMLDetailsElement>(null);
|
|
43
47
|
const off = Boolean(disabled || loading);
|
|
@@ -86,7 +90,7 @@ export function Menu({ label, icon, text, select, end, children, className, disa
|
|
|
86
90
|
<svg className="ui-menu__chevron" viewBox="0 0 20 20" width="16" height="16" aria-hidden="true"><path d="M6 8l4 4 4-4" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round" /></svg>
|
|
87
91
|
</summary>
|
|
88
92
|
) : (
|
|
89
|
-
<summary className={text ? "ui-btn ui-menu__trigger" : "ui-btn ui-btn--icon"} aria-label={text ? undefined : label} title={text ? undefined : label}
|
|
93
|
+
<summary className={[text ? "ui-btn ui-menu__trigger" : "ui-btn ui-btn--icon", ghost && !text ? "ui-btn--ghost" : ""].filter(Boolean).join(" ")} aria-label={text ? undefined : label} title={text ? undefined : label}
|
|
90
94
|
aria-haspopup="menu" onClick={onSummary} aria-disabled={off || undefined} aria-busy={loading || undefined} tabIndex={off ? -1 : undefined}>
|
|
91
95
|
{loading ? <span className="ui-menu__busy" aria-hidden="true" />
|
|
92
96
|
: text ? <>{icon ? <span className="ui-menu__trigger-icon" aria-hidden="true">{icon}</span> : null}{text}</>
|
package/src/narration.css
CHANGED
|
@@ -1 +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:
|
|
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:flex-start;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;margin-top:2px}.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)}
|