@orkestrel/test 0.0.29 → 0.0.31

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.
@@ -1,7 +1,7 @@
1
- import { STATECHART_ATTRIBUTES, STATECHART_STATUSES, buildRefusal, checkBounds, collectSelectorClasses, executeScenario, invokeUnchecked, readProperty, requireValue, waitForAbort, waitForCondition, waitForDelay } from "../core/index.js";
1
+ import { STATECHART_ATTRIBUTES, STATECHART_STATUSES, buildRefusal, captureProduction, checkBounds, collectSelectorClasses, executeScenario, invokeUnchecked, readProperty, requireValue, waitForAbort, waitForCondition, waitForDelay } from "../core/index.js";
2
2
  import { cdp, commands, page, server, userEvent } from "vitest/browser";
3
- import { isArray, isError, isNumber, isRecord, isString, resolveField } from "@orkestrel/contract";
4
- //#region src/browser/helpers.ts
3
+ import { attempt, isArray, isError, isNumber, isRecord, isString, resolveField } from "@orkestrel/contract";
4
+ // src/browser/helpers.ts
5
5
  /**
6
6
  * Sends one DevTools protocol command through the browser provider.
7
7
  *
@@ -20,16 +20,26 @@ import { isArray, isError, isNumber, isRecord, isString, resolveField } from "@o
20
20
  * ```
21
21
  */
22
22
  async function sendProtocol(method, params) {
23
- let session;
24
- let send;
23
+ const [session, send] = readProtocolSession();
24
+ if (typeof send !== "function") throw new Error("Browser provider exposes no DevTools session");
25
+ return await invokeUnchecked(session, send, [method, params]);
26
+ }
27
+ /**
28
+ * Reads the browser provider's DevTools session and its send member.
29
+ *
30
+ * @throws Thrown when the provider or member read fails.
31
+ * @example
32
+ * ```ts
33
+ * const [session, send] = readProtocolSession()
34
+ * ```
35
+ */
36
+ function readProtocolSession() {
25
37
  try {
26
- session = cdp();
27
- send = readProperty(session, "send");
38
+ const session = cdp();
39
+ return [session, readProperty(session, "send")];
28
40
  } catch (cause) {
29
41
  throw new Error("Browser provider exposes no DevTools session", { cause });
30
42
  }
31
- if (typeof send !== "function") throw new Error("Browser provider exposes no DevTools session");
32
- return await invokeUnchecked(session, send, [method, params]);
33
43
  }
34
44
  /**
35
45
  * Waits for one animation frame to settle pending browser paint work.
@@ -128,8 +138,7 @@ function readStyle(element, property, pseudo) {
128
138
  }
129
139
  return getComputedStyle(element, pseudo).getPropertyValue(property).trim();
130
140
  }
131
- //#endregion
132
- //#region src/browser/journeys/constants.ts
141
+ // src/browser/journeys/constants.ts
133
142
  /**
134
143
  * Names the interactive ARIA roles a bare accessible name is searched across.
135
144
  *
@@ -303,8 +312,7 @@ var IMPLICIT_ROLES = Object.freeze({
303
312
  * so a rejected send keeps the marker for a retry.
304
313
  */
305
314
  var POINTER_HOLD = "data-pointer-hold";
306
- //#endregion
307
- //#region src/browser/captures/constants.ts
315
+ // src/browser/captures/constants.ts
308
316
  /**
309
317
  * Names the attribute marking the runner's tester pane, and the rule that sizes it, while a frame
310
318
  * is staged.
@@ -332,7 +340,7 @@ var CAPTURE_PANE = "data-capture-pane";
332
340
  * one restaging past the cap before it comes back down to the edge. Nothing measured needs a
333
341
  * fourth, so a fourth is the headroom that keeps a settling document off the refusal.
334
342
  */
335
- var CAPTURE_STAGINGS = 4;
343
+ var CAPTURE_STAGE_LIMIT = 4;
336
344
  /**
337
345
  * Names the tester root's attribute holding the media readings observed before the first stage.
338
346
  *
@@ -343,8 +351,7 @@ var CAPTURE_STAGINGS = 4;
343
351
  * the marker stays four bits and release leaves touch emulation alone.
344
352
  */
345
353
  var MEDIA_STAGE = "data-media-stage";
346
- //#endregion
347
- //#region src/browser/captures/helpers.ts
354
+ // src/browser/captures/helpers.ts
348
355
  /**
349
356
  * Reads one resolved CSS length as a number of pixels.
350
357
  *
@@ -573,15 +580,14 @@ function clipsOverflow(element) {
573
580
  * ```
574
581
  */
575
582
  function measureContent() {
576
- let edge = 0;
577
- for (const element of document.body.querySelectorAll("*")) {
583
+ const edge = Array.from(document.body.querySelectorAll("*")).reduce((greatest, element) => {
578
584
  const limits = collectClippingAncestors(element).filter((frame) => frame !== document.body && frame !== document.documentElement).flatMap((frame) => {
579
585
  const limit = readClipEdge(frame);
580
586
  return limit === void 0 ? [] : [limit];
581
587
  });
582
588
  const bottom = Math.min(element.getBoundingClientRect().bottom + window.scrollY + readPixels(element, "margin-bottom"), ...limits);
583
- if (bottom > edge) edge = bottom;
584
- }
589
+ return bottom > greatest ? bottom : greatest;
590
+ }, 0);
585
591
  return Math.ceil(edge + readPixels(document.body, "padding-bottom") + readPixels(document.body, "margin-bottom") + readPixels(document.documentElement, "padding-bottom") + readPixels(document.documentElement, "margin-bottom"));
586
592
  }
587
593
  /**
@@ -604,6 +610,8 @@ function measureContent() {
604
610
  * selector and the `--tester-transform`, `--tester-margin-left`, `--viewport-width`, and
605
611
  * `--viewport-height` custom properties are the runner's, so a Vitest release that renames any of
606
612
  * them reddens the size check that follows rather than writing a wrong frame.
613
+ * The custom-property overrides serve Vitest 4; `transform: none !important` on the pane and
614
+ * iframe also suppresses Vitest 5's direct CSS transform.
607
615
  *
608
616
  * Hand the pane straight back with {@link releasePane}. A tester pinned at a viewport taller than
609
617
  * the window puts its lower half beyond what a pointer can reach, so an ordinary press then fails
@@ -621,7 +629,8 @@ function measureContent() {
621
629
  * the shot replaces the node and takes any attribute of ours with it.
622
630
  *
623
631
  * The wait is two frames rather than a delay: the first carries the resize into layout and the
624
- * second is the paint a screenshot reads.
632
+ * second is the paint a screenshot reads. An already matching viewport needs no resize command;
633
+ * the staging rule, paint waits, and rendered-size check still run.
625
634
  *
626
635
  * The viewport the tester had before this staging is written onto that rule element as the
627
636
  * {@link CAPTURE_PANE} value, in `<width>x<height>` form, and {@link releasePane} hands it back.
@@ -635,7 +644,7 @@ function measureContent() {
635
644
  */
