@burdenoff/fe-libs 2026.1115.4 → 2026.1115.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.
- package/dist/shared/assistant/askAbout/AskAboutLayer.d.ts +5 -0
- package/dist/shared/assistant/askAbout/AskAboutLayer.js +187 -105
- package/dist/shared/assistant/askAbout/askAboutStore.d.ts +7 -0
- package/dist/shared/assistant/askAbout/askAnywhere.d.ts +16 -0
- package/dist/shared/assistant/askAbout/askAnywhere.js +76 -0
- package/dist/shared/assistant/askAbout/askableSelection.d.ts +20 -8
- package/dist/shared/assistant/askAbout/askableSelection.js +43 -38
- package/dist/shared/assistant/askAbout/describeAnything.d.ts +47 -0
- package/dist/shared/assistant/askAbout/describeAnything.js +294 -0
- package/dist/shared/assistant/askAbout/placement.d.ts +3 -1
- package/dist/shared/assistant/askAbout/placement.js +10 -9
- package/dist/shared/assistant/askAbout/useAskable.js +71 -67
- package/dist/shared/assistant/i18nManifest.d.ts +16 -0
- package/dist/shared/assistant/i18nManifest.js +16 -0
- package/dist/shared/assistant/index.d.ts +2 -0
- package/dist/shared/assistant/ui/AssistantOverlay.d.ts +8 -0
- package/dist/shared/assistant/ui/AssistantOverlay.js +240 -237
- package/dist/shared/providers/shell/I18nProvider.d.ts +16 -1
- package/dist/shared/providers/shell/I18nProvider.js +69 -67
- package/dist/shared/providers/shell/ProfileI18nBridge.d.ts +7 -0
- package/dist/shared/providers/shell/ProfileI18nBridge.js +55 -38
- package/dist/shared-assistant.js +325 -323
- package/package.json +1 -1
|
@@ -1,57 +1,62 @@
|
|
|
1
1
|
import { isDenied as e } from "../../agent-tools/ui/dom.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { describeAnything as t } from "./describeAnything.js";
|
|
3
|
+
import { normaliseFocus as n } from "./focus.js";
|
|
4
|
+
import { useEffect as r, useRef as i, useState as a } from "react";
|
|
4
5
|
// src/shared/assistant/askAbout/askableSelection.ts
|
|
5
|
-
var
|
|
6
|
-
function
|
|
7
|
-
return
|
|
8
|
-
|
|
6
|
+
var o = "data-ask-selection", s = /* @__PURE__ */ new WeakMap();
|
|
7
|
+
function c(e, t) {
|
|
8
|
+
return s.set(e, t), e.setAttribute(o, ""), () => {
|
|
9
|
+
s.get(e) === t && s.delete(e), e.removeAttribute(o);
|
|
9
10
|
};
|
|
10
11
|
}
|
|
11
|
-
function
|
|
12
|
-
let [t,
|
|
13
|
-
return
|
|
12
|
+
function l(e) {
|
|
13
|
+
let [t, n] = a(null), o = i(e);
|
|
14
|
+
return r(() => {
|
|
14
15
|
o.current = e;
|
|
15
|
-
}, [e]),
|
|
16
|
-
if (t) return
|
|
17
|
-
}, [t]),
|
|
16
|
+
}, [e]), r(() => {
|
|
17
|
+
if (t) return c(t, () => o.current());
|
|
18
|
+
}, [t]), n;
|
|
18
19
|
}
|
|
19
|
-
function
|
|
20
|
+
function u(e) {
|
|
20
21
|
return e ? e instanceof Element ? e : e.parentElement : null;
|
|
21
22
|
}
|
|
22
|
-
function
|
|
23
|
+
function d(t) {
|
|
23
24
|
return e(t) || t.closest("[data-agent-sensitive]") !== null;
|
|
24
25
|
}
|
|
25
|
-
function
|
|
26
|
-
let
|
|
27
|
-
if (!
|
|
28
|
-
let
|
|
29
|
-
if (!
|
|
30
|
-
let
|
|
31
|
-
if (!
|
|
32
|
-
let
|
|
33
|
-
if (
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
26
|
+
function f(e = document, r = {}) {
|
|
27
|
+
let i = e.getSelection();
|
|
28
|
+
if (!i || i.isCollapsed || i.rangeCount === 0) return null;
|
|
29
|
+
let a = u(i.anchorNode), c = u(i.focusNode);
|
|
30
|
+
if (!a || !c || d(a) || d(c)) return null;
|
|
31
|
+
let l = i.toString();
|
|
32
|
+
if (!l.trim()) return null;
|
|
33
|
+
let f = a.closest(`[${o}]`), p = f && f.contains(c) ? s.get(f) : void 0, m = null, h = null;
|
|
34
|
+
if (p && f) m = p(), h = f instanceof HTMLElement ? f : null;
|
|
35
|
+
else if (r.anywhere) {
|
|
36
|
+
if (a.closest("input, textarea, select, [contenteditable]:not([contenteditable=\"false\"]), [role=\"textbox\"], .monaco-editor, .cm-editor") || c.closest("input, textarea, select, [contenteditable]:not([contenteditable=\"false\"]), [role=\"textbox\"], .monaco-editor, .cm-editor")) return null;
|
|
37
|
+
let e = u(i.getRangeAt(0).commonAncestorContainer);
|
|
38
|
+
if (!e || d(e)) return null;
|
|
39
|
+
let n = t(e, r.anywhere);
|
|
40
|
+
m = n?.input ?? null, h = n?.anchor ?? null;
|
|
41
|
+
}
|
|
42
|
+
if (!m) return null;
|
|
43
|
+
let g = n({
|
|
44
|
+
...m,
|
|
45
|
+
selectedText: l
|
|
41
46
|
}, {
|
|
42
47
|
route: e.defaultView?.location.pathname ?? "",
|
|
43
48
|
pickedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
44
49
|
});
|
|
45
|
-
if (!
|
|
46
|
-
let
|
|
50
|
+
if (!g?.selectedText) return null;
|
|
51
|
+
let _ = i.getRangeAt(0).getBoundingClientRect();
|
|
47
52
|
return {
|
|
48
|
-
focus:
|
|
53
|
+
focus: g,
|
|
49
54
|
rect: {
|
|
50
|
-
left:
|
|
51
|
-
top:
|
|
52
|
-
bottom:
|
|
55
|
+
left: _.left,
|
|
56
|
+
top: _.top,
|
|
57
|
+
bottom: _.bottom
|
|
53
58
|
},
|
|
54
|
-
anchor:
|
|
59
|
+
anchor: h
|
|
55
60
|
};
|
|
56
61
|
}
|
|
57
|
-
export {
|
|
62
|
+
export { o as ASK_SELECTION_ATTRIBUTE, c as attachAskableSelection, f as readAskableSelection, l as useAskableSelection };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { AssistantFocusInput } from './focus';
|
|
2
|
+
/**
|
|
3
|
+
* ★ BOFF-14630 "Ask AI about this" anywhere: what the assistant is told about
|
|
4
|
+
* something on the page that no product described. The person right-clicked
|
|
5
|
+
* (or selected text) outside every askable thing; this names what is under
|
|
6
|
+
* the pointer from what the page shows: a link, a button, a table row with its
|
|
7
|
+
* column names, a heading, a list item or card, an image, a form field's
|
|
8
|
+
* label, a dialog, a section, and failing all of those, the page itself.
|
|
9
|
+
*
|
|
10
|
+
* ★★ Only what the person can already see. The text read here skips regions
|
|
11
|
+
* hidden from agents (`data-agent="deny"`), anything marked sensitive, every
|
|
12
|
+
* form field's value (a field is named by its label, never by what is typed in
|
|
13
|
+
* it), and anything hidden from assistive technology. `normaliseFocus` then
|
|
14
|
+
* bounds it and the note labels it as data, exactly as for a product's own
|
|
15
|
+
* describer.
|
|
16
|
+
*
|
|
17
|
+
* ★ Pure DOM reads, called once at the moment of the right-click, so a page
|
|
18
|
+
* pays nothing for it until someone asks.
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* Where text is edited, not read: right-click and selection there stay the
|
|
22
|
+
* browser's (copy, paste, spellcheck), and an editor's own menu is left alone.
|
|
23
|
+
*/
|
|
24
|
+
export declare const ASK_EDITABLE_SELECTOR = "input, textarea, select, [contenteditable]:not([contenteditable=\"false\"]), [role=\"textbox\"], .monaco-editor, .cm-editor";
|
|
25
|
+
/** The kinds of thing this can name. Each is shown in the chip, translated. */
|
|
26
|
+
export type GenericAskKind = 'link' | 'button' | 'tab' | 'menuItem' | 'tableRow' | 'heading' | 'listItem' | 'card' | 'image' | 'formField' | 'dialog' | 'section' | 'page';
|
|
27
|
+
/** The kind in the person's language (`askAbout.kind.<kind>`). */
|
|
28
|
+
export type GenericKindLabel = (kind: GenericAskKind) => string;
|
|
29
|
+
export declare const GENERIC_KIND_FALLBACK: Readonly<Record<GenericAskKind, string>>;
|
|
30
|
+
/** What a pick anywhere is about: the element to outline, and its description. */
|
|
31
|
+
export interface GenericAskTarget {
|
|
32
|
+
/** The element the question is about (outlined while it is the chip). Null for the whole page. */
|
|
33
|
+
readonly anchor: HTMLElement | null;
|
|
34
|
+
readonly input: AssistantFocusInput;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The text an element shows, whitespace collapsed, at most `max` characters.
|
|
38
|
+
* Hidden, denied and sensitive parts and every field's value are left out.
|
|
39
|
+
*/
|
|
40
|
+
export declare function askableVisibleText(element: Element, max?: number): string;
|
|
41
|
+
/** What an element is called: its accessible name, else the text it shows. */
|
|
42
|
+
export declare function askableNameOf(element: Element): string;
|
|
43
|
+
/**
|
|
44
|
+
* Describe what is at `target` for a pick anywhere. Null when it may not be
|
|
45
|
+
* asked about at all (hidden from agents, or inside a sensitive region).
|
|
46
|
+
*/
|
|
47
|
+
export declare function describeAnything(target: Element, kindLabel?: GenericKindLabel): GenericAskTarget | null;
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
import { isDenied as e, isSensitiveField as t } from "../../agent-tools/ui/dom.js";
|
|
2
|
+
// src/shared/assistant/askAbout/describeAnything.ts
|
|
3
|
+
var n = "input, textarea, select, [contenteditable]:not([contenteditable=\"false\"]), [role=\"textbox\"], .monaco-editor, .cm-editor", r = Object.freeze({
|
|
4
|
+
link: "link",
|
|
5
|
+
button: "button",
|
|
6
|
+
tab: "tab",
|
|
7
|
+
menuItem: "menu item",
|
|
8
|
+
tableRow: "table row",
|
|
9
|
+
heading: "heading",
|
|
10
|
+
listItem: "list item",
|
|
11
|
+
card: "card",
|
|
12
|
+
image: "image",
|
|
13
|
+
formField: "form field",
|
|
14
|
+
dialog: "dialog",
|
|
15
|
+
section: "section",
|
|
16
|
+
page: "page"
|
|
17
|
+
}), i = 300, a = 80, o = 10, s = /* @__PURE__ */ new Set([
|
|
18
|
+
"SCRIPT",
|
|
19
|
+
"STYLE",
|
|
20
|
+
"NOSCRIPT",
|
|
21
|
+
"TEMPLATE",
|
|
22
|
+
"INPUT",
|
|
23
|
+
"TEXTAREA",
|
|
24
|
+
"SELECT",
|
|
25
|
+
"OPTION",
|
|
26
|
+
"SVG",
|
|
27
|
+
"CANVAS",
|
|
28
|
+
"IFRAME"
|
|
29
|
+
]);
|
|
30
|
+
function c(t) {
|
|
31
|
+
return s.has(t.tagName.toUpperCase()) || t.getAttribute("aria-hidden") === "true" || t.hasAttribute("hidden") || t.closest("[data-agent-sensitive]") ? !0 : e(t);
|
|
32
|
+
}
|
|
33
|
+
function l(e, t = i) {
|
|
34
|
+
if (c(e)) return "";
|
|
35
|
+
let n = e.ownerDocument, r = [], a = 0, o = (i) => {
|
|
36
|
+
if (a >= t) return;
|
|
37
|
+
if (i.nodeType === 3) {
|
|
38
|
+
let e = i.nodeValue ?? "";
|
|
39
|
+
e.trim() && (r.push(e), a += e.length);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
if (i.nodeType !== 1) return;
|
|
43
|
+
let s = i;
|
|
44
|
+
if (s !== e && c(s)) return;
|
|
45
|
+
let l = s !== e && n.defaultView?.getComputedStyle?.(s).display === "block";
|
|
46
|
+
l && r.push(" ");
|
|
47
|
+
for (let e of Array.from(s.childNodes)) o(e);
|
|
48
|
+
l && r.push(" ");
|
|
49
|
+
};
|
|
50
|
+
o(e);
|
|
51
|
+
let s = r.join("").replace(/\s+/g, " ").trim();
|
|
52
|
+
return s.length > t ? `${s.slice(0, t - 1)}…` : s;
|
|
53
|
+
}
|
|
54
|
+
function u(e, t) {
|
|
55
|
+
let n = (e.getAttribute(t) ?? "").split(/\s+/).filter(Boolean), r = e.ownerDocument;
|
|
56
|
+
return n.map((e) => r.getElementById(e)).filter((e) => e !== null).map((e) => l(e, a)).filter(Boolean).join(" ");
|
|
57
|
+
}
|
|
58
|
+
function d(e) {
|
|
59
|
+
let t = u(e, "aria-labelledby");
|
|
60
|
+
if (t) return t;
|
|
61
|
+
let n = e.getAttribute("aria-label")?.trim();
|
|
62
|
+
if (n) return n;
|
|
63
|
+
if (e.tagName === "IMG") {
|
|
64
|
+
let t = e.getAttribute("alt")?.trim();
|
|
65
|
+
if (t) return t;
|
|
66
|
+
}
|
|
67
|
+
return l(e, a) || (e.getAttribute("title")?.trim() ?? "");
|
|
68
|
+
}
|
|
69
|
+
function f(e, t) {
|
|
70
|
+
let n = t.trim();
|
|
71
|
+
return n ? {
|
|
72
|
+
label: e,
|
|
73
|
+
value: n
|
|
74
|
+
} : null;
|
|
75
|
+
}
|
|
76
|
+
function p(e) {
|
|
77
|
+
let t = e.querySelector("main h1, [role=\"main\"] h1") ?? e.querySelector("h1");
|
|
78
|
+
return (t && !c(t) ? l(t, a) : "") || e.title.trim();
|
|
79
|
+
}
|
|
80
|
+
function m(e, t) {
|
|
81
|
+
let n = e.ownerDocument, r = t ?? n.body;
|
|
82
|
+
if (!r) return "";
|
|
83
|
+
let i = Array.from(r.querySelectorAll("h1, h2, h3, h4, h5, h6, [role=\"heading\"]")).filter((t) => !t.contains(e) && !c(t)), o = "";
|
|
84
|
+
for (let t of i) t.compareDocumentPosition(e) & 4 && (o = l(t, a));
|
|
85
|
+
return o;
|
|
86
|
+
}
|
|
87
|
+
function h(e) {
|
|
88
|
+
let t = e.getAttribute("href") ?? "";
|
|
89
|
+
if (!t || t.startsWith("#") || /^javascript:/i.test(t)) return "";
|
|
90
|
+
try {
|
|
91
|
+
let n = new URL(t, e.ownerDocument.location?.href);
|
|
92
|
+
if (n.protocol !== "http:" && n.protocol !== "https:" && n.protocol !== "mailto:") return "";
|
|
93
|
+
let r = e.ownerDocument.location?.origin;
|
|
94
|
+
return n.origin === r ? `${n.pathname}${n.search}` : n.href;
|
|
95
|
+
} catch {
|
|
96
|
+
return "";
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function g(e) {
|
|
100
|
+
let t = e.closest("table, [role=\"table\"], [role=\"grid\"], [role=\"treegrid\"]");
|
|
101
|
+
return t ? Array.from(t.querySelectorAll("th, [role=\"columnheader\"]")).filter((t) => t.closest("tr, [role=\"row\"]") !== e).map((e) => d(e)) : [];
|
|
102
|
+
}
|
|
103
|
+
function _(e) {
|
|
104
|
+
return Array.from(e.children).filter((e) => /^(TD|TH)$/.test(e.tagName) || /^(cell|gridcell|rowheader)$/.test(e.getAttribute("role") ?? ""));
|
|
105
|
+
}
|
|
106
|
+
function v(e) {
|
|
107
|
+
let t = _(e).slice(0, o), n = g(e), r = [], s = "";
|
|
108
|
+
return t.forEach((e, t) => {
|
|
109
|
+
let o = l(e, i);
|
|
110
|
+
if (!o) return;
|
|
111
|
+
s ||= o.slice(0, a);
|
|
112
|
+
let c = f(n[t] || `Column ${t + 1}`, o);
|
|
113
|
+
c && r.push(c);
|
|
114
|
+
}), s ||= d(e), {
|
|
115
|
+
label: s,
|
|
116
|
+
facts: r
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
function y(e) {
|
|
120
|
+
let n = e.ownerDocument, r = e.closest("label"), i = null, o = "";
|
|
121
|
+
if (r) {
|
|
122
|
+
let e = r.getAttribute("for");
|
|
123
|
+
i = (e ? n.getElementById(e) : null) ?? r.querySelector("input, textarea, select, [role=\"combobox\"], [role=\"textbox\"]"), o = l(r, a);
|
|
124
|
+
}
|
|
125
|
+
if (!o) return null;
|
|
126
|
+
if (i && t(i)) return {
|
|
127
|
+
label: o,
|
|
128
|
+
facts: []
|
|
129
|
+
};
|
|
130
|
+
let s = [];
|
|
131
|
+
if (i) {
|
|
132
|
+
let e = f("Help text", u(i, "aria-describedby"));
|
|
133
|
+
e && s.push(e), i.getAttribute("aria-invalid") === "true" && s.push({
|
|
134
|
+
label: "State",
|
|
135
|
+
value: "invalid"
|
|
136
|
+
}), (i.hasAttribute("required") || i.getAttribute("aria-required") === "true") && s.push({
|
|
137
|
+
label: "Required",
|
|
138
|
+
value: "yes"
|
|
139
|
+
}), (i.hasAttribute("disabled") || i.getAttribute("aria-disabled") === "true") && s.push({
|
|
140
|
+
label: "State",
|
|
141
|
+
value: "disabled"
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
return {
|
|
145
|
+
label: o,
|
|
146
|
+
facts: s
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
var b = [
|
|
150
|
+
{
|
|
151
|
+
selector: "a[href]",
|
|
152
|
+
kind: "link"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
selector: "[role=\"tab\"]",
|
|
156
|
+
kind: "tab"
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
selector: "[role=\"menuitem\"], [role=\"menuitemcheckbox\"], [role=\"menuitemradio\"], [role=\"option\"]",
|
|
160
|
+
kind: "menuItem"
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
selector: "button, [role=\"button\"], [role=\"switch\"], [role=\"checkbox\"], [role=\"radio\"], summary",
|
|
164
|
+
kind: "button"
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
selector: "label",
|
|
168
|
+
kind: "formField"
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
selector: "img, [role=\"img\"]",
|
|
172
|
+
kind: "image"
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
selector: "h1, h2, h3, h4, h5, h6, [role=\"heading\"]",
|
|
176
|
+
kind: "heading"
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
selector: "tr, [role=\"row\"]",
|
|
180
|
+
kind: "tableRow"
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
selector: "li, [role=\"listitem\"]",
|
|
184
|
+
kind: "listItem"
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
selector: "article, [role=\"article\"], [data-slot=\"card\"], [data-card]",
|
|
188
|
+
kind: "card"
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
selector: "dialog, [role=\"dialog\"]",
|
|
192
|
+
kind: "dialog"
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
selector: "section[aria-label], section[aria-labelledby], [role=\"region\"], form[aria-label]",
|
|
196
|
+
kind: "section"
|
|
197
|
+
}
|
|
198
|
+
];
|
|
199
|
+
function x(e) {
|
|
200
|
+
for (let t = e; t; t = t.parentElement) {
|
|
201
|
+
if (t === t.ownerDocument.body || t === t.ownerDocument.documentElement) return null;
|
|
202
|
+
for (let e of b) if (t.matches(e.selector)) return {
|
|
203
|
+
element: t,
|
|
204
|
+
kind: e.kind
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
return null;
|
|
208
|
+
}
|
|
209
|
+
function S(e) {
|
|
210
|
+
let t = [], n = e.ownerDocument, r = f("Page", p(n));
|
|
211
|
+
r && t.push(r);
|
|
212
|
+
let i = e.closest("dialog, [role=\"dialog\"]");
|
|
213
|
+
if (i && i !== e) {
|
|
214
|
+
let e = f("In dialog", d(i));
|
|
215
|
+
e && t.push(e);
|
|
216
|
+
}
|
|
217
|
+
let a = m(e, i);
|
|
218
|
+
return a && a !== r?.value && t.push({
|
|
219
|
+
label: "Under heading",
|
|
220
|
+
value: a
|
|
221
|
+
}), t;
|
|
222
|
+
}
|
|
223
|
+
function C(t, n = (e) => r[e]) {
|
|
224
|
+
if (e(t) || t.closest("[data-agent-sensitive]")) return null;
|
|
225
|
+
let o = t.ownerDocument, s = x(t);
|
|
226
|
+
if (!s) {
|
|
227
|
+
let e = p(o);
|
|
228
|
+
return e ? {
|
|
229
|
+
anchor: null,
|
|
230
|
+
input: {
|
|
231
|
+
kind: n("page"),
|
|
232
|
+
label: e,
|
|
233
|
+
facts: []
|
|
234
|
+
}
|
|
235
|
+
} : null;
|
|
236
|
+
}
|
|
237
|
+
let { element: m, kind: g } = s, _ = m instanceof HTMLElement ? m : null, b = "", C = [];
|
|
238
|
+
switch (g) {
|
|
239
|
+
case "tableRow": {
|
|
240
|
+
let e = v(m);
|
|
241
|
+
b = e.label, C = e.facts;
|
|
242
|
+
break;
|
|
243
|
+
}
|
|
244
|
+
case "formField": {
|
|
245
|
+
let e = y(m);
|
|
246
|
+
e && (b = e.label, C = e.facts);
|
|
247
|
+
break;
|
|
248
|
+
}
|
|
249
|
+
case "link": {
|
|
250
|
+
b = d(m);
|
|
251
|
+
let e = f("Goes to", m instanceof HTMLAnchorElement ? h(m) : "");
|
|
252
|
+
e && C.push(e);
|
|
253
|
+
break;
|
|
254
|
+
}
|
|
255
|
+
case "button":
|
|
256
|
+
case "tab":
|
|
257
|
+
case "menuItem": {
|
|
258
|
+
b = d(m);
|
|
259
|
+
let e = f("State", m.getAttribute("aria-selected") === "true" || m.getAttribute("aria-checked") === "true" || m.getAttribute("aria-pressed") === "true" ? "on" : m.hasAttribute("disabled") || m.getAttribute("aria-disabled") === "true" ? "disabled" : "");
|
|
260
|
+
e && C.push(e);
|
|
261
|
+
let t = f("Description", u(m, "aria-describedby"));
|
|
262
|
+
t && C.push(t);
|
|
263
|
+
break;
|
|
264
|
+
}
|
|
265
|
+
default: {
|
|
266
|
+
b = d(m);
|
|
267
|
+
let e = m.querySelector("h1, h2, h3, h4, h5, h6, [role=\"heading\"]"), t = e && !c(e) ? l(e, a) : "";
|
|
268
|
+
if (t && g !== "heading" && (b = t), g !== "heading" && g !== "image") {
|
|
269
|
+
let e = f("Shows", l(m, i));
|
|
270
|
+
e && e.value !== b && C.push(e);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
if (!b) {
|
|
275
|
+
let e = p(o);
|
|
276
|
+
return e ? {
|
|
277
|
+
anchor: null,
|
|
278
|
+
input: {
|
|
279
|
+
kind: n("page"),
|
|
280
|
+
label: e,
|
|
281
|
+
facts: []
|
|
282
|
+
}
|
|
283
|
+
} : null;
|
|
284
|
+
}
|
|
285
|
+
return {
|
|
286
|
+
anchor: _,
|
|
287
|
+
input: {
|
|
288
|
+
kind: n(g),
|
|
289
|
+
label: b.length > a ? `${b.slice(0, 79)}…` : b,
|
|
290
|
+
facts: [...C, ...S(m)]
|
|
291
|
+
}
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
export { n as ASK_EDITABLE_SELECTOR, r as GENERIC_KIND_FALLBACK, d as askableNameOf, l as askableVisibleText, C as describeAnything };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { AskableSelectionOffer } from './askableSelection';
|
|
2
2
|
/** The menu's width; the layer renders it at exactly this. */
|
|
3
3
|
export declare const ASK_ABOUT_MENU_WIDTH = 256;
|
|
4
|
+
/** ★ BOFF-14630: each one-line item under it (Copy, Open in new tab, Copy link). */
|
|
5
|
+
export declare const ASK_ABOUT_EXTRA_ITEM_HEIGHT = 36;
|
|
4
6
|
/** Where the menu goes for a request at (x, y): there, or moved back inside the viewport. */
|
|
5
7
|
export declare function placeAskAboutMenu(at: {
|
|
6
8
|
x: number;
|
|
@@ -8,7 +10,7 @@ export declare function placeAskAboutMenu(at: {
|
|
|
8
10
|
}, viewport: {
|
|
9
11
|
width: number;
|
|
10
12
|
height: number;
|
|
11
|
-
}): {
|
|
13
|
+
}, extraItems?: number): {
|
|
12
14
|
left: number;
|
|
13
15
|
top: number;
|
|
14
16
|
};
|
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
// src/shared/assistant/askAbout/placement.ts
|
|
2
|
-
var e = 256;
|
|
3
|
-
function
|
|
2
|
+
var e = 256, t = 36;
|
|
3
|
+
function n(e, t, n = 0) {
|
|
4
|
+
let r = 64 + n * 36;
|
|
4
5
|
return {
|
|
5
6
|
left: Math.max(8, Math.min(e.x, t.width - 256 - 8)),
|
|
6
|
-
top: e.y +
|
|
7
|
+
top: e.y + r + 8 <= t.height ? e.y : Math.max(8, e.y - r)
|
|
7
8
|
};
|
|
8
9
|
}
|
|
9
|
-
function
|
|
10
|
+
function r(e, t) {
|
|
10
11
|
let n = Math.max(8, Math.min(e.left, t.width - 96 - 8)), r = e.bottom + 6;
|
|
11
12
|
return {
|
|
12
13
|
left: n,
|
|
13
14
|
top: r + 32 + 8 <= t.height ? r : Math.max(8, e.top - 6 - 32)
|
|
14
15
|
};
|
|
15
16
|
}
|
|
16
|
-
var
|
|
17
|
-
function
|
|
18
|
-
return
|
|
17
|
+
var i = (e) => typeof e == "object" && !!e && typeof e.nodeType == "number" && typeof e.contains == "function";
|
|
18
|
+
function a(e, t, n) {
|
|
19
|
+
return i(e) && i(n) && n.contains(e) ? !1 : !i(t) || !i(e) || e.nodeType === 9 || e.contains(t);
|
|
19
20
|
}
|
|
20
|
-
function
|
|
21
|
+
function o(e, t) {
|
|
21
22
|
let n = e.left, r = e.top, i = e.left + e.width, a = e.top + e.height;
|
|
22
23
|
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
24
|
return i - n < 1 || a - r < 1 ? null : {
|
|
@@ -27,4 +28,4 @@ function a(e, t) {
|
|
|
27
28
|
height: a - r
|
|
28
29
|
};
|
|
29
30
|
}
|
|
30
|
-
export { e as ASK_ABOUT_MENU_WIDTH,
|
|
31
|
+
export { t as ASK_ABOUT_EXTRA_ITEM_HEIGHT, e as ASK_ABOUT_MENU_WIDTH, n as placeAskAboutMenu, r as placeAskSelectionButton, a as scrollClosesMenu, o as visiblePart };
|