@gemboss/ui 0.70.2 → 0.73.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.
Files changed (141) hide show
  1. package/CHANGELOG.md +633 -3
  2. package/README.md +170 -11
  3. package/catalog/editor.html +1 -1
  4. package/catalog/index.html +48 -46
  5. package/gemboss-ui.css +4 -4
  6. package/package.json +32 -1
  7. package/parts/components.css +3 -3
  8. package/parts/core.css +1 -1
  9. package/parts/shell.css +2 -2
  10. package/src/app-nav.css +1 -1
  11. package/src/app-shell.css +1 -1
  12. package/src/assistant/chat-cards.tsx +118 -19
  13. package/src/assistant/chat.tsx +209 -22
  14. package/src/assistant/composer-menus.tsx +7 -2
  15. package/src/assistant/dock.ts +97 -10
  16. package/src/assistant/figures.tsx +119 -0
  17. package/src/assistant/gallery.tsx +67 -0
  18. package/src/assistant/hold.ts +51 -0
  19. package/src/assistant/host.tsx +258 -137
  20. package/src/assistant/ideas.tsx +90 -0
  21. package/src/assistant/index.ts +12 -3
  22. package/src/assistant/plus.tsx +61 -0
  23. package/src/assistant/provider.tsx +121 -24
  24. package/src/assistant/sessions.tsx +54 -20
  25. package/src/assistant/window-host.tsx +215 -0
  26. package/src/assistant/window.ts +120 -0
  27. package/src/assistant-chat.css +1 -1
  28. package/src/assistant-figures.css +1 -0
  29. package/src/assistant-hold.css +1 -0
  30. package/src/assistant-places.css +1 -0
  31. package/src/assistant-plain.js +1 -1
  32. package/src/assistant-plus.css +1 -0
  33. package/src/assistant-window-plain.js +1 -0
  34. package/src/assistant-window.css +1 -0
  35. package/src/assistant.css +1 -1
  36. package/src/auth-extras.css +1 -1
  37. package/src/auth-footer.css +1 -1
  38. package/src/auth-steps.css +1 -1
  39. package/src/auth.css +1 -1
  40. package/src/board-move.ts +2 -1
  41. package/src/chat-attachments.css +1 -1
  42. package/src/chat-cards-drawn.css +1 -0
  43. package/src/chat-cards-float.css +1 -0
  44. package/src/chat-cards.css +1 -1
  45. package/src/chat-composer-menus.css +1 -1
  46. package/src/chat-composer.css +1 -1
  47. package/src/chat-plain.js +6 -6
  48. package/src/chat-shortcuts.css +1 -0
  49. package/src/chat-voice.css +1 -1
  50. package/src/chat.css +1 -1
  51. package/src/chips-drawn.css +1 -0
  52. package/src/collections.css +1 -1
  53. package/src/collections.tsx +4 -2
  54. package/src/create-shell.css +1 -1
  55. package/src/dialog.css +1 -1
  56. package/src/editor/choice-cards.tsx +8 -5
  57. package/src/editor/controls.tsx +36 -9
  58. package/src/editor/field-control.tsx +17 -3
  59. package/src/editor/field-spec.ts +17 -4
  60. package/src/editor/index.ts +2 -0
  61. package/src/editor/media-words.ts +21 -0
  62. package/src/editor-color.css +1 -1
  63. package/src/editor-empty.css +1 -0
  64. package/src/editor-insert.css +1 -1
  65. package/src/editor-inspector-frame.css +1 -1
  66. package/src/editor-media.css +1 -1
  67. package/src/editor-picker-grid.css +1 -1
  68. package/src/editor-picker.css +1 -1
  69. package/src/editor-popover.css +1 -1
  70. package/src/editor-repeater.css +1 -1
  71. package/src/editor-tiles.css +1 -1
  72. package/src/editor.css +1 -1
  73. package/src/email-canvas.css +1 -0
  74. package/src/email-card.tsx +44 -0
  75. package/src/email-editor/canvas.tsx +109 -0
  76. package/src/email-editor/editor.tsx +45 -4
  77. package/src/email-editor/index.ts +2 -1
  78. package/src/email-editor/model.ts +9 -1
  79. package/src/email-editor.css +1 -1
  80. package/src/email-parts.css +1 -0
  81. package/src/email-parts.tsx +81 -0
  82. package/src/email-thumb.css +1 -0
  83. package/src/email-thumb.tsx +206 -0
  84. package/src/feedback-dialog.css +1 -0
  85. package/src/feedback-dialog.tsx +122 -0
  86. package/src/flow-strip.css +1 -0
  87. package/src/flow-strip.tsx +50 -0
  88. package/src/gemboss-field-drawn.css +1 -0
  89. package/src/gemboss-field.css +1 -1
  90. package/src/gems.css +1 -1
  91. package/src/icon-frame.tsx +31 -0
  92. package/src/icons.tsx +9 -9
  93. package/src/index.ts +12 -0
  94. package/src/job-card.css +1 -1
  95. package/src/kit-plain.css +1 -1
  96. package/src/kit-plain.js +1 -1
  97. package/src/language-switcher.css +1 -1
  98. package/src/list-page.css +1 -1
  99. package/src/list-page.tsx +6 -3
  100. package/src/list-toolbar.css +1 -1
  101. package/src/media-card.css +1 -0
  102. package/src/members.css +1 -1
  103. package/src/menu-extras.css +1 -1
  104. package/src/menu-layer.ts +2 -0
  105. package/src/menu-select.css +1 -1
  106. package/src/menu.css +1 -1
  107. package/src/menu.tsx +9 -4
  108. package/src/narration.css +1 -1
  109. package/src/pager-extras.css +1 -1
  110. package/src/pager.css +1 -1
  111. package/src/picture-actions.css +1 -0
  112. package/src/picture-actions.tsx +23 -0
  113. package/src/portal.css +1 -1
  114. package/src/question-card.css +1 -1
  115. package/src/rail-fold.css +1 -1
  116. package/src/reactions.css +1 -1
  117. package/src/reader-dialog.css +1 -1
  118. package/src/report-charts.css +1 -1
  119. package/src/segmented.tsx +6 -0
  120. package/src/service-switcher.css +1 -1
  121. package/src/session-rail-plain.js +1 -1
  122. package/src/settings-dialog.css +1 -1
  123. package/src/setup-guide.css +1 -1
  124. package/src/sheet.css +1 -1
  125. package/src/shell.css +1 -1
  126. package/src/shell.tsx +9 -2
  127. package/src/site.css +1 -1
  128. package/src/skill-card.css +1 -1
  129. package/src/skill-flow.css +1 -1
  130. package/src/skill-pages.css +1 -1
  131. package/src/skill-view.css +1 -1
  132. package/src/stage-path.css +1 -1
  133. package/src/stat-tile.css +1 -0
  134. package/src/stat-tile.tsx +39 -0
  135. package/src/status-list.css +1 -1
  136. package/src/team-chat.css +1 -1
  137. package/src/tray-plain.js +1 -0
  138. package/src/tray-search.tsx +116 -0
  139. package/src/tray.css +1 -0
  140. package/src/tray.tsx +250 -0
  141. package/src/ui.css +1 -1
