@burdenoff/fe-libs 2026.1118.4 → 2026.1118.6

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 (55) hide show
  1. package/dist/platform-pages/AppearanceSettingsPage.d.ts +9 -13
  2. package/dist/platform-pages/AppearanceSettingsPage.js +7 -4
  3. package/dist/platform-pages/index.d.ts +1 -1
  4. package/dist/shared/assistant/home/AssistantHomePage.d.ts +29 -1
  5. package/dist/shared/assistant/home/AssistantHomePage.js +63 -36
  6. package/dist/shared/assistant/home/AssistantHomeStart.d.ts +12 -0
  7. package/dist/shared/assistant/home/AssistantHomeStart.js +24 -15
  8. package/dist/shared/assistant/home.js +5 -5
  9. package/dist/shared/assistant/ui/AIAssistantPanel.js +152 -152
  10. package/dist/shared/assistant/ui/compact/AssistantCompactHeader.d.ts +9 -0
  11. package/dist/shared/assistant/ui/compact/AssistantCompactHeader.js +62 -52
  12. package/dist/shared/assistant/ui/compact/AssistantWindowHeader.js +29 -35
  13. package/dist/shared/assistant/ui/compact/windowTitle.d.ts +32 -9
  14. package/dist/shared/assistant/ui/compact/windowTitle.js +31 -6
  15. package/dist/shared/backgrounds/BackgroundEffect.d.ts +7 -0
  16. package/dist/shared/backgrounds/BackgroundEffect.js +24 -0
  17. package/dist/shared/backgrounds/BackgroundPicker.d.ts +49 -0
  18. package/dist/shared/backgrounds/BackgroundPicker.js +133 -0
  19. package/dist/shared/backgrounds/BackgroundRoot.d.ts +13 -0
  20. package/dist/shared/backgrounds/BackgroundRoot.js +44 -0
  21. package/dist/shared/backgrounds/CursorWave.d.ts +19 -0
  22. package/dist/shared/backgrounds/CursorWave.js +40 -0
  23. package/dist/shared/backgrounds/DottedWaves.d.ts +20 -0
  24. package/dist/shared/backgrounds/DottedWaves.js +36 -0
  25. package/dist/shared/backgrounds/Glimmer.d.ts +18 -0
  26. package/dist/shared/backgrounds/Glimmer.js +38 -0
  27. package/dist/shared/backgrounds/backgroundGround.d.ts +5 -0
  28. package/dist/shared/backgrounds/backgroundGround.js +16 -0
  29. package/dist/shared/backgrounds/backgroundTypes.d.ts +38 -0
  30. package/dist/shared/backgrounds/backgroundTypes.js +20 -0
  31. package/dist/shared/backgrounds/canvasEffect.d.ts +51 -0
  32. package/dist/shared/backgrounds/canvasEffect.js +97 -0
  33. package/dist/shared/backgrounds/color.d.ts +56 -0
  34. package/dist/shared/backgrounds/color.js +153 -0
  35. package/dist/shared/backgrounds/cursorWavePool.d.ts +7 -0
  36. package/dist/shared/backgrounds/cursorWavePool.js +14 -0
  37. package/dist/shared/backgrounds/cursorWaveRenderer.d.ts +43 -0
  38. package/dist/shared/backgrounds/cursorWaveRenderer.js +146 -0
  39. package/dist/shared/backgrounds/dottedWavesRenderer.d.ts +72 -0
  40. package/dist/shared/backgrounds/dottedWavesRenderer.js +176 -0
  41. package/dist/shared/backgrounds/glimmerRenderer.d.ts +65 -0
  42. package/dist/shared/backgrounds/glimmerRenderer.js +254 -0
  43. package/dist/shared/backgrounds/index.d.ts +31 -0
  44. package/dist/shared/backgrounds/noise.d.ts +19 -0
  45. package/dist/shared/backgrounds/noise.js +143 -0
  46. package/dist/shared/backgrounds/originalPalettes.d.ts +36 -0
  47. package/dist/shared/backgrounds/originalPalettes.js +24 -0
  48. package/dist/shared/backgrounds/useBackgroundColors.d.ts +40 -0
  49. package/dist/shared/backgrounds/useBackgroundColors.js +165 -0
  50. package/dist/shared/backgrounds/useBackgroundPreference.d.ts +26 -0
  51. package/dist/shared/backgrounds/useBackgroundPreference.js +109 -0
  52. package/dist/shared-assistant.js +79 -79
  53. package/dist/shared-backgrounds.d.ts +2 -0
  54. package/dist/shared-backgrounds.js +16 -0
  55. package/package.json +9 -1
@@ -2,82 +2,92 @@ import { useAssistantTr as e } from "../../i18n.js";
2
2
  import { useAssistantPreview as t } from "../../preview/context.js";
3
3
  import { hasAssistantPreviewSurface as n } from "../../preview/types.js";
4
4
  import { assistantPageLabelKey as r, translateProductCopy as i } from "../../productCopy.js";
