@burdenoff/fe-libs 2026.910.6 → 2026.911.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 (32) hide show
  1. package/dist/shared/assistant/index.d.ts +6 -0
  2. package/dist/shared/assistant/index.d.ts.map +1 -1
  3. package/dist/shared/assistant/preview/AssistantPreviewOverlay.d.ts +5 -0
  4. package/dist/shared/assistant/preview/AssistantPreviewOverlay.d.ts.map +1 -0
  5. package/dist/shared/assistant/preview/AssistantPreviewOverlay.js +65 -0
  6. package/dist/shared/assistant/preview/context.d.ts +9 -0
  7. package/dist/shared/assistant/preview/context.d.ts.map +1 -0
  8. package/dist/shared/assistant/preview/context.js +12 -0
  9. package/dist/shared/assistant/preview/previewTransitions.d.ts +78 -0
  10. package/dist/shared/assistant/preview/previewTransitions.d.ts.map +1 -0
  11. package/dist/shared/assistant/preview/previewTransitions.js +96 -0
  12. package/dist/shared/assistant/preview/types.d.ts +121 -0
  13. package/dist/shared/assistant/preview/types.d.ts.map +1 -0
  14. package/dist/shared/assistant/preview/useAssistantPreviewBridge.d.ts +3 -0
  15. package/dist/shared/assistant/preview/useAssistantPreviewBridge.d.ts.map +1 -0
  16. package/dist/shared/assistant/preview/useAssistantPreviewBridge.js +71 -0
  17. package/dist/shared/assistant/ui/AIAssistantPanel.d.ts +8 -0
  18. package/dist/shared/assistant/ui/AIAssistantPanel.d.ts.map +1 -1
  19. package/dist/shared/assistant/ui/AIAssistantPanel.js +82 -45
  20. package/dist/shared/assistant/ui/AssistantHeader.d.ts +10 -0
  21. package/dist/shared/assistant/ui/AssistantHeader.d.ts.map +1 -1
  22. package/dist/shared/assistant/ui/AssistantHeader.js +46 -36
  23. package/dist/shared/assistant/ui/panelOverlays.d.ts +48 -0
  24. package/dist/shared/assistant/ui/panelOverlays.d.ts.map +1 -0
  25. package/dist/shared/assistant/ui/panelOverlays.js +16 -0
  26. package/dist/shared/providers/shell/I18nProvider.d.ts.map +1 -1
  27. package/dist/shared/providers/shell/I18nProvider.js +72 -71
  28. package/dist/shared/providers/shell/interpolate.d.ts +30 -0
  29. package/dist/shared/providers/shell/interpolate.d.ts.map +1 -0
  30. package/dist/shared/providers/shell/interpolate.js +11 -0
  31. package/dist/shared-assistant.js +40 -35
  32. package/package.json +2 -2
@@ -4,55 +4,92 @@ 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 { AssistantHeader as o } from "./AssistantHeader.js";
8
- import { AssistantConversationList as s } from "./AssistantConversationList.js";
9
- import { useFilesServiceWarmup as c } from "../../../storage/warmFilesService.js";
10
- import { useAssistantHeartbeat as l } from "../useAssistantHeartbeat.js";
11
- import { useAssistantKeyboardShortcuts as u } from "../useAssistantKeyboardShortcuts.js";
12
- import { AssistantChatArea as d } from "./AssistantChatArea.js";
13
- import { useRef as f } from "react";
14
- import { jsx as p, jsxs as m } from "react/jsx-runtime";
7
+ import { AssistantPreviewProvider as o } from "../preview/context.js";
8
+ import { escapeDismisses as s, nextPanelOverlays as c } from "./panelOverlays.js";
9
+ import { useAssistantPreviewBridge as l } from "../preview/useAssistantPreviewBridge.js";
10
+ import { AssistantPreviewOverlay as u } from "../preview/AssistantPreviewOverlay.js";
11
+ import { AssistantHeader as d } from "./AssistantHeader.js";
12
+ import { AssistantConversationList as f } from "./AssistantConversationList.js";
13
+ import { useFilesServiceWarmup as p } from "../../../storage/warmFilesService.js";
14
+ import { useAssistantHeartbeat as m } from "../useAssistantHeartbeat.js";
15
+ import { useAssistantKeyboardShortcuts as h } from "../useAssistantKeyboardShortcuts.js";
16
+ import { AssistantChatArea as g } from "./AssistantChatArea.js";
17
+ import { useRef as _, useState as v } from "react";
18
+ import { jsx as y, jsxs as b } from "react/jsx-runtime";
15
19
  //#region src/shared/assistant/ui/AIAssistantPanel.tsx