@@ -16,6 +16,10 @@
16
16
  * being spread over three components' effects.
17
17
  */
18
18
 
19
+ // NO IMPORTS in this file: the admin's tests load it straight with Node's type stripping (lib/assistant-dock.ts re-exports it), and
20
+ // Node does not resolve an extensionless sibling (`./window` broke assistant-dock.test.ts, 12/11/2026). The floating window's geometry
21
+ // is window.ts, which nothing Node loads imports.
22
+
19
23
  /**
20
24
  * Where the assistant is drawn. `hidden` still means MOUNTED — the run keeps going.
21
25
  *
@@ -24,9 +28,25 @@
24
28
  * popup, full width height" — and content-radar / partner-radar / GemCommunity each built their own right-side panel.
25
29
  * A surface opts in (`AssistantHost allowSide`); without it nothing here ever produces `side`.
26
30
  */
27
- export type AssistantPresentation = "hidden" | "mini" | "dock" | "side" | "full";
28
- /** The two shapes a seller WORKS in on top of a screen. The status bar reopens into whichever they last used. */
29
- export type AssistantFloatShape = "dock" | "side";
31
+ /**
32
+ * `left` (12/11/2026, Chris: "ai chat mặc định mở, nằm ở bên trái, sidebar menu sẽ collapse lại; tắt ai chat thì menu tự động expand
33
+ * ra… thêm một kiểu hiển thị"): the same full-height panel, on the LEFT of the page (beside the rail, under the topbar), resized on
34
+ * its right edge. A surface opts in (`AssistantHost allowLeft`) and may fold its rail while it is up (the admin does, reading
35
+ * `useAssistantPresentation`); the kit does not touch the rail.
36
+ */
37
+ export type AssistantPresentation = "hidden" | "mini" | "dock" | "side" | "left" | "full";
38
+ /** The shapes a seller WORKS in on top of a screen. The chat button (`mini`) reopens into whichever they last used. */
39
+ export type AssistantFloatShape = "dock" | "side" | "left";
40
+
41
+ /** A shape the person works in over a screen: the popup or a panel (12/11/2026). Every "is Gem beside the page" check asks this, so
42
+ * a shape added later is counted everywhere at once (the left panel had to be added by hand to nine checks, and a tenth was missed). */
43
+ export function isPanelShape(p: AssistantPresentation): boolean {
44
+ return p === "dock" || p === "side" || p === "left";
45
+ }
46
+ /** On screen and worked in: a panel shape or the full page. Not `mini` (folded into its button) nor `hidden`. */
47
+ export function isOpenShape(p: AssistantPresentation): boolean {
48
+ return isPanelShape(p) || p === "full";
49
+ }
30
50
 
