@burdenoff/fe-libs 2026.1029.8 → 2026.1029.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/shared/assistant/i18nManifest.d.ts +27 -0
  2. package/dist/shared/assistant/i18nManifest.js +27 -0
  3. package/dist/shared/assistant/index.d.ts +9 -0
  4. package/dist/shared/assistant/speech/speechFeed.d.ts +4 -3
  5. package/dist/shared/assistant/speech/speechFeed.js +3 -2
  6. package/dist/shared/assistant/ui/AIAssistantPanel.d.ts +11 -0
  7. package/dist/shared/assistant/ui/AIAssistantPanel.js +233 -127
  8. package/dist/shared/assistant/ui/AssistantChatArea.d.ts +13 -1
  9. package/dist/shared/assistant/ui/AssistantChatArea.js +1632 -1605
  10. package/dist/shared/assistant/ui/AssistantConversationList.d.ts +17 -1
  11. package/dist/shared/assistant/ui/AssistantConversationList.js +304 -274
  12. package/dist/shared/assistant/ui/AssistantOverlay.d.ts +11 -0
  13. package/dist/shared/assistant/ui/AssistantOverlay.js +106 -90
  14. package/dist/shared/assistant/ui/AssistantSpeechProvider.js +140 -137
  15. package/dist/shared/assistant/ui/closeGuard.d.ts +21 -0
  16. package/dist/shared/assistant/ui/closeGuard.js +8 -0
  17. package/dist/shared/assistant/ui/compact/AssistantCompactHeader.d.ts +38 -0
  18. package/dist/shared/assistant/ui/compact/AssistantCompactHeader.js +89 -0
  19. package/dist/shared/assistant/ui/compact/AssistantConversationMenu.d.ts +29 -0
  20. package/dist/shared/assistant/ui/compact/AssistantConversationMenu.js +87 -0
  21. package/dist/shared/assistant/ui/compact/AssistantDiscardDraftDialog.d.ts +19 -0
  22. package/dist/shared/assistant/ui/compact/AssistantDiscardDraftDialog.js +38 -0
  23. package/dist/shared/assistant/ui/compact/AssistantMenuView.d.ts +42 -0
  24. package/dist/shared/assistant/ui/compact/AssistantMenuView.js +285 -0
  25. package/dist/shared/assistant/ui/compact/AssistantVoiceLanguageSettings.d.ts +24 -0
  26. package/dist/shared/assistant/ui/compact/AssistantVoiceLanguageSettings.js +68 -0
  27. package/dist/shared/assistant/ui/compact/AssistantWaitingChangeRow.d.ts +21 -0
  28. package/dist/shared/assistant/ui/compact/AssistantWaitingChangeRow.js +34 -0
  29. package/dist/shared/assistant/ui/compact/compactChrome.d.ts +75 -0
  30. package/dist/shared/assistant/ui/compact/compactChrome.js +39 -0
  31. package/dist/shared/assistant/ui/compact/waitingChange.d.ts +49 -0
  32. package/dist/shared/assistant/ui/compact/waitingChange.js +12 -0
  33. package/dist/shared/assistant/ui/composer/AssistantComposer.d.ts +19 -18
  34. package/dist/shared/assistant/ui/composer/AssistantComposer.js +261 -224
  35. package/dist/shared/assistant/ui/useVoiceSession.js +13 -8
  36. package/dist/shared/assistant/useAssistantKeyboardShortcuts.d.ts +16 -2
  37. package/dist/shared/assistant/useAssistantKeyboardShortcuts.js +28 -16
  38. package/dist/shared-assistant.js +42 -33
  39. package/package.json +1 -1
@@ -18,6 +18,17 @@ export interface AssistantOverlayContextValue {
18
18
  */
19
19
  panelInsetPx: number;
20
20
  keys: AssistantOverlayKeys;
21
+ /**
22
+ * BOFF-10177 (N1): let the open panel ask before it is closed. The guard runs
23
+ * for every request to CLOSE from outside the panel (the launcher, the
24
+ * shortcut, the toggle event, Escape with focus outside it, `close()`), and
25
+ * returns true when it took the request, which it then answers itself, by
26
+ * asking the person and calling `close()` again once they have said yes.
27
+ * Returns an unregister function. Only the compact panel registers one, so
28
+ * with none, every path below closes exactly as before. Optional so a host
29
+ * that builds this value itself keeps compiling.
30
+ */
31
+ registerCloseGuard?: (guard: () => boolean) => () => void;
21
32
  }
