@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.
- package/CHANGELOG.md +633 -3
- package/README.md +170 -11
- package/catalog/editor.html +1 -1
- package/catalog/index.html +48 -46
- package/gemboss-ui.css +4 -4
- package/package.json +32 -1
- package/parts/components.css +3 -3
- package/parts/core.css +1 -1
- package/parts/shell.css +2 -2
- package/src/app-nav.css +1 -1
- package/src/app-shell.css +1 -1
- package/src/assistant/chat-cards.tsx +118 -19
- package/src/assistant/chat.tsx +209 -22
- package/src/assistant/composer-menus.tsx +7 -2
- package/src/assistant/dock.ts +97 -10
- package/src/assistant/figures.tsx +119 -0
- package/src/assistant/gallery.tsx +67 -0
- package/src/assistant/hold.ts +51 -0
- package/src/assistant/host.tsx +258 -137
- package/src/assistant/ideas.tsx +90 -0
- package/src/assistant/index.ts +12 -3
- package/src/assistant/plus.tsx +61 -0
- package/src/assistant/provider.tsx +121 -24
- package/src/assistant/sessions.tsx +54 -20
- package/src/assistant/window-host.tsx +215 -0
- package/src/assistant/window.ts +120 -0
- package/src/assistant-chat.css +1 -1
- package/src/assistant-figures.css +1 -0
- package/src/assistant-hold.css +1 -0
- package/src/assistant-places.css +1 -0
- package/src/assistant-plain.js +1 -1
- package/src/assistant-plus.css +1 -0
- package/src/assistant-window-plain.js +1 -0
- package/src/assistant-window.css +1 -0
- package/src/assistant.css +1 -1
- package/src/auth-extras.css +1 -1
- package/src/auth-footer.css +1 -1
- package/src/auth-steps.css +1 -1
- package/src/auth.css +1 -1
- package/src/board-move.ts +2 -1
- package/src/chat-attachments.css +1 -1
- package/src/chat-cards-drawn.css +1 -0
- package/src/chat-cards-float.css +1 -0
- package/src/chat-cards.css +1 -1
- package/src/chat-composer-menus.css +1 -1
- package/src/chat-composer.css +1 -1
- package/src/chat-plain.js +6 -6
- package/src/chat-shortcuts.css +1 -0
- package/src/chat-voice.css +1 -1
- package/src/chat.css +1 -1
- package/src/chips-drawn.css +1 -0
- package/src/collections.css +1 -1
- package/src/collections.tsx +4 -2
- package/src/create-shell.css +1 -1
- package/src/dialog.css +1 -1
- package/src/editor/choice-cards.tsx +8 -5
- package/src/editor/controls.tsx +36 -9
- package/src/editor/field-control.tsx +17 -3
- package/src/editor/field-spec.ts +17 -4
- package/src/editor/index.ts +2 -0
- package/src/editor/media-words.ts +21 -0
- package/src/editor-color.css +1 -1
- package/src/editor-empty.css +1 -0
- package/src/editor-insert.css +1 -1
- package/src/editor-inspector-frame.css +1 -1
- package/src/editor-media.css +1 -1
- package/src/editor-picker-grid.css +1 -1
- package/src/editor-picker.css +1 -1
- package/src/editor-popover.css +1 -1
- package/src/editor-repeater.css +1 -1
- package/src/editor-tiles.css +1 -1
- package/src/editor.css +1 -1
- package/src/email-canvas.css +1 -0
- package/src/email-card.tsx +44 -0
- package/src/email-editor/canvas.tsx +109 -0
- package/src/email-editor/editor.tsx +45 -4
- package/src/email-editor/index.ts +2 -1
- package/src/email-editor/model.ts +9 -1
- package/src/email-editor.css +1 -1
- package/src/email-parts.css +1 -0
- package/src/email-parts.tsx +81 -0
- package/src/email-thumb.css +1 -0
- package/src/email-thumb.tsx +206 -0
- package/src/feedback-dialog.css +1 -0
- package/src/feedback-dialog.tsx +122 -0
- package/src/flow-strip.css +1 -0
- package/src/flow-strip.tsx +50 -0
- package/src/gemboss-field-drawn.css +1 -0
- package/src/gemboss-field.css +1 -1
- package/src/gems.css +1 -1
- package/src/icon-frame.tsx +31 -0
- package/src/icons.tsx +9 -9
- package/src/index.ts +12 -0
- package/src/job-card.css +1 -1
- package/src/kit-plain.css +1 -1
- package/src/kit-plain.js +1 -1
- package/src/language-switcher.css +1 -1
- package/src/list-page.css +1 -1
- package/src/list-page.tsx +6 -3
- package/src/list-toolbar.css +1 -1
- package/src/media-card.css +1 -0
- package/src/members.css +1 -1
- package/src/menu-extras.css +1 -1
- package/src/menu-layer.ts +2 -0
- package/src/menu-select.css +1 -1
- package/src/menu.css +1 -1
- package/src/menu.tsx +9 -4
- package/src/narration.css +1 -1
- package/src/pager-extras.css +1 -1
- package/src/pager.css +1 -1
- package/src/picture-actions.css +1 -0
- package/src/picture-actions.tsx +23 -0
- package/src/portal.css +1 -1
- package/src/question-card.css +1 -1
- package/src/rail-fold.css +1 -1
- package/src/reactions.css +1 -1
- package/src/reader-dialog.css +1 -1
- package/src/report-charts.css +1 -1
- package/src/segmented.tsx +6 -0
- package/src/service-switcher.css +1 -1
- package/src/session-rail-plain.js +1 -1
- package/src/settings-dialog.css +1 -1
- package/src/setup-guide.css +1 -1
- package/src/sheet.css +1 -1
- package/src/shell.css +1 -1
- package/src/shell.tsx +9 -2
- package/src/site.css +1 -1
- package/src/skill-card.css +1 -1
- package/src/skill-flow.css +1 -1
- package/src/skill-pages.css +1 -1
- package/src/skill-view.css +1 -1
- package/src/stage-path.css +1 -1
- package/src/stat-tile.css +1 -0
- package/src/stat-tile.tsx +39 -0
- package/src/status-list.css +1 -1
- package/src/team-chat.css +1 -1
- package/src/tray-plain.js +1 -0
- package/src/tray-search.tsx +116 -0
- package/src/tray.css +1 -0
- package/src/tray.tsx +250 -0
- package/src/ui.css +1 -1
package/src/assistant/host.tsx
CHANGED
|
@@ -13,50 +13,101 @@
|
|
|
13
13
|
* class names; the subtree is never re-parented (that would remount the chat and abort the run too).
|
|
14
14
|
*/
|
|
15
15
|
import "../assistant.css"; // its own stylesheet travels with it (0.23.0): a surface that never renders it never loads it
|
|
16
|
-
|
|
16
|
+
// The left panel, ⋯'s places and the chat button (12/11/2026): an entry of their own, since assistant.css is in the frozen
|
|
17
|
+
// compatibility bundle (gemboss-ui.css, at its ceiling). After assistant.css, so its rules come later in the cascade.
|
|
18
|
+
import "../assistant-places.css";
|
|
19
|
+
import "../assistant-plus.css"; // the Plus look of the panel (13/11/2026, `plus`): its own entry, after the places so it restates their tokens
|
|
20
|
+
// The kit menu's row icon slot (`.ui-menu__icon`, menu-extras.css): ⋯'s places wear the marks the header's switcher wore (12/11/2026).
|
|
21
|
+
import "../menu-extras.css";
|
|
22
|
+
import React, { Children, createContext, isValidElement, useCallback, useContext, useEffect, useLayoutEffect, useRef, useState, type ReactNode } from "react";
|
|
17
23
|
|
|
18
24
|
import { Icon } from "../icons"; // every glyph in the frame is from the GemBoss set (11/11/2026), not an SVG drawn here
|
|
19
|
-
import { DOCK_MIN_HEIGHT, SIDE_MIN_WIDTH, clampDockHeight, clampSideWidth } from "./dock";
|
|
25
|
+
import { DOCK_MIN_HEIGHT, SIDE_FITS_QUERY, SIDE_MIN_WIDTH, clampDockHeight, clampSideWidth } from "./dock";
|
|
20
26
|
import { sideAvailable, useAssistant } from "./provider";
|
|
27
|
+
// The floating window (12/11/2026, canvas GemDockModes 4, 7, 8): its ⋮⋮, edges and drop zones, and its stylesheet (assistant-window.css,
|
|
28
|
+
// an entry of its own), which comes after assistant-places.css because this import comes after that one.
|
|
29
|
+
import { useDockWindow, useMediaQuery, useWindowMode, type DockWindowLabels } from "./window-host";
|
|
21
30
|
|
|
22
31
|
/** One literal class per presentation, not `gb-dock-${mode}`: a runtime-built class name is a stem the
|
|
23
32
|
* admin's orphan gate (a-tap-target-rule-outlived-its-markup) has to exempt wholesale. */
|
|
24
|
-
const MODE_CLASS = { hidden: "gb-dock-hidden", mini: "gb-dock-mini", dock: "gb-dock-dock", side: "gb-dock-side", full: "gb-dock-full" } as const;
|
|
33
|
+
const MODE_CLASS = { hidden: "gb-dock-hidden", mini: "gb-dock-mini", dock: "gb-dock-dock", side: "gb-dock-side", left: "gb-dock-left", full: "gb-dock-full" } as const;
|
|
34
|
+
/** The places, rows of the ⋯ menu (12/11/2026), literal classes (the same reason): the two panels are named, the phone does not draw them. */
|
|
35
|
+
const PLACE_CLASS = { side: "ui-menu__item gb-dock-place gb-dock-place-side", left: "ui-menu__item gb-dock-place gb-dock-place-left", dock: "ui-menu__item gb-dock-place", full: "ui-menu__item gb-dock-place" } as const;
|
|
36
|
+
/** The chat button's dot, by what it says (busy > failed > waiting > an answer waiting). */
|
|
37
|
+
const KNOB_DOT = { busy: "gb-dock-knob-dot gb-dock-knob-busy", failed: "gb-dock-knob-dot gb-dock-knob-failed", waiting: "gb-dock-knob-dot gb-dock-knob-waiting", unread: "gb-dock-knob-dot gb-dock-knob-unread" } as const;
|
|
25
38
|
|
|
26
39
|
|
|
27
|
-
/** mm:ss since a run started — the only honest thing the
|
|
40
|
+
/** mm:ss since a run started — the only honest thing the chat button can say about a run. */
|
|
28
41
|
function elapsed(since: number): string {
|
|
29
42
|
const s = Math.max(0, Math.floor((Date.now() - since) / 1000));
|
|
30
43
|
return `${Math.floor(s / 60)}:${String(s % 60).padStart(2, "0")}`;
|
|
31
44
|
}
|
|
32
45
|
|
|
33
46
|
/** Every word the host says. English defaults are the admin's; a surface passes its own language. */
|
|
34
|
-
export interface AssistantHostLabels {
|
|
47
|
+
export interface AssistantHostLabels extends DockWindowLabels {
|
|
35
48
|
ready: string; working: string; done: string;
|
|
36
|
-
answerWaiting: string;
|
|
49
|
+
answerWaiting: string;
|
|
50
|
+
/** @deprecated 12/11/2026: the status bar's default hint, gone with the bar. Not drawn. */
|
|
51
|
+
askAboutScreen: string;
|
|
37
52
|
/** The last answer ends on a question only the person can answer (the `waiting` prop). */
|
|
38
53
|
waiting: string;
|
|
39
|
-
reopen: string;
|
|
54
|
+
reopen: string;
|
|
55
|
+
/** @deprecated 12/11/2026: the status bar's ×, gone with the bar (the chat button has none). Not drawn. */
|
|
56
|
+
hide: string;
|
|
57
|
+
/** @deprecated 12/11/2026: as `hide`. */
|
|
58
|
+
hideTitle: string;
|
|
59
|
+
/** @deprecated 12/11/2026: as `hide`. */
|
|
60
|
+
openInstead: string;
|
|
61
|
+
/** @deprecated 12/11/2026: as `hide`. */
|
|
62
|
+
openInsteadTitle: string;
|
|
40
63
|
grip: string; headerTitle: string;
|
|
41
|
-
|
|
64
|
+
/** @deprecated 12/11/2026: the header's full-screen button, now ⋯'s `placeFull` row. Not drawn. */
|
|
65
|
+
openFull: string;
|
|
66
|
+
newChat: string;
|
|
67
|
+
/** @deprecated 12/11/2026: ⋯'s "Fold into the chat button" row, gone: × does it (Chris: "nó là 1"). Not drawn. */
|
|
68
|
+
minimize: string;
|
|
69
|
+
/** @deprecated 12/11/2026: as `minimize`. */
|
|
70
|
+
minimizeTitle: string;
|
|
42
71
|
close: string; closeBusy: string; closeBusyTitle: string;
|
|
43
72
|
shrinkToPopup: string; tablist: string; primaryTab: string;
|
|
44
|
-
|
|
73
|
+
/** @deprecated 12/11/2026: the ⋯ row, now ⋯'s `placeSide` row. Not drawn. */
|
|
74
|
+
pinSide: string;
|
|
75
|
+
/** @deprecated 12/11/2026: the ⋯ row, now ⋯'s `placeDock` row. Not drawn. */
|
|
76
|
+
floatPopup: string;
|
|
77
|
+
sideGrip: string; backToSide: string;
|
|
45
78
|
more: string; clearHistory: string;
|
|
79
|
+
/** The last run failed (the `failed` prop): the header and the chat button say it, in red. */
|
|
80
|
+
failed: string;
|
|
81
|
+
/** Where it sits, ⋯'s first group (12/11/2026): the group's name, its four places, and why a panel is off in a narrow window. */
|
|
82
|
+
places: string; placeSide: string; placeLeft: string; placeDock: string; placeFull: string; placeNeedsWidth: string;
|
|
83
|
+
/** Full screen's way back when the left panel is the working shape. */
|
|
84
|
+
backToLeft: string;
|
|
46
85
|
}
|
|
47
86
|
const EN: AssistantHostLabels = {
|
|
48
87
|
ready: "Ready", working: "Working", done: "Done — tap to see it",
|
|
49
88
|
answerWaiting: "An answer is waiting", askAboutScreen: "Ask about this screen", waiting: "Waiting on you",
|
|
50
|
-
reopen: "Reopen the {title}",
|
|
89
|
+
reopen: "Reopen the {title}",
|
|
90
|
+
// `hide`, `hideTitle`, `openInstead`, `openInsteadTitle`: the status bar's ×, gone with the bar (the chat button has none). Kept
|
|
91
|
+
// so a surface's `labels` still type-checks.
|
|
92
|
+
hide: "Hide the assistant", hideTitle: "Hide the assistant",
|
|
51
93
|
openInstead: "Open the assistant", openInsteadTitle: "Still working — open it",
|
|
52
94
|
grip: "Drag to resize the assistant; left and right arrows move it sideways",
|
|
53
95
|
headerTitle: "Drag this bar to move the popup left or right",
|
|
54
|
-
|
|
55
|
-
|
|
96
|
+
// `openFull`, `pinSide`, `floatPopup`: the header's ⤢ and the ⋯ rows the places replaced; `minimize`, `minimizeTitle`: ⋯'s fold row, which
|
|
97
|
+
// × does. Kept for the same reason.
|
|
98
|
+
newChat: "New chat", openFull: "Open full screen", minimize: "Minimise", minimizeTitle: "Fold into the chat button",
|
|
99
|
+
close: "Close the assistant", closeBusy: "Fold into the chat button", closeBusyTitle: "Still working — fold it into the chat button",
|
|
56
100
|
shrinkToPopup: "Shrink to popup", tablist: "Assistant or a person", primaryTab: "Assistant",
|
|
57
101
|
pinSide: "Pin to the side", floatPopup: "Float as a popup", sideGrip: "Drag to resize the assistant; left and right arrows work too",
|
|
58
102
|
backToSide: "Back to the side panel",
|
|
59
103
|
more: "More", clearHistory: "Clear history",
|
|
104
|
+
failed: "Something went wrong",
|
|
105
|
+
places: "Where the assistant sits", placeSide: "On the right", placeLeft: "On the left", placeDock: "Floating window",
|
|
106
|
+
placeFull: "Full screen", placeNeedsWidth: "Needs a window at least 1100px wide",
|
|
107
|
+
backToLeft: "Back to the left panel",
|
|
108
|
+
// The floating window (12/11/2026): the ⋮⋮, the corner, the header's tooltip, and what the zone says while it is dragged to an edge.
|
|
109
|
+
windowMove: "Move the window: drag it, or use the arrow keys", windowResize: "Resize the window: drag an edge or a corner, or use the arrow keys",
|
|
110
|
+
windowHeaderTitle: "Drag this bar to move the window", dropLeft: "Release to dock on the left", dropSide: "Release to dock on the right",
|
|
60
111
|
};
|
|
61
112
|
|
|
62
113
|
/**
|
|
@@ -73,9 +124,11 @@ export function AssistantMenuItem({ danger, disabled, onClick, className, childr
|
|
|
73
124
|
className?: string;
|
|
74
125
|
children?: ReactNode;
|
|
75
126
|
}) {
|
|
127
|
+
const inMenu = useContext(InMenu);
|
|
76
128
|
return (
|
|
77
129
|
<button
|
|
78
130
|
type="button"
|
|
131
|
+
role={inMenu ? "menuitem" : undefined}
|
|
79
132
|
className={["ui-menu__item", danger ? "ui-menu__item--danger" : "", className ?? ""].filter(Boolean).join(" ")}
|
|
80
133
|
disabled={disabled}
|
|
81
134
|
onClick={(e) => {
|
|
@@ -90,6 +143,10 @@ export function AssistantMenuItem({ danger, disabled, onClick, className, childr
|
|
|
90
143
|
);
|
|
91
144
|
}
|
|
92
145
|
|
|
146
|
+
/** Inside the panel's ⋯, which is a `menu` (12/11/2026): its rows are `menuitem`s and the arrow keys move between them. Full screen's
|
|
147
|
+
* ⋯ holds the surface's own buttons too, and stays a disclosure of buttons. */
|
|
148
|
+
const InMenu = createContext(false);
|
|
149
|
+
|
|
93
150
|
/**
|
|
94
151
|
* The header's ⋯ (0.31.0, Chris 08/10/2026: "clear history lên topbar … nhiều icon rồi nên cần gom nhóm"). A `<details>`
|
|
95
152
|
* like the kit's Menu, but its position and trigger are the host's (assistant.css): the kit's `.ui-menu` rules live in
|
|
@@ -99,7 +156,7 @@ export function AssistantMenuItem({ danger, disabled, onClick, className, childr
|
|
|
99
156
|
* "Escape hides the assistant" does not fire on the same key; an Escape meant for a modal elsewhere is left to it. It also
|
|
100
157
|
* closes when the window loses focus (a click into an iframe), like the kit's plain menus (kit-plain.js initMenus).
|
|
101
158
|
*/
|
|
102
|
-
function HostMenu({ label, trigger = "gb-dock-icon", children }: { label: string; trigger?: string; children: ReactNode }) {
|
|
159
|
+
function HostMenu({ label, trigger = "gb-dock-icon", menu = false, children }: { label: string; trigger?: string; menu?: boolean; children: ReactNode }) {
|
|
103
160
|
const ref = useRef<HTMLDetailsElement>(null);
|
|
104
161
|
// Listening all the time and asking `el.open`, like the kit's Menu: gating the listeners on an `open` state left the
|
|
105
162
|
// render between the toggle and the effect unguarded, and a press outside in that window kept the menu open (measured
|
|
@@ -108,6 +165,19 @@ function HostMenu({ label, trigger = "gb-dock-icon", children }: { label: string
|
|
|
108
165
|
const el = ref.current;
|
|
109
166
|
if (!el) return undefined;
|
|
110
167
|
const onKey = (e: KeyboardEvent) => {
|
|
168
|
+
// A menu (the panel's ⋯): ↓ ↑ Home End move between its rows, from ⋯ too, and wrap; Enter and Space press the row (a button).
|
|
169
|
+
if (el.open && el.contains(document.activeElement) && /^(ArrowDown|ArrowUp|Home|End)$/.test(e.key)) {
|
|
170
|
+
// Not a row it cannot land on: one not drawn here, or natively disabled (Clear history with nothing to clear). An off place is
|
|
171
|
+
// `aria-disabled` and stays in reach (/code-review of #7320).
|
|
172
|
+
const rows = [...el.querySelectorAll<HTMLElement>('[role^="menuitem"]')].filter((r) => r.offsetParent !== null && !(r as HTMLButtonElement).disabled);
|
|
173
|
+
if (!rows.length) return;
|
|
174
|
+
e.preventDefault();
|
|
175
|
+
const at = rows.indexOf(document.activeElement as HTMLElement);
|
|
176
|
+
const next = e.key === "Home" ? 0 : e.key === "End" ? rows.length - 1 : e.key === "ArrowDown" ? (at + 1) % rows.length
|
|
177
|
+
: (at <= 0 ? rows.length : at) - 1;
|
|
178
|
+
rows[next]!.focus();
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
111
181
|
if (!el.open || e.key !== "Escape" || e.defaultPrevented || e.isComposing || e.keyCode === 229) return;
|
|
112
182
|
const modal = (document.activeElement as Element | null)?.closest?.('dialog[open], [aria-modal="true"]');
|
|
113
183
|
if (modal && !el.contains(modal)) return;
|
|
@@ -133,7 +203,9 @@ function HostMenu({ label, trigger = "gb-dock-icon", children }: { label: string
|
|
|
133
203
|
</summary>
|
|
134
204
|
{/* title="": the popup's header carries "Drag this bar…" as its title, and a browser shows an ancestor's title on
|
|
135
205
|
any child without one of its own, so every row said it (review #3941). */}
|
|
136
|
-
<div className="gemboss-popover-surface gb-dock-menu-list" title=""
|
|
206
|
+
<div className="gemboss-popover-surface gb-dock-menu-list" title="" role={menu ? "menu" : undefined} aria-label={menu ? label : undefined}>
|
|
207
|
+
<InMenu.Provider value={menu}>{children}</InMenu.Provider>
|
|
208
|
+
</div>
|
|
137
209
|
</details>
|
|
138
210
|
);
|
|
139
211
|
}
|
|
@@ -149,8 +221,9 @@ export interface AssistantSecondTab {
|
|
|
149
221
|
|
|
150
222
|
/** Where the side panel stands BESIDE the page (assistant.css). Below it the panel would cover the page — the whole
|
|
151
223
|
* content area at 761–1099px, the whole screen on a phone — so the default there stays the popup (review #3744: on a
|
|
152
|
-
* phone a fresh open became a full-screen sheet over the very screen the question is about).
|
|
153
|
-
|
|
224
|
+
* phone a fresh open became a full-screen sheet over the very screen the question is about). Defined in dock.ts since
|
|
225
|
+
* 12/11/2026 (the provider reads it for the left panel's open-on-load); exported here as before. */
|
|
226
|
+
export { SIDE_FITS_QUERY };
|
|
154
227
|
|
|
155
228
|
/** Before paint in the browser, a plain effect on the server (where a layout effect only warns). */
|
|
156
229
|
const useBeforePaint = typeof window === "undefined" ? useEffect : useLayoutEffect;
|
|
@@ -163,17 +236,7 @@ const useBeforePaint = typeof window === "undefined" ? useEffect : useLayoutEffe
|
|
|
163
236
|
export const COMPACT_CHROME_QUERY = "(max-width: 640px)";
|
|
164
237
|
|
|
165
238
|
function useCompactChrome(): boolean {
|
|
166
|
-
|
|
167
|
-
useEffect(() => {
|
|
168
|
-
if (typeof window === "undefined" || !window.matchMedia) return;
|
|
169
|
-
const mq = window.matchMedia(COMPACT_CHROME_QUERY);
|
|
170
|
-
const on = () => setHit(mq.matches);
|
|
171
|
-
on();
|
|
172
|
-
if (mq.addEventListener) mq.addEventListener("change", on);
|
|
173
|
-
else mq.addListener(on);
|
|
174
|
-
return () => { if (mq.removeEventListener) mq.removeEventListener("change", on); else mq.removeListener(on); };
|
|
175
|
-
}, []);
|
|
176
|
-
return hit;
|
|
239
|
+
return useMediaQuery(COMPACT_CHROME_QUERY, false);
|
|
177
240
|
}
|
|
178
241
|
|
|
179
242
|
/**
|
|
@@ -190,24 +253,13 @@ function closeMenuOnButton(e: React.MouseEvent<HTMLDivElement>) {
|
|
|
190
253
|
}
|
|
191
254
|
|
|
192
255
|
function useSideFits(): boolean {
|
|
193
|
-
|
|
194
|
-
? true : window.matchMedia(SIDE_FITS_QUERY).matches);
|
|
195
|
-
useEffect(() => {
|
|
196
|
-
if (typeof window === "undefined" || !window.matchMedia) return;
|
|
197
|
-
const mq = window.matchMedia(SIDE_FITS_QUERY);
|
|
198
|
-
const on = () => setFits(mq.matches);
|
|
199
|
-
on();
|
|
200
|
-
// Safari < 14 has only the old listener API on MediaQueryList.
|
|
201
|
-
if (mq.addEventListener) mq.addEventListener("change", on);
|
|
202
|
-
else mq.addListener(on);
|
|
203
|
-
return () => { if (mq.removeEventListener) mq.removeEventListener("change", on); else mq.removeListener(on); };
|
|
204
|
-
}, []);
|
|
205
|
-
return fits;
|
|
256
|
+
return useMediaQuery(SIDE_FITS_QUERY, true);
|
|
206
257
|
}
|
|
207
258
|
|
|
208
259
|
export function AssistantHost({
|
|
209
260
|
title, labels, onNewChat, onClearHistory, canClearHistory = true, menuItems, onExpand, onShrink, fullActions, secondTab,
|
|
210
|
-
view = "primary", onViewChange, miniHint, allowSide = true,
|
|
261
|
+
view = "primary", onViewChange, miniHint, onButtonPress, allowSide = true, allowLeft = false, leftOffReason, waiting = false, failed = false, heading,
|
|
262
|
+
hideTabs = false, overlay, plus = false, children,
|
|
211
263
|
}: {
|
|
212
264
|
/**
|
|
213
265
|
* What the header says in place of the title, when the surface has more to say than a name: the admin's "← list · who you
|
|
@@ -229,7 +281,12 @@ export function AssistantHost({
|
|
|
229
281
|
* frame (assistant-plain.js) keeps its own copy of that reducer, and a question waiting is the chat's fact, not the frame's.
|
|
230
282
|
*/
|
|
231
283
|
waiting?: boolean;
|
|
232
|
-
/**
|
|
284
|
+
/**
|
|
285
|
+
* The last run ended in an error and nothing is running (12/11/2026). Like `waiting`, the surface's fact: the header and the chat
|
|
286
|
+
* button say "Something went wrong" with a red dot, ahead of "Waiting on you" (a failed run that offers Retry is a failure first).
|
|
287
|
+
*/
|
|
288
|
+
failed?: boolean;
|
|
289
|
+
/** "Gem assistant" in the admin. Names the region, the popup header and the chat button. */
|
|
233
290
|
title: string;
|
|
234
291
|
labels?: Partial<AssistantHostLabels>;
|
|
235
292
|
/** The popup header's +. Omit it and the button is not drawn. */
|
|
@@ -241,27 +298,54 @@ export function AssistantHost({
|
|
|
241
298
|
onClearHistory?: () => void;
|
|
242
299
|
/** False greys "Clear history" out (nothing to clear). */
|
|
243
300
|
canClearHistory?: boolean;
|
|
244
|
-
/** The surface's own rows
|
|
301
|
+
/** The surface's own rows of the ⋯ menu, as `AssistantMenuItem`s: under where it sits in the panel's header (12/11/2026), at the top
|
|
302
|
+
* in full screen's chrome. */
|
|
245
303
|
menuItems?: ReactNode;
|
|
246
304
|
/** Popup → full screen. The surface decides what that means (the admin navigates to its page). */
|
|
247
305
|
onExpand: () => void;
|
|
248
|
-
/** Full screen → popup, e.g. open the dock and go back to the screen they came from.
|
|
249
|
-
|
|
306
|
+
/** Full screen → popup, e.g. open the dock and go back to the screen they came from. Absent: full screen is the only place the chat has
|
|
307
|
+
* here (the admin on a phone or a tablet, where every screen is the chat: Gems/CLAUDE.md §16), so there is no "Shrink to popup" button
|
|
308
|
+
* and no such row in the small screen's ⋯ (which is then not drawn at all when nothing else is in it). */
|
|
309
|
+
onShrink?: () => void;
|
|
250
310
|
/** Extra buttons in the full-screen chrome, before "Shrink to popup". Give them `gb-dock-shrink`. */
|
|
251
311
|
fullActions?: ReactNode;
|
|
252
312
|
secondTab?: AssistantSecondTab;
|
|
253
313
|
/** Which tab the popup shows. Owned by the surface, because its full-screen actions may switch it. */
|
|
254
314
|
view?: "primary" | "secondary";
|
|
255
315
|
onViewChange?: (view: "primary" | "secondary") => void;
|
|
256
|
-
/** What the
|
|
316
|
+
/** What the chat button's name adds when idle and nothing is waiting (until 12/11/2026 the status bar's words). */
|
|
257
317
|
miniHint?: string;
|
|
258
318
|
/**
|
|
259
|
-
*
|
|
260
|
-
*
|
|
319
|
+
* The folded chat button was pressed (13/11/2026). Return `true` when the surface opened something itself, and the host does not
|
|
320
|
+
* reopen its last place; return nothing (or false) and it reopens as without this. The admin's way to open the Gem team from it.
|
|
321
|
+
*/
|
|
322
|
+
onButtonPress?: () => boolean | void;
|
|
323
|
+
/**
|
|
324
|
+
* Offer the full-height SIDE panel (01/10/2026): "On the right" in ⋯'s places (12/11/2026; a "Pin to the side"
|
|
325
|
+
* row until then). The page makes room for it — `.gemboss-platform-main` pads by `--gb-assistant-side-w`; a surface with its
|
|
261
326
|
* own layout reads the same variable. ON by default since 04/10/2026 (Chris: the side panel is every surface's default
|
|
262
327
|
* shape); a surface whose layout cannot make room passes `allowSide={false}` and gets the popup instead.
|
|
263
328
|
*/
|
|
264
329
|
allowSide?: boolean;
|
|
330
|
+
/**
|
|
331
|
+
* Offer the full-height LEFT panel (12/11/2026): the same column as the side panel, on the left of the page, beside the rail,
|
|
332
|
+
* resized on its right edge. The page makes room (`.gemboss-platform-main` pads its left by `--gb-assistant-side-w` under
|
|
333
|
+
* `<prefix>-left` on <body>). Off by default: a surface turns it on when its layout makes room on that side. A surface that folds
|
|
334
|
+
* its rail while it is up reads `useAssistantPresentation()`. Below 1100px it is off, as the side panel is.
|
|
335
|
+
*/
|
|
336
|
+
allowLeft?: boolean;
|
|
337
|
+
/**
|
|
338
|
+
* The left panel is offered on this surface but not right now, and why (12/11/2026): the admin, while an editor or a plugin's Focus
|
|
339
|
+
* frame covers the page, says "Not while an editor covers the page". The place stays in the switcher, off, its tooltip saying this;
|
|
340
|
+
* the panel is not drawn meanwhile (the popup stands in) and comes back when the reason goes.
|
|
341
|
+
*/
|
|
342
|
+
leftOffReason?: string;
|
|
343
|
+
/**
|
|
344
|
+
* The store's plan has Gem Plus (assistant/plus.tsx): the panel wears the Plus look, obsidian and gold (assistant-plus.css), always.
|
|
345
|
+
* One look for the plan, the white panel for every other (14/11/2026, Chris: "merge cái màu đen với cái màu vàng làm một… và phân
|
|
346
|
+
* biệt với cái màu trắng (chưa upgrade)"; the ivory `gold` panel and the Research switch are gone). The surface decides; the kit draws.
|
|
347
|
+
*/
|
|
348
|
+
plus?: boolean;
|
|
265
349
|
children?: ReactNode;
|
|
266
350
|
}) {
|
|
267
351
|
const dock = useAssistant();
|
|
@@ -274,7 +358,7 @@ export function AssistantHost({
|
|
|
274
358
|
|
|
275
359
|
useEffect(() => { setRunStartedAt(dock.busy ? Date.now() : null); }, [dock.busy]);
|
|
276
360
|
|
|
277
|
-
// Keep the
|
|
361
|
+
// Keep the chat button's clock moving while a run is live (1s, only while folded): it is in its name and its tooltip.
|
|
278
362
|
useEffect(() => {
|
|
279
363
|
if (!runStartedAt || dock.presentation !== "mini") return;
|
|
280
364
|
const id = window.setInterval(() => setTick((n) => n + 1), 1000);
|
|
@@ -371,18 +455,20 @@ export function AssistantHost({
|
|
|
371
455
|
// content area (or the screen) and the popup hides its pin (assistant.css); with the side panel now the DEFAULT shape,
|
|
372
456
|
// a first open at 768 went straight into that covering panel (measured on gemwatcher: 528px wide over the whole
|
|
373
457
|
// page). There the person gets the popup; the reducer puts the panel back when the window is wide again.
|
|
374
|
-
const { setSideAllowed } = dock;
|
|
458
|
+
const { setSideAllowed, setLeftAllowed } = dock;
|
|
375
459
|
const sideFits = useSideFits();
|
|
376
460
|
// Before paint: the admin mounts this host only after the first open, so that open was decided while the panel was
|
|
377
461
|
// not yet allowed; registering after paint drew the stand-in popup for a frame before the reducer swapped in the
|
|
378
462
|
// panel (review #3744).
|
|
379
463
|
useBeforePaint(() => { setSideAllowed(allowSide && sideFits); }, [allowSide, sideFits, setSideAllowed]);
|
|
464
|
+
// The left panel: the same window rule (rail + the panel's narrowest + the page's narrowest), its own opt-in.
|
|
465
|
+
useBeforePaint(() => { setLeftAllowed(allowLeft && sideFits && !leftOffReason); }, [allowLeft, sideFits, leftOffReason, setLeftAllowed]);
|
|
380
466
|
|
|
381
|
-
// ── Width drag (side
|
|
382
|
-
// The panel's LEFT edge is a `.ui-resizer` (the fleet's one seam, @gemboss/ui ui.css): dragging it left widens the
|
|
383
|
-
// panel.
|
|
384
|
-
// shield over iframes that every other seam
|
|
385
|
-
const sideDragRef = useRef<{ startX: number; startW: number; id: number } | null>(null);
|
|
467
|
+
// ── Width drag (side and left) ───────────────────────────────────────────
|
|
468
|
+
// The side panel's LEFT edge is a `.ui-resizer` (the fleet's one seam, @gemboss/ui ui.css): dragging it left widens the
|
|
469
|
+
// panel. The left panel's seam is its RIGHT edge, and dragging it right widens it (`grows`). Pointer capture keeps the drag on
|
|
470
|
+
// the seam; `ui-resizing` on <body> gives the col-resize cursor and the shield over iframes that every other seam shows.
|
|
471
|
+
const sideDragRef = useRef<{ startX: number; startW: number; id: number; grows: 1 | -1 } | null>(null);
|
|
386
472
|
const endSideDrag = useCallback((e?: React.PointerEvent<HTMLDivElement>) => {
|
|
387
473
|
sideDragRef.current = null;
|
|
388
474
|
setDragging(false);
|
|
@@ -395,25 +481,28 @@ export function AssistantHost({
|
|
|
395
481
|
(e.currentTarget as HTMLElement).setPointerCapture(e.pointerId);
|
|
396
482
|
setDragging(true);
|
|
397
483
|
document.body.classList.add("ui-resizing");
|
|
398
|
-
sideDragRef.current = { startX: e.clientX, startW: dock.sideWidth, id: e.pointerId };
|
|
399
|
-
}, [dock.sideWidth]);
|
|
484
|
+
sideDragRef.current = { startX: e.clientX, startW: dock.sideWidth, id: e.pointerId, grows: dock.presentation === "left" ? 1 : -1 };
|
|
485
|
+
}, [dock.sideWidth, dock.presentation]);
|
|
400
486
|
const onSideGripMove = useCallback((e: React.PointerEvent<HTMLDivElement>) => {
|
|
401
487
|
const drag = sideDragRef.current;
|
|
402
488
|
if (!drag || e.pointerId !== drag.id) return;
|
|
403
489
|
// A lost release (a context menu took it) leaves a mouse with no button down: treat it as the release.
|
|
404
490
|
if (e.pointerType === "mouse" && e.buttons === 0) { endSideDrag(e); return; }
|
|
405
|
-
dock.setSideWidth(drag.startW + (drag.startX
|
|
491
|
+
dock.setSideWidth(drag.startW + (e.clientX - drag.startX) * drag.grows);
|
|
406
492
|
}, [dock, endSideDrag]);
|
|
407
493
|
const onSideGripKey = useCallback((e: React.KeyboardEvent) => {
|
|
408
494
|
if (e.altKey || e.metaKey || e.ctrlKey) return; // Back / Forward belong to the browser
|
|
409
495
|
const step = e.shiftKey ? 64 : 16;
|
|
410
|
-
|
|
411
|
-
|
|
496
|
+
// The arrow that points AWAY from the page widens the panel: left for the side panel, right for the left one.
|
|
497
|
+
const wider = dock.presentation === "left" ? "ArrowRight" : "ArrowLeft";
|
|
498
|
+
const narrower = dock.presentation === "left" ? "ArrowLeft" : "ArrowRight";
|
|
499
|
+
if (e.key === wider) { e.preventDefault(); dock.setSideWidth(dock.sideWidth + step); }
|
|
500
|
+
else if (e.key === narrower) { e.preventDefault(); dock.setSideWidth(dock.sideWidth - step); }
|
|
412
501
|
else if (e.key === "Home") { e.preventDefault(); dock.setSideWidth(SIDE_MIN_WIDTH); }
|
|
413
502
|
else if (e.key === "End") { e.preventDefault(); dock.setSideWidth(Number.MAX_SAFE_INTEGER); }
|
|
414
503
|
}, [dock]);
|
|
415
504
|
// A drag that is still running when the panel goes away must not leave the shield over the page.
|
|
416
|
-
useEffect(() => { if (dock.presentation !== "side" && sideDragRef.current) endSideDrag(); }, [dock.presentation, endSideDrag]);
|
|
505
|
+
useEffect(() => { if (dock.presentation !== "side" && dock.presentation !== "left" && sideDragRef.current) endSideDrag(); }, [dock.presentation, endSideDrag]);
|
|
417
506
|
|
|
418
507
|
// A drag handle nobody can reach with a keyboard is a control only half the sellers have.
|
|
419
508
|
const onHandleKey = useCallback((e: React.KeyboardEvent) => {
|
|
@@ -428,27 +517,63 @@ export function AssistantHost({
|
|
|
428
517
|
else if (e.key === "End") { e.preventDefault(); dock.setDockHeight(DOCK_MIN_HEIGHT); }
|
|
429
518
|
}, [dock, slideBounds]);
|
|
430
519
|
|
|
520
|
+
// THE FLOATING WINDOW (12/11/2026, Chris: "ở dạng floating thì nó thực sự là floating popup có thể move khắp màn hình như cái window"):
|
|
521
|
+
// under a mouse from 768px the popup is a window, dragged anywhere, resized from its edges, docked by a drag to an edge
|
|
522
|
+
// (window-host.tsx). Under a finger or on a phone it stays the popup below (`windowed` false).
|
|
523
|
+
const windowed = useWindowMode();
|
|
524
|
+
const win = useDockWindow(dock, windowed && dock.mounted && dock.presentation === "dock", L, setDragging);
|
|
525
|
+
|
|
431
526
|
if (!dock.mounted) return null;
|
|
432
527
|
|
|
433
528
|
const mode = dock.presentation;
|
|
434
529
|
const isDock = mode === "dock";
|
|
435
530
|
const isSide = mode === "side";
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
const
|
|
531
|
+
const isLeft = mode === "left";
|
|
532
|
+
/** The working shapes over a screen share the header, the tabs and the body. */
|
|
533
|
+
const isPanel = isDock || isSide || isLeft;
|
|
534
|
+
const maxSideWidth = clampSideWidth(Number.MAX_SAFE_INTEGER, sideAvailable(isLeft));
|
|
439
535
|
// Announced on the grip. Read at render (not in the key handler) so assistive tech is told the
|
|
440
536
|
// real ceiling for this window, which changes when the window does.
|
|
441
537
|
const maxDockHeight = clampDockHeight(Number.MAX_SAFE_INTEGER, typeof window === "undefined" ? 900 : window.innerHeight);
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
538
|
+
// A failed run outranks a question waiting (a failure that offers Retry is a failure first), never a run going on now.
|
|
539
|
+
const failedNow = failed && !dock.busy;
|
|
540
|
+
const statusText = dock.busy ? L.working : failedNow ? L.failed : waiting ? L.waiting : dock.unread ? L.done : L.ready;
|
|
541
|
+
// The header dot: a run going on, then a failure, then a question waiting. Classes in assistant-places.css (12/11/2026): an inline
|
|
542
|
+
// colour until then, because assistant.css is in the frozen compatibility bundle; the places entry is not, and the plain frame
|
|
543
|
+
// (at its weight ceiling) writes one class where it wrote a style.
|
|
544
|
+
// Idle draws none (12/11/2026: a grey dot beside the title read as a stray mark), so the room goes to the title.
|
|
545
|
+
const dotClass = dock.busy ? "gb-dock-dot gb-dock-dot-busy" : failedNow ? "gb-dock-dot gb-dock-dot-failed" : waiting ? "gb-dock-dot gb-dock-dot-waiting"
|
|
546
|
+
: dock.unread ? "gb-dock-dot gb-dock-dot-unread" : null;
|
|
547
|
+
// The chat button (folded): its dot, and its name says what the dot says.
|
|
548
|
+
const knobDot = dock.busy ? KNOB_DOT.busy : failedNow ? KNOB_DOT.failed : waiting ? KNOB_DOT.waiting : dock.unread ? KNOB_DOT.unread : null;
|
|
549
|
+
// The run's clock is in the tooltip only: in the accessible name it changed the name every second (review of #7303).
|
|
550
|
+
const knobSays = dock.busy ? L.working : failedNow ? L.failed : waiting ? L.waiting : dock.unread ? L.answerWaiting : miniHint ?? "";
|
|
551
|
+
const knobName = L.reopen.replace("{title}", title) + (knobSays ? `: ${knobSays}` : "");
|
|
552
|
+
const knobTitle = dock.busy && runStartedAt ? `${knobName} · ${elapsed(runStartedAt)}` : knobName;
|
|
446
553
|
// The surface's rows of the ⋯ menu, in the panel's header and in full screen's chrome alike.
|
|
447
554
|
const clearRow = onClearHistory ? (
|
|
448
555
|
<AssistantMenuItem danger disabled={!canClearHistory} onClick={onClearHistory}>{L.clearHistory}</AssistantMenuItem>
|
|
449
556
|
) : null;
|
|
450
557
|
const surfaceRows = menuItems || clearRow ? <>{menuItems}{clearRow}</> : null;
|
|
451
|
-
const shrinkLabel = dock.sideAllowed && dock.floatShape === "side" ? L.backToSide
|
|
558
|
+
const shrinkLabel = dock.sideAllowed && dock.floatShape === "side" ? L.backToSide
|
|
559
|
+
: dock.leftAllowed && dock.floatShape === "left" ? L.backToLeft : L.shrinkToPopup;
|
|
560
|
+
/**
|
|
561
|
+
* Where the assistant sits: the FIRST group of the panel's ⋯ (12/11/2026; four buttons in the header until Chris saw them on prod:
|
|
562
|
+
* "danh sách các layout options các thứ cũng tốn không gian nhìn ko được clean, cái top bar đó ko ổn đâu nhìn rối"). Four rows, the
|
|
563
|
+
* person's place checked (`menuitemradio`, `aria-checked`). A place the HOST does not offer is not drawn; one the WINDOW cannot fit
|
|
564
|
+
* (under 1100px) is off (`aria-disabled`, still focusable) and its row says why. Switching keeps the conversation: only class names
|
|
565
|
+
* change (file header).
|
|
566
|
+
*/
|
|
567
|
+
const places = [
|
|
568
|
+
// Checked = the person's PLACE (`floatShape`), not what stands in for it: on a page the left panel is not offered, "On the left"
|
|
569
|
+
// stays checked (off, saying why) and the stand-in's own place can still be chosen (review of #7303).
|
|
570
|
+
allowSide ? { cls: PLACE_CLASS.side, icon: "panelRight", label: L.placeSide, on: dock.floatShape === "side", off: !sideFits, go: dock.openSide,
|
|
571
|
+
why: L.placeNeedsWidth } as const : null,
|
|
572
|
+
allowLeft ? { cls: PLACE_CLASS.left, icon: "panelLeft", label: L.placeLeft, on: dock.floatShape === "left", off: !sideFits || !!leftOffReason,
|
|
573
|
+
go: dock.openLeft, why: sideFits && leftOffReason ? leftOffReason : L.placeNeedsWidth } as const : null,
|
|
574
|
+
{ cls: PLACE_CLASS.dock, icon: "popup", label: L.placeDock, on: dock.floatShape === "dock", off: false, go: dock.openDock, why: "" } as const,
|
|
575
|
+
{ cls: PLACE_CLASS.full, icon: "expand", label: L.placeFull, on: false, off: false, go: onExpand, why: "" } as const,
|
|
576
|
+
].filter((p) => p !== null);
|
|
452
577
|
// Full screen is the assistant's own page and has no tab strip; the second tab lives in the popup.
|
|
453
578
|
const secondVisible = isPanel && !!secondTab && view === "secondary";
|
|
454
579
|
// `overlay={open && <List />}` is the common way to write it: false, null and undefined are all "no overlay".
|
|
@@ -456,11 +581,12 @@ export function AssistantHost({
|
|
|
456
581
|
const secondBadge = secondTab?.badge || 0;
|
|
457
582
|
|
|
458
583
|
return (
|
|
584
|
+
<>
|
|
459
585
|
<div
|
|
460
586
|
ref={shellRef}
|
|
461
|
-
className={`gb-dock ${MODE_CLASS[mode]}${dragging ? " gb-dock-dragging" : ""}`}
|
|
462
|
-
style={isDock ? { height: dock.dockHeight, right: dock.dockOffsetRight }
|
|
463
|
-
: isSide ? ({ "--gb-dock-side-w": `${dock.sideWidth}px` } as React.CSSProperties) : undefined}
|
|
587
|
+
className={`gb-dock ${MODE_CLASS[mode]}${win ? win.cls : ""}${dragging ? " gb-dock-dragging" : ""}${plus ? " gb-dock--plus" : ""}`}
|
|
588
|
+
style={win ? win.style : isDock ? { height: dock.dockHeight, right: dock.dockOffsetRight }
|
|
589
|
+
: isSide || isLeft ? ({ "--gb-dock-side-w": `${dock.sideWidth}px` } as React.CSSProperties) : undefined}
|
|
464
590
|
role={mode === "hidden" ? undefined : "region"}
|
|
465
591
|
aria-label={mode === "hidden" ? undefined : title}
|
|
466
592
|
>
|
|
@@ -470,51 +596,40 @@ export function AssistantHost({
|
|
|
470
596
|
{compactChrome ? <>
|
|
471
597
|
{/* Small screen: ONE ⋯ holds the surface's buttons (labels shown), its rows and the way back (COMPACT_CHROME_QUERY). */}
|
|
472
598
|
{actions.filter(keepsOut)}
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
{
|
|
476
|
-
|
|
477
|
-
|
|
599
|
+
{/* No way back (`onShrink` absent) and nothing else to hold: no ⋯ at all, never an empty menu. */}
|
|
600
|
+
{onShrink || surfaceRows || actions.some((n) => !keepsOut(n)) ? (
|
|
601
|
+
<HostMenu label={L.more} trigger="gb-dock-shrink gb-dock-menu-pill">
|
|
602
|
+
<div className="gb-dock-menu-actions" onClick={closeMenuOnButton}>{actions.filter((n) => !keepsOut(n))}</div>
|
|
603
|
+
{surfaceRows}
|
|
604
|
+
{onShrink ? <AssistantMenuItem onClick={onShrink}>{shrinkLabel}</AssistantMenuItem> : null}
|
|
605
|
+
</HostMenu>
|
|
606
|
+
) : null}
|
|
478
607
|
</> : <>
|
|
479
608
|
{fullActions}
|
|
480
609
|
{surfaceRows ? <HostMenu label={L.more} trigger="gb-dock-shrink gb-dock-menu-pill">{surfaceRows}</HostMenu> : null}
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
610
|
+
{onShrink ? (
|
|
611
|
+
<button type="button" className="gb-dock-shrink" onClick={onShrink}>
|
|
612
|
+
{/* Two arrows pulled INTO the centre. The first attempt drew two corner brackets, which at 16px
|
|
613
|
+
reads as a plus sign — the opposite of "make this smaller". */}
|
|
614
|
+
<Icon name="shrink" size={16} />
|
|
615
|
+
<span>{shrinkLabel}</span>
|
|
616
|
+
</button>
|
|
617
|
+
) : null}
|
|
487
618
|
</>}
|
|
488
619
|
</div>
|
|
489
620
|
) : null}
|
|
490
621
|
|
|
491
622
|
{mode === "mini" ? (
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
<span className="gb-dock-minichevron" aria-hidden><Icon name="chevronUp" size={14} /></span>
|
|
500
|
-
</button>
|
|
501
|
-
{/* A bar that follows you onto every screen has to be closable from the bar itself. While a
|
|
502
|
-
run is live `dismiss` opens it instead — see ./dock. */}
|
|
503
|
-
<button
|
|
504
|
-
type="button"
|
|
505
|
-
className="gb-dock-icon"
|
|
506
|
-
onClick={dock.dismiss}
|
|
507
|
-
title={dock.busy ? L.openInsteadTitle : L.hideTitle}
|
|
508
|
-
>
|
|
509
|
-
<Icon name="close" size={18} />
|
|
510
|
-
{/* The NAME follows the behaviour: while a run is live this button opens the popup rather
|
|
511
|
-
than hiding it, and `title` is not the accessible name. */}
|
|
512
|
-
<span className="gb-dock-sr">{dock.busy ? L.openInstead : L.hide}</span>
|
|
513
|
-
</button>
|
|
514
|
-
</div>
|
|
623
|
+
// FOLDED = THE CHAT BUTTON (12/11/2026, Chris: "collapse lại là thành hình button chat chứ không phải cái panel"): a round black
|
|
624
|
+
// button in the bottom-right corner, the admin's chat corner's look, whatever shape it folded from; a press reopens that shape.
|
|
625
|
+
// Its dot says what the bar's words said (Gem working, a question waiting, a failure, an answer waiting); its name says it too.
|
|
626
|
+
<button type="button" className="gb-dock-knob" onClick={() => { if (onButtonPress?.() !== true) dock.reopen(); }} aria-label={knobName} title={knobTitle}>
|
|
627
|
+
<Icon name="chat" size={22} />
|
|
628
|
+
{knobDot ? <span className={knobDot} aria-hidden /> : null}
|
|
629
|
+
</button>
|
|
515
630
|
) : null}
|
|
516
631
|
|
|
517
|
-
{isSide ? (
|
|
632
|
+
{isSide || isLeft ? (
|
|
518
633
|
<div
|
|
519
634
|
className="ui-resizer gb-dock-sidegrip"
|
|
520
635
|
role="separator"
|
|
@@ -535,7 +650,7 @@ export function AssistantHost({
|
|
|
535
650
|
|
|
536
651
|
{isPanel ? (
|
|
537
652
|
<>
|
|
538
|
-
{isDock ? <div
|
|
653
|
+
{isDock && !win ? <div
|
|
539
654
|
className="gb-dock-grip"
|
|
540
655
|
role="separator"
|
|
541
656
|
aria-orientation="horizontal"
|
|
@@ -552,22 +667,26 @@ export function AssistantHost({
|
|
|
552
667
|
>
|
|
553
668
|
<span aria-hidden />
|
|
554
669
|
</div> : null}
|
|
670
|
+
{win ? win.handles : null}
|
|
555
671
|
<header
|
|
556
672
|
className="gb-dock-header"
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
673
|
+
{...(win ? win.header : {
|
|
674
|
+
onPointerDown: isDock ? onHeaderDown : undefined,
|
|
675
|
+
onPointerMove: isDock ? onHeaderMove : undefined,
|
|
676
|
+
onPointerUp: isDock ? onHeaderUp : undefined,
|
|
677
|
+
onPointerCancel: isDock ? onHeaderUp : undefined,
|
|
678
|
+
title: isDock ? L.headerTitle : undefined,
|
|
679
|
+
})}
|
|
562
680
|
>
|
|
563
|
-
|
|
681
|
+
{win ? win.grip : null}
|
|
682
|
+
{dotClass ? <span className={dotClass} aria-hidden /> : null}
|
|
564
683
|
{heading ?? <span className="gb-dock-title">{title}</span>}
|
|
565
684
|
<span className="gb-dock-status">{statusText}</span>
|
|
566
685
|
<div className="gb-dock-actions">
|
|
567
686
|
{onNewChat ? (
|
|
568
687
|
<button
|
|
569
688
|
type="button"
|
|
570
|
-
className="gb-dock-icon
|
|
689
|
+
className="gb-dock-icon"
|
|
571
690
|
title={L.newChat}
|
|
572
691
|
onClick={onNewChat}
|
|
573
692
|
>
|
|
@@ -575,29 +694,28 @@ export function AssistantHost({
|
|
|
575
694
|
<span className="gb-dock-sr">{L.newChat}</span>
|
|
576
695
|
</button>
|
|
577
696
|
) : null}
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
697
|
+
{/* ⋯ (0.31.0): where it sits first (12/11/2026: the header's four place buttons came here), then the surface's rows and
|
|
698
|
+
Clear history. No "Fold into the chat button" row: × does that (Chris 12/11: "nó là 1"). A menu: ↓ ↑ Home End move,
|
|
699
|
+
Enter presses, Escape closes onto ⋯.
|
|
700
|
+
Off is `aria-disabled`, never `disabled` (the kit's rule): it keeps its focus, and its row says why. */}
|
|
701
|
+
<HostMenu label={L.more} menu>
|
|
702
|
+
<div className="gb-dock-menu-group" role="group" aria-label={L.places}>
|
|
703
|
+
{places.map((p) => (
|
|
704
|
+
<button key={p.label} type="button" role="menuitemradio" className={p.cls} aria-checked={p.on} aria-disabled={p.off || undefined}
|
|
705
|
+
onClick={p.off ? undefined : (e) => {
|
|
706
|
+
const menu = e.currentTarget.closest("details");
|
|
707
|
+
menu?.removeAttribute("open");
|
|
708
|
+
menu?.querySelector("summary")?.focus();
|
|
709
|
+
if (!p.on) p.go();
|
|
710
|
+
}}>
|
|
711
|
+
<span className="ui-menu__icon" aria-hidden="true"><Icon name={p.icon} size={16} /></span>
|
|
712
|
+
<span className="gb-dock-place-name">{p.label}{p.off ? <span className="gb-dock-place-why">{p.why}</span> : null}</span>
|
|
713
|
+
{p.on ? <Icon name="check" size={16} /> : null}
|
|
714
|
+
</button>
|
|
715
|
+
))}
|
|
716
|
+
</div>
|
|
595
717
|
{surfaceRows ? <hr className="gb-dock-menu-sep" /> : null}
|
|
596
|
-
{
|
|
597
|
-
<AssistantMenuItem className="gb-dock-pinside" onClick={dock.openSide}>{L.pinSide}</AssistantMenuItem>
|
|
598
|
-
) : null}
|
|
599
|
-
{isSide ? <AssistantMenuItem onClick={dock.openDock}>{L.floatPopup}</AssistantMenuItem> : null}
|
|
600
|
-
<AssistantMenuItem onClick={dock.minimize}>{L.minimizeTitle}</AssistantMenuItem>
|
|
718
|
+
{surfaceRows}
|
|
601
719
|
</HostMenu>
|
|
602
720
|
<button
|
|
603
721
|
type="button"
|
|
@@ -654,5 +772,8 @@ export function AssistantHost({
|
|
|
654
772
|
{overlayVisible ? <div className="gb-dock-pane">{overlay}</div> : null}
|
|
655
773
|
</div>
|
|
656
774
|
</div>
|
|
775
|
+
{/* The window's drop zones while it is dragged: after the frame, never in it (window-host.tsx). */}
|
|
776
|
+
{win ? win.overlay : null}
|
|
777
|
+
</>
|
|
657
778
|
);
|
|
658
779
|
}
|