@burdenoff/fe-libs 2026.911.5 → 2026.912.1

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 (34) hide show
  1. package/dist/shared/assistant/index.d.ts +3 -0
  2. package/dist/shared/assistant/index.d.ts.map +1 -1
  3. package/dist/shared/assistant/preview/previewTransitions.d.ts +12 -0
  4. package/dist/shared/assistant/preview/previewTransitions.d.ts.map +1 -1
  5. package/dist/shared/assistant/preview/previewTransitions.js +57 -44
  6. package/dist/shared/assistant/preview/runIdentity.d.ts +44 -0
  7. package/dist/shared/assistant/preview/runIdentity.d.ts.map +1 -0
  8. package/dist/shared/assistant/preview/runIdentity.js +33 -0
  9. package/dist/shared/assistant/preview/surfaceState.d.ts +133 -0
  10. package/dist/shared/assistant/preview/surfaceState.d.ts.map +1 -0
  11. package/dist/shared/assistant/preview/surfaceState.js +92 -0
  12. package/dist/shared/assistant/preview/types.d.ts +33 -0
  13. package/dist/shared/assistant/preview/types.d.ts.map +1 -1
  14. package/dist/shared/assistant/preview/useAssistantPreviewBridge.d.ts.map +1 -1
  15. package/dist/shared/assistant/preview/useAssistantPreviewBridge.js +47 -39
  16. package/dist/shared/assistant/ui/AIAssistantPanel.d.ts.map +1 -1
  17. package/dist/shared/assistant/ui/AIAssistantPanel.js +67 -63
  18. package/dist/shared/assistant/ui/AssistantConversationList.d.ts.map +1 -1
  19. package/dist/shared/assistant/ui/AssistantConversationList.js +1 -1
  20. package/dist/shared/assistant/ui/AssistantMoreMenu.d.ts.map +1 -1
  21. package/dist/shared/assistant/ui/AssistantMoreMenu.js +58 -59
  22. package/dist/shared/assistant/ui/composer/AssistantAttachmentButton.d.ts.map +1 -1
  23. package/dist/shared/assistant/ui/composer/AssistantAttachmentButton.js +49 -50
  24. package/dist/shared/assistant/ui/panelOverlays.d.ts +52 -3
  25. package/dist/shared/assistant/ui/panelOverlays.d.ts.map +1 -1
  26. package/dist/shared/assistant/ui/panelOverlays.js +11 -7
  27. package/dist/shared/assistant/ui/useDropdownEscape.d.ts +34 -0
  28. package/dist/shared/assistant/ui/useDropdownEscape.d.ts.map +1 -0
  29. package/dist/shared/assistant/ui/useDropdownEscape.js +23 -0
  30. package/dist/shared/assistant/ui/useOverlayFocus.d.ts.map +1 -1
  31. package/dist/shared/assistant/useAssistantKeyboardShortcuts.d.ts.map +1 -1
  32. package/dist/shared/assistant/useAssistantKeyboardShortcuts.js +26 -21
  33. package/dist/shared-assistant.js +46 -43
  34. package/package.json +1 -1
@@ -1,11 +1,13 @@
1
1
  import { useAssistantTr as e } from "../i18n.js";
2
2
  import { useAssistantStore as t } from "../store.js";
3
3
  import { isStageCopy as n } from "../stageCopy.js";
4
- import { getWorkspaceId as r } from "../context.js";
5
- import { IDLE_PREVIEW_STATE as i, nextPreviewEvents as a } from "./previewTransitions.js";
6
- import { useEffect as o, useRef as s } from "react";
4
+ import { parseToolActivity as r } from "../ui/AssistantToolActivity.js";
5
+ import { IDLE_PREVIEW_STATE as i, isRunningStatus as a, nextPreviewEvents as o } from "./previewTransitions.js";
6
+ import { NO_OWNER as s } from "./surfaceState.js";
7
+ import { runIdentities as c } from "./runIdentity.js";
8
+ import { useEffect as l, useRef as u } from "react";
7
9
  //#region src/shared/assistant/preview/useAssistantPreviewBridge.ts