22
33
  /** The overlay state in force, or null when no provider is mounted. */
23
34
  export declare function useAssistantOverlayOrNull(): AssistantOverlayContextValue | null;
@@ -4,134 +4,147 @@ import { assistantPanelOwnsEscape as n } from "./panelOverlays.js";
4
4
  import { AssistantPreviewBridgeHost as r } from "../preview/bridgeHost.js";
5
5
  import { ASSISTANT_DOCK_WIDTH_VAR as i, ASSISTANT_OVERLAY_DESKTOP_QUERY as a, ASSISTANT_OVERLAY_TOP_VAR as o, ASSISTANT_PANEL_INSET_VAR as s, ASSISTANT_SHEET_BOTTOM_VAR as c, assistantLauncherBottom as l, assistantLauncherRight as u, assistantOverlayClassName as d, assistantOverlayEscapeAction as f, assistantOverlayKeys as p, assistantQuotaKindOf as m, closestAround as h, createAssistantNavigate as g, isAssistantToggleShortcut as _, nextAssistantOpenState as v, publishedAssistantDockWidth as y, publishedAssistantPanelInset as b, readAssistantOverlayFlag as x, requestedAssistantOpenState as S, writeAssistantOverlayFlag as C } from "./assistantOverlayState.js";
6
6
  import { useAssistantServerHistory as w } from "../history/useAssistantServerHistory.js";
7
- import { AIAssistantPanel as T } from "./AIAssistantPanel.js";
8
- import { createContext as E, useCallback as D, useContext as O, useEffect as k, useMemo as A, useRef as j, useState as M, useSyncExternalStore as N } from "react";
9
- import { Sparkles as P } from "lucide-react";
10
- import { jsx as F, jsxs as I } from "react/jsx-runtime";
7
+ import { AssistantCloseGuardContext as T } from "./closeGuard.js";
8
+ import { AIAssistantPanel as E } from "./AIAssistantPanel.js";
9
+ import { createContext as D, useCallback as O, useContext as k, useEffect as A, useMemo as j, useRef as M, useState as N, useSyncExternalStore as P } from "react";
10
+ import { Sparkles as F } from "lucide-react";
11
+ import { jsx as I, jsxs as L } from "react/jsx-runtime";
11
12
  //#region src/shared/assistant/ui/AssistantOverlay.tsx
12
- var L = E(null);
13
- function R() {
14
- return O(L);
15
- }
13
+ var R = D(null);
16
14
  function z() {
17
- return O(L)?.dockWidthPx ?? 0;
15
+ return k(R);
18
16
  }
19
17
  function B() {
20
- return O(L)?.panelInsetPx ?? 0;
18
+ return k(R)?.dockWidthPx ?? 0;
19
+ }
20
+ function V() {
21
+ return k(R)?.panelInsetPx ?? 0;
21
22
  }
