@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.
- package/dist/shared/assistant/askAbout/AskAboutLayer.js +177 -59
- package/dist/shared/assistant/askAbout/askAboutStore.d.ts +23 -1
- package/dist/shared/assistant/askAbout/askAboutStore.js +26 -3
- package/dist/shared/assistant/askAbout/askableSelection.d.ts +2 -0
- package/dist/shared/assistant/askAbout/askableSelection.js +2 -1
- package/dist/shared/assistant/askAbout/focus.d.ts +11 -0
- package/dist/shared/assistant/askAbout/focus.js +40 -28
- package/dist/shared/assistant/askAbout/hint.d.ts +18 -0
- package/dist/shared/assistant/askAbout/hint.js +22 -0
- package/dist/shared/assistant/askAbout/placement.d.ts +14 -0
- package/dist/shared/assistant/askAbout/placement.js +11 -1
- package/dist/shared/assistant/askAbout/useAskable.d.ts +10 -0
- package/dist/shared/assistant/askAbout/useAskable.js +73 -53
- package/dist/shared/assistant/i18nManifest.d.ts +2 -0
- package/dist/shared/assistant/i18nManifest.js +2 -0
- package/dist/shared/assistant/index.d.ts +1 -0
- package/dist/shared/assistant/ui/composer/AssistantComposer.js +285 -272
- package/dist/shared/assistant/ui/composer/AssistantFocusChip.d.ts +10 -2
- package/dist/shared/assistant/ui/composer/AssistantFocusChip.js +30 -11
- package/dist/shared-assistant.js +305 -304
- package/package.json +1 -1
|
@@ -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 {
|
|
4
|
-
import {
|
|
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
|
|
7
|
-
function
|
|
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 ?
|
|
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
|
|
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(
|
|
18
|
+
return !i.closest(d) && !e(i) && !e(r);
|
|
18
19
|
}
|
|
19
|
-
function
|
|
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
|
|
24
|
-
let
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
},
|
|
33
|
-
|
|
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),
|
|
37
|
-
},
|
|
38
|
-
if (Date.now() -
|
|
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 (
|
|
43
|
-
let
|
|
44
|
-
|
|
45
|
-
},
|
|
46
|
-
t.pointerType === "mouse" || !t.isPrimary || t.button > 0 || (
|
|
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
|
-
},
|
|
51
|
-
let t =
|
|
52
|
-
if (
|
|
53
|
-
let
|
|
54
|
-
|
|
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
|
-
},
|
|
57
|
-
|
|
58
|
-
},
|
|
59
|
-
|
|
60
|
-
},
|
|
61
|
-
if (!(t.key === "ContextMenu" || t.shiftKey && t.key === "F10") || t.defaultPrevented || !
|
|
62
|
-
let
|
|
63
|
-
if (!
|
|
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
|
|
66
|
-
|
|
67
|
-
},
|
|
68
|
-
return e.style.setProperty("-webkit-touch-callout", "none"), e.addEventListener("contextmenu",
|
|
69
|
-
|
|
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
|
|
73
|
-
let
|
|
74
|
-
|
|
75
|
-
|
|
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
|
|
79
|
-
if (n && !c) return
|
|
80
|
-
}, [n, c]),
|
|
98
|
+
return a(() => {
|
|
99
|
+
if (n && !c) return h(n, () => i.current());
|
|
100
|
+
}, [n, c]), r;
|
|
81
101
|
}
|
|
82
|
-
export {
|
|
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';
|