@sedum-dev/core 0.1.0-alpha.5 → 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.
@@ -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
- return !!inside && !inside.some((node) => interactive(node) || node.hasAttribute("role"));
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");
@@ -652,7 +740,7 @@ var SedumPageScript = (() => {
652
740
  pieces.push(part);
653
741
  }
654
742
  return { text: pieces.join(" "), complete: true };
655
- }, peers = function(element, name) {
743
+ }, peers = function(element, name, operation = "click") {
656
744
  const row = element.closest("tr");
657
745
  const preceding = row?.previousElementSibling;
658
746
  const rank = preceding?.querySelector(".rank");
@@ -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,14 @@ 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;
772
+ const container = region;
773
+ if (operation === "read" && container.classList.length > 0 && Array.from(container.parentElement?.children ?? []).some(
774
+ (sibling) => sibling !== container && sibling.tagName === container.tagName && sibling.classList.length === container.classList.length && Array.from(container.classList).every(
775
+ (name2) => sibling.classList.contains(name2)
776
+ )
777
+ ))
778
+ break;
683
779
  region = composedParent(region);
684
780
  }
685
781
  region = region === document.body ? lastUnique : region;
@@ -736,6 +832,7 @@ var SedumPageScript = (() => {
736
832
  };
737
833
  const outline = [];
738
834
  titleCache.clear();
835
+ hoverRules = void 0;
739
836
  for (const element of elements) {
740
837
  if (element.matches("h1,h2,h3,h4,h5,h6,[role='heading']")) {
741
838
  const text = visible(element) ? publicText(element) : "";
@@ -750,7 +847,7 @@ var SedumPageScript = (() => {
750
847
  }
751
848
  }
752
849
  const proxied = operation === "click" ? toggleLabel(element) : null;
753
- 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))))
754
851
  continue;
755
852
  if (operation === "fill" && !editable(element)) continue;
756
853
  if (operation === "click" && editable(element) && !element.matches("input[type='checkbox'],input[type='radio']") && role(element) !== "combobox" && !element.readOnly)