636
645
  async function stagePane(width, height) {
637
646
  const viewport = `${String(window.innerWidth)}x${String(window.innerHeight)}`;
638
- await page.viewport(width, height);
647
+ if (window.innerWidth !== width || window.innerHeight !== height) await page.viewport(width, height);
639
648
  const frame = window.frameElement;
640
649
  const pane = frame?.parentElement;
641
650
  const owner = pane?.ownerDocument;
@@ -646,9 +655,9 @@ async function stagePane(width, height) {
646
655
  rule.setAttribute(CAPTURE_PANE, viewport);
647
656
  rule.textContent = [
648
657
  `[${CAPTURE_PANE}],:has(>iframe[data-vitest])`,
649
- "{--tester-transform:none !important;--tester-margin-left:0px !important}",
658
+ "{--tester-transform:none !important;--tester-margin-left:0px !important;transform:none !important}",
650
659
  "iframe[data-vitest]",
651
- "{position:fixed !important;left:0 !important;top:0 !important;right:auto !important;",
660
+ "{transform:none !important;position:fixed !important;left:0 !important;top:0 !important;right:auto !important;",
652
661
  "bottom:auto !important;width:var(--viewport-width) !important;",
653
662
  "height:var(--viewport-height) !important;z-index:2147483647 !important}"
654
663
  ].join("");
@@ -674,7 +683,9 @@ async function stagePane(width, height) {
674
683
  * otherwise read the last capture's variant. The size comes off the {@link CAPTURE_PANE} value
675
684
  * {@link stagePane} wrote onto the rule element, which is the reading taken before the first
676
685
  * staging. Calling this on an unstaged pane finds no such value, so it changes nothing and resizes
677
- * nothing.
686
+ * nothing. A staged pane sends its saved size even when the tester already holds it, because the
687
+ * runner refits its frame scale only on a viewport request; a release that skipped it would leave
688
+ * the next case shooting through the staged scale.
678
689
  *
679
690
  * That hand-back is what makes {@link stagePane} and this pair a capture's staging rather than a
680
691
  * resize: the pair puts the tester back where it found it, so a suite that used it to reach a
@@ -868,12 +879,12 @@ async function stageMedia(options) {
868
879
  async function waitForStability(description, read, options) {
869
880
  const frames = options?.frames ?? 4;
870
881
  if (!Number.isInteger(frames) || frames < 1) throw new Error("Stability frames must be a positive integer");
871
- const readings = [read()];
882
+ const samples = [read()];
872
883
  await waitForCondition(description, async () => {
873
884
  await waitForFrame();
874
- readings.push(read());
875
- const tail = readings.slice(-(frames + 1));
876
- return tail.length > frames && tail.every((reading) => reading === tail[0]);
885
+ samples.push(read());
886
+ const tail = samples.slice(-(frames + 1));
887
+ return tail.length > frames && tail.every((sample) => sample === tail[0]);
877
888
  }, options);
878
889
  }
879
890
  /**
@@ -912,33 +923,33 @@ async function releaseMedia() {
912
923
  ];
913
924
  const staged = document.documentElement.getAttribute(MEDIA_STAGE);
914
925
  if (staged !== null) {
915
- const readings = staged.split("").map((value) => value === "1");
926
+ const matches = staged.split("").map((value) => value === "1");
916
927
  if (staged.length === 5) queries.push("(pointer: coarse)");
917
928
  await sendProtocol("Emulation.setEmulatedMedia", {
918
- media: readings[0] ? "print" : "screen",
929
+ media: matches[0] ? "print" : "screen",
919
930
  features: [
920
931
  {
921
932
  name: "prefers-reduced-motion",
922
- value: readings[1] ? "reduce" : "no-preference"
933
+ value: matches[1] ? "reduce" : "no-preference"
923
934
  },
924
935
  {
925
936
  name: "prefers-color-scheme",
926
- value: readings[2] ? "dark" : "light"
937
+ value: matches[2] ? "dark" : "light"
927
938
  },
928
939
  {
929
940
  name: "forced-colors",
930
- value: readings[3] ? "active" : "none"
941
+ value: matches[3] ? "active" : "none"
931
942
  }
932
943
  ]
933
944
  });
934
945
  if (staged.length === 5) await sendProtocol("Emulation.setTouchEmulationEnabled", {
935
- enabled: readings[4],
946
+ enabled: matches[4],
936
947
  maxTouchPoints: 1
937
948
  });
938
949
  try {
939
950
  await Promise.all(queries.map((query, index) => waitForCondition(query, async () => {
940
951
  await waitForFrame();
941
- return matchMedia(query).matches === readings[index];
952
+ return matchMedia(query).matches === matches[index];
942
953
  })));
943
954
  } catch (cause) {
944
955
  throw new Error("Media emulation did not clear from the tester", { cause });
@@ -962,14 +973,17 @@ async function releaseMedia() {
962
973
  * @param options - The path to write, the viewport to shoot at, and the element to shoot.
963
974
  * @returns The absolute path of the written frame, after it has been read back and matched.
964
975
  * @throws Thrown when the pane cannot be staged, when the document's height or an element frame's
965
- * element height never settles under {@link CAPTURE_STAGINGS} restagings, when the provider wrote
976
+ * element height never settles under {@link CAPTURE_STAGE_LIMIT} restagings, when the provider wrote
966
977
  * the frame somewhere else, and when the bytes on disk are not the ones this shot produced.
967
978
  *
968
979
  * @remarks
969
980
  * The path a screenshot call returns is the path it meant to write, so it is not evidence a file
970
- * exists. The file is read back through the runner's built-in `readFile` command and compared with
971
- * the shot itself, which is what separates a frame this run wrote from one an earlier run left
972
- * behind. The provider resolves `options.path` against the calling test file and returns an absolute
981
+ * exists. The {@link verifyFrame} helper compares the file with the shot itself. When the page
982
+ * registered a `readCapture` command, {@link readCaptureReader} returns it and the comparison uses
983
+ * SHA-256 digests computed in Node for the file and in the browser for the returned bytes. Otherwise
984
+ * the runner's built-in `readFile` command supplies the base64 comparison. A command failure
985
+ * propagates without falling back. The provider resolves `options.path`
986
+ * against the calling test file and returns an absolute
973
987
  * path, so the two are compared by the segments that survive resolving `.` and `..` lexically — the
974
988
  * refusal is what a provider resolving that path against a different base would trip.
975
989
  *
@@ -979,6 +993,8 @@ async function releaseMedia() {
979
993
  * than the document — a frame that reads as the surface down to the fold and as bare canvas after
980
994
  * it. The document is therefore laid out at the declared viewport first and, where it is taller
981
995
  * than that, the pane is staged again at the height the document needs, for the shot alone.
996
+ * Where the tester already has the declared viewport, the reading precedes the initial staging,
997
+ * so fixed content stages at its final height directly. Every staged height is still read again.
982
998
  *
983
999
  * That height is {@link measureContent}, never less than `options.height`, because the declared
984
1000
  * viewport is the smallest frame a variant asks for. The reading is the content's own edge rather
@@ -1001,7 +1017,7 @@ async function releaseMedia() {
1001
1017
  *
1002
1018
  * The re-reading stops when the pane and the edge agree, which is the pane the shot is taken at. A
1003
1019
  * rule that adds height with every pane never reaches that point, so the re-reading is bounded by
1004
- * {@link CAPTURE_STAGINGS} and the shot is refused with
1020
+ * {@link CAPTURE_STAGE_LIMIT} and the shot is refused with
1005
1021
  * `Capture frame at <path> never settled after <n> restagings: <h> over a <h> pane` rather than
1006
1022
  * written at a height that is already wrong.
1007
1023
  *
@@ -1054,124 +1070,12 @@ async function captureFrame(options) {
1054
1070
  left: window.scrollX,
1055
1071
  top: window.scrollY
1056
1072
  };
1073
+ const prepared = window.innerWidth === options.width && window.innerHeight === options.height;
1057
1074
  try {
1058
- await stagePane(options.width, options.height);
1059
- let pane = options.height;
1060
- let covered;
1061
- let growth = 0;
1062
- for (let staging = 0;; staging += 1) {
1063
- let height = element?.getBoundingClientRect().height;
1064
- if (element !== void 0 && height !== void 0 && height > options.height) {
1065
- element.scrollIntoView({
1066
- block: "start",
1067
- inline: "nearest",
1068
- behavior: "instant"
1069
- });
1070
- const aligned = element.getBoundingClientRect();
1071
- height = aligned.height + Math.max(0, aligned.top);
1072
- } else if (element !== void 0 && height !== void 0) {
1073
- const padding = readStyle(document.documentElement, "scroll-padding-top");
1074
- const margin = readStyle(element, "scroll-margin-top");
1075
- if (padding !== "auto" && padding !== "0px" || margin !== "0px") {
1076
- element.scrollIntoView({
1077
- block: "nearest",
1078
- inline: "nearest",
1079
- behavior: "instant"
1080
- });
1081
- if (element.getBoundingClientRect().bottom >= options.height) {
1082
- let placement = {
1083
- left: window.scrollX,
1084
- top: window.scrollY
1085
- };
1086
- element.scrollIntoView({
1087
- block: "start",
1088
- inline: "nearest",
1089
- behavior: "instant"
1090
- });
1091
- const aligned = element.getBoundingClientRect();
1092
- if (aligned.bottom > options.height) {
1093
- element.scrollIntoView({
1094
- block: "end",
1095
- inline: "nearest",
1096
- behavior: "instant"
1097
- });
1098
- const end = element.getBoundingClientRect();
1099
- const sticky = readStyle(element, "position") === "sticky" && readStyle(element, "top") !== "auto" && end.top >= 0 && end.bottom <= pane;
1100
- if (sticky) placement = {
1101
- left: window.scrollX,
1102
- top: window.scrollY
1103
- };
1104
- if (!sticky && (pane > options.height || end.top !== aligned.top)) {
1105
- height = aligned.height + Math.max(0, aligned.top);
1106
- element.scrollIntoView({
1107
- block: "start",
1108
- inline: "nearest",
1109
- behavior: "instant"
1110
- });
1111
- }
1112
- }
1113
- if (height <= options.height) window.scrollTo({
1114
- ...placement,
1115
- behavior: "instant"
1116
- });
1117
- }
1118
- }
1119
- }
1120
- const reading = Math.max(height === void 0 ? measureContent() : Math.ceil(height), options.height);
1121
- if (covered !== void 0) growth = Math.max(0, reading - covered);
1122
- covered = reading;
1123
- if (pane === covered) break;
1124
- if (staging === 4) throw new Error(`Capture frame at ${options.path} never settled after ${String(4)} restagings: ${String(covered)} over a ${String(pane)} pane`);
1125
- pane = covered + growth;
1126
- await stagePane(options.width, pane);
1127
- }
1128
- let shot;
1129
- if (element === void 0) shot = await page.screenshot({
1130
- path: options.path,
1131
- base64: true
1132
- });
1133
- else {
1134
- const box = element.getBoundingClientRect();
1135
- const down = box.top < 0 ? box.top : Math.max(0, box.bottom - window.innerHeight);
1136
- const across = box.left < 0 ? box.left : Math.max(0, box.right - window.innerWidth);
1137
- if (down !== 0 || across !== 0) window.scrollBy({
1138
- top: down,
1139
- left: across,
1140
- behavior: "instant"
1141
- });
1142
- const frame = window.frameElement;
1143
- const view = window.top;
1144
- const placed = element.getBoundingClientRect();
1145
- const move = view === null ? {
1146
- top: 0,
1147
- left: 0
1148
- } : computeOffset(placed, view.innerWidth, view.innerHeight);
1149
- const style = frame?.getAttribute("style") ?? null;
1150
- const offset = frame !== null && (move.top !== 0 || move.left !== 0);
1151
- try {
1152
- if (offset) {
1153
- frame.setAttribute("style", `${style ?? ""};top:${String(move.top)}px !important;left:${String(move.left)}px !important;will-change:transform`);
1154
- await waitForFrame();
1155
- await waitForFrame();
1156
- }
1157
- shot = await page.screenshot({
1158
- element,
1159
- path: options.path,
1160
- base64: true
1161
- });
1162
- } finally {
1163
- if (offset && style === null) frame.removeAttribute("style");
1164
- else if (offset && style !== null) frame.setAttribute("style", style);
1165
- }
1166
- }
1167
- const segments = [];
1168
- for (const segment of options.path.replaceAll("\\", "/").split("/")) {
1169
- if (segment === "" || segment === ".") continue;
1170
- if (segment === "..") segments.pop();
1171
- else segments.push(segment);
1172
- }
1173
- if (!shot.path.replaceAll("\\", "/").endsWith(segments.join("/"))) throw new Error(`Capture frame was written to ${shot.path} where ${options.path} was asked for`);
1174
- if (await commands.readFile(shot.path, "base64") !== shot.base64) throw new Error(`Capture frame at ${options.path} is not the one this run shot`);
1075
+ if (!prepared) await stagePane(options.width, options.height);
1076
+ await settleFrame(options, element, prepared);
1077
+ const shot = await takeFrameShot(options, element);
1078
+ await verifyFrame(shot, options.path, readCaptureReader());
1175
1079
  return shot.path;
1176
1080
  } finally {
1177
1081
  try {
@@ -1186,6 +1090,49 @@ async function captureFrame(options) {
1186
1090
  }
1187
1091
  }
1188
1092
  /**
1093
+ * Reads the optional disk-digest command the tester page registered.
1094
+ *
1095
+ * @returns The registered `readCapture` command, or undefined where none is registered.
1096
+ *
1097
+ * @remarks Vitest publishes only registered commands, so an unregistered `readCapture` reads as
1098
+ * undefined and a capture falls back to the base64 read-back. Outside a Vitest browser page, where
1099
+ * `commands` is no object, the command reads as undefined too, so importing this module never
1100
+ * throws there.
1101
+ * @example
1102
+ * ```ts
1103
+ * await verifyFrame(shot, '../../tmp/frame.png', readCaptureReader())
1104
+ * ```
1105
+ */
1106
+ function readCaptureReader() {
1107
+ if (typeof commands !== "object" || commands === null) return void 0;
1108
+ return readProperty(commands, "readCapture");
1109
+ }
1110
+ /**
1111
+ * Verifies a screenshot's destination and compares its returned bytes with the written file.
1112
+ *
1113
+ * @param shot - The provider's absolute path and base64 screenshot bytes.
1114
+ * @param path - The requested screenshot path, relative to the test file.
1115
+ * @param reader - The optional Node disk-digest command; omission uses Vitest's base64 read-back.
1116
+ * @throws Thrown when the destination differs, the bytes differ, or either reading fails.
1117
+ * @remarks Digest reads compare SHA-256 of the decoded shot with SHA-256 of the disk bytes.
1118
+ * Command failures propagate unchanged; they never select the base64 fallback.
1119
+ * @example
1120
+ * ```ts
1121
+ * await verifyFrame(shot, '../../tmp/frame.png', readCaptureReader())
1122
+ * ```
1123
+ */
1124
+ async function verifyFrame(shot, path, reader) {
1125
+ const segments = [];
1126
+ for (const segment of path.replaceAll("\\", "/").split("/")) {
1127
+ if (segment === "" || segment === ".") continue;
1128
+ if (segment === "..") segments.pop();
1129
+ else segments.push(segment);
1130
+ }
1131
+ if (!shot.path.replaceAll("\\", "/").endsWith(segments.join("/"))) throw new Error(`Capture frame was written to ${shot.path} where ${path} was asked for`);
1132
+ const expected = reader === void 0 ? shot.base64 : [...new Uint8Array(await crypto.subtle.digest("SHA-256", Uint8Array.from(atob(shot.base64), (character) => character.charCodeAt(0))))].map((byte) => byte.toString(16).padStart(2, "0")).join("");
1133
+ if ((reader === void 0 ? await commands.readFile(shot.path, "base64") : await reader(shot.path)) !== expected) throw new Error(`Capture frame at ${path} is not the one this run shot`);
1134
+ }
1135
+ /**
1189
1136
  * Decodes a base64 PNG and paints it, unscaled, onto a fresh offscreen 2D canvas.
1190
1137
  *
1191
1138
  * @param encoded - The image's bytes as base64 text, without a data-URL prefix.
@@ -1240,7 +1187,7 @@ async function paintImage(encoded) {
1240
1187
  *
1241
1188
  * @example
1242
1189
  * ```ts
1243
- * const reading = await readFrame(written)
1190
+ * const result = await readFrame(written)
1244
1191
  * ```
1245
1192
  */
1246
1193
  async function readFrame(path) {
@@ -1261,13 +1208,10 @@ async function readFrame(path) {
1261
1208
  const red = row[0];
1262
1209
  const green = row[1];
1263
1210
  const blue = row[2];
1264
- const alpha = row[3];
1265
- let single = red !== void 0 && green !== void 0 && blue !== void 0;
1266
- for (let pixel = 4; single && pixel < row.length; pixel += 4) single = row[pixel] === red && row[pixel + 1] === green && row[pixel + 2] === blue && row[pixel + 3] === alpha;
1267
1211
  return {
1268
1212
  width,
1269
1213
  height,
1270
- floor: single ? `rgb(${String(red)}, ${String(green)}, ${String(blue)})` : void 0
1214
+ floor: red !== void 0 && green !== void 0 && blue !== void 0 && row.subarray(4).every((channel, index) => channel === row[index % 4]) ? `rgb(${String(red)}, ${String(green)}, ${String(blue)})` : void 0
1271
1215
  };
1272
1216
  }
1273
1217
  /**
@@ -1337,8 +1281,155 @@ function expandCaptures(states, variants) {
1337
1281
  for (const state of states) for (const variant of variants) files.push(`${state}--${variant.name}.png`);
1338
1282
  return files;
1339
1283
  }
1340
- //#endregion
1341
- //#region src/browser/journeys/helpers.ts
1284
+ /**
1285
+ * Restages a capture until its content extent equals the pane height.
1286
+ *
1287
+ * @remarks The stage limit bounds the recursion; a prepared pane is staged before accepting it.
1288
+ * @example
1289
+ * ```ts
1290
+ * await settleFrame({ path: 'frame.png', width: 390, height: 844 }, undefined, false)
1291
+ * ```
1292
+ */
1293
+ async function settleFrame(options, element, prepared, pane = options.height, covered, stage = 0) {
1294
+ const height = readFrameHeight(options, element, pane);
1295
+ const measured = height === void 0 ? measureContent() : Math.ceil(height);
1296
+ const extent = Math.max(measured, options.height);
1297
+ const growth = covered === void 0 ? 0 : Math.max(0, extent - covered);
1298
+ if (pane === extent) {
1299
+ if (prepared && stage === 0) {
1300
+ await stagePane(options.width, pane);
1301
+ return settleFrame(options, element, prepared, pane, extent, stage + 1);
1302
+ }
1303
+ return;
1304
+ }
1305
+ if (stage === 4) throw new Error(`Capture frame at ${options.path} never settled after ${String(4)} restagings: ${String(extent)} over a ${String(pane)} pane`);
1306
+ const next = extent + growth;
1307
+ await stagePane(options.width, next);
1308
+ return settleFrame(options, element, prepared, next, extent, stage + 1);
1309
+ }
1310
+ /**
1311
+ * Reads a capture subject's height after applying its native scroll clearance.
1312
+ *
1313
+ * @example
1314
+ * ```ts
1315
+ * readFrameHeight({ path: 'frame.png', width: 390, height: 844 }, undefined, 844)
1316
+ * ```
1317
+ */
1318
+ function readFrameHeight(options, element, pane) {
1319
+ const height = element?.getBoundingClientRect().height;
1320
+ if (element === void 0 || height === void 0) return height;
1321
+ if (height > options.height) {
1322
+ element.scrollIntoView({
1323
+ block: "start",
1324
+ inline: "nearest",
1325
+ behavior: "instant"
1326
+ });
1327
+ const aligned = element.getBoundingClientRect();
1328
+ return aligned.height + Math.max(0, aligned.top);
1329
+ }
1330
+ const padding = readStyle(document.documentElement, "scroll-padding-top");
1331
+ const margin = readStyle(element, "scroll-margin-top");
1332
+ if ((padding === "auto" || padding === "0px") && margin === "0px") return height;
1333
+ element.scrollIntoView({
1334
+ block: "nearest",
1335
+ inline: "nearest",
1336
+ behavior: "instant"
1337
+ });
1338
+ if (!(element.getBoundingClientRect().bottom >= options.height)) return height;
1339
+ const placement = {
1340
+ left: window.scrollX,
1341
+ top: window.scrollY
1342
+ };
1343
+ element.scrollIntoView({
1344
+ block: "start",
1345
+ inline: "nearest",
1346
+ behavior: "instant"
1347
+ });
1348
+ const aligned = element.getBoundingClientRect();
1349
+ if (aligned.bottom > options.height) {
1350
+ element.scrollIntoView({
1351
+ block: "end",
1352
+ inline: "nearest",
1353
+ behavior: "instant"
1354
+ });
1355
+ const end = element.getBoundingClientRect();
1356
+ if (readStyle(element, "position") === "sticky" && readStyle(element, "top") !== "auto" && end.top >= 0 && end.bottom <= pane) {
1357
+ if (height <= options.height) window.scrollTo({
1358
+ left: window.scrollX,
1359
+ top: window.scrollY,
1360
+ behavior: "instant"
1361
+ });
1362
+ return height;
1363
+ }
1364
+ if (pane > options.height || end.top !== aligned.top) {
1365
+ const extended = aligned.height + Math.max(0, aligned.top);
1366
+ element.scrollIntoView({
1367
+ block: "start",
1368
+ inline: "nearest",
1369
+ behavior: "instant"
1370
+ });
1371
+ if (extended <= options.height) window.scrollTo({
1372
+ ...placement,
1373
+ behavior: "instant"
1374
+ });
1375
+ return extended;
1376
+ }
1377
+ }
1378
+ if (height <= options.height) window.scrollTo({
1379
+ ...placement,
1380
+ behavior: "instant"
1381
+ });
1382
+ return height;
1383
+ }
1384
+ /**
1385
+ * Takes a screenshot while temporarily positioning the runner frame around its subject.
1386
+ *
1387
+ * @example
1388
+ * ```ts
1389
+ * const shot = await takeFrameShot({ path: 'frame.png', width: 390, height: 844 }, undefined)
1390
+ * ```
1391
+ */
1392
+ async function takeFrameShot(options, element) {
1393
+ if (element === void 0) return await page.screenshot({
1394
+ path: options.path,
1395
+ base64: true
1396
+ });
1397
+ else {
1398
+ const box = element.getBoundingClientRect();
1399
+ const down = box.top < 0 ? box.top : Math.max(0, box.bottom - window.innerHeight);
1400
+ const across = box.left < 0 ? box.left : Math.max(0, box.right - window.innerWidth);
1401
+ if (down !== 0 || across !== 0) window.scrollBy({
1402
+ top: down,
1403
+ left: across,
1404
+ behavior: "instant"
1405
+ });
1406
+ const frame = window.frameElement;
1407
+ const view = window.top;
1408
+ const placed = element.getBoundingClientRect();
1409
+ const move = view === null ? {
1410
+ top: 0,
1411
+ left: 0
1412
+ } : computeOffset(placed, view.innerWidth, view.innerHeight);
1413
+ const style = frame?.getAttribute("style") ?? null;
1414
+ const offset = frame !== null && (move.top !== 0 || move.left !== 0);
1415
+ try {
1416
+ if (offset) {
1417
+ frame.setAttribute("style", `${style ?? ""};top:${String(move.top)}px !important;left:${String(move.left)}px !important;will-change:transform`);
1418
+ await waitForFrame();
1419
+ await waitForFrame();
1420
+ }
1421
+ return await page.screenshot({
1422
+ element,
1423
+ path: options.path,
1424
+ base64: true
1425
+ });
1426
+ } finally {
1427
+ if (offset && style === null) frame.removeAttribute("style");
1428
+ else if (offset && style !== null) frame.setAttribute("style", style);
1429
+ }
1430
+ }
1431
+ }
1432
+ // src/browser/journeys/helpers.ts
1342
1433
  /**
1343
1434
  * Sends one emulated touch event through the browser protocol.
1344
1435
  *
@@ -1565,12 +1656,7 @@ function isOutsideViewport(rectangle) {
1565
1656
  */
1566
1657
  function isReachable(element) {
1567
1658
  if (!(element instanceof HTMLElement) && !(element instanceof SVGElement)) return false;
1568
- const chain = [element];
1569
- let root = element.getRootNode();
1570
- while (root instanceof ShadowRoot) {
1571
- chain.push(root.host);
1572
- root = root.host.getRootNode();
1573
- }
1659
+ const chain = collectShadowHosts(element);
1574
1660
  const rectangle = element.getBoundingClientRect();
1575
1661
  return element.isConnected && element.checkVisibility({
1576
1662
  checkOpacity: true,
@@ -1578,6 +1664,21 @@ function isReachable(element) {
1578
1664
  }) && rectangle.width > 0 && rectangle.height > 0 && element.tabIndex >= 0 && !element.matches(":disabled, [aria-disabled=\"true\"]") && element.closest("[inert]") === null && [...element.ownerDocument.querySelectorAll("[aria-modal=\"true\"]")].every((dialog) => !isRendered(dialog) || chain.some((node) => dialog.contains(node)));
1579
1665
  }
1580
1666
  /**
1667
+ * Collects an element and the successive hosts of its containing shadow roots.
1668
+ *
1669
+ * @param element - The element that opens the collected chain.
1670
+ * @param root - The root already read by an outer traversal step, or the element's current root.
1671
+ * @example
1672
+ * ```ts
1673
+ * collectShadowHosts(document.body) // [document.body]
1674
+ * ```
1675
+ */
1676
+ function collectShadowHosts(element, root = element.getRootNode()) {
1677
+ if (!(root instanceof ShadowRoot)) return [element];
1678
+ const host = root.host;
1679
+ return [element, ...collectShadowHosts(host, root.host.getRootNode())];
1680
+ }
1681
+ /**
1581
1682
  * Determines whether the accessibility tree presents one element at all.
1582
1683
  *
1583
1684
  * @param element - The element to judge.
@@ -1761,15 +1862,13 @@ function resolveRendered(first, second) {
1761
1862
  }
1762
1863
  function resolveAccessible(first, second) {
1763
1864
  const target = resolveRendered(first, second);
1764
- let rectangle = target.getBoundingClientRect();
1765
- if (isOutsideViewport(rectangle)) {
1865
+ if (isOutsideViewport(target.getBoundingClientRect())) {
1766
1866
  target.scrollIntoView({
1767
1867
  block: "nearest",
1768
1868
  behavior: "instant"
1769
1869
  });
1770
- rectangle = target.getBoundingClientRect();
1870
+ if (isOutsideViewport(target.getBoundingClientRect())) throw new Error(`Interactive target "${second ?? first}" is unreachable after scrolling`);
1771
1871
  }
1772
- if (isOutsideViewport(rectangle)) throw new Error(`Interactive target "${second ?? first}" is unreachable after scrolling`);
1773
1872
  return target;
1774
1873
  }
1775
1874
  async function clickAccessible(first, second) {
@@ -1813,7 +1912,7 @@ function resolveFileInput(name) {
1813
1912
  * ```
1814
1913
  */
1815
1914
  async function chooseAccessible(name, files, options) {
1816
- if (options?.keyboard) await driveTraversal(() => resolveFileInput(name), name);
1915
+ if (options?.keyboard) await driveTraversal(() => resolveFileInput(name), name, (focused) => focused instanceof HTMLInputElement && focused.type === "file");
1817
1916
  const target = resolveFileInput(name);
1818
1917
  const command = readProperty(commands, "chooseFiles");
1819
1918
  if (typeof command !== "function") throw new Error("Register the chooseFiles browser command before choosing files");
@@ -1855,10 +1954,10 @@ async function clickAccessibleWithin(region, role, name) {
1855
1954
  * @throws When the named control is absent, unreachable, or ambiguous inside the region.
1856
1955
  *
1857
1956
  * @remarks
1858
- * The region's name is matched exactly and the control's name loosely, over a computed name that
1859
- * includes hidden subtrees, so a glyph joins the text rather than displacing it. One pass answers
1860
- * this: a control the region cannot reach is refused whether it is absent or hidden. This is the
1861
- * resolver the region-scoped verbs share.
1957
+ * The region's name is matched exactly. The control first matches the case-sensitive pattern
1958
+ * from `computeNamePattern`, with hidden subtrees included. Any exact candidates own the result,
1959
+ * including unreachable or ambiguous candidates. Only an empty exact tier selects the loose query.
1960
+ * Both tiers refuse zero reachable candidates and several reachable candidates.
1862
1961
  *
1863
1962
  * @example
1864
1963
  * ```ts
@@ -1866,14 +1965,20 @@ async function clickAccessibleWithin(region, role, name) {
1866
1965
  * ```
1867
1966
  */
1868
1967
  function resolveAccessibleWithin(region, role, name) {
1869
- const reachable = page.getByRole("region", {
1968
+ const scope = page.getByRole("region", {
1870
1969
  name: region,
1871
1970
  exact: true
1872
- }).getByRole(role, {
1971
+ });
1972
+ const exact = scope.getByRole(role, {
1973
+ name: computeNamePattern(name),
1974
+ exact: true,
1975
+ includeHidden: true
1976
+ }).elements();
1977
+ const reachable = (exact.length > 0 ? exact : scope.getByRole(role, {
1873
1978
  name,
1874
1979
  exact: false,
1875
1980
  includeHidden: true
1876
- }).elements().filter((element) => element instanceof HTMLElement && isReachable(element));
1981
+ }).elements()).filter((element) => element instanceof HTMLElement && isReachable(element));
1877
1982
  if (reachable.length === 0) throw new Error(`Interactive target "${name}" is not reachable inside "${region}"`);
1878
1983
  if (reachable.length > 1) throw new Error(`Interactive target "${name}" is ambiguous across ${reachable.length} elements inside "${region}"`);
1879
1984
  const [target] = reachable;
@@ -2053,24 +2158,18 @@ async function parkPointer() {
2053
2158
  */
2054
2159
  async function releasePointer() {
2055
2160
  const held = document.documentElement.getAttribute(POINTER_HOLD);
2056
- let released = held === null;
2057
- let rejection;
2058
- try {
2059
- if (held !== null) {
2060
- const [x, y] = held.split("x").map(Number);
2061
- await sendProtocol("Input.dispatchMouseEvent", {
2062
- type: "mouseReleased",
2063
- x,
2064
- y,
2065
- button: "left",
2066
- buttons: 0,
2067
- clickCount: 1
2068
- });
2069
- released = true;
2070
- }
2071
- } catch (cause) {
2072
- rejection = cause;
2073
- }
2161
+ const [x, y] = held === null ? [] : held.split("x").map(Number);
2162
+ const request = {
2163
+ type: "mouseReleased",
2164
+ x,
2165
+ y,
2166
+ button: "left",
2167
+ buttons: 0,
2168
+ clickCount: 1
2169
+ };
2170
+ const release = held === null ? void 0 : await captureProduction(() => sendProtocol("Input.dispatchMouseEvent", request));
2171
+ const released = release === void 0 || release.status === "fulfilled";
2172
+ const rejection = release?.status === "rejected" ? release.reason : void 0;
2074
2173
  if (released) document.documentElement.removeAttribute(POINTER_HOLD);
2075
2174
  try {
2076
2175
  await parkPointer();
@@ -2303,7 +2402,8 @@ async function pressKeys(keys) {
2303
2402
  * @throws When one complete traversal cannot reach the target.
2304
2403
  *
2305
2404
  * @remarks
2306
- * The loop is {@link driveTraversal} over {@link resolveRendered}. Consecutive landings inside a
2405
+ * The loop is {@link driveTraversal} over {@link resolveRendered}, with a conservative name check
2406
+ * before each arrival resolution. Consecutive landings inside a
2307
2407
  * native segmented input continue through its segments up to {@link FOCUS_SEGMENT_LIMIT} landings.
2308
2408
  * A longer run or any other revisit ends the traversal.
2309
2409
  *
@@ -2327,7 +2427,8 @@ async function traverseAccessible(name) {
2327
2427
  *
2328
2428
  * @remarks
2329
2429
  * The resolution is {@link resolveAccessibleWithin} and the loop is {@link driveTraversal}, so a
2330
- * twin of the same name earlier in the tab order is passed over rather than reached.
2430
+ * twin of the same name earlier in the tab order is passed over rather than reached. Candidates
2431
+ * retain the resolver's loose name match and must belong to a freshly resolved named region.
2331
2432
  *
2332
2433
  * @example
2333
2434
  * ```ts
@@ -2335,7 +2436,10 @@ async function traverseAccessible(name) {
2335
2436
  * ```
2336
2437
  */
2337
2438
  async function traverseAccessibleWithin(region, role, name) {
2338
- return driveTraversal(() => resolveAccessibleWithin(region, role, name), name);
2439
+ return driveTraversal(() => resolveAccessibleWithin(region, role, name), name, (focused) => matchesTraversalName(focused, name, false) && page.getByRole("region", {
2440
+ name: region,
2441
+ exact: true
2442
+ }).elements().some((container) => containsNode(container, focused)));
2339
2443
  }
2340
2444
  /**
2341
2445
  * Reads the HTML element that holds focus, following it into open shadow roots and same-origin
@@ -2477,12 +2581,50 @@ function supportsSegmentedFocus(element) {
2477
2581
  return realm !== null && element instanceof realm.HTMLInputElement && SEGMENTED_INPUT_TYPES.includes(element.type);
2478
2582
  }
2479
2583
  /**
2584
+ * Checks whether a landing can carry a requested accessible name without resolving the document.
2585
+ *
2586
+ * @param element - The element focus landed on.
2587
+ * @param name - The name the resolver matches.
2588
+ * @param exact - If `true`, compares exact names; if `false`, compares case-insensitive substrings.
2589
+ * Default: `true`.
2590
+ * @returns True if the name matches or its computation requires the resolver; false otherwise.
2591
+ *
2592
+ * @remarks
2593
+ * This is a conservative candidate check, not an accessible-name implementation. It compares a
2594
+ * nonempty `aria-label` without `aria-labelledby`, or the text of a plain native button or link.
2595
+ * Referenced labels, associated labels, descendants, shadow content, owned content, explicit roles,
2596
+ * generated content, and other naming rules fall through to the resolver. Empty requested names
2597
+ * also fall through because a role can prohibit naming. Whitespace, zero-width spaces, and soft
2598
+ * hyphens are normalized as in the provider's role query. Never use this check to accept a target.
2599
+ *
2600
+ * @example
2601
+ * ```ts
2602
+ * matchesTraversalName(document.createElement('input'), 'Attachments') // true
2603
+ * ```
2604
+ */
2605
+ function matchesTraversalName(element, name, exact = true) {
2606
+ const wanted = name.replaceAll(/[\u200b\u00ad]/g, "").trim().replaceAll(/\s+/g, " ");
2607
+ if (wanted.length === 0 || element.hasAttribute("aria-labelledby")) return true;
2608
+ const label = element.getAttribute("aria-label") ?? "";
2609
+ const realm = element.ownerDocument.defaultView;
2610
+ if (label.trim().length === 0) {
2611
+ if (realm === null || !(element instanceof realm.HTMLButtonElement || element instanceof realm.HTMLAnchorElement) || element.hasAttribute("role") || element.hasAttribute("aria-owns") || element.childElementCount > 0 || element.shadowRoot !== null || element instanceof realm.HTMLButtonElement && (element.labels?.length ?? 0) > 0 || element instanceof realm.HTMLAnchorElement && !element.hasAttribute("href")) return true;
2612
+ if (![realm.getComputedStyle(element, "::before"), realm.getComputedStyle(element, "::after")].every((style) => style.content === "none" || style.content === "normal")) return true;
2613
+ if ((element.textContent ?? "").trim().length === 0) return true;
2614
+ }
2615
+ const actual = (label.trim().length > 0 ? label : element.textContent ?? "").replaceAll(/[\u200b\u00ad]/g, "").trim().replaceAll(/\s+/g, " ");
2616
+ return exact ? actual === wanted : actual.toUpperCase().includes(wanted.toUpperCase());
2617
+ }
2618
+ /**
2480
2619
  * Reaches the control a resolver returns, only through natural forward Tab traversal from the
2481
2620
  * current focus.
2482
2621
  *
2483
- * @param resolve - The resolver that returns the target, called before the first step and again on
2484
- * every step, because a framework may replace the node between resolution and focus arrival.
2622
+ * @param resolve - The resolver called before traversal and at candidate arrivals, without retaining
2623
+ * its result between steps.
2485
2624
  * @param name - The target's name, as the refusal voices it.
2625
+ * @param candidate - The landing check; it must admit every element the resolver could return.
2626
+ * Default: the conservative exact-name check from {@link matchesTraversalName}. Supply a check
2627
+ * matching the resolver's semantics when it uses a label, region, or loose name.
2486
2628
  * @returns The target after the browser moves focus to it.
2487
2629
  * @throws When the resolver refuses, or one complete traversal cannot reach the target.
2488
2630
  *
@@ -2499,26 +2641,28 @@ function supportsSegmentedFocus(element) {
2499
2641
  * await driveTraversal(() => resolveRendered('Evaluate'), 'Evaluate')
2500
2642
  * ```
2501
2643
  */
2502
- async function driveTraversal(resolve, name) {
2644
+ async function driveTraversal(resolve, name, candidate) {
2503
2645
  resolve();
2504
2646
  const cap = document.querySelectorAll(FOCUSABLE_SELECTOR).length * 10 + 10;
2505
2647
  const visited = /* @__PURE__ */ new Set();
2506
- const landings = [];
2648
+ const stops = [];
2507
2649
  for await (const focused of stepFocus(cap)) {
2508
- const previous = landings.at(-1);
2509
- landings.push(focused);
2650
+ const previous = stops.at(-1);
2651
+ stops.push(focused);
2510
2652
  if (focused === void 0) continue;
2511
2653
  try {
2512
- const current = resolve();
2513
- if (focused === current) return current;
2654
+ if (candidate === void 0 ? matchesTraversalName(focused, name) : candidate(focused)) {
2655
+ const current = resolve();
2656
+ if (focused === current) return current;
2657
+ }
2514
2658
  } catch {
2515
2659
  continue;
2516
2660
  }
2517
- if (focused === previous && supportsSegmentedFocus(focused) && landings.length - landings.findLastIndex((landing) => landing !== focused) - 1 <= 10) continue;
2661
+ if (focused === previous && supportsSegmentedFocus(focused) && stops.length - stops.findLastIndex((entry) => entry !== focused) - 1 <= 10) continue;
2518
2662
  if (visited.has(focused)) break;
2519
2663
  visited.add(focused);
2520
2664
  }
2521
- const trail = [...new Set(landings)].filter((focused) => focused !== void 0).filter((focused) => visited.has(focused)).map((focused) => `${focused.tagName}:${focused.innerText.slice(0, 20)}`);
2665
+ const trail = [...new Set(stops)].filter((focused) => focused !== void 0).filter((focused) => visited.has(focused)).map((focused) => `${focused.tagName}:${focused.innerText.slice(0, 20)}`);
2522
2666
  throw new Error(`Interactive target "${name}" is not reachable through forward Tab traversal: ${trail.join(" > ")}`);
2523
2667
  }
2524
2668
  /**
@@ -2558,13 +2702,13 @@ async function walkFocus(stop) {
2558
2702
  const first = readActiveElement();
2559
2703
  if (first === void 0) return [];
2560
2704
  const reached = [first];
2561
- const landings = [first];
2705
+ const stops = [first];
2562
2706
  if (stop?.(first) === true) return reached;
2563
2707
  for await (const focused of stepFocus(countElements() * 10)) {
2564
2708
  if (focused === void 0) return reached;
2565
- const previous = landings.at(-1);
2566
- landings.push(focused);
2567
- if (focused === previous && supportsSegmentedFocus(focused) && landings.length - landings.findLastIndex((landing) => landing !== focused) - 1 <= 10) continue;
2709
+ const previous = stops.at(-1);
2710
+ stops.push(focused);
2711
+ if (focused === previous && supportsSegmentedFocus(focused) && stops.length - stops.findLastIndex((entry) => entry !== focused) - 1 <= 10) continue;
2568
2712
  if (reached.includes(focused)) return reached;
2569
2713
  reached.push(focused);
2570
2714
  if (stop?.(focused) === true) return reached;
@@ -2742,7 +2886,9 @@ function readRefusal(first, second) {
2742
2886
  function readText(element) {
2743
2887
  const parts = [];
2744
2888
  const walker = element.ownerDocument.createTreeWalker(element, NodeFilter.SHOW_TEXT);
2745
- for (let node = walker.nextNode(); node !== null; node = walker.nextNode()) {
2889
+ while (true) {
2890
+ const node = walker.nextNode();
2891
+ if (node === null) break;
2746
2892
  const owner = node.parentElement;
2747
2893
  if (owner === null || owner.closest("[aria-hidden=\"true\"]") !== null) continue;
2748
2894
  parts.push(node.textContent ?? "");
@@ -2909,14 +3055,14 @@ function describeTree(element) {
2909
3055
  if (entry === void 0) break;
2910
3056
  if (!isRendered(entry.node)) continue;
2911
3057
  const role = readRole(entry.node);
2912
- let depth = entry.depth;
2913
3058
  if (role !== void 0) {
2914
3059
  const name = readName(entry.node);
2915
3060
  const states = readStates(entry.node);
2916
- lines.push(`${" ".repeat(depth)}${role}${name.length > 0 ? ` "${name}"` : ""}${states.length > 0 ? ` [${states.join(", ")}]` : ""}`);
2917
- depth += 1;
3061
+ lines.push(`${" ".repeat(entry.depth)}${role}${name.length > 0 ? ` "${name}"` : ""}${states.length > 0 ? ` [${states.join(", ")}]` : ""}`);
2918
3062
  }
2919
- for (let index = entry.node.children.length - 1; index >= 0; index -= 1) {
3063
+ const depth = entry.depth + (role === void 0 ? 0 : 1);
3064
+ const length = entry.node.children.length;
3065
+ for (const index of Array.from({ length }, (_, offset) => length - offset - 1)) {
2920
3066
  const child = entry.node.children[index];
2921
3067
  if (child !== void 0) pending.push({
2922
3068
  node: child,
@@ -2968,24 +3114,22 @@ async function waitForState(first, second, third, fourth) {
2968
3114
  const options = keyed ? fourth : third;
2969
3115
  const absent = options?.absent ?? false;
2970
3116
  const description = `"${name}" to ${absent ? "stop announcing" : "announce"} "${state}"`;
2971
- let observed = [];
2972
- let readings = 0;
2973
- let refused;
2974
- try {
3117
+ const observations = [];
3118
+ const waited = await captureProduction(async () => {
2975
3119
  await waitForCondition(description, () => {
2976
- readings += 1;
2977
- try {
2978
- observed = readStates(role === void 0 ? resolveRendered(name) : resolveRendered(role, name));
2979
- } catch (thrown) {
2980
- refused = { thrown };
2981
- throw thrown;
2982
- }
2983
- return observed.includes(state) !== absent;
3120
+ const observation = attempt(() => readStates(role === void 0 ? resolveRendered(name) : resolveRendered(role, name)));
3121
+ observations.push(observation);
3122
+ if (!observation.success) throw observation.error;
3123
+ return observation.value.includes(state) !== absent;
2984
3124
  }, options);
2985
- } catch (cause) {
2986
- if (refused !== void 0 && cause === refused.thrown) throw cause;
3125
+ });
3126
+ const observed = observations.reduce((states, observation) => observation.success ? observation.value : states, []);
3127
+ const refused = observations.find((observation) => !observation.success);
3128
+ if (waited.status === "rejected") {
3129
+ const cause = waited.reason;
3130
+ if (refused?.success === false && cause === refused.error) throw cause;
2987
3131
  if (cause === options?.signal?.reason) throw cause;
2988
- if (readings === 0) throw cause;
3132
+ if (observations.length === 0) throw cause;
2989
3133
  if (!isError(cause)) throw cause;
2990
3134
  throw new Error(`${cause.message} (last states: ${JSON.stringify(observed)})`, { cause });
2991
3135
  }
@@ -3035,22 +3179,20 @@ async function waitForAnimations(element, options) {
3035
3179
  const label = readName(element);
3036
3180
  const subject = `${readRole(element) ?? element.localName}${label.length > 0 ? ` "${label}"` : ""}`;
3037
3181
  const start = performance.now();
3038
- let expired = false;
3039
- let aborted;
3040
- let timer;
3041
- const expiry = new Promise((resolve) => {
3042
- timer = setTimeout(() => {
3043
- expired = true;
3044
- resolve();
3045
- }, budget);
3046
- });
3182
+ const deadline = new AbortController();
3183
+ const aborts = /* @__PURE__ */ new Map();
3184
+ const expiry = Promise.withResolvers();
3185
+ const timer = setTimeout(() => {
3186
+ deadline.abort();
3187
+ expiry.resolve();
3188
+ }, budget);
3047
3189
  try {
3048
3190
  while (true) {
3049
3191
  signal?.throwIfAborted();
3050
3192
  const running = readAnimations(element).finite;
3051
3193
  if (running.length === 0) return;
3052
3194
  const elapsed = performance.now() - start;
3053
- if (expired || elapsed >= budget) {
3195
+ if (deadline.signal.aborted || elapsed >= budget) {
3054
3196
  const names = running.map((animation) => {
3055
3197
  if (animation instanceof CSSAnimation) return animation.animationName;
3056
3198
  if (animation instanceof CSSTransition) return animation.transitionProperty;
@@ -3059,15 +3201,16 @@ async function waitForAnimations(element, options) {
3059
3201
  throw new Error(`Animation "${subject}" did not settle within ${budget}ms (waited ${elapsed}ms): ${names.join(", ")}`);
3060
3202
  }
3061
3203
  const pending = running.map((animation) => animation.finished.catch(() => void 0));
3062
- pending.push(expiry);
3204
+ pending.push(expiry.promise);
3063
3205
  if (signal !== void 0) {
3064
- aborted ??= waitForAbort(signal);
3206
+ const aborted = aborts.get(signal) ?? waitForAbort(signal);
3207
+ if (!aborts.has(signal)) aborts.set(signal, aborted);
3065
3208
  pending.push(aborted);
3066
3209
  }
3067
3210
  await Promise.race(pending);
3068
3211
  }
3069
3212
  } finally {
3070
- if (timer !== void 0) clearTimeout(timer);
3213
+ clearTimeout(timer);
3071
3214
  }
3072
3215
  }
3073
3216
  /**
@@ -3355,8 +3498,110 @@ function readRows(root, selector) {
3355
3498
  function buildDenial(operation, key) {
3356
3499
  return new DOMException(`Access is denied for ${operation}${key === void 0 ? "" : ` "${key}"`}`, "SecurityError");
3357
3500
  }
3358
- //#endregion
3359
- //#region src/browser/journeys/factories.ts
3501
+ // src/browser/journeys/Journal.ts
3502
+ /** Owns the state and console subscriptions behind a journal projection. */
3503
+ var Journal = class {
3504
+ #steps = [];
3505
+ #output = [];
3506
+ #intercepted;
3507
+ #listeners;
3508
+ get steps() {
3509
+ return [...this.#steps];
3510
+ }
3511
+ get output() {
3512
+ return [...this.#output];
3513
+ }
3514
+ start() {
3515
+ this.#steps.length = 0;
3516
+ this.#output.length = 0;
3517
+ if (this.#intercepted !== void 0) return;
3518
+ const forwarded = {
3519
+ debug: console.debug,
3520
+ error: console.error,
3521
+ info: console.info,
3522
+ log: console.log,
3523
+ warn: console.warn
3524
+ };
3525
+ this.#intercepted = forwarded;
3526
+ for (const channel of [
3527
+ "debug",
3528
+ "error",
3529
+ "info",
3530
+ "log",
3531
+ "warn"
3532
+ ]) console[channel] = createChannel(channel, this.#output, forwarded[channel]);
3533
+ const dropped = new AbortController();
3534
+ this.#listeners = dropped;
3535
+ window.addEventListener("error", (event) => {
3536
+ this.#output.push(`error: ${event.message}`);
3537
+ }, { signal: dropped.signal });
3538
+ window.addEventListener("unhandledrejection", (event) => {
3539
+ this.#output.push(`rejection: ${String(event.reason)}`);
3540
+ }, { signal: dropped.signal });
3541
+ }
3542
+ stop() {
3543
+ if (this.#intercepted === void 0) return;
3544
+ Object.assign(console, this.#intercepted);
3545
+ this.#intercepted = void 0;
3546
+ this.#listeners?.abort();
3547
+ this.#listeners = void 0;
3548
+ }
3549
+ record(action, trigger, result) {
3550
+ if (this.#intercepted === void 0) return;
3551
+ this.#steps.push(Object.freeze({
3552
+ action,
3553
+ trigger,
3554
+ result
3555
+ }));
3556
+ }
3557
+ };
3558
+ // src/browser/journeys/WebStorage.ts
3559
+ /** Owns permissions, values, and quota behind a Web Storage projection. */
3560
+ var WebStorage = class {
3561
+ #values;
3562
+ #reads;
3563
+ #writes;
3564
+ #room;
3565
+ constructor(options, quota) {
3566
+ this.#values = new Map(Object.entries(options?.values ?? {}));
3567
+ this.#reads = options?.reads ?? true;
3568
+ this.#writes = options?.writes ?? true;
3569
+ this.#room = quota;
3570
+ }
3571
+ get length() {
3572
+ if (!this.#reads) throw buildDenial("length");
3573
+ return this.#values.size;
3574
+ }
3575
+ permit() {
3576
+ this.#reads = true;
3577
+ this.#writes = true;
3578
+ }
3579
+ clear() {
3580
+ if (!this.#writes) throw buildDenial("clear");
3581
+ this.#values.clear();
3582
+ }
3583
+ getItem(key) {
3584
+ if (!this.#reads) throw buildDenial("getItem", key);
3585
+ return this.#values.get(key) ?? null;
3586
+ }
3587
+ key(index) {
3588
+ if (!this.#reads) throw buildDenial("key");
3589
+ return [...this.#values.keys()][index] ?? null;
3590
+ }
3591
+ removeItem(key) {
3592
+ if (!this.#writes) throw buildDenial("removeItem", key);
3593
+ this.#values.delete(key);
3594
+ }
3595
+ setItem(key, value) {
3596
+ if (!this.#writes) throw buildDenial("setItem", key);
3597
+ if (this.#room !== void 0) {
3598
+ if (this.#room === 0) throw new DOMException(`No room is left for ${key}`, "QuotaExceededError");
3599
+ this.#room -= 1;
3600
+ }
3601
+ this.#values.set(key, value);
3602
+ }
3603
+ };
3604
+ // src/browser/journeys/factories.ts
3360
3605
  /**
3361
3606
  * Creates one console channel that records every call it receives and hands that call on unchanged.
3362
3607
  *
@@ -3412,60 +3657,17 @@ function createChannel(name, output, forward) {
3412
3657
  * ```
3413
3658
  */
3414
3659
  function createJournal() {
3415
- const steps = [];
3416
- const output = [];
3417
- let intercepted;
3418
- let listeners;
3660
+ const journal = new Journal();
3419
3661
  return {
3420
3662
  get steps() {
3421
- return [...steps];
3663
+ return journal.steps;
3422
3664
  },
3423
3665
  get output() {
3424
- return [...output];
3425
- },
3426
- start() {
3427
- steps.length = 0;
3428
- output.length = 0;
3429
- if (intercepted !== void 0) return;
3430
- const forwarded = {
3431
- debug: console.debug,
3432
- error: console.error,
3433
- info: console.info,
3434
- log: console.log,
3435
- warn: console.warn
3436
- };
3437
- intercepted = forwarded;
3438
- for (const channel of [
3439
- "debug",
3440
- "error",
3441
- "info",
3442
- "log",
3443
- "warn"
3444
- ]) console[channel] = createChannel(channel, output, forwarded[channel]);
3445
- const dropped = new AbortController();
3446
- listeners = dropped;
3447
- window.addEventListener("error", (event) => {
3448
- output.push(`error: ${event.message}`);
3449
- }, { signal: dropped.signal });
3450
- window.addEventListener("unhandledrejection", (event) => {
3451
- output.push(`rejection: ${String(event.reason)}`);
3452
- }, { signal: dropped.signal });
3666
+ return journal.output;
3453
3667
  },
3454
- stop() {
3455
- if (intercepted === void 0) return;
3456
- Object.assign(console, intercepted);
3457
- intercepted = void 0;
3458
- listeners?.abort();
3459
- listeners = void 0;
3460
- },
3461
- record(action, trigger, result) {
3462
- if (intercepted === void 0) return;
3463
- steps.push(Object.freeze({
3464
- action,
3465
- trigger,
3466
- result
3467
- }));
3468
- }
3668
+ start: journal.start.bind(journal),
3669
+ stop: journal.stop.bind(journal),
3670
+ record: journal.record.bind(journal)
3469
3671
  };
3470
3672
  }
3471
3673
  /**
@@ -3513,43 +3715,17 @@ function createJournal() {
3513
3715
  function createStorage(options) {
3514
3716
  const quota = options?.quota;
3515
3717
  if (quota !== void 0 && (!Number.isSafeInteger(quota) || quota < 0)) throw new Error("Storage quota must be a non-negative integer");
3516
- const values = new Map(Object.entries(options?.values ?? {}));
3517
- let reads = options?.reads ?? true;
3518
- let writes = options?.writes ?? true;
3519
- let room = quota;
3718
+ const storage = new WebStorage(options, quota);
3520
3719
  return {
3521
3720
  get length() {
3522
- if (!reads) throw buildDenial("length");
3523
- return values.size;
3524
- },
3525
- permit() {
3526
- reads = true;
3527
- writes = true;
3528
- },
3529
- clear() {
3530
- if (!writes) throw buildDenial("clear");
3531
- values.clear();
3532
- },
3533
- getItem(key) {
3534
- if (!reads) throw buildDenial("getItem", key);
3535
- return values.get(key) ?? null;
3721
+ return storage.length;
3536
3722
  },
3537
- key(index) {
3538
- if (!reads) throw buildDenial("key");
3539
- return [...values.keys()][index] ?? null;
3540
- },
3541
- removeItem(key) {
3542
- if (!writes) throw buildDenial("removeItem", key);
3543
- values.delete(key);
3544
- },
3545
- setItem(key, value) {
3546
- if (!writes) throw buildDenial("setItem", key);
3547
- if (room !== void 0) {
3548
- if (room === 0) throw new DOMException(`No room is left for ${key}`, "QuotaExceededError");
3549
- room -= 1;
3550
- }
3551
- values.set(key, value);
3552
- }
3723
+ permit: storage.permit.bind(storage),
3724
+ clear: storage.clear.bind(storage),
3725
+ getItem: storage.getItem.bind(storage),
3726
+ key: storage.key.bind(storage),
3727
+ removeItem: storage.removeItem.bind(storage),
3728
+ setItem: storage.setItem.bind(storage)
3553
3729
  };
3554
3730
  }
3555
3731
  /**
@@ -3652,34 +3828,25 @@ function createHarness(options) {
3652
3828
  for (const row of table) row.element.removeAttribute(STATECHART_ATTRIBUTES.result);
3653
3829
  state.removeAttribute(STATECHART_ATTRIBUTES.state);
3654
3830
  state.textContent = "";
3655
- let passed = 0;
3656
- let failed = 0;
3831
+ const outcomes = [];
3657
3832
  root.setAttribute(STATECHART_ATTRIBUTES.passed, "0");
3658
3833
  root.setAttribute(STATECHART_ATTRIBUTES.failed, "0");
3659
3834
  root.setAttribute(STATECHART_ATTRIBUTES.status, "running");
3660
3835
  announcer.textContent = `Statechart harness is running, 0 passed and 0 failed of ${table.length}.`;
3661
3836
  try {
3662
3837
  for (const [index, row] of table.entries()) {
3663
- let built;
3664
- let refusal;
3665
- try {
3666
- built = { context: await options.build(row.scenario) };
3667
- } catch (cause) {
3668
- refusal = buildRefusal(row.scenario.transition.name, cause).message;
3669
- }
3670
- if (built !== void 0) {
3671
- try {
3672
- await executeScenario(row.scenario, built.context);
3673
- } catch (cause) {
3674
- if (!isError(cause)) throw cause;
3675
- refusal = cause.message;
3676
- }
3677
- const current = options.state(built.context);
3838
+ const built = await captureProduction(() => options.build(row.scenario));
3839
+ const executed = built.status === "fulfilled" ? await captureProduction(() => executeScenario(row.scenario, built.value)) : void 0;
3840
+ if (executed?.status === "rejected" && !isError(executed.reason)) throw executed.reason;
3841
+ const refusal = built.status === "rejected" ? buildRefusal(row.scenario.transition.name, built.reason).message : executed?.status === "rejected" && isError(executed.reason) ? executed.reason.message : void 0;
3842
+ if (built.status === "fulfilled") {
3843
+ const current = options.state(built.value);
3678
3844
  state.setAttribute(STATECHART_ATTRIBUTES.state, current);
3679
3845
  state.textContent = current;
3680
3846
  }
3681
- if (refusal === void 0) passed += 1;
3682
- else failed += 1;
3847
+ outcomes.push(refusal === void 0);
3848
+ const passed = outcomes.filter((outcome) => outcome).length;
3849
+ const failed = outcomes.length - passed;
3683
3850
  row.element.setAttribute(STATECHART_ATTRIBUTES.result, refusal === void 0 ? "passed" : "failed");
3684
3851
  root.setAttribute(STATECHART_ATTRIBUTES.passed, String(passed));
3685
3852
  root.setAttribute(STATECHART_ATTRIBUTES.failed, String(failed));
@@ -3687,10 +3854,14 @@ function createHarness(options) {
3687
3854
  if (options.pause !== void 0 && index < table.length - 1) await waitForDelay(options.pause);
3688
3855
  }
3689
3856
  } catch (cause) {
3857
+ const passed = outcomes.filter((outcome) => outcome).length;
3858
+ const failed = outcomes.length - passed;
3690
3859
  root.setAttribute(STATECHART_ATTRIBUTES.status, "failed");
3691
3860
  announcer.textContent = `Statechart harness failed, ${passed} passed and ${failed} failed of ${table.length}.`;
3692
3861
  throw cause;
3693
3862
  }
3863
+ const passed = outcomes.filter((result) => result).length;
3864
+ const failed = outcomes.length - passed;
3694
3865
  const outcome = failed === 0 ? "passed" : "failed";
3695
3866
  root.setAttribute(STATECHART_ATTRIBUTES.status, outcome);
3696
3867
  announcer.textContent = `Statechart harness ${outcome}, ${passed} passed and ${failed} failed of ${table.length}.`;
@@ -3807,8 +3978,7 @@ function createKeyboardEvent(name, options) {
3807
3978
  ...options
3808
3979
  });
3809
3980
  }
3810
- //#endregion
3811
- //#region src/browser/captures/factories.ts
3981
+ // src/browser/captures/factories.ts
3812
3982
  /**
3813
3983
  * Creates the capture portfolio one run places its screenshots through; a disabled run still refuses.
3814
3984
  *
@@ -3879,8 +4049,7 @@ function createPortfolio(options) {
3879
4049
  }
3880
4050
  };
3881
4051
  }
3882
- //#endregion
3883
- //#region src/browser/colors/constants.ts
4052
+ // src/browser/colors/constants.ts
3884
4053
  /**
3885
4054
  * Names the color a browser paints an unstyled document with: opaque white.
3886
4055
  *
@@ -3895,8 +4064,7 @@ var CANVAS_COLOR = Object.freeze([
3895
4064
  255,
3896
4065
  1
3897
4066
  ]);
3898
- //#endregion
3899
- //#region src/browser/colors/helpers.ts
4067
+ // src/browser/colors/helpers.ts
3900
4068
  /**
3901
4069
  * Converts normalized encoded sRGB channels to the clipped paint scale.
3902
4070
  *
@@ -4409,20 +4577,12 @@ function measureContrast(front, back) {
4409
4577
  * ```
4410
4578
  */
4411
4579
  function readLayers(element) {
4412
- const layers = [];
4413
- for (let node = element; node !== null; node = node.parentElement) {
4414
- const computed = getComputedStyle(node).backgroundColor;
4415
- if (computed === "") continue;
4416
- const layer = parseColor(computed);
4417
- if (layer === void 0) {
4418
- if (/\/\s*(?:0(?:\.0*)?|none)\s*\)$/u.test(computed)) continue;
4419
- throw new Error(`Computed background color is unreadable on ${node.localName}${node.id === "" ? "" : `#${node.id}`}: ${computed}`);
4420
- }
4421
- if (layer[3] === 0) continue;
4422
- layers.push(layer);
4423
- if (layer[3] >= 1) break;
4424
- }
4425
- return Object.freeze(layers);
4580
+ const computed = getComputedStyle(element).backgroundColor;
4581
+ const layer = computed === "" ? void 0 : parseColor(computed);
4582
+ if (layer === void 0 && computed !== "" && !/\/\s*(?:0(?:\.0*)?|none)\s*\)$/u.test(computed)) throw new Error(`Computed background color is unreadable on ${element.localName}${element.id === "" ? "" : `#${element.id}`}: ${computed}`);
4583
+ if (layer !== void 0 && layer[3] >= 1) return Object.freeze([layer]);
4584
+ const parent = element.parentElement;
4585
+ return Object.freeze([...layer === void 0 || layer[3] === 0 ? [] : [layer], ...parent === null ? [] : readLayers(parent)]);
4426
4586
  }
4427
4587
  /**
4428
4588
  * Resolves the opaque color standing behind one element.
@@ -4662,20 +4822,21 @@ function buildContrast(bar) {
4662
4822
  tint[2],
4663
4823
  1
4664
4824
  ];
4665
- let refusedChannel;
4666
- let acceptedChannel;
4667
- for (let channel = 0; channel <= 255; channel += 1) {
4825
+ const channels = Array.from({ length: 256 }, (_, channel) => {
4668
4826
  const front = [
4669
4827
  channel,
4670
4828
  channel,
4671
4829
  channel,
4672
4830
  1
4673
4831
  ];
4674
- const composited = measureContrast(front, backdrop);
4675
- const flat = measureContrast(front, flattened);
4676
- if (refusedChannel === void 0 && composited < bar && flat >= bar) refusedChannel = channel;
4677
- if (acceptedChannel === void 0 && composited >= bar && flat < bar) acceptedChannel = channel;
4678
- }
4832
+ return {
4833
+ channel,
4834
+ composited: measureContrast(front, backdrop),
4835
+ flat: measureContrast(front, flattened)
4836
+ };
4837
+ });
4838
+ const refusedChannel = channels.find(({ composited, flat }) => composited < bar && flat >= bar)?.channel;
4839
+ const acceptedChannel = channels.find(({ composited, flat }) => composited >= bar && flat < bar)?.channel;
4679
4840
  if (refusedChannel === void 0 || acceptedChannel === void 0) throw new Error(`Contrast control cannot straddle the bar ${bar}`);
4680
4841
  const root = build("div", { attributes: { style: `background-color: rgb(${CANVAS_COLOR[0]}, ${CANVAS_COLOR[1]}, ${CANVAS_COLOR[2]})` } });
4681
4842
  const tinted = build("div", { attributes: { style: `background-color: rgba(${tint[0]}, ${tint[1]}, ${tint[2]}, ${tint[3]})` } });
@@ -4695,8 +4856,7 @@ function buildContrast(bar) {
4695
4856
  accepted
4696
4857
  });
4697
4858
  }
4698
- //#endregion
4699
- //#region src/browser/sheets/helpers.ts
4859
+ // src/browser/sheets/helpers.ts
4700
4860
  /**
4701
4861
  * Adopts CSS text into the document with an idempotent release operation.
4702
4862
  *
@@ -4878,10 +5038,7 @@ function readRules() {
4878
5038
  } catch {
4879
5039
  continue;
4880
5040
  }
4881
- for (let index = 0; index < rules.length; index += 1) {
4882
- const rule = rules[index];
4883
- if (rule instanceof CSSGroupingRule) rules.push(...rule.cssRules);
4884
- }
5041
+ for (const rule of rules) if (rule instanceof CSSGroupingRule) rules.push(...rule.cssRules);
4885
5042
  return rules;
4886
5043
  }
4887
5044
  /**
@@ -5121,7 +5278,6 @@ function buildCensus() {
5121
5278
  mark
5122
5279
  });
5123
5280
  }
5124
- //#endregion
5125
- export { ACCESSIBLE_ROLES, CANVAS_COLOR, CAPTURE_PANE, CAPTURE_STAGINGS, CONTENT_ROLES, FIELD_ROLES, FOCUSABLE_SELECTOR, FOCUS_SEGMENT_LIMIT, HEADER_ROLES, IMPLICIT_ROLES, MEDIA_STAGE, POINTER_HOLD, SEGMENTED_INPUT_TYPES, adoptSheet, blendColor, build, buildCensus, buildContrast, buildDenial, buildEscapes, captureFrame, chooseAccessible, clearStorage, clickAccessible, clickAccessibleWithin, clickDisclosure, clipsOverflow, collectClippingAncestors, collectScrollRegions, collectTabStops, commitInput, computeNamePattern, computeOffset, containsNode, convertA98RGB, convertDisplayP3, convertLab, convertLinearSRGB, convertOKLab, convertProPhotoRGB, convertRec2020, convertSRGB, convertXYZD50, convertXYZD65, countElements, createChannel, createDragEvent, createHarness, createJournal, createKeyboardEvent, createPointerEvent, createPortfolio, createStorage, describeFocus, describeScrollRegions, describeTree, driveHold, driveTraversal, expandCaptures, extractOrphans, extractStyles, fillAccessible, findKeyframes, findRule, holdAccessible, holdAccessibleWithin, hoverAccessible, isOutsideViewport, isReachable, isRendered, matchesColor, measureContent, measureContrast, measureLuminance, mount, paintImage, parkPointer, parseCSSColor, parseColor, pressKeys, readAccessibilityNode, readActiveElement, readAnimations, readBackdrop, readCascade, readCensus, readClasses, readClipEdge, readClipMargin, readClippedBlock, readColorContrast, readContrast, readFocus, readFrame, readHit, readLayerNames, readLayers, readName, readPage, readPerception, readPixels, readProtocolNode, readProtocolPoint, readRefusal, readRing, readRole, readRootToken, readRows, readRules, readShotPixel, readStates, readStyle, readText, readToken, readValue, releaseMedia, releasePane, releasePointer, releaseTouch, removeDatabase, render, resolveAccessible, resolveAccessibleWithin, resolveFileInput, resolveRendered, sendFileDrag, sendProtocol, sendTouch, settleCapture, stageMedia, stagePane, stepFocus, supportsSegmentedFocus, tapTouch, traverseAccessible, traverseAccessibleWithin, typeAccessible, typeInput, waitForAnimations, waitForFrame, waitForStability, waitForState, walkFocus };
5281
+ export { ACCESSIBLE_ROLES, CANVAS_COLOR, CAPTURE_PANE, CAPTURE_STAGE_LIMIT, CONTENT_ROLES, FIELD_ROLES, FOCUSABLE_SELECTOR, FOCUS_SEGMENT_LIMIT, HEADER_ROLES, IMPLICIT_ROLES, MEDIA_STAGE, POINTER_HOLD, SEGMENTED_INPUT_TYPES, adoptSheet, blendColor, build, buildCensus, buildContrast, buildDenial, buildEscapes, captureFrame, chooseAccessible, clearStorage, clickAccessible, clickAccessibleWithin, clickDisclosure, clipsOverflow, collectClippingAncestors, collectScrollRegions, collectShadowHosts, collectTabStops, commitInput, computeNamePattern, computeOffset, containsNode, convertA98RGB, convertDisplayP3, convertLab, convertLinearSRGB, convertOKLab, convertProPhotoRGB, convertRec2020, convertSRGB, convertXYZD50, convertXYZD65, countElements, createChannel, createDragEvent, createHarness, createJournal, createKeyboardEvent, createPointerEvent, createPortfolio, createStorage, describeFocus, describeScrollRegions, describeTree, driveHold, driveTraversal, expandCaptures, extractOrphans, extractStyles, fillAccessible, findKeyframes, findRule, holdAccessible, holdAccessibleWithin, hoverAccessible, isOutsideViewport, isReachable, isRendered, matchesColor, matchesTraversalName, measureContent, measureContrast, measureLuminance, mount, paintImage, parkPointer, parseCSSColor, parseColor, pressKeys, readAccessibilityNode, readActiveElement, readAnimations, readBackdrop, readCaptureReader, readCascade, readCensus, readClasses, readClipEdge, readClipMargin, readClippedBlock, readColorContrast, readContrast, readFocus, readFrame, readFrameHeight, readHit, readLayerNames, readLayers, readName, readPage, readPerception, readPixels, readProtocolNode, readProtocolPoint, readProtocolSession, readRefusal, readRing, readRole, readRootToken, readRows, readRules, readShotPixel, readStates, readStyle, readText, readToken, readValue, releaseMedia, releasePane, releasePointer, releaseTouch, removeDatabase, render, resolveAccessible, resolveAccessibleWithin, resolveFileInput, resolveRendered, sendFileDrag, sendProtocol, sendTouch, settleCapture, settleFrame, stageMedia, stagePane, stepFocus, supportsSegmentedFocus, takeFrameShot, tapTouch, traverseAccessible, traverseAccessibleWithin, typeAccessible, typeInput, verifyFrame, waitForAnimations, waitForFrame, waitForStability, waitForState, walkFocus };
5126
5282
 
5127
5283
  //# sourceMappingURL=index.js.map