@unotest/web 0.55.0 → 0.57.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/skills/write-e2e-test/SKILL.md +44 -7
- package/.claude/skills/write-e2e-test-ground/SKILL.md +20 -5
- package/CHANGELOG.md +250 -3
- package/README.md +7 -6
- package/bin/unotest-web.js +13 -0
- package/dist/config/schema.d.ts +29 -23
- package/dist/config/schema.js +1 -1
- package/dist/driver/index.d.ts +16 -2
- package/dist/driver/index.js +1 -1
- package/dist/dsl/index.d.ts +74 -94
- package/dist/dsl/index.js +1 -1
- package/dist/dsl/v8/scenario-worker.js +1 -1
- package/dist/dsl/web-dsl-language-service.d.ts +30 -3
- package/dist/dsl/web-dsl-language-service.js +1 -1
- package/dist/inspection/page-inject.d.ts +63 -7
- package/dist/inspection/page-inject.js +199 -19
- package/dist/{interfaces-CNvyInrY.d.ts → interfaces-DDp6Chwx.d.ts} +167 -10
- package/dist/{linter-BpaIstU3.d.ts → linter-q4UNIeGI.d.ts} +20 -0
- package/dist/mcp/server.js +1 -1
- package/dist/runner/cli.d.ts +1 -1
- package/dist/runner/cli.js +1 -1
- package/dist/runner/init/chrome-probe.js +1 -1
- package/dist/runner/init.js +1 -1
- package/dist/runner/install-chromium.js +1 -1
- package/dist/runner/prepare-fix.js +1 -1
- package/dist/runner/scaffold-workspace.js +1 -1
- package/dist/runner/serve-fixture.js +1 -1
- package/dist/runner/web-runner-adapter.js +1 -1
- package/dist/scenario-variables-CGexnWK4.d.ts +106 -0
- package/examples/idioms/README.md +16 -0
- package/examples/idioms/animations-list.js +24 -0
- package/examples/idioms/api-call-timeout.js +14 -0
- package/examples/idioms/background-tab.js +24 -0
- package/examples/idioms/clipboard-paste.js +25 -0
- package/examples/idioms/computed-style.js +21 -0
- package/examples/idioms/image-size.js +20 -0
- package/examples/idioms/never-appears.js +20 -0
- package/examples/idioms/never-condition.js +24 -0
- package/examples/idioms/page-code-function.js +18 -0
- package/examples/idioms/select-by-label.js +22 -0
- package/examples/idioms/wait-enabled.js +24 -0
- package/examples/idioms/wait-for-animations.js +16 -0
- package/examples/idioms/wait-until-value.js +32 -0
- package/guides/agent-integration.md +28 -4
- package/guides/dsl-reference.md +896 -45
- package/llms.txt +38 -9
- package/package.json +9 -8
- package/types/unotest-dsl.d.ts +107 -30
- package/types/unotest-lib.d.ts +5 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { InjectedDomHelpers } from '@unotest/grounder-client/dom-walker';
|
|
2
2
|
import { PickerMode } from '@unotest/protocol';
|
|
3
|
-
import { E as ElementHint, A as AnimationInfo } from '../interfaces-
|
|
3
|
+
import { E as ElementHint, A as AnimationInfo, F as FocusZoomRead } from '../interfaces-DDp6Chwx.js';
|
|
4
4
|
import '../config/schema.js';
|
|
5
5
|
import 'zod';
|
|
6
6
|
|
|
@@ -385,11 +385,18 @@ interface FindElementMatch {
|
|
|
385
385
|
* full snapshot. Each entry is `{ role, name, ref }`; unnamed
|
|
386
386
|
* ancestors are skipped. Capped at 4 entries — deeper structure
|
|
387
387
|
* rarely informs disambiguation. */
|
|
388
|
-
ancestors:
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
}
|
|
388
|
+
ancestors: FindElementAncestor[];
|
|
389
|
+
}
|
|
390
|
+
interface FindElementAncestor {
|
|
391
|
+
role: string;
|
|
392
|
+
/** Accessible name (W3C accname) — what `find_element({name})` matches. */
|
|
393
|
+
name: string;
|
|
394
|
+
/** The label the outline (`get_page_snapshot`) prints for this region:
|
|
395
|
+
* aria-label → aria-labelledby → first heading inside. Absent when
|
|
396
|
+
* there is none. Differs from `name` for a container titled by its
|
|
397
|
+
* own heading (`<form><h2>Employees</h2>…`): no accname, label set. */
|
|
398
|
+
label?: string;
|
|
399
|
+
ref?: string;
|
|
393
400
|
}
|
|
394
401
|
interface FindElementResult {
|
|
395
402
|
/** All matches; first `nth` (default 20) returned. */
|
|
@@ -413,6 +420,15 @@ declare function findElementAlgorithm(h: InjectedDomHelpers, args: {
|
|
|
413
420
|
limit: number;
|
|
414
421
|
}): FindElementResult;
|
|
415
422
|
|
|
423
|
+
/** What the page reports about one match beyond its hint. */
|
|
424
|
+
interface ProbeFields {
|
|
425
|
+
name: string;
|
|
426
|
+
placeholder?: string;
|
|
427
|
+
value?: string;
|
|
428
|
+
valueHidden?: true;
|
|
429
|
+
}
|
|
430
|
+
declare function probeFieldsAlgorithm(h: InjectedDomHelpers): (el: Element) => ProbeFields;
|
|
431
|
+
|
|
416
432
|
/** Raw element hint read off a live DOM element: `ElementHint` minus the
|
|
417
433
|
* wire-only `ref` the caller adds when mapping. Type-only import — erased
|
|
418
434
|
* at runtime, so the serialized functions stay self-contained. */
|
|
@@ -428,9 +444,30 @@ declare function readCheckedState(el: Element): boolean | null;
|
|
|
428
444
|
/** Disabled state — native `:disabled` (covers `<fieldset disabled>`
|
|
429
445
|
* inheritance) or `aria-disabled` on a custom widget. */
|
|
430
446
|
declare function readDisabledState(el: Element): boolean;
|
|
447
|
+
/** The share of the element inside the viewport, 0..1, as an
|
|
448
|
+
* IntersectionObserver reports it on its first callback — ancestors that
|
|
449
|
+
* clip by overflow count, the way Playwright's `toBeInViewport` reads it.
|
|
450
|
+
* The empty animation frame wakes engines that hold the callback until
|
|
451
|
+
* the next frame. */
|
|
452
|
+
declare function readViewportRatio(el: Element): Promise<number>;
|
|
453
|
+
/** After `fill(…, {force: true})`: whether an `<input>` / `<textarea>`
|
|
454
|
+
* holds `value`, and the state that kept it from taking it — readonly,
|
|
455
|
+
* disabled or hidden — or null for an editable field or another element.
|
|
456
|
+
* Compared here, so the value never leaves the page (#537). */
|
|
457
|
+
declare function readForcedFillState(el: Element, value: string): {
|
|
458
|
+
state: "readonly" | "disabled" | "hidden" | null;
|
|
459
|
+
holds: boolean;
|
|
460
|
+
};
|
|
431
461
|
/** Computed value of one CSS property — custom properties included, which
|
|
432
462
|
* `getPropertyValue` returns with the whitespace after their colon. */
|
|
433
463
|
declare function readComputedStyle(el: Element, property: string): string;
|
|
464
|
+
/** The fields inside `root` (itself included; the document when absent)
|
|
465
|
+
* that a phone browser zooms into on focus when their text is small, each
|
|
466
|
+
* with its CSS font size, plus the page scale and what the document's
|
|
467
|
+
* viewport meta says of width and zoom. Hidden, disabled and read-only fields take no
|
|
468
|
+
* keyboard and are left out; a nested contenteditable counts once, by its
|
|
469
|
+
* editing host. */
|
|
470
|
+
declare function readFocusZoomFields(root?: Element): FocusZoomRead;
|
|
434
471
|
/** The visible labels of a `<select>`'s options, in order — what a
|
|
435
472
|
* select by `{label}` matches against and `{index}` counts. Anything
|
|
436
473
|
* but a `<select>` has none. */
|
|
@@ -467,6 +504,9 @@ declare function pageHasBackdropFilter(): boolean;
|
|
|
467
504
|
declare function writeLocalStorageItem([key, value]: [string, string]): void;
|
|
468
505
|
/** Read a localStorage item (`null` when absent). */
|
|
469
506
|
declare function readLocalStorageItem(key: string): string | null;
|
|
507
|
+
/** Give the page a `beforeunload` listener that does nothing: it asks
|
|
508
|
+
* nothing and leaves the page's own listeners as they are. */
|
|
509
|
+
declare function addIdleBeforeUnload(): void;
|
|
470
510
|
/** Make the document report itself hidden or visible to its scripts:
|
|
471
511
|
* `document.hidden`, `visibilityState`, `hasFocus()`. With `announce` it
|
|
472
512
|
* fires what a tab switch fires — `blur` then `visibilitychange` on hiding,
|
|
@@ -498,5 +538,21 @@ declare function inspectElementRaw(el: Element, args: {
|
|
|
498
538
|
limit: number;
|
|
499
539
|
};
|
|
500
540
|
}): ElementHintRaw;
|
|
541
|
+
/** One phase of a one-finger touch at viewport point (x, y), dispatched
|
|
542
|
+
* from the page — for engines without a touch input to drive (WebKit,
|
|
543
|
+
* Firefox). Sends what a real finger does: a `pointerType: 'touch'`
|
|
544
|
+
* pointer event, then the touch event. Every phase goes to the element
|
|
545
|
+
* the finger went down on, as touch events (and pointer events under
|
|
546
|
+
* implicit touch capture) do. WebKit will not construct a `Touch` or a
|
|
547
|
+
* `TouchEvent` from script: there the touch event is a plain `Event`
|
|
548
|
+
* carrying `touches` / `targetTouches` / `changedTouches` built by
|
|
549
|
+
* `document.createTouchList` — real `Touch` objects, but the event is not
|
|
550
|
+
* `instanceof TouchEvent`. Returns false when no element is at a
|
|
551
|
+
* `start` point, or no touch is down for a `move` / `end`. */
|
|
552
|
+
declare function dispatchTouchPhase(arg: {
|
|
553
|
+
phase: "start" | "move" | "end";
|
|
554
|
+
x: number;
|
|
555
|
+
y: number;
|
|
556
|
+
}): boolean;
|
|
501
557
|
|
|
502
|
-
export { type ElementHintRaw, type ImageState, ariaSnapshotAlgorithm, endsByItself, findElementAlgorithm, inspectElementRaw, isImageComplete, outlineAlgorithm, pageHasBackdropFilter, pasteValue, pickerOverlayAlgorithm, readAnimations, readCheckedState, readClipboardText, readComputedStyle, readDisabledState, readImageState, readLocalStorageItem, readOptionLabels, semanticDomAlgorithm, serializeRuntimeDom, writeDisplayMode, writeDocumentHidden, writeLocalStorageItem };
|
|
558
|
+
export { type ElementHintRaw, type ImageState, addIdleBeforeUnload, ariaSnapshotAlgorithm, dispatchTouchPhase, endsByItself, findElementAlgorithm, inspectElementRaw, isImageComplete, outlineAlgorithm, pageHasBackdropFilter, pasteValue, pickerOverlayAlgorithm, probeFieldsAlgorithm, readAnimations, readCheckedState, readClipboardText, readComputedStyle, readDisabledState, readFocusZoomFields, readForcedFillState, readImageState, readLocalStorageItem, readOptionLabels, readViewportRatio, semanticDomAlgorithm, serializeRuntimeDom, writeDisplayMode, writeDocumentHidden, writeLocalStorageItem };
|
|
@@ -1666,7 +1666,7 @@ function outlineAlgorithm(h, assignRefs) {
|
|
|
1666
1666
|
clickAffordance,
|
|
1667
1667
|
testIdOf,
|
|
1668
1668
|
formFieldRole,
|
|
1669
|
-
|
|
1669
|
+
landmarkLabel,
|
|
1670
1670
|
svgAccname,
|
|
1671
1671
|
makeAccname,
|
|
1672
1672
|
ariaStateFlags,
|
|
@@ -1774,23 +1774,6 @@ function outlineAlgorithm(h, assignRefs) {
|
|
|
1774
1774
|
return null;
|
|
1775
1775
|
}
|
|
1776
1776
|
__name(findLandmark, "findLandmark");
|
|
1777
|
-
function landmarkLabel(landmark) {
|
|
1778
|
-
const aria = trim(landmark.getAttribute("aria-label"));
|
|
1779
|
-
if (aria) return cap(aria);
|
|
1780
|
-
const fromLabelledby = nameFromLabelledby(
|
|
1781
|
-
landmark,
|
|
1782
|
-
/* @__PURE__ */ new Set(),
|
|
1783
|
-
(ref) => trim(textContentVisible(ref))
|
|
1784
|
-
);
|
|
1785
|
-
if (fromLabelledby) return fromLabelledby;
|
|
1786
|
-
const heading = landmark.querySelector("h1, h2, h3, h4, h5, h6");
|
|
1787
|
-
if (heading) {
|
|
1788
|
-
const txt = trim(textContentVisible(heading));
|
|
1789
|
-
if (txt) return cap(txt);
|
|
1790
|
-
}
|
|
1791
|
-
return "";
|
|
1792
|
-
}
|
|
1793
|
-
__name(landmarkLabel, "landmarkLabel");
|
|
1794
1777
|
function tooltipLabel(el) {
|
|
1795
1778
|
for (const a of Array.from(el.attributes)) {
|
|
1796
1779
|
if (!a.name.startsWith("data-") || a.name.startsWith("data-unotest")) continue;
|
|
@@ -2319,6 +2302,12 @@ import { pickerOverlayAlgorithm as pickerOverlayInjectable } from "@unotest/web/
|
|
|
2319
2302
|
// src/util/errors.ts
|
|
2320
2303
|
import { UnotestError } from "@unotest/core";
|
|
2321
2304
|
|
|
2305
|
+
// src/dsl/external-variable-messages.ts
|
|
2306
|
+
import { ENV_FILE, SECRETS_FILE } from "@unotest/protocol";
|
|
2307
|
+
|
|
2308
|
+
// src/config/env-layers.ts
|
|
2309
|
+
import { activeEnvName, envLayerFilesFor, secretsLayerFilesFor } from "@unotest/protocol";
|
|
2310
|
+
|
|
2322
2311
|
// src/inspection/picker-overlay.ts
|
|
2323
2312
|
function pickerOverlayAlgorithm(op) {
|
|
2324
2313
|
const REF_ATTR = "data-unotest-ref";
|
|
@@ -2733,7 +2722,10 @@ function findElementAlgorithm(h, args) {
|
|
|
2733
2722
|
if (role) {
|
|
2734
2723
|
const name = h.accname(p);
|
|
2735
2724
|
if (role !== "generic" || name) {
|
|
2736
|
-
|
|
2725
|
+
const entry = { role, name, ref: h.ensureRef(p, "n") };
|
|
2726
|
+
const label = h.landmarkLabel(p);
|
|
2727
|
+
if (label) entry.label = label;
|
|
2728
|
+
chain.push(entry);
|
|
2737
2729
|
}
|
|
2738
2730
|
}
|
|
2739
2731
|
p = h.parentOrHost(p);
|
|
@@ -2757,6 +2749,69 @@ function findElementAlgorithm(h, args) {
|
|
|
2757
2749
|
}
|
|
2758
2750
|
__name(findElementAlgorithm, "findElementAlgorithm");
|
|
2759
2751
|
|
|
2752
|
+
// src/inspection/probe-locator.ts
|
|
2753
|
+
import { composeInjectedScript as composeInjectedScript4 } from "@unotest/grounder-client/dom-walker";
|
|
2754
|
+
|
|
2755
|
+
// src/driver/options.ts
|
|
2756
|
+
function optionKeys() {
|
|
2757
|
+
return (keys) => keys;
|
|
2758
|
+
}
|
|
2759
|
+
__name(optionKeys, "optionKeys");
|
|
2760
|
+
var CLICK_OPTION_KEYS = optionKeys()(["timeout", "force", "position", "modifiers", "button", "clickCount"]);
|
|
2761
|
+
var DRAG_OPTION_KEYS = optionKeys()(["timeout", "force", "sourcePosition", "targetPosition"]);
|
|
2762
|
+
var DRAG_BY_OPTION_KEYS = optionKeys()(["timeout", "force", "sourcePosition"]);
|
|
2763
|
+
var TAP_OPTION_KEYS = optionKeys()(["timeout", "position"]);
|
|
2764
|
+
var LONG_PRESS_OPTION_KEYS = optionKeys()(["timeout", "position", "durationMs"]);
|
|
2765
|
+
var SWIPE_OPTION_KEYS = optionKeys()(["timeout", "sourcePosition", "durationMs"]);
|
|
2766
|
+
var FILL_OPTION_KEYS = optionKeys()(["timeout", "force"]);
|
|
2767
|
+
var PRESS_OPTION_KEYS = optionKeys()(["timeout", "delay"]);
|
|
2768
|
+
var CHECK_OPTION_KEYS = optionKeys()(["timeout", "force"]);
|
|
2769
|
+
var SELECT_OPTION_KEYS = optionKeys()(["timeout", "force"]);
|
|
2770
|
+
var HOVER_OPTION_KEYS = optionKeys()(["timeout", "force", "position"]);
|
|
2771
|
+
var WAIT_FOR_OPTION_KEYS = optionKeys()(["timeout", "state"]);
|
|
2772
|
+
var WAIT_FOR_TEXT_OPTION_KEYS = optionKeys()(["timeout", "state", "first", "exact"]);
|
|
2773
|
+
var NAVIGATION_OPTION_KEYS = optionKeys()(["timeout", "waitUntil"]);
|
|
2774
|
+
|
|
2775
|
+
// src/dsl/locator-value.ts
|
|
2776
|
+
var FILTER_OPTION_KEYS = optionKeys()([
|
|
2777
|
+
"hasText",
|
|
2778
|
+
"hasNotText",
|
|
2779
|
+
"has",
|
|
2780
|
+
"hasNot"
|
|
2781
|
+
]);
|
|
2782
|
+
var ROLE_OPTION_KEYS = optionKeys()([
|
|
2783
|
+
"name",
|
|
2784
|
+
"exact",
|
|
2785
|
+
"checked",
|
|
2786
|
+
"disabled",
|
|
2787
|
+
"expanded",
|
|
2788
|
+
"includeHidden",
|
|
2789
|
+
"level",
|
|
2790
|
+
"pressed",
|
|
2791
|
+
"selected"
|
|
2792
|
+
]);
|
|
2793
|
+
|
|
2794
|
+
// src/inspection/probe-locator.ts
|
|
2795
|
+
import { probeFieldsAlgorithm as probeFieldsAlgorithmInjectable } from "@unotest/web/internal/page-inject";
|
|
2796
|
+
function probeFieldsAlgorithm(h) {
|
|
2797
|
+
const nonText = ["checkbox", "radio", "button", "submit", "reset", "image", "file", "hidden"];
|
|
2798
|
+
return (el) => {
|
|
2799
|
+
const out = { name: h.accname(el) };
|
|
2800
|
+
const tag = el.tagName.toLowerCase();
|
|
2801
|
+
if (tag === "input" || tag === "textarea") {
|
|
2802
|
+
const placeholder = h.trim(el.placeholder);
|
|
2803
|
+
if (placeholder) out.placeholder = placeholder;
|
|
2804
|
+
}
|
|
2805
|
+
const type = tag === "input" ? el.type.toLowerCase() : "";
|
|
2806
|
+
if (type === "password") out.valueHidden = true;
|
|
2807
|
+
else if (tag === "textarea" || tag === "select" || tag === "input" && !nonText.includes(type)) {
|
|
2808
|
+
out.value = el.value;
|
|
2809
|
+
}
|
|
2810
|
+
return out;
|
|
2811
|
+
};
|
|
2812
|
+
}
|
|
2813
|
+
__name(probeFieldsAlgorithm, "probeFieldsAlgorithm");
|
|
2814
|
+
|
|
2760
2815
|
// src/inspection/page-dom.ts
|
|
2761
2816
|
function readClipboardText() {
|
|
2762
2817
|
return navigator.clipboard.readText();
|
|
@@ -2801,11 +2856,70 @@ function readDisabledState(el) {
|
|
|
2801
2856
|
return el.matches(":disabled") || el.getAttribute("aria-disabled") === "true";
|
|
2802
2857
|
}
|
|
2803
2858
|
__name(readDisabledState, "readDisabledState");
|
|
2859
|
+
function readViewportRatio(el) {
|
|
2860
|
+
globalThis.__name ??= (fn) => fn;
|
|
2861
|
+
return new Promise((resolve) => {
|
|
2862
|
+
const observer = new IntersectionObserver((entries) => {
|
|
2863
|
+
resolve(entries[0]?.intersectionRatio ?? 0);
|
|
2864
|
+
observer.disconnect();
|
|
2865
|
+
});
|
|
2866
|
+
observer.observe(el);
|
|
2867
|
+
requestAnimationFrame(() => {
|
|
2868
|
+
});
|
|
2869
|
+
});
|
|
2870
|
+
}
|
|
2871
|
+
__name(readViewportRatio, "readViewportRatio");
|
|
2872
|
+
function readForcedFillState(el, value) {
|
|
2873
|
+
globalThis.__name ??= (fn) => fn;
|
|
2874
|
+
if (el.tagName !== "INPUT" && el.tagName !== "TEXTAREA") return { state: null, holds: true };
|
|
2875
|
+
const field = el;
|
|
2876
|
+
const hidden = field.tagName === "INPUT" && field.type === "hidden" || field.getClientRects().length === 0 || getComputedStyle(field).visibility === "hidden";
|
|
2877
|
+
const state = field.matches(":disabled") ? "disabled" : field.readOnly ? "readonly" : hidden ? "hidden" : null;
|
|
2878
|
+
return { state, holds: field.value === value };
|
|
2879
|
+
}
|
|
2880
|
+
__name(readForcedFillState, "readForcedFillState");
|
|
2804
2881
|
function readComputedStyle(el, property) {
|
|
2805
2882
|
globalThis.__name ??= (fn) => fn;
|
|
2806
2883
|
return getComputedStyle(el).getPropertyValue(property).trim();
|
|
2807
2884
|
}
|
|
2808
2885
|
__name(readComputedStyle, "readComputedStyle");
|
|
2886
|
+
function readFocusZoomFields(root) {
|
|
2887
|
+
globalThis.__name ??= (fn) => fn;
|
|
2888
|
+
const NO_KEYBOARD = /* @__PURE__ */ new Set(["checkbox", "radio", "button", "submit", "reset", "file", "image", "range", "color", "hidden"]);
|
|
2889
|
+
const scale = window.visualViewport?.scale ?? 1;
|
|
2890
|
+
const takesText = /* @__PURE__ */ __name((el) => {
|
|
2891
|
+
if (el instanceof HTMLInputElement) return !NO_KEYBOARD.has(el.type) && !el.readOnly;
|
|
2892
|
+
if (el instanceof HTMLTextAreaElement) return !el.readOnly;
|
|
2893
|
+
if (el instanceof HTMLSelectElement) return true;
|
|
2894
|
+
return el instanceof HTMLElement && el.isContentEditable && !el.parentElement?.isContentEditable;
|
|
2895
|
+
}, "takesText");
|
|
2896
|
+
const shown = /* @__PURE__ */ __name((el) => el.getClientRects().length > 0 && getComputedStyle(el).visibility !== "hidden" && !el.matches(":disabled"), "shown");
|
|
2897
|
+
const field = /* @__PURE__ */ __name((el) => ({
|
|
2898
|
+
tag: el.tagName.toLowerCase(),
|
|
2899
|
+
type: el instanceof HTMLInputElement ? el.type : "",
|
|
2900
|
+
id: el.id,
|
|
2901
|
+
name: el.getAttribute("name") ?? "",
|
|
2902
|
+
fontPx: parseFloat(getComputedStyle(el).fontSize)
|
|
2903
|
+
}), "field");
|
|
2904
|
+
const selector = "input, textarea, select, [contenteditable]";
|
|
2905
|
+
const within = root ?? document.documentElement;
|
|
2906
|
+
const candidates = [...within.matches(selector) ? [within] : [], ...Array.from(within.querySelectorAll(selector))];
|
|
2907
|
+
const limits = /* @__PURE__ */ new Map();
|
|
2908
|
+
for (const pair of (document.querySelector('meta[name="viewport"]')?.getAttribute("content") ?? "").split(/[,;]/)) {
|
|
2909
|
+
const [key, value] = pair.split("=");
|
|
2910
|
+
if (key && value !== void 0) limits.set(key.trim().toLowerCase(), value.trim().toLowerCase());
|
|
2911
|
+
}
|
|
2912
|
+
const maximum = parseFloat(limits.get("maximum-scale") ?? "");
|
|
2913
|
+
const scalable = limits.get("user-scalable");
|
|
2914
|
+
return {
|
|
2915
|
+
fields: candidates.filter((el) => takesText(el) && shown(el)).map(field),
|
|
2916
|
+
scale,
|
|
2917
|
+
deviceWidth: limits.get("width") === "device-width",
|
|
2918
|
+
maximumScale: Number.isFinite(maximum) ? maximum : null,
|
|
2919
|
+
userScalable: scalable !== "no" && scalable !== "0"
|
|
2920
|
+
};
|
|
2921
|
+
}
|
|
2922
|
+
__name(readFocusZoomFields, "readFocusZoomFields");
|
|
2809
2923
|
function readOptionLabels(el) {
|
|
2810
2924
|
globalThis.__name ??= (fn) => fn;
|
|
2811
2925
|
return el instanceof HTMLSelectElement ? Array.from(el.options, (o) => o.label) : [];
|
|
@@ -2868,6 +2982,12 @@ function readLocalStorageItem(key) {
|
|
|
2868
2982
|
return localStorage.getItem(key);
|
|
2869
2983
|
}
|
|
2870
2984
|
__name(readLocalStorageItem, "readLocalStorageItem");
|
|
2985
|
+
function addIdleBeforeUnload() {
|
|
2986
|
+
globalThis.__name ??= (fn) => fn;
|
|
2987
|
+
addEventListener("beforeunload", () => {
|
|
2988
|
+
});
|
|
2989
|
+
}
|
|
2990
|
+
__name(addIdleBeforeUnload, "addIdleBeforeUnload");
|
|
2871
2991
|
function writeDocumentHidden([hidden, announce]) {
|
|
2872
2992
|
globalThis.__name ??= (fn) => fn;
|
|
2873
2993
|
if (hidden) {
|
|
@@ -3104,8 +3224,64 @@ function inspectElementRaw(el, args) {
|
|
|
3104
3224
|
__name(inferRole, "inferRole");
|
|
3105
3225
|
}
|
|
3106
3226
|
__name(inspectElementRaw, "inspectElementRaw");
|
|
3227
|
+
function dispatchTouchPhase(arg) {
|
|
3228
|
+
globalThis.__name ??= (fn) => fn;
|
|
3229
|
+
const state = globalThis;
|
|
3230
|
+
const POINTER_ID = 1;
|
|
3231
|
+
const TOUCH_ID = 1;
|
|
3232
|
+
if (arg.phase === "start") state.__unotestTouchTarget = document.elementFromPoint(arg.x, arg.y);
|
|
3233
|
+
const target = state.__unotestTouchTarget ?? null;
|
|
3234
|
+
if (target === null) return false;
|
|
3235
|
+
if (arg.phase === "end") state.__unotestTouchTarget = null;
|
|
3236
|
+
const pointerType = { start: "pointerdown", move: "pointermove", end: "pointerup" }[arg.phase];
|
|
3237
|
+
const touchType = { start: "touchstart", move: "touchmove", end: "touchend" }[arg.phase];
|
|
3238
|
+
const down = arg.phase !== "end";
|
|
3239
|
+
target.dispatchEvent(
|
|
3240
|
+
new PointerEvent(pointerType, {
|
|
3241
|
+
bubbles: true,
|
|
3242
|
+
cancelable: true,
|
|
3243
|
+
composed: true,
|
|
3244
|
+
pointerId: POINTER_ID,
|
|
3245
|
+
pointerType: "touch",
|
|
3246
|
+
isPrimary: true,
|
|
3247
|
+
clientX: arg.x,
|
|
3248
|
+
clientY: arg.y,
|
|
3249
|
+
buttons: down ? 1 : 0,
|
|
3250
|
+
pressure: down ? 0.5 : 0
|
|
3251
|
+
})
|
|
3252
|
+
);
|
|
3253
|
+
const init = { bubbles: true, cancelable: true, composed: true };
|
|
3254
|
+
const standard = /* @__PURE__ */ __name(() => {
|
|
3255
|
+
const touch = new Touch({ identifier: TOUCH_ID, target, clientX: arg.x, clientY: arg.y, pageX: arg.x + scrollX, pageY: arg.y + scrollY });
|
|
3256
|
+
const held = down ? [touch] : [];
|
|
3257
|
+
return new TouchEvent(touchType, { ...init, touches: held, targetTouches: held, changedTouches: [touch] });
|
|
3258
|
+
}, "standard");
|
|
3259
|
+
const legacy = /* @__PURE__ */ __name(() => {
|
|
3260
|
+
const doc = document;
|
|
3261
|
+
const touch = doc.createTouch(window, target, TOUCH_ID, arg.x + scrollX, arg.y + scrollY, arg.x, arg.y);
|
|
3262
|
+
const held = down ? doc.createTouchList(touch) : doc.createTouchList();
|
|
3263
|
+
const event2 = new Event(touchType, init);
|
|
3264
|
+
Object.defineProperties(event2, {
|
|
3265
|
+
touches: { value: held },
|
|
3266
|
+
targetTouches: { value: held },
|
|
3267
|
+
changedTouches: { value: doc.createTouchList(touch) }
|
|
3268
|
+
});
|
|
3269
|
+
return event2;
|
|
3270
|
+
}, "legacy");
|
|
3271
|
+
let event;
|
|
3272
|
+
try {
|
|
3273
|
+
event = standard();
|
|
3274
|
+
} catch {
|
|
3275
|
+
event = legacy();
|
|
3276
|
+
}
|
|
3277
|
+
target.dispatchEvent(event);
|
|
3278
|
+
return true;
|
|
3279
|
+
}
|
|
3280
|
+
__name(dispatchTouchPhase, "dispatchTouchPhase");
|
|
3107
3281
|
export {
|
|
3282
|
+
addIdleBeforeUnload,
|
|
3108
3283
|
ariaSnapshotAlgorithm,
|
|
3284
|
+
dispatchTouchPhase,
|
|
3109
3285
|
endsByItself,
|
|
3110
3286
|
findElementAlgorithm,
|
|
3111
3287
|
inspectElementRaw,
|
|
@@ -3114,14 +3290,18 @@ export {
|
|
|
3114
3290
|
pageHasBackdropFilter,
|
|
3115
3291
|
pasteValue,
|
|
3116
3292
|
pickerOverlayAlgorithm,
|
|
3293
|
+
probeFieldsAlgorithm,
|
|
3117
3294
|
readAnimations,
|
|
3118
3295
|
readCheckedState,
|
|
3119
3296
|
readClipboardText,
|
|
3120
3297
|
readComputedStyle,
|
|
3121
3298
|
readDisabledState,
|
|
3299
|
+
readFocusZoomFields,
|
|
3300
|
+
readForcedFillState,
|
|
3122
3301
|
readImageState,
|
|
3123
3302
|
readLocalStorageItem,
|
|
3124
3303
|
readOptionLabels,
|
|
3304
|
+
readViewportRatio,
|
|
3125
3305
|
semanticDomAlgorithm,
|
|
3126
3306
|
serializeRuntimeDom,
|
|
3127
3307
|
writeDisplayMode,
|