@sedum-dev/core 0.1.0-alpha.6 → 0.1.0-alpha.7
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/README.md +1 -1
- package/dist/index.d.ts +47 -7
- package/dist/index.js +691 -36
- package/dist/page-script/index.global.js +140 -11
- package/dist/{script-api-D3if59MQ.d.ts → script-api-B8MYTfrL.d.ts} +5 -0
- package/dist/script-api.d.ts +1 -1
- package/package.json +1 -1
|
@@ -179,14 +179,18 @@ var SedumPageScript = (() => {
|
|
|
179
179
|
return true;
|
|
180
180
|
}
|
|
181
181
|
return false;
|
|
182
|
-
}, publicText = function(element, visualOnly = false) {
|
|
182
|
+
}, publicText = function(element, visualOnly = false, ownOnly = false) {
|
|
183
183
|
const parts = [];
|
|
184
184
|
for (const node of flatTextNodes(element)) {
|
|
185
185
|
const parent = node.parentElement;
|
|
186
|
-
if (parent && visible(parent, visualOnly) && !excludedTextAncestor(parent))
|
|
186
|
+
if (parent && visible(parent, visualOnly) && !excludedTextAncestor(parent) && !(ownOnly && insideNestedControl(element, parent)))
|
|
187
187
|
parts.push(node.textContent ?? "");
|
|
188
188
|
}
|
|
189
189
|
return parts.join(" ").replace(/\s+/g, " ").trim();
|
|
190
|
+
}, insideNestedControl = function(element, node) {
|
|
191
|
+
for (let current = node; current && current !== element; current = composedParent(current))
|
|
192
|
+
if (interactive(current)) return true;
|
|
193
|
+
return false;
|
|
190
194
|
}, referencedLabelText = function(element) {
|
|
191
195
|
const walker = document.createTreeWalker(element, NodeFilter.SHOW_TEXT);
|
|
192
196
|
const parts = [];
|
|
@@ -223,7 +227,7 @@ var SedumPageScript = (() => {
|
|
|
223
227
|
const value = element.value.trim();
|
|
224
228
|
if (value) return value;
|
|
225
229
|
}
|
|
226
|
-
return publicText(element, visualOnly) || element.getAttribute("title")?.trim() || "";
|
|
230
|
+
return publicText(element, visualOnly, true) || element.getAttribute("title")?.trim() || "";
|
|
227
231
|
}, nearbyText = function(element) {
|
|
228
232
|
const box = element.getBoundingClientRect();
|
|
229
233
|
if (!box.width || !box.height) return "";
|
|
@@ -279,6 +283,8 @@ var SedumPageScript = (() => {
|
|
|
279
283
|
}, iconName = function(element) {
|
|
280
284
|
for (const node of Array.from(element.querySelectorAll("i,span,em"))) {
|
|
281
285
|
if (node.textContent?.trim()) continue;
|
|
286
|
+
if (!node.getClientRects().length || insideNestedControl(element, node))
|
|
287
|
+
continue;
|
|
282
288
|
for (const token of Array.from(node.classList)) {
|
|
283
289
|
const match = /^(?:fa|bi|glyphicon|icon|mdi|ti|ri)-([a-z][a-z0-9-]*)$/.exec(token);
|
|
284
290
|
if (match && !/^(lg|[0-9]x|fw|solid|regular|light|brands|spin|pulse|border|inverse|stack.*|rotate.*|flip.*)$/.test(
|
|
@@ -329,6 +335,8 @@ var SedumPageScript = (() => {
|
|
|
329
335
|
let distance = Infinity;
|
|
330
336
|
if (sameLine && rect.right <= box.left + 2)
|
|
331
337
|
distance = box.left - rect.right;
|
|
338
|
+
else if (sameLine && rect.left >= box.right - 2)
|
|
339
|
+
distance = rect.left - box.right;
|
|
332
340
|
else if (rect.bottom <= box.top + 2 && rect.left < box.right)
|
|
333
341
|
distance = box.top - rect.bottom;
|
|
334
342
|
if (distance > 400) continue;
|
|
@@ -370,6 +378,19 @@ var SedumPageScript = (() => {
|
|
|
370
378
|
const placeholder = element.getAttribute("placeholder")?.trim() ?? "";
|
|
371
379
|
if (placeholder && placeholder !== name)
|
|
372
380
|
addPart(`placeholder "${clip(placeholder)}"`, placeholder);
|
|
381
|
+
const ariaLabel = element.getAttribute("aria-label")?.trim();
|
|
382
|
+
const labelledBy = element.getAttribute("aria-labelledby")?.split(/\s+/).some((id) => {
|
|
383
|
+
const labelled = document.getElementById(id);
|
|
384
|
+
return labelled && referencedLabelText(labelled);
|
|
385
|
+
});
|
|
386
|
+
const nativeLabel = Array.from(element.labels ?? []).some(
|
|
387
|
+
(node) => Boolean(publicText(node).trim())
|
|
388
|
+
);
|
|
389
|
+
if (placeholder && placeholder === name && !ariaLabel && !labelledBy && !nativeLabel) {
|
|
390
|
+
const caption = nearbyText(element) || rowLabel(element);
|
|
391
|
+
if (caption && caption !== placeholder)
|
|
392
|
+
addPart(`label "${clip(caption)}"`, caption);
|
|
393
|
+
}
|
|
373
394
|
}
|
|
374
395
|
const named = element.hasAttribute("aria-label") || element.hasAttribute("aria-labelledby");
|
|
375
396
|
const shown = publicText(element, true);
|
|
@@ -412,6 +433,16 @@ var SedumPageScript = (() => {
|
|
|
412
433
|
if (kind) addPart(`${kind[1]} icon`, kind[1]);
|
|
413
434
|
}
|
|
414
435
|
if (kbdText && kbdText === shown) addPart("keyboard shortcut");
|
|
436
|
+
const items = Array.from(element.querySelectorAll("*")).filter((node) => node !== element && interactive(node) && !visible(node)).slice(0, 6).map((node) => {
|
|
437
|
+
const glyph = Array.from(node.querySelectorAll("i,span,em")).flatMap((icon) => Array.from(icon.classList)).map(
|
|
438
|
+
(token) => /^(?:fa|bi|icon|mdi|ti|ri)-([a-z][a-z0-9-]*)$/.exec(token)?.[1]
|
|
439
|
+
).find(
|
|
440
|
+
(name2) => name2 && !/^(lg|[0-9]x|fw|solid|regular|light)$/.test(name2)
|
|
441
|
+
);
|
|
442
|
+
return [glyph?.replace(/-/g, " "), referencedLabelText(node)].filter(Boolean).join(" ");
|
|
443
|
+
}).filter(Boolean);
|
|
444
|
+
if (items.length)
|
|
445
|
+
addPart(`menu "${clip(items.join(", "), 80)}"`, items.join(" "));
|
|
415
446
|
return parts.join(", ");
|
|
416
447
|
}, countBadgeKind = function(node, count) {
|
|
417
448
|
const tokens = [];
|
|
@@ -474,7 +505,64 @@ var SedumPageScript = (() => {
|
|
|
474
505
|
for (let node = parent; node; node = composedParent(node))
|
|
475
506
|
if (interactive(node)) return false;
|
|
476
507
|
const inside = allElements(element, 500);
|
|
477
|
-
|
|
508
|
+
if (!inside) return false;
|
|
509
|
+
const controls = inside.filter(
|
|
510
|
+
(node) => interactive(node) || node.hasAttribute("role")
|
|
511
|
+
);
|
|
512
|
+
if (!controls.length) return true;
|
|
513
|
+
return controls.every(
|
|
514
|
+
(control) => !interactive(control) || !publicText(control, true)
|
|
515
|
+
) && !!publicText(element, false, true);
|
|
516
|
+
}, readHoverRules = function() {
|
|
517
|
+
const rules = [];
|
|
518
|
+
const visit = (list) => {
|
|
519
|
+
for (const rule of Array.from(list)) {
|
|
520
|
+
if (rule instanceof CSSStyleRule) {
|
|
521
|
+
const style = rule.style;
|
|
522
|
+
const reveals = style.visibility === "visible" || style.opacity !== "" && Number.parseFloat(style.opacity) > 0;
|
|
523
|
+
if (!reveals || !rule.selectorText.includes(":hover")) continue;
|
|
524
|
+
for (const selector of rule.selectorText.split(",")) {
|
|
525
|
+
const at = selector.indexOf(":hover");
|
|
526
|
+
if (at < 0) continue;
|
|
527
|
+
const host = selector.slice(0, at).trim();
|
|
528
|
+
const revealed = selector.replace(/:hover/g, "").trim();
|
|
529
|
+
if (!host || host === revealed) continue;
|
|
530
|
+
try {
|
|
531
|
+
document.querySelector(host);
|
|
532
|
+
document.querySelector(revealed);
|
|
533
|
+
rules.push({ revealed, host });
|
|
534
|
+
} catch {
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
} else if ("cssRules" in rule) {
|
|
538
|
+
visit(rule.cssRules);
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
};
|
|
542
|
+
for (const sheet of Array.from(document.styleSheets)) {
|
|
543
|
+
try {
|
|
544
|
+
visit(sheet.cssRules);
|
|
545
|
+
} catch {
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
return rules;
|
|
549
|
+
}, hoverHost = function(element) {
|
|
550
|
+
if (!interactive(element) || !element.getClientRects().length) return null;
|
|
551
|
+
if (element.closest("[hidden],[inert],[aria-hidden='true']")) return null;
|
|
552
|
+
hoverRules ??= readHoverRules();
|
|
553
|
+
for (let node = element; node && node !== document.body; node = composedParent(node)) {
|
|
554
|
+
const style = getComputedStyle(node);
|
|
555
|
+
if (style.display === "none") return null;
|
|
556
|
+
if (node !== element && interactive(node)) return null;
|
|
557
|
+
for (const rule of hoverRules) {
|
|
558
|
+
if (!node.matches(rule.revealed)) continue;
|
|
559
|
+
const host = composedParent(node)?.closest(rule.host);
|
|
560
|
+
if (host && visible(host)) return host;
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
return null;
|
|
564
|
+
}, hoverRevealed = function(element) {
|
|
565
|
+
return !visible(element) && !!hoverHost(element);
|
|
478
566
|
}, landmarkOf = function(node) {
|
|
479
567
|
const tag = node.tagName.toLowerCase();
|
|
480
568
|
const explicit = node.getAttribute("role");
|
|
@@ -672,7 +760,7 @@ var SedumPageScript = (() => {
|
|
|
672
760
|
break;
|
|
673
761
|
}
|
|
674
762
|
const sameLabel = Array.from(possible).filter(
|
|
675
|
-
(item2) => visible(item2) && label(item2) === name
|
|
763
|
+
(item2) => (visible(item2) || hoverRevealed(item2)) && (label(item2) || mediaName(item2) || iconName(item2)) === name
|
|
676
764
|
);
|
|
677
765
|
if (sameLabel.length > 1) {
|
|
678
766
|
region = lastUnique;
|
|
@@ -680,6 +768,7 @@ var SedumPageScript = (() => {
|
|
|
680
768
|
}
|
|
681
769
|
lastUnique = region;
|
|
682
770
|
if (region.matches("article,li,[data-product],[role='listitem']")) break;
|
|
771
|
+
if (operation === "click" && pointerTarget(region)) break;
|
|
683
772
|
const container = region;
|
|
684
773
|
if (operation === "read" && container.classList.length > 0 && Array.from(container.parentElement?.children ?? []).some(
|
|
685
774
|
(sibling) => sibling !== container && sibling.tagName === container.tagName && sibling.classList.length === container.classList.length && Array.from(container.classList).every(
|
|
@@ -743,6 +832,7 @@ var SedumPageScript = (() => {
|
|
|
743
832
|
};
|
|
744
833
|
const outline = [];
|
|
745
834
|
titleCache.clear();
|
|
835
|
+
hoverRules = void 0;
|
|
746
836
|
for (const element of elements) {
|
|
747
837
|
if (element.matches("h1,h2,h3,h4,h5,h6,[role='heading']")) {
|
|
748
838
|
const text = visible(element) ? publicText(element) : "";
|
|
@@ -757,7 +847,7 @@ var SedumPageScript = (() => {
|
|
|
757
847
|
}
|
|
758
848
|
}
|
|
759
849
|
const proxied = operation === "click" ? toggleLabel(element) : null;
|
|
760
|
-
if (!(visible(element) || transparentToggle(element) || operation === "click" && ariaHiddenOnly(element)) || (operation === "read" ? !readable(element) : !interactive(element) && !proxied && (operation !== "click" || !pointerTarget(element))))
|
|
850
|
+
if (!(visible(element) || transparentToggle(element) || operation === "click" && (ariaHiddenOnly(element) || hoverRevealed(element))) || (operation === "read" ? !readable(element) : !interactive(element) && !proxied && (operation !== "click" || !pointerTarget(element))))
|
|
761
851
|
continue;
|
|
762
852
|
if (operation === "fill" && !editable(element)) continue;
|
|
763
853
|
if (operation === "click" && editable(element) && !element.matches("input[type='checkbox'],input[type='radio']") && role(element) !== "combobox" && !element.readOnly)
|
|
@@ -876,6 +966,8 @@ var SedumPageScript = (() => {
|
|
|
876
966
|
}
|
|
877
967
|
return parts.join(" ").replace(/\s+/g, " ").trim();
|
|
878
968
|
}, digest = function() {
|
|
969
|
+
return pageText(DIGEST_LIMIT);
|
|
970
|
+
}, pageText = function(limit) {
|
|
879
971
|
const current = version();
|
|
880
972
|
const selectedModal = modal();
|
|
881
973
|
if (selectedModal === void 0)
|
|
@@ -919,7 +1011,7 @@ var SedumPageScript = (() => {
|
|
|
919
1011
|
const part2 = !selection ? "" : name ? `${name}: ${selection}` : selection;
|
|
920
1012
|
if (!part2) continue;
|
|
921
1013
|
size += Array.from(part2).length + (pieces.length ? 1 : 0);
|
|
922
|
-
if (size >
|
|
1014
|
+
if (size > limit)
|
|
923
1015
|
return {
|
|
924
1016
|
protocol: PAGE_PROTOCOL,
|
|
925
1017
|
version: current,
|
|
@@ -936,7 +1028,7 @@ var SedumPageScript = (() => {
|
|
|
936
1028
|
const kind = /^\d{1,4}\+?$/.test(text) ? countBadgeKind(parent, text) : "";
|
|
937
1029
|
const part = kind ? `${kind} icon badge: ${text}` : text;
|
|
938
1030
|
size += Array.from(part).length + (pieces.length ? 1 : 0);
|
|
939
|
-
if (size >
|
|
1031
|
+
if (size > limit)
|
|
940
1032
|
return {
|
|
941
1033
|
protocol: PAGE_PROTOCOL,
|
|
942
1034
|
version: current,
|
|
@@ -985,6 +1077,32 @@ var SedumPageScript = (() => {
|
|
|
985
1077
|
if (!text) return { status: "empty" };
|
|
986
1078
|
if (Array.from(text).length > 4096) return { status: "too_long" };
|
|
987
1079
|
return { status: "ok", text };
|
|
1080
|
+
}, controlState = function(target) {
|
|
1081
|
+
const current = version();
|
|
1082
|
+
if (!snapshot || snapshot.operation !== "click" && snapshot.operation !== "fill" || !same(snapshot.version, current) || !same(target.version, current))
|
|
1083
|
+
return { status: "stale" };
|
|
1084
|
+
const element = refElement(target.ref);
|
|
1085
|
+
const candidate = snapshot.candidates.find(
|
|
1086
|
+
(item) => item.ref === target.ref
|
|
1087
|
+
);
|
|
1088
|
+
if (!element || !candidate || element.tagName.toLowerCase() !== target.tag || candidate.name !== target.name)
|
|
1089
|
+
return { status: "stale" };
|
|
1090
|
+
const control = toggleLabel(element) ?? element;
|
|
1091
|
+
const ariaChecked = control.getAttribute("aria-checked");
|
|
1092
|
+
const checked = isToggle(control) ? control.checked : ariaChecked === "true" || ariaChecked === "mixed" ? true : ariaChecked === "false" ? false : null;
|
|
1093
|
+
const active = (root) => {
|
|
1094
|
+
const focused2 = root.activeElement;
|
|
1095
|
+
return focused2?.shadowRoot ? active(focused2.shadowRoot) ?? focused2 : focused2;
|
|
1096
|
+
};
|
|
1097
|
+
const focused = active(document);
|
|
1098
|
+
const textField = element instanceof HTMLInputElement && FILLABLE_INPUT_TYPES.has(element.type) && element.type !== "password" || element instanceof HTMLTextAreaElement;
|
|
1099
|
+
return {
|
|
1100
|
+
status: "ok",
|
|
1101
|
+
disabled: disabled(control),
|
|
1102
|
+
checked,
|
|
1103
|
+
focused: !!focused && (focused === control || deepContains(control, focused)),
|
|
1104
|
+
value: textField ? element.value : element instanceof HTMLElement && element.isContentEditable ? element.textContent ?? "" : null
|
|
1105
|
+
};
|
|
988
1106
|
}, aim = function(ref, expected) {
|
|
989
1107
|
const current = version();
|
|
990
1108
|
if (!snapshot || !same(snapshot.version, current))
|
|
@@ -998,7 +1116,8 @@ var SedumPageScript = (() => {
|
|
|
998
1116
|
const candidate = snapshot?.candidates.find((item) => item.ref === ref);
|
|
999
1117
|
if (!candidate || candidateName(element) !== owned.get(element)?.rawName || JSON.stringify(peers(element, candidate.name).texts) !== JSON.stringify(candidate.peers) || expected && expected.name !== candidate.name)
|
|
1000
1118
|
return { actionable: false, reason: "stale" };
|
|
1001
|
-
|
|
1119
|
+
const shownBy = visible(element) ? null : hoverHost(element);
|
|
1120
|
+
if (!(visible(element) || transparentToggle(element) || ariaHiddenOnly(element) || shownBy) || disabled(element))
|
|
1002
1121
|
return { actionable: false, reason: "not_actionable" };
|
|
1003
1122
|
const enclosingLink = element.closest("a[href]");
|
|
1004
1123
|
if (enclosingLink) {
|
|
@@ -1022,7 +1141,7 @@ var SedumPageScript = (() => {
|
|
|
1022
1141
|
const y = rect.top + rect.height * fy;
|
|
1023
1142
|
if (x < 0 || y < 0 || x >= innerWidth || y >= innerHeight) continue;
|
|
1024
1143
|
const hit = deepElementFromPoint(x, y);
|
|
1025
|
-
if (hit && deepContains(element, hit)) {
|
|
1144
|
+
if (hit && deepContains(shownBy ?? element, hit)) {
|
|
1026
1145
|
return {
|
|
1027
1146
|
actionable: true,
|
|
1028
1147
|
aim: {
|
|
@@ -1033,6 +1152,7 @@ var SedumPageScript = (() => {
|
|
|
1033
1152
|
tag: element.tagName.toLowerCase(),
|
|
1034
1153
|
name: candidate.name,
|
|
1035
1154
|
point: { x: rect.width * fx, y: rect.height * fy },
|
|
1155
|
+
...shownBy ? { hover: true } : {},
|
|
1036
1156
|
box: {
|
|
1037
1157
|
x: Math.max(0, rect.left / innerWidth),
|
|
1038
1158
|
y: Math.max(0, rect.top / innerHeight),
|
|
@@ -1057,7 +1177,7 @@ var SedumPageScript = (() => {
|
|
|
1057
1177
|
return { actionable: false, reason: "stale" };
|
|
1058
1178
|
return hitTest() ?? { actionable: false, reason: "not_actionable" };
|
|
1059
1179
|
};
|
|
1060
|
-
observe2 = observe, composedParent2 = composedParent, allElements2 = allElements, flatTextNodes2 = flatTextNodes, deepElementFromPoint2 = deepElementFromPoint, deepContains2 = deepContains, version2 = version, same2 = same, clearRefs2 = clearRefs, visible2 = visible, modal2 = modal, excludedTextAncestor2 = excludedTextAncestor, publicText2 = publicText, referencedLabelText2 = referencedLabelText, label2 = label, nearbyText2 = nearbyText, mediaName2 = mediaName, hostLabel2 = hostLabel, iconName2 = iconName, describedText2 = describedText, rowLabel2 = rowLabel, candidateName2 = candidateName, hintWords2 = hintWords, addsWords2 = addsWords, siteRootLink2 = siteRootLink, nameHint2 = nameHint, countBadgeKind2 = countBadgeKind, clippedAway2 = clippedAway, ariaHiddenOnly2 = ariaHiddenOnly, isToggle2 = isToggle, transparentToggle2 = transparentToggle, toggleLabel2 = toggleLabel, pointerTarget2 = pointerTarget, landmarkOf2 = landmarkOf, landmarkRoot2 = landmarkRoot, locationOf2 = locationOf, shortText2 = shortText, containerTitle2 = containerTitle, sectionOf2 = sectionOf, boundedName2 = boundedName, role2 = role, interactive2 = interactive, readable2 = readable, editable2 = editable, disabled2 = disabled, path2 = path, inArticleBody2 = inArticleBody, itemContext2 = itemContext, peers2 = peers, scan2 = scan, collect2 = collect, selectOnly2 = selectOnly, selectedText2 = selectedText, digest2 = digest, refElement2 = refElement, fillElement2 = fillElement, readTarget2 = readTarget, aim2 = aim;
|
|
1180
|
+
observe2 = observe, composedParent2 = composedParent, allElements2 = allElements, flatTextNodes2 = flatTextNodes, deepElementFromPoint2 = deepElementFromPoint, deepContains2 = deepContains, version2 = version, same2 = same, clearRefs2 = clearRefs, visible2 = visible, modal2 = modal, excludedTextAncestor2 = excludedTextAncestor, publicText2 = publicText, insideNestedControl2 = insideNestedControl, referencedLabelText2 = referencedLabelText, label2 = label, nearbyText2 = nearbyText, mediaName2 = mediaName, hostLabel2 = hostLabel, iconName2 = iconName, describedText2 = describedText, rowLabel2 = rowLabel, candidateName2 = candidateName, hintWords2 = hintWords, addsWords2 = addsWords, siteRootLink2 = siteRootLink, nameHint2 = nameHint, countBadgeKind2 = countBadgeKind, clippedAway2 = clippedAway, ariaHiddenOnly2 = ariaHiddenOnly, isToggle2 = isToggle, transparentToggle2 = transparentToggle, toggleLabel2 = toggleLabel, pointerTarget2 = pointerTarget, readHoverRules2 = readHoverRules, hoverHost2 = hoverHost, hoverRevealed2 = hoverRevealed, landmarkOf2 = landmarkOf, landmarkRoot2 = landmarkRoot, locationOf2 = locationOf, shortText2 = shortText, containerTitle2 = containerTitle, sectionOf2 = sectionOf, boundedName2 = boundedName, role2 = role, interactive2 = interactive, readable2 = readable, editable2 = editable, disabled2 = disabled, path2 = path, inArticleBody2 = inArticleBody, itemContext2 = itemContext, peers2 = peers, scan2 = scan, collect2 = collect, selectOnly2 = selectOnly, selectedText2 = selectedText, digest2 = digest, pageText2 = pageText, refElement2 = refElement, fillElement2 = fillElement, readTarget2 = readTarget, controlState2 = controlState, aim2 = aim;
|
|
1061
1181
|
const documentId = Array.from(crypto.getRandomValues(new Uint32Array(4))).map((part) => part.toString(16)).join("-");
|
|
1062
1182
|
let revision = 0;
|
|
1063
1183
|
let route = location.href;
|
|
@@ -1124,6 +1244,7 @@ var SedumPageScript = (() => {
|
|
|
1124
1244
|
[/(?:^|-)play(?:$|-)/, "play"],
|
|
1125
1245
|
[/(?:^|-)pause(?:$|-)/, "pause"]
|
|
1126
1246
|
];
|
|
1247
|
+
let hoverRules;
|
|
1127
1248
|
const SECTIONING = "article,aside,main,nav,section";
|
|
1128
1249
|
const SECTION_TITLE_LIMIT = 60;
|
|
1129
1250
|
const titleCache = /* @__PURE__ */ new Map();
|
|
@@ -1162,6 +1283,7 @@ var SedumPageScript = (() => {
|
|
|
1162
1283
|
},
|
|
1163
1284
|
collect,
|
|
1164
1285
|
digest,
|
|
1286
|
+
visibleText: () => pageText(Number.MAX_SAFE_INTEGER),
|
|
1165
1287
|
pageVersion: version,
|
|
1166
1288
|
findBySignals: ({ operation }) => {
|
|
1167
1289
|
const first = collect({ operation });
|
|
@@ -1169,6 +1291,7 @@ var SedumPageScript = (() => {
|
|
|
1169
1291
|
},
|
|
1170
1292
|
clickTarget: (ref) => aim(ref),
|
|
1171
1293
|
readTarget,
|
|
1294
|
+
controlState,
|
|
1172
1295
|
checkAim: (expected) => aim(expected.ref, expected),
|
|
1173
1296
|
fillElement,
|
|
1174
1297
|
clearRefs,
|
|
@@ -1209,6 +1332,7 @@ var SedumPageScript = (() => {
|
|
|
1209
1332
|
var modal2;
|
|
1210
1333
|
var excludedTextAncestor2;
|
|
1211
1334
|
var publicText2;
|
|
1335
|
+
var insideNestedControl2;
|
|
1212
1336
|
var referencedLabelText2;
|
|
1213
1337
|
var label2;
|
|
1214
1338
|
var nearbyText2;
|
|
@@ -1229,6 +1353,9 @@ var SedumPageScript = (() => {
|
|
|
1229
1353
|
var transparentToggle2;
|
|
1230
1354
|
var toggleLabel2;
|
|
1231
1355
|
var pointerTarget2;
|
|
1356
|
+
var readHoverRules2;
|
|
1357
|
+
var hoverHost2;
|
|
1358
|
+
var hoverRevealed2;
|
|
1232
1359
|
var landmarkOf2;
|
|
1233
1360
|
var landmarkRoot2;
|
|
1234
1361
|
var locationOf2;
|
|
@@ -1250,8 +1377,10 @@ var SedumPageScript = (() => {
|
|
|
1250
1377
|
var selectOnly2;
|
|
1251
1378
|
var selectedText2;
|
|
1252
1379
|
var digest2;
|
|
1380
|
+
var pageText2;
|
|
1253
1381
|
var refElement2;
|
|
1254
1382
|
var fillElement2;
|
|
1255
1383
|
var readTarget2;
|
|
1384
|
+
var controlState2;
|
|
1256
1385
|
var aim2;
|
|
1257
1386
|
})();
|
|
@@ -148,6 +148,11 @@ interface Ai {
|
|
|
148
148
|
/** Name a block of steps; every step inside is reported under the name. */
|
|
149
149
|
group<T>(name: string, body: () => Promise<T> | T): Promise<T>;
|
|
150
150
|
group(name: string, sentences: readonly string[], values?: AiValues): Promise<void>;
|
|
151
|
+
/**
|
|
152
|
+
* Ask whether a claim holds on the page now, to branch on what the page
|
|
153
|
+
* shows. It is judged like a verify, never retried, and never fails the test.
|
|
154
|
+
*/
|
|
155
|
+
holds(claim: string, values?: AiValues): Promise<boolean>;
|
|
151
156
|
/** Read the text of the element a description refers to. */
|
|
152
157
|
extract(description: string): Promise<string>;
|
|
153
158
|
extract<T>(description: string, parser: Parser<T>): Promise<T>;
|
package/dist/script-api.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { j as Ai, k as AiValue, A as AiValues, o as Parser, p as SecretValue, T as TestBody, q as TestContext, r as TestInfo, s as TestOptions, C as secret, G as test } from './script-api-
|
|
1
|
+
export { j as Ai, k as AiValue, A as AiValues, o as Parser, p as SecretValue, T as TestBody, q as TestContext, r as TestInfo, s as TestOptions, C as secret, G as test } from './script-api-B8MYTfrL.js';
|
|
2
2
|
export { expect } from 'playwright/test';
|
|
3
3
|
export { BrowserContext, Locator, Page } from 'playwright-core';
|