5
- import { Eye as a, Maximize2 as o, Menu as s, Minimize2 as c, Sparkles as l, X as u } from "lucide-react";
6
- import { jsx as d, jsxs as f } from "react/jsx-runtime";
5
+ import { useAssistantProductTitle as a, useFittedAssistantTitle as o } from "./windowTitle.js";
6
+ import { useRef as s } from "react";
7
+ import { Eye as c, Maximize2 as l, Menu as u, Minimize2 as d, Sparkles as f, X as p } from "lucide-react";
8
+ import { jsx as m, jsxs as h } from "react/jsx-runtime";
7
9
  // src/shared/assistant/ui/compact/AssistantCompactHeader.tsx
8
- var p = "flex size-10 shrink-0 items-center justify-center rounded-button transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]", m = "text-text-secondary hover:bg-bg-sunken hover:text-text-primary", h = "bg-action-primary-bg/15 text-action-primary-bg", g = ({ contextLabel: g, menuOpen: _, menuViewId: v, onOpenMenu: y, menuButtonRef: b, conversationMenu: x, expandOffered: S, expanded: C, onToggleExpanded: w, onTogglePreview: T, previewOpen: E, onClose: D }) => {
9
- let O = e(), k = t();
10
- return /* @__PURE__ */ f("div", {
10
+ var g = "flex size-10 shrink-0 items-center justify-center rounded-button transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]", _ = "text-text-secondary hover:bg-bg-sunken hover:text-text-primary", v = "bg-action-primary-bg/15 text-action-primary-bg", y = ({ contextLabel: t }) => {
11
+ let n = e(), c = a() ?? n("header.title", "AI Assistant"), l = s(null), u = s(null);
12
+ return o(l, c, u), /* @__PURE__ */ h("div", {
13
+ className: "flex min-h-7 min-w-0 flex-1 items-center gap-3",
14
+ children: [/* @__PURE__ */ m("span", {
15
+ ref: u,
16
+ className: "ms-1 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 data-[dropped]:hidden",
17
+ "data-testid": "assistant-header-mark",
18
+ children: /* @__PURE__ */ m(f, {
19
+ className: "size-4",
20
+ "aria-hidden": "true"
21
+ })
22
+ }), /* @__PURE__ */ h("span", {
23
+ className: "min-w-0 flex-1",
24
+ children: [/* @__PURE__ */ m("span", {
25
+ ref: l,
26
+ className: "block truncate text-base font-semibold leading-5 text-text-primary data-[tight]:text-[15px] data-[tighter]:text-sm",
27
+ title: c,
28
+ "data-testid": "assistant-header-title",
29
+ children: c
30
+ }), t ? /* @__PURE__ */ m("span", {
31
+ className: "mt-0.5 block truncate text-xs leading-tight text-text-muted",
32
+ children: n("header.context", "Context: {{page}}", { page: i(n, r(t), t) })
33
+ }) : null]
34
+ })]
35
+ });
36
+ }, b = ({ contextLabel: r, menuOpen: i, menuViewId: a, onOpenMenu: o, menuButtonRef: s, conversationMenu: f, expandOffered: b, expanded: x, onToggleExpanded: S, onTogglePreview: C, previewOpen: w, onClose: T }) => {
37
+ let E = e(), D = t();
38
+ return /* @__PURE__ */ h("div", {
11
39
  className: "flex min-h-14 items-center gap-0.5 border-b border-border-default bg-bg-elevated px-2 py-2",
12
40
  "data-testid": "assistant-header",
13
41
  "data-presentation": "compact",
14
42
  children: [
15
- /* @__PURE__ */ d("button", {
16
- ref: b,
43
+ /* @__PURE__ */ m("button", {
44
+ ref: s,
17
45
  type: "button",
18
- onClick: y,
19
- className: `${p} ${m}`,
20
- "aria-label": O("header.menu", "Assistant menu"),
21
- "aria-expanded": _,
22
- "aria-controls": _ ? v : void 0,
46
+ onClick: o,
47
+ className: `${g} ${_}`,
48
+ "aria-label": E("header.menu", "Assistant menu"),
49
+ "aria-expanded": i,
50
+ "aria-controls": i ? a : void 0,
23
51
  "data-testid": "assistant-menu",
24
- children: /* @__PURE__ */ d(s, {
52
+ children: /* @__PURE__ */ m(u, {
25
53
  className: "size-5",
26
54
  "aria-hidden": "true"
27
55
  })
28
56
  }),
29
- /* @__PURE__ */ f("div", {
30
- className: "flex min-w-0 flex-1 items-center gap-3 ps-1",
31
- children: [/* @__PURE__ */ d("span", {
32
- 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",
33
- children: /* @__PURE__ */ d(l, {
34
- className: "size-4",
35
- "aria-hidden": "true"
36
- })
37
- }), /* @__PURE__ */ f("span", {
38
- className: "min-w-0 flex-1",
39
- children: [/* @__PURE__ */ d("span", {
40
- className: "block truncate text-base font-semibold leading-tight text-text-primary",
41
- children: O("header.title", "AI Assistant")
42
- }), g ? /* @__PURE__ */ d("span", {
43
- className: "mt-0.5 block truncate text-xs leading-tight text-text-muted",
44
- children: O("header.context", "Context: {{page}}", { page: i(O, r(g), g) })
45
- }) : null]
46
- })]
47
- }),
48
- n(k) && T ? /* @__PURE__ */ d("button", {
57
+ /* @__PURE__ */ m(y, { contextLabel: r }),
58
+ n(D) && C ? /* @__PURE__ */ m("button", {
49
59
  type: "button",
50
- onClick: T,
51
- className: `${p} ${E ? h : m}`,
52
- "aria-label": k.label ?? O("header.preview", "Preview"),
53
- "aria-pressed": !!E,
60
+ onClick: C,
61
+ className: `${g} ${w ? v : _}`,
62
+ "aria-label": D.label ?? E("header.preview", "Preview"),
63
+ "aria-pressed": !!w,
54
64
  "data-testid": "assistant-toggle-preview",
55
- children: /* @__PURE__ */ d(a, {
65
+ children: /* @__PURE__ */ m(c, {
56
66
  className: "size-5",
57
67
  "aria-hidden": "true"
58
68
  })
59
69
  }) : null,
60
- x,
61
- S ? /* @__PURE__ */ d("button", {
70
+ f,
71
+ b ? /* @__PURE__ */ m("button", {
62
72
  type: "button",
63
- onClick: w,
64
- className: `${p} ${C ? h : m}`,
65
- "aria-label": O("header.expand", "Expand assistant"),
66
- "aria-pressed": C,
67
- title: C ? O("header.restoreSize", "Restore size") : O("header.expandTip", "Expand"),
73
+ onClick: S,
74
+ className: `${g} ${x ? v : _}`,
75
+ "aria-label": E("header.expand", "Expand assistant"),
76
+ "aria-pressed": x,
77
+ title: x ? E("header.restoreSize", "Restore size") : E("header.expandTip", "Expand"),
68
78
  "data-testid": "assistant-expand",
69
- children: d(C ? c : o, {
79
+ children: m(x ? d : l, {
70
80
  className: "size-5",
71
81
  "aria-hidden": "true"
72
82
  })
73
83
  }) : null,
74
- D ? /* @__PURE__ */ d("button", {
84
+ T ? /* @__PURE__ */ m("button", {
75
85
  type: "button",
76
- onClick: D,
77
- className: `${p} ${m}`,
78
- "aria-label": O("header.close", "Close assistant"),
86
+ onClick: T,
87
+ className: `${g} ${_}`,
88
+ "aria-label": E("header.close", "Close assistant"),
79
89
  "data-testid": "assistant-close",
80
- children: /* @__PURE__ */ d(u, {
90
+ children: /* @__PURE__ */ m(p, {
81
91
  className: "size-5",
82
92
  "aria-hidden": "true"
83
93
  })
@@ -85,4 +95,4 @@ var p = "flex size-10 shrink-0 items-center justify-center rounded-button transi
85
95
  ]
86
96
  });
87
97
  };
88
- export { g as AssistantCompactHeader };
98
+ export { b as AssistantCompactHeader };
@@ -1,63 +1,57 @@
1
1
  import { useAssistantTr as e } from "../../i18n.js";
2
2
  import { AssistantLanguagePill as t } from "./AssistantLanguagePill.js";
3
- import { fitAssistantWindowTitle as n, useAssistantWindowTitle as r } from "./windowTitle.js";
4
- import { useLayoutEffect as i, useRef as a } from "react";
5
- import { Minus as o, PanelRight as s, Sparkles as c } from "lucide-react";
6
- import { jsx as l, jsxs as u } from "react/jsx-runtime";
3
+ import { useAssistantWindowTitle as n, useFittedAssistantTitle as r } from "./windowTitle.js";
4
+ import { useRef as i } from "react";
5
+ import { Minus as a, PanelRight as o, Sparkles as s } from "lucide-react";
6
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
7
7
  // src/shared/assistant/ui/compact/AssistantWindowHeader.tsx
8
- var d = "flex size-10 shrink-0 items-center justify-center rounded-button transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]", f = "text-text-secondary hover:bg-bg-sunken hover:text-text-primary", p = ({ voiceLive: p, avatarOn: m, onOpenFull: h, onMinimize: g }) => {
9
- let _ = e(), v = r(), y = a(null);
10
- i(() => {
11
- let e = y.current;
12
- if (!e) return;
13
- let t = () => n(e);
14
- if (t(), typeof ResizeObserver > "u" || !e.parentElement) return;
15
- let r = new ResizeObserver(t);
16
- return r.observe(e.parentElement), () => r.disconnect();
17
- }, [v]);
18
- let b = _("window.openFull", "Open full assistant"), x = m ? _("window.openFullAvatarStays", "Open full assistant (the avatar stays on)") : b, S = m && p ? _("window.minimizeEndsAvatarAndVoice", "Minimize (turns off the avatar and ends voice)") : m ? _("window.minimizeTurnsOffAvatar", "Minimize (turns off the avatar)") : p ? _("window.minimizeEndsVoice", "Minimize (ends voice)") : _("window.minimize", "Minimize");
19
- return /* @__PURE__ */ u("div", {
8
+ var u = "flex size-10 shrink-0 items-center justify-center rounded-button transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]", d = "text-text-secondary hover:bg-bg-sunken hover:text-text-primary", f = ({ voiceLive: f, avatarOn: p, onOpenFull: m, onMinimize: h }) => {
9
+ let g = e(), _ = n(), v = i(null), y = i(null);
10
+ r(v, _, y);
11
+ let b = g("window.openFull", "Open full assistant"), x = p ? g("window.openFullAvatarStays", "Open full assistant (the avatar stays on)") : b, S = p && f ? g("window.minimizeEndsAvatarAndVoice", "Minimize (turns off the avatar and ends voice)") : p ? g("window.minimizeTurnsOffAvatar", "Minimize (turns off the avatar)") : f ? g("window.minimizeEndsVoice", "Minimize (ends voice)") : g("window.minimize", "Minimize");
12
+ return /* @__PURE__ */ l("div", {
20
13
  className: "relative flex h-[3.25rem] shrink-0 items-center gap-0.5 border-b border-border-subtle py-1.5 pe-1.5 ps-2.5",
21
14
  "data-testid": "assistant-window-header",
22
15
  "data-presentation": "compact",
23
16
  "data-surface": "window",
24
17
  children: [
25
- /* @__PURE__ */ u("div", {
26
- className: "flex min-w-0 flex-1 items-center gap-2",
27
- children: [/* @__PURE__ */ l("span", {
28
- className: "boff-accent-tile boff-accent-tile--duo flex size-7 shrink-0 items-center justify-center rounded-lg max-[23.99rem]:size-[1.625rem]",
18
+ /* @__PURE__ */ l("div", {
19
+ className: "flex min-h-7 min-w-0 flex-1 items-center gap-2",
20
+ children: [/* @__PURE__ */ c("span", {
21
+ ref: y,
22
+ className: "boff-accent-tile boff-accent-tile--duo flex size-7 shrink-0 items-center justify-center rounded-lg max-[23.99rem]:size-[1.625rem] data-[dropped]:hidden",
29
23
  "aria-hidden": "true",
30
24
  "data-testid": "assistant-window-mark",
31
- children: /* @__PURE__ */ l(c, { className: "boff-twinkle size-4" })
32
- }), /* @__PURE__ */ l("h2", {
33
- ref: y,
25
+ children: /* @__PURE__ */ c(s, { className: "boff-twinkle size-4" })
26
+ }), /* @__PURE__ */ c("h2", {
27
+ ref: v,
34
28
  className: "m-0 min-w-0 truncate text-[15px] font-semibold leading-5 tracking-[-0.012em] text-text-primary data-[tight]:text-sm data-[tighter]:text-[13px]",
35
- title: v,
29
+ title: _,
36
30
  "data-testid": "assistant-window-title",
37
- children: v
31
+ children: _
38
32
  })]
39
33
  }),
40
- /* @__PURE__ */ l(t, { voiceLive: p }),
41
- /* @__PURE__ */ l("button", {
34
+ /* @__PURE__ */ c(t, { voiceLive: f }),
35
+ /* @__PURE__ */ c("button", {
42
36
  type: "button",
43
- onClick: () => h(),
44
- className: `${d} ${f}`,
37
+ onClick: () => m(),
38
+ className: `${u} ${d}`,
45
39
  "aria-label": x,
46
40
  title: b,
47
41
  "data-testid": "assistant-open-full",
48
- children: /* @__PURE__ */ l(s, {
42
+ children: /* @__PURE__ */ c(o, {
49
43
  className: "size-[1.125rem]",
50
44
  "aria-hidden": "true"
51
45
  })
52
46
  }),
53
- /* @__PURE__ */ l("button", {
47
+ /* @__PURE__ */ c("button", {
54
48
  type: "button",
55
- onClick: g,
56
- className: `${d} ${f}`,
49
+ onClick: h,
50
+ className: `${u} ${d}`,
57
51
  "aria-label": S,
58
52
  title: S,
59
53
  "data-testid": "assistant-minimize",
60
- children: /* @__PURE__ */ l(o, {
54
+ children: /* @__PURE__ */ c(a, {
61
55
  className: "size-[1.125rem]",
62
56
  "aria-hidden": "true"
63
57
  })
@@ -65,4 +59,4 @@ var d = "flex size-10 shrink-0 items-center justify-center rounded-button transi
65
59
  ]
66
60
  });
67
61
  };
68
- export { p as AssistantWindowHeader };
62
+ export { f as AssistantWindowHeader };
@@ -1,15 +1,38 @@
1
+ import { RefObject } from 'react';
1
2
  /**
2
- * The window's name: "<Product> Assistant" (BOFF-15066), the product's display name from the shared catalog
3
- * (`config/products.ts`), so every product gets its own name from the SDK with no app change.
3
+ * The assistant's own name, "<Product> Assistant" (BOFF-15066): the product's display name from the shared catalog
4
+ * (`config/products.ts`), so every product gets its own name from the SDK with no app change. `null` for a product the
5
+ * catalog does not know (a host's own id): each surface then keeps its generic words, because a wrong name is worse than
6
+ * the generic one.
4
7
  *
5
- * ★ Its own key, `window.productTitle`, never `window.title`: that one is seeded in every product as "Quick assistant", so
6
- * reusing it would show the old words wherever a translation exists. A product the catalog does not know (a host's own id)
7
- * keeps `window.title`: a wrong name is worse than the generic one.
8
+ * ★ One key, `window.productTitle`, for the Quick window AND the full panel (the operator, 17 Nov: "use product name in the
9
+ * big panel too"): one product's assistant has one name wherever it opens, translated once. Never `window.title` or
10
+ * `header.title`: those are seeded in every product as "Quick assistant" and "AI Assistant" (FluidGrids' "FluidGrids
11
+ * AI", HealthyBowl's "HealthyBowl AI"), so reusing either would show the old words wherever a translation exists. Those
12
+ * two products' own `header.title` still names their classic panel (the installed apps).
8
13
  */
14
+ export declare function useAssistantProductTitle(): string | null;
15
+ /** The Quick window's name: the product's (`useAssistantProductTitle`), else `window.title`. */
9
16
  export declare function useAssistantWindowTitle(): string;
10
17
  /**
11
- * Fit the window's name in its box: 15 px (no attribute), else 14 px (`data-tight`), else 13 px
12
- * (`data-tighter`); a name that overflows even at 13 px keeps `data-tighter` and truncates. Each step is
13
- * measured as it is set (the browser lays the heading out again on each read).
18
+ * Fit an assistant name in its box: its own size (no attribute), else a step smaller (`data-tight`), else two steps
19
+ * smaller (`data-tighter`). The heading's classes say the sizes (the window: 15, 14 and 13 px; the full panel: 16, 15
20
+ * and 14 px). Given the header's brand `mark`, a name that does not fit even two steps smaller drops the mark
21
+ * (`data-dropped`, which the mark's classes hide) and is fitted again in the room it leaves. A name that overflows even
22
+ * then keeps `data-tighter` and truncates. Each step is measured as it is set (the browser lays the heading out again on
23
+ * each read).
24
+ *
25
+ * ★ The overflow test is fractional. `scrollWidth` and `clientWidth` are whole pixels, but the ellipsis is drawn for ANY
26
+ * overflow, so a name up to half a pixel too wide passed as fitting and showed "FluidGrids Assist…" (BOFF-15066 review).
27
+ * A Range gives the text's own width, ellipsized or not, to compare with the heading's box (it has no padding or border).
28
+ */
29
+ export declare function fitAssistantWindowTitle(heading: HTMLElement, mark?: HTMLElement | null): void;
30
+ /**
31
+ * Keep a header's name fitted (`fitAssistantWindowTitle`): before anything paints, and again whenever the name changes
32
+ * or its row resizes (a font, a language or a product name can each change its width). Attributes, not state: the fit
33
+ * must read each width in the same frame, before anything paints.
34
+ *
35
+ * ★ It watches the row that holds the mark and the name, never the name's own box: dropping the mark widens that box,
36
+ * and an observer that resizes what it watches loops ("ResizeObserver loop completed with undelivered notifications").
14
37
  */
15
- export declare function fitAssistantWindowTitle(heading: HTMLElement): void;
38
+ export declare function useFittedAssistantTitle(headingRef: RefObject<HTMLElement | null>, title: string, markRef?: RefObject<HTMLElement | null>): void;
@@ -1,13 +1,38 @@
1
1
  import { findProductConfig as e } from "../../../config/products.js";
2
2
  import { useAssistantTr as t } from "../../i18n.js";
3
3
  import { useAssistantProduct as n } from "../../product.js";
4
+ import { useLayoutEffect as r } from "react";
4
5
  // src/shared/assistant/ui/compact/windowTitle.ts
5
- function r() {
6
+ function i() {
6
7
  let r = t(), { product: i } = n(), a = i ? e(i)?.name : void 0;
7
- return a ? r("window.productTitle", "{{product}} Assistant", { product: a }) : r("window.title", "Quick assistant");
8
+ return a ? r("window.productTitle", "{{product}} Assistant", { product: a }) : null;
8
9
  }
9
- function i(e) {
10
- let t = () => e.scrollWidth > e.clientWidth;
11
- e.removeAttribute("data-tight"), e.removeAttribute("data-tighter"), t() && (e.setAttribute("data-tight", ""), t() && (e.removeAttribute("data-tight"), e.setAttribute("data-tighter", "")));
10
+ function a() {
11
+ let e = t();
12
+ return i() ?? e("window.title", "Quick assistant");
12
13
  }
13
- export { i as fitAssistantWindowTitle, r as useAssistantWindowTitle };
14
+ function o(e, t) {
15
+ let n = () => {
16
+ if (e.scrollWidth > e.clientWidth) return !0;
17
+ let t = e.ownerDocument?.createRange?.();
18
+ return t ? (t.selectNodeContents(e), t.getBoundingClientRect().width > e.getBoundingClientRect().width) : !1;
19
+ }, r = () => (e.removeAttribute("data-tight"), e.removeAttribute("data-tighter"), !n() || (e.setAttribute("data-tight", ""), !n()) || (e.removeAttribute("data-tight"), e.setAttribute("data-tighter", ""), !n()));
20
+ t?.removeAttribute("data-dropped"), !r() && t && (t.setAttribute("data-dropped", ""), r());
21
+ }
22
+ function s(e, t, n) {
23
+ r(() => {
24
+ let t = e.current;
25
+ if (!t) return;
26
+ let r = n?.current ?? null, i = () => o(t, r);
27
+ i();
28
+ let a = (r ?? t).parentElement;
29
+ if (typeof ResizeObserver > "u" || !a) return;
30
+ let s = new ResizeObserver(i);
31
+ return s.observe(a), () => s.disconnect();
32
+ }, [
33
+ e,
34
+ n,
35
+ t
36
+ ]);
37
+ }
38
+ export { o as fitAssistantWindowTitle, i as useAssistantProductTitle, a as useAssistantWindowTitle, s as useFittedAssistantTitle };
@@ -0,0 +1,7 @@
1
+ import { BackgroundColorMode, BackgroundCommonProps, BackgroundEffectName } from './backgroundTypes';
2
+ export interface BackgroundEffectProps extends BackgroundCommonProps {
3
+ effect: BackgroundEffectName;
4
+ /** Where the colours come from (default `accent`). */
5
+ colors?: BackgroundColorMode;
6
+ }
7
+ export declare function BackgroundEffect({ effect, colors, strength, backgroundColor, ...rest }: BackgroundEffectProps): import('react').JSX.Element | null;
@@ -0,0 +1,24 @@
1
+ import { useBackgroundGround as e } from "./backgroundGround.js";
2
+ import { CursorWave as t } from "./CursorWave.js";
3
+ import { DottedWaves as n } from "./DottedWaves.js";
4
+ import { Glimmer as r } from "./Glimmer.js";
5
+ import { jsx as i } from "react/jsx-runtime";
6
+ // src/shared/backgrounds/BackgroundEffect.tsx
7
+ function a({ effect: a, colors: o = "accent", strength: s = "subtle", backgroundColor: c, ...l }) {
8
+ let u = e(a, o), d = {
9
+ colors: o,
10
+ strength: s,
11
+ backgroundColor: c ?? u ?? void 0
12
+ };
13
+ return a === "dotted-waves" ? /* @__PURE__ */ i(n, {
14
+ ...d,
15
+ ...l
16
+ }) : a === "glimmer" ? /* @__PURE__ */ i(r, {
17
+ ...d,
18
+ ...l
19
+ }) : a === "cursor-wave" ? /* @__PURE__ */ i(t, {
20
+ ...d,
21
+ ...l
22
+ }) : null;
23
+ }
24
+ export { a as BackgroundEffect };
@@ -0,0 +1,49 @@
1
+ import { KeyboardEvent, ReactNode } from 'react';
2
+ import { BackgroundColorMode, BackgroundEffectName, BackgroundStrength } from './backgroundTypes';
3
+ /**
4
+ * Roving focus for a radio group: the chosen option is the group's one tab stop; arrows,
5
+ * Home and End move the choice and the focus together.
6
+ */
7
+ export declare function useRovingRadio<T extends string>(values: readonly T[], value: T, onChange: (next: T) => void): {
8
+ itemProps: (option: T) => {
9
+ tabIndex: number;
10
+ ref: (element: HTMLElement | null) => void;
11
+ onKeyDown: (event: KeyboardEvent<HTMLElement>) => void;
12
+ onClick: () => void;
13
+ };
14
+ };
15
+ export interface BackgroundPickerProps {
16
+ /** The chosen effect. */
17
+ value: BackgroundEffectName;
18
+ onChange: (effect: BackgroundEffectName) => void;
19
+ /** The group's accessible name (translated). */
20
+ label: string;
21
+ /** Each option's name (translated). */
22
+ labels: Readonly<Record<BackgroundEffectName, string>>;
23
+ /** The previews' colours (the person's current choice; default `accent`). */
24
+ colors?: BackgroundColorMode;
25
+ /** The previews' strength (the person's current choice; default `subtle`). */
26
+ strength?: BackgroundStrength;
27
+ /** The effects offered, in order (default all). */
28
+ effects?: readonly BackgroundEffectName[];
29
+ className?: string;
30
+ }
31
+ /** The effects as tiles with live previews; a radio group. */
32
+ export declare function BackgroundPicker({ value, onChange, label, labels, colors, strength, effects, className, }: BackgroundPickerProps): import('react').JSX.Element;
33
+ export interface BackgroundOption<T extends string> {
34
+ value: T;
35
+ /** Translated. */
36
+ label: string;
37
+ /** Optional leading content (say, a swatch). */
38
+ icon?: ReactNode;
39
+ }
40
+ export interface BackgroundOptionGroupProps<T extends string> {
41
+ value: T;
42
+ onChange: (value: T) => void;
43
+ /** The group's accessible name (translated). */
44
+ label: string;
45
+ options: readonly BackgroundOption<T>[];
46
+ className?: string;
47
+ }
48
+ /** A segmented radio group (the colours, the strength). */
49
+ export declare function BackgroundOptionGroup<T extends string>({ value, onChange, label, options, className, }: BackgroundOptionGroupProps<T>): import('react').JSX.Element;
@@ -0,0 +1,133 @@
1
+ import { cn as e } from "../../shared-utils.js";
2
+ import { useBackgroundGround as t } from "./backgroundGround.js";
3
+ import { BACKGROUND_EFFECTS as n } from "./backgroundTypes.js";
4
+ import { CursorWave as r } from "./CursorWave.js";
5
+ import { DottedWaves as i } from "./DottedWaves.js";
6
+ import { Glimmer as a } from "./Glimmer.js";
7
+ import { usePrefersReducedMotion as o } from "../assistant/ui/usePrefersReducedMotion.js";
8
+ import { useCallback as s, useEffect as c, useRef as l } from "react";
9
+ import { Check as u } from "lucide-react";
10
+ import { jsx as d, jsxs as f } from "react/jsx-runtime";
11
+ // src/shared/backgrounds/BackgroundPicker.tsx
12
+ var p = "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring focus-visible:ring-offset-2 focus-visible:ring-offset-bg-canvas";
13
+ function m(e, t, n) {
14
+ let r = l(/* @__PURE__ */ new Map()), i = e.includes(t) ? t : e[0], a = s((t, i) => {
15
+ let a = e.indexOf(t), o = i === "first" ? e[0] : i === "last" ? e[e.length - 1] : e[(a + i + e.length) % e.length];
16
+ o !== void 0 && (n(o), r.current.get(o)?.focus());
17
+ }, [e, n]);
18
+ return { itemProps: s((e) => ({
19
+ tabIndex: e === i ? 0 : -1,
20
+ ref: (t) => {
21
+ t ? r.current.set(e, t) : r.current.delete(e);
22
+ },
23
+ onClick: () => n(e),
24
+ onKeyDown: (t) => {
25
+ let r = typeof getComputedStyle == "function" && getComputedStyle(t.currentTarget).direction === "rtl", i = r ? "ArrowLeft" : "ArrowRight", o = r ? "ArrowRight" : "ArrowLeft";
26
+ if (t.key === i || t.key === "ArrowDown") a(e, 1);
27
+ else if (t.key === o || t.key === "ArrowUp") a(e, -1);
28
+ else if (t.key === "Home") a(e, "first");
29
+ else if (t.key === "End") a(e, "last");
30
+ else if (t.key === " " || t.key === "Enter") n(e);
31
+ else return;
32
+ t.preventDefault();
33
+ }
34
+ }), [
35
+ i,
36
+ a,
37
+ n
38
+ ]) };
39
+ }
40
+ function h({ effect: e, colors: n, strength: s }) {
41
+ let u = l(null), f = o(), p = t(e, n) ?? void 0;
42
+ return c(() => {
43
+ if (e !== "cursor-wave" || f) return;
44
+ let t = window.setTimeout(() => u.current?.burst(), 400), n = window.setInterval(() => u.current?.burst(), 3200);
45
+ return () => {
46
+ window.clearTimeout(t), window.clearInterval(n);
47
+ };
48
+ }, [e, f]), e === "dotted-waves" ? /* @__PURE__ */ d(i, {
49
+ colors: n,
50
+ strength: s,
51
+ backgroundColor: p,
52
+ interactive: !1,
53
+ spacing: 9,
54
+ size: 1.9,
55
+ jump: 2
56
+ }) : e === "glimmer" ? /* @__PURE__ */ d(a, {
57
+ colors: n,
58
+ strength: s,
59
+ backgroundColor: p,
60
+ count: 420,
61
+ size: 1.1,
62
+ parallax: 0,
63
+ boost: 1,
64
+ waves: !1
65
+ }) : e === "cursor-wave" ? /* @__PURE__ */ d(r, {
66
+ ref: u,
67
+ colors: n,
68
+ strength: s,
69
+ backgroundColor: p,
70
+ cellSize: 16,
71
+ idleScale: .16,
72
+ burstSpeed: 260,
73
+ burstThickness: 60
74
+ }) : null;
75
+ }
76
+ function g({ value: t, onChange: r, label: i, labels: a, colors: o = "accent", strength: s = "subtle", effects: c = n, className: l }) {
77
+ let { itemProps: g } = m(c, t, r);
78
+ return /* @__PURE__ */ d("div", {
79
+ role: "radiogroup",
80
+ "aria-label": i,
81
+ className: e("grid grid-cols-2 gap-3 sm:grid-cols-4", l),
82
+ "data-testid": "background-picker",
83
+ children: c.map((n) => {
84
+ let r = n === t;
85
+ return /* @__PURE__ */ f("button", {
86
+ type: "button",
87
+ role: "radio",
88
+ "aria-checked": r,
89
+ "data-effect": n,
90
+ ...g(n),
91
+ className: e("group flex flex-col gap-2 rounded-card border p-2 text-start transition-colors", p, r ? "border-border-focus bg-accent-soft" : "border-border-default bg-bg-surface hover:border-border-strong hover:bg-bg-sunken"),
92
+ children: [/* @__PURE__ */ d("span", {
93
+ "aria-hidden": "true",
94
+ className: "relative block h-16 w-full overflow-hidden rounded-button border border-border-seam bg-bg-canvas",
95
+ children: /* @__PURE__ */ d(h, {
96
+ effect: n,
97
+ colors: o,
98
+ strength: s
99
+ })
100
+ }), /* @__PURE__ */ f("span", {
101
+ className: "flex items-center justify-between gap-1",
102
+ children: [/* @__PURE__ */ d("span", {
103
+ className: "truncate text-xs font-medium text-text-primary",
104
+ children: a[n]
105
+ }), r ? /* @__PURE__ */ d(u, {
106
+ className: "size-3.5 shrink-0 text-action-primary-bg",
107
+ "aria-hidden": "true"
108
+ }) : null]
109
+ })]
110
+ }, n);
111
+ })
112
+ });
113
+ }
114
+ function _({ value: t, onChange: n, label: r, options: i, className: a }) {
115
+ let { itemProps: o } = m(i.map((e) => e.value), t, n);
116
+ return /* @__PURE__ */ d("div", {
117
+ role: "radiogroup",
118
+ "aria-label": r,
119
+ className: e("inline-flex w-full flex-col gap-1 rounded-button border border-border-default bg-bg-sunken p-1 sm:w-auto sm:flex-row", a),
120
+ children: i.map((n) => {
121
+ let r = n.value === t;
122
+ return /* @__PURE__ */ f("button", {
123
+ type: "button",
124
+ role: "radio",
125
+ "aria-checked": r,
126
+ ...o(n.value),
127
+ className: e("flex flex-1 items-center justify-center gap-2 rounded-button px-4 py-1.5 text-sm font-medium transition-colors", p, r ? "bg-bg-surface text-text-primary shadow-elevation-1" : "text-text-secondary hover:text-text-primary"),
128
+ children: [n.icon, n.label]
129
+ }, n.value);
130
+ })
131
+ });
132
+ }
133
+ export { _ as BackgroundOptionGroup, g as BackgroundPicker, m as useRovingRadio };
@@ -0,0 +1,13 @@
1
+ import { CSSProperties, ReactNode, RefObject } from 'react';
2
+ import { BackgroundStrength } from './backgroundTypes';
3
+ export interface BackgroundRootProps {
4
+ /** The effect's name, on the root (`data-background-effect`). */
5
+ effect: string;
6
+ canvasRef: RefObject<HTMLCanvasElement | null>;
7
+ strength: BackgroundStrength;
8
+ backgroundColor: string;
9
+ className?: string;
10
+ style?: CSSProperties;
11
+ children?: ReactNode;
12
+ }
13
+ export declare function BackgroundRoot({ effect, canvasRef, strength, backgroundColor, className, style, children, }: BackgroundRootProps): import('react').JSX.Element;
@@ -0,0 +1,44 @@
1
+ import { BACKGROUND_STRENGTH_OPACITY as e } from "./backgroundTypes.js";
2
+ import { jsx as t, jsxs as n } from "react/jsx-runtime";
3
+ // src/shared/backgrounds/BackgroundRoot.tsx
4
+ var r = {
5
+ position: "relative",
6
+ width: "100%",
7
+ height: "100%",
8
+ overflow: "hidden",
9
+ pointerEvents: "none"
10
+ }, i = {
11
+ position: "absolute",
12
+ inset: 0,
13
+ width: "100%",
14
+ height: "100%",
15
+ display: "block"
16
+ }, a = {
17
+ position: "relative",
18
+ width: "100%",
19
+ height: "100%",
20
+ pointerEvents: "auto"
21
+ };
22
+ function o({ effect: o, canvasRef: s, strength: c, backgroundColor: l, className: u, style: d, children: f }) {
23
+ return /* @__PURE__ */ n("div", {
24
+ className: u,
25
+ style: {
26
+ ...r,
27
+ backgroundColor: l,
28
+ ...d
29
+ },
30
+ "data-background-effect": o,
31
+ children: [/* @__PURE__ */ t("canvas", {
32
+ ref: s,
33
+ "aria-hidden": "true",
34
+ style: {
35
+ ...i,
36
+ opacity: e[c]
37
+ }
38
+ }), f == null ? null : /* @__PURE__ */ t("div", {
39
+ style: a,
40
+ children: f
41
+ })]
42
+ });
43
+ }
44
+ export { o as BackgroundRoot };
@@ -0,0 +1,19 @@
1
+ import { Ref } from 'react';
2
+ import { BackgroundColorMode, BackgroundCommonProps } from './backgroundTypes';
3
+ import { CursorWaveColorInput } from './cursorWavePool';
4
+ import { CursorWaveParams } from './cursorWaveRenderer';
5
+ /** What a ref to `CursorWave` can do. */
6
+ export interface CursorWaveHandle {
7
+ /** Rolls a ring out from (x, y), fractions of the frame (the centre by default). */
8
+ burst(x?: number, y?: number): void;
9
+ }
10
+ export interface CursorWaveProps extends Partial<CursorWaveParams>, BackgroundCommonProps {
11
+ /** A colour mode (`original` by default), or the pool of colours and gradients. */
12
+ colors?: BackgroundColorMode | readonly CursorWaveColorInput[];
13
+ /** Container width (default 100%). */
14
+ width?: string | number;
15
+ /** Container height (default 100%). */
16
+ height?: string | number;
17
+ ref?: Ref<CursorWaveHandle>;
18
+ }
19
+ export declare function CursorWave({ colors, strength, backgroundColor, paused, dpr, width, height, className, style, children, ref, ...params }: CursorWaveProps): import('react').JSX.Element;