@burdenoff/fe-libs 2026.1113.9 → 2026.1113.11
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/dist/shared/assistant/index.d.ts +4 -0
- package/dist/shared/assistant/ui/AIAssistantPanel.d.ts +7 -0
- package/dist/shared/assistant/ui/AIAssistantPanel.js +278 -250
- package/dist/shared/assistant/ui/AssistantChatArea.js +1243 -1241
- package/dist/shared/assistant/ui/AssistantConversationList.js +253 -252
- package/dist/shared/assistant/ui/AssistantHeader.d.ts +2 -1
- package/dist/shared/assistant/ui/AssistantHeader.js +1 -1
- package/dist/shared/assistant/ui/AssistantMessageList.js +48 -47
- package/dist/shared/assistant/ui/AssistantOverlay.d.ts +46 -2
- package/dist/shared/assistant/ui/AssistantOverlay.js +359 -307
- package/dist/shared/assistant/ui/AssistantPageHost.d.ts +11 -0
- package/dist/shared/assistant/ui/AssistantPageHost.js +17 -0
- package/dist/shared/assistant/ui/assistantPageLayout.d.ts +13 -0
- package/dist/shared/assistant/ui/assistantPageLayout.js +8 -0
- package/dist/shared/assistant/ui/assistantPageSurface.d.ts +11 -0
- package/dist/shared/assistant/ui/assistantPageSurface.js +10 -0
- package/dist/shared/assistant/ui/avatar/AssistantCompactAvatar.d.ts +6 -0
- package/dist/shared/assistant/ui/avatar/AssistantCompactAvatar.js +77 -71
- package/dist/shared/assistant/ui/compact/AssistantCompactHeader.d.ts +2 -1
- package/dist/shared/assistant/ui/compact/AssistantCompactHeader.js +2 -2
- package/dist/shared/assistant/ui/compact/AssistantMenuView.d.ts +5 -2
- package/dist/shared/assistant/ui/compact/AssistantMenuView.js +132 -131
- package/dist/shared/assistant/ui/compact/AssistantPageBar.d.ts +13 -0
- package/dist/shared/assistant/ui/compact/AssistantPageBar.js +46 -0
- package/dist/shared/assistant/ui/compact/AssistantViewSwitch.d.ts +5 -0
- package/dist/shared/assistant/ui/compact/AssistantViewSwitch.js +11 -11
- package/dist/shared/assistant/ui/composer/AssistantCompactFooter.js +15 -11
- package/dist/shared/assistant/ui/composer/AssistantComposer.js +258 -257
- package/dist/shared-assistant.js +71 -67
- package/package.json +1 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface AssistantPageHostProps {
|
|
3
|
+
/** Size and place the host; the panel fills it. */
|
|
4
|
+
className?: string;
|
|
5
|
+
/**
|
|
6
|
+
* Rendered instead when nothing can be hosted here: no overlay provider above,
|
|
7
|
+
* or one without `pageSurface`. Default: nothing.
|
|
8
|
+
*/
|
|
9
|
+
fallback?: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
export declare function AssistantPageHost({ className, fallback }: AssistantPageHostProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { cn as e } from "../../../shared-utils.js";
|
|
2
|
+
import { useAssistantOverlayOrNull as t } from "./AssistantOverlay.js";
|
|
3
|
+
import { useCallback as n } from "react";
|
|
4
|
+
import { Fragment as r, jsx as i } from "react/jsx-runtime";
|
|
5
|
+
// src/shared/assistant/ui/AssistantPageHost.tsx
|
|
6
|
+
function a({ className: a, fallback: o = null }) {
|
|
7
|
+
let s = t()?.registerPageHost, c = n((e) => {
|
|
8
|
+
if (e && s) return s(e);
|
|
9
|
+
}, [s]);
|
|
10
|
+
return s ? /* @__PURE__ */ i("div", {
|
|
11
|
+
ref: c,
|
|
12
|
+
className: e("flex min-h-0 flex-col", a),
|
|
13
|
+
"data-testid": "assistant-page-host",
|
|
14
|
+
"data-assistant-page-host": ""
|
|
15
|
+
}) : /* @__PURE__ */ i(r, { children: o });
|
|
16
|
+
}
|
|
17
|
+
export { a as AssistantPageHost };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const AssistantPageLayoutContext: import('react').Context<boolean>;
|
|
2
|
+
/** True inside a panel laid out as a page. */
|
|
3
|
+
export declare function useAssistantPageLayout(): boolean;
|
|
4
|
+
/** The page's one column (48rem), for an element that sits in it. */
|
|
5
|
+
export declare const PAGE_COLUMN = "mx-auto w-full max-w-[48rem]";
|
|
6
|
+
/**
|
|
7
|
+
* Side padding that centres a full-width scroll box's content in the column,
|
|
8
|
+
* so the scrollbar stays at the page's edge. 46.5rem: the column less the
|
|
9
|
+
* message box's own 0.75rem sides, so the messages line up with the box.
|
|
10
|
+
*/
|
|
11
|
+
export declare const PAGE_SCROLL_GUTTER = "px-[max(0.75rem,calc((100%_-_46.5rem)/2))]";
|
|
12
|
+
/** The same, for a full-surface view (☰, history, the Avatar view): its content in the column. */
|
|
13
|
+
export declare const PAGE_VIEW_GUTTER = "px-[max(0rem,calc((100%_-_48rem)/2))]";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createContext as e, useContext as t } from "react";
|
|
2
|
+
// src/shared/assistant/ui/assistantPageLayout.ts
|
|
3
|
+
var n = e(!1);
|
|
4
|
+
function r() {
|
|
5
|
+
return t(n);
|
|
6
|
+
}
|
|
7
|
+
var i = "mx-auto w-full max-w-[48rem]", a = "px-[max(0.75rem,calc((100%_-_46.5rem)/2))]", o = "px-[max(0rem,calc((100%_-_48rem)/2))]";
|
|
8
|
+
export { n as AssistantPageLayoutContext, i as PAGE_COLUMN, a as PAGE_SCROLL_GUTTER, o as PAGE_VIEW_GUTTER, r as useAssistantPageLayout };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface AssistantPageSurfaceState {
|
|
2
|
+
/**
|
|
3
|
+
* A page can host the assistant: an overlay provider with `pageSurface` is
|
|
4
|
+
* above. False: `AssistantPageHost` renders its fallback, and a page opens
|
|
5
|
+
* the side panel instead (`useAssistantOverlayOrNull()?.openFull()`).
|
|
6
|
+
*/
|
|
7
|
+
available: boolean;
|
|
8
|
+
/** A page is hosting the assistant now. */
|
|
9
|
+
hosted: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function useAssistantPageSurface(): AssistantPageSurfaceState;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useAssistantOverlayOrNull as e } from "./AssistantOverlay.js";
|
|
2
|
+
// src/shared/assistant/ui/assistantPageSurface.ts
|
|
3
|
+
function t() {
|
|
4
|
+
let t = e();
|
|
5
|
+
return {
|
|
6
|
+
available: t?.registerPageHost !== void 0,
|
|
7
|
+
hosted: t?.pageHosted === !0
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export { t as useAssistantPageSurface };
|
|
@@ -17,5 +17,11 @@ export interface AssistantCompactAvatarProps {
|
|
|
17
17
|
readonly ask?: AvatarTabAsk;
|
|
18
18
|
/** The one-line footer (the standing disclaimer), the chat area's own. */
|
|
19
19
|
readonly footer: ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* BOFF-13461: laid out as a page, where the Chat | Avatar switch is the page bar's (one instance, outside this view). This view then
|
|
22
|
+
* shows no switch of its own (its row stays, empty, for the voice strip's clearance), focus that has nowhere else to go goes to the
|
|
23
|
+
* bar's Avatar segment, and its content sits in the page's column.
|
|
24
|
+
*/
|
|
25
|
+
readonly switchInBar?: boolean;
|
|
20
26
|
}
|
|
21
27
|
export declare const AssistantCompactAvatar: FC<AssistantCompactAvatarProps>;
|
|
@@ -7,114 +7,120 @@ import { clearReplyRequests as a } from "../../speech/replySpeechRequests.js";
|
|
|
7
7
|
import { AvatarCompactAskBox as o } from "./AvatarCompactAskBox.js";
|
|
8
8
|
import { AvatarTabLastExchange as s } from "./AvatarTabLastExchange.js";
|
|
9
9
|
import { useAvatarTabExchange as c } from "./avatarTabExchange.js";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
10
|
+
import { PAGE_VIEW_GUTTER as l } from "../assistantPageLayout.js";
|
|
11
|
+
import { useEffect as u, useLayoutEffect as d, useRef as f, useState as p } from "react";
|
|
12
|
+
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
12
13
|
// src/shared/assistant/ui/avatar/AssistantCompactAvatar.tsx
|
|
13
|
-
var
|
|
14
|
-
function
|
|
14
|
+
var g = /* @__PURE__ */ new WeakMap();
|
|
15
|
+
function _() {
|
|
15
16
|
if (typeof document > "u") return !1;
|
|
16
17
|
let e = document.activeElement;
|
|
17
18
|
return e === null || e === document.body || !e.isConnected || e.hasAttribute("data-assistant-panel");
|
|
18
19
|
}
|
|
19
|
-
var
|
|
20
|
+
var v = ({ state: e, restored: t }) => {
|
|
20
21
|
let n = i(), r = e === "thinking" ? n.askThinking : e === "not-spoken" ? n.askNotSpoken : e === "cut" ? n.askCut : e === "not-heard" ? n.askNotHeard : e === "failed" ? t ? n.askFailed : n.askFailedInChat : "";
|
|
21
|
-
return /* @__PURE__ */
|
|
22
|
+
return /* @__PURE__ */ m("p", {
|
|
22
23
|
className: "sr-only",
|
|
23
24
|
"aria-live": "polite",
|
|
24
25
|
"aria-atomic": "true",
|
|
25
26
|
"data-testid": "assistant-avatar-tab-ask-live",
|
|
26
27
|
children: r
|
|
27
28
|
});
|
|
28
|
-
},
|
|
29
|
-
let
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
(
|
|
29
|
+
}, y = ({ tab: i, CompactView: y, ids: b, compact: x, shown: S, voice: C, mute: w, ask: T, footer: E, switchInBar: D = !1 }) => {
|
|
30
|
+
let O = f(null), k = f(null), A = e(), j = x.surface === "window", M = n(b);
|
|
31
|
+
d(() => (g.set(i, (g.get(i) ?? 0) + 1), i.setOpen(!0, { compact: !0 }), () => {
|
|
32
|
+
g.set(i, (g.get(i) ?? 1) - 1), queueMicrotask(() => {
|
|
33
|
+
(g.get(i) ?? 0) > 0 || (i.setOpen(!1), a());
|
|
33
34
|
});
|
|
34
35
|
}), [i]);
|
|
35
|
-
let
|
|
36
|
-
l(() => {
|
|
37
|
-
N.current !== M && (N.current = M, (E.current ?? j.current ?? document.getElementById(A.avatarTab))?.focus({ preventScroll: !0 }));
|
|
38
|
-
}, [M, A.avatarTab]);
|
|
39
|
-
let P = d(S.live);
|
|
40
|
-
l(() => {
|
|
41
|
-
let e = P.current;
|
|
42
|
-
P.current = S.live, e && !S.live && g() && (D.current ?? E.current)?.focus();
|
|
43
|
-
}, [S.live]);
|
|
44
|
-
let F = c(w?.last ?? null, w?.navigatingReplyId ?? null), I = S.live ? void 0 : w, [L, R] = f(null), z = F?.state === "failed" ? F.exchange.replyId : null, B = F?.question ?? "", V = w?.draft;
|
|
36
|
+
let N = f(null), P = x.focusRequest ?? 0, F = f(P);
|
|
45
37
|
u(() => {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
38
|
+
F.current !== P && (F.current = P, (O.current ?? N.current ?? document.getElementById(D ? b.avatarTab : M.avatarTab))?.focus({ preventScroll: !0 }));
|
|
39
|
+
}, [
|
|
40
|
+
P,
|
|
41
|
+
M.avatarTab,
|
|
42
|
+
b.avatarTab,
|
|
43
|
+
D
|
|
44
|
+
]);
|
|
45
|
+
let I = f(C.live);
|
|
46
|
+
u(() => {
|
|
47
|
+
let e = I.current;
|
|
48
|
+
I.current = C.live, e && !C.live && _() && (k.current ?? O.current)?.focus();
|
|
49
|
+
}, [C.live]);
|
|
50
|
+
let L = c(T?.last ?? null, T?.navigatingReplyId ?? null), R = C.live ? void 0 : T, [z, B] = p(null), V = L?.state === "failed" ? L.exchange.replyId : null, H = L?.question ?? "", U = T?.draft;
|
|
51
|
+
d(() => {
|
|
52
|
+
if (V === null || U === void 0 || z?.replyId === V) return;
|
|
53
|
+
let e = U.get().trim() === "";
|
|
54
|
+
e && U.set(H), B({
|
|
55
|
+
replyId: V,
|
|
50
56
|
restored: e
|
|
51
57
|
});
|
|
52
58
|
}, [
|
|
53
|
-
z,
|
|
54
|
-
B,
|
|
55
59
|
V,
|
|
56
|
-
|
|
60
|
+
H,
|
|
61
|
+
U,
|
|
62
|
+
z
|
|
57
63
|
]);
|
|
58
|
-
let
|
|
59
|
-
...
|
|
60
|
-
...
|
|
61
|
-
open:
|
|
62
|
-
toggle: () =>
|
|
64
|
+
let W = z === null || z.replyId !== V || z.restored, [G, K] = p(null), q = G ?? !j, J = {
|
|
65
|
+
...w ? { mute: w } : {},
|
|
66
|
+
...R ? { transcript: {
|
|
67
|
+
open: q,
|
|
68
|
+
toggle: () => K(!q)
|
|
63
69
|
} } : {}
|
|
64
70
|
};
|
|
65
|
-
return /* @__PURE__ */
|
|
66
|
-
className: `absolute inset-0 z-[5] flex flex-col ${
|
|
71
|
+
return /* @__PURE__ */ h("div", {
|
|
72
|
+
className: `absolute inset-0 z-[5] flex flex-col ${j ? "bg-bg-elevated" : "bg-bg-surface"}${D ? ` ${l}` : ""}`,
|
|
67
73
|
"data-testid": "assistant-avatar-tab",
|
|
68
74
|
"data-presentation": "compact",
|
|
69
|
-
"data-surface":
|
|
75
|
+
"data-surface": x.surface,
|
|
70
76
|
children: [
|
|
71
|
-
/* @__PURE__ */
|
|
77
|
+
/* @__PURE__ */ h("div", {
|
|
72
78
|
role: "tabpanel",
|
|
73
|
-
id:
|
|
74
|
-
"aria-labelledby":
|
|
79
|
+
id: b.avatarPanel,
|
|
80
|
+
"aria-labelledby": D ? b.avatarTab : M.avatarTab,
|
|
75
81
|
className: "flex min-h-0 flex-1 flex-col",
|
|
76
82
|
"data-testid": "assistant-avatar-tab-column",
|
|
77
|
-
children: [/* @__PURE__ */
|
|
78
|
-
shown:
|
|
79
|
-
voice:
|
|
80
|
-
leaveHintId:
|
|
81
|
-
surface:
|
|
82
|
-
onOpenSettings:
|
|
83
|
-
navigate:
|
|
84
|
-
controls:
|
|
85
|
-
switchRef:
|
|
86
|
-
}),
|
|
83
|
+
children: [/* @__PURE__ */ m(y, {
|
|
84
|
+
shown: S,
|
|
85
|
+
voice: C,
|
|
86
|
+
leaveHintId: b.leaveHint,
|
|
87
|
+
surface: x.surface,
|
|
88
|
+
onOpenSettings: x.openSettings,
|
|
89
|
+
navigate: A,
|
|
90
|
+
controls: J,
|
|
91
|
+
switchRef: N
|
|
92
|
+
}), R && q ? /* @__PURE__ */ m("div", {
|
|
87
93
|
className: "max-h-[40%] shrink-0 overflow-y-auto px-4 pb-1",
|
|
88
|
-
children: /* @__PURE__ */
|
|
89
|
-
view:
|
|
94
|
+
children: /* @__PURE__ */ m(s, {
|
|
95
|
+
view: L,
|
|
90
96
|
invite: !1,
|
|
91
|
-
restored:
|
|
92
|
-
focusAfterStop:
|
|
93
|
-
},
|
|
97
|
+
restored: W,
|
|
98
|
+
focusAfterStop: O
|
|
99
|
+
}, L?.exchange.replyId ?? "none")
|
|
94
100
|
}) : null]
|
|
95
101
|
}),
|
|
96
|
-
/* @__PURE__ */
|
|
97
|
-
voiceLive:
|
|
98
|
-
children: /* @__PURE__ */
|
|
99
|
-
selected:
|
|
100
|
-
onSelect:
|
|
101
|
-
ids:
|
|
102
|
+
/* @__PURE__ */ m(r, {
|
|
103
|
+
voiceLive: C.live,
|
|
104
|
+
children: D ? null : /* @__PURE__ */ m(t, {
|
|
105
|
+
selected: x.view,
|
|
106
|
+
onSelect: x.selectView,
|
|
107
|
+
ids: b,
|
|
102
108
|
instance: "avatar"
|
|
103
109
|
})
|
|
104
110
|
}),
|
|
105
|
-
|
|
106
|
-
ask:
|
|
107
|
-
inputRef:
|
|
108
|
-
voice:
|
|
109
|
-
waveRef:
|
|
110
|
-
windowSurface:
|
|
111
|
+
R ? /* @__PURE__ */ m(o, {
|
|
112
|
+
ask: R,
|
|
113
|
+
inputRef: O,
|
|
114
|
+
voice: C,
|
|
115
|
+
waveRef: k,
|
|
116
|
+
windowSurface: j
|
|
111
117
|
}) : null,
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
state:
|
|
115
|
-
restored:
|
|
118
|
+
E,
|
|
119
|
+
T ? /* @__PURE__ */ m(v, {
|
|
120
|
+
state: L?.state ?? null,
|
|
121
|
+
restored: W
|
|
116
122
|
}) : null
|
|
117
123
|
]
|
|
118
124
|
});
|
|
119
125
|
};
|
|
120
|
-
export {
|
|
126
|
+
export { y as AssistantCompactAvatar };
|
|
@@ -16,7 +16,8 @@ export interface AssistantCompactHeaderProps {
|
|
|
16
16
|
onToggleExpanded: () => void;
|
|
17
17
|
onTogglePreview?: () => void;
|
|
18
18
|
previewOpen?: boolean;
|
|
19
|
-
|
|
19
|
+
/** Absent (a page hosts the panel, BOFF-13461): no Close button. */
|
|
20
|
+
onClose?: () => void;
|
|
20
21
|
}
|
|
21
22
|
/**
|
|
22
23
|
* The compact presentation's header (BOFF-10177, Slice 2):
|
|
@@ -71,7 +71,7 @@ var p = "flex size-10 shrink-0 items-center justify-center rounded-button transi
|
|
|
71
71
|
"aria-hidden": "true"
|
|
72
72
|
})
|
|
73
73
|
}) : null,
|
|
74
|
-
/* @__PURE__ */ d("button", {
|
|
74
|
+
D ? /* @__PURE__ */ d("button", {
|
|
75
75
|
type: "button",
|
|
76
76
|
onClick: D,
|
|
77
77
|
className: `${p} ${m}`,
|
|
@@ -81,7 +81,7 @@ var p = "flex size-10 shrink-0 items-center justify-center rounded-button transi
|
|
|
81
81
|
className: "size-5",
|
|
82
82
|
"aria-hidden": "true"
|
|
83
83
|
})
|
|
84
|
-
})
|
|
84
|
+
}) : null
|
|
85
85
|
]
|
|
86
86
|
});
|
|
87
87
|
};
|
|
@@ -5,8 +5,11 @@ export interface AssistantMenuViewProps {
|
|
|
5
5
|
id: string;
|
|
6
6
|
/** Back to the conversation (Back, or Escape from the list). */
|
|
7
7
|
onClose: () => void;
|
|
8
|
-
/**
|
|
9
|
-
|
|
8
|
+
/**
|
|
9
|
+
* The × of the view: closes the assistant, through the panel's close request (N1).
|
|
10
|
+
* Absent (a page hosts the panel, BOFF-13461): no ×.
|
|
11
|
+
*/
|
|
12
|
+
onRequestClosePanel?: () => void;
|
|
10
13
|
/** New conversation: the panel creates it, closes this view and focuses the message box. */
|
|
11
14
|
onNewConversation: () => void;
|
|
12
15
|
/** Absent: no offered avatar settings. The factory's stable view shares its tab's controller. */
|