31
51
  export interface AssistantDockState {
32
52
  presentation: AssistantPresentation;
@@ -44,7 +64,8 @@ export interface AssistantDockState {
44
64
  /** Bumped every time the assistant is brought back on screen. Lets a mount that already exists
45
65
  * pick up a question handed over from ⌘K, which a mount-time read would only ever see once. */
46
66
  openNonce: number;
47
- /** Width of the `side` panel in px (seller-resizable, persisted). */
67
+ /** Width of the `side` panel in px (seller-resizable, persisted). The `left` panel is the same column on the other side of
68
+ * the page and wears the same width: one number for "how wide I want Gem's column", whichever side it stands on. */
48
69
  sideWidth: number;
49
70
  /**
50
71
  * The last shape the seller worked in over a screen. The status bar's "reopen", × on a busy bar and leaving full
@@ -59,6 +80,16 @@ export interface AssistantDockState {
59
80
  * build. Review of #(this PR): the rail link dispatched a stored "side" straight past the host's opt-in.
60
81
  */
61
82
  sideAllowed: boolean;
83
+ /** Whether the mounted host offers the LEFT panel (`AssistantHost allowLeft`, and a window that fits it). Same rule as
84
+ * `sideAllowed`: every way into `left` goes through it. */
85
+ leftAllowed: boolean;
86
+ /**
87
+ * The app loaded for a person whose place is the left panel ("mặc định mở"): mounted and waiting for the host to say whether the left
88
+ * panel is offered here (12/11/2026). The host's first word decides: offered, it opens as the left panel; not offered (a narrow
89
+ * window, a page an editor covers, a host without it), it stays closed. Never a stand-in popup opened over a screen nobody opened
90
+ * the assistant on (/code-review of #7303). Any other way of opening or closing it clears this.
91
+ */
92
+ opensLeft: boolean;
62
93
  }
63
94
 
64
95
  export type AssistantDockEvent =
@@ -68,18 +99,24 @@ export type AssistantDockEvent =
68
99
  | { type: "leave-full" }
69
100
  /** show the floating popup (restore from mini, or open it from anywhere) */
70
101
  | { type: "dock" }
71
- /** dock → the small status bar */
102
+ /** fold into the chat button (12/11/2026; a small status bar until then) */
72
103
  | { type: "minimize" }
73
104
  /** the popup's × */
74
105
  | { type: "dismiss" }
75
106
  /** pin to the side panel (only surfaces that allow it send this) */
76
107
  | { type: "side" }
77
- /** bring it back in the last working shape (`floatShape`) — the status bar's click */
108
+ /** pin to the left panel (only surfaces that allow it send this) */
109
+ | { type: "left" }
110
+ /** bring it back in the last working shape (`floatShape`) — the chat button's click */
78
111
  | { type: "reopen" }
79
112
  /** `available` = the width of the content area the panel sits in (window minus the rail) */
80
113
  | { type: "side-resize"; width: number; available: number }
81
114
  /** the host says whether it offers the side panel */
82
115
  | { type: "side-allowed"; allowed: boolean }
116
+ /** the host says whether it offers the left panel */
117
+ | { type: "left-allowed"; allowed: boolean }
118
+ /** the app loaded for a person whose place is the left panel: open it when the host says it is offered (`opensLeft`) */
119
+ | { type: "open-left-on-load" }
83
120
  /** the last working shape, read back from storage on load */
84
121
  | { type: "restore-float"; shape: AssistantFloatShape }
85
122
  | { type: "busy"; busy: boolean }
@@ -112,6 +149,12 @@ export const SIDE_MAX_WIDTH = 720;
112
149
  /** The page beside the panel never gets narrower than this — a cap only exists when it is smaller than the room
113
150
  * there really is (§9.1), so the ceiling is taken from the content area, not from SIDE_MAX_WIDTH alone. */
114
151
  export const SIDE_PAGE_MIN = 480;
152
+ /** The mark on <html> while the LEFT panel's place is held from the first paint (assistant/hold.ts), until the load's open is decided. */
153
+ export const ASSISTANT_HOLD_ATTR = "data-gb-assistant-hold";
154
+
155
+ /** Where a panel (side or left) stands BESIDE the page: rail 240 + SIDE_MIN_WIDTH + SIDE_PAGE_MIN. host.tsx says why below it the
156
+ * popup stands in; the provider reads it too (a seller whose place is the left panel finds it open on load only where it fits). */
157
+ export const SIDE_FITS_QUERY = "(min-width: 1100px)";
115
158
 
116
159
  export function clampSideWidth(width: number, available: number): number {
117
160
  const max = Number.isFinite(available) && available > 0
@@ -160,15 +203,33 @@ export const initialAssistantDockState: AssistantDockState = {
160
203
  // (`backTo`), and a seller who floats it as a popup is remembered as such.
161
204
  floatShape: "side",
162
205
  sideAllowed: false,
206
+ leftAllowed: false,
207
+ opensLeft: false,
163
208
  };
164
209
 
165
- /** The shape to come back to: the last one worked in, unless this host does not offer the side panel. */
210
+ /** The shape to come back to: the last one worked in, unless this host (or this window) does not offer that panel. A left panel not
211
+ * offered here stands in as the side panel where that one is (an editor covers the page: it makes room on the right, editor-gem.css),
212
+ * else as the popup (review of #7303: with the left panel the admin's default, every editor otherwise got a popup over it). */
166
213
  function backTo(state: AssistantDockState): AssistantFloatShape {
167
- return state.sideAllowed ? state.floatShape : "dock";
214
+ if (state.floatShape === "side") return state.sideAllowed ? "side" : "dock";
215
+ if (state.floatShape === "left") return state.leftAllowed ? "left" : state.sideAllowed ? "side" : "dock";
216
+ return "dock";
168
217
  }
169
218
 
170
219
  export function assistantDockReducer(state: AssistantDockState, event: AssistantDockEvent): AssistantDockState {
220
+ // A way in or out the person (or a screen) chose replaces the load's wish to open the left panel.
221
+ if (state.opensLeft && event.type !== "left-allowed" && event.type !== "side-allowed" && event.type !== "busy"
222
+ && event.type !== "resize" && event.type !== "slide" && event.type !== "side-resize" && event.type !== "restore-float"
223
+ && event.type !== "open-left-on-load") {
224
+ return assistantDockReducer({ ...state, opensLeft: false }, event);
225
+ }
171
226
  switch (event.type) {
227
+ case "open-left-on-load":
228
+ // Only from a closed assistant, and only for a person whose place is the left panel.
229
+ if (state.presentation !== "hidden" || state.floatShape !== "left") return state;
230
+ if (state.leftAllowed) return { ...state, presentation: "left", mounted: true, unread: false, openNonce: state.openNonce + 1 };
231
+ return { ...state, mounted: true, opensLeft: true };
232
+
172
233
  case "enter-full":
173
234
  return { ...state, presentation: "full", mounted: true, unread: false, openNonce: state.openNonce + 1 };
174
235
 
@@ -194,18 +255,44 @@ export function assistantDockReducer(state: AssistantDockState, event: Assistant
194
255
  if (!state.sideAllowed) return { ...state, presentation: "dock", floatShape: "dock", mounted: true, unread: false, openNonce: state.openNonce + 1 };
195
256
  return { ...state, presentation: "side", floatShape: "side", mounted: true, unread: false, openNonce: state.openNonce + 1 };
196
257
 
258
+ case "left":
259
+ // Not offered (a host without it, a window under 1100px, a covered page): the popup, as `side` does, and recorded as the
260
+ // popup, as a refused `side` is: it was asked for now. A caller that means "the person's own place, when it can" sends
261
+ // `reopen`, which keeps `floatShape` and lets `left-allowed` put the panel back (the admin's Ask Gem does).
262
+ if (!state.leftAllowed) return { ...state, presentation: "dock", floatShape: "dock", mounted: true, unread: false, openNonce: state.openNonce + 1 };
263
+ return { ...state, presentation: "left", floatShape: "left", mounted: true, unread: false, openNonce: state.openNonce + 1 };
264
+
197
265
  case "reopen":
198
266
  return { ...state, presentation: backTo(state), mounted: true, unread: false, openNonce: state.openNonce + 1 };
199
267
 
200
268
  case "side-allowed":
201
269
  if (event.allowed === state.sideAllowed) return state;
202
- // Withdrawn while the panel is up: it becomes the popup rather than a shape the host no longer draws for.
270
+ // Withdrawn while the panel is up: it becomes the popup rather than a shape the host no longer draws for (also when it stood in for
271
+ // the left panel).
203
272
  if (!event.allowed) return { ...state, sideAllowed: false, presentation: state.presentation === "side" ? "dock" : state.presentation };
204
273
  // Allowed (again): a popup that is only there because the panel was not allowed a moment ago — the working shape
205
274
  // is still "side" — goes back to the panel. Two ways that happens (review #3744): the admin mounts its host only
206
275
  // after the first open, so that first open arrived before the host said yes; and a window that dipped below
207
276
  // 1100px (DevTools docked, a snap) and came back. A popup the person CHOSE has floatShape "dock" and stays.
208
- return { ...state, sideAllowed: true, presentation: state.presentation === "dock" && state.floatShape === "side" ? "side" : state.presentation };
277
+ // A popup standing in for a LEFT panel not offered here becomes the side panel too (backTo's order: left, side, popup).
278
+ const standIn = state.floatShape === "side" || (state.floatShape === "left" && !state.leftAllowed);
279
+ return { ...state, sideAllowed: true, presentation: state.presentation === "dock" && standIn ? "side" : state.presentation };
280
+
281
+ case "left-allowed":
282
+ // Waiting on the load's open (`opensLeft`): this word decides it, even when it is the same word as before (a host that does
283
+ // not offer it says "no" to a "no"); offered, the left panel opens; not offered, nothing opens.
284
+ if (state.opensLeft) {
285
+ const open = event.allowed && state.presentation === "hidden";
286
+ return { ...state, leftAllowed: event.allowed, opensLeft: false,
287
+ ...(open ? { presentation: "left" as const, unread: false, openNonce: state.openNonce + 1 } : {}) };
288
+ }
289
+ // The same two rules as the side panel: withdrawn, the panel becomes the popup; allowed (again), a popup that only stood in
290
+ // for it (the working shape is still "left") goes back to the left panel.
291
+ if (event.allowed === state.leftAllowed) return state;
292
+ if (!event.allowed) return { ...state, leftAllowed: false, presentation: state.presentation === "left" ? (state.sideAllowed ? "side" : "dock") : state.presentation };
293
+ // Back: the stand-in (the popup, or the side panel standing in for the left one) gives way to the left panel.
294
+ return { ...state, leftAllowed: true,
295
+ presentation: (state.presentation === "dock" || state.presentation === "side") && state.floatShape === "left" ? "left" : state.presentation };
209
296
 
210
297
  case "restore-float":
211
298
  return { ...state, floatShape: event.shape };
@@ -0,0 +1,119 @@
1
+ "use client";
2
+
3
+ /**
4
+ * FIGURES UNDER AN ANSWER (13/11/2026, Gem Plus slice 2; Gem Plus boards, artifact DmPeQEJDAZXdiTxzmFv5UL, "stats, chart, source line").
5
+ * A chat answer that rests on numbers shows them drawn, under the words, with the line that says where they come from: the answer
6
+ * names one or two, the figures carry the rest. Drawn from the report's own vocabulary (report-charts.css `ui-barlist`, ui.css
7
+ * `ui-metrics`), so a report built later from the same figures looks the same.
8
+ *
9
+ * Shares only: every number here is a percentage, and each figure says its base as the surface words it ("from 100+ brands"). The
10
+ * component draws what it is given and adds nothing: no total, no date. The surface's words come in `labels` (English by default).
11
+ */
12
+ import "../report-charts.css";
13
+ import "../assistant-figures.css";
14
+ import React from "react";
15
+
16
+ export interface ChatFigureRow {
17
+ key: string;
18
+ label: string;
19
+ /** Two shares to compare: the group's (drawn as the bar) and everyone's (said beside it). */
20
+ proven?: number;
21
+ all?: number;
22
+ /** One share (drawn as the bar). */
23
+ share?: number;
24
+ }
25
+
26
+ export interface ChatFigure {
27
+ id: string;
28
+ title: string;
29
+ /** What the figure measures, said under its title. */
30
+ sub?: string;
31
+ /** The base as the surface says it ("100+"). */
32
+ brands: string;
33
+ /** One headline share, drawn as a number. */
34
+ value?: number;
35
+ rows: ChatFigureRow[];
36
+ }
37
+
38
+ export interface ChatFiguresLabels {
39
+ /** The base, under each title: "from 100+ brands". */
40
+ from: (brands: string) => string;
41
+ /** Beside a compared row: "all pages 31%". */
42
+ vsAll: (all: string) => string;
43
+ /** The region's name for a screen reader. */
44
+ region: string;
45
+ }
46
+
47
+ export const CHAT_FIGURES_LABELS: ChatFiguresLabels = {
48
+ from: (brands) => `from ${brands} brands`,
49
+ vsAll: (all) => `all pages ${all}`,
50
+ region: "Figures",
51
+ };
52
+
53
+ /** 24.1 → "24%", 7.5 → "7.5%", 0.4 → "0.4%": whole numbers from 10 up, one decimal below. */
54
+ export function figurePct(n: number): string {
55
+ if (!Number.isFinite(n)) return "";
56
+ const shown = n >= 10 ? Math.round(n) : Math.round(n * 10) / 10;
57
+ return `${shown}%`;
58
+ }
59
+
60
+ const bar = (n: number): React.CSSProperties => ({ ["--v" as string]: Math.max(0, Math.min(1, n / 100)) } as React.CSSProperties);
61
+
62
+ export function ChatFigures({ figures, title, source, labels }: {
63
+ figures: ChatFigure[];
64
+ /** Above the figures: what they are about ("Skincare & beauty"). */
65
+ title?: string;
66
+ /** Under them: where they come from. */
67
+ source?: string;
68
+ labels?: Partial<ChatFiguresLabels>;
69
+ }) {
70
+ const L = { ...CHAT_FIGURES_LABELS, ...labels };
71
+ if (figures.length === 0) return null;
72
+ return (
73
+ <section className="gb-chat-figures" aria-label={title ? `${L.region}: ${title}` : L.region}>
74
+ {title ? <p className="gb-chat-figures__head">{title}</p> : null}
75
+ {figures.map((f) => {
76
+ const said = [f.sub, L.from(f.brands)].filter(Boolean).join(" · ");
77
+ return (
78
+ <figure className="gb-chat-figure" key={f.id} data-figure={f.id}>
79
+ {f.value !== undefined ? (
80
+ <>
81
+ <div className="ui-metrics">
82
+ <div className="ui-metric">
83
+ <span className="ui-metric__val">{figurePct(f.value)}</span>
84
+ <span className="ui-metric__lbl">{f.title}</span>
85
+ </div>
86
+ </div>
87
+ <figcaption className="ui-muted">{said}</figcaption>
88
+ </>
89
+ ) : (
90
+ <figcaption className="gb-chat-figure__cap">
91
+ <span className="gb-chat-figure__title">{f.title}</span>
92
+ <span className="ui-muted">{said}</span>
93
+ </figcaption>
94
+ )}
95
+ {f.rows.length > 0 ? (
96
+ <ol className="ui-barlist">
97
+ {f.rows.map((r) => {
98
+ const n = r.proven ?? r.share;
99
+ if (n === undefined) return null;
100
+ return (
101
+ <li key={r.key}>
102
+ <span className="ui-barlist__label">{r.label}</span>
103
+ <span className="ui-barlist__val">
104
+ {figurePct(n)}
105
+ {r.all !== undefined ? <span className="ui-barlist__share">{L.vsAll(figurePct(r.all))}</span> : null}
106
+ </span>
107
+ <span className="ui-barlist__bar" style={bar(n)} aria-hidden />
108
+ </li>
109
+ );
110
+ })}
111
+ </ol>
112
+ ) : null}
113
+ </figure>
114
+ );
115
+ })}
116
+ {source ? <p className="gb-chat-figures__source ui-muted">{source}</p> : null}
117
+ </section>
118
+ );
119
+ }
@@ -0,0 +1,67 @@
1
+ "use client";
2
+
3
+ /**
4
+ * REAL PAGES UNDER AN ANSWER (13/11/2026, Gem Plus slice 3; boards artifact DmPeQEJDAZXdiTxzmFv5UL, "a strip of real pages, Use this
5
+ * layout"). Pictures to choose by, two to a row, each with its label, a line of what it shows, and one button that takes the seller
6
+ * to build their own page from it (the surface's link: `onUse(href)`, and a real link for a new tab).
7
+ *
8
+ * The component shows what it is given: the surface decides what a card may say (the admin never says whose page it is). The frame is
9
+ * assistant-figures.css's, the entry of the blocks drawn under an answer.
10
+ */
11
+ import "../assistant-figures.css";
12
+ import React from "react";
13
+
14
+ export interface ChatGalleryPage {
15
+ label: string;
16
+ /** What it shows ("Advertorial · 3 ads seen in the last 30 days"). */
17
+ meta?: string;
18
+ thumb_url: string;
19
+ /** Where "Use this layout" goes. */
20
+ href: string;
21
+ }
22
+
23
+ export interface ChatGalleryLabels {
24
+ /** The button. */
25
+ use: string;
26
+ /** The region's name for a screen reader. */
27
+ region: string;
28
+ }
29
+
30
+ export const CHAT_GALLERY_LABELS: ChatGalleryLabels = { use: "Use this layout", region: "Real pages" };
31
+
32
+ export function ChatPageGallery({ title, pages, onUse, labels }: {
33
+ title?: string;
34
+ pages: ChatGalleryPage[];
35
+ /** A press on "Use this layout": the surface navigates (a modified click opens the link in a new tab instead). */
36
+ onUse: (href: string) => void;
37
+ labels?: Partial<ChatGalleryLabels>;
38
+ }) {
39
+ const L = { ...CHAT_GALLERY_LABELS, ...labels };
40
+ if (pages.length === 0) return null;
41
+ return (
42
+ <section className="gb-chat-gallery" aria-label={title ? `${L.region}: ${title}` : L.region}>
43
+ {title ? <p className="gb-chat-figures__head">{title}</p> : null}
44
+ <ul className="gb-chat-gallery__grid">
45
+ {pages.map((p) => (
46
+ <li className="gb-chat-gallery__card" key={p.href}>
47
+ {/* eslint-disable-next-line @next/next/no-img-element -- a picture the surface signed, not a build asset */}
48
+ <img className="gb-chat-gallery__thumb" src={p.thumb_url} alt={p.label} loading="lazy" decoding="async" />
49
+ <span className="gb-chat-gallery__label">{p.label}</span>
50
+ {p.meta ? <span className="gb-chat-gallery__meta ui-muted">{p.meta}</span> : null}
51
+ <a
52
+ className="ui-btn gb-chat-gallery__use"
53
+ href={p.href}
54
+ onClick={(e) => {
55
+ if (e.metaKey || e.ctrlKey || e.shiftKey || e.button !== 0) return;
56
+ e.preventDefault();
57
+ onUse(p.href);
58
+ }}
59
+ >
60
+ {L.use}
61
+ </a>
62
+ </li>
63
+ ))}
64
+ </ul>
65
+ </section>
66
+ );
67
+ }
@@ -0,0 +1,51 @@
1
+ /**
2
+ * THE LEFT PANEL'S PLACE, HELD FROM THE FIRST PAINT (12/11/2026, review of gemboss #7303).
3
+ *
4
+ * A surface whose person finds the left panel open on load (`defaultShape: "left"`, or "left" chosen) opened it only once the provider
5
+ * had read storage and the dock's code had arrived, after the page had painted: the rail folded 240 → 56 and the page moved over by the
6
+ * panel, every load. Measured on the admin rig at 1440: CLS 0.119, against 0.0001 for a person who keeps the popup (§9.4's cap is 0.1).
7
+ *
8
+ * `assistantLeftHoldScript(...)` is a script for the page's markup BEFORE the shell (like `themeScript`): it asks what the provider will
9
+ * ask (a window that fits, not the full page, not closed or folded in this tab, the place chosen or the surface's default), and if the
10
+ * left panel will open, marks <html> (`ASSISTANT_HOLD_ATTR`) with the panel's width. assistant-hold.css, which this module brings, then
11
+ * draws the folded rail, the page beside the panel and an empty panel from the first frame. The provider takes the mark away once the
12
+ * load's open is decided (the panel up, or not opened): the real rules then hold the same geometry.
13
+ */
14
+ import "../assistant-hold.css";
15
+ import { ASSISTANT_HOLD_ATTR, SIDE_DEFAULT_WIDTH, SIDE_FITS_QUERY, SIDE_MAX_WIDTH, SIDE_MIN_WIDTH, SIDE_PAGE_MIN, type AssistantFloatShape } from "./dock";
16
+
17
+ /**
18
+ * How long a hold may stand at most, from the first paint. The provider gives it back once the load's open is decided (the host's word,
19
+ * `opensLeft`); a host that never mounts (the dock's code failed to load) never says it, and the empty column would stay for good. So
20
+ * the script that set the mark takes it away by itself this long after (12/11/2026). Here, not in the provider: the script is the
21
+ * page's markup, while the provider is in every admin screen's first-load JS, at its budget (#7320). The panel still opens if the host
22
+ * comes later.
23
+ */
24
+ export const ASSISTANT_HOLD_GIVE_UP_MS = 5000;
25
+
26
+ /** The folded rail's width (rail-fold.css, rail-mini.css): the panel stands right of it. */
27
+ const FOLDED_RAIL = 56;
28
+
29
+ export function assistantLeftHoldScript({ storagePrefix = "gemboss.assistant", defaultShape = "side", fullPath = "" }: {
30
+ /** The provider's `storagePrefix`. */
31
+ storagePrefix?: string;
32
+ /** The provider's `defaultShape`. */
33
+ defaultShape?: AssistantFloatShape;
34
+ /** The assistant's own page: the provider's `isOnFullPage` as a path prefix ("/app/assistant" in the admin). Nothing is held there. */
35
+ fullPath?: string;
36
+ } = {}): string {
37
+ const j = JSON.stringify;
38
+ return `(function(){try{var d=document.documentElement,P=${j(storagePrefix)};`
39
+ + `if(!matchMedia(${j(SIDE_FITS_QUERY)}).matches)return;`
40
+ + (fullPath ? `if(location.pathname.indexOf(${j(fullPath)})===0)return;` : "")
41
+ + `var s=sessionStorage.getItem(P+".presentation");if(s==="hidden"||s==="mini")return;`
42
+ // The provider's reading of the stored place (provider.tsx): `place`, else the old key's "dock" (a choice), else the default.
43
+ + `var c=localStorage.getItem(P+".place");if(c===null&&localStorage.getItem(P+".shape")==="dock")c="dock";`
44
+ + `if((c==="side"||c==="dock"||c==="left"?c:${j(defaultShape)})!=="left")return;`
45
+ // dock.ts clampSideWidth against the content area beside the folded rail (provider.tsx sideAvailable(true)).
46
+ + `var w=Number(localStorage.getItem(P+".sideWidth"))||${SIDE_DEFAULT_WIDTH},a=(d.clientWidth||innerWidth)-${FOLDED_RAIL};`
47
+ + `var m=Math.max(${SIDE_MIN_WIDTH},Math.min(${SIDE_MAX_WIDTH},a-${SIDE_PAGE_MIN}));w=Math.min(Math.max(Math.round(w),${SIDE_MIN_WIDTH}),m);`
48
+ + `d.setAttribute(${j(ASSISTANT_HOLD_ATTR)},"left");d.style.setProperty("--gb-assistant-left-w",w+"px");`
49
+ + `setTimeout(function(){if(d.hasAttribute(${j(ASSISTANT_HOLD_ATTR)})){d.removeAttribute(${j(ASSISTANT_HOLD_ATTR)});`
50
+ + `d.style.removeProperty("--gb-assistant-left-w")}},${ASSISTANT_HOLD_GIVE_UP_MS})}catch(e){}})();`;
51
+ }