16
- var h = ({ onClose: h, visible: g, docked: _, onToggleDock: v, writeAccess: y, onNavigate: b, connectSourceHref: x }) => {
17
- let S = t(), C = f(null), { conversations: w, activeConversationId: T, conversationListOpen: E, toggleConversationList: D, createConversation: O } = r(), k = w.find((e) => e.id === T);
18
- l(k?.backendSessionId ?? null, k?.mode ?? null, g ?? !0), c(g ?? !0);
19
- let A = e(g !== !1);
20
- return u({
21
- panelRef: C,
22
- onClose: h
23
- }), /* @__PURE__ */ p(i, {
24
- visible: g ?? !0,
25
- children: /* @__PURE__ */ p(n, {
26
- value: b,
27
- children: /* @__PURE__ */ p(a, {
28
- value: x,
29
- children: /* @__PURE__ */ m("div", {
30
- ref: C,
31
- className: "relative flex h-full w-full flex-col bg-bg-surface",
32
- role: "complementary",
33
- "aria-label": S("panel.ariaLabel", "AI Assistant"),
34
- "data-testid": "ai-assistant-panel",
35
- tabIndex: -1,
36
- children: [
37
- /* @__PURE__ */ p(o, {
38
- contextLabel: A,
39
- onNewConversation: () => O(),
40
- onOpenHistory: D,
41
- historyOpen: E,
42
- onClose: h,
43
- docked: _,
44
- onToggleDock: v
45
- }),
46
- E && /* @__PURE__ */ p(s, {}),
47
- /* @__PURE__ */ p(d, {
48
- visible: g ?? !0,
49
- writeAccess: y
50
- })
51
- ]
20
+ var x = ({ onClose: x, visible: S, docked: C, onToggleDock: w, writeAccess: T, onNavigate: E, connectSourceHref: D, preview: O }) => {
21
+ let k = t(), [A, j] = v(!1);
22
+ A && !O && j(!1);
23
+ let M = A && !!O;
24
+ l(O ?? null);
25
+ let N = _(null), { conversations: P, activeConversationId: F, conversationListOpen: I, setConversationListOpen: L, createConversation: R } = r(), z = I || M, B = (e) => {
26
+ let t = c({
27
+ historyOpen: I,
28
+ previewOpen: M
29
+ }, e);
30
+ L(t.historyOpen), j(t.previewOpen);
31
+ }, V = P.find((e) => e.id === F);
32
+ m(V?.backendSessionId ?? null, V?.mode ?? null, S ?? !0), p(S ?? !0);
33
+ let H = e(S !== !1);
34
+ return h({
35
+ panelRef: N,
36
+ onClose: () => {
37
+ if (s({
38
+ historyOpen: I,
39
+ previewOpen: M
40
+ }) === "overlay") {
41
+ L(!1), j(!1);
42
+ return;
43
+ }
44
+ x();
45
+ }
46
+ }), /* @__PURE__ */ y(i, {
47
+ visible: S ?? !0,
48
+ children: /* @__PURE__ */ y(o, {
49
+ value: O,
50
+ children: /* @__PURE__ */ y(n, {
51
+ value: E,
52
+ children: /* @__PURE__ */ y(a, {
53
+ value: D,
54
+ children: /* @__PURE__ */ b("div", {
55
+ ref: N,
56
+ className: "relative flex h-full w-full flex-col bg-bg-surface",
57
+ role: "complementary",
58
+ "aria-label": k("panel.ariaLabel", "AI Assistant"),
59
+ "data-testid": "ai-assistant-panel",
60
+ tabIndex: -1,
61
+ children: [
62
+ /* @__PURE__ */ y("div", {
63
+ className: "contents",
64
+ inert: z || void 0,
65
+ children: /* @__PURE__ */ y(d, {
66
+ contextLabel: H,
67
+ onNewConversation: () => R(),
68
+ onOpenHistory: () => B("history"),
69
+ historyOpen: I,
70
+ onTogglePreview: () => B("preview"),
71
+ previewOpen: M,
72
+ onClose: x,
73
+ docked: C,
74
+ onToggleDock: w
75
+ })
76
+ }),
77
+ I && /* @__PURE__ */ y(f, {}),
78
+ M && /* @__PURE__ */ y(u, { onClose: () => j(!1) }),
79
+ /* @__PURE__ */ y("div", {
80
+ className: "contents",
81
+ inert: z || void 0,
82
+ children: /* @__PURE__ */ y(g, {
83
+ visible: S ?? !0,
84
+ writeAccess: T
85
+ })
86
+ })
87
+ ]
88
+ })
52
89
  })
53
90
  })
54
91
  })
55
92
  });
56
93
  };
57
94
  //#endregion
58
- export { h as AIAssistantPanel };
95
+ export { x as AIAssistantPanel };
@@ -14,6 +14,16 @@ interface Props {
14
14
  onOpenHistory: () => void;
15
15
  /** True when the history drawer is currently open (drives the toggle state). */
16
16
  historyOpen: boolean;
17
+ /**
18
+ * ★★ OPTIONAL, because this component is published. `AssistantHeader` is
19
+ * `export *`-ed from the assistant barrel and reaches the built package, so a
20
+ * product that composes its own panel chrome renders it directly. Two
21
+ * REQUIRED props would have failed that product's build the moment it bumped
22
+ * fe-libs — a breaking change to ship an OPTIONAL capability, which is
23
+ * exactly backwards. Absent, the toggle simply does not render.
24
+ */
25
+ onTogglePreview?: () => void;
26
+ previewOpen?: boolean;
17
27
  onClose: () => void;
18
28
  docked?: boolean;
19
29
  onToggleDock?: () => void;
@@ -1 +1 @@
1
- {"version":3,"file":"AssistantHeader.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/ui/AssistantHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAKhC,UAAU,KAAK;IACb,qEAAqE;IACrE;;;;;;;OAOG;IACH,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,iBAAiB,EAAE,MAAM,IAAI,CAAC;IAC9B,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,gFAAgF;IAChF,WAAW,EAAE,OAAO,CAAC;IACrB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,KAAK,CAmHrC,CAAC"}
1
+ {"version":3,"file":"AssistantHeader.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/ui/AssistantHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAchC,UAAU,KAAK;IACb,qEAAqE;IACrE;;;;;;;OAOG;IACH,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,iBAAiB,EAAE,MAAM,IAAI,CAAC;IAC9B,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,gFAAgF;IAChF,WAAW,EAAE,OAAO,CAAC;IACrB;;;;;;;OAOG;IACH,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IAC7B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,KAAK,CA4IrC,CAAC"}
@@ -1,71 +1,81 @@
1
1
  import { useAssistantTr as e } from "../i18n.js";
2
- import { AssistantMoreMenu as t } from "./AssistantMoreMenu.js";
3
- import { History as n, PanelBottom as r, PanelRight as i, Plus as a, Sparkles as o, X as s } from "lucide-react";
4
- import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
2
+ import { useAssistantPreview as t } from "../preview/context.js";
3
+ import { AssistantMoreMenu as n } from "./AssistantMoreMenu.js";
4
+ import { Eye as r, History as i, PanelBottom as a, PanelRight as o, Plus as s, Sparkles as c, X as l } from "lucide-react";
5
+ import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
5
6
  //#region src/shared/assistant/ui/AssistantHeader.tsx
6
- var d = ({ contextLabel: d, onNewConversation: f, onOpenHistory: p, historyOpen: m, onClose: h, docked: g, onToggleDock: _ }) => {
7
- let v = e();
8
- return /* @__PURE__ */ u("div", {
7
+ var p = ({ contextLabel: p, onNewConversation: m, onOpenHistory: h, historyOpen: g, onTogglePreview: _, previewOpen: v, onClose: y, docked: b, onToggleDock: x }) => {
8
+ let S = e(), C = t();
9
+ return /* @__PURE__ */ f("div", {
9
10
  className: "flex items-center gap-2 border-b border-border-default bg-bg-elevated px-3 py-2.5",
10
- children: [/* @__PURE__ */ u("div", {
11
+ children: [/* @__PURE__ */ f("div", {
11
12
  className: "flex min-w-0 flex-1 items-center gap-2",
12
- children: [/* @__PURE__ */ l("span", {
13
+ children: [/* @__PURE__ */ d("span", {
13
14
  className: "flex size-7 flex-shrink-0 items-center justify-center rounded-lg bg-gradient-to-br from-action-primary-bg/25 to-action-primary-bg/5 text-action-primary-bg",
14
- children: /* @__PURE__ */ l(o, { className: "size-4" })
15
- }), /* @__PURE__ */ u("span", {
15
+ children: /* @__PURE__ */ d(c, { className: "size-4" })
16
+ }), /* @__PURE__ */ f("span", {
16
17
  className: "min-w-0 flex-1",
17
- children: [/* @__PURE__ */ l("span", {
18
+ children: [/* @__PURE__ */ d("span", {
18
19
  className: "block truncate text-[14px] font-semibold leading-tight text-text-primary",
19
- children: v("header.title", "AI Assistant")
20
- }), /* @__PURE__ */ u("span", {
20
+ children: S("header.title", "AI Assistant")
21
+ }), /* @__PURE__ */ f("span", {
21
22
  className: "block truncate text-[11px] leading-tight text-text-muted",
22
- children: [v("header.ready", "Ready"), d && /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l("span", {
23
+ children: [S("header.ready", "Ready"), p && /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d("span", {
23
24
  "aria-hidden": "true",
24
25
  children: " · "
25
- }), v("header.context", "Context: {{page}}", { page: d })] })]
26
+ }), S("header.context", "Context: {{page}}", { page: p })] })]
26
27
  })]
27
28
  })]
28
- }), /* @__PURE__ */ u("div", {
29
+ }), /* @__PURE__ */ f("div", {
29
30
  className: "flex flex-shrink-0 items-center gap-0.5",
30
31
  children: [
31
- /* @__PURE__ */ l("button", {
32
+ /* @__PURE__ */ d("button", {
32
33
  type: "button",
33
- onClick: f,
34
+ onClick: m,
34
35
  className: "rounded-lg p-1.5 text-text-secondary transition-colors hover:bg-bg-sunken hover:text-text-primary",
35
- "aria-label": v("header.newConversation", "New conversation"),
36
+ "aria-label": S("header.newConversation", "New conversation"),
36
37
  "data-testid": "assistant-new-conversation",
37
- children: /* @__PURE__ */ l(a, { className: "size-4" })
38
+ children: /* @__PURE__ */ d(s, { className: "size-4" })
38
39
  }),
39
- /* @__PURE__ */ l("button", {
40
+ /* @__PURE__ */ d("button", {
40
41
  type: "button",
41
- onClick: p,
42
- className: `rounded-lg p-1.5 transition-colors ${m ? "bg-action-primary-bg/15 text-action-primary-bg" : "text-text-secondary hover:bg-bg-sunken hover:text-text-primary"}`,
43
- "aria-label": v("header.history", "Conversation history"),
44
- "aria-pressed": m,
42
+ onClick: h,
43
+ className: `rounded-lg p-1.5 transition-colors ${g ? "bg-action-primary-bg/15 text-action-primary-bg" : "text-text-secondary hover:bg-bg-sunken hover:text-text-primary"}`,
44
+ "aria-label": S("header.history", "Conversation history"),
45
+ "aria-pressed": g,
45
46
  "data-testid": "assistant-open-history",
46
- children: /* @__PURE__ */ l(n, { className: "size-4" })
47
+ children: /* @__PURE__ */ d(i, { className: "size-4" })
47
48
  }),
48
- /* @__PURE__ */ l(t, {}),
49
- _ && /* @__PURE__ */ l("button", {
49
+ C && _ && /* @__PURE__ */ d("button", {
50
50
  type: "button",
51
51
  onClick: _,
52
+ className: `rounded-lg p-1.5 transition-colors ${v ? "bg-action-primary-bg/15 text-action-primary-bg" : "text-text-secondary hover:bg-bg-sunken hover:text-text-primary"}`,
53
+ "aria-label": C.label ?? S("header.preview", "Preview"),
54
+ "aria-pressed": !!v,
55
+ "data-testid": "assistant-toggle-preview",
56
+ children: /* @__PURE__ */ d(r, { className: "size-4" })
57
+ }),
58
+ /* @__PURE__ */ d(n, {}),
59
+ x && /* @__PURE__ */ d("button", {
60
+ type: "button",
61
+ onClick: x,
52
62
  className: "hidden rounded-lg p-1.5 text-text-secondary transition-colors hover:bg-bg-sunken hover:text-text-primary sm:inline-flex",
53
- "aria-label": g ? v("header.float", "Float chat window") : v("header.dock", "Dock to side panel"),
54
- "aria-pressed": g,
63
+ "aria-label": b ? S("header.float", "Float chat window") : S("header.dock", "Dock to side panel"),
64
+ "aria-pressed": b,
55
65
  "data-testid": "assistant-toggle-dock",
56
- children: l(g ? r : i, { className: "size-4" })
66
+ children: d(b ? a : o, { className: "size-4" })
57
67
  }),
58
- /* @__PURE__ */ l("button", {
68
+ /* @__PURE__ */ d("button", {
59
69
  type: "button",
60
- onClick: h,
70
+ onClick: y,
61
71
  className: "rounded-lg p-1.5 text-text-secondary transition-colors hover:bg-bg-sunken hover:text-text-primary",
62
- "aria-label": v("header.close", "Close assistant"),
72
+ "aria-label": S("header.close", "Close assistant"),
63
73
  "data-testid": "assistant-close",
64
- children: /* @__PURE__ */ l(s, { className: "size-4" })
74
+ children: /* @__PURE__ */ d(l, { className: "size-4" })
65
75
  })
66
76
  ]
67
77
  })]
68
78
  });
69
79
  };
70
80
  //#endregion
71
- export { d as AssistantHeader };
81
+ export { p as AssistantHeader };
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Which of the panel's full-surface overlays is showing.
3
+ *
4
+ * ★★ THEY ARE MUTUALLY EXCLUSIVE, and that is not a style choice. The history
5
+ * drawer (`AssistantConversationList.tsx:71`) and the preview surface
6
+ * (`AssistantPreviewOverlay.tsx:57`) are BOTH `absolute inset-0 z-10` with an
7
+ * opaque `bg-bg-surface`, inside the same relative panel. Equal z-index means
8
+ * the later one in DOM order simply paints over the earlier one, so allowing
9
+ * both produces three separate defects at once:
10
+ *
11
+ * - the covered surface is invisible while its own toggle still reports
12
+ * `aria-pressed="true"`, so a screen reader announces a drawer the sighted
13
+ * user cannot see and the sighted user sees a pressed button doing nothing;
14
+ * - closing the top one makes a surface the user had forgotten reappear
15
+ * unbidden, over their conversation;
16
+ * - which one wins depends on JSX order, so a future reorder silently swaps
17
+ * the behaviour with nothing to catch it.
18
+ *
19
+ * Modelled as one slot with two toggles rather than two independent booleans,
20
+ * because "at most one is true" is then true by construction instead of by
21
+ * everyone remembering to close the other one.
22
+ */
23
+ export interface PanelOverlayState {
24
+ readonly historyOpen: boolean;
25
+ readonly previewOpen: boolean;
26
+ }
27
+ /** Nothing showing — the state the panel opens in. */
28
+ export declare const NO_PANEL_OVERLAY: PanelOverlayState;
29
+ /**
30
+ * The state after the user presses one of the two toggles.
31
+ *
32
+ * Pressing the toggle of the overlay already showing closes it; pressing the
33
+ * other one swaps to it. There is deliberately no way to express "both".
34
+ */
35
+ export declare function nextPanelOverlays(current: PanelOverlayState, toggled: "history" | "preview"): PanelOverlayState;
36
+ /**
37
+ * What Escape should dismiss.
38
+ *
39
+ * ★★ THE TOPMOST LAYER, NOT THE WHOLE ASSISTANT. `useAssistantKeyboardShortcuts`
40
+ * calls `onClose()` on Escape (`:39-43`), and both host apps mount the panel as
41
+ * `{isOpen && <AIAssistantPanel/>}` — so with an overlay open, Escape did not
42
+ * close the overlay, it UNMOUNTED the assistant and took the in-flight turn,
43
+ * the composer draft and the attachments with it. The user's mental model of
44
+ * Escape is "back out of the thing I just opened"; here it destroyed a
45
+ * conversation instead.
46
+ */
47
+ export declare function escapeDismisses(current: PanelOverlayState): "overlay" | "panel";
48
+ //# sourceMappingURL=panelOverlays.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"panelOverlays.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/ui/panelOverlays.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;CAC/B;AAED,sDAAsD;AACtD,eAAO,MAAM,gBAAgB,EAAE,iBAG9B,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,iBAAiB,EAC1B,OAAO,EAAE,SAAS,GAAG,SAAS,GAC7B,iBAAiB,CAOnB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,iBAAiB,GACzB,SAAS,GAAG,OAAO,CAErB"}
@@ -0,0 +1,16 @@
1
+ //#region src/shared/assistant/ui/panelOverlays.ts
2
+ var e = {
3
+ historyOpen: !1,
4
+ previewOpen: !1
5
+ };
6
+ function t(t, n) {
7
+ return (n === "history" ? t.historyOpen : t.previewOpen) ? e : {
8
+ historyOpen: n === "history",
9
+ previewOpen: n === "preview"
10
+ };
11
+ }
12
+ function n(e) {
13
+ return e.historyOpen || e.previewOpen ? "overlay" : "panel";
14
+ }
15
+ //#endregion
16
+ export { e as NO_PANEL_OVERLAY, n as escapeDismisses, t as nextPanelOverlays };
@@ -1 +1 @@
1
- {"version":3,"file":"I18nProvider.d.ts","sourceRoot":"","sources":["../../../../src/shared/providers/shell/I18nProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,MAAM,MAAM,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAWlF,MAAM,WAAW,qBAAqB;IACpC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,qBAAqB,CAAC;CAC/C;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,qBAAqB,CAAC;IACpC,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,CAAC,EAAE,CACD,GAAG,EAAE,MAAM,EACX,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,EAC3D,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,KACrC,MAAM,CAAC;IACZ,uDAAuD;IACvD,SAAS,EAAE,OAAO,CAAC;IACnB,gDAAgD;IAChD,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAID;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,qBAAqB,CAAC,CAAC;AAErF,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,SAAS,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH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,SAAS,EACT,iBAAiB,EACjB,wBAA+B,EAC/B,gBAAgB,GACjB,EAAE,iBAAiB,2CAwMnB;AAED,wBAAgB,OAAO,qBAMtB;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,IAAI,IAAI,CAE5C;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE9D"}
@@ -1,7 +1,8 @@
1
- import { createContext as e, use as t, useCallback as n, useEffect as r, useMemo as i, useRef as a, useState as o } from "react";
2
- import { Fragment as s, jsx as c } from "react/jsx-runtime";
1
+ import { interpolate as e } from "./interpolate.js";
2
+ import { createContext as t, use as n, useCallback as r, useEffect as i, useMemo as a, useRef as o, useState as s } from "react";
3
+ import { Fragment as c, jsx as l } from "react/jsx-runtime";
3
4
  //#region src/shared/providers/shell/I18nProvider.tsx
4
- var l = e(null), u = {
5
+ var u = t(null), d = {
5
6
  en: {},
6
7
  es: {},
7
8
  fr: {},
@@ -11,7 +12,7 @@ var l = e(null), u = {
11
12
  ta: {},
12
13
  hi: {},
13
14
  ar: {}
14
- }, d = {
15
+ }, f = {
15
16
  attempted: /* @__PURE__ */ new Set(),
16
17
  translations: {},
17
18
  version: 0,
@@ -19,7 +20,7 @@ var l = e(null), u = {
19
20
  this.attempted.clear(), this.translations = {}, this.version++;
20
21
  }
21
22
  };
22
- function f(e, t, n) {
23
+ function p(e, t, n) {
23
24
  if (typeof window > "u") return n;
24
25
  if (e) {
25
26
  let t = localStorage.getItem(`bf-p-${e}-locale`);
@@ -27,17 +28,17 @@ function f(e, t, n) {
27
28
  }
28
29
  return localStorage.getItem(t) || n;
29
30
  }
30
- function p(e, t) {
31
+ function m(e, t) {
31
32
  if (!e) return;
32
33
  let n = t.split("."), r = e;
33
34
  for (let e of n) if (typeof r == "object" && r && e in r) r = r[e];
34
35
  else return;
35
36
  return typeof r == "string" ? r : void 0;
36
37
  }
37
- function m(e) {
38
+ function h(e) {
38
39
  return typeof e == "object" && !!e;
39
40
  }
40
- function h(e, t) {
41
+ function g(e, t) {
41
42
  if (!e && !t) return {};
42
43
  if (!e) return { ...t ?? {} };
43
44
  if (!t) return { ...e };
@@ -48,103 +49,103 @@ function h(e, t) {
48
49
  n[e] = r;
49
50
  continue;
50
51
  }
51
- n[e] = h(m(t) ? t : void 0, r);
52
+ n[e] = g(h(t) ? t : void 0, r);
52
53
  }
53
54
  return n;
54
55
  }
55
- function g({ children: e, defaultLocale: t = "en", translations: m = u, storageKey: g = "burdenoff-locale", profileId: _, fetchTranslations: v, showChildrenWhileLoading: y = !0, loadingComponent: b }) {
56
- let [x, S] = o(() => f(_, g, t)), [C, w] = o({}), [T, E] = o(!!v), [D, O] = o(null), k = a(/* @__PURE__ */ new Set()), A = a(d.version), j = i(() => {
57
- let e = { ...m };
58
- for (let [t, n] of Object.entries(C)) if (n && Object.keys(n).length > 0) {
56
+ function _({ children: t, defaultLocale: n = "en", translations: h = d, storageKey: _ = "burdenoff-locale", profileId: v, fetchTranslations: y, showChildrenWhileLoading: b = !0, loadingComponent: x }) {
57
+ let [S, C] = s(() => p(v, _, n)), [w, T] = s({}), [E, D] = s(!!y), [O, k] = s(null), A = o(/* @__PURE__ */ new Set()), j = o(f.version), M = a(() => {
58
+ let e = { ...h };
59
+ for (let [t, n] of Object.entries(w)) if (n && Object.keys(n).length > 0) {
59
60
  let r = t;
60
- e[r] = h(m[r], n);
61
+ e[r] = g(h[r], n);
61
62
  }
62
63
  return e;
63
- }, [m, C]), M = n(async (e) => {
64
- if (v) {
65
- if (A.current !== d.version && (k.current.clear(), A.current = d.version), d.attempted.has(e)) {
66
- let t = d.translations[e];
67
- t && Object.keys(t).length > 0 && w((n) => !n[e] || Object.keys(n[e]).length === 0 ? {
64
+ }, [h, w]), N = r(async (e) => {
65
+ if (y) {
66
+ if (j.current !== f.version && (A.current.clear(), j.current = f.version), f.attempted.has(e)) {
67
+ let t = f.translations[e];
68
+ t && Object.keys(t).length > 0 && T((n) => !n[e] || Object.keys(n[e]).length === 0 ? {
68
69
  ...n,
69
70
  [e]: t
70
71
  } : n);
71
72
  return;
72
73
  }
73
- if (!k.current.has(e)) {
74
- k.current.add(e), E(!0), O(null);
74
+ if (!A.current.has(e)) {
75
+ A.current.add(e), D(!0), k(null);
75
76
  try {
76
- let t = await v(e);
77
- t && Object.keys(t).length > 0 && (d.attempted.add(e), d.translations[e] = t), w((n) => ({
77
+ let t = await y(e);
78
+ t && Object.keys(t).length > 0 && (f.attempted.add(e), f.translations[e] = t), T((n) => ({
78
79
  ...n,
79
80
  [e]: t
80
81
  }));
81
82
  } catch (t) {
82
- console.error(`[I18nProvider] Failed to fetch translations for ${e}:`, t), O(t instanceof Error ? t.message : "Failed to fetch translations");
83
+ console.error(`[I18nProvider] Failed to fetch translations for ${e}:`, t), k(t instanceof Error ? t.message : "Failed to fetch translations");
83
84
  } finally {
84
- k.current.delete(e), E(!1);
85
+ A.current.delete(e), D(!1);
85
86
  }
86
87
  }
87
88
  }
88
- }, [v]);
89
- r(() => {
90
- v && (d.attempted.has(x) && d.translations[x] && Object.keys(d.translations[x]).length > 0 || M(x));
89
+ }, [y]);
90
+ i(() => {
91
+ y && (f.attempted.has(S) && f.translations[S] && Object.keys(f.translations[S]).length > 0 || N(S));
91
92
  }, [
92
- v,
93
- x,
94
- M
95
- ]), r(() => {
96
- let e = f(_, g, t);
97
- S(e), document.documentElement.setAttribute("lang", e);
93
+ y,
94
+ S,
95
+ N
96
+ ]), i(() => {
97
+ let e = p(v, _, n);
98
+ C(e), document.documentElement.setAttribute("lang", e);
98
99
  }, [
100
+ v,
99
101
  _,
100
- g,
101
- t
102
+ n
102
103
  ]);
103
- let N = n((e) => {
104
- S(e), localStorage.setItem(g, e), _ && localStorage.setItem(`bf-p-${_}-locale`, e), document.documentElement.setAttribute("lang", e);
105
- }, [g, _]), P = n((e, n, r) => {
106
- let i, a;
107
- if (typeof n == "string") i = n, a = r;
108
- else if (n && typeof n == "object") {
109
- let { defaultValue: e, ...t } = n;
110
- typeof e == "string" ? i = e : typeof e == "number" && (i = String(e)), a = t;
104
+ let P = r((e) => {
105
+ C(e), localStorage.setItem(_, e), v && localStorage.setItem(`bf-p-${v}-locale`, e), document.documentElement.setAttribute("lang", e);
106
+ }, [_, v]), F = r((t, r, i) => {
107
+ let a, o;
108
+ if (typeof r == "string") a = r, o = i;
109
+ else if (r && typeof r == "object") {
110
+ let { defaultValue: e, ...t } = r;
111
+ typeof e == "string" ? a = e : typeof e == "number" && (a = String(e)), o = t;
111
112
  }
112
- let o = p(j[x], e) ?? (x === t ? void 0 : p(j[t], e)) ?? (t === "en" ? void 0 : p(j.en, e)) ?? i ?? e;
113
- return a ? Object.entries(a).reduce((e, [t, n]) => e.replaceAll(`{{${t}}}`, String(n)), o) : o;
113
+ let s = m(M[S], t) ?? (S === n ? void 0 : m(M[n], t)) ?? (n === "en" ? void 0 : m(M.en, t)) ?? a ?? t;
114
+ return o ? e(s, o) : s;
114
115
  }, [
115
- x,
116
- j,
117
- t
118
- ]), F = i(() => ({
119
- locale: x,
120
- translations: j[x] || {},
121
- setLocale: N,
122
- t: P,
123
- isLoading: T,
124
- error: D
116
+ S,
117
+ M,
118
+ n
119
+ ]), I = a(() => ({
120
+ locale: S,
121
+ translations: M[S] || {},
122
+ setLocale: P,
123
+ t: F,
124
+ isLoading: E,
125
+ error: O
125
126
  }), [
126
- x,
127
- j,
128
- N,
127
+ S,
128
+ M,
129
129
  P,
130
- T,
131
- D
130
+ F,
131
+ E,
132
+ O
132
133
  ]);
133
- return T && !y && b ? /* @__PURE__ */ c(s, { children: b }) : /* @__PURE__ */ c(l.Provider, {
134
- value: F,
135
- children: e
134
+ return E && !b && x ? /* @__PURE__ */ l(c, { children: x }) : /* @__PURE__ */ l(u.Provider, {
135
+ value: I,
136
+ children: t
136
137
  });
137
138
  }
138
- function _() {
139
- let e = t(l);
139
+ function v() {
140
+ let e = n(u);
140
141
  if (!e) throw Error("useI18n must be used within an I18nProvider");
141
142
  return e;
142
143
  }
143
- function v() {
144
- d.clear();
144
+ function y() {
145
+ f.clear();
145
146
  }
146
- function y(e) {
147
- return d.attempted.has(e);
147
+ function b(e) {
148
+ return f.attempted.has(e);
148
149
  }
149
150
  //#endregion
150
- export { g as I18nProvider, v as clearTranslationCache, y as isTranslationAttempted, h as mergeTranslationDictionaries, _ as useI18n };
151
+ export { _ as I18nProvider, y as clearTranslationCache, b as isTranslationAttempted, g as mergeTranslationDictionaries, v as useI18n };
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Substitute `{{name}}` and `{name}` placeholders in one left-to-right pass.
3
+ *
4
+ * WHY BOTH SPELLINGS
5
+ * `{{name}}` is the house style, but a large amount of already-SEEDED copy uses
6
+ * the single brace: 174 rows in the FluidGrids production dictionary alone (25
7
+ * of them `dashboard.*`) against 512 rows using `{{name}}`. Those strings were
8
+ * authored in MFEs whose local fallback helper interpolates single braces, so
9
+ * they looked correct until the key reached the dictionary and `t()` began
10
+ * returning the stored value instead of the local fallback — at which point the
11
+ * FluidGrids dashboard rendered `{memberLabel} across {count} {workspaceLabel}`
12
+ * verbatim to users (BOFF-7245). Accepting both spellings fixes every such row
13
+ * in every product with no re-seed.
14
+ *
15
+ * WHY ONE REGEX PASS AND NOT CHAINED `replaceAll`
16
+ * Chained replacement re-scans text it has already written. A parameter whose
17
+ * VALUE happens to contain braces — a workspace literally named "{count}", a
18
+ * translated string carrying a placeholder — would be substituted a second time
19
+ * on a later iteration. Matching once and looking each name up leaves inserted
20
+ * values untouched, and it is also why a repeated placeholder works: every
21
+ * occurrence is matched by the same pass, which the old `replace` (first match
22
+ * only) got wrong for "…{{observed}}{{unit}} · threshold {{threshold}}{{unit}}".
23
+ *
24
+ * An unknown name is left exactly as written rather than blanked, so a missing
25
+ * parameter shows up as `{name}` in review instead of silently vanishing, and
26
+ * braces that are not placeholders at all — `{}` in a code sample, `{0}` in an
27
+ * index template — survive untouched.
28
+ */
29
+ export declare function interpolate(template: string, params: Record<string, string | number>): string;
30
+ //# sourceMappingURL=interpolate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interpolate.d.ts","sourceRoot":"","sources":["../../../../src/shared/providers/shell/interpolate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,GAAG,MAAM,CAU7F"}
@@ -0,0 +1,11 @@
1
+ //#region src/shared/providers/shell/interpolate.ts
2
+ function e(e, t) {
3
+ return e.replace(/\{\{(\w+)\}\}|\{(\w+)\}/g, (e, n, r) => {
4
+ let i = n ?? r;
5
+ if (i === void 0) return e;
6
+ let a = t[i];
7
+ return a === void 0 ? e : String(a);
8
+ });
9
+ }
10
+ //#endregion
11
+ export { e as interpolate };