@gemboss/ui 0.70.2 → 0.71.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 +257 -2
- package/README.md +25 -9
- package/catalog/editor.html +1 -1
- package/catalog/index.html +48 -46
- package/gemboss-ui.css +4 -4
- package/package.json +17 -1
- package/parts/components.css +2 -2
- 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.tsx +118 -16
- package/src/assistant/composer-menus.tsx +7 -2
- package/src/assistant/dock.ts +97 -10
- package/src/assistant/hold.ts +51 -0
- package/src/assistant/host.tsx +231 -124
- package/src/assistant/index.ts +4 -2
- 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-hold.css +1 -0
- package/src/assistant-places.css +1 -0
- package/src/assistant-plain.js +1 -1
- 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/chat-attachments.css +1 -1
- 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-voice.css +1 -1
- package/src/chat.css +1 -1
- package/src/collections.css +1 -1
- package/src/create-shell.css +1 -1
- package/src/editor/controls.tsx +28 -4
- package/src/editor/field-control.tsx +11 -2
- package/src/editor/field-spec.ts +6 -2
- 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-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-editor.css +1 -1
- package/src/feedback-dialog.css +1 -0
- package/src/feedback-dialog.tsx +122 -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 +1 -0
- package/src/job-card.css +1 -1
- package/src/kit-plain.css +1 -1
- package/src/language-switcher.css +1 -1
- package/src/list-page.css +1 -1
- package/src/list-toolbar.css +1 -1
- package/src/members.css +1 -1
- package/src/menu-extras.css +1 -1
- package/src/menu-select.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/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/report-charts.css +1 -1
- 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/shell.css +1 -1
- 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/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,100 @@
|
|
|
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
|
+
// 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).
|
|
20
|
+
import "../menu-extras.css";
|
|
21
|
+
import React, { Children, createContext, isValidElement, useCallback, useContext, useEffect, useLayoutEffect, useRef, useState, type ReactNode } from "react";
|
|
17
22
|
|
|
18
23
|
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";
|
|
24
|
+
import { DOCK_MIN_HEIGHT, SIDE_FITS_QUERY, SIDE_MIN_WIDTH, clampDockHeight, clampSideWidth } from "./dock";
|
|
20
25
|
import { sideAvailable, useAssistant } from "./provider";
|
|
26
|
+
// The floating window (12/11/2026, canvas GemDockModes 4, 7, 8): its ⋮⋮, edges and drop zones, and its stylesheet (assistant-window.css,
|
|
27
|
+
// an entry of its own), which comes after assistant-places.css because this import comes after that one.
|
|
28
|
+
import { useDockWindow, useMediaQuery, useWindowMode, type DockWindowLabels } from "./window-host";
|
|
21
29
|
|
|
22
30
|
/** One literal class per presentation, not `gb-dock-${mode}`: a runtime-built class name is a stem the
|
|
23
31
|
* 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;
|
|
32
|
+
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;
|
|
33
|
+
/** 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. */
|
|
34
|
+
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;
|
|
35
|
+
/** The chat button's dot, by what it says (busy > failed > waiting > an answer waiting). */
|
|
36
|
+
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
37
|
|
|
26
38
|
|
|
27
|
-
/** mm:ss since a run started — the only honest thing the
|
|
39
|
+
/** mm:ss since a run started — the only honest thing the chat button can say about a run. */
|
|
28
40
|
function elapsed(since: number): string {
|
|
29
41
|
const s = Math.max(0, Math.floor((Date.now() - since) / 1000));
|
|
30
42
|
return `${Math.floor(s / 60)}:${String(s % 60).padStart(2, "0")}`;
|
|
31
43
|
}
|
|
32
44
|
|
|
33
45
|
/** Every word the host says. English defaults are the admin's; a surface passes its own language. */
|
|
34
|
-
export interface AssistantHostLabels {
|
|
46
|
+
export interface AssistantHostLabels extends DockWindowLabels {
|
|
35
47
|
ready: string; working: string; done: string;
|
|
36
|
-
answerWaiting: string;
|
|
48
|
+
answerWaiting: string;
|
|
49
|
+
/** @deprecated 12/11/2026: the status bar's default hint, gone with the bar. Not drawn. */
|
|
50
|
+
askAboutScreen: string;
|
|
37
51
|
/** The last answer ends on a question only the person can answer (the `waiting` prop). */
|
|
38
52
|
waiting: string;
|
|
39
|
-
reopen: string;
|
|
53
|
+
reopen: string;
|
|
54
|
+
/** @deprecated 12/11/2026: the status bar's ×, gone with the bar (the chat button has none). Not drawn. */
|
|
55
|
+
hide: string;
|
|
56
|
+
/** @deprecated 12/11/2026: as `hide`. */
|
|
57
|
+
hideTitle: string;
|
|
58
|
+
/** @deprecated 12/11/2026: as `hide`. */
|
|
59
|
+
openInstead: string;
|
|
60
|
+
/** @deprecated 12/11/2026: as `hide`. */
|
|
61
|
+
openInsteadTitle: string;
|
|
40
62
|
grip: string; headerTitle: string;
|
|
41
|
-
|
|
63
|
+
/** @deprecated 12/11/2026: the header's full-screen button, now ⋯'s `placeFull` row. Not drawn. */
|
|
64
|
+
openFull: string;
|
|
65
|
+
newChat: string;
|
|
66
|
+
/** @deprecated 12/11/2026: ⋯'s "Fold into the chat button" row, gone: × does it (Chris: "nó là 1"). Not drawn. */
|
|
67
|
+
minimize: string;
|
|
68
|
+
/** @deprecated 12/11/2026: as `minimize`. */
|
|
69
|
+
minimizeTitle: string;
|
|
42
70
|
close: string; closeBusy: string; closeBusyTitle: string;
|
|
43
71
|
shrinkToPopup: string; tablist: string; primaryTab: string;
|
|
44
|
-
|
|
72
|
+
/** @deprecated 12/11/2026: the ⋯ row, now ⋯'s `placeSide` row. Not drawn. */
|
|
73
|
+
pinSide: string;
|
|
74
|
+
/** @deprecated 12/11/2026: the ⋯ row, now ⋯'s `placeDock` row. Not drawn. */
|
|
75
|
+
floatPopup: string;
|
|
76
|
+
sideGrip: string; backToSide: string;
|
|
45
77
|
more: string; clearHistory: string;
|
|
78
|
+
/** The last run failed (the `failed` prop): the header and the chat button say it, in red. */
|
|
79
|
+
failed: string;
|
|
80
|
+
/** 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. */
|
|
81
|
+
places: string; placeSide: string; placeLeft: string; placeDock: string; placeFull: string; placeNeedsWidth: string;
|
|
82
|
+
/** Full screen's way back when the left panel is the working shape. */
|
|
83
|
+
backToLeft: string;
|
|
46
84
|
}
|
|
47
85
|
const EN: AssistantHostLabels = {
|
|
48
86
|
ready: "Ready", working: "Working", done: "Done — tap to see it",
|
|
49
87
|
answerWaiting: "An answer is waiting", askAboutScreen: "Ask about this screen", waiting: "Waiting on you",
|
|
50
|
-
reopen: "Reopen the {title}",
|
|
88
|
+
reopen: "Reopen the {title}",
|
|
89
|
+
// `hide`, `hideTitle`, `openInstead`, `openInsteadTitle`: the status bar's ×, gone with the bar (the chat button has none). Kept
|
|
90
|
+
// so a surface's `labels` still type-checks.
|
|
91
|
+
hide: "Hide the assistant", hideTitle: "Hide the assistant",
|
|
51
92
|
openInstead: "Open the assistant", openInsteadTitle: "Still working — open it",
|
|
52
93
|
grip: "Drag to resize the assistant; left and right arrows move it sideways",
|
|
53
94
|
headerTitle: "Drag this bar to move the popup left or right",
|
|
54
|
-
|
|
55
|
-
|
|
95
|
+
// `openFull`, `pinSide`, `floatPopup`: the header's ⤢ and the ⋯ rows the places replaced; `minimize`, `minimizeTitle`: ⋯'s fold row, which
|
|
96
|
+
// × does. Kept for the same reason.
|
|
97
|
+
newChat: "New chat", openFull: "Open full screen", minimize: "Minimise", minimizeTitle: "Fold into the chat button",
|
|
98
|
+
close: "Close the assistant", closeBusy: "Fold into the chat button", closeBusyTitle: "Still working — fold it into the chat button",
|
|
56
99
|
shrinkToPopup: "Shrink to popup", tablist: "Assistant or a person", primaryTab: "Assistant",
|
|
57
100
|
pinSide: "Pin to the side", floatPopup: "Float as a popup", sideGrip: "Drag to resize the assistant; left and right arrows work too",
|
|
58
101
|
backToSide: "Back to the side panel",
|
|
59
102
|
more: "More", clearHistory: "Clear history",
|
|
103
|
+
failed: "Something went wrong",
|
|
104
|
+
places: "Where the assistant sits", placeSide: "On the right", placeLeft: "On the left", placeDock: "Floating window",
|
|
105
|
+
placeFull: "Full screen", placeNeedsWidth: "Needs a window at least 1100px wide",
|
|
106
|
+
backToLeft: "Back to the left panel",
|
|
107
|
+
// 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.
|
|
108
|
+
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",
|
|
109
|
+
windowHeaderTitle: "Drag this bar to move the window", dropLeft: "Release to dock on the left", dropSide: "Release to dock on the right",
|
|
60
110
|
};
|
|
61
111
|
|
|
62
112
|
/**
|
|
@@ -73,9 +123,11 @@ export function AssistantMenuItem({ danger, disabled, onClick, className, childr
|
|
|
73
123
|
className?: string;
|
|
74
124
|
children?: ReactNode;
|
|
75
125
|
}) {
|
|
126
|
+
const inMenu = useContext(InMenu);
|
|
76
127
|
return (
|
|
77
128
|
<button
|
|
78
129
|
type="button"
|
|
130
|
+
role={inMenu ? "menuitem" : undefined}
|
|
79
131
|
className={["ui-menu__item", danger ? "ui-menu__item--danger" : "", className ?? ""].filter(Boolean).join(" ")}
|
|
80
132
|
disabled={disabled}
|
|
81
133
|
onClick={(e) => {
|
|
@@ -90,6 +142,10 @@ export function AssistantMenuItem({ danger, disabled, onClick, className, childr
|
|
|
90
142
|
);
|
|
91
143
|
}
|
|
92
144
|
|
|
145
|
+
/** 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
|
|
146
|
+
* ⋯ holds the surface's own buttons too, and stays a disclosure of buttons. */
|
|
147
|
+
const InMenu = createContext(false);
|
|
148
|
+
|
|
93
149
|
/**
|
|
94
150
|
* 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
151
|
* 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 +155,7 @@ export function AssistantMenuItem({ danger, disabled, onClick, className, childr
|
|
|
99
155
|
* "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
156
|
* closes when the window loses focus (a click into an iframe), like the kit's plain menus (kit-plain.js initMenus).
|
|
101
157
|
*/
|
|
102
|
-
function HostMenu({ label, trigger = "gb-dock-icon", children }: { label: string; trigger?: string; children: ReactNode }) {
|
|
158
|
+
function HostMenu({ label, trigger = "gb-dock-icon", menu = false, children }: { label: string; trigger?: string; menu?: boolean; children: ReactNode }) {
|
|
103
159
|
const ref = useRef<HTMLDetailsElement>(null);
|
|
104
160
|
// Listening all the time and asking `el.open`, like the kit's Menu: gating the listeners on an `open` state left the
|
|
105
161
|
// render between the toggle and the effect unguarded, and a press outside in that window kept the menu open (measured
|
|
@@ -108,6 +164,19 @@ function HostMenu({ label, trigger = "gb-dock-icon", children }: { label: string
|
|
|
108
164
|
const el = ref.current;
|
|
109
165
|
if (!el) return undefined;
|
|
110
166
|
const onKey = (e: KeyboardEvent) => {
|
|
167
|
+
// A menu (the panel's ⋯): ↓ ↑ Home End move between its rows, from ⋯ too, and wrap; Enter and Space press the row (a button).
|
|
168
|
+
if (el.open && el.contains(document.activeElement) && /^(ArrowDown|ArrowUp|Home|End)$/.test(e.key)) {
|
|
169
|
+
// Not a row it cannot land on: one not drawn here, or natively disabled (Clear history with nothing to clear). An off place is
|
|
170
|
+
// `aria-disabled` and stays in reach (/code-review of #7320).
|
|
171
|
+
const rows = [...el.querySelectorAll<HTMLElement>('[role^="menuitem"]')].filter((r) => r.offsetParent !== null && !(r as HTMLButtonElement).disabled);
|
|
172
|
+
if (!rows.length) return;
|
|
173
|
+
e.preventDefault();
|
|
174
|
+
const at = rows.indexOf(document.activeElement as HTMLElement);
|
|
175
|
+
const next = e.key === "Home" ? 0 : e.key === "End" ? rows.length - 1 : e.key === "ArrowDown" ? (at + 1) % rows.length
|
|
176
|
+
: (at <= 0 ? rows.length : at) - 1;
|
|
177
|
+
rows[next]!.focus();
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
111
180
|
if (!el.open || e.key !== "Escape" || e.defaultPrevented || e.isComposing || e.keyCode === 229) return;
|
|
112
181
|
const modal = (document.activeElement as Element | null)?.closest?.('dialog[open], [aria-modal="true"]');
|
|
113
182
|
if (modal && !el.contains(modal)) return;
|
|
@@ -133,7 +202,9 @@ function HostMenu({ label, trigger = "gb-dock-icon", children }: { label: string
|
|
|
133
202
|
</summary>
|
|
134
203
|
{/* title="": the popup's header carries "Drag this bar…" as its title, and a browser shows an ancestor's title on
|
|
135
204
|
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=""
|
|
205
|
+
<div className="gemboss-popover-surface gb-dock-menu-list" title="" role={menu ? "menu" : undefined} aria-label={menu ? label : undefined}>
|
|
206
|
+
<InMenu.Provider value={menu}>{children}</InMenu.Provider>
|
|
207
|
+
</div>
|
|
137
208
|
</details>
|
|
138
209
|
);
|
|
139
210
|
}
|
|
@@ -149,8 +220,9 @@ export interface AssistantSecondTab {
|
|
|
149
220
|
|
|
150
221
|
/** Where the side panel stands BESIDE the page (assistant.css). Below it the panel would cover the page — the whole
|
|
151
222
|
* 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
|
-
|
|
223
|
+
* phone a fresh open became a full-screen sheet over the very screen the question is about). Defined in dock.ts since
|
|
224
|
+
* 12/11/2026 (the provider reads it for the left panel's open-on-load); exported here as before. */
|
|
225
|
+
export { SIDE_FITS_QUERY };
|
|
154
226
|
|
|
155
227
|
/** Before paint in the browser, a plain effect on the server (where a layout effect only warns). */
|
|
156
228
|
const useBeforePaint = typeof window === "undefined" ? useEffect : useLayoutEffect;
|
|
@@ -163,17 +235,7 @@ const useBeforePaint = typeof window === "undefined" ? useEffect : useLayoutEffe
|
|
|
163
235
|
export const COMPACT_CHROME_QUERY = "(max-width: 640px)";
|
|
164
236
|
|
|
165
237
|
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;
|
|
238
|
+
return useMediaQuery(COMPACT_CHROME_QUERY, false);
|
|
177
239
|
}
|
|
178
240
|
|
|
179
241
|
/**
|
|
@@ -190,24 +252,13 @@ function closeMenuOnButton(e: React.MouseEvent<HTMLDivElement>) {
|
|
|
190
252
|
}
|
|
191
253
|
|
|
192
254
|
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;
|
|
255
|
+
return useMediaQuery(SIDE_FITS_QUERY, true);
|
|
206
256
|
}
|
|
207
257
|
|
|
208
258
|
export function AssistantHost({
|
|
209
259
|
title, labels, onNewChat, onClearHistory, canClearHistory = true, menuItems, onExpand, onShrink, fullActions, secondTab,
|
|
210
|
-
view = "primary", onViewChange, miniHint, allowSide = true,
|
|
260
|
+
view = "primary", onViewChange, miniHint, onButtonPress, allowSide = true, allowLeft = false, leftOffReason, waiting = false, failed = false, heading,
|
|
261
|
+
hideTabs = false, overlay, children,
|
|
211
262
|
}: {
|
|
212
263
|
/**
|
|
213
264
|
* 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 +280,12 @@ export function AssistantHost({
|
|
|
229
280
|
* 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
281
|
*/
|
|
231
282
|
waiting?: boolean;
|
|
232
|
-
/**
|
|
283
|
+
/**
|
|
284
|
+
* 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
|
|
285
|
+
* button say "Something went wrong" with a red dot, ahead of "Waiting on you" (a failed run that offers Retry is a failure first).
|
|
286
|
+
*/
|
|
287
|
+
failed?: boolean;
|
|
288
|
+
/** "Gem assistant" in the admin. Names the region, the popup header and the chat button. */
|
|
233
289
|
title: string;
|
|
234
290
|
labels?: Partial<AssistantHostLabels>;
|
|
235
291
|
/** The popup header's +. Omit it and the button is not drawn. */
|
|
@@ -241,7 +297,8 @@ export function AssistantHost({
|
|
|
241
297
|
onClearHistory?: () => void;
|
|
242
298
|
/** False greys "Clear history" out (nothing to clear). */
|
|
243
299
|
canClearHistory?: boolean;
|
|
244
|
-
/** The surface's own rows
|
|
300
|
+
/** 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
|
|
301
|
+
* in full screen's chrome. */
|
|
245
302
|
menuItems?: ReactNode;
|
|
246
303
|
/** Popup → full screen. The surface decides what that means (the admin navigates to its page). */
|
|
247
304
|
onExpand: () => void;
|
|
@@ -253,15 +310,33 @@ export function AssistantHost({
|
|
|
253
310
|
/** Which tab the popup shows. Owned by the surface, because its full-screen actions may switch it. */
|
|
254
311
|
view?: "primary" | "secondary";
|
|
255
312
|
onViewChange?: (view: "primary" | "secondary") => void;
|
|
256
|
-
/** What the
|
|
313
|
+
/** What the chat button's name adds when idle and nothing is waiting (until 12/11/2026 the status bar's words). */
|
|
257
314
|
miniHint?: string;
|
|
258
315
|
/**
|
|
259
|
-
*
|
|
260
|
-
*
|
|
316
|
+
* The folded chat button was pressed (13/11/2026). Return `true` when the surface opened something itself, and the host does not
|
|
317
|
+
* 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.
|
|
318
|
+
*/
|
|
319
|
+
onButtonPress?: () => boolean | void;
|
|
320
|
+
/**
|
|
321
|
+
* Offer the full-height SIDE panel (01/10/2026): "On the right" in ⋯'s places (12/11/2026; a "Pin to the side"
|
|
322
|
+
* row until then). The page makes room for it — `.gemboss-platform-main` pads by `--gb-assistant-side-w`; a surface with its
|
|
261
323
|
* own layout reads the same variable. ON by default since 04/10/2026 (Chris: the side panel is every surface's default
|
|
262
324
|
* shape); a surface whose layout cannot make room passes `allowSide={false}` and gets the popup instead.
|
|
263
325
|
*/
|
|
264
326
|
allowSide?: boolean;
|
|
327
|
+
/**
|
|
328
|
+
* 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,
|
|
329
|
+
* resized on its right edge. The page makes room (`.gemboss-platform-main` pads its left by `--gb-assistant-side-w` under
|
|
330
|
+
* `<prefix>-left` on <body>). Off by default: a surface turns it on when its layout makes room on that side. A surface that folds
|
|
331
|
+
* its rail while it is up reads `useAssistantPresentation()`. Below 1100px it is off, as the side panel is.
|
|
332
|
+
*/
|
|
333
|
+
allowLeft?: boolean;
|
|
334
|
+
/**
|
|
335
|
+
* 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
|
|
336
|
+
* frame covers the page, says "Not while an editor covers the page". The place stays in the switcher, off, its tooltip saying this;
|
|
337
|
+
* the panel is not drawn meanwhile (the popup stands in) and comes back when the reason goes.
|
|
338
|
+
*/
|
|
339
|
+
leftOffReason?: string;
|
|
265
340
|
children?: ReactNode;
|
|
266
341
|
}) {
|
|
267
342
|
const dock = useAssistant();
|
|
@@ -274,7 +349,7 @@ export function AssistantHost({
|
|
|
274
349
|
|
|
275
350
|
useEffect(() => { setRunStartedAt(dock.busy ? Date.now() : null); }, [dock.busy]);
|
|
276
351
|
|
|
277
|
-
// Keep the
|
|
352
|
+
// 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
353
|
useEffect(() => {
|
|
279
354
|
if (!runStartedAt || dock.presentation !== "mini") return;
|
|
280
355
|
const id = window.setInterval(() => setTick((n) => n + 1), 1000);
|
|
@@ -371,18 +446,20 @@ export function AssistantHost({
|
|
|
371
446
|
// content area (or the screen) and the popup hides its pin (assistant.css); with the side panel now the DEFAULT shape,
|
|
372
447
|
// a first open at 768 went straight into that covering panel (measured on gemwatcher: 528px wide over the whole
|
|
373
448
|
// page). There the person gets the popup; the reducer puts the panel back when the window is wide again.
|
|
374
|
-
const { setSideAllowed } = dock;
|
|
449
|
+
const { setSideAllowed, setLeftAllowed } = dock;
|
|
375
450
|
const sideFits = useSideFits();
|
|
376
451
|
// Before paint: the admin mounts this host only after the first open, so that open was decided while the panel was
|
|
377
452
|
// not yet allowed; registering after paint drew the stand-in popup for a frame before the reducer swapped in the
|
|
378
453
|
// panel (review #3744).
|
|
379
454
|
useBeforePaint(() => { setSideAllowed(allowSide && sideFits); }, [allowSide, sideFits, setSideAllowed]);
|
|
455
|
+
// The left panel: the same window rule (rail + the panel's narrowest + the page's narrowest), its own opt-in.
|
|
456
|
+
useBeforePaint(() => { setLeftAllowed(allowLeft && sideFits && !leftOffReason); }, [allowLeft, sideFits, leftOffReason, setLeftAllowed]);
|
|
380
457
|
|
|
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);
|
|
458
|
+
// ── Width drag (side and left) ───────────────────────────────────────────
|
|
459
|
+
// The side panel's LEFT edge is a `.ui-resizer` (the fleet's one seam, @gemboss/ui ui.css): dragging it left widens the
|
|
460
|
+
// panel. The left panel's seam is its RIGHT edge, and dragging it right widens it (`grows`). Pointer capture keeps the drag on
|
|
461
|
+
// the seam; `ui-resizing` on <body> gives the col-resize cursor and the shield over iframes that every other seam shows.
|
|
462
|
+
const sideDragRef = useRef<{ startX: number; startW: number; id: number; grows: 1 | -1 } | null>(null);
|
|
386
463
|
const endSideDrag = useCallback((e?: React.PointerEvent<HTMLDivElement>) => {
|
|
387
464
|
sideDragRef.current = null;
|
|
388
465
|
setDragging(false);
|
|
@@ -395,25 +472,28 @@ export function AssistantHost({
|
|
|
395
472
|
(e.currentTarget as HTMLElement).setPointerCapture(e.pointerId);
|
|
396
473
|
setDragging(true);
|
|
397
474
|
document.body.classList.add("ui-resizing");
|
|
398
|
-
sideDragRef.current = { startX: e.clientX, startW: dock.sideWidth, id: e.pointerId };
|
|
399
|
-
}, [dock.sideWidth]);
|
|
475
|
+
sideDragRef.current = { startX: e.clientX, startW: dock.sideWidth, id: e.pointerId, grows: dock.presentation === "left" ? 1 : -1 };
|
|
476
|
+
}, [dock.sideWidth, dock.presentation]);
|
|
400
477
|
const onSideGripMove = useCallback((e: React.PointerEvent<HTMLDivElement>) => {
|
|
401
478
|
const drag = sideDragRef.current;
|
|
402
479
|
if (!drag || e.pointerId !== drag.id) return;
|
|
403
480
|
// A lost release (a context menu took it) leaves a mouse with no button down: treat it as the release.
|
|
404
481
|
if (e.pointerType === "mouse" && e.buttons === 0) { endSideDrag(e); return; }
|
|
405
|
-
dock.setSideWidth(drag.startW + (drag.startX
|
|
482
|
+
dock.setSideWidth(drag.startW + (e.clientX - drag.startX) * drag.grows);
|
|
406
483
|
}, [dock, endSideDrag]);
|
|
407
484
|
const onSideGripKey = useCallback((e: React.KeyboardEvent) => {
|
|
408
485
|
if (e.altKey || e.metaKey || e.ctrlKey) return; // Back / Forward belong to the browser
|
|
409
486
|
const step = e.shiftKey ? 64 : 16;
|
|
410
|
-
|
|
411
|
-
|
|
487
|
+
// The arrow that points AWAY from the page widens the panel: left for the side panel, right for the left one.
|
|
488
|
+
const wider = dock.presentation === "left" ? "ArrowRight" : "ArrowLeft";
|
|
489
|
+
const narrower = dock.presentation === "left" ? "ArrowLeft" : "ArrowRight";
|
|
490
|
+
if (e.key === wider) { e.preventDefault(); dock.setSideWidth(dock.sideWidth + step); }
|
|
491
|
+
else if (e.key === narrower) { e.preventDefault(); dock.setSideWidth(dock.sideWidth - step); }
|
|
412
492
|
else if (e.key === "Home") { e.preventDefault(); dock.setSideWidth(SIDE_MIN_WIDTH); }
|
|
413
493
|
else if (e.key === "End") { e.preventDefault(); dock.setSideWidth(Number.MAX_SAFE_INTEGER); }
|
|
414
494
|
}, [dock]);
|
|
415
495
|
// 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]);
|
|
496
|
+
useEffect(() => { if (dock.presentation !== "side" && dock.presentation !== "left" && sideDragRef.current) endSideDrag(); }, [dock.presentation, endSideDrag]);
|
|
417
497
|
|
|
418
498
|
// A drag handle nobody can reach with a keyboard is a control only half the sellers have.
|
|
419
499
|
const onHandleKey = useCallback((e: React.KeyboardEvent) => {
|
|
@@ -428,27 +508,63 @@ export function AssistantHost({
|
|
|
428
508
|
else if (e.key === "End") { e.preventDefault(); dock.setDockHeight(DOCK_MIN_HEIGHT); }
|
|
429
509
|
}, [dock, slideBounds]);
|
|
430
510
|
|
|
511
|
+
// 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"):
|
|
512
|
+
// under a mouse from 768px the popup is a window, dragged anywhere, resized from its edges, docked by a drag to an edge
|
|
513
|
+
// (window-host.tsx). Under a finger or on a phone it stays the popup below (`windowed` false).
|
|
514
|
+
const windowed = useWindowMode();
|
|
515
|
+
const win = useDockWindow(dock, windowed && dock.mounted && dock.presentation === "dock", L, setDragging);
|
|
516
|
+
|
|
431
517
|
if (!dock.mounted) return null;
|
|
432
518
|
|
|
433
519
|
const mode = dock.presentation;
|
|
434
520
|
const isDock = mode === "dock";
|
|
435
521
|
const isSide = mode === "side";
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
const
|
|
522
|
+
const isLeft = mode === "left";
|
|
523
|
+
/** The working shapes over a screen share the header, the tabs and the body. */
|
|
524
|
+
const isPanel = isDock || isSide || isLeft;
|
|
525
|
+
const maxSideWidth = clampSideWidth(Number.MAX_SAFE_INTEGER, sideAvailable(isLeft));
|
|
439
526
|
// Announced on the grip. Read at render (not in the key handler) so assistive tech is told the
|
|
440
527
|
// real ceiling for this window, which changes when the window does.
|
|
441
528
|
const maxDockHeight = clampDockHeight(Number.MAX_SAFE_INTEGER, typeof window === "undefined" ? 900 : window.innerHeight);
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
529
|
+
// A failed run outranks a question waiting (a failure that offers Retry is a failure first), never a run going on now.
|
|
530
|
+
const failedNow = failed && !dock.busy;
|
|
531
|
+
const statusText = dock.busy ? L.working : failedNow ? L.failed : waiting ? L.waiting : dock.unread ? L.done : L.ready;
|
|
532
|
+
// The header dot: a run going on, then a failure, then a question waiting. Classes in assistant-places.css (12/11/2026): an inline
|
|
533
|
+
// colour until then, because assistant.css is in the frozen compatibility bundle; the places entry is not, and the plain frame
|
|
534
|
+
// (at its weight ceiling) writes one class where it wrote a style.
|
|
535
|
+
// Idle draws none (12/11/2026: a grey dot beside the title read as a stray mark), so the room goes to the title.
|
|
536
|
+
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"
|
|
537
|
+
: dock.unread ? "gb-dock-dot gb-dock-dot-unread" : null;
|
|
538
|
+
// The chat button (folded): its dot, and its name says what the dot says.
|
|
539
|
+
const knobDot = dock.busy ? KNOB_DOT.busy : failedNow ? KNOB_DOT.failed : waiting ? KNOB_DOT.waiting : dock.unread ? KNOB_DOT.unread : null;
|
|
540
|
+
// The run's clock is in the tooltip only: in the accessible name it changed the name every second (review of #7303).
|
|
541
|
+
const knobSays = dock.busy ? L.working : failedNow ? L.failed : waiting ? L.waiting : dock.unread ? L.answerWaiting : miniHint ?? "";
|
|
542
|
+
const knobName = L.reopen.replace("{title}", title) + (knobSays ? `: ${knobSays}` : "");
|
|
543
|
+
const knobTitle = dock.busy && runStartedAt ? `${knobName} · ${elapsed(runStartedAt)}` : knobName;
|
|
446
544
|
// The surface's rows of the ⋯ menu, in the panel's header and in full screen's chrome alike.
|
|
447
545
|
const clearRow = onClearHistory ? (
|
|
448
546
|
<AssistantMenuItem danger disabled={!canClearHistory} onClick={onClearHistory}>{L.clearHistory}</AssistantMenuItem>
|
|
449
547
|
) : null;
|
|
450
548
|
const surfaceRows = menuItems || clearRow ? <>{menuItems}{clearRow}</> : null;
|
|
451
|
-
const shrinkLabel = dock.sideAllowed && dock.floatShape === "side" ? L.backToSide
|
|
549
|
+
const shrinkLabel = dock.sideAllowed && dock.floatShape === "side" ? L.backToSide
|
|
550
|
+
: dock.leftAllowed && dock.floatShape === "left" ? L.backToLeft : L.shrinkToPopup;
|
|
551
|
+
/**
|
|
552
|
+
* 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:
|
|
553
|
+
* "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
|
|
554
|
+
* person's place checked (`menuitemradio`, `aria-checked`). A place the HOST does not offer is not drawn; one the WINDOW cannot fit
|
|
555
|
+
* (under 1100px) is off (`aria-disabled`, still focusable) and its row says why. Switching keeps the conversation: only class names
|
|
556
|
+
* change (file header).
|
|
557
|
+
*/
|
|
558
|
+
const places = [
|
|
559
|
+
// Checked = the person's PLACE (`floatShape`), not what stands in for it: on a page the left panel is not offered, "On the left"
|
|
560
|
+
// stays checked (off, saying why) and the stand-in's own place can still be chosen (review of #7303).
|
|
561
|
+
allowSide ? { cls: PLACE_CLASS.side, icon: "panelRight", label: L.placeSide, on: dock.floatShape === "side", off: !sideFits, go: dock.openSide,
|
|
562
|
+
why: L.placeNeedsWidth } as const : null,
|
|
563
|
+
allowLeft ? { cls: PLACE_CLASS.left, icon: "panelLeft", label: L.placeLeft, on: dock.floatShape === "left", off: !sideFits || !!leftOffReason,
|
|
564
|
+
go: dock.openLeft, why: sideFits && leftOffReason ? leftOffReason : L.placeNeedsWidth } as const : null,
|
|
565
|
+
{ cls: PLACE_CLASS.dock, icon: "popup", label: L.placeDock, on: dock.floatShape === "dock", off: false, go: dock.openDock, why: "" } as const,
|
|
566
|
+
{ cls: PLACE_CLASS.full, icon: "expand", label: L.placeFull, on: false, off: false, go: onExpand, why: "" } as const,
|
|
567
|
+
].filter((p) => p !== null);
|
|
452
568
|
// Full screen is the assistant's own page and has no tab strip; the second tab lives in the popup.
|
|
453
569
|
const secondVisible = isPanel && !!secondTab && view === "secondary";
|
|
454
570
|
// `overlay={open && <List />}` is the common way to write it: false, null and undefined are all "no overlay".
|
|
@@ -456,11 +572,12 @@ export function AssistantHost({
|
|
|
456
572
|
const secondBadge = secondTab?.badge || 0;
|
|
457
573
|
|
|
458
574
|
return (
|
|
575
|
+
<>
|
|
459
576
|
<div
|
|
460
577
|
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}
|
|
578
|
+
className={`gb-dock ${MODE_CLASS[mode]}${win ? win.cls : ""}${dragging ? " gb-dock-dragging" : ""}`}
|
|
579
|
+
style={win ? win.style : isDock ? { height: dock.dockHeight, right: dock.dockOffsetRight }
|
|
580
|
+
: isSide || isLeft ? ({ "--gb-dock-side-w": `${dock.sideWidth}px` } as React.CSSProperties) : undefined}
|
|
464
581
|
role={mode === "hidden" ? undefined : "region"}
|
|
465
582
|
aria-label={mode === "hidden" ? undefined : title}
|
|
466
583
|
>
|
|
@@ -489,32 +606,16 @@ export function AssistantHost({
|
|
|
489
606
|
) : null}
|
|
490
607
|
|
|
491
608
|
{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>
|
|
609
|
+
// 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
|
|
610
|
+
// button in the bottom-right corner, the admin's chat corner's look, whatever shape it folded from; a press reopens that shape.
|
|
611
|
+
// Its dot says what the bar's words said (Gem working, a question waiting, a failure, an answer waiting); its name says it too.
|
|
612
|
+
<button type="button" className="gb-dock-knob" onClick={() => { if (onButtonPress?.() !== true) dock.reopen(); }} aria-label={knobName} title={knobTitle}>
|
|
613
|
+
<Icon name="chat" size={22} />
|
|
614
|
+
{knobDot ? <span className={knobDot} aria-hidden /> : null}
|
|
615
|
+
</button>
|
|
515
616
|
) : null}
|
|
516
617
|
|
|
517
|
-
{isSide ? (
|
|
618
|
+
{isSide || isLeft ? (
|
|
518
619
|
<div
|
|
519
620
|
className="ui-resizer gb-dock-sidegrip"
|
|
520
621
|
role="separator"
|
|
@@ -535,7 +636,7 @@ export function AssistantHost({
|
|
|
535
636
|
|
|
536
637
|
{isPanel ? (
|
|
537
638
|
<>
|
|
538
|
-
{isDock ? <div
|
|
639
|
+
{isDock && !win ? <div
|
|
539
640
|
className="gb-dock-grip"
|
|
540
641
|
role="separator"
|
|
541
642
|
aria-orientation="horizontal"
|
|
@@ -552,22 +653,26 @@ export function AssistantHost({
|
|
|
552
653
|
>
|
|
553
654
|
<span aria-hidden />
|
|
554
655
|
</div> : null}
|
|
656
|
+
{win ? win.handles : null}
|
|
555
657
|
<header
|
|
556
658
|
className="gb-dock-header"
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
659
|
+
{...(win ? win.header : {
|
|
660
|
+
onPointerDown: isDock ? onHeaderDown : undefined,
|
|
661
|
+
onPointerMove: isDock ? onHeaderMove : undefined,
|
|
662
|
+
onPointerUp: isDock ? onHeaderUp : undefined,
|
|
663
|
+
onPointerCancel: isDock ? onHeaderUp : undefined,
|
|
664
|
+
title: isDock ? L.headerTitle : undefined,
|
|
665
|
+
})}
|
|
562
666
|
>
|
|
563
|
-
|
|
667
|
+
{win ? win.grip : null}
|
|
668
|
+
{dotClass ? <span className={dotClass} aria-hidden /> : null}
|
|
564
669
|
{heading ?? <span className="gb-dock-title">{title}</span>}
|
|
565
670
|
<span className="gb-dock-status">{statusText}</span>
|
|
566
671
|
<div className="gb-dock-actions">
|
|
567
672
|
{onNewChat ? (
|
|
568
673
|
<button
|
|
569
674
|
type="button"
|
|
570
|
-
className="gb-dock-icon
|
|
675
|
+
className="gb-dock-icon"
|
|
571
676
|
title={L.newChat}
|
|
572
677
|
onClick={onNewChat}
|
|
573
678
|
>
|
|
@@ -575,29 +680,28 @@ export function AssistantHost({
|
|
|
575
680
|
<span className="gb-dock-sr">{L.newChat}</span>
|
|
576
681
|
</button>
|
|
577
682
|
) : null}
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
683
|
+
{/* ⋯ (0.31.0): where it sits first (12/11/2026: the header's four place buttons came here), then the surface's rows and
|
|
684
|
+
Clear history. No "Fold into the chat button" row: × does that (Chris 12/11: "nó là 1"). A menu: ↓ ↑ Home End move,
|
|
685
|
+
Enter presses, Escape closes onto ⋯.
|
|
686
|
+
Off is `aria-disabled`, never `disabled` (the kit's rule): it keeps its focus, and its row says why. */}
|
|
687
|
+
<HostMenu label={L.more} menu>
|
|
688
|
+
<div className="gb-dock-menu-group" role="group" aria-label={L.places}>
|
|
689
|
+
{places.map((p) => (
|
|
690
|
+
<button key={p.label} type="button" role="menuitemradio" className={p.cls} aria-checked={p.on} aria-disabled={p.off || undefined}
|
|
691
|
+
onClick={p.off ? undefined : (e) => {
|
|
692
|
+
const menu = e.currentTarget.closest("details");
|
|
693
|
+
menu?.removeAttribute("open");
|
|
694
|
+
menu?.querySelector("summary")?.focus();
|
|
695
|
+
if (!p.on) p.go();
|
|
696
|
+
}}>
|
|
697
|
+
<span className="ui-menu__icon" aria-hidden="true"><Icon name={p.icon} size={16} /></span>
|
|
698
|
+
<span className="gb-dock-place-name">{p.label}{p.off ? <span className="gb-dock-place-why">{p.why}</span> : null}</span>
|
|
699
|
+
{p.on ? <Icon name="check" size={16} /> : null}
|
|
700
|
+
</button>
|
|
701
|
+
))}
|
|
702
|
+
</div>
|
|
595
703
|
{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>
|
|
704
|
+
{surfaceRows}
|
|
601
705
|
</HostMenu>
|
|
602
706
|
<button
|
|
603
707
|
type="button"
|
|
@@ -654,5 +758,8 @@ export function AssistantHost({
|
|
|
654
758
|
{overlayVisible ? <div className="gb-dock-pane">{overlay}</div> : null}
|
|
655
759
|
</div>
|
|
656
760
|
</div>
|
|
761
|
+
{/* The window's drop zones while it is dragged: after the frame, never in it (window-host.tsx). */}
|
|
762
|
+
{win ? win.overlay : null}
|
|
763
|
+
</>
|
|
657
764
|
);
|
|
658
765
|
}
|
package/src/assistant/index.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
// The assistant's frame: popup, status bar, full screen — and the rules for when each shows.
|
|
2
2
|
// A separate entry from the shell/auth barrel so a surface that never opens an assistant pays nothing for it.
|
|
3
3
|
export { AssistantHost, AssistantMenuItem, type AssistantHostLabels, type AssistantSecondTab } from "./host";
|
|
4
|
-
export { AssistantProvider, SIDE_WIDTH_VAR, useAssistant, useAssistantPageFacts, type AssistantDockApi, type AssistantOptions } from "./provider";
|
|
4
|
+
export { AssistantProvider, LEFT_WIDTH_VAR, SIDE_WIDTH_VAR, useAssistant, useAssistantPageFacts, useAssistantPresentation, type AssistantDockApi, type AssistantOptions } from "./provider";
|
|
5
5
|
export * from "./dock";
|
|
6
|
-
|
|
6
|
+
// The floating window's geometry (12/11/2026): fitted, moved, resized, docked. Its own module, which only the window's chrome loads.
|
|
7
|
+
export * from "./window";
|
|
8
|
+
export { AssistantWorkspaceLayout, OpenChatTabs, SessionRail, SESSION_RAIL_EN, SESSION_RAIL_SIZE, SESSION_RAIL_WIDTH_KEY, groupSessions, normalizeForSearch, relativeTime, type AssistantSession, type SessionGroup, type SessionRailIcons, type SessionRailLabels } from "./sessions";
|
|
7
9
|
export { BRIDGE_TONE, BridgeNotice, ENGINE_PICKER_EN, EnginePicker, bridgeStateWords, bridgeSuffix, engineChipName, engineMarkOf, useEnginePicker, type BridgeSetup, type BridgeState, type BridgeStatus, type Choice, type EngineChoice, type EnginePickerLabels, type EnginePickerProps, type EnginePickerTab } from "./engine";
|
|
8
10
|
// The engine in the surface's Settings ("AI & engines", 0.52.0; the only place since 0.53.0): the chip opens it
|
|
9
11
|
// (`onOpenSettings`), the section draws it.
|