8
- function c(e, t) {
10
+ function d(e, t) {
9
11
  try {
10
12
  let n = e?.onEvent?.(t);
11
13
  n && typeof n.then == "function" && Promise.resolve(n).catch((e) => {
@@ -15,57 +17,63 @@ function c(e, t) {
15
17
  console.error("[assistant] preview observer threw", e);
16
18
  }
17
19
  }
18
- function l(l) {
19
- let u = e(), d = t((e) => e.activeConversationId), f = t((e) => e.activeConversationId ? e.processingByConversationId[e.activeConversationId] : void 0), p = t((e) => {
20
+ function f(f) {
21
+ let p = e(), m = t((e) => e.activeConversationId), h = t((e) => e.activeConversationId ? e.processingByConversationId[e.activeConversationId] : void 0), g = t((e) => {
20
22
  let t = e.activeConversationId, n = t ? e.processingByConversationId[t]?.messageId : null;
21
23
  return !t || !n ? null : e.conversations.find((e) => e.id === t)?.messages.find((e) => e.id === n)?.content ?? null;
22
- }), m = s(i), h = s(null), g = s(null);
23
- o(() => {
24
- h.current = l;
25
- }, [l]), o(() => () => {
26
- let { events: e, state: t } = a(m.current, {
24
+ }), _ = u(i), v = u(null), y = u(null);
25
+ l(() => {
26
+ v.current = f;
27
+ }, [f]), l(() => () => {
28
+ let { events: e, state: t } = o(_.current, {
27
29
  run: null,
28
30
  conversationId: null,
29
31
  status: "idle",
30
32
  content: null,
33
+ steps: [],
31
34
  isFiller: () => !1
32
35
  });
33
- m.current = t;
34
- for (let t of e) c(h.current, t);
35
- }, []), o(() => {
36
- if (!l?.onEvent) {
37
- m.current = i;
36
+ _.current = t;
37
+ for (let t of e) d(v.current, t);
38
+ }, []), l(() => {
39
+ let e = f?.onEvent, t = h?.messageId ?? null, l = m && t ? `${m}:${t}` : null, u = h?.status ?? "idle", v = l ? a(u) ? c.ownerFor(l) : c.ownerForSettled(l) : s;
40
+ if (!e) {
41
+ _.current = i;
38
42
  return;
39
43
  }
40
- let e = (e) => {
41
- c(l, e);
42
- }, t = f?.messageId ?? null, o = d && t ? {
43
- runId: `${d}:${t}`,
44
- conversationId: d,
44
+ let b = (e) => {
45
+ d(f, e);
46
+ }, x = m && t ? {
47
+ runId: `${m}:${t}`,
48
+ conversationId: m,
45
49
  messageId: t,
46
- workspaceId: r() || null
50
+ ...v
47
51
  } : null;
48
- o && g.current?.runId !== o.runId && (g.current = {
49
- runId: o.runId,
50
- tr: u
52
+ x && y.current?.runId !== x.runId && (y.current = {
53
+ runId: x.runId,
54
+ tr: p
51
55
  });
52
- let s = o ? g.current?.tr ?? u : u, { events: h, state: _ } = a(m.current, {
53
- run: o,
54
- conversationId: d,
55
- status: f?.status ?? "idle",
56
- content: p,
57
- error: f?.error ?? null,
58
- isFiller: (e) => n(s, e)
56
+ let S = x ? y.current?.tr ?? p : p, { steps: C, text: w } = g ? r(g) : {
57
+ steps: [],
58
+ text: ""
59
+ }, { events: T, state: E } = o(_.current, {
60
+ run: x,
61
+ conversationId: m,
62
+ status: u,
63
+ content: w,
64
+ steps: C,
65
+ error: h?.error ?? null,
66
+ isFiller: (e) => n(S, e)
59
67
  });
60
- m.current = _;
61
- for (let t of h) e(t);
68
+ _.current = E;
69
+ for (let e of T) b(e);
62
70
  }, [
63
- l,
64
- d,
65
71
  f,
66
- p,
67
- u
72
+ m,
73
+ h,
74
+ g,
75
+ p
68
76
  ]);
69
77
  }
70
78
  //#endregion
71
- export { l as useAssistantPreviewBridge };
79
+ export { f as useAssistantPreviewBridge };
@@ -1 +1 @@
1
- {"version":3,"file":"AIAssistantPanel.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/ui/AIAssistantPanel.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAU,KAAK,EAAE,EAAY,MAAM,OAAO,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAMtD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAIvE,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,6BAA6B,CAAC;AAYrC,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAGnE,MAAM,MAAM,qBAAqB,GAAG,UAAU,GAAG;IAC/C,gEAAgE;IAChE,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,oBAAoB,CAAC;IACnC;;;;;;;;OAQG;IACH,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B;;;;;;;;;OASG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;;OAKG;IACH,OAAO,CAAC,EAAE,0BAA0B,CAAC;CACtC,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CA8MtD,CAAC"}
1
+ {"version":3,"file":"AIAssistantPanel.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/ui/AIAssistantPanel.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAU,KAAK,EAAE,EAAY,MAAM,OAAO,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAMtD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAIvE,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,6BAA6B,CAAC;AAcrC,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAGnE,MAAM,MAAM,qBAAqB,GAAG,UAAU,GAAG;IAC/C,gEAAgE;IAChE,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,oBAAoB,CAAC;IACnC;;;;;;;;OAQG;IACH,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B;;;;;;;;;OASG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;;OAKG;IACH,OAAO,CAAC,EAAE,0BAA0B,CAAC;CACtC,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CA0NtD,CAAC"}
@@ -4,85 +4,89 @@ import { AssistantNavigateProvider as n } from "./AssistantMarkdownRenderer.js";
4
4
  import { useAssistantStore as r } from "../store.js";
5
5
  import { AssistantSpeechProvider as i } from "./AssistantSpeechProvider.js";
6
6
  import { AssistantConnectSourceProvider as a } from "./composer/connectSource.js";
7
- import { AssistantPreviewProvider as o } from "../preview/context.js";
8
- import { ASSISTANT_PANEL_ATTR as s, escapeDismisses as c, nextPanelOverlays as l } from "./panelOverlays.js";
9
- import { useAssistantPreviewBridge as u } from "../preview/useAssistantPreviewBridge.js";
10
- import { AssistantPreviewOverlay as d } from "../preview/AssistantPreviewOverlay.js";
11
- import { AssistantHeader as f } from "./AssistantHeader.js";
12
- import { AssistantConversationList as p } from "./AssistantConversationList.js";
13
- import { useFilesServiceWarmup as m } from "../../../storage/warmFilesService.js";
14
- import { useAssistantHeartbeat as h } from "../useAssistantHeartbeat.js";
15
- import { useAssistantKeyboardShortcuts as g } from "../useAssistantKeyboardShortcuts.js";
16
- import { AssistantChatArea as _ } from "./AssistantChatArea.js";
17
- import { useRef as v, useState as y } from "react";
18
- import { jsx as b, jsxs as x } from "react/jsx-runtime";
7
+ import { ASSISTANT_OVERLAY_ATTR as o, ASSISTANT_PANEL_ATTR as s, activePanelOverlay as c, escapeDismisses as l, nextPanelOverlays as u } from "./panelOverlays.js";
8
+ import { AssistantPreviewProvider as d } from "../preview/context.js";
9
+ import { useAssistantPreviewBridge as f } from "../preview/useAssistantPreviewBridge.js";
10
+ import { AssistantPreviewOverlay as p } from "../preview/AssistantPreviewOverlay.js";
11
+ import { AssistantHeader as m } from "./AssistantHeader.js";
12
+ import { AssistantConversationList as h } from "./AssistantConversationList.js";
13
+ import { useFilesServiceWarmup as g } from "../../../storage/warmFilesService.js";
14
+ import { useAssistantHeartbeat as _ } from "../useAssistantHeartbeat.js";
15
+ import { useAssistantKeyboardShortcuts as v } from "../useAssistantKeyboardShortcuts.js";
16
+ import { AssistantChatArea as y } from "./AssistantChatArea.js";
17
+ import { useRef as b, useState as x } from "react";
18
+ import { jsx as S, jsxs as C } from "react/jsx-runtime";
19
19
  //#region src/shared/assistant/ui/AIAssistantPanel.tsx
20
- var S = ({ onClose: S, visible: C, docked: w, onToggleDock: T, writeAccess: E, onNavigate: D, connectSourceHref: O, preview: k }) => {
21
- let A = t(), [j, M] = y(!1);
22
- j && !k && M(!1);
23
- let N = j && !!k;
24
- u(k ?? null);
25
- let P = v(null), { conversations: F, activeConversationId: I, conversationListOpen: L, setConversationListOpen: R, createConversation: z } = r(), B = L || N, V = (e) => {
26
- let t = l({
27
- historyOpen: L,
28
- previewOpen: N
20
+ var w = ({ onClose: w, visible: T, docked: E, onToggleDock: D, writeAccess: O, onNavigate: k, connectSourceHref: A, preview: j }) => {
21
+ let M = t(), [N, P] = x(!1);
22
+ N && !j && P(!1);
23
+ let F = N && !!j;
24
+ f(j ?? null);
25
+ let I = b(null), { conversations: L, activeConversationId: R, conversationListOpen: z, setConversationListOpen: B, createConversation: V } = r(), H = z || F, U = c({
26
+ historyOpen: z,
27
+ previewOpen: F
28
+ }), W = (e) => {
29
+ let t = u({
30
+ historyOpen: z,
31
+ previewOpen: F
29
32
  }, e);
30
- R(t.historyOpen), M(t.previewOpen);
31
- }, H = F.find((e) => e.id === I);
32
- h(H?.backendSessionId ?? null, H?.mode ?? null, C ?? !0), m(C ?? !0);
33
- let U = e(C !== !1);
34
- return g({
35
- panelRef: P,
33
+ B(t.historyOpen), P(t.previewOpen);
34
+ }, G = L.find((e) => e.id === R);
35
+ _(G?.backendSessionId ?? null, G?.mode ?? null, T ?? !0), g(T ?? !0);
36
+ let K = e(T !== !1);
37
+ return v({
38
+ panelRef: I,
36
39
  onClose: () => {
37
- if (c({
38
- historyOpen: L,
39
- previewOpen: N
40
+ if (l({
41
+ historyOpen: z,
42
+ previewOpen: F
40
43
  }) === "overlay") {
41
- R(!1), M(!1);
44
+ B(!1), P(!1);
42
45
  return;
43
46
  }
44
- S();
47
+ w();
45
48
  }
46
- }), /* @__PURE__ */ b(i, {
47
- visible: C ?? !0,
48
- children: /* @__PURE__ */ b(o, {
49
- value: k,
50
- children: /* @__PURE__ */ b(n, {
51
- value: D,
52
- children: /* @__PURE__ */ b(a, {
53
- value: O,
54
- children: /* @__PURE__ */ x("div", {
55
- ref: P,
49
+ }), /* @__PURE__ */ S(i, {
50
+ visible: T ?? !0,
51
+ children: /* @__PURE__ */ S(d, {
52
+ value: j,
53
+ children: /* @__PURE__ */ S(n, {
54
+ value: k,
55
+ children: /* @__PURE__ */ S(a, {
56
+ value: A,
57
+ children: /* @__PURE__ */ C("div", {
58
+ ref: I,
56
59
  className: "relative flex h-full w-full flex-col bg-bg-surface",
57
60
  role: "complementary",
58
- "aria-label": A("panel.ariaLabel", "AI Assistant"),
61
+ "aria-label": M("panel.ariaLabel", "AI Assistant"),
59
62
  "data-testid": "ai-assistant-panel",
60
63
  [s]: "",
64
+ ...U ? { [o]: U } : {},
61
65
  tabIndex: -1,
62
66
  children: [
63
- /* @__PURE__ */ b("div", {
67
+ /* @__PURE__ */ S("div", {
64
68
  className: "contents",
65
- inert: B || void 0,
66
- children: /* @__PURE__ */ b(f, {
67
- contextLabel: U,
68
- onNewConversation: () => z(),
69
- onOpenHistory: () => V("history"),
70
- historyOpen: L,
71
- onTogglePreview: () => V("preview"),
72
- previewOpen: N,
73
- onClose: S,
74
- docked: w,
75
- onToggleDock: T
69
+ inert: H || void 0,
70
+ children: /* @__PURE__ */ S(m, {
71
+ contextLabel: K,
72
+ onNewConversation: () => V(),
73
+ onOpenHistory: () => W("history"),
74
+ historyOpen: z,
75
+ onTogglePreview: () => W("preview"),
76
+ previewOpen: F,
77
+ onClose: w,
78
+ docked: E,
79
+ onToggleDock: D
76
80
  })
77
81
  }),
78
- L && /* @__PURE__ */ b(p, {}),
79
- N && /* @__PURE__ */ b(d, { onClose: () => M(!1) }),
80
- /* @__PURE__ */ b("div", {
82
+ z && /* @__PURE__ */ S(h, {}),
83
+ F && /* @__PURE__ */ S(p, { onClose: () => P(!1) }),
84
+ /* @__PURE__ */ S("div", {
81
85
  className: "contents",
82
- inert: B || void 0,
83
- children: /* @__PURE__ */ b(_, {
84
- visible: C ?? !0,
85
- writeAccess: E
86
+ inert: H || void 0,
87
+ children: /* @__PURE__ */ S(y, {
88
+ visible: T ?? !0,
89
+ writeAccess: O
86
90
  })
87
91
  })
88
92
  ]
@@ -93,4 +97,4 @@ var S = ({ onClose: S, visible: C, docked: w, onToggleDock: T, writeAccess: E, o
93
97
  });
94
98
  };
95
99
  //#endregion
96
- export { S as AIAssistantPanel };
100
+ export { w as AIAssistantPanel };
@@ -1 +1 @@
1
- {"version":3,"file":"AssistantConversationList.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/ui/AssistantConversationList.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAgB1C,eAAO,MAAM,yBAAyB,EAAE,EA8PvC,CAAC"}
1
+ {"version":3,"file":"AssistantConversationList.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/ui/AssistantConversationList.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAgB1C,eAAO,MAAM,yBAAyB,EAAE,EAuQvC,CAAC"}
@@ -89,7 +89,7 @@ var h = () => {
89
89
  value: O,
90
90
  onChange: (e) => k(e.target.value),
91
91
  onKeyDown: (e) => {
92
- e.key === "Enter" && N(), e.key === "Escape" && D(null);
92
+ e.key === "Enter" && N(), e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), D(null));
93
93
  },
94
94
  className: "flex-1 text-xs bg-bg-sunken border border-border-default rounded px-2 py-1 text-text-primary focus:outline-none focus:border-action-primary-bg",
95
95
  onClick: (e) => e.stopPropagation()
@@ -1 +1 @@
1
- {"version":3,"file":"AssistantMoreMenu.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/ui/AssistantMoreMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA+B,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAgB7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,iBAAiB,EAAE,EAoM/B,CAAC"}
1
+ {"version":3,"file":"AssistantMoreMenu.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/ui/AssistantMoreMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA+B,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAiB7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,iBAAiB,EAAE,EAgM/B,CAAC"}
@@ -2,115 +2,114 @@ import { useAssistantTr as e } from "../i18n.js";
2
2
  import { useAssistantStore as t } from "../store.js";
3
3
  import { useAssistantSpeech as n } from "./AssistantSpeechProvider.js";
4
4
  import { AssistantLanguageMenu as r } from "./AssistantLanguageMenu.js";
5
- import { AssistantVoiceSelector as i } from "./composer/AssistantVoiceSelector.js";
6
- import { downloadFile as a, exportConversation as o } from "../exportConversation.js";
7
- import { useEffect as s, useRef as c, useState as l } from "react";
8
- import { Check as u, FileJson as d, FileText as f, MoreHorizontal as p, Play as m, Volume2 as h } from "lucide-react";
9
- import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
5
+ import { useDropdownEscape as i } from "./useDropdownEscape.js";
6
+ import { AssistantVoiceSelector as a } from "./composer/AssistantVoiceSelector.js";
7
+ import { downloadFile as o, exportConversation as s } from "../exportConversation.js";
8
+ import { useEffect as c, useRef as l, useState as u } from "react";
9
+ import { Check as d, FileJson as f, FileText as p, MoreHorizontal as m, Play as h, Volume2 as g } from "lucide-react";
10
+ import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
10
11
  //#region src/shared/assistant/ui/AssistantMoreMenu.tsx
11
- var y = () => {
12
- let y = e(), [b, x] = l(!1), S = c(null), C = c(null), { conversations: w, activeConversationId: T } = t(), E = w.find((e) => e.id === T), D = !!(E && E.messages.length > 0), { isSupported: O, isBlocked: k, disabledReason: A, autoSpeakEnabled: j, setAutoSpeak: M, stop: N, previewVoice: P, activeVoiceName: F } = n(), I = k && !j;
13
- s(() => {
14
- if (!b) return;
12
+ var b = () => {
13
+ let b = e(), [x, S] = u(!1), C = l(null), w = l(null), { conversations: T, activeConversationId: E } = t(), D = T.find((e) => e.id === E), O = !!(D && D.messages.length > 0), { isSupported: k, isBlocked: A, disabledReason: j, autoSpeakEnabled: M, setAutoSpeak: N, stop: P, previewVoice: F, activeVoiceName: I } = n(), L = A && !M;
14
+ i(x, C, w, () => S(!1)), c(() => {
15
+ if (!x) return;
15
16
  let e = (e) => {
16
- e.key === "Escape" && (x(!1), C.current?.focus());
17
- }, t = (e) => {
18
17
  let t = e.target;
19
- S.current?.contains(t) || C.current?.contains(t) || x(!1);
18
+ C.current?.contains(t) || w.current?.contains(t) || S(!1);
20
19
  };
21
- return window.addEventListener("keydown", e), document.addEventListener("mousedown", t), () => {
22
- window.removeEventListener("keydown", e), document.removeEventListener("mousedown", t);
20
+ return document.addEventListener("mousedown", e), () => {
21
+ document.removeEventListener("mousedown", e);
23
22
  };
24
- }, [b]);
25
- let L = (e) => {
26
- if (!E) return;
27
- let { content: t, filename: n, mimeType: r } = o(E, e);
28
- a(t, n, r), x(!1);
29
- }, R = () => {
30
- j && N(), M(!j);
31
- }, z = y("header.more", "More options");
32
- return /* @__PURE__ */ v("div", {
23
+ }, [x]);
24
+ let R = (e) => {
25
+ if (!D) return;
26
+ let { content: t, filename: n, mimeType: r } = s(D, e);
27
+ o(t, n, r), S(!1);
28
+ }, z = () => {
29
+ M && P(), N(!M);
30
+ }, B = b("header.more", "More options");
31
+ return /* @__PURE__ */ y("div", {
33
32
  className: "relative",
34
- children: [/* @__PURE__ */ _("button", {
35
- ref: C,
33
+ children: [/* @__PURE__ */ v("button", {
34
+ ref: w,
36
35
  type: "button",
37
- onClick: () => x((e) => !e),
36
+ onClick: () => S((e) => !e),
38
37
  className: "rounded p-1 transition-colors hover:bg-bg-elevated",
39
- "aria-label": z,
38
+ "aria-label": B,
40
39
  "aria-haspopup": "menu",
41
- "aria-expanded": b,
40
+ "aria-expanded": x,
42
41
  "data-testid": "assistant-more",
43
- children: /* @__PURE__ */ _(p, { className: "size-4 text-text-secondary" })
44
- }), b ? /* @__PURE__ */ v("div", {
45
- ref: S,
42
+ children: /* @__PURE__ */ v(m, { className: "size-4 text-text-secondary" })
43
+ }), x ? /* @__PURE__ */ y("div", {
44
+ ref: C,
46
45
  role: "menu",
47
- "aria-label": z,
46
+ "aria-label": B,
48
47
  className: "absolute right-0 top-full z-50 mt-1 min-w-56 overflow-hidden rounded-xl border border-border-default bg-bg-surface py-1 shadow-lg",
49
48
  "data-testid": "assistant-more-menu",
50
49
  children: [
51
- O ? /* @__PURE__ */ v("button", {
50
+ k ? /* @__PURE__ */ y("button", {
52
51
  type: "button",
53
52
  role: "menuitemcheckbox",
54
- "aria-checked": j,
55
- onClick: R,
56
- disabled: I,
57
- title: I ? A ?? void 0 : void 0,
53
+ "aria-checked": M,
54
+ onClick: z,
55
+ disabled: L,
56
+ title: L ? j ?? void 0 : void 0,
58
57
  className: "flex w-full items-center gap-2.5 px-3 py-2 text-left text-xs text-text-primary transition-colors hover:bg-bg-elevated disabled:cursor-not-allowed disabled:text-text-muted disabled:hover:bg-transparent",
59
58
  "data-testid": "assistant-auto-speak",
60
59
  children: [
61
- /* @__PURE__ */ _(h, {
60
+ /* @__PURE__ */ v(g, {
62
61
  className: "size-3.5 flex-shrink-0 text-text-secondary",
63
62
  "aria-hidden": "true"
64
63
  }),
65
- /* @__PURE__ */ _("span", {
64
+ /* @__PURE__ */ v("span", {
66
65
  className: "flex-1",
67
- children: y("header.autoRead", "Auto-read replies")
66
+ children: b("header.autoRead", "Auto-read replies")
68
67
  }),
69
- j ? /* @__PURE__ */ _(u, { className: "size-3.5 flex-shrink-0 text-action-primary-bg" }) : null
68
+ M ? /* @__PURE__ */ v(d, { className: "size-3.5 flex-shrink-0 text-action-primary-bg" }) : null
70
69
  ]
71
70
  }) : null,
72
- /* @__PURE__ */ _(r, {}),
73
- /* @__PURE__ */ v("div", {
71
+ /* @__PURE__ */ v(r, {}),
72
+ /* @__PURE__ */ y("div", {
74
73
  className: "flex items-center gap-1 px-3 py-1.5",
75
74
  "data-testid": "assistant-more-voice",
76
- children: [/* @__PURE__ */ _(i, {}), F ? /* @__PURE__ */ v("button", {
75
+ children: [/* @__PURE__ */ v(a, {}), I ? /* @__PURE__ */ y("button", {
77
76
  type: "button",
78
- onClick: () => P(F),
77
+ onClick: () => F(I),
79
78
  className: "flex items-center gap-1 rounded-md px-1.5 py-1 text-[11px] text-text-muted transition-colors hover:bg-bg-elevated hover:text-text-secondary focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong",
80
- "aria-label": y("voice.preview", "Hear this voice"),
79
+ "aria-label": b("voice.preview", "Hear this voice"),
81
80
  "data-testid": "assistant-voice-preview",
82
- children: [/* @__PURE__ */ _(m, {
81
+ children: [/* @__PURE__ */ v(h, {
83
82
  className: "size-3",
84
83
  "aria-hidden": "true"
85
- }), y("voice.previewShort", "Preview")]
84
+ }), b("voice.previewShort", "Preview")]
86
85
  }) : null]
87
86
  }),
88
- D ? /* @__PURE__ */ v(g, { children: [
89
- /* @__PURE__ */ _("div", {
87
+ O ? /* @__PURE__ */ y(_, { children: [
88
+ /* @__PURE__ */ v("div", {
90
89
  className: "my-1 border-t border-border-subtle",
91
90
  role: "separator"
92
91
  }),
93
- /* @__PURE__ */ v("button", {
92
+ /* @__PURE__ */ y("button", {
94
93
  type: "button",
95
94
  role: "menuitem",
96
- onClick: () => L("json"),
95
+ onClick: () => R("json"),
97
96
  className: "flex w-full items-center gap-2.5 px-3 py-2 text-left text-xs text-text-primary transition-colors hover:bg-bg-elevated",
98
97
  "data-testid": "export-json",
99
- children: [/* @__PURE__ */ _(d, {
98
+ children: [/* @__PURE__ */ v(f, {
100
99
  className: "size-3.5 flex-shrink-0 text-text-secondary",
101
100
  "aria-hidden": "true"
102
- }), y("export.json", "Export as JSON")]
101
+ }), b("export.json", "Export as JSON")]
103
102
  }),
104
- /* @__PURE__ */ v("button", {
103
+ /* @__PURE__ */ y("button", {
105
104
  type: "button",
106
105
  role: "menuitem",
107
- onClick: () => L("markdown"),
106
+ onClick: () => R("markdown"),
108
107
  className: "flex w-full items-center gap-2.5 px-3 py-2 text-left text-xs text-text-primary transition-colors hover:bg-bg-elevated",
109
108
  "data-testid": "export-markdown",
110
- children: [/* @__PURE__ */ _(f, {
109
+ children: [/* @__PURE__ */ v(p, {
111
110
  className: "size-3.5 flex-shrink-0 text-text-secondary",
112
111
  "aria-hidden": "true"
113
- }), y("export.markdown", "Export as Markdown")]
112
+ }), b("export.markdown", "Export as Markdown")]
114
113
  })
115
114
  ] }) : null
116
115
  ]
@@ -118,4 +117,4 @@ var y = () => {
118
117
  });
119
118
  };
120
119
  //#endregion
121
- export { y as AssistantMoreMenu };
120
+ export { b as AssistantMoreMenu };
@@ -1 +1 @@
1
- {"version":3,"file":"AssistantAttachmentButton.d.ts","sourceRoot":"","sources":["../../../../../src/shared/assistant/ui/composer/AssistantAttachmentButton.tsx"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,EAAE,EACR,MAAM,OAAO,CAAC;AAaf,UAAU,KAAK;IACb,OAAO,EAAE,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI,KAAK,IAAI,CAAC;IAC1C;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAC1B,wEAAwE;IACxE,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AASD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,yBAAyB,EAAE,EAAE,CAAC,KAAK,CA4J/C,CAAC"}
1
+ {"version":3,"file":"AssistantAttachmentButton.d.ts","sourceRoot":"","sources":["../../../../../src/shared/assistant/ui/composer/AssistantAttachmentButton.tsx"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,EAAE,EACR,MAAM,OAAO,CAAC;AAcf,UAAU,KAAK;IACb,OAAO,EAAE,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI,KAAK,IAAI,CAAC;IAC1C;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAC1B,wEAAwE;IACxE,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AASD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,yBAAyB,EAAE,EAAE,CAAC,KAAK,CAwJ/C,CAAC"}
@@ -3,87 +3,86 @@ import "../../attachments.js";
3
3
  import { availableAttachmentSources as t, deviceHasCamera as n } from "../../attachmentSources.js";
4
4
  import { useAssistantConnectSource as r } from "./connectSource.js";
5
5
  import { AssistantConnectSourceItem as i } from "./AssistantConnectSourceItem.js";
6
- import { useCallback as a, useEffect as o, useMemo as s, useRef as c, useState as l } from "react";
7
- import { Camera as u, FileText as d, FolderOpen as f, ImageIcon as p, Plus as m } from "lucide-react";
8
- import { jsx as h, jsxs as g } from "react/jsx-runtime";
6
+ import { useDropdownEscape as a } from "../useDropdownEscape.js";
7
+ import { useCallback as o, useEffect as s, useMemo as c, useRef as l, useState as u } from "react";
8
+ import { Camera as d, FileText as f, FolderOpen as p, ImageIcon as m, Plus as h } from "lucide-react";
9
+ import { jsx as g, jsxs as _ } from "react/jsx-runtime";
9
10
  //#region src/shared/assistant/ui/composer/AssistantAttachmentButton.tsx
10
- var _ = {
11
- camera: u,
12
- gallery: p,
13
- documents: d,
14
- files: f
15
- }, v = ({ onFiles: u, onPickerOpen: d, direction: f = "up", canAddMore: p, disabled: v = !1 }) => {
16
- let y = e(), b = c(null), x = c(null), S = c(null), [C, w] = l(!1), T = c(d);
17
- T.current = d;
18
- let E = s(() => t(n()), []), D = r(), O = p || !!D, k = p ? y("composer.attach", "Attach files or photos") : y("composer.attachFull", "Attachment limit reached ({{max}})", { max: 5 });
19
- o(() => {
20
- if (!C) return;
11
+ var v = {
12
+ camera: d,
13
+ gallery: m,
14
+ documents: f,
15
+ files: p
16
+ }, y = ({ onFiles: d, onPickerOpen: f, direction: p = "up", canAddMore: m, disabled: y = !1 }) => {
17
+ let b = e(), x = l(null), S = l(null), C = l(null), [w, T] = u(!1), E = l(f);
18
+ E.current = f;
19
+ let D = c(() => t(n()), []), O = r(), k = m || !!O, A = m ? b("composer.attach", "Attach files or photos") : b("composer.attachFull", "Attachment limit reached ({{max}})", { max: 5 });
20
+ a(w, S, C, () => T(!1)), s(() => {
21
+ if (!w) return;
21
22
  let e = (e) => {
22
- e.key === "Escape" && (w(!1), S.current?.focus());
23
- }, t = (e) => {
24
23
  let t = e.target;
25
- x.current?.contains(t) || S.current?.contains(t) || w(!1);
24
+ S.current?.contains(t) || C.current?.contains(t) || T(!1);
26
25
  };
27
- return window.addEventListener("keydown", e), window.addEventListener("mousedown", t), () => {
28
- window.removeEventListener("keydown", e), window.removeEventListener("mousedown", t);
26
+ return window.addEventListener("mousedown", e), () => {
27
+ window.removeEventListener("mousedown", e);
29
28
  };
30
- }, [C]);
31
- let A = a((e) => {
32
- u(e.target.files), e.target.value = "";
33
- }, [u]), j = a((e) => {
34
- let t = b.current;
35
- t && (t.accept = e.accept, t.multiple = e.multiple, e.capture ? t.setAttribute("capture", e.capture) : t.removeAttribute("capture"), w(!1), T.current?.(), t.click());
29
+ }, [w]);
30
+ let j = o((e) => {
31
+ d(e.target.files), e.target.value = "";
32
+ }, [d]), M = o((e) => {
33
+ let t = x.current;
34
+ t && (t.accept = e.accept, t.multiple = e.multiple, e.capture ? t.setAttribute("capture", e.capture) : t.removeAttribute("capture"), T(!1), E.current?.(), t.click());
36
35
  }, []);
37
- return /* @__PURE__ */ g("div", {
36
+ return /* @__PURE__ */ _("div", {
38
37
  className: "relative flex-shrink-0",
39
38
  children: [
40
- /* @__PURE__ */ h("input", {
41
- ref: b,
39
+ /* @__PURE__ */ g("input", {
40
+ ref: x,
42
41
  type: "file",
43
42
  multiple: !0,
44
43
  className: "hidden",
45
- onChange: A,
44
+ onChange: j,
46
45
  tabIndex: -1,
47
46
  "aria-hidden": "true",
48
47
  "data-testid": "assistant-attach-input"
49
48
  }),
50
- /* @__PURE__ */ h("button", {
51
- ref: S,
49
+ /* @__PURE__ */ g("button", {
50
+ ref: C,
52
51
  type: "button",
53
- onClick: () => w((e) => !e),
54
- disabled: v || !O,
55
- title: k,
56
- "aria-label": k,
52
+ onClick: () => T((e) => !e),
53
+ disabled: y || !k,
54
+ title: A,
55
+ "aria-label": A,
57
56
  "aria-haspopup": "menu",
58
- "aria-expanded": C,
57
+ "aria-expanded": w,
59
58
  className: "flex size-9 items-center justify-center rounded-full border border-border-subtle bg-bg-elevated text-text-secondary transition-colors hover:bg-bg-sunken hover:text-text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong disabled:cursor-not-allowed disabled:text-text-muted disabled:hover:bg-bg-elevated",
60
59
  "data-testid": "assistant-attach",
61
- children: /* @__PURE__ */ h(m, { className: "size-4" })
60
+ children: /* @__PURE__ */ g(h, { className: "size-4" })
62
61
  }),
63
- C ? /* @__PURE__ */ g("div", {
64
- ref: x,
62
+ w ? /* @__PURE__ */ _("div", {
63
+ ref: S,
65
64
  role: "menu",
66
- "aria-label": y("composer.attachSource", "Attach from"),
67
- className: `absolute ${f === "up" ? "bottom-full mb-2" : "top-full mt-2"} left-0 z-30 min-w-44 overflow-hidden rounded-xl border border-border-default bg-bg-elevated py-1 shadow-lg`,
65
+ "aria-label": b("composer.attachSource", "Attach from"),
66
+ className: `absolute ${p === "up" ? "bottom-full mb-2" : "top-full mt-2"} left-0 z-30 min-w-44 overflow-hidden rounded-xl border border-border-default bg-bg-elevated py-1 shadow-lg`,
68
67
  "data-testid": "assistant-attach-menu",
69
- children: [E.map((e) => {
70
- let t = _[e.id];
71
- return /* @__PURE__ */ g("button", {
68
+ children: [D.map((e) => {
69
+ let t = v[e.id];
70
+ return /* @__PURE__ */ _("button", {
72
71
  type: "button",
73
72
  role: "menuitem",
74
- disabled: !p,
75
- onClick: () => j(e),
73
+ disabled: !m,
74
+ onClick: () => M(e),
76
75
  className: "flex w-full items-center gap-2.5 px-3 py-2 text-left text-sm text-text-primary transition-colors hover:bg-bg-sunken focus:outline-none focus-visible:bg-bg-sunken disabled:cursor-not-allowed disabled:text-text-muted disabled:hover:bg-transparent",
77
76
  "data-testid": `assistant-attach-source-${e.id}`,
78
- children: [/* @__PURE__ */ h(t, {
77
+ children: [/* @__PURE__ */ g(t, {
79
78
  className: "size-4 flex-shrink-0 text-text-secondary",
80
79
  "aria-hidden": "true"
81
- }), y(e.labelKey, e.labelFallback)]
80
+ }), b(e.labelKey, e.labelFallback)]
82
81
  }, e.id);
83
- }), /* @__PURE__ */ h(i, { onActivate: () => w(!1) })]
82
+ }), /* @__PURE__ */ g(i, { onActivate: () => T(!1) })]
84
83
  }) : null
85
84
  ]
86
85
  });
87
86
  };
88
87
  //#endregion
89
- export { v as AssistantAttachmentButton };
88
+ export { y as AssistantAttachmentButton };