@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
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The floating window's chrome for AssistantHost (12/11/2026, canvas board GemDockModes 4, 7, 8): the ⋮⋮ that moves it, the edges and
|
|
5
|
+
* corners that resize it, and the zone that shows where it docks while it is dragged to an edge. The geometry is dock.ts's ("The floating window"); this is
|
|
6
|
+
* the pointer and the keys. Under a finger or below 768px it is off (`useWindowMode`) and the host draws the popup it always drew.
|
|
7
|
+
*
|
|
8
|
+
* What a drag changes is drawn from this hook's own state (`live`) and handed to the provider once, on release: the provider is a
|
|
9
|
+
* context every screen sits under, and sixty dispatches a second would draw all of them again. A release in a zone docks the window
|
|
10
|
+
* into that panel and keeps its place as it was before the drag, so "Floating window" reopens it there.
|
|
11
|
+
*/
|
|
12
|
+
// Its own stylesheet, after assistant-places.css (host.tsx imports that one first, then this module): its classes are drawn here.
|
|
13
|
+
import "../assistant-window.css";
|
|
14
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState, type ReactNode } from "react";
|
|
15
|
+
|
|
16
|
+
import { Icon } from "../icons";
|
|
17
|
+
import type { AssistantDockApi } from "./provider";
|
|
18
|
+
import {
|
|
19
|
+
WINDOW_OFF_QUERY, dockViewport, dropZoneAt, formatWindow, moveWindow, parseWindow, placeWindow, resizeWindow,
|
|
20
|
+
type DockWindowEdge, type DockWindowRect, type DockWindowZone,
|
|
21
|
+
} from "./window";
|
|
22
|
+
|
|
23
|
+
/** The words the window's chrome says (AssistantHostLabels carries them). */
|
|
24
|
+
export interface DockWindowLabels {
|
|
25
|
+
windowMove: string; windowResize: string; windowHeaderTitle: string; dropLeft: string; dropSide: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** One literal class per edge, zone and hint (the admin's orphan gate reads class names as written; host.tsx says why). */
|
|
29
|
+
const EDGE_CLASS = {
|
|
30
|
+
n: "gb-dock-rs gb-dock-rs-n", s: "gb-dock-rs gb-dock-rs-s", e: "gb-dock-rs gb-dock-rs-e", w: "gb-dock-rs gb-dock-rs-w",
|
|
31
|
+
ne: "gb-dock-rs gb-dock-rs-ne", nw: "gb-dock-rs gb-dock-rs-nw", sw: "gb-dock-rs gb-dock-rs-sw",
|
|
32
|
+
} as const;
|
|
33
|
+
const ZONE_CLASS = { left: "gb-dock-drop gb-dock-drop-left", side: "gb-dock-drop gb-dock-drop-side" } as const;
|
|
34
|
+
const HINT_CLASS = { left: "gb-dock-edgehint gb-dock-edgehint-left", side: "gb-dock-edgehint gb-dock-edgehint-side" } as const;
|
|
35
|
+
/** The bottom-right corner is a button too: the one a keyboard resizes with. The other seven are for a mouse. */
|
|
36
|
+
const POINTER_EDGES = ["n", "s", "e", "w", "ne", "nw", "sw"] as const;
|
|
37
|
+
|
|
38
|
+
/** Arrow keys move and resize by this much, Shift by four times it (the left panel's seam steps the same: host.tsx). */
|
|
39
|
+
const STEP = 16;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Whether a media query matches, kept current. `server`: the answer where there is no window or no matchMedia. The host's three
|
|
43
|
+
* questions of the window (the compact chrome, a panel that fits, a window under a mouse) ask it here, once (/code-review of #7320:
|
|
44
|
+
* three copies of this hook).
|
|
45
|
+
*/
|
|
46
|
+
export function useMediaQuery(query: string, server: boolean): boolean {
|
|
47
|
+
const [hit, setHit] = useState(() => typeof window === "undefined" || !window.matchMedia ? server : window.matchMedia(query).matches);
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
if (typeof window === "undefined" || !window.matchMedia) return;
|
|
50
|
+
const mq = window.matchMedia(query);
|
|
51
|
+
const on = () => setHit(mq.matches);
|
|
52
|
+
on();
|
|
53
|
+
// Safari < 14 has only the old listener API on MediaQueryList.
|
|
54
|
+
if (mq.addEventListener) mq.addEventListener("change", on);
|
|
55
|
+
else mq.addListener(on);
|
|
56
|
+
return () => { if (mq.removeEventListener) mq.removeEventListener("change", on); else mq.removeListener(on); };
|
|
57
|
+
}, [query]);
|
|
58
|
+
return hit;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** A mouse, from 768px: the popup is a window. The server draws no host at all (not mounted), so its answer is never drawn. */
|
|
62
|
+
export function useWindowMode(): boolean {
|
|
63
|
+
return !useMediaQuery(WINDOW_OFF_QUERY, true);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** Where the page starts: the rail's right edge. Over the rail is the left panel's zone (dock.ts dropZoneAt). */
|
|
67
|
+
function contentLeft(): number {
|
|
68
|
+
return Math.max(0, Math.round(document.querySelector(".gemboss-platform-main")?.getBoundingClientRect().left ?? 0));
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// `vw`/`vh`: the viewport read once at the press, not on every move (each read there forced a layout; /code-review of #7320).
|
|
72
|
+
type Drag = { kind: "move" | "resize"; edge: DockWindowEdge; id: number; px: number; py: number; start: DockWindowRect; moved: boolean; left: number;
|
|
73
|
+
vw: number; vh: number };
|
|
74
|
+
|
|
75
|
+
export function useDockWindow(dock: AssistantDockApi, on: boolean, L: DockWindowLabels, setDragging: (v: boolean) => void) {
|
|
76
|
+
const drag = useRef<Drag | null>(null);
|
|
77
|
+
const [live, setLive] = useState<DockWindowRect | null>(null);
|
|
78
|
+
const [zone, setZone] = useState<DockWindowZone>(null);
|
|
79
|
+
const [moving, setMoving] = useState<{ left: number } | null>(null);
|
|
80
|
+
// The place asked for, kept here and as `<prefix>.window`, and fitted to the viewport here, where it is drawn: the provider keeps
|
|
81
|
+
// nothing of the window, so every screen's first load carries none of it (#7320).
|
|
82
|
+
const storeKey = `${dock.storagePrefix}.window`;
|
|
83
|
+
const [asked, setAsked] = useState<DockWindowRect | null>(() => {
|
|
84
|
+
try { return parseWindow(window.localStorage.getItem(storeKey)); } catch { return null; } // private mode: the first place
|
|
85
|
+
});
|
|
86
|
+
const setWindow = useCallback((r: DockWindowRect) => {
|
|
87
|
+
const a = { x: Math.round(r.x), y: Math.round(r.y), w: Math.round(r.w), h: Math.round(r.h) };
|
|
88
|
+
setAsked(a);
|
|
89
|
+
try { window.localStorage.setItem(storeKey, formatWindow(a)); } catch { /* best-effort */ }
|
|
90
|
+
}, [storeKey]);
|
|
91
|
+
// The viewport is read when the window comes up and on a resize, not on every render (a drag renders on each pointermove:
|
|
92
|
+
// /code-review of #7320); a resize re-fits it, and a larger window gives the place back.
|
|
93
|
+
const [vp, setVp] = useState(() => (typeof window === "undefined" ? { vw: 1440, vh: 900 } : dockViewport()));
|
|
94
|
+
useEffect(() => {
|
|
95
|
+
if (!on) return undefined;
|
|
96
|
+
const read = () => setVp(dockViewport());
|
|
97
|
+
read();
|
|
98
|
+
window.addEventListener("resize", read);
|
|
99
|
+
return () => window.removeEventListener("resize", read);
|
|
100
|
+
}, [on]);
|
|
101
|
+
const rect = live ?? placeWindow(asked, vp.vw, vp.vh);
|
|
102
|
+
const rectRef = useRef(rect);
|
|
103
|
+
rectRef.current = rect;
|
|
104
|
+
|
|
105
|
+
const end = useCallback((el?: Element | null, id?: number) => {
|
|
106
|
+
drag.current = null;
|
|
107
|
+
setLive(null); setZone(null); setMoving(null); setDragging(false);
|
|
108
|
+
if (el && id !== undefined) { try { el.releasePointerCapture(id); } catch { /* already released */ } }
|
|
109
|
+
}, [setDragging]);
|
|
110
|
+
// A drag still running when the window goes away (a key folded it, the person picked another place) leaves nothing behind.
|
|
111
|
+
useEffect(() => { if (!on && drag.current) end(); }, [on, end]);
|
|
112
|
+
|
|
113
|
+
const begin = useCallback((e: React.PointerEvent<HTMLElement>, kind: Drag["kind"], edge: DockWindowEdge) => {
|
|
114
|
+
if (e.button !== 0 || (e.pointerType === "mouse" && e.ctrlKey)) return false;
|
|
115
|
+
e.currentTarget.setPointerCapture(e.pointerId);
|
|
116
|
+
drag.current = { kind, edge, id: e.pointerId, px: e.clientX, py: e.clientY, start: rectRef.current, moved: false, left: contentLeft(), ...dockViewport() };
|
|
117
|
+
return true;
|
|
118
|
+
}, []);
|
|
119
|
+
const onMove = useCallback((e: React.PointerEvent<HTMLElement>) => {
|
|
120
|
+
const d = drag.current;
|
|
121
|
+
if (!d || e.pointerId !== d.id) return;
|
|
122
|
+
// A lost release (a context menu took it) leaves a mouse with no button down: the drag ends where it is, nothing docks.
|
|
123
|
+
if (e.pointerType === "mouse" && e.buttons === 0) { end(e.currentTarget, e.pointerId); return; }
|
|
124
|
+
const dx = e.clientX - d.px, dy = e.clientY - d.py;
|
|
125
|
+
// A few pixels of slop, so a press on the header that wobbles is still a press.
|
|
126
|
+
if (!d.moved && Math.abs(dx) < 4 && Math.abs(dy) < 4) return;
|
|
127
|
+
if (!d.moved) { d.moved = true; setDragging(true); if (d.kind === "move") setMoving({ left: d.left }); }
|
|
128
|
+
const { vw: w, vh: h } = d;
|
|
129
|
+
if (d.kind === "move") {
|
|
130
|
+
setLive(moveWindow(d.start, dx, dy, w, h));
|
|
131
|
+
setZone(dropZoneAt(e.clientX, w, d.left, dock.leftAllowed, dock.sideAllowed));
|
|
132
|
+
} else setLive(resizeWindow(d.start, d.edge, dx, dy, w, h));
|
|
133
|
+
}, [dock.leftAllowed, dock.sideAllowed, end, setDragging]);
|
|
134
|
+
const onUp = useCallback((e: React.PointerEvent<HTMLElement>) => {
|
|
135
|
+
const d = drag.current;
|
|
136
|
+
if (!d || e.pointerId !== d.id) return;
|
|
137
|
+
const { vw: w, vh: h } = d;
|
|
138
|
+
const dx = e.clientX - d.px, dy = e.clientY - d.py;
|
|
139
|
+
const docked = d.moved && d.kind === "move" ? dropZoneAt(e.clientX, w, d.left, dock.leftAllowed, dock.sideAllowed) : null;
|
|
140
|
+
const next = !d.moved ? null : d.kind === "move" ? moveWindow(d.start, dx, dy, w, h) : resizeWindow(d.start, d.edge, dx, dy, w, h);
|
|
141
|
+
end(e.currentTarget, e.pointerId);
|
|
142
|
+
// Docked: the panel, and the window keeps the place it had before this drag. Else the window stays where it was let go.
|
|
143
|
+
if (docked === "left") dock.openLeft();
|
|
144
|
+
else if (docked === "side") dock.openSide();
|
|
145
|
+
else if (next) setWindow(next);
|
|
146
|
+
}, [dock, end, setWindow]);
|
|
147
|
+
const onCancel = useCallback((e: React.PointerEvent<HTMLElement>) => {
|
|
148
|
+
if (drag.current && e.pointerId === drag.current.id) end(e.currentTarget, e.pointerId);
|
|
149
|
+
}, [end]);
|
|
150
|
+
|
|
151
|
+
// The header: its bare strip and the ⋮⋮ move the window; its other buttons and the ⋯ menu (a <details>) keep their clicks.
|
|
152
|
+
const onHeaderDown = useCallback((e: React.PointerEvent<HTMLElement>) => {
|
|
153
|
+
if ((e.target as HTMLElement).closest("button:not(.gb-dock-move), details, a, input, textarea, select")) return;
|
|
154
|
+
if (begin(e, "move", "se")) e.preventDefault(); // as the edges: no text selected along the drag (/code-review of #7320)
|
|
155
|
+
}, [begin]);
|
|
156
|
+
const onEdgeDown = useCallback((e: React.PointerEvent<HTMLElement>) => {
|
|
157
|
+
const edge = (e.currentTarget.dataset.edge ?? "se") as DockWindowEdge;
|
|
158
|
+
if (begin(e, "resize", edge)) e.preventDefault(); // no text selection under the pointer, no focus moved from the chat
|
|
159
|
+
}, [begin]);
|
|
160
|
+
|
|
161
|
+
// Keys: the ⋮⋮ moves the window, the corner resizes it from its bottom-right. Both stay inside the viewport (dock.ts). One handler
|
|
162
|
+
// for both, given what an arrow does to the window (the plain file's `keys` is the same).
|
|
163
|
+
const arrows = useCallback((apply: (r: DockWindowRect, dx: number, dy: number, vw: number, vh: number) => DockWindowRect) => (e: React.KeyboardEvent) => {
|
|
164
|
+
if (e.altKey || e.metaKey || e.ctrlKey) return; // Back / Forward belong to the browser
|
|
165
|
+
const s = e.shiftKey ? STEP * 4 : STEP;
|
|
166
|
+
const d = ({ ArrowLeft: [-s, 0], ArrowRight: [s, 0], ArrowUp: [0, -s], ArrowDown: [0, s] } as Record<string, [number, number]>)[e.key];
|
|
167
|
+
if (!d) return;
|
|
168
|
+
e.preventDefault();
|
|
169
|
+
const { vw: w, vh: h } = dockViewport();
|
|
170
|
+
setWindow(apply(rectRef.current, d[0], d[1], w, h));
|
|
171
|
+
}, [setWindow]);
|
|
172
|
+
const onMoveKey = useMemo(() => arrows(moveWindow), [arrows]);
|
|
173
|
+
const onResizeKey = useMemo(() => arrows((r, dx, dy, w, h) => resizeWindow(r, "se", dx, dy, w, h)), [arrows]);
|
|
174
|
+
|
|
175
|
+
if (!on) return null;
|
|
176
|
+
|
|
177
|
+
const pointer = { onPointerMove: onMove, onPointerUp: onUp, onPointerCancel: onCancel,
|
|
178
|
+
onLostPointerCapture: () => { if (drag.current) end(); } };
|
|
179
|
+
const grip: ReactNode = (
|
|
180
|
+
<button type="button" className="gb-dock-move" aria-label={L.windowMove} title={L.windowMove} onKeyDown={onMoveKey}>
|
|
181
|
+
<Icon name="grip" size={16} />
|
|
182
|
+
</button>
|
|
183
|
+
);
|
|
184
|
+
const handles: ReactNode = (
|
|
185
|
+
<>
|
|
186
|
+
{POINTER_EDGES.map((edge) => (
|
|
187
|
+
<div key={edge} className={EDGE_CLASS[edge]} data-edge={edge} aria-hidden onPointerDown={onEdgeDown} {...pointer} />
|
|
188
|
+
))}
|
|
189
|
+
<button type="button" className="gb-dock-rs gb-dock-rs-se" data-edge="se" aria-label={L.windowResize} title={L.windowResize}
|
|
190
|
+
onPointerDown={onEdgeDown} onKeyDown={onResizeKey} {...pointer} />
|
|
191
|
+
</>
|
|
192
|
+
);
|
|
193
|
+
// While it moves: a thin band at each edge it could dock to, and the panel's place lit when the pointer is in that zone. Drawn
|
|
194
|
+
// OUTSIDE the window (the host puts it after the frame): the window's blur makes it the containing block of fixed children.
|
|
195
|
+
const overlay: ReactNode = moving ? (
|
|
196
|
+
<>
|
|
197
|
+
{dock.leftAllowed && zone !== "left" ? <div className={HINT_CLASS.left} style={{ left: moving.left }} aria-hidden /> : null}
|
|
198
|
+
{dock.sideAllowed && zone !== "side" ? <div className={HINT_CLASS.side} aria-hidden /> : null}
|
|
199
|
+
{zone ? (
|
|
200
|
+
<div className={ZONE_CLASS[zone]} style={zone === "left" ? { left: moving.left, width: dock.sideWidth } : { width: dock.sideWidth }} aria-hidden>
|
|
201
|
+
<span>{zone === "left" ? L.dropLeft : L.dropSide}</span>
|
|
202
|
+
</div>
|
|
203
|
+
) : null}
|
|
204
|
+
</>
|
|
205
|
+
) : null;
|
|
206
|
+
|
|
207
|
+
return {
|
|
208
|
+
/** The window's classes on the frame: what it is, and whether it is being moved (not resized) right now. */
|
|
209
|
+
cls: moving ? " gb-dock-window gb-dock-moving" : " gb-dock-window",
|
|
210
|
+
/** Inline geometry: React's style prop (CSSOM), never a style attribute written as text (the surfaces' CSP). */
|
|
211
|
+
style: { left: rect.x, top: rect.y, width: rect.w, height: rect.h } as React.CSSProperties,
|
|
212
|
+
header: { onPointerDown: onHeaderDown, ...pointer, title: L.windowHeaderTitle },
|
|
213
|
+
grip, handles, overlay,
|
|
214
|
+
};
|
|
215
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The floating window's geometry: where it first opens, how far it may go, a drag, a resize, the zone a drag docks into. Loaded only
|
|
3
|
+
* by the window's chrome (window-host.tsx, which the admin's dock host brings in a chunk of its own), the plain window file's copy and
|
|
4
|
+
* the tests. The window's place is the chrome's too (kept, read and written as `<prefix>.window`): nothing of the window is in the
|
|
5
|
+
* provider or dock.ts, which every admin screen loads (#7320: there it put the dashboard 0.8 KB brotli over its first-load budget).
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/** Where the floating window stands and how big it is, in viewport px (x, y: its top-left corner). */
|
|
9
|
+
export interface DockWindowRect { x: number; y: number; w: number; h: number }
|
|
10
|
+
/**
|
|
11
|
+
* The floating window's geometry (12/11/2026, canvas board GemDockModes, screens 4, 7 and 8). Pure, so its rules are tested without a
|
|
12
|
+
* browser and the plain frame (assistant-window-plain.js) can be held to it.
|
|
13
|
+
*
|
|
14
|
+
* Chris 12/11: "ở dạng floating thì nó thực sự là floating popup có thể move khắp màn hình như cái window". Under a mouse from 768px
|
|
15
|
+
* the popup (`dock`) is a window: dragged by its header anywhere in the viewport, resized from its edges and corners, docked into a
|
|
16
|
+
* panel when it is dragged to an edge. Under a finger or on a phone it stays the popup it was (WINDOW_OFF_QUERY).
|
|
17
|
+
*
|
|
18
|
+
* - Where it first opens: where the popup opened, 460 wide and 12px under the top bar (Chris 04/10/2026, "gần hết màn": as tall as
|
|
19
|
+
* the window allows), now 24px in from the right AND the bottom, so it reads as a window. The board's 400 × 600 outline (screen 4)
|
|
20
|
+
* is an example ("Số và tên trong màn là ví dụ"); the opening height is the rule Chris chose and dock.ts measured.
|
|
21
|
+
* - Never smaller than 360 × 480, never larger than the viewport (screen 8), and always wholly inside it, 8px from each edge: the
|
|
22
|
+
* header can always be grabbed, after a drag, a stored place from a larger screen, or a window made smaller.
|
|
23
|
+
* - Docking (screen 7): while it is dragged, the pointer over the rail (or within 32px of the left edge) is the LEFT panel's zone; within
|
|
24
|
+
* 32px of the right edge, the side panel's. Only a panel the host offers here (`leftAllowed` / `sideAllowed`); else no zone.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/** Which edge or corner a resize pulls: the compass points, `se` is the bottom-right corner. */
|
|
28
|
+
export type DockWindowEdge = "n" | "s" | "e" | "w" | "ne" | "nw" | "se" | "sw";
|
|
29
|
+
/** The panel a drag would dock into: `left` or `side` (the right panel), else none. */
|
|
30
|
+
export type DockWindowZone = "left" | "side" | null;
|
|
31
|
+
|
|
32
|
+
export const WINDOW_MIN_WIDTH = 360;
|
|
33
|
+
export const WINDOW_MIN_HEIGHT = 480;
|
|
34
|
+
/** The popup's width (assistant.css: the app's own modal width, `.ui-modal`). */
|
|
35
|
+
export const WINDOW_DEFAULT_WIDTH = 460;
|
|
36
|
+
/** Where it first opens: this far in from the right and the bottom. */
|
|
37
|
+
export const WINDOW_GAP = 24;
|
|
38
|
+
/** The closest it comes to any edge of the viewport. */
|
|
39
|
+
export const WINDOW_MARGIN = 8;
|
|
40
|
+
/** The pointer this close to an edge of the viewport is in that edge's zone. */
|
|
41
|
+
export const WINDOW_SNAP = 32;
|
|
42
|
+
/** The top bar's height plus the popup's gap under it (dock.ts DOCK_VIEWPORT_RESERVE): where the first place starts. */
|
|
43
|
+
const UNDER_TOPBAR = 68;
|
|
44
|
+
/**
|
|
45
|
+
* Where the window is NOT a window: under a finger, or a window narrower than 768px (the kit's touch tier, §9.1). There the popup is
|
|
46
|
+
* what it was before 12/11/2026 (glued to the bottom, its height from the top edge, slid sideways), and none of this applies.
|
|
47
|
+
*/
|
|
48
|
+
export const WINDOW_OFF_QUERY = "(pointer: coarse), (max-width: 47.9975em)";
|
|
49
|
+
|
|
50
|
+
const clamp = (v: number, lo: number, hi: number) => Math.min(Math.max(v, lo), Math.max(lo, hi));
|
|
51
|
+
|
|
52
|
+
/** Inside the viewport: the size between the minimum and the room there is (the room wins on a small screen), then the place. */
|
|
53
|
+
export function clampWindow(r: DockWindowRect, vw: number, vh: number): DockWindowRect {
|
|
54
|
+
const maxW = Math.max(1, vw - 2 * WINDOW_MARGIN);
|
|
55
|
+
const maxH = Math.max(1, vh - 2 * WINDOW_MARGIN);
|
|
56
|
+
const w = Math.round(Math.min(Math.max(r.w, WINDOW_MIN_WIDTH), maxW));
|
|
57
|
+
const h = Math.round(Math.min(Math.max(r.h, WINDOW_MIN_HEIGHT), maxH));
|
|
58
|
+
const x = Math.round(clamp(r.x, WINDOW_MARGIN, vw - WINDOW_MARGIN - w));
|
|
59
|
+
const y = Math.round(clamp(r.y, WINDOW_MARGIN, vh - WINDOW_MARGIN - h));
|
|
60
|
+
return { x, y, w, h };
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** The first place: 460 wide, from 12px under the top bar to 24px above the bottom, 24px in from the right. */
|
|
64
|
+
export function defaultWindow(vw: number, vh: number): DockWindowRect {
|
|
65
|
+
return clampWindow({ x: vw - WINDOW_GAP - WINDOW_DEFAULT_WIDTH, y: UNDER_TOPBAR, w: WINDOW_DEFAULT_WIDTH, h: vh - UNDER_TOPBAR - WINDOW_GAP }, vw, vh);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** Where to draw it: the place asked for, fitted to this viewport; no place asked for yet, the first place. */
|
|
69
|
+
export function placeWindow(asked: DockWindowRect | null, vw: number, vh: number): DockWindowRect {
|
|
70
|
+
return asked ? clampWindow(asked, vw, vh) : defaultWindow(vw, vh);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** Dragged by `dx`, `dy` from where the drag started; the size does not change. */
|
|
74
|
+
export function moveWindow(start: DockWindowRect, dx: number, dy: number, vw: number, vh: number): DockWindowRect {
|
|
75
|
+
return clampWindow({ ...start, x: start.x + dx, y: start.y + dy }, vw, vh);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Resized by pulling `edge` by `dx`, `dy`: the edges not pulled stay where they are, at the minimum too (pulling the left edge past
|
|
80
|
+
* the minimum stops the window, it does not push it right). The far edge stops at the viewport's margin.
|
|
81
|
+
*/
|
|
82
|
+
export function resizeWindow(start: DockWindowRect, edge: DockWindowEdge, dx: number, dy: number, vw: number, vh: number): DockWindowRect {
|
|
83
|
+
const right = start.x + start.w, bottom = start.y + start.h;
|
|
84
|
+
let { x, y, w, h } = start;
|
|
85
|
+
if (edge.includes("e")) w = clamp(start.w + dx, WINDOW_MIN_WIDTH, vw - WINDOW_MARGIN - start.x);
|
|
86
|
+
if (edge.includes("w")) { w = clamp(start.w - dx, WINDOW_MIN_WIDTH, right - WINDOW_MARGIN); x = right - w; }
|
|
87
|
+
if (edge.includes("s")) h = clamp(start.h + dy, WINDOW_MIN_HEIGHT, vh - WINDOW_MARGIN - start.y);
|
|
88
|
+
if (edge.includes("n")) { h = clamp(start.h - dy, WINDOW_MIN_HEIGHT, bottom - WINDOW_MARGIN); y = bottom - h; }
|
|
89
|
+
return clampWindow({ x, y, w, h }, vw, vh);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* The zone under the pointer while the window is dragged. `contentLeft`: where the page starts (the rail's right edge), so the
|
|
94
|
+
* pointer over the rail is the left panel's zone, the way the board draws it (screen 7). A panel the host does not offer here has
|
|
95
|
+
* no zone: released there, the window stays a window.
|
|
96
|
+
*/
|
|
97
|
+
export function dropZoneAt(px: number, vw: number, contentLeft: number, leftAllowed: boolean, sideAllowed: boolean): DockWindowZone {
|
|
98
|
+
if (leftAllowed && px <= Math.max(WINDOW_SNAP, contentLeft)) return "left";
|
|
99
|
+
if (sideAllowed && px >= vw - WINDOW_SNAP) return "side";
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** The viewport a fixed box lives in: without the scrollbars (`clientWidth`), which `innerWidth` counts (dock.ts slideBounds says
|
|
104
|
+
* how 1440 vs 1429 put the popup on the rail). The floating window is fitted to it. */
|
|
105
|
+
export function dockViewport(): { vw: number; vh: number } {
|
|
106
|
+
if (typeof window === "undefined") return { vw: 0, vh: 0 };
|
|
107
|
+
const d = document.documentElement;
|
|
108
|
+
return { vw: d.clientWidth || window.innerWidth, vh: d.clientHeight || window.innerHeight };
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/** Stored as "x,y,w,h" (`<prefix>.window`). Anything else reads as no place asked for. */
|
|
112
|
+
export function parseWindow(raw: string | null): DockWindowRect | null {
|
|
113
|
+
if (!raw) return null;
|
|
114
|
+
const n = raw.split(",").map(Number);
|
|
115
|
+
if (n.length !== 4 || !n.every(Number.isFinite) || n[2]! <= 0 || n[3]! <= 0) return null;
|
|
116
|
+
return { x: n[0]!, y: n[1]!, w: n[2]!, h: n[3]! };
|
|
117
|
+
}
|
|
118
|
+
export function formatWindow(r: DockWindowRect): string {
|
|
119
|
+
return [r.x, r.y, r.w, r.h].map((v) => Math.round(v)).join(",");
|
|
120
|
+
}
|
package/src/assistant-chat.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.gb-chat{display:flex;flex-direction:column;min-width:0;min-height:0;height:100%;background:var(--gemboss-surface, #fff)}.gemboss-assistant-layout:not(.is-dock) .gb-chat{background:transparent}.gb-chat>.gemboss-ec-scroll{flex:1 1 auto}.gb-dock:not(.gb-dock-full) .gb-chat-head{display:none}.gb-chat-head{flex:none;box-sizing:border-box;justify-content:center}.gb-chat[data-chrome]>.gb-chat-head{padding-right:var(--gb-chat-chrome-w);min-height:var(--gb-chat-chrome-h)}.gb-chat[data-chrome]:not(:has(>.gb-chat-head))>.gemboss-ec-scroll{padding-top:var(--gb-chat-chrome-h)}.gemboss-ec-starter.gb-chat-starter{white-space:normal;border-radius:12px;text-align:left;overflow-wrap:anywhere}.gb-chat-starter-hint{display:block;margin-bottom:4px;color:var(--gemboss-text-muted);font-size:var(--gemboss-fs-caption, 12px)}.gemboss-ec-starters.gb-chat-starters-cards{flex-direction:column;flex-wrap:nowrap;row-gap:8px}.gb-chat-starters-cards .gb-chat-starter{display:flex;align-items:center;gap:12px;padding:12px 16px}.gb-chat-starter-icon{flex:none;width:32px;height:32px;border-radius:var(--gemboss-radius-md, 8px);display:grid;place-items:center;background:var(--gemboss-accent-soft, #eef0fe);color:var(--gemboss-accent, #5661f5)}.gb-chat-starter-icon svg{width:20px;height:20px;fill:currentColor}.gb-chat-starter-body{display:flex;flex-direction:column;gap:2px;min-width:0}.gb-chat-starter-label{font-weight:600}.gb-chat-starter-sub{color:var(--gemboss-text-muted);font-size:var(--gemboss-fs-caption, 12px)}.gb-chat-label{margin:0;color:var(--gemboss-text-muted);font-size:var(--gemboss-fs-caption, 12px)}.gb-chat-target{color:var(--gemboss-text-muted)}.gb-chat-meta{display:flex;flex-wrap:wrap;align-items:center;gap:8px;color:var(--gemboss-text-muted);font-size:var(--gemboss-fs-caption, 12px)}.gb-chat-copy{flex:none}.gb-chat-note{margin:0;align-self:center;text-align:center;color:var(--gemboss-text-muted);font-size:var(--gemboss-fs-caption, 12px)}.gb-chat-notice{margin:0}.gb-chat-error{display:grid;gap:8px;margin:0;overflow-wrap:anywhere}.gb-chat-cmd{display:block;padding:6px 8px;border-radius:8px;background:#0000000d;color:var(--gemboss-text);font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;line-height:16px;overflow-wrap:anywhere;user-select:all}.gb-chat-original>summary{cursor:pointer;min-height:24px;display:flex;align-items:center}.gemboss-ec-input .gemboss-ec-attach-btn{flex:0 0 auto;width:28px;height:28px;border-radius:50%;padding:0;display:inline-flex;align-items:center;justify-content:center;border:0;background-color:transparent;color:var(--gemboss-text-muted);cursor:pointer}.gemboss-ec-input .gemboss-ec-attach-btn:hover:not(:disabled){background-color:var(--gemboss-hover, rgba(0, 0, 0, .05));color:var(--gemboss-text)}.gemboss-ec-input .gemboss-ec-attach-btn:focus-visible{outline:2px solid var(--ui-focus, #5661f5);outline-offset:2px}.gemboss-ec-input .gemboss-ec-attach-btn:disabled{opacity:.5;cursor:default}.gemboss-ec-input .gemboss-ec-attach-btn svg{width:16px;height:16px}@media (pointer: coarse),(max-width: 47.9975em){.gb-chat-original>summary{min-height:44px}.gemboss-ec-input .gemboss-ec-attach-btn{width:44px;height:44px}.gemboss-ec-input
|
|
1
|
+
.gb-chat{display:flex;flex-direction:column;min-width:0;min-height:0;height:100%;background:var(--gemboss-surface, #fff)}.gemboss-assistant-layout:not(.is-dock) .gb-chat{background:transparent}.gb-chat>.gemboss-ec-scroll{flex:1 1 auto}.gb-dock:not(.gb-dock-full) .gb-chat-head{display:none}.gb-chat-head{flex:none;box-sizing:border-box;justify-content:center}.gb-chat[data-chrome]>.gb-chat-head{padding-right:var(--gb-chat-chrome-w);min-height:var(--gb-chat-chrome-h)}.gb-chat[data-chrome]:not(:has(>.gb-chat-head))>.gemboss-ec-scroll{padding-top:var(--gb-chat-chrome-h)}.gemboss-ec-starter.gb-chat-starter{white-space:normal;border-radius:12px;text-align:left;overflow-wrap:anywhere}.gb-chat-starter-hint{display:block;margin-bottom:4px;color:var(--gemboss-text-muted);font-size:var(--gemboss-fs-caption, 12px)}.gemboss-ec-starters.gb-chat-starters-cards{flex-direction:column;flex-wrap:nowrap;row-gap:8px}.gb-chat-starters-cards .gb-chat-starter{display:flex;align-items:center;gap:12px;padding:12px 16px}.gb-chat-starter-icon{flex:none;width:32px;height:32px;border-radius:var(--gemboss-radius-md, 8px);display:grid;place-items:center;background:var(--gemboss-accent-soft, #eef0fe);color:var(--gemboss-accent, #5661f5)}.gb-chat-starter-icon svg{width:20px;height:20px;fill:currentColor}.gb-chat-starter-body{display:flex;flex-direction:column;gap:2px;min-width:0}.gb-chat-starter-label{font-weight:600}.gb-chat-starter-sub{color:var(--gemboss-text-muted);font-size:var(--gemboss-fs-caption, 12px)}.gb-chat-label{margin:0;color:var(--gemboss-text-muted);font-size:var(--gemboss-fs-caption, 12px)}.gb-chat-target{color:var(--gemboss-text-muted)}.gb-chat-meta{display:flex;flex-wrap:wrap;align-items:center;gap:8px;color:var(--gemboss-text-muted);font-size:var(--gemboss-fs-caption, 12px)}.gb-chat-copy{flex:none}.gb-chat-note{margin:0;align-self:center;text-align:center;color:var(--gemboss-text-muted);font-size:var(--gemboss-fs-caption, 12px)}.gb-chat-notice{margin:0}.gb-chat-error{display:grid;gap:8px;margin:0;overflow-wrap:anywhere}.gb-chat-cmd{display:block;padding:6px 8px;border-radius:8px;background:#0000000d;color:var(--gemboss-text);font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;line-height:16px;overflow-wrap:anywhere;user-select:all}.gb-chat-original>summary{cursor:pointer;min-height:24px;display:flex;align-items:center}.gemboss-ec-input .gemboss-ec-attach-btn{flex:0 0 auto;width:28px;height:28px;border-radius:50%;padding:0;display:inline-flex;align-items:center;justify-content:center;border:0;background-color:transparent;color:var(--gemboss-text-muted);cursor:pointer}@media (hover: hover){.gemboss-ec-input .gemboss-ec-attach-btn:hover:not(:disabled){background-color:var(--gemboss-hover, rgba(0, 0, 0, .05));color:var(--gemboss-text)}}.gemboss-ec-input .gemboss-ec-attach-btn:focus-visible{outline:2px solid var(--ui-focus, #5661f5);outline-offset:2px}.gemboss-ec-input .gemboss-ec-attach-btn:disabled{opacity:.5;cursor:default}.gemboss-ec-input .gemboss-ec-attach-btn svg{width:16px;height:16px}@media (pointer: coarse),(max-width: 47.9975em){.gb-chat-original>summary{min-height:44px}.gemboss-ec-input .gemboss-ec-attach-btn{min-width:44px;min-height:44px}}.gemboss-ec-input[data-rows="1"]>.gemboss-ec-toolbar{display:contents}.gemboss-ec-input[data-rows="1"]>textarea{flex:1 1 0;order:2}.gemboss-ec-input[data-rows="1"] .gemboss-ec-toolbar-lead{flex:none;order:1}.gemboss-ec-input[data-rows="1"] .gemboss-ec-toolbar>:not(.gemboss-ec-toolbar-lead){order:3}.gemboss-ec-input[data-rows="1"]>textarea~:not(.gemboss-ec-toolbar){order:4}.gemboss-ec-input[data-rows="1"]>textarea::placeholder{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}:where(.gemboss-ec-pending-star){display:inline-block;width:10px;height:10px;border-radius:50%;background:currentColor}.gemboss-narr-row.thinking .gemboss-narr-dot{margin-top:2px}@supports not (color: color-mix(in srgb,currentColor 14%,transparent)){.gemboss-ec-msg .gemboss-ec-bubble.gemboss-ec-bubble{--gemboss-ec-md-line: #80808052;--gemboss-ec-md-fill: #80808024}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.gb-chat-figures{display:grid;gap:var(--ui-space-4, 16px);margin:var(--ui-space-2, 8px) 0;padding:var(--ui-space-3, 12px);border:1px solid var(--ui-border);border-radius:12px;background:var(--ui-surface);color:var(--ui-text)}.gb-chat-figures__head{margin:0;font-size:var(--ui-fs-body, 13px);font-weight:600}.gb-chat-figure{display:grid;gap:var(--ui-space-2, 8px);margin:0;min-width:0}.gb-chat-figure__cap{display:grid;gap:2px}.gb-chat-figure__title{font-size:var(--ui-fs-body, 13px);font-weight:600}.gb-chat-figures__source{margin:0}.gb-chat-gallery{display:grid;gap:var(--ui-space-3, 12px);margin:var(--ui-space-2, 8px) 0;padding:var(--ui-space-3, 12px);border:1px solid var(--ui-border);border-radius:12px;background:var(--ui-surface);color:var(--ui-text)}.gb-chat-gallery__grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:var(--ui-space-3, 12px);margin:0;padding:0;list-style:none}.gb-chat-gallery__card{display:grid;gap:4px;align-content:start;min-width:0}.gb-chat-gallery__thumb{display:block;width:100%;aspect-ratio:4 / 5;object-fit:cover;object-position:top;border:1px solid var(--ui-border);border-radius:8px;background:var(--ui-surface-2)}.gb-chat-gallery__label{font-size:var(--ui-fs-body, 13px);font-weight:600}.gb-chat-gallery__meta{overflow-wrap:anywhere}.gb-chat-gallery__use{justify-self:start;margin-top:4px}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@media (min-width:1100px){html[data-gb-assistant-hold=left] .gemboss-platform-shell[data-rail=auto]{--gb-rail-w:56px}html[data-gb-assistant-hold=left] .gemboss-platform-shell[data-rail=auto] .icon-nav{width:56px;border-right:0;box-shadow:inset -1px 0 0 var(--gemboss-divider)}html[data-gb-assistant-hold=left] .gemboss-platform-shell[data-rail=auto] .gnav-item{position:relative;justify-content:center;gap:0;padding:6px}html[data-gb-assistant-hold=left] .gemboss-platform-shell[data-rail=auto] :is(.gnav-sub,.gnav-head){display:none}html[data-gb-assistant-hold=left] .gemboss-platform-shell[data-rail=auto] .gnav-group.has-active-child>.gnav-item.active{background:var(--gemboss-active-bg)}html[data-gb-assistant-hold=left] .gemboss-platform-shell[data-rail=auto] :is(.icon-nav .gnav-label,.icon-nav .gnav-heading){position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap}html[data-gb-assistant-hold=left] .gemboss-platform-shell[data-rail=auto] .gnav-item>:not(.gnav-ico,.gnav-label){position:absolute;top:2px;right:0;margin:0}html[data-gb-assistant-hold=left] .gemboss-platform-shell[data-rail=auto] .gnav-item>kbd{display:none}html[data-gb-assistant-hold=left] .gemboss-platform-shell[data-rail=auto] .gnav-item>.gnav-count{top:4px;right:4px;width:8px;height:8px;min-width:0;padding:0;overflow:hidden;box-shadow:0 0 0 2px var(--gemboss-nav-bg);font-size:0;line-height:0}html[data-gb-assistant-hold=left] .gemboss-platform-shell:is([data-rail=auto],[data-rail=mini]) .gemboss-platform-main{margin-left:calc(56px + var(--gb-assistant-left-w,400px))}html[data-gb-assistant-hold=left] .gemboss-platform-shell:is([data-rail=auto],[data-rail=mini]) .gemboss-platform-main:before{content:"";position:fixed;z-index:195;top:56px;bottom:0;left:56px;width:var(--gb-assistant-left-w,400px);box-sizing:border-box;background:var(--gemboss-surface);border-right:1px solid var(--gemboss-divider)}}@media (min-width:1100px) and (pointer:coarse){html[data-gb-assistant-hold=left] .gemboss-platform-shell[data-rail=auto] .icon-nav :is(.gnav-scroll,.gnav-bottom){padding-inline:6px}html[data-gb-assistant-hold=left] .gemboss-platform-shell[data-rail=auto] .gnav-item{padding:12px}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.gb-dock.gb-dock-dock{background:var(--gemboss-surface);-webkit-backdrop-filter:none;backdrop-filter:none}.gb-dock.gb-dock-left{z-index:195;top:56px;bottom:0;left:var(--gb-rail-w, 240px);right:auto;width:var(--gb-dock-side-w, 400px);background:var(--gemboss-surface);-webkit-backdrop-filter:none;backdrop-filter:none;border:0;border-right:1px solid var(--gemboss-divider);border-radius:0;box-shadow:none;overflow:visible}@starting-style{.gb-dock-left{transform:translate(-12px);opacity:0}}.gb-dock-left .gb-dock-body,.gb-dock-left .gb-dock-pane{overflow:hidden}.gb-dock-left .gb-dock-header,.gb-dock-left .gb-dock-header:active{cursor:default;touch-action:auto}.gb-dock-left .gb-dock-status{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}.gb-dock-left>.gb-dock-sidegrip{position:absolute;inset:0 -3px 0 auto;width:5px;z-index:3}@media (pointer: fine){.gb-dock:is(.gb-dock-left,.gb-dock-side)>.gb-dock-sidegrip:after{content:"";position:absolute;top:0;bottom:0;width:8px}.gb-dock.gb-dock-left>.gb-dock-sidegrip:after{left:100%}.gb-dock.gb-dock-side>.gb-dock-sidegrip:after{right:100%}}@media (min-width: 1100px){body.gemboss-assistant-left .gemboss-platform-main,body.gemboss-assistant-left .gemboss-platform-shell .gemboss-platform-main{margin-left:calc(var(--gb-rail-w, 240px) + var(--gb-assistant-left-w, 400px))}}@media (max-width: 1099.98px){.gb-dock.gb-dock-left{right:0;width:auto}.gb-dock-left>.gb-dock-sidegrip{display:none}}@media (max-width: 760px){.gb-dock.gb-dock-left{left:0;border-right:0}}.gb-dock-menu-group{display:grid}.gb-dock-menu-group>.ui-menu__item{border-radius:8px;flex-wrap:nowrap}.gb-dock-place-name{display:grid;flex:1 1 auto}.gb-dock-place-why{font-size:12px;line-height:16px;color:var(--gemboss-text-muted);white-space:nowrap}.gb-dock-place[aria-checked=true]{font-weight:600;color:var(--gemboss-text-strong)}.gb-dock-place>svg{flex:none;width:16px;height:16px}.gb-dock-menu-group>.gb-dock-place[aria-disabled=true]{opacity:1;color:var(--gemboss-text-muted);cursor:not-allowed}@media (hover: hover){.gb-dock-place[aria-disabled=true]:hover{background:transparent}}.gb-dock-header .gb-dock-actions>.gb-dock-icon,.gb-dock-header .gb-dock-actions>.gb-dock-menu>.gb-dock-icon{width:32px;height:32px}@media (pointer: coarse),(max-width: 47.9975em){.gb-dock-header .gb-dock-actions>.gb-dock-icon,.gb-dock-header .gb-dock-actions>.gb-dock-menu>.gb-dock-icon{width:44px;height:44px}}@media (max-width: 760px){.gb-dock-place-side,.gb-dock-place-left{display:none}}.gb-dock.gb-dock-mini{left:auto;right:24px;bottom:calc(24px + env(safe-area-inset-bottom,0px));width:52px;height:52px;padding:0;border:0;border-radius:50%;background:transparent;-webkit-backdrop-filter:none;backdrop-filter:none;box-shadow:none;overflow:visible}@media (max-width: 760px){.gb-dock.gb-dock-mini{right:16px;bottom:calc(16px + env(safe-area-inset-bottom,0px))}}.gb-dock-knob{position:relative;width:100%;height:100%;display:grid;place-items:center;padding:0;border:0;border-radius:50%;background:var(--gemboss-primary);color:var(--gemboss-on-primary, #fff);cursor:pointer;box-shadow:inset 0 1px #ffffff24,0 12px 28px -8px #5661f573,0 2px 24px #00000029;transition:transform .16s cubic-bezier(.33,0,0,1)}@media (hover: hover){.gb-dock-knob:hover{transform:scale(1.06)}}.gb-dock-knob:active{transform:scale(.94)}.gb-dock-knob:focus-visible{outline:3px solid var(--ui-focus, #5661f5);outline-offset:3px}.gb-dock-knob svg{width:22px;height:22px}.gb-dock-knob-dot{position:absolute;top:1px;right:1px;width:14px;height:14px;border-radius:50%;box-shadow:0 0 0 2px var(--gemboss-surface)}.gb-dock-knob-busy{background:var(--gemboss-accent-strong);animation:gb-dock-pulse 1.4s ease-in-out infinite}.gb-dock-knob-failed{background:var(--gemboss-danger)}.gb-dock-knob-waiting{background:var(--gemboss-warning)}.gb-dock-knob-unread{background:var(--gemboss-success-strong)}.gb-dock-dot-failed{background:var(--gemboss-danger)}.gb-dock-dot-waiting{background:var(--gemboss-warning)}@media (prefers-reduced-motion: reduce){.gb-dock-knob{transition:none}.gb-dock-knob-busy{animation:none}}
|
package/src/assistant-plain.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(d){"use strict";var z=d.gembossUI;if(!z){d.console&&d.console.error("@gemboss/ui assistant-plain.js: load kit-plain.js first (it defines gembossUI)");return}if(z.assistantFrame)return;var B=280,Pe=480,nt=56,it=12,Re=nt+it,be=24,G=380,ge=400,ye=720,xe=480,Oe="(min-width: 1100px)",rt="(max-width: 640px)",ke="--gb-assistant-side-w",Z=9007199254740991;function Ee(t,i){var r=isFinite(i)&&i>0?Math.max(G,Math.min(ye,i-xe)):ye;return Math.min(Math.max(Math.round(t),G),r)}function We(t,i,r){return r<i?i:Math.min(Math.max(Math.round(t),i),r)}function K(t,i){var r=Math.max(B,i-Re);return Math.min(Math.max(Math.round(t),B),r)}function $(t,i){var r=t!==null&&isFinite(t)&&t>0?t:1/0;return K(r,i)}var Fe={presentation:"hidden",mounted:!1,busy:!1,unread:!1,dockHeight:Pe,dockOffsetRight:be,openNonce:0,sideWidth:ge,floatShape:"side",sideAllowed:!1};function m(t,i){var r={},p;for(p in t)r[p]=t[p];for(p in i)r[p]=i[p];return r}function ee(t){return t.sideAllowed?t.floatShape:"dock"}function Ce(t,i){switch(i.type){case"enter-full":return m(t,{presentation:"full",mounted:!0,unread:!1,openNonce:t.openNonce+1});case"leave-full":return t.presentation!=="full"?t:m(t,{presentation:t.busy?ee(t):"mini"});case"dock":return m(t,{presentation:"dock",floatShape:"dock",mounted:!0,unread:!1,openNonce:t.openNonce+1});case"side":return t.sideAllowed?m(t,{presentation:"side",floatShape:"side",mounted:!0,unread:!1,openNonce:t.openNonce+1}):m(t,{presentation:"dock",floatShape:"dock",mounted:!0,unread:!1,openNonce:t.openNonce+1});case"reopen":return m(t,{presentation:ee(t),mounted:!0,unread:!1,openNonce:t.openNonce+1});case"side-allowed":return i.allowed===t.sideAllowed?t:i.allowed?m(t,{sideAllowed:!0,presentation:t.presentation==="dock"&&t.floatShape==="side"?"side":t.presentation}):m(t,{sideAllowed:!1,presentation:t.presentation==="side"?"dock":t.presentation});case"restore-float":return m(t,{floatShape:i.shape});case"minimize":return m(t,{presentation:"mini"});case"dismiss":return t.busy?m(t,{presentation:t.presentation==="mini"?ee(t):"mini"}):m(t,{presentation:"hidden"});case"busy":{if(i.busy===t.busy)return t;var r=t.presentation==="mini"||t.presentation==="hidden";return m(t,{busy:i.busy,unread:!i.busy&&r?!0:t.unread})}case"resize":return m(t,{dockHeight:K(i.height,i.viewport)});case"slide":return m(t,{dockOffsetRight:We(i.offsetRight,i.min,i.max)});case"side-resize":return m(t,{sideWidth:Ee(i.width,i.available)});default:return t}}z.assistantDock={reducer:Ce,initial:Fe,clampSideWidth:Ee,clampDockOffset:We,clampDockHeight:K,openingDockHeight:$,DOCK_MIN_HEIGHT:B,DOCK_DEFAULT_HEIGHT:Pe,DOCK_VIEWPORT_RESERVE:Re,DOCK_DEFAULT_OFFSET_RIGHT:be,SIDE_MIN_WIDTH:G,SIDE_DEFAULT_WIDTH:ge,SIDE_MAX_WIDTH:ye,SIDE_PAGE_MIN:xe,SIDE_FITS_QUERY:Oe};var at={ready:"Ready",working:"Working",done:"Done \u2014 tap to see it",answerWaiting:"An answer is waiting",askAboutScreen:"Ask about this screen",reopen:"Reopen the {title}",hide:"Hide the assistant",hideTitle:"Hide the assistant",openInstead:"Open the assistant",openInsteadTitle:"Still working \u2014 open it",grip:"Drag to resize the assistant; left and right arrows move it sideways",headerTitle:"Drag this bar to move the popup left or right",newChat:"New chat",openFull:"Open full screen",minimize:"Minimise",minimizeTitle:"Shrink to a bar",close:"Close the assistant",closeBusy:"Shrink to a bar",closeBusyTitle:"Still working \u2014 shrink it to a bar",shrinkToPopup:"Shrink to popup",tablist:"Assistant or a person",primaryTab:"Assistant",pinSide:"Pin to the side",floatPopup:"Float as a popup",sideGrip:"Drag to resize the assistant; left and right arrows work too",backToSide:"Back to the side panel",more:"More",clearHistory:"Clear history"},ze={hidden:"gb-dock-hidden",mini:"gb-dock-mini",dock:"gb-dock-dock",side:"gb-dock-side",full:"gb-dock-full"},we=function(t){return typeof Node<"u"&&t instanceof Node};function c(t,i,r){var p=document.createElement(t);if(i)for(var k in i){var g=i[k];g==null||g===!1||(k==="text"?p.textContent=String(g):k==="className"?p.className=g:p.setAttribute(k,g===!0?"":String(g)))}return te(p,r),p}function te(t,i){return i==null||i===!1?t:Array.isArray(i)?(i.forEach(function(r){te(t,r)}),t):(t.appendChild(we(i)?i:document.createTextNode(String(i))),t)}function L(t,i){var r=document.createElement("template");return r.innerHTML='<svg viewBox="0 0 20 20" width="'+t+'" height="'+t+'" aria-hidden="true" focusable="false"><g fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">'+i+"</g></svg>",r.content.firstChild}var I={close:'<path d="M5 5l10 10M15 5 5 15"/>',plus:'<path d="M10 4v12M4 10h12"/>',expand:'<path d="M11 9l5-5M16 4h-3.5M16 4v3.5M9 11l-5 5M4 16h3.5M4 16v-3.5"/>',shrink:'<path d="M16 4l-5 5M11 9h3.5M11 9V5.5M4 16l5-5M9 11H5.5M9 11v3.5"/>',chevronUp:'<path d="M6 12l4-4 4 4"/>',more:'<circle cx="4.5" cy="10" r="1"/><circle cx="10" cy="10" r="1"/><circle cx="15.5" cy="10" r="1"/>'},H={close:function(){return L(18,I.close)},plus:function(){return L(18,I.plus)},expand:function(){return L(18,I.expand)},shrink:function(){return L(16,I.shrink)},chevronUp:function(){return L(14,I.chevronUp)},more:function(){return L(18,I.more)}};function ot(t){var i=Math.max(0,Math.floor((Date.now()-t)/1e3)),r=i%60;return Math.floor(i/60)+":"+(r<10?"0":"")+r}function Be(t){try{return t==="session"?d.sessionStorage:d.localStorage}catch{return null}}function _(t,i){var r=Be(t);try{return r?r.getItem(i):null}catch{return null}}function A(t,i,r){var p=Be(t);try{p&&(r===null?p.removeItem(i):p.setItem(i,r))}catch{}}function U(){var t=document.querySelector(".gemboss-platform-main"),i=t?t.getBoundingClientRect().left:0;return(document.documentElement.clientWidth||d.innerWidth)-i}z.fullChromeRoom=function(t){var i=t&&t.closest?t.closest(".gb-dock"):null;if(!i||typeof d.ResizeObserver>"u")return function(){};var r=null,p=function(){t.removeAttribute("data-chrome"),t.style.removeProperty("--gb-chat-chrome-w"),t.style.removeProperty("--gb-chat-chrome-h")},k=new d.ResizeObserver(function(){g()});function g(){var C=i.querySelector(":scope > [data-gb-dock-chrome]");if(C!==r&&(r&&k.unobserve(r),C&&k.observe(C),r=C),!C||getComputedStyle(C).position!=="absolute")return p();var w=C.getBoundingClientRect(),S=t.getBoundingClientRect();if(w.left>=S.right||w.bottom<=S.top||w.right<=S.left)return p();t.style.setProperty("--gb-chat-chrome-w",Math.ceil(S.right-w.left+8)+"px"),t.style.setProperty("--gb-chat-chrome-h",Math.ceil(w.bottom-S.top+8)+"px"),t.setAttribute("data-chrome","")}g(),k.observe(t),k.observe(i);var ne=new MutationObserver(g);return ne.observe(i,{childList:!0,attributes:!0,attributeFilter:["class"]}),function(){k.disconnect(),ne.disconnect()}},z.assistantFrame=function(t){t=t||{};var i={title:t.title||"Assistant",storagePrefix:t.storagePrefix||"gemboss.assistant",bodyClassPrefix:t.bodyClassPrefix||"gemboss-assistant",dockedEvent:t.dockedEvent||"gemboss:assistant-docked",allowSide:t.allowSide!==!1,keepAcrossPages:t.keepAcrossPages!==!1,fullHref:t.fullHref||"",miniHint:t.miniHint||"",canClearHistory:t.canClearHistory!==!1},r=m(at,t.labels||{}),p=function(){try{return i.fullHref?new URL(i.fullHref,d.location.href).pathname:""}catch{return""}},k=t.isFullLink||function(e){return!!p()&&e.pathname===p()},g=t.isOnFullPage||function(){return!!p()&&d.location.pathname===p()},ne=t.onExpand||function(){i.fullHref&&(d.location.href=i.fullHref)},C=t.onShrink||function(){A("session",y("presentation"),ee(a));var e=document.referrer,n=!1;try{n=!!e&&new URL(e).origin===d.location.origin&&new URL(e).pathname!==d.location.pathname}catch{n=!1}n?d.history.back():h({type:"reopen"})},w=t.onNewChat||null,S=t.onClearHistory||null,Se=t.menuItems||null,ie=t.fullActions||null,X=d.matchMedia?d.matchMedia(rt):null,y=function(e){return i.storagePrefix+"."+e},a=Fe,re=[],ae=[],T=function(e,n,l,s){e.addEventListener(n,l,s),ae.push(function(){e.removeEventListener(n,l,s)})},oe=null,Ne=be,se=ge,le=null,Ge=!1,M=0,f=c("div",{className:"gb-dock "+ze.hidden}),de=c("div",{className:"gb-dock-body"}),ce=c("div",{className:"gb-dock-pane",id:"gem-dock-pane-assistant"}),q=t.rail?we(t.rail)?t.rail:t.rail.el:null,N=null,Y=null,Ke=!1;q?(N=c("div",{className:"gemboss-assistant-layout is-dock"}),Y=c("div",{className:"gemboss-assistant-page"}),t.body&&Y.appendChild(t.body),N.appendChild(Y),ce.appendChild(N)):t.body&&ce.appendChild(t.body),de.appendChild(ce),f.appendChild(de);var o={},Ae="";function Ue(){var e=document.querySelector(".gemboss-platform-main"),n=e?e.getBoundingClientRect().width:document.documentElement.clientWidth||d.innerWidth,l=Math.min(460,Math.max(0,n-48));return{min:8,max:Math.max(8,Math.floor(n-l-8))}}function ue(){var e=Math.ceil(f.getBoundingClientRect().width||600),n=document.querySelector(".gemboss-platform-main"),l=n?n.getBoundingClientRect().width:document.documentElement.clientWidth||d.innerWidth;return{min:8,max:Math.max(8,Math.floor(l-e-8))}}function h(e){var n=a;a=Ce(a,e),a!==n&&(n.presentation!==a.presentation&&((a.presentation==="full"||a.presentation==="dock"||a.presentation==="side")&&A("local",y("lastMode"),a.presentation),a.presentation==="side"&&(a=Ce(a,{type:"side-resize",width:se,available:U()})),i.keepAcrossPages&&A("session",y("presentation"),a.presentation)),n.busy!==a.busy&&(le=a.busy?Date.now():null),F(),re.slice().forEach(function(l){try{l(Ze.state())}catch(s){d.console&&d.console.error(s)}}))}function Xe(e){A("local",y("shape"),e)}function P(e){var n=d.innerHeight,l=Math.round(e)>=$(null,n);oe=l?null:Math.round(e),h({type:"resize",height:e,viewport:n}),A("local",y("dockHeight"),l?null:String(Math.round(e)))}function fe(e,n,l){Ne=Math.round(e),h({type:"slide",offsetRight:e,min:n,max:l}),A("local",y("dockOffsetRight"),String(Math.round(e)))}function R(e){se=Math.round(e),h({type:"side-resize",width:e,available:U()}),A("local",y("sideWidth"),String(Math.round(e)))}var qe=function(){h({type:"dock"}),Xe("dock")},Ye=function(){h({type:"side"}),a.sideAllowed&&Xe("side")},x=function(){h({type:"reopen"})},Ve=function(){h({type:"minimize"})},pe=function(){h({type:"dismiss"})};function O(e,n,l){l=l||{};var s=c("button",{type:"button",className:["ui-menu__item",l.danger?"ui-menu__item--danger":"",l.className||""].filter(Boolean).join(" "),disabled:!!l.disabled},e);return s.addEventListener("click",function(u){var v=s.closest("details");if(v){v.removeAttribute("open");var b=v.querySelector("summary");b&&b.focus()}n&&n(u)}),s}function De(e,n,l){var s=c("details",{className:"gb-dock-menu"}),u=c("summary",{className:n,title:e,"aria-label":e});return u.appendChild(H.more()),s.appendChild(u),s.appendChild(c("div",{className:"gemboss-popover-surface gb-dock-menu-list",title:""},l)),s}function st(){var e=[];return(Se||[]).forEach(function(n){we(n)?e.push(n):n&&e.push(O(n.label,n.onClick,{danger:n.danger,disabled:n.disabled,className:n.className}))}),S&&e.push(O(r.clearHistory,function(){S()},{danger:!0,disabled:!i.canClearHistory})),e}T(d,"keydown",function(e){var n=f.querySelector("details.gb-dock-menu[open]");if(!(!n||e.key!=="Escape"||e.defaultPrevented||e.isComposing||e.keyCode===229)){var l=document.activeElement,s=l&&l.closest?l.closest('dialog[open], [aria-modal="true"]'):null;if(!(s&&!n.contains(s)))if(e.preventDefault(),n.contains(l)){e.stopPropagation(),n.open=!1;var u=n.querySelector("summary");u&&u.focus()}else n.open=!1}},!0),T(document,"pointerdown",function(e){Array.prototype.forEach.call(f.querySelectorAll("details.gb-dock-menu[open]"),function(n){n.contains(e.target)||(n.open=!1)})},!0),T(d,"blur",function(){Array.prototype.forEach.call(f.querySelectorAll("details.gb-dock-menu[open]"),function(e){e.open=!1})});function W(e){Ge=e,f.classList.toggle("gb-dock-dragging",e)}function lt(e){var n=null;e.addEventListener("pointerdown",function(s){s.preventDefault(),e.setPointerCapture(s.pointerId),W(!0),n={startY:s.clientY,startH:a.dockHeight}}),e.addEventListener("pointermove",function(s){n&&P(n.startH+(n.startY-s.clientY))});var l=function(s){n=null,W(!1);try{e.releasePointerCapture(s.pointerId)}catch{}};e.addEventListener("pointerup",l),e.addEventListener("pointercancel",l),e.addEventListener("keydown",function(s){var u=s.shiftKey?96:32,v=K(Z,d.innerHeight),b;s.key==="ArrowUp"?(s.preventDefault(),P(a.dockHeight+u)):s.key==="ArrowDown"?(s.preventDefault(),P(a.dockHeight-u)):s.key==="ArrowLeft"?(b=ue(),s.preventDefault(),fe(a.dockOffsetRight+u,b.min,b.max)):s.key==="ArrowRight"?(b=ue(),s.preventDefault(),fe(a.dockOffsetRight-u,b.min,b.max)):s.key==="Home"?(s.preventDefault(),P(v)):s.key==="End"&&(s.preventDefault(),P(B))})}function dt(e){var n=null;e.addEventListener("pointerdown",function(s){a.presentation!=="dock"||s.target.closest&&s.target.closest("button, summary, .gb-dock-menu")||(e.setPointerCapture(s.pointerId),W(!0),n={startX:s.clientX,startOffset:a.dockOffsetRight,moved:!1})}),e.addEventListener("pointermove",function(s){if(n&&!(!n.moved&&Math.abs(s.clientX-n.startX)<4)){n.moved=!0;var u=ue();fe(n.startOffset-(s.clientX-n.startX),u.min,u.max)}});var l=function(s){if(n){n=null,W(!1);try{e.releasePointerCapture(s.pointerId)}catch{}}};e.addEventListener("pointerup",l),e.addEventListener("pointercancel",l)}var D=null;function V(e,n){if(D=null,W(!1),document.body.classList.remove("ui-resizing"),e&&n)try{e.releasePointerCapture(n.pointerId)}catch{}}function ct(e){e.addEventListener("pointerdown",function(n){n.button!==0||n.pointerType==="mouse"&&n.ctrlKey||(n.preventDefault(),e.setPointerCapture(n.pointerId),W(!0),document.body.classList.add("ui-resizing"),D={startX:n.clientX,startW:a.sideWidth,id:n.pointerId})}),e.addEventListener("pointermove",function(n){if(!(!D||n.pointerId!==D.id)){if(n.pointerType==="mouse"&&n.buttons===0){V(e,n);return}R(D.startW+(D.startX-n.clientX))}}),e.addEventListener("pointerup",function(n){V(e,n)}),e.addEventListener("pointercancel",function(n){V(e,n)}),e.addEventListener("lostpointercapture",function(){D&&V()}),e.addEventListener("keydown",function(n){if(!(n.altKey||n.metaKey||n.ctrlKey)){var l=n.shiftKey?64:16;n.key==="ArrowLeft"?(n.preventDefault(),R(a.sideWidth+l)):n.key==="ArrowRight"?(n.preventDefault(),R(a.sideWidth-l)):n.key==="Home"?(n.preventDefault(),R(G)):n.key==="End"&&(n.preventDefault(),R(Z))}})}function ut(e){Array.prototype.slice.call(f.childNodes).forEach(function(E){E!==de&&f.removeChild(E)}),o={};var n=function(E){f.insertBefore(E,de)},l=e==="dock",s=e==="side",u=st();if(e==="full"){var v=c("div",{className:"gb-dock-fullchrome","data-gb-dock-chrome":""});if(X&&X.matches){var b=c("div",{className:"gb-dock-menu-actions"});[].concat(ie).forEach(function(E){te(E&&E.classList&&E.classList.contains("gb-dock-shrink-keep")?v:b,E)}),b.addEventListener("click",function(E){E.target.closest("button")&&(b.parentNode.parentNode.open=!1)}),v.appendChild(De(r.more,"gb-dock-shrink gb-dock-menu-pill",[b].concat(u,o.shrinkLabel=O("",function(){C()}))))}else{o.shrinkLabel=c("span"),te(v,ie),u.length&&v.appendChild(De(r.more,"gb-dock-shrink gb-dock-menu-pill",u));var j=c("button",{type:"button",className:"gb-dock-shrink"},[H.shrink(),o.shrinkLabel]);j.addEventListener("click",function(){C()}),v.appendChild(j)}n(v)}if(e==="mini"&&(o.miniDot=c("span",{className:"gb-dock-dot","aria-hidden":"true"}),o.miniStatus=c("span",{className:"gb-dock-ministatus"}),o.miniBar=c("button",{type:"button",className:"gb-dock-minibar"},[o.miniDot,c("strong",null,i.title),o.miniStatus,c("span",{className:"gb-dock-minichevron","aria-hidden":"true"},H.chevronUp())]),o.miniBar.addEventListener("click",x),o.miniClose=c("button",{type:"button",className:"gb-dock-icon"}),o.miniCloseSr=c("span",{className:"gb-dock-sr"}),o.miniClose.appendChild(H.close()),o.miniClose.appendChild(o.miniCloseSr),o.miniClose.addEventListener("click",pe),n(c("div",{className:"gb-dock-minirow"},[o.miniBar,o.miniClose]))),s&&(o.sideGrip=c("div",{className:"ui-resizer gb-dock-sidegrip",role:"separator","aria-orientation":"vertical","aria-label":r.sideGrip,tabindex:"0"}),ct(o.sideGrip),n(o.sideGrip)),l||s){l&&(o.grip=c("div",{className:"gb-dock-grip",role:"separator","aria-orientation":"horizontal","aria-label":r.grip,tabindex:"0"},c("span",{"aria-hidden":"true"})),lt(o.grip),n(o.grip)),o.dot=c("span",{className:"gb-dock-dot","aria-hidden":"true"}),o.status=c("span",{className:"gb-dock-status"});var Q=c("div",{className:"gb-dock-actions"});if(w){var $e=c("button",{type:"button",className:"gb-dock-icon gb-dock-action",title:r.newChat},[H.plus(),c("span",{className:"gb-dock-sr"},r.newChat)]);$e.addEventListener("click",function(){w()}),Q.appendChild($e)}var et=c("button",{type:"button",className:"gb-dock-icon",title:r.openFull},[H.expand(),c("span",{className:"gb-dock-sr"},r.openFull)]);et.addEventListener("click",function(){ne()}),Q.appendChild(et);var J=u.slice();u.length&&J.push(c("hr",{className:"gb-dock-menu-sep"})),l&&a.sideAllowed&&J.push(O(r.pinSide,Ye,{className:"gb-dock-pinside"})),s&&J.push(O(r.floatPopup,qe)),J.push(O(r.minimizeTitle,Ve)),Q.appendChild(De(r.more,"gb-dock-icon",J)),o.close=c("button",{type:"button",className:"gb-dock-icon"}),o.closeSr=c("span",{className:"gb-dock-sr"}),o.close.appendChild(H.close()),o.close.appendChild(o.closeSr),o.close.addEventListener("click",pe),Q.appendChild(o.close);var tt=c("header",{className:"gb-dock-header",title:l?r.headerTitle:null},[o.dot,c("span",{className:"gb-dock-title"},i.title),o.status,Q]);l&&dt(tt),n(tt)}}function F(){var e=a.presentation,n=[a.mounted?e:"unmounted",a.sideAllowed,!!w,!!S,i.canClearHistory,i.title,(Se||[]).length,(ie||[]).length,X&&X.matches].join("|");if(n!==Ae&&(ut(a.mounted?e:"hidden"),Ae=n),a.mounted&&!f.parentNode&&(t.container||document.body).appendChild(f),f.className="gb-dock "+ze[e]+(Ge?" gb-dock-dragging":""),N){var l=e==="full";N.className="gemboss-assistant-layout"+(l?"":" is-dock"),l&&q.parentNode!==N?N.insertBefore(q,Y):!l&&q.parentNode===N&&N.removeChild(q),Y.className="gemboss-assistant-page"+(Ke?" is-switching":"")}e==="hidden"?(f.removeAttribute("role"),f.removeAttribute("aria-label"),f.setAttribute("inert","")):(f.setAttribute("role","region"),f.setAttribute("aria-label",i.title),f.removeAttribute("inert")),f.style.removeProperty("height"),f.style.removeProperty("right"),f.style.removeProperty("--gb-dock-side-w"),e==="dock"&&(f.style.height=a.dockHeight+"px",f.style.right=a.dockOffsetRight+"px"),e==="side"&&f.style.setProperty("--gb-dock-side-w",a.sideWidth+"px");var s=a.busy?r.working:a.unread?r.done:r.ready;o.dot&&(o.dot.className="gb-dock-dot"+(a.busy?" gb-dock-dot-busy":"")),o.status&&(o.status.textContent=s),o.close&&(o.close.title=a.busy?r.closeBusyTitle:r.close,o.closeSr.textContent=a.busy?r.closeBusy:r.close),o.grip&&(o.grip.setAttribute("aria-valuenow",String(a.dockHeight)),o.grip.setAttribute("aria-valuemin",String(B)),o.grip.setAttribute("aria-valuemax",String(K(Z,d.innerHeight)))),o.sideGrip&&(o.sideGrip.setAttribute("aria-valuenow",String(a.sideWidth)),o.sideGrip.setAttribute("aria-valuemin",String(G)),o.sideGrip.setAttribute("aria-valuemax",String(Ee(Z,U())))),o.miniBar&&(o.miniBar.setAttribute("aria-label",r.reopen.replace("{title}",i.title)),o.miniDot.className="gb-dock-dot"+(a.busy?" gb-dock-dot-busy":a.unread?" gb-dock-dot-unread":""),o.miniStatus.textContent=a.busy&&le?r.working+" \xB7 "+ot(le):a.unread?r.answerWaiting:i.miniHint||r.askAboutScreen,o.miniClose.title=a.busy?r.openInsteadTitle:r.hideTitle,o.miniCloseSr.textContent=a.busy?r.openInstead:r.hide),o.shrinkLabel&&(o.shrinkLabel.textContent=a.sideAllowed&&a.floatShape==="side"?r.backToSide:r.shrinkToPopup),a.busy&&le&&e==="mini"?M||(M=d.setInterval(F,1e3)):M&&(d.clearInterval(M),M=0);var u=i.bodyClassPrefix,v=document.body;v.classList.toggle(u+"-busy",a.busy),v.classList.toggle(u+"-unread",a.unread&&!a.busy),v.classList.toggle(u+"-side",e==="side"),e==="side"?v.style.setProperty(ke,a.sideWidth+"px"):v.style.removeProperty(ke),e!=="side"&&D&&V(),He().forEach(function(b){var j=e!=="hidden";b.hidden=j,b.style.display=j?"none":""})}function He(){var e=t.launchers;return e?typeof e=="string"?Array.prototype.slice.call(document.querySelectorAll(e)):Array.prototype.slice.call(e.length!==void 0?e:[e]):[]}T(document,"click",function(e){if(!(!t.launchers||e.defaultPrevented)){var n=e.target&&e.target.closest?e.target.closest("button"):null;n&&He().indexOf(n)>=0&&(e.preventDefault(),x())}}),T(document,"click",function(e){if(!(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)){var n=e.target&&e.target.closest?e.target.closest("a"):null;if(!(!n||n.target==="_blank")){var l;try{l=new URL(n.href,d.location.origin)}catch{return}if(!(!k(l)||g())){var s=_("local",y("lastMode"))||"",u=!!n.closest(".gnav-assistant");(u?s==="full":s!=="dock"&&s!=="side")||(e.preventDefault(),e.stopPropagation(),x(),d.dispatchEvent(new CustomEvent(i.dockedEvent)))}}}},!0);function je(e,n){e&&(e.addEventListener?(e.addEventListener("change",n),ae.push(function(){e.removeEventListener("change",n)})):(e.addListener(n),ae.push(function(){e.removeListener(n)})))}var Me=d.matchMedia?d.matchMedia(Oe):null,Qe=function(){h({type:"side-allowed",allowed:i.allowSide&&(!Me||Me.matches)})};je(Me,Qe),je(X,F),T(d,"resize",function(){h({type:"resize",height:$(oe,d.innerHeight),viewport:d.innerHeight});var e=Ue();h({type:"slide",offsetRight:Ne,min:e.min,max:e.max}),h({type:"side-resize",width:se,available:U()})}),Qe();var Le=_("local",y("dockHeight")),Ie=Le===null||Le===""?NaN:Number(Le);oe=isFinite(Ie)&&Ie>0?Ie:null,h({type:"resize",height:$(oe,d.innerHeight),viewport:d.innerHeight});var _e=_("local",y("dockOffsetRight")),he=Number(_e);if(_e!==null&&_e!==""&&isFinite(he)&&he>=0){Ne=he;var Je=Ue();h({type:"slide",offsetRight:he,min:Je.min,max:Je.max})}var Te=_("local",y("shape"));(Te==="side"||Te==="dock")&&h({type:"restore-float",shape:Te}),A("local",y("floatShape"),null);var me=Number(_("local",y("sideWidth")));if(isFinite(me)&&me>0&&(se=me,h({type:"side-resize",width:me,available:U()})),g())h({type:"enter-full"});else if(i.keepAcrossPages){var ve=_("session",y("presentation"));ve==="dock"||ve==="side"?h({type:"reopen"}):(ve==="mini"||ve==="full")&&(h({type:"reopen"}),h({type:"minimize"}))}F();var Ze={el:f,pane:ce,state:function(){return m(a,{})},open:x,reopen:x,openDock:qe,openSide:Ye,minimize:Ve,dismiss:pe,toggle:function(){a.presentation==="hidden"||a.presentation==="mini"?x():pe()},enterFull:function(){h({type:"enter-full"})},leaveFull:function(){h({type:"leave-full"})},setBusy:function(e){h({type:"busy",busy:!!e})},setSwitching:function(e){Ke=!!e,F()},setDockHeight:P,setSideWidth:R,setDockOffsetRight:function(e){var n=ue();fe(e,n.min,n.max)},onChange:function(e){return re.push(e),function(){re=re.filter(function(n){return n!==e})}},update:function(e){e=e||{},e.title!==void 0&&(i.title=e.title),e.miniHint!==void 0&&(i.miniHint=e.miniHint),e.canClearHistory!==void 0&&(i.canClearHistory=e.canClearHistory!==!1),e.menuItems!==void 0&&(Se=e.menuItems),e.fullActions!==void 0&&(ie=e.fullActions),e.labels&&(r=m(r,e.labels)),Ae="",F()},destroy:function(){ae.forEach(function(n){n()}),M&&d.clearInterval(M);var e=i.bodyClassPrefix;document.body.classList.remove(e+"-busy",e+"-unread",e+"-side"),document.body.style.removeProperty(ke),He().forEach(function(n){n.hidden=!1,n.style.display=""}),f.parentNode&&f.parentNode.removeChild(f)}};return Ze}})(typeof globalThis<"u"?globalThis:this);
|
|
1
|
+
(function(d){"use strict";var R=d.gembossUI;if(!R){d.console&&d.console.error("@gemboss/ui assistant-plain.js: load kit-plain.js first (it defines gembossUI)");return}if(R.assistantFrame)return;var j=280,qe=480,dt=56,ct=12,Ve=dt+ct,Ee=24,Q=380,Se=400,Ae=720,Ye=480,je="(min-width: 1100px)",ut="(max-width: 640px)",Ce="--gb-assistant-side-w",Le="--gb-assistant-left-w",re=9007199254740991;function Ne(t,i){var a=isFinite(i)&&i>0?Math.max(Q,Math.min(Ae,i-Ye)):Ae;return Math.min(Math.max(Math.round(t),Q),a)}function Qe(t,i,a){return a<i?i:Math.min(Math.max(Math.round(t),i),a)}function J(t,i){var a=Math.max(j,i-Ve);return Math.min(Math.max(Math.round(t),j),a)}function oe(t,i){var a=t!==null&&isFinite(t)&&t>0?t:1/0;return J(a,i)}var Je={presentation:"hidden",mounted:!1,busy:!1,unread:!1,dockHeight:qe,dockOffsetRight:Ee,openNonce:0,sideWidth:Se,floatShape:"side",sideAllowed:!1,leftAllowed:!1,opensLeft:!1},ft={"left-allowed":1,"side-allowed":1,busy:1,resize:1,slide:1,"side-resize":1,"restore-float":1,"open-left-on-load":1};function v(t,i){var a={},p;for(p in t)a[p]=t[p];for(p in i)a[p]=i[p];return a}function le(t){return t.floatShape==="side"?t.sideAllowed?"side":"dock":t.floatShape==="left"?t.leftAllowed?"left":t.sideAllowed?"side":"dock":"dock"}function De(t,i){return v(t,{presentation:i,floatShape:i,mounted:!0,unread:!1,openNonce:t.openNonce+1})}function se(t,i){if(t.opensLeft&&!ft[i.type])return se(v(t,{opensLeft:!1}),i);switch(i.type){case"open-left-on-load":return t.presentation!=="hidden"||t.floatShape!=="left"?t:t.leftAllowed?v(t,{presentation:"left",mounted:!0,unread:!1,openNonce:t.openNonce+1}):v(t,{mounted:!0,opensLeft:!0});case"enter-full":return v(t,{presentation:"full",mounted:!0,unread:!1,openNonce:t.openNonce+1});case"leave-full":return t.presentation!=="full"?t:v(t,{presentation:t.busy?le(t):"mini"});case"dock":return De(t,"dock");case"side":return De(t,t.sideAllowed?"side":"dock");case"left":return De(t,t.leftAllowed?"left":"dock");case"reopen":return v(t,{presentation:le(t),mounted:!0,unread:!1,openNonce:t.openNonce+1});case"side-allowed":return i.allowed===t.sideAllowed?t:i.allowed?v(t,{sideAllowed:!0,presentation:t.presentation==="dock"&&(t.floatShape==="side"||t.floatShape==="left"&&!t.leftAllowed)?"side":t.presentation}):v(t,{sideAllowed:!1,presentation:t.presentation==="side"?"dock":t.presentation});case"left-allowed":if(t.opensLeft){var a=i.allowed&&t.presentation==="hidden";return v(t,a?{leftAllowed:i.allowed,opensLeft:!1,presentation:"left",unread:!1,openNonce:t.openNonce+1}:{leftAllowed:i.allowed,opensLeft:!1})}return i.allowed===t.leftAllowed?t:i.allowed?v(t,{leftAllowed:!0,presentation:(t.presentation==="dock"||t.presentation==="side")&&t.floatShape==="left"?"left":t.presentation}):v(t,{leftAllowed:!1,presentation:t.presentation==="left"?t.sideAllowed?"side":"dock":t.presentation});case"restore-float":return v(t,{floatShape:i.shape});case"minimize":return v(t,{presentation:"mini"});case"dismiss":return t.busy?v(t,{presentation:t.presentation==="mini"?le(t):"mini"}):v(t,{presentation:"hidden"});case"busy":{if(i.busy===t.busy)return t;var p=t.presentation==="mini"||t.presentation==="hidden";return v(t,{busy:i.busy,unread:!i.busy&&p?!0:t.unread})}case"resize":return v(t,{dockHeight:J(i.height,i.viewport)});case"slide":return v(t,{dockOffsetRight:Qe(i.offsetRight,i.min,i.max)});case"side-resize":return v(t,{sideWidth:Ne(i.width,i.available)});default:return t}}R.assistantDock={reducer:se,initial:Je,clampSideWidth:Ne,clampDockOffset:Qe,clampDockHeight:J,openingDockHeight:oe,DOCK_MIN_HEIGHT:j,DOCK_DEFAULT_HEIGHT:qe,DOCK_VIEWPORT_RESERVE:Ve,DOCK_DEFAULT_OFFSET_RIGHT:Ee,SIDE_MIN_WIDTH:Q,SIDE_DEFAULT_WIDTH:Se,SIDE_MAX_WIDTH:Ae,SIDE_PAGE_MIN:Ye,SIDE_FITS_QUERY:je};var pt={ready:"Ready",working:"Working",done:"Done \u2014 tap to see it",answerWaiting:"An answer is waiting",waiting:"Waiting on you",failed:"Something went wrong",reopen:"Reopen the {title}",grip:"Drag to resize the assistant; left and right arrows move it sideways",headerTitle:"Drag this bar to move the popup left or right",newChat:"New chat",close:"Close the assistant",closeBusy:"Fold into the chat button",closeBusyTitle:"Still working \u2014 fold it into the chat button",shrinkToPopup:"Shrink to popup",sideGrip:"Drag to resize the assistant; left and right arrows work too",backToSide:"Back to the side panel",backToLeft:"Back to the left panel",more:"More",clearHistory:"Clear history",places:"Where the assistant sits",placeSide:"On the right",placeLeft:"On the left",placeDock:"Floating window",placeFull:"Full screen",placeNeedsWidth:"Needs a window at least 1100px wide"},Ze={hidden:"gb-dock-hidden",mini:"gb-dock-mini",dock:"gb-dock-dock",side:"gb-dock-side",left:"gb-dock-left",full:"gb-dock-full"},ht={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"},mt={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"},He=function(t){return typeof Node<"u"&&t instanceof Node};function c(t,i,a){var p=document.createElement(t);if(i)for(var w in i){var y=i[w];y==null||y===!1||(w==="text"?p.textContent=String(y):w==="className"?p.className=y:p.setAttribute(w,y===!0?"":String(y)))}return de(p,a),p}function de(t,i){return i==null||i===!1?t:Array.isArray(i)?(i.forEach(function(a){de(t,a)}),t):(t.appendChild(He(i)?i:document.createTextNode(String(i))),t)}function B(t,i){var a=document.createElement("template");return a.innerHTML='<svg viewBox="0 0 20 20" width="'+t+'" height="'+t+'" aria-hidden="true" focusable="false"><g fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">'+i+"</g></svg>",a.content.firstChild}var K={close:'<path d="M5 5l10 10M15 5 5 15"/>',plus:'<path d="M10 4v12M4 10h12"/>',shrink:'<path d="M16 4l-5 5M11 9h3.5M11 9V5.5M4 16l5-5M9 11H5.5M9 11v3.5"/>',more:'<circle cx="4.5" cy="10" r="1"/><circle cx="10" cy="10" r="1"/><circle cx="15.5" cy="10" r="1"/>',chat:'<path d="M3 4.5h14v9H8.5L5 16.5v-3H3z"/>',check:'<path d="M4 10.5 8 14.5 16 5.5"/>'},Z={close:function(){return B(18,K.close)},plus:function(){return B(18,K.plus)},shrink:function(){return B(16,K.shrink)},more:function(){return B(18,K.more)},chat:function(){return B(22,K.chat)}};function vt(t){var i=Math.max(0,Math.floor((Date.now()-t)/1e3)),a=i%60;return Math.floor(i/60)+":"+(a<10?"0":"")+a}function $e(t){try{return t==="session"?d.sessionStorage:d.localStorage}catch{return null}}function O(t,i){var a=$e(t);try{return a?a.getItem(i):null}catch{return null}}function S(t,i,a){var p=$e(t);try{p&&(a===null?p.removeItem(i):p.setItem(i,a))}catch{}}function et(){var t=document.querySelector(".gemboss-platform-main");return t?getComputedStyle(t).getPropertyValue("--gb-rail-w").trim():""}function $(t){var i=document.querySelector(".gemboss-platform-main"),a=document.documentElement.clientWidth||d.innerWidth;if(!t)return a-(i?i.getBoundingClientRect().left:0);var p=parseFloat(et());return a-(isFinite(p)?p:240)}R.fullChromeRoom=function(t){var i=t&&t.closest?t.closest(".gb-dock"):null;if(!i||typeof d.ResizeObserver>"u")return function(){};var a=null,p=function(){t.removeAttribute("data-chrome"),t.style.removeProperty("--gb-chat-chrome-w"),t.style.removeProperty("--gb-chat-chrome-h")},w=new d.ResizeObserver(function(){y()});function y(){var A=i.querySelector(":scope > [data-gb-dock-chrome]");if(A!==a&&(a&&w.unobserve(a),A&&w.observe(A),a=A),!A||getComputedStyle(A).position!=="absolute")return p();var L=A.getBoundingClientRect(),N=t.getBoundingClientRect();if(L.left>=N.right||L.bottom<=N.top||L.right<=N.left)return p();t.style.setProperty("--gb-chat-chrome-w",Math.ceil(N.right-L.left+8)+"px"),t.style.setProperty("--gb-chat-chrome-h",Math.ceil(L.bottom-N.top+8)+"px"),t.setAttribute("data-chrome","")}y(),w.observe(t),w.observe(i);var ce=new MutationObserver(y);return ce.observe(i,{childList:!0,attributes:!0,attributeFilter:["class"]}),function(){w.disconnect(),ce.disconnect()}},R.assistantFrame=function(t){t=t||{};var i={title:t.title||"Assistant",storagePrefix:t.storagePrefix||"gemboss.assistant",bodyClassPrefix:t.bodyClassPrefix||"gemboss-assistant",dockedEvent:t.dockedEvent||"gemboss:assistant-docked",allowSide:t.allowSide!==!1,allowLeft:t.allowLeft===!0,keepAcrossPages:t.keepAcrossPages!==!1,fullHref:t.fullHref||"",miniHint:t.miniHint||"",canClearHistory:t.canClearHistory!==!1,waiting:t.waiting,failed:t.failed},a=v(pt,t.labels||{}),p=function(){try{return i.fullHref?new URL(i.fullHref,d.location.href).pathname:""}catch{return""}},w=t.isFullLink||function(e){return!!p()&&e.pathname===p()},y=t.isOnFullPage||function(){return!!p()&&d.location.pathname===p()},ce=t.onExpand||function(){i.fullHref&&(d.location.href=i.fullHref)},A=t.onShrink||function(){S("session",g("presentation"),le(r));var e=document.referrer,n=!1;try{n=!!e&&new URL(e).origin===d.location.origin&&new URL(e).pathname!==d.location.pathname}catch{n=!1}n?d.history.back():h({type:"reopen"})},L=t.onNewChat||null,N=t.onClearHistory||null,Me=t.menuItems||null,ue=t.fullActions||null,ee=d.matchMedia?d.matchMedia(ut):null,g=function(e){return i.storagePrefix+"."+e},r=Je,fe=[],te=[],G=function(e,n,l,o){e.addEventListener(n,l,o),te.push(function(){e.removeEventListener(n,l,o)})},pe=null,_e=Ee,he=Se,D=null,me=null,tt=!1,W=0,f=c("div",{className:"gb-dock "+Ze.hidden}),ve=c("div",{className:"gb-dock-body"}),be=c("div",{className:"gb-dock-pane",id:"gem-dock-pane-assistant"}),ne=t.rail?He(t.rail)?t.rail:t.rail.el:null,H=null,ie=null,nt=!1;ne?(H=c("div",{className:"gemboss-assistant-layout is-dock"}),ie=c("div",{className:"gemboss-assistant-page"}),t.body&&ie.appendChild(t.body),H.appendChild(ie),be.appendChild(H)):t.body&&be.appendChild(t.body),ve.appendChild(be),f.appendChild(ve);var s={},Ie="";function it(){var e=document.querySelector(".gemboss-platform-main"),n=e?e.getBoundingClientRect().width:document.documentElement.clientWidth||d.innerWidth,l=Math.min(460,Math.max(0,n-48));return{min:8,max:Math.max(8,Math.floor(n-l-8))}}function ge(){var e=Math.ceil(f.getBoundingClientRect().width||600),n=document.querySelector(".gemboss-platform-main"),l=n?n.getBoundingClientRect().width:document.documentElement.clientWidth||d.innerWidth;return{min:8,max:Math.max(8,Math.floor(l-e-8))}}function h(e){var n=r;r=se(r,e),r!==n&&(n.presentation!==r.presentation&&(r.presentation!=="hidden"&&r.presentation!=="mini"&&S("local",g("lastMode"),r.presentation),(r.presentation==="side"||r.presentation==="left")&&(r=se(r,{type:"side-resize",width:he,available:$(r.presentation==="left")})),i.keepAcrossPages&&S("session",g("presentation"),r.presentation)),n.busy!==r.busy&&(me=r.busy?Date.now():null),F(),fe.slice().forEach(function(l){try{l(Xe.state())}catch(o){d.console&&d.console.error(o)}}))}function Pe(e){S("local",g("place"),e)}function U(e){var n=d.innerHeight,l=Math.round(e)>=oe(null,n);pe=l?null:Math.round(e),h({type:"resize",height:e,viewport:n}),S("local",g("dockHeight"),l?null:String(Math.round(e)))}function ke(e,n,l){_e=Math.round(e),h({type:"slide",offsetRight:e,min:n,max:l}),S("local",g("dockOffsetRight"),String(Math.round(e)))}function X(e){he=Math.round(e),h({type:"side-resize",width:e,available:$(r.presentation==="left")}),S("local",g("sideWidth"),String(Math.round(e)))}var at=function(){h({type:"dock"}),Pe("dock")},Te=function(){h({type:"side"}),r.sideAllowed&&Pe("side")},Re=function(){h({type:"left"}),r.leftAllowed&&Pe("left")},q=function(){h({type:"reopen"})},bt=function(){h({type:"minimize"})},Oe=function(){h({type:"dismiss"})};function We(e){var n=e.closest("details");if(n){n.removeAttribute("open");var l=n.querySelector("summary");l&&l.focus()}}function xe(e,n,l){l=l||{};var o=c("button",{type:"button",role:l.menu?"menuitem":null,className:["ui-menu__item",l.danger?"ui-menu__item--danger":"",l.className||""].filter(Boolean).join(" "),disabled:!!l.disabled},e);return o.addEventListener("click",function(u){We(o),n&&n(u)}),o}function Fe(e,n,l,o){var u=c("details",{className:"gb-dock-menu"}),k=c("summary",{className:n,title:e,"aria-label":e});return k.appendChild(Z.more()),u.appendChild(k),u.appendChild(c("div",{className:"gemboss-popover-surface gb-dock-menu-list",title:"",role:o?"menu":null,"aria-label":o?e:null},l)),u}function gt(e){var n=[];return(Me||[]).forEach(function(l){He(l)?n.push(l):l&&n.push(xe(l.label,l.onClick,{danger:l.danger,disabled:l.disabled,className:l.className,menu:e}))}),N&&n.push(xe(a.clearHistory,function(){N()},{danger:!0,disabled:!i.canClearHistory,menu:e})),n}G(d,"keydown",function(e){var n=f.querySelector("details.gb-dock-menu[open]");if(n&&n.contains(document.activeElement)){var l=[].filter.call(n.querySelectorAll("[role^=menuitem]"),function(_){return _.offsetParent&&!_.disabled}),o=l.length,u=l.indexOf(document.activeElement),k={Home:0,End:o-1,ArrowDown:u+1,ArrowUp:(u>0?u:o)-1}[e.key];if(k!=null&&o)return e.preventDefault(),l[k%o].focus()}if(!(!n||e.key!=="Escape"||e.defaultPrevented||e.isComposing||e.keyCode===229)){var b=document.activeElement,C=b&&b.closest?b.closest('dialog[open], [aria-modal="true"]'):null;C&&!n.contains(C)||(e.preventDefault(),n.contains(b)?(e.stopPropagation(),We(b)):n.open=!1)}},!0),G(document,"pointerdown",function(e){[].forEach.call(f.querySelectorAll("details.gb-dock-menu[open]"),function(n){n.contains(e.target)||(n.open=!1)})},!0),G(d,"blur",function(){[].forEach.call(f.querySelectorAll("details.gb-dock-menu[open]"),function(e){e.open=!1})});function x(e){tt=e,f.classList.toggle("gb-dock-dragging",e)}function kt(e){var n=null;e.addEventListener("pointerdown",function(o){o.preventDefault(),e.setPointerCapture(o.pointerId),x(!0),n={startY:o.clientY,startH:r.dockHeight}}),e.addEventListener("pointermove",function(o){n&&U(n.startH+(n.startY-o.clientY))});var l=function(o){n=null,x(!1);try{e.releasePointerCapture(o.pointerId)}catch{}};e.addEventListener("pointerup",l),e.addEventListener("pointercancel",l),e.addEventListener("keydown",function(o){var u=o.shiftKey?96:32,k=J(re,d.innerHeight),b;o.key==="ArrowUp"?(o.preventDefault(),U(r.dockHeight+u)):o.key==="ArrowDown"?(o.preventDefault(),U(r.dockHeight-u)):o.key==="ArrowLeft"?(b=ge(),o.preventDefault(),ke(r.dockOffsetRight+u,b.min,b.max)):o.key==="ArrowRight"?(b=ge(),o.preventDefault(),ke(r.dockOffsetRight-u,b.min,b.max)):o.key==="Home"?(o.preventDefault(),U(k)):o.key==="End"&&(o.preventDefault(),U(j))})}function yt(e){var n=null;e.addEventListener("pointerdown",function(o){r.presentation!=="dock"||D&&D.on()||o.target.closest&&o.target.closest("button, summary, .gb-dock-menu")||(e.setPointerCapture(o.pointerId),x(!0),n={startX:o.clientX,startOffset:r.dockOffsetRight,moved:!1})}),e.addEventListener("pointermove",function(o){if(n&&!(!n.moved&&Math.abs(o.clientX-n.startX)<4)){n.moved=!0;var u=ge();ke(n.startOffset-(o.clientX-n.startX),u.min,u.max)}});var l=function(o){if(n){n=null,x(!1);try{e.releasePointerCapture(o.pointerId)}catch{}}};e.addEventListener("pointerup",l),e.addEventListener("pointercancel",l)}var M=null;function ae(e,n){if(M=null,x(!1),document.body.classList.remove("ui-resizing"),e&&n)try{e.releasePointerCapture(n.pointerId)}catch{}}function wt(e){e.addEventListener("pointerdown",function(n){n.button!==0||n.pointerType==="mouse"&&n.ctrlKey||(n.preventDefault(),e.setPointerCapture(n.pointerId),x(!0),document.body.classList.add("ui-resizing"),M={startX:n.clientX,startW:r.sideWidth,id:n.pointerId,grows:r.presentation==="left"?1:-1})}),e.addEventListener("pointermove",function(n){if(!(!M||n.pointerId!==M.id)){if(n.pointerType==="mouse"&&n.buttons===0){ae(e,n);return}X(M.startW+(n.clientX-M.startX)*M.grows)}}),e.addEventListener("pointerup",function(n){ae(e,n)}),e.addEventListener("pointercancel",function(n){ae(e,n)}),e.addEventListener("lostpointercapture",function(){M&&ae()}),e.addEventListener("keydown",function(n){if(!(n.altKey||n.metaKey||n.ctrlKey)){var l=n.shiftKey?64:16,o=r.presentation==="left";n.key===(o?"ArrowRight":"ArrowLeft")?(n.preventDefault(),X(r.sideWidth+l)):n.key===(o?"ArrowLeft":"ArrowRight")?(n.preventDefault(),X(r.sideWidth-l)):n.key==="Home"?(n.preventDefault(),X(Q)):n.key==="End"&&(n.preventDefault(),X(re))}})}function Et(e){[].slice.call(f.childNodes).forEach(function(m){m!==ve&&f.removeChild(m)}),s={};var n=function(m){f.insertBefore(m,ve)},l=e==="dock",o=e==="side",u=e==="left",k=gt(e!=="full");if(e==="full"){var b=c("div",{className:"gb-dock-fullchrome","data-gb-dock-chrome":""});if(ee&&ee.matches){var C=c("div",{className:"gb-dock-menu-actions"});[].concat(ue).forEach(function(m){de(m&&m.classList&&m.classList.contains("gb-dock-shrink-keep")?b:C,m)}),C.addEventListener("click",function(m){m.target.closest("button")&&(C.parentNode.parentNode.open=!1)}),b.appendChild(Fe(a.more,"gb-dock-shrink gb-dock-menu-pill",[C].concat(k,s.shrinkLabel=xe("",function(){A()}))))}else{s.shrinkLabel=c("span"),de(b,ue),k.length&&b.appendChild(Fe(a.more,"gb-dock-shrink gb-dock-menu-pill",k));var _=c("button",{type:"button",className:"gb-dock-shrink"},[Z.shrink(),s.shrinkLabel]);_.addEventListener("click",function(){A()}),b.appendChild(_)}n(b)}if(e==="mini"&&(s.knob=c("button",{type:"button",className:"gb-dock-knob"},Z.chat()),s.knob.addEventListener("click",function(){(!t.onButtonPress||t.onButtonPress()!==!0)&&q()}),n(s.knob)),(o||u)&&(s.sideGrip=c("div",{className:"ui-resizer gb-dock-sidegrip",role:"separator","aria-orientation":"vertical","aria-label":a.sideGrip,tabindex:"0"}),wt(s.sideGrip),n(s.sideGrip)),l||o||u){l&&(s.grip=c("div",{className:"gb-dock-grip",role:"separator","aria-orientation":"horizontal","aria-label":a.grip,tabindex:"0"},c("span",{"aria-hidden":"true"})),kt(s.grip),n(s.grip)),s.dot=c("span",{className:"gb-dock-dot","aria-hidden":"true"}),s.status=c("span",{className:"gb-dock-status"});var P=c("div",{className:"gb-dock-actions"});if(L){var V=c("button",{type:"button",className:"gb-dock-icon",title:a.newChat},[Z.plus(),c("span",{className:"gb-dock-sr"},a.newChat)]);V.addEventListener("click",function(){L()}),P.appendChild(V)}var T=c("div",{className:"gb-dock-menu-group",role:"group","aria-label":a.places});[i.allowSide&&["side",a.placeSide,r.floatShape==="side",!r.sideAllowed,Te],i.allowLeft&&["left",a.placeLeft,r.floatShape==="left",!r.leftAllowed,Re],["dock",a.placeDock,r.floatShape==="dock",!1,at],["full",a.placeFull,!1,!1,ce]].forEach(function(m){if(m){var Y=c("button",{type:"button",role:"menuitemradio",className:ht[m[0]],"aria-checked":String(m[2]),"aria-disabled":m[3]?"true":null},[c("span",{className:"gb-dock-place-name"},[m[1],m[3]&&c("span",{className:"gb-dock-place-why"},a.placeNeedsWidth)]),m[2]&&B(16,K.check)]);m[3]||Y.addEventListener("click",function(){We(Y),m[2]||m[4]()}),T.appendChild(Y)}}),P.appendChild(Fe(a.more,"gb-dock-icon",k.length?[T,c("hr",{className:"gb-dock-menu-sep"})].concat(k):[T],!0)),s.close=c("button",{type:"button",className:"gb-dock-icon"}),s.closeSr=c("span",{className:"gb-dock-sr"}),s.close.appendChild(Z.close()),s.close.appendChild(s.closeSr),s.close.addEventListener("click",Oe),P.appendChild(s.close);var E=c("header",{className:"gb-dock-header",title:l?a.headerTitle:null},[s.title=c("span",{className:"gb-dock-title"},i.title),s.status,P]);l&&yt(E),n(E)}D&&D.dress(e,E)}function F(){var e=r.presentation,n=[r.mounted?e:"unmounted",r.floatShape,r.sideAllowed,r.leftAllowed,!!L,!!N,i.canClearHistory,i.title,(Me||[]).length,(ue||[]).length,ee&&ee.matches,D&&D.on()].join("|");if(n!==Ie&&(Et(r.mounted?e:"hidden"),Ie=n),r.mounted&&!f.parentNode&&(t.container||document.body).appendChild(f),f.className="gb-dock "+Ze[e]+(tt?" gb-dock-dragging":""),H){var l=e==="full";H.className="gemboss-assistant-layout"+(l?"":" is-dock"),l&&ne.parentNode!==H?H.insertBefore(ne,ie):!l&&ne.parentNode===H&&H.removeChild(ne),ie.className="gemboss-assistant-page"+(nt?" is-switching":"")}e==="hidden"?(f.removeAttribute("role"),f.removeAttribute("aria-label"),f.setAttribute("inert","")):(f.setAttribute("role","region"),f.setAttribute("aria-label",i.title),f.removeAttribute("inert"));var o=e==="side"||e==="left";f.style.removeProperty("height"),f.style.removeProperty("right"),f.style.removeProperty("--gb-dock-side-w"),!(D&&D.paint())&&e==="dock"&&(f.style.height=r.dockHeight+"px",f.style.right=r.dockOffsetRight+"px"),o&&f.style.setProperty("--gb-dock-side-w",r.sideWidth+"px");var u=r.busy?"busy":i.failed?"failed":i.waiting?"waiting":r.unread?"unread":"",k={busy:a.working,failed:a.failed,waiting:a.waiting},b=u==="unread"?a.done:k[u]||a.ready;if(s.dot&&(u?(s.dot.className="gb-dock-dot gb-dock-dot-"+u,s.title.before(s.dot)):s.dot.remove()),s.status&&(s.status.textContent=b),s.close&&(s.close.title=r.busy?a.closeBusyTitle:a.close,s.closeSr.textContent=r.busy?a.closeBusy:a.close),s.grip&&(s.grip.setAttribute("aria-valuenow",String(r.dockHeight)),s.grip.setAttribute("aria-valuemin",String(j)),s.grip.setAttribute("aria-valuemax",String(J(re,d.innerHeight)))),s.sideGrip&&(s.sideGrip.setAttribute("aria-valuenow",String(r.sideWidth)),s.sideGrip.setAttribute("aria-valuemin",String(Q)),s.sideGrip.setAttribute("aria-valuemax",String(Ne(re,$(e==="left"))))),s.knob){var C=u==="unread"?a.answerWaiting:k[u]||i.miniHint,_=a.reopen.replace("{title}",i.title)+(C?": "+C:"");s.knob.setAttribute("aria-label",_),s.knob.title=r.busy&&me?_+" \xB7 "+vt(me):_;var P=mt[u]||"",V=s.knob.querySelector(".gb-dock-knob-dot");V&&!P&&s.knob.removeChild(V),P&&((V||s.knob.appendChild(c("span",{"aria-hidden":"true"}))).className=P)}s.shrinkLabel&&(s.shrinkLabel.textContent=r.sideAllowed&&r.floatShape==="side"?a.backToSide:r.leftAllowed&&r.floatShape==="left"?a.backToLeft:a.shrinkToPopup),r.busy&&me&&e==="mini"?W||(W=d.setInterval(F,1e3)):W&&(d.clearInterval(W),W=0);var T=i.bodyClassPrefix,E=document.body;E.classList.toggle(T+"-busy",r.busy),E.classList.toggle(T+"-unread",r.unread&&!r.busy),E.classList.toggle(T+"-side",e==="side"),E.classList.toggle(T+"-left",e==="left"),e==="side"?E.style.setProperty(Ce,r.sideWidth+"px"):E.style.removeProperty(Ce),e==="left"?E.style.setProperty(Le,r.sideWidth+"px"):E.style.removeProperty(Le);var m=e==="left"?et():"";m?f.style.setProperty("--gb-rail-w",m):f.style.removeProperty("--gb-rail-w"),!o&&M&&ae(),ze().forEach(function(Y){var st=e!=="hidden";Y.hidden=st,Y.style.display=st?"none":""})}function ze(){var e=t.launchers;return e?typeof e=="string"?[].slice.call(document.querySelectorAll(e)):[].slice.call(e.length!==void 0?e:[e]):[]}G(document,"click",function(e){if(!(!t.launchers||e.defaultPrevented)){var n=e.target&&e.target.closest?e.target.closest("button"):null;n&&ze().indexOf(n)>=0&&(e.preventDefault(),q())}}),G(document,"click",function(e){if(!(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)){var n=e.target&&e.target.closest?e.target.closest("a"):null;if(!(!n||n.target==="_blank")){var l;try{l=new URL(n.href,d.location.origin)}catch{return}if(!(!w(l)||y())){var o=O("local",g("lastMode"))||"",u=!!n.closest(".gnav-assistant");(u?o==="full":o!=="dock"&&o!=="side"&&o!=="left")||(e.preventDefault(),e.stopPropagation(),q(),d.dispatchEvent(new CustomEvent(i.dockedEvent)))}}}},!0);function rt(e,n){e&&(e.addEventListener?(e.addEventListener("change",n),te.push(function(){e.removeEventListener("change",n)})):(e.addListener(n),te.push(function(){e.removeListener(n)})))}var Be=d.matchMedia?d.matchMedia(je):null,ot=function(){var e=!Be||Be.matches;h({type:"side-allowed",allowed:i.allowSide&&e}),h({type:"left-allowed",allowed:i.allowLeft&&e})};rt(Be,ot),rt(ee,F),G(d,"resize",function(){h({type:"resize",height:oe(pe,d.innerHeight),viewport:d.innerHeight});var e=it();h({type:"slide",offsetRight:_e,min:e.min,max:e.max}),h({type:"side-resize",width:he,available:$(r.presentation==="left")})}),ot();var Ke=O("local",g("dockHeight")),Ge=Ke===null||Ke===""?NaN:Number(Ke);pe=isFinite(Ge)&&Ge>0?Ge:null,h({type:"resize",height:oe(pe,d.innerHeight),viewport:d.innerHeight});var Ue=O("local",g("dockOffsetRight")),ye=Number(Ue);if(Ue!==null&&Ue!==""&&isFinite(ye)&&ye>=0){_e=ye;var lt=it();h({type:"slide",offsetRight:ye,min:lt.min,max:lt.max})}var I=O("local",g("place"));I===null&&O("local",g("shape"))==="dock"&&(I="dock",S("local",g("place"),I)),S("local",g("shape"),null),(I==="side"||I==="dock"||I==="left")&&h({type:"restore-float",shape:I}),S("local",g("floatShape"),null);var we=Number(O("local",g("sideWidth")));isFinite(we)&&we>0&&(he=we,h({type:"side-resize",width:we,available:$()}));var z=O("session",g("presentation"));y()?h({type:"enter-full"}):i.keepAcrossPages&&(z==="dock"||z==="side"||z==="left")?h({type:"reopen"}):i.keepAcrossPages&&(z==="mini"||z==="full")?(h({type:"reopen"}),h({type:"minimize"})):I==="left"&&r.leftAllowed&&z!=="hidden"&&z!=="mini"&&h({type:"reopen"}),F();var Xe={el:f,pane:be,state:function(){return v(r,{})},open:q,reopen:q,openDock:at,openSide:Te,openLeft:Re,minimize:bt,dismiss:Oe,toggle:function(){r.presentation==="hidden"||r.presentation==="mini"?q():Oe()},enterFull:function(){h({type:"enter-full"})},leaveFull:function(){h({type:"leave-full"})},setBusy:function(e){h({type:"busy",busy:!!e})},setSwitching:function(e){nt=!!e,F()},setDockHeight:U,setSideWidth:X,setDockOffsetRight:function(e){var n=ge();ke(e,n.min,n.max)},onChange:function(e){return fe.push(e),function(){fe=fe.filter(function(n){return n!==e})}},update:function(e){e=e||{},["title","miniHint","waiting","failed"].forEach(function(n){e[n]!==void 0&&(i[n]=e[n])}),e.canClearHistory!==void 0&&(i.canClearHistory=e.canClearHistory!==!1),e.menuItems!==void 0&&(Me=e.menuItems),e.fullActions!==void 0&&(ue=e.fullActions),e.labels&&(a=v(a,e.labels)),Ie="",F()},destroy:function(){te.forEach(function(n){n()}),W&&d.clearInterval(W);var e=i.bodyClassPrefix;document.body.classList.remove(e+"-busy",e+"-unread",e+"-side",e+"-left"),document.body.style.removeProperty(Ce),document.body.style.removeProperty(Le),ze().forEach(function(n){n.hidden=!1,n.style.display=""}),f.parentNode&&f.parentNode.removeChild(f)}};return R.assistantWindow&&(D=R.assistantWindow.frame(f,a,function(){return r},F,g("window"),Re,Te,x,te,Xe)),Xe}})(typeof globalThis<"u"?globalThis:this);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.gb-chat-plus{display:inline-flex;align-items:center;gap:4px;flex:none;box-sizing:border-box;height:28px;min-height:28px;padding:0 10px 0 8px;border:0;border-radius:999px;box-shadow:inset 0 0 0 1px var(--gemboss-divider);background:var(--gemboss-surface, #fff);color:var(--gemboss-text-muted);font:inherit;font-size:var(--gemboss-fs-caption, 12px);font-weight:600;line-height:1;white-space:nowrap;cursor:pointer;transition:background-color var(--gemboss-transition-fast, .12s) ease}.gb-chat-plus:focus-visible{outline:2px solid var(--ui-focus, #5661f5);outline-offset:2px}.gb-chat-plus:disabled{opacity:.5;cursor:default}.gb-chat-plus svg{flex:none}.gb-chat-plus-lock{opacity:.7}.gb-chat-plus[data-state=on]{color:#1a1408;box-shadow:0 0 0 1px #c99a3e73,0 2px 10px #c99a3e4d;background:linear-gradient(135deg,#f3d891,#c99a3e 55%,#ecd08a)}@media (hover: hover){.gb-chat-plus:hover:not(:disabled){background-color:var(--gemboss-hover, rgba(0, 0, 0, .05));color:var(--gemboss-text)}.gb-chat-plus[data-state=on]:hover:not(:disabled){color:#1a1408;background:linear-gradient(135deg,#f6de9c,#cfa247 55%,#efd593)}}@media (pointer: coarse),(max-width: 47.9975em){.gb-chat-plus{min-height:44px;position:relative;isolation:isolate;-webkit-background-clip:text!important;background-clip:text!important}.gb-chat-plus,.gb-chat-plus[data-state=on]{box-shadow:none}.gb-chat-plus:before{content:"";position:absolute;inset:0;margin:auto;z-index:-1;box-sizing:border-box;pointer-events:none;height:inherit;max-height:100%;border-radius:inherit;background:inherit;-webkit-background-clip:border-box;background-clip:border-box;box-shadow:inset 0 0 0 1px var(--gemboss-divider)}.gb-chat-plus[data-state=on]:before{box-shadow:0 0 0 1px #c99a3e73,0 2px 10px #c99a3e4d}}@media (prefers-reduced-motion: reduce){.gb-chat-plus{transition:none}}.gb-dock.gb-dock--plus{--gemboss-surface: #14120e;--gemboss-panel-bg: #14120e;--gemboss-app-bg: #14120e;--gemboss-text: #f2ecdf;--gemboss-text-strong: #f2ecdf;--gemboss-text-muted: #a99f8b;--gemboss-divider: rgba(214, 178, 100, .22);--gemboss-hover: rgba(242, 236, 223, .07);--gemboss-primary: #d9b464;--gemboss-primary-dark: #e9cb84;--gemboss-on-primary: #17120a;--gemboss-primary-soft: rgba(214, 178, 100, .14);--gemboss-accent: #e2c27c;--gemboss-accent-strong: #ebd096;--gemboss-accent-soft: rgba(214, 178, 100, .14);--gemboss-accent-wash: rgba(214, 178, 100, .06);--gemboss-accent-tint: rgba(214, 178, 100, .2);--gemboss-success-strong: #8fd9b6;--gemboss-success-soft: rgba(143, 217, 182, .12);--ui-surface: #1b1813;--ui-surface-2: rgba(242, 236, 223, .06);--ui-text: #f2ecdf;--ui-text-muted: #a99f8b;--ui-border: rgba(214, 178, 100, .22);--ui-series-1: #e2c27c;--ui-success-fg: #8fd9b6;--ui-danger-fg: #f0a39a;--ui-focus: #e9cb84;color:#f2ecdf;border-color:#d6b2644d}.gb-dock--plus .gemboss-ec-msg.user .gemboss-ec-bubble{background:#2b2519;color:#f6ecd4}.gb-dock--plus .gemboss-ec-input{background:#17140f;border-color:#d6b26466}.gb-dock--plus .gemboss-ec-cta-btn.primary{color:#17120a;background:linear-gradient(135deg,#f3d891,#c99a3e 55%,#ecd08a);--gemboss-ec-cta-glow: 0 4px 14px rgba(201, 154, 62, .28);box-shadow:var(--gemboss-ec-cta-glow)}.gb-dock--plus .gb-dock-header .ui-seg :is(button,a)[aria-pressed=true],.gb-dock--plus .gb-dock-header .ui-seg :is(button,a).active{background:#d6b2642e;color:#f3d891;box-shadow:none}.ui-btn.gb-plus-btn{color:#1a1408;border-color:transparent;background:linear-gradient(135deg,#f3d891,#c99a3e 55%,#ecd08a);box-shadow:0 2px 10px #c99a3e47}@media (hover: hover){.ui-btn.gb-plus-btn:hover{color:#1a1408;background:linear-gradient(135deg,#f6de9c,#cfa247 55%,#efd593)}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(L){"use strict";var B=L.gembossUI;if(!B||B.assistantWindow)return;var T=360,D=480,U=460,X=24,w=8,K=32,Y=68,q=16;function N(e,n,a){return Math.min(Math.max(e,n),Math.max(n,a))}function O(e,n,a){var d=Math.round(Math.min(Math.max(e.w,T),Math.max(1,n-2*w))),c=Math.round(Math.min(Math.max(e.h,D),Math.max(1,a-2*w)));return{x:Math.round(N(e.x,w,n-w-d)),y:Math.round(N(e.y,w,a-w-c)),w:d,h:c}}function z(e,n,a){return O(e||{x:n-X-U,y:Y,w:U,h:a-Y-X},n,a)}function H(e,n,a,d,c){return O({x:e.x+n,y:e.y+a,w:e.w,h:e.h},d,c)}function P(e,n,a,d,c,f){var g=e.x+e.w,y=e.y+e.h,b=e.x,E=e.y,h=e.w,v=e.h;return n.indexOf("e")>=0&&(h=N(e.w+a,T,c-w-e.x)),n.indexOf("w")>=0&&(h=N(e.w-a,T,g-w),b=g-h),n.indexOf("s")>=0&&(v=N(e.h+d,D,f-w-e.y)),n.indexOf("n")>=0&&(v=N(e.h-d,D,y-w),E=y-v),O({x:b,y:E,w:h,h:v},c,f)}function F(e,n,a,d,c){return d&&e<=Math.max(K,a)?"left":c&&e>=n-K?"side":null}function G(e){if(!e)return null;var n=String(e).split(",").map(Number);return n.length!==4||!n.every(isFinite)||n[2]<=0||n[3]<=0?null:{x:n[0],y:n[1],w:n[2],h:n[3]}}function j(e){return[e.x,e.y,e.w,e.h].map(Math.round).join(",")}function W(){var e=document.documentElement;return{vw:e.clientWidth||L.innerWidth,vh:e.clientHeight||L.innerHeight}}var V={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",windowHeaderTitle:"Drag this bar to move the window",dropLeft:"Release to dock on the left",dropSide:"Release to dock on the right"},Q="(pointer: coarse), (max-width: 47.9975em)";function $(e,n,a,d,c,f,g,y,b,E){var h={shell:e,L:n,state:a,render:d,openLeft:f,openSide:g,setDragging:y,offs:b,asked:function(){return k}},v=function(){try{return L.localStorage}catch{return null}},p=L.matchMedia?L.matchMedia(Q):null,k=null,l=null,A=function(){h.render()};p&&(p.addEventListener?p.addEventListener("change",A):p.addListener(A),h.offs.push(function(){p.removeEventListener?p.removeEventListener("change",A):p.removeListener(A)}));var M={on:function(){return!!p&&!p.matches},dress:function(t,i){if(M.stop(),i&&te(i),!(t!=="dock"||!M.on())){l=ie(h,M.set);var o=e.querySelector(":scope > .gb-dock-grip");o&&e.removeChild(o),l.handles.forEach(function(r){e.insertBefore(r,i)}),i.insertBefore(l.grip,i.firstChild),i.title=l.title,l.header(i)}},paint:function(){return l?(e.classList.add("gb-dock-window"),e.classList.toggle("gb-dock-moving",l.moving()),l.paint(),!0):(["left","top","width"].forEach(function(t){h.shell.style.removeProperty(t)}),!1)},set:function(t){k={x:Math.round(t.x),y:Math.round(t.y),w:Math.round(t.w),h:Math.round(t.h)},l&&l.paint();try{v().setItem(c,j(k))}catch{}},stop:function(){l&&l.stop(),l=null}},C=!1,I=function(){l&&l.paint()};L.addEventListener("resize",I),b.push(function(){C=!0,L.removeEventListener("resize",I)},M.stop),E.setWindow=M.set;try{k=G(v().getItem(c))}catch{k=null}return Promise.resolve().then(function(){C||h.render()}),M}var ee={grip:'<circle cx="7.5" cy="5" r="1"/><circle cx="12.5" cy="5" r="1"/><circle cx="7.5" cy="10" r="1"/><circle cx="12.5" cy="10" r="1"/><circle cx="7.5" cy="15" r="1"/><circle cx="12.5" cy="15" r="1"/>',panelRight:'<rect x="3" y="3.5" width="14" height="13" rx="2"/><path d="M12.5 3.5v13"/>',panelLeft:'<rect x="3" y="3.5" width="14" height="13" rx="2"/><path d="M7.5 3.5v13"/>',popup:'<rect x="3" y="3.5" width="14" height="13" rx="2"/><rect x="9" y="8.5" width="5.5" height="5.5" rx="1"/>',expand:'<path d="M11 9l5-5M16 4h-3.5M16 4v3.5M9 11l-5 5M4 16h3.5M4 16v-3.5"/>'};function Z(e){var n=document.createElement("template");return n.innerHTML='<svg viewBox="0 0 20 20" width="16" height="16" aria-hidden="true" focusable="false"><g fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">'+ee[e]+"</g></svg>",n.content.firstChild}function te(e){var n=e.querySelectorAll(".gb-dock-place"),a=n.length;[].forEach.call(n,function(d,c){var f=document.createElement("span");f.className="ui-menu__icon",f.setAttribute("aria-hidden","true"),f.appendChild(Z(d.classList.contains("gb-dock-place-side")?"panelRight":d.classList.contains("gb-dock-place-left")?"panelLeft":c===a-1?"expand":"popup")),d.insertBefore(f,d.firstChild)})}var ne={n:"gb-dock-rs gb-dock-rs-n",s:"gb-dock-rs gb-dock-rs-s",e:"gb-dock-rs gb-dock-rs-e",w:"gb-dock-rs gb-dock-rs-w",ne:"gb-dock-rs gb-dock-rs-ne",nw:"gb-dock-rs gb-dock-rs-nw",sw:"gb-dock-rs gb-dock-rs-sw"},re={left:"gb-dock-drop gb-dock-drop-left",side:"gb-dock-drop gb-dock-drop-side"},J={left:"gb-dock-edgehint gb-dock-edgehint-left",side:"gb-dock-edgehint gb-dock-edgehint-side"};function S(e,n){var a=document.createElement(e);for(var d in n)n[d]!==null&&n[d]!==void 0&&(d==="className"?a.className=n[d]:a.setAttribute(d,n[d]));return a}function ie(e,n){var a=null,d=null,c=!1,f=[],g=function(t){return e.L[t]||V[t]};function y(){var t=W();return d||z(e.asked(),t.vw,t.vh)}function b(t){var i=e.shell.style;i.left=t.x+"px",i.top=t.y+"px",i.width=t.w+"px",i.height=t.h+"px"}function E(){f.forEach(function(t){t.parentNode&&t.parentNode.removeChild(t)}),f=[]}function h(t,i){E();var o=e.state(),r=e.shell.nextSibling,s=e.shell.parentNode,u=function(_){f.push(_),s.insertBefore(_,r)};if(s){if(o.leftAllowed&&t!=="left"){var m=S("div",{className:J.left,"aria-hidden":"true"});m.style.left=i+"px",u(m)}if(o.sideAllowed&&t!=="side"&&u(S("div",{className:J.side,"aria-hidden":"true"})),t){var x=S("div",{className:re[t],"aria-hidden":"true"});t==="left"&&(x.style.left=i+"px"),x.style.width=o.sideWidth+"px";var R=document.createElement("span");R.textContent=g(t==="left"?"dropLeft":"dropSide"),x.appendChild(R),u(x)}}}function v(t,i){if(a=null,d=null,c=!1,E(),e.setDragging(!1),e.shell.classList.remove("gb-dock-moving"),t&&i!==void 0)try{t.releasePointerCapture(i)}catch{}b(y())}function p(t,i,o,r){if(t.button!==0||t.pointerType==="mouse"&&t.ctrlKey)return!1;i.setPointerCapture(t.pointerId);var s=document.querySelector(".gemboss-platform-main"),u=W();return a={kind:o,edge:r,id:t.pointerId,px:t.clientX,py:t.clientY,start:y(),moved:!1,left:Math.max(0,Math.round(s?s.getBoundingClientRect().left:0)),vw:u.vw,vh:u.vh},!0}function k(t,i){t.addEventListener("pointerdown",i),t.addEventListener("pointermove",function(o){var r=a;if(!(!r||o.pointerId!==r.id)){if(o.pointerType==="mouse"&&o.buttons===0){v(t,o.pointerId);return}var s=o.clientX-r.px,u=o.clientY-r.py,m=r;if(!(!r.moved&&Math.abs(s)<4&&Math.abs(u)<4)){if(r.moved||(r.moved=!0,e.setDragging(!0),r.kind==="move"&&(c=!0,e.shell.classList.add("gb-dock-moving"))),r.kind==="move"){d=H(r.start,s,u,m.vw,m.vh);var x=e.state();h(F(o.clientX,m.vw,r.left,x.leftAllowed,x.sideAllowed),r.left)}else d=P(r.start,r.edge,s,u,m.vw,m.vh);b(d)}}}),t.addEventListener("pointerup",function(o){var r=a;if(!(!r||o.pointerId!==r.id)){var s=r,u=e.state(),m=o.clientX-r.px,x=o.clientY-r.py,R=r.moved&&r.kind==="move"?F(o.clientX,s.vw,r.left,u.leftAllowed,u.sideAllowed):null,_=r.moved?r.kind==="move"?H(r.start,m,x,s.vw,s.vh):P(r.start,r.edge,m,x,s.vw,s.vh):null;v(t,o.pointerId),R==="left"?e.openLeft():R==="side"?e.openSide():_&&n(_)}}),t.addEventListener("pointercancel",function(o){a&&o.pointerId===a.id&&v(t,o.pointerId)}),t.addEventListener("lostpointercapture",function(){a&&v()})}function l(t,i){t.addEventListener("keydown",function(o){if(!(o.altKey||o.metaKey||o.ctrlKey)){var r=o.shiftKey?q*4:q,s={ArrowLeft:[-r,0],ArrowRight:[r,0],ArrowUp:[0,-r],ArrowDown:[0,r]}[o.key];if(s){o.preventDefault();var u=W();n(i(y(),s[0],s[1],u.vw,u.vh))}}})}var A=S("button",{type:"button",className:"gb-dock-move","aria-label":g("windowMove"),title:g("windowMove")});A.appendChild(Z("grip")),l(A,H);var M=function(t){p(t,t.currentTarget,"resize",t.currentTarget.getAttribute("data-edge"))&&t.preventDefault()},C=["n","s","e","w","ne","nw","sw"].map(function(t){var i=S("div",{className:ne[t],"data-edge":t,"aria-hidden":"true"});return k(i,M),i}),I=S("button",{type:"button",className:"gb-dock-rs gb-dock-rs-se","data-edge":"se","aria-label":g("windowResize"),title:g("windowResize")});return k(I,M),l(I,function(t,i,o,r,s){return P(t,"se",i,o,r,s)}),C.push(I),{grip:A,handles:C,rect:y,paint:function(){b(y())},title:g("windowHeaderTitle"),moving:function(){return c},header:function(t){k(t,function(i){i.target.closest&&i.target.closest("button:not(.gb-dock-move), details, a, input, textarea, select")||p(i,t,"move","se")&&i.preventDefault()})},stop:function(){a&&v(),E()}}}B.assistantWindow={OFF_QUERY:Q,MIN_W:T,MIN_H:D,place:z,fit:O,move:H,resize:P,zoneAt:F,parse:G,format:j,viewport:W,frame:$}})(typeof globalThis<"u"?globalThis:this);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.gb-dock.gb-dock-window{right:auto;bottom:auto;border-bottom:1px solid var(--gemboss-divider);border-radius:12px;overflow:visible}.gb-dock-window>.gb-dock-body{overflow:hidden;border-radius:0 0 11px 11px}.gb-dock-window .gb-dock-header{padding-left:6px}.gb-dock-window .gb-dock-status{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}.gb-dock-moving,.gb-dock-moving .gb-dock-header{cursor:grabbing}.gb-dock-move{flex:0 0 auto;width:28px;height:28px;display:grid;place-items:center;padding:0;border:0;border-radius:6px;background:transparent;color:var(--gemboss-text-muted);cursor:grab;touch-action:none}.gb-dock-move svg{width:16px;height:16px}@media (hover: hover){.gb-dock-move:hover{background:var(--gemboss-hover);color:var(--gemboss-text-strong)}}.gb-dock-move:active,.gb-dock-moving .gb-dock-move{cursor:grabbing;background:var(--gemboss-hover);color:var(--gemboss-accent-strong)}.gb-dock-move:focus-visible{outline:2px solid var(--ui-focus, #5661f5);outline-offset:-2px}.gb-dock-rs{position:absolute;z-index:4;touch-action:none}.gb-dock-rs-n,.gb-dock-rs-s{left:12px;right:12px;height:8px;cursor:ns-resize}.gb-dock-rs-n{top:-4px}.gb-dock-rs-s{bottom:-4px}.gb-dock-rs-e,.gb-dock-rs-w{top:12px;bottom:12px;width:8px;cursor:ew-resize}.gb-dock-rs-e{right:-4px}.gb-dock-rs-w{left:-4px}.gb-dock-rs-nw,.gb-dock-rs-ne,.gb-dock-rs-sw{width:16px;height:16px}.gb-dock-rs-nw{top:-4px;left:-4px;cursor:nwse-resize}.gb-dock-rs-ne{top:-4px;right:-4px;cursor:nesw-resize}.gb-dock-rs-sw{bottom:-4px;left:-4px;cursor:nesw-resize}.gb-dock-rs-se{right:-12px;bottom:-12px;width:24px;height:24px;padding:0;border:0;border-radius:6px;background:transparent;color:var(--gemboss-text-muted);opacity:.7;cursor:nwse-resize}.gb-dock-rs-se:after{content:"";position:absolute;right:17px;bottom:17px;width:9px;height:9px;pointer-events:none;background:linear-gradient(135deg,transparent 55%,currentColor 55% 61%,transparent 61% 72%,currentColor 72% 78%,transparent 78%)}@media (hover: hover){.gb-dock-rs-se:hover{color:var(--gemboss-text-strong);opacity:1}}.gb-dock-rs-se:active{color:var(--gemboss-accent-strong);opacity:1}.gb-dock-rs-se:focus-visible{outline:2px solid var(--ui-focus, #5661f5);outline-offset:0;opacity:1}.gb-dock-drop,.gb-dock-edgehint{position:fixed;z-index:310;top:56px;bottom:0;pointer-events:none;box-sizing:border-box}.gb-dock-edgehint{width:12px;background:color-mix(in srgb,var(--gemboss-accent-strong) 18%,transparent)}.gb-dock-edgehint-left,.gb-dock-drop-left{left:0}.gb-dock-edgehint-side{right:0}.gb-dock-drop{display:grid;place-items:end center;padding-bottom:40px;border:2px dashed var(--gemboss-accent-strong);background:color-mix(in srgb,var(--gemboss-accent-strong) 12%,transparent);animation:gb-dock-drop-in .12s ease-out}.gb-dock-drop-side{right:0}.gb-dock-drop>span{padding:8px 12px;border-radius:8px;background:var(--gemboss-accent-strong);color:var(--gemboss-on-primary, #fff);font-size:14px;font-weight:600;line-height:20px}@keyframes gb-dock-drop-in{0%{opacity:0}to{opacity:1}}@media (prefers-reduced-motion: reduce){.gb-dock-drop{animation:none}}
|