@burdenoff/fe-libs 2026.1113.4 → 2026.1113.5

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.
@@ -2,30 +2,30 @@ import { useAssistantTr as e } from "../i18n.js";
2
2
  import { useAskAboutStore as t } from "./askAboutStore.js";
3
3
  import { ASK_ABOUT_HINT_SHOWN_MS as n, markAskAboutHintSeen as r } from "./hint.js";
4
4
  import { readAskableSelection as i } from "./askableSelection.js";
5
- import { placeAskAboutMenu as a, placeAskSelectionButton as o, scrollClosesMenu as s } from "./placement.js";
6
- import { useEffect as c, useRef as l, useState as u } from "react";
7
- import { Sparkles as d } from "lucide-react";
8
- import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
9
- import { createPortal as h } from "react-dom";
5
+ import { placeAskAboutMenu as a, placeAskSelectionButton as o, scrollClosesMenu as s, visiblePart as c } from "./placement.js";
6
+ import { useEffect as l, useRef as u, useState as d } from "react";
7
+ import { Sparkles as f } from "lucide-react";
8
+ import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
9
+ import { createPortal as g } from "react-dom";
10
10
  // src/shared/assistant/askAbout/AskAboutLayer.tsx
11
- var g = ({ onOpenAssistant: e }) => {
12
- c(() => t.getState().actions.registerHost(), []);
11
+ var _ = ({ onOpenAssistant: e }) => {
12
+ l(() => t.getState().actions.registerHost(), []);
13
13
  let n = (n, r) => {
14
14
  t.getState().actions.pick(n, r), e();
15
- }, r = t((e) => e.openRequested), i = l(e);
16
- return c(() => {
15
+ }, r = t((e) => e.openRequested), i = u(e);
16
+ return l(() => {
17
17
  i.current = e;
18
- }, [e]), c(() => {
18
+ }, [e]), l(() => {
19
19
  r && (t.getState().actions.opened(), i.current());
20
- }, [r]), /* @__PURE__ */ m(f, { children: [
21
- /* @__PURE__ */ p(_, { onAsk: n }),
22
- /* @__PURE__ */ p(x, {}),
23
- /* @__PURE__ */ p(S, {}),
24
- /* @__PURE__ */ p(v, { onAsk: n })
20
+ }, [r]), /* @__PURE__ */ h(p, { children: [
21
+ /* @__PURE__ */ m(v, { onAsk: n }),
22
+ /* @__PURE__ */ m(T, {}),
23
+ /* @__PURE__ */ m(E, {}),
24
+ /* @__PURE__ */ m(y, { onAsk: n })
25
25
  ] });
26
- }, _ = ({ onAsk: n }) => {
27
- let r = e(), i = t((e) => e.menu), o = l(null);
28
- if (c(() => {
26
+ }, v = ({ onAsk: n }) => {
27
+ let r = e(), i = t((e) => e.menu), o = u(null);
28
+ if (l(() => {
29
29
  if (!i) return;
30
30
  let { closeMenu: e } = t.getState().actions;
31
31
  o.current?.querySelector("[role=\"menuitem\"]")?.focus({ preventScroll: !0 });
@@ -38,13 +38,13 @@ var g = ({ onOpenAssistant: e }) => {
38
38
  document.removeEventListener("pointerdown", n, !0), window.removeEventListener("scroll", r, !0), window.removeEventListener("resize", e), window.removeEventListener("popstate", e), window.removeEventListener("blur", e);
39
39
  };
40
40
  }, [i]), !i || typeof document > "u") return null;
41
- let { left: u, top: f } = a(i, {
41
+ let { left: c, top: d } = a(i, {
42
42
  width: window.innerWidth,
43
43
  height: window.innerHeight
44
- }), g = () => {
44
+ }), p = () => {
45
45
  t.getState().actions.closeMenu(), i.returnFocusTo?.focus({ preventScroll: !0 });
46
46
  };
47
- return h(/* @__PURE__ */ p("div", {
47
+ return g(/* @__PURE__ */ m("div", {
48
48
  ref: o,
49
49
  role: "menu",
50
50
  "aria-label": r("askAbout.menuLabel", "Ask AI"),
@@ -52,11 +52,11 @@ var g = ({ onOpenAssistant: e }) => {
52
52
  "data-testid": "assistant-ask-about-menu",
53
53
  onKeyDown: (e) => {
54
54
  if (e.key === "Escape") {
55
- e.preventDefault(), e.stopPropagation(), g();
55
+ e.preventDefault(), e.stopPropagation(), p();
56
56
  return;
57
57
  }
58
58
  if (e.key === "Tab") {
59
- e.preventDefault(), g();
59
+ e.preventDefault(), p();
60
60
  return;
61
61
  }
62
62
  let t = Array.from(o.current?.querySelectorAll("[role=\"menuitem\"]") ?? []);
@@ -67,34 +67,34 @@ var g = ({ onOpenAssistant: e }) => {
67
67
  onContextMenu: (e) => e.preventDefault(),
68
68
  className: "fixed z-[1100] max-w-[calc(100vw-16px)] overflow-hidden rounded-card border border-border-subtle bg-bg-elevated p-1 shadow-[var(--shadow-elevation-4)]",
69
69
  style: {
70
- left: u,
71
- top: f,
70
+ left: c,
71
+ top: d,
72
72
  width: 256
73
73
  },
74
- children: /* @__PURE__ */ m("button", {
74
+ children: /* @__PURE__ */ h("button", {
75
75
  type: "button",
76
76
  role: "menuitem",
77
77
  onClick: () => n(i.focus, i.anchor ?? null),
78
78
  className: "flex w-full items-start gap-2 rounded-button px-3 py-2 text-start text-sm text-text-primary transition-colors hover:bg-bg-sunken focus:bg-bg-sunken focus:outline-none",
79
79
  "data-testid": "assistant-ask-about-item",
80
- children: [/* @__PURE__ */ p(d, {
80
+ children: [/* @__PURE__ */ m(f, {
81
81
  className: "mt-0.5 size-4 shrink-0 text-action-primary-bg",
82
82
  "aria-hidden": "true"
83
- }), /* @__PURE__ */ m("span", {
83
+ }), /* @__PURE__ */ h("span", {
84
84
  className: "min-w-0",
85
- children: [/* @__PURE__ */ p("span", {
85
+ children: [/* @__PURE__ */ m("span", {
86
86
  className: "block font-medium",
87
87
  children: r("askAbout.menuItem", "Ask AI about this")
88
- }), /* @__PURE__ */ p("span", {
88
+ }), /* @__PURE__ */ m("span", {
89
89
  className: "block truncate text-xs text-text-muted",
90
90
  children: i.focus.label
91
91
  })]
92
92
  })]
93
93
  })
94
94
  }), document.body);
95
- }, v = ({ onAsk: t }) => {
96
- let n = e(), [r, a] = u(null);
97
- c(() => {
95
+ }, y = ({ onAsk: t }) => {
96
+ let n = e(), [r, a] = d(null);
97
+ l(() => {
98
98
  let e = 0, t = () => {
99
99
  e = 0, a(i(document));
100
100
  }, n = () => {
@@ -105,18 +105,18 @@ var g = ({ onOpenAssistant: e }) => {
105
105
  };
106
106
  }, []);
107
107
  let s = r !== null;
108
- if (c(() => {
108
+ if (l(() => {
109
109
  if (!s) return;
110
110
  let e = () => a(null);
111
111
  return window.addEventListener("scroll", e, !0), window.addEventListener("resize", e), () => {
112
112
  window.removeEventListener("scroll", e, !0), window.removeEventListener("resize", e);
113
113
  };
114
114
  }, [s]), !r || typeof document > "u") return null;
115
- let { left: l, top: f } = o(r.rect, {
115
+ let { left: c, top: u } = o(r.rect, {
116
116
  width: window.innerWidth,
117
117
  height: window.innerHeight
118
118
  });
119
- return h(/* @__PURE__ */ m("button", {
119
+ return g(/* @__PURE__ */ h("button", {
120
120
  type: "button",
121
121
  "data-agent": "deny",
122
122
  "data-testid": "assistant-ask-about-selection",
@@ -126,41 +126,65 @@ var g = ({ onOpenAssistant: e }) => {
126
126
  },
127
127
  className: "fixed z-[1100] inline-flex items-center gap-1.5 rounded-full border border-border-subtle bg-bg-elevated px-3 py-1.5 text-xs font-medium text-text-primary shadow-[var(--shadow-elevation-4)] transition-colors hover:bg-bg-sunken focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]",
128
128
  style: {
129
- left: l,
130
- top: f
129
+ left: c,
130
+ top: u
131
131
  },
132
- children: [/* @__PURE__ */ p(d, {
132
+ children: [/* @__PURE__ */ m(f, {
133
133
  className: "size-3.5 text-action-primary-bg",
134
134
  "aria-hidden": "true"
135
135
  }), n("askAbout.selectionButton", "Ask AI")]
136
136
  }), document.body);
137
- };
138
- function y(e) {
139
- let [t, n] = u(null);
140
- return c(() => {
137
+ }, b = /* @__PURE__ */ new Set([
138
+ "hidden",
139
+ "clip",
140
+ "auto",
141
+ "scroll",
142
+ "overlay"
143
+ ]);
144
+ function x(e) {
145
+ let t = [], n = e.ownerDocument.defaultView;
146
+ for (let r = e.parentElement; r && n; r = r.parentElement) {
147
+ let e = n.getComputedStyle(r);
148
+ [
149
+ e.overflow,
150
+ e.overflowX,
151
+ e.overflowY
152
+ ].some((e) => b.has(e)) && t.push(r);
153
+ }
154
+ return t;
155
+ }
156
+ var S = (e) => ({
157
+ left: e.left,
158
+ top: e.top,
159
+ width: e.width,
160
+ height: e.height
161
+ });
162
+ function C(e, t = {}) {
163
+ let n = t.clip === !0, [r, i] = d(null);
164
+ return l(() => {
141
165
  if (!e) {
142
- n(null);
166
+ i(null);
143
167
  return;
144
168
  }
145
- let t = 0, r = "", i = () => {
169
+ let t = 0, r = "", a = n ? x(e) : [], o = () => {
146
170
  if (!e.isConnected) {
147
- n(null);
171
+ i(null);
148
172
  return;
149
173
  }
150
- let a = e.getBoundingClientRect(), o = `${a.left},${a.top},${a.width},${a.height}`;
151
- o !== r && (r = o, n({
152
- left: a.left,
153
- top: a.top,
154
- width: a.width,
155
- height: a.height
156
- })), t = requestAnimationFrame(i);
174
+ let s = S(e.getBoundingClientRect()), l = n ? c(s, [...a.map((e) => S(e.getBoundingClientRect())), {
175
+ left: 0,
176
+ top: 0,
177
+ width: window.innerWidth,
178
+ height: window.innerHeight
179
+ }]) : s, u = l ? `${l.left},${l.top},${l.width},${l.height}` : "none";
180
+ u !== r && (r = u, i(l)), t = requestAnimationFrame(o);
157
181
  };
158
- return i(), () => cancelAnimationFrame(t);
159
- }, [e]), t;
182
+ return o(), () => cancelAnimationFrame(t);
183
+ }, [e, n]), r;
160
184
  }
161
- var b = 4, x = () => {
162
- let e = t((e) => e.pending ? e.pendingAnchor : null), n = y(e);
163
- return c(() => {
185
+ var w = 4, T = () => {
186
+ let e = t((e) => e.pending ? e.pendingAnchor : null), n = C(e, { clip: !0 });
187
+ return l(() => {
164
188
  if (!e) return;
165
189
  let t = setTimeout(() => {
166
190
  if (!e.isConnected) return;
@@ -171,21 +195,21 @@ var b = 4, x = () => {
171
195
  });
172
196
  }, 250);
173
197
  return () => clearTimeout(t);
174
- }, [e]), !n || typeof document > "u" ? null : h(/* @__PURE__ */ p("div", {
198
+ }, [e]), !n || typeof document > "u" ? null : g(/* @__PURE__ */ m("div", {
175
199
  "aria-hidden": "true",
176
200
  "data-agent": "deny",
177
201
  "data-testid": "assistant-ask-about-highlight",
178
202
  className: "pointer-events-none fixed z-[45] rounded-card border-2 border-action-primary-bg shadow-[0_0_0_4px_var(--color-focus-ring)] transition-[left,top,width,height] duration-75",
179
203
  style: {
180
- left: n.left - b,
181
- top: n.top - b,
204
+ left: n.left - w,
205
+ top: n.top - w,
182
206
  width: n.width + 8,
183
207
  height: n.height + 8
184
208
  }
185
209
  }), document.body);
186
- }, S = () => {
187
- let i = e(), a = t((e) => e.hint)?.anchor ?? null, s = y(a);
188
- if (c(() => {
210
+ }, E = () => {
211
+ let i = e(), a = t((e) => e.hint)?.anchor ?? null, s = C(a);
212
+ if (l(() => {
189
213
  if (!a) return;
190
214
  r();
191
215
  let { hideHint: e } = t.getState().actions, i = setTimeout(e, n);
@@ -196,7 +220,7 @@ var b = 4, x = () => {
196
220
  clearTimeout(i), window.removeEventListener("pointerdown", e, !0), window.removeEventListener("keydown", e, !0), window.removeEventListener("scroll", e, !0), window.removeEventListener("wheel", e, !0), a.removeEventListener("pointerleave", e);
197
221
  };
198
222
  }, [a]), !s || typeof document > "u") return null;
199
- let { left: l, top: u } = o({
223
+ let { left: c, top: u } = o({
200
224
  left: s.left,
201
225
  top: s.top,
202
226
  bottom: s.top + s.height
@@ -204,19 +228,19 @@ var b = 4, x = () => {
204
228
  width: window.innerWidth,
205
229
  height: window.innerHeight
206
230
  });
207
- return h(/* @__PURE__ */ m("div", {
231
+ return g(/* @__PURE__ */ h("div", {
208
232
  role: "status",
209
233
  "data-agent": "deny",
210
234
  "data-testid": "assistant-ask-about-hint",
211
235
  className: "pointer-events-none fixed z-[1100] inline-flex max-w-[calc(100vw-16px)] items-center gap-1.5 rounded-full border border-border-subtle bg-bg-elevated px-3 py-1.5 text-xs text-text-primary shadow-[var(--shadow-elevation-4)]",
212
236
  style: {
213
- left: l,
237
+ left: c,
214
238
  top: u
215
239
  },
216
- children: [/* @__PURE__ */ p(d, {
240
+ children: [/* @__PURE__ */ m(f, {
217
241
  className: "size-3.5 shrink-0 text-action-primary-bg",
218
242
  "aria-hidden": "true"
219
243
  }), i("askAbout.hint", "Right-click to ask AI about this")]
220
244
  }), document.body);
221
245
  };
222
- export { g as AskAboutLayer };
246
+ export { _ as AskAboutLayer };
@@ -29,3 +29,17 @@ export declare function placeAskSelectionButton(rect: AskableSelectionOffer['rec
29
29
  * outside the menu closes it.
30
30
  */
31
31
  export declare function scrollClosesMenu(target: unknown, anchor: unknown, menu: unknown): boolean;
32
+ /** A box in viewport coordinates. */
33
+ export interface ScreenBox {
34
+ readonly left: number;
35
+ readonly top: number;
36
+ readonly width: number;
37
+ readonly height: number;
38
+ }
39
+ /**
40
+ * ★ BOFF-13381: the part of `box` inside every one of `clips` (the areas that
41
+ * cut off what they hold, and the viewport), or null when none of it shows.
42
+ * The ring around a picked thing is drawn over this part only, so a step half
43
+ * under a side panel is not outlined across the panel.
44
+ */
45
+ export declare function visiblePart(box: ScreenBox, clips: readonly ScreenBox[]): ScreenBox | null;
@@ -17,4 +17,14 @@ var r = (e) => typeof e == "object" && !!e && typeof e.nodeType == "number" && t
17
17
  function i(e, t, n) {
18
18
  return r(e) && r(n) && n.contains(e) ? !1 : !r(t) || !r(e) || e.nodeType === 9 || e.contains(t);
19
19
  }
20
- export { e as ASK_ABOUT_MENU_WIDTH, t as placeAskAboutMenu, n as placeAskSelectionButton, i as scrollClosesMenu };
20
+ function a(e, t) {
21
+ let n = e.left, r = e.top, i = e.left + e.width, a = e.top + e.height;
22
+ for (let e of t) n = Math.max(n, e.left), r = Math.max(r, e.top), i = Math.min(i, e.left + e.width), a = Math.min(a, e.top + e.height);
23
+ return i - n < 1 || a - r < 1 ? null : {
24
+ left: n,
25
+ top: r,
26
+ width: i - n,
27
+ height: a - r
28
+ };
29
+ }
30
+ export { e as ASK_ABOUT_MENU_WIDTH, t as placeAskAboutMenu, n as placeAskSelectionButton, i as scrollClosesMenu, a as visiblePart };