@burdenoff/fe-libs 2026.1113.3 → 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.
@@ -29,6 +29,16 @@ export declare function pickFocus(describe: AskableDescribe): AssistantFocus | n
29
29
  * when the menu is asked for, so it always sees the thing as it is then.
30
30
  */
31
31
  export declare function attachAskable(element: HTMLElement, describe: AskableDescribe): () => void;
32
+ /**
33
+ * ★ BOFF-13381: ask about something from a product's own button ("Ask AI" in a
34
+ * toolbar), exactly as choosing the menu item does: the assistant opens with it
35
+ * as the chip and the cursor in the message box, and nothing is sent. `anchor`
36
+ * is the element it is about, which the page outlines while the chip is shown.
37
+ *
38
+ * Returns false, and does nothing, where there is no assistant to ask, the
39
+ * anchor is hidden from agents, or the description names nothing.
40
+ */
41
+ export declare function askAssistantAbout(input: AssistantFocusInput, anchor?: HTMLElement | null): boolean;
32
42
  export interface UseAskableOptions {
33
43
  /** Stop offering the menu here (the thing is not askable right now). */
34
44
  readonly disabled?: boolean;
@@ -1,82 +1,102 @@
1
1
  import { isDenied as e } from "../../agent-tools/ui/dom.js";
2
2
  import { useAskAboutStore as t } from "./askAboutStore.js";
3
- import { normaliseFocus as n } from "./focus.js";
4
- import { useEffect as r, useRef as i, useState as a } from "react";
3
+ import { askAboutHintSeen as n, markAskAboutHintSeen as r } from "./hint.js";
4
+ import { normaliseFocus as i } from "./focus.js";
5
+ import { useEffect as a, useRef as o, useState as s } from "react";
5
6
  // src/shared/assistant/askAbout/useAskable.ts
6
- var o = 500, s = 10, c = 800, l = "input, textarea, select, [contenteditable]:not([contenteditable=\"false\"])";
7
- function u(e) {
7
+ var c = 500, l = 10, u = 800, d = "input, textarea, select, [contenteditable]:not([contenteditable=\"false\"])";
8
+ function f(e) {
8
9
  let t = e();
9
- return t ? n(t, {
10
+ return t ? i(t, {
10
11
  route: window.location.pathname,
11
12
  pickedAt: (/* @__PURE__ */ new Date()).toISOString()
12
13
  }) : null;
13
14
  }
14
- function d(n, r) {
15
+ function p(n, r) {
15
16
  if (t.getState().hosts === 0) return !1;
16
17
  let i = n instanceof Element ? n : r;
17
- return !i.closest(l) && !e(i) && !e(r);
18
+ return !i.closest(d) && !e(i) && !e(r);
18
19
  }
19
- function f(e) {
20
+ function m(e) {
20
21
  let t = e.ownerDocument.activeElement;
21
22
  return t instanceof HTMLElement && t !== e.ownerDocument.body ? t : null;
22
23
  }
23
- function p(e, n) {
24
- let r = null, i = null, a = 0, o = e.ownerDocument.defaultView ?? window, s = (n, r, i, a) => t.getState().actions.openMenu({
25
- focus: n,
26
- x: r,
27
- y: i,
28
- returnFocusTo: a,
29
- anchor: e
30
- }), l = () => {
31
- r !== null && clearTimeout(r), r = null, i = null, o.removeEventListener("scroll", l, !0);
32
- }, p = () => {
33
- let t = Date.now() + c, n = (r) => {
24
+ function h(e, i) {
25
+ let a = null, o = null, s = 0, c = e.ownerDocument.defaultView ?? window, l = (n, i, a, o) => {
26
+ r(), h(), t.getState().actions.openMenu({
27
+ focus: n,
28
+ x: i,
29
+ y: a,
30
+ returnFocusTo: o,
31
+ anchor: e
32
+ });
33
+ }, d = null, h = () => {
34
+ d !== null && clearTimeout(d), d = null;
35
+ }, g = (r) => {
36
+ r.pointerType !== "mouse" || n() || p(r.target, e) && (h(), d = setTimeout(() => {
37
+ d = null;
38
+ let r = t.getState();
39
+ n() || r.menu !== null || r.hint !== null || r.actions.showHint({ anchor: e });
40
+ }, 900));
41
+ }, _ = () => {
42
+ a !== null && clearTimeout(a), a = null, o = null, c.removeEventListener("scroll", _, !0);
43
+ }, v = () => {
44
+ let t = Date.now() + u, n = (r) => {
34
45
  e.removeEventListener("click", n, !0), Date.now() > t || (r.preventDefault(), r.stopPropagation());
35
46
  };
36
- e.addEventListener("click", n, !0), setTimeout(() => e.removeEventListener("click", n, !0), c);
37
- }, m = (t) => {
38
- if (Date.now() - a < c) {
47
+ e.addEventListener("click", n, !0), setTimeout(() => e.removeEventListener("click", n, !0), u);
48
+ }, y = (t) => {
49
+ if (Date.now() - s < u) {
39
50
  t.preventDefault();
40
51
  return;
41
52
  }
42
- if (l(), t.shiftKey || t.defaultPrevented || !d(t.target, e)) return;
43
- let r = u(n);
44
- r && (t.preventDefault(), s(r, t.clientX, t.clientY, f(e)));
45
- }, h = (t) => {
46
- t.pointerType === "mouse" || !t.isPrimary || t.button > 0 || (l(), d(t.target, e) && (i = {
53
+ if (_(), t.shiftKey || t.defaultPrevented || !p(t.target, e)) return;
54
+ let n = f(i);
55
+ n && (t.preventDefault(), l(n, t.clientX, t.clientY, m(e)));
56
+ }, b = (t) => {
57
+ h(), t.pointerType === "mouse" || !t.isPrimary || t.button > 0 || (_(), p(t.target, e) && (o = {
47
58
  x: t.clientX,
48
59
  y: t.clientY,
49
60
  pointerId: t.pointerId
50
- }, o.addEventListener("scroll", l, !0), r = setTimeout(() => {
51
- let t = i;
52
- if (l(), !t) return;
53
- let r = u(n);
54
- r && (a = Date.now(), p(), s(r, t.x, t.y, f(e)));
61
+ }, c.addEventListener("scroll", _, !0), a = setTimeout(() => {
62
+ let t = o;
63
+ if (_(), !t) return;
64
+ let n = f(i);
65
+ n && (s = Date.now(), v(), l(n, t.x, t.y, m(e)));
55
66
  }, 500)));
56
- }, g = (e) => {
57
- i && e.pointerId === i.pointerId && Math.hypot(e.clientX - i.x, e.clientY - i.y) > 10 && l();
58
- }, _ = (e) => {
59
- i && e.pointerId === i.pointerId && l();
60
- }, v = (t) => {
61
- if (!(t.key === "ContextMenu" || t.shiftKey && t.key === "F10") || t.defaultPrevented || !d(t.target, e)) return;
62
- let r = u(n);
63
- if (!r) return;
67
+ }, x = (e) => {
68
+ o && e.pointerId === o.pointerId && Math.hypot(e.clientX - o.x, e.clientY - o.y) > 10 && _();
69
+ }, S = (e) => {
70
+ o && e.pointerId === o.pointerId && _();
71
+ }, C = (t) => {
72
+ if (!(t.key === "ContextMenu" || t.shiftKey && t.key === "F10") || t.defaultPrevented || !p(t.target, e)) return;
73
+ let n = f(i);
74
+ if (!n) return;
64
75
  t.preventDefault();
65
- let i = t.target instanceof HTMLElement ? t.target : e, a = i.getBoundingClientRect();
66
- s(r, a.left + Math.min(16, a.width / 2), a.bottom, i);
67
- }, y = e.style.getPropertyValue("-webkit-touch-callout");
68
- return e.style.setProperty("-webkit-touch-callout", "none"), e.addEventListener("contextmenu", m), e.addEventListener("pointerdown", h), e.addEventListener("pointermove", g), e.addEventListener("pointerup", _), e.addEventListener("pointercancel", _), e.addEventListener("keydown", v), () => {
69
- l(), e.removeEventListener("contextmenu", m), e.removeEventListener("pointerdown", h), e.removeEventListener("pointermove", g), e.removeEventListener("pointerup", _), e.removeEventListener("pointercancel", _), e.removeEventListener("keydown", v), y ? e.style.setProperty("-webkit-touch-callout", y) : e.style.removeProperty("-webkit-touch-callout");
76
+ let r = t.target instanceof HTMLElement ? t.target : e, a = r.getBoundingClientRect();
77
+ l(n, a.left + Math.min(16, a.width / 2), a.bottom, r);
78
+ }, w = e.style.getPropertyValue("-webkit-touch-callout");
79
+ return e.style.setProperty("-webkit-touch-callout", "none"), e.addEventListener("contextmenu", y), e.addEventListener("pointerdown", b), e.addEventListener("pointermove", x), e.addEventListener("pointerup", S), e.addEventListener("pointercancel", S), e.addEventListener("keydown", C), e.addEventListener("pointerenter", g), e.addEventListener("pointerleave", h), () => {
80
+ _(), h(), e.removeEventListener("pointerenter", g), e.removeEventListener("pointerleave", h), e.removeEventListener("contextmenu", y), e.removeEventListener("pointerdown", b), e.removeEventListener("pointermove", x), e.removeEventListener("pointerup", S), e.removeEventListener("pointercancel", S), e.removeEventListener("keydown", C), w ? e.style.setProperty("-webkit-touch-callout", w) : e.style.removeProperty("-webkit-touch-callout");
70
81
  };
71
82
  }
72
- function m(e, t = {}) {
73
- let [n, o] = a(null), s = i(e);
74
- r(() => {
75
- s.current = e;
83
+ function g(n, a = null) {
84
+ let { hosts: o, actions: s } = t.getState();
85
+ if (o === 0 || a !== null && e(a)) return !1;
86
+ let c = i(n, {
87
+ route: window.location.pathname,
88
+ pickedAt: (/* @__PURE__ */ new Date()).toISOString()
89
+ });
90
+ return c ? (r(), s.pickAndOpen(c, a), !0) : !1;
91
+ }
92
+ function _(e, t = {}) {
93
+ let [n, r] = s(null), i = o(e);
94
+ a(() => {
95
+ i.current = e;
76
96
  }, [e]);
77
97
  let c = t.disabled === !0;
78
- return r(() => {
79
- if (n && !c) return p(n, () => s.current());
80
- }, [n, c]), o;
98
+ return a(() => {
99
+ if (n && !c) return h(n, () => i.current());
100
+ }, [n, c]), r;
81
101
  }
82
- export { o as LONG_PRESS_MS, s as LONG_PRESS_SLOP_PX, p as attachAskable, u as pickFocus, m as useAskable };
102
+ export { c as LONG_PRESS_MS, l as LONG_PRESS_SLOP_PX, g as askAssistantAbout, h as attachAskable, f as pickFocus, _ as useAskable };
@@ -193,10 +193,12 @@ export declare const ASSISTANT_I18N_LITERAL_COPY: {
193
193
  readonly 'appControl.workspaceSwitched': "Switching to {{name}}.";
194
194
  readonly 'askAbout.chipLabel': "About: {{name}}";
195
195
  readonly 'askAbout.chipRemove': "Stop asking about {{name}}";
196
+ readonly 'askAbout.hint': "Right-click to ask AI about this";
196
197
  readonly 'askAbout.menuItem': "Ask AI about this";
197
198
  readonly 'askAbout.menuLabel': "Ask AI";
198
199
  readonly 'askAbout.placeholder': "Ask about {{name}}…";
199
200
  readonly 'askAbout.selectionButton': "Ask AI";
201
+ readonly 'askAbout.suggestionsLabel': "Suggested questions";
200
202
  readonly 'attachments.blockedMany': "{{count}} attachments didn't upload. Retry or remove them before sending.";
201
203
  readonly 'attachments.blockedOne': "{{name}} didn't upload. Retry or remove it before sending.";
202
204
  readonly 'attachments.cancelSaving': "Cancel";
@@ -86,10 +86,12 @@ var g = {
86
86
  "appControl.workspaceSwitched": "Switching to {{name}}.",
87
87
  "askAbout.chipLabel": "About: {{name}}",
88
88
  "askAbout.chipRemove": "Stop asking about {{name}}",
89
+ "askAbout.hint": "Right-click to ask AI about this",
89
90
  "askAbout.menuItem": "Ask AI about this",
90
91
  "askAbout.menuLabel": "Ask AI",
91
92
  "askAbout.placeholder": "Ask about {{name}}…",
92
93
  "askAbout.selectionButton": "Ask AI",
94
+ "askAbout.suggestionsLabel": "Suggested questions",
93
95
  "attachments.blockedMany": "{{count}} attachments didn't upload. Retry or remove them before sending.",
94
96
  "attachments.blockedOne": "{{name}} didn't upload. Retry or remove it before sending.",
95
97
  "attachments.cancelSaving": "Cancel",
@@ -113,6 +113,7 @@ export * from './askAbout/useAskable';
113
113
  export * from './askAbout/askableSelection';
114
114
  export * from './askAbout/AskAboutLayer';
115
115
  export * from './askAbout/placement';
116
+ export * from './askAbout/hint';
116
117
  export * from './attachmentCommit';
117
118
  export * from './voiceCommit';
118
119
  export * from './useAttachmentCommitter';