22
- var V = () => typeof window > "u" ? void 0 : window.sessionStorage, H = () => typeof window > "u" ? void 0 : window.localStorage;
23
- function U(e) {
23
+ var H = () => typeof window > "u" ? void 0 : window.sessionStorage, U = () => typeof window > "u" ? void 0 : window.localStorage;
24
+ function W(e) {
24
25
  if (typeof window > "u" || typeof window.matchMedia != "function") return () => {};
25
26
  let t = window.matchMedia(a);
26
27
  return t.addEventListener("change", e), () => t.removeEventListener("change", e);
27
28
  }
28
- function W() {
29
+ function G() {
29
30
  return typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(min-width: 640px)").matches;
30
31
  }
31
- function G() {
32
- return N(U, W, () => !1);
32
+ function K() {
33
+ return P(W, G, () => !1);
33
34
  }
34
- function K(t, n) {
35
- let r = j(n);
36
- k(() => {
35
+ function q(t, n) {
36
+ let r = M(n);
37
+ A(() => {
37
38
  r.current = n;
38
- }, [n]), k(() => {
39
+ }, [n]), A(() => {
39
40
  if (!t || typeof window > "u") return;
40
41
  let n = e(t), i = (e) => r.current(m(e), e);
41
42
  return window.addEventListener(n, i), () => window.removeEventListener(n, i);
42
43
  }, [t]);
43
44
  }
44
- var q = () => {};
45
- function J({ keyPrefix: e, quota: t, children: n }) {
46
- let r = A(() => p(e), [e]), [a, o] = M(() => x(V, r.openStorageKey)), [c, l] = M(() => x(H, r.dockStorageKey)), u = D(() => o(!0), []), d = D(() => o(!1), []), f = D(() => o((e) => !e), []), m = D(() => l((e) => !e), []);
47
- k(() => {
48
- C(V, r.openStorageKey, a);
49
- }, [r.openStorageKey, a]), k(() => {
50
- C(H, r.dockStorageKey, c);
51
- }, [r.dockStorageKey, c]), k(() => {
45
+ var J = () => {};
46
+ function Y({ keyPrefix: e, quota: t, children: n }) {
47
+ let r = j(() => p(e), [e]), [a, o] = N(() => x(H, r.openStorageKey)), [c, l] = N(() => x(U, r.dockStorageKey)), u = M(null), d = M(a);
48
+ A(() => {
49
+ d.current = a;
50
+ }, [a]);
51
+ let f = O(() => u.current?.() === !0, []), m = O((e) => (u.current = e, () => {
52
+ u.current === e && (u.current = null);
53
+ }), []), h = O(() => o(!0), []), g = O(() => {
54
+ f() || o(!1);
55
+ }, [f]), w = O(() => {
56
+ d.current && f() || o((e) => !e);
57
+ }, [f]), T = O(() => l((e) => !e), []);
58
+ A(() => {
59
+ C(H, r.openStorageKey, a);
60
+ }, [r.openStorageKey, a]), A(() => {
61
+ C(U, r.dockStorageKey, c);
62
+ }, [r.dockStorageKey, c]), A(() => {
52
63
  if (typeof window > "u") return;
53
64
  let e = (e) => {
54
65
  let t = S(e);
55
- o((e) => v(e, t));
66
+ d.current && !v(!0, t) && u.current?.() === !0 || o((e) => v(e, t));
56
67
  };
57
68
  return window.addEventListener(r.toggleEvent, e), () => window.removeEventListener(r.toggleEvent, e);
58
- }, [r.toggleEvent]), k(() => {
69
+ }, [r.toggleEvent]), A(() => {
59
70
  if (typeof document > "u") return;
60
71
  let e = (e) => {
61
- _(e) && (e.preventDefault(), o((e) => !e));
72
+ _(e) && (e.preventDefault(), !(d.current && u.current?.() === !0) && o((e) => !e));
62
73
  };
63
74
  return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
64
- }, []), K(t?.product ?? null, t?.onExhausted ?? q);
65
- let h = G(), g = y({
75
+ }, []), q(t?.product ?? null, t?.onExhausted ?? J);
76
+ let E = K(), D = y({
66
77
  isOpen: a,
67
78
  docked: c,
68
- isDesktop: h
69
- }), w = b({
79
+ isDesktop: E
80
+ }), k = b({
70
81
  isOpen: a,
71
82
  docked: c,
72
- isDesktop: h
83
+ isDesktop: E
73
84
  });
74
- k(() => {
85
+ A(() => {
75
86
  if (typeof document > "u") return;
76
87
  let e = document.documentElement.style;
77
- return e.setProperty(i, `${g}px`), () => {
88
+ return e.setProperty(i, `${D}px`), () => {
78
89
  e.removeProperty(i);
79
90
  };
80
- }, [g]), k(() => {
91
+ }, [D]), A(() => {
81
92
  if (typeof document > "u") return;
82
93
  let e = document.documentElement.style;
83
- return e.setProperty(s, `${w}px`), () => {
94
+ return e.setProperty(s, `${k}px`), () => {
84
95
  e.removeProperty(s);
85
96
  };
86
- }, [w]);
87
- let T = A(() => ({
97
+ }, [k]);
98
+ let P = j(() => ({
88
99
  isOpen: a,
89
- open: u,
90
- close: d,
91
- toggle: f,
100
+ open: h,
101
+ close: g,
102
+ toggle: w,
92
103
  docked: c,
93
- toggleDock: m,
94
- dockWidthPx: g,
95
- panelInsetPx: w,
96
- keys: r
104
+ toggleDock: T,
105
+ dockWidthPx: D,
106
+ panelInsetPx: k,
107
+ keys: r,
108
+ registerCloseGuard: m
97
109
  }), [
98
110
  a,
99
- u,
100
- d,
101
- f,
102
- c,
103
- m,
111
+ h,
104
112
  g,
105
113
  w,
106
- r
114
+ c,
115
+ T,
116
+ D,
117
+ k,
118
+ r,
119
+ m
107
120
  ]);
108
- return /* @__PURE__ */ F(L.Provider, {
109
- value: T,
121
+ return /* @__PURE__ */ I(R.Provider, {
122
+ value: P,
110
123
  children: n
111
124
  });
112
125
  }
113
- var Y = (e, t) => /* @__PURE__ */ F(T, {
126
+ var X = (e, t) => /* @__PURE__ */ I(E, {
114
127
  ...e,
115
128
  ...t
116
129
  });
117
- function X(e) {
118
- let t = R();
119
- return t ? /* @__PURE__ */ F(Z, {
130
+ function Z(e) {
131
+ let t = z();
132
+ return t ? /* @__PURE__ */ I(Q, {
120
133
  state: t,
121
134
  ...e
122
135
  }) : null;
123
136
  }
124
- function Z({ state: e, panelId: i = "ai-assistant", panelProps: a, renderPanel: s, navigate: p, isShellLessTarget: m, topOffsetPx: _ = 56, launcherIcon: v, launcherBottomInset: y = "1.5rem", showLauncher: b = !0, closeOnEscape: x = !0 }) {
125
- let { isOpen: S, close: C, toggle: T, docked: E, toggleDock: D, dockWidthPx: O } = e, j = t();
137
+ function Q({ state: e, panelId: i = "ai-assistant", panelProps: a, renderPanel: s, navigate: p, isShellLessTarget: m, topOffsetPx: _ = 56, launcherIcon: v, launcherBottomInset: y = "1.5rem", showLauncher: b = !0, closeOnEscape: x = !0 }) {
138
+ let { isOpen: S, close: C, toggle: E, docked: D, toggleDock: O, dockWidthPx: k } = e, M = t();
126
139
  w(a?.serverHistory === !0);
127
- let [N, L] = M(!1), R = A(() => p ? g({
140
+ let [P, R] = N(!1), z = j(() => p ? g({
128
141
  navigate: p,
129
142
  isShellLessTarget: m,
130
- isDesktop: W,
131
- collapseSheet: () => L(!1),
143
+ isDesktop: G,
144
+ collapseSheet: () => R(!1),
132
145
  openInNewTab: (e) => window.open(e, "_blank", "noopener,noreferrer")
133
146
  }) : void 0, [p, m]);
134
- k(() => {
147
+ A(() => {
135
148
  if (!S || !x) return;
136
149
  let e = (e) => {
137
150
  f({
@@ -149,53 +162,56 @@ function Z({ state: e, panelId: i = "ai-assistant", panelProps: a, renderPanel:
149
162
  C,
150
163
  x
151
164
  ]);
152
- let z = {
165
+ let B = {
153
166
  panelId: i,
154
167
  visible: !0,
155
168
  onClose: C,
156
- docked: E,
157
- onToggleDock: D,
158
- onNavigate: R,
169
+ docked: D,
170
+ onToggleDock: O,
171
+ onNavigate: z,
159
172
  isShellLessTarget: m
160
- }, B = j("overlay.launcher", "AI Assistant"), V = {
173
+ }, V = M("overlay.launcher", "AI Assistant"), H = {
161
174
  [o]: `${_}px`,
162
175
  [c]: "var(--mobile-tabbar-height, 0px)"
163
176
  };
164
- return /* @__PURE__ */ I(r, {
177
+ return /* @__PURE__ */ L(r, {
165
178
  preview: a?.preview,
166
- children: [S && /* @__PURE__ */ I("div", {
179
+ children: [S && /* @__PURE__ */ L("div", {
167
180
  className: d({
168
- expanded: N,
169
- docked: E
181
+ expanded: P,
182
+ docked: D
170
183
  }),
171
- style: V,
184
+ style: H,
172
185
  "data-testid": "assistant-overlay",
173
- children: [/* @__PURE__ */ F("button", {
186
+ children: [/* @__PURE__ */ I("button", {
174
187
  type: "button",
175
- onClick: () => L((e) => !e),
188
+ onClick: () => R((e) => !e),
176
189
  className: "flex w-full shrink-0 justify-center pt-2 pb-1 sm:hidden",
177
- "aria-label": N ? j("sheet.collapse", "Shrink the assistant") : j("sheet.expand", "Expand the assistant"),
178
- "aria-expanded": N,
190
+ "aria-label": P ? M("sheet.collapse", "Shrink the assistant") : M("sheet.expand", "Expand the assistant"),
191
+ "aria-expanded": P,
179
192
  "data-testid": "assistant-sheet-handle",
180
- children: /* @__PURE__ */ F("span", { className: "h-1.5 w-10 rounded-full bg-border-strong" })
181
- }), /* @__PURE__ */ F("div", {
193
+ children: /* @__PURE__ */ I("span", { className: "h-1.5 w-10 rounded-full bg-border-strong" })
194
+ }), /* @__PURE__ */ I("div", {
182
195
  className: "flex min-h-0 flex-1 flex-col",
183
- children: s ? s(z) : Y(a, z)
196
+ children: /* @__PURE__ */ I(T.Provider, {
197
+ value: e.registerCloseGuard ?? null,
198
+ children: s ? s(B) : X(a, B)
199
+ })
184
200
  })]
185
- }), b && /* @__PURE__ */ F("button", {
201
+ }), b && /* @__PURE__ */ I("button", {
186
202
  type: "button",
187
- onClick: T,
188
- title: j("overlay.launcherTitle", "AI Assistant ({{shortcut}})", { shortcut: "Ctrl+Shift+A" }),
189
- "aria-label": B,
203
+ onClick: E,
204
+ title: M("overlay.launcherTitle", "AI Assistant ({{shortcut}})", { shortcut: "Ctrl+Shift+A" }),
205
+ "aria-label": V,
190
206
  "aria-haspopup": "dialog",
191
207
  "aria-expanded": S,
192
208
  "data-testid": "assistant-fab",
193
209
  style: {
194
210
  bottom: l(y),
195
- right: u(O)
211
+ right: u(k)
196
212
  },
197
213
  className: "fixed z-30 size-14 items-center justify-center rounded-full border border-border-strong bg-[var(--color-accent-soft)] text-action-primary-bg shadow-float transition-colors duration-200 hover:border-action-primary-bg focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)] cursor-pointer " + (S ? "hidden sm:inline-flex" : "inline-flex"),
198
- children: v ?? /* @__PURE__ */ F(P, {
214
+ children: v ?? /* @__PURE__ */ I(F, {
199
215
  className: "size-6",
200
216
  "aria-hidden": "true"
201
217
  })
@@ -203,4 +219,4 @@ function Z({ state: e, panelId: i = "ai-assistant", panelProps: a, renderPanel:
203
219
  });
204
220
  }
205
221
  //#endregion
206
- export { X as AssistantOverlay, J as AssistantOverlayProvider, z as useAssistantDockWidth, R as useAssistantOverlayOrNull, B as useAssistantPanelInset, K as useAssistantQuotaExhausted };
222
+ export { Z as AssistantOverlay, Y as AssistantOverlayProvider, B as useAssistantDockWidth, z as useAssistantOverlayOrNull, V as useAssistantPanelInset, q as useAssistantQuotaExhausted };