@@ -764,7 +861,7 @@ var SedumPageScript = (() => {
764
861
  nodeId = `${documentId}-node-${++nodeSequence}`;
765
862
  nodeIds.set(element, nodeId);
766
863
  }
767
- const peerData = peers(element, name);
864
+ const peerData = peers(element, name, operation);
768
865
  const location2 = locationOf(element, heading);
769
866
  const section = sectionOf(element, outline);
770
867
  const hint = operation === "read" ? "" : nameHint(element, rawName);
@@ -869,6 +966,8 @@ var SedumPageScript = (() => {
869
966
  }
870
967
  return parts.join(" ").replace(/\s+/g, " ").trim();
871
968
  }, digest = function() {
969
+ return pageText(DIGEST_LIMIT);
970
+ }, pageText = function(limit) {
872
971
  const current = version();
873
972
  const selectedModal = modal();
874
973
  if (selectedModal === void 0)
@@ -912,7 +1011,7 @@ var SedumPageScript = (() => {
912
1011
  const part2 = !selection ? "" : name ? `${name}: ${selection}` : selection;
913
1012
  if (!part2) continue;
914
1013
  size += Array.from(part2).length + (pieces.length ? 1 : 0);
915
- if (size > DIGEST_LIMIT)
1014
+ if (size > limit)
916
1015
  return {
917
1016
  protocol: PAGE_PROTOCOL,
918
1017
  version: current,
@@ -929,7 +1028,7 @@ var SedumPageScript = (() => {
929
1028
  const kind = /^\d{1,4}\+?$/.test(text) ? countBadgeKind(parent, text) : "";
930
1029
  const part = kind ? `${kind} icon badge: ${text}` : text;
931
1030
  size += Array.from(part).length + (pieces.length ? 1 : 0);
932
- if (size > DIGEST_LIMIT)
1031
+ if (size > limit)
933
1032
  return {
934
1033
  protocol: PAGE_PROTOCOL,
935
1034
  version: current,
@@ -972,12 +1071,38 @@ var SedumPageScript = (() => {
972
1071
  const candidate = snapshot.candidates.find(
973
1072
  (item) => item.ref === target.ref
974
1073
  );
975
- if (!element || !candidate || element.tagName.toLowerCase() !== target.tag || candidate.name !== target.name || !readable(element) || !visible(element) || label(element) !== owned.get(element)?.rawName || JSON.stringify(peers(element, candidate.name).texts) !== JSON.stringify(candidate.peers))
1074
+ if (!element || !candidate || element.tagName.toLowerCase() !== target.tag || candidate.name !== target.name || !readable(element) || !visible(element) || label(element) !== owned.get(element)?.rawName || JSON.stringify(peers(element, candidate.name, "read").texts) !== JSON.stringify(candidate.peers))
976
1075
  return { status: "stale" };
977
1076
  const text = publicText(element);
978
1077
  if (!text) return { status: "empty" };
979
1078
  if (Array.from(text).length > 4096) return { status: "too_long" };
980
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
+ };
981
1106
  }, aim = function(ref, expected) {
982
1107
  const current = version();
983
1108
  if (!snapshot || !same(snapshot.version, current))
@@ -991,7 +1116,8 @@ var SedumPageScript = (() => {
991
1116
  const candidate = snapshot?.candidates.find((item) => item.ref === ref);
992
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)
993
1118
  return { actionable: false, reason: "stale" };
994
- if (!(visible(element) || transparentToggle(element) || ariaHiddenOnly(element)) || disabled(element))
1119
+ const shownBy = visible(element) ? null : hoverHost(element);
1120
+ if (!(visible(element) || transparentToggle(element) || ariaHiddenOnly(element) || shownBy) || disabled(element))
995
1121
  return { actionable: false, reason: "not_actionable" };
996
1122
  const enclosingLink = element.closest("a[href]");
997
1123
  if (enclosingLink) {
@@ -1015,7 +1141,7 @@ var SedumPageScript = (() => {
1015
1141
  const y = rect.top + rect.height * fy;
1016
1142
  if (x < 0 || y < 0 || x >= innerWidth || y >= innerHeight) continue;
1017
1143
  const hit = deepElementFromPoint(x, y);
1018
- if (hit && deepContains(element, hit)) {
1144
+ if (hit && deepContains(shownBy ?? element, hit)) {
1019
1145
  return {
1020
1146
  actionable: true,
1021
1147
  aim: {
@@ -1026,6 +1152,7 @@ var SedumPageScript = (() => {
1026
1152
  tag: element.tagName.toLowerCase(),
1027
1153
  name: candidate.name,
1028
1154
  point: { x: rect.width * fx, y: rect.height * fy },
1155
+ ...shownBy ? { hover: true } : {},
1029
1156
  box: {
1030
1157
  x: Math.max(0, rect.left / innerWidth),
1031
1158
  y: Math.max(0, rect.top / innerHeight),
@@ -1050,7 +1177,7 @@ var SedumPageScript = (() => {
1050
1177
  return { actionable: false, reason: "stale" };
1051
1178
  return hitTest() ?? { actionable: false, reason: "not_actionable" };
1052
1179
  };
1053
- 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;
1054
1181
  const documentId = Array.from(crypto.getRandomValues(new Uint32Array(4))).map((part) => part.toString(16)).join("-");
1055
1182
  let revision = 0;
1056
1183
  let route = location.href;
@@ -1117,6 +1244,7 @@ var SedumPageScript = (() => {
1117
1244
  [/(?:^|-)play(?:$|-)/, "play"],
1118
1245
  [/(?:^|-)pause(?:$|-)/, "pause"]
1119
1246
  ];
1247
+ let hoverRules;
1120
1248
  const SECTIONING = "article,aside,main,nav,section";
1121
1249
  const SECTION_TITLE_LIMIT = 60;
1122
1250
  const titleCache = /* @__PURE__ */ new Map();
@@ -1155,6 +1283,7 @@ var SedumPageScript = (() => {
1155
1283
  },
1156
1284
  collect,
1157
1285
  digest,
1286
+ visibleText: () => pageText(Number.MAX_SAFE_INTEGER),
1158
1287
  pageVersion: version,
1159
1288
  findBySignals: ({ operation }) => {
1160
1289
  const first = collect({ operation });
@@ -1162,6 +1291,7 @@ var SedumPageScript = (() => {
1162
1291
  },
1163
1292
  clickTarget: (ref) => aim(ref),
1164
1293
  readTarget,
1294
+ controlState,
1165
1295
  checkAim: (expected) => aim(expected.ref, expected),
1166
1296
  fillElement,
1167
1297
  clearRefs,
@@ -1202,6 +1332,7 @@ var SedumPageScript = (() => {
1202
1332
  var modal2;
1203
1333
  var excludedTextAncestor2;
1204
1334
  var publicText2;
1335
+ var insideNestedControl2;
1205
1336
  var referencedLabelText2;
1206
1337
  var label2;
1207
1338
  var nearbyText2;
@@ -1222,6 +1353,9 @@ var SedumPageScript = (() => {
1222
1353
  var transparentToggle2;
1223
1354
  var toggleLabel2;
1224
1355
  var pointerTarget2;
1356
+ var readHoverRules2;
1357
+ var hoverHost2;
1358
+ var hoverRevealed2;
1225
1359
  var landmarkOf2;
1226
1360
  var landmarkRoot2;
1227
1361
  var locationOf2;
@@ -1243,8 +1377,10 @@ var SedumPageScript = (() => {
1243
1377
  var selectOnly2;
1244
1378
  var selectedText2;
1245
1379
  var digest2;
1380
+ var pageText2;
1246
1381
  var refElement2;
1247
1382
  var fillElement2;
1248
1383
  var readTarget2;
1384
+ var controlState2;
1249
1385
  var aim2;
1250
1386
  })();
@@ -798,6 +798,10 @@
798
798
  "type": "string",
799
799
  "maxLength": 120
800
800
  },
801
+ "abstentionReason": {
802
+ "type": "string",
803
+ "maxLength": 120
804
+ },
801
805
  "elapsedMs": {
802
806
  "type": "number",
803
807
  "minimum": 0
@@ -813,7 +817,8 @@
813
817
  "invalid_json",
814
818
  "invalid_selection",
815
819
  "truncated_response",
816
- "unknown"
820
+ "unknown",
821
+ "stale_page"
817
822
  ]
818
823
  },
819
824
  "httpStatus": {
@@ -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>;
@@ -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-D3if59MQ.js';
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';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sedum-dev/core",
3
- "version": "0.1.0-alpha.5",
3
+ "version": "0.1.0-alpha.7",
4
4
  "repository": "https://github.com/sedum-dev/sedum",
5
5
  "publishConfig": {
6
6
  "access": "public"