@ctrl/dom 0.1.14 → 0.2.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/README.md +44 -0
- package/dist/aria/_chunks/{roles-list--7uYUGyR.cjs → roles-list-C57tqF4n.cjs} +2 -2
- package/dist/aria/_chunks/roles-list-DEwbBc_c.js +4 -0
- package/dist/aria/index.cjs +1 -1
- package/dist/aria/index.js +1 -1
- package/dist/aria/internal.cjs +1 -1
- package/dist/aria/internal.js +1 -1
- package/dist/aria/types/forms.d.ts +6 -13
- package/dist/bridge/internal.js +1 -1
- package/dist/dom/_chunks/src-CaVKwScX.js +49 -0
- package/dist/dom/index.js +1 -1
- package/dist/dom/internal.js +1 -1
- package/dist/dom/types/collections/HTMLCollection.d.ts +2 -5
- package/dist/dom/types/css/cascade.d.ts +10 -3
- package/dist/dom/types/css/cssom.d.ts +9 -3
- package/dist/dom/types/css/parser.d.ts +27 -0
- package/dist/dom/types/css/style-deps.d.ts +11 -0
- package/dist/dom/types/events/Event.d.ts +16 -3
- package/dist/dom/types/events/EventTarget.d.ts +3 -3
- package/dist/dom/types/events/UIEvents.d.ts +10 -1
- package/dist/dom/types/events/activation.d.ts +2 -0
- package/dist/dom/types/events/dispatch.d.ts +1 -6
- package/dist/dom/types/events/listeners.d.ts +58 -18
- package/dist/dom/types/html/elements.d.ts +3 -2
- package/dist/dom/types/html/forms/HTMLButtonElement.d.ts +4 -3
- package/dist/dom/types/html/forms/HTMLFieldSetElement.d.ts +3 -2
- package/dist/dom/types/html/forms/HTMLInputElement.d.ts +11 -39
- package/dist/dom/types/html/forms/HTMLOutputElement.d.ts +6 -5
- package/dist/dom/types/html/forms/HTMLSelectElement.d.ts +6 -9
- package/dist/dom/types/html/forms/HTMLTextAreaElement.d.ts +10 -19
- package/dist/dom/types/html/forms/control-state.d.ts +33 -0
- package/dist/dom/types/html/forms/face.d.ts +3 -2
- package/dist/dom/types/html/forms/form-associated.d.ts +29 -9
- package/dist/dom/types/html/forms/user-validity.d.ts +7 -8
- package/dist/dom/types/html/forms/validation.d.ts +2 -2
- package/dist/dom/types/html/reflect.d.ts +1 -0
- package/dist/dom/types/internal.d.ts +4 -3
- package/dist/dom/types/keys.d.ts +10 -17
- package/dist/dom/types/nodes/Document.d.ts +6 -2
- package/dist/dom/types/nodes/Element.d.ts +1 -7
- package/dist/dom/types/nodes/Node.d.ts +4 -1
- package/dist/dom/types/nodes/attributes.d.ts +24 -2
- package/dist/dom/types/nodes/cache.d.ts +1 -1
- package/dist/dom/types/nodes/constants.d.ts +5 -0
- package/dist/dom/types/nodes/tree.d.ts +3 -3
- package/dist/dom/types/selectors/compile.d.ts +8 -0
- package/dist/dom/types/selectors/internal.d.ts +3 -1
- package/dist/dom/types/window/clock.d.ts +30 -0
- package/dist/dom/types/window/file-reset.d.ts +22 -0
- package/dist/jest-dom/_chunks/{matchers-CkxM783o.cjs → matchers-CZ6Smfw9.cjs} +2 -2
- package/dist/jest-dom/_chunks/{matchers-Dt7W4g5X.js → matchers-CwGF61j-.js} +2 -2
- package/dist/jest-dom/index.cjs +1 -1
- package/dist/jest-dom/index.js +1 -1
- package/dist/jest-dom/jest-globals.cjs +1 -1
- package/dist/jest-dom/jest-globals.js +1 -1
- package/dist/jest-dom/matchers.cjs +1 -1
- package/dist/jest-dom/matchers.js +1 -1
- package/dist/jest-dom/vitest.cjs +1 -1
- package/dist/jest-dom/vitest.js +1 -1
- package/dist/react/_chunks/pure-CYb0HgYU.js +1 -0
- package/dist/react/_chunks/pure-DRugbA0j.cjs +1 -0
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.js +1 -1
- package/dist/react/pure.cjs +1 -1
- package/dist/react/pure.js +1 -1
- package/dist/testing-library/index.cjs +2 -2
- package/dist/testing-library/index.js +7 -7
- package/dist/user-event/index.cjs +15 -15
- package/dist/user-event/index.js +15 -15
- package/dist/user-event/types/ctrl-dom.d.ts +8 -0
- package/dist/vitest-environment/_chunks/rolldown-runtime-H3fMLYWS.js +1 -0
- package/dist/vitest-environment/failure-snapshot.js +1 -1
- package/dist/vitest-environment/index.js +1 -1
- package/dist/vitest-environment/jsx-dev-runtime.js +1 -0
- package/dist/vitest-environment/jsx-runtime.js +1 -0
- package/dist/vitest-environment/plugin.js +1 -1
- package/dist/vitest-environment/shared-workers.js +1 -0
- package/dist/vitest-environment/types/jsx-dev-runtime.d.ts +3 -0
- package/dist/vitest-environment/types/jsx-runtime.d.ts +4 -0
- package/dist/vitest-environment/types/plugin.d.ts +19 -0
- package/dist/vitest-environment/types/shared-workers.d.ts +1 -0
- package/package.json +13 -1
- package/dist/aria/_chunks/roles-list-b_Z0ZWwY.js +0 -4
- package/dist/dom/_chunks/src-BacPsCQO.js +0 -49
- package/dist/react/_chunks/pure-D7Z4g4oF.js +0 -1
- package/dist/react/_chunks/pure-DOgNQrwu.cjs +0 -1
- package/dist/vitest-environment/_chunks/rolldown-runtime-BhWHdk3m.js +0 -1
|
@@ -8,9 +8,10 @@ import { $customValidity, $defaultValueOverride, $labels, $options, $validity }
|
|
|
8
8
|
export declare class HTMLOutputElement extends HTMLElement {
|
|
9
9
|
/** https://html.spec.whatwg.org/#concept-output-default-value-override (null = none). */
|
|
10
10
|
[$defaultValueOverride]: string | null;
|
|
11
|
-
|
|
12
|
-
[$
|
|
13
|
-
[$
|
|
11
|
+
/** The custom validity error message; absent while it is the empty string. */
|
|
12
|
+
[$customValidity]?: string;
|
|
13
|
+
[$validity]?: ValidityState | null;
|
|
14
|
+
[$labels]?: LabelsNodeList | null;
|
|
14
15
|
/** @internal Use Document.createElement. */
|
|
15
16
|
constructor(doc: Document, localName: string, ns: string | null, prefix: string | null);
|
|
16
17
|
get type(): string;
|
|
@@ -33,7 +34,7 @@ export declare class HTMLOutputElement extends HTMLElement {
|
|
|
33
34
|
export interface HTMLOutputElement extends ConstraintValidation {
|
|
34
35
|
}
|
|
35
36
|
export declare class HTMLProgressElement extends HTMLElement {
|
|
36
|
-
[$labels]
|
|
37
|
+
[$labels]?: LabelsNodeList | null;
|
|
37
38
|
/** @internal Use Document.createElement. */
|
|
38
39
|
constructor(doc: Document, localName: string, ns: string | null, prefix: string | null);
|
|
39
40
|
/** https://html.spec.whatwg.org/#dom-progress-max */
|
|
@@ -48,7 +49,7 @@ export declare class HTMLProgressElement extends HTMLElement {
|
|
|
48
49
|
}
|
|
49
50
|
/** https://html.spec.whatwg.org/#the-meter-element — the clamped values of the meter algorithm. */
|
|
50
51
|
export declare class HTMLMeterElement extends HTMLElement {
|
|
51
|
-
[$labels]
|
|
52
|
+
[$labels]?: LabelsNodeList | null;
|
|
52
53
|
/** @internal Use Document.createElement. */
|
|
53
54
|
constructor(doc: Document, localName: string, ns: string | null, prefix: string | null);
|
|
54
55
|
get min(): number;
|
|
@@ -6,12 +6,11 @@ import { HTMLCollection } from "../../collections/HTMLCollection.js";
|
|
|
6
6
|
import { HTMLOptionsCollection, LabelsNodeList } from "./collections.js";
|
|
7
7
|
import { type ConstraintValidation, type ValidityState } from "./validation.js";
|
|
8
8
|
import { $customValidity, $labels, $options, $selectedOptions, $settled, $updatingSelectedContent, $userValidity, $validity } from "../../keys.js";
|
|
9
|
-
import type { Event } from "../../events/Event.js";
|
|
10
|
-
import type { EventTarget } from "../../events/EventTarget.js";
|
|
11
9
|
export declare class HTMLSelectElement extends HTMLElement {
|
|
12
|
-
|
|
13
|
-
[$
|
|
14
|
-
[$
|
|
10
|
+
/** The custom validity error message; absent while it is the empty string. */
|
|
11
|
+
[$customValidity]?: string;
|
|
12
|
+
[$validity]?: ValidityState | null;
|
|
13
|
+
[$labels]?: LabelsNodeList | null;
|
|
15
14
|
[$options]: HTMLOptionsCollection | null;
|
|
16
15
|
[$selectedOptions]: HTMLCollection | null;
|
|
17
16
|
/**
|
|
@@ -21,12 +20,10 @@ export declare class HTMLSelectElement extends HTMLElement {
|
|
|
21
20
|
[$settled]: boolean;
|
|
22
21
|
/** Re-entrancy guard for `_updateSelectedContent` (it mutates the select's subtree). */
|
|
23
22
|
[$updatingSelectedContent]: boolean;
|
|
24
|
-
/** https://html.spec.whatwg.org/#user-validity (forms/user-validity.ts). */
|
|
25
|
-
[$userValidity]
|
|
23
|
+
/** https://html.spec.whatwg.org/#user-validity (forms/user-validity.ts); absent while false. */
|
|
24
|
+
[$userValidity]?: boolean;
|
|
26
25
|
/** @internal Use Document.createElement. */
|
|
27
26
|
constructor(doc: Document, localName: string, ns: string | null, prefix: string | null);
|
|
28
|
-
/** Sets user validity when a `change` event is dispatched at this control (forms/user-validity.ts). */
|
|
29
|
-
_getTheParent(event: Event): EventTarget | null;
|
|
30
27
|
_ensureSettled(): void;
|
|
31
28
|
_cloningSteps(copy: Element): void;
|
|
32
29
|
_connectedSteps(): void;
|
|
@@ -3,28 +3,19 @@ import type { Document } from "../../nodes/Document.js";
|
|
|
3
3
|
import type { Element } from "../../nodes/Element.js";
|
|
4
4
|
import { LabelsNodeList } from "./collections.js";
|
|
5
5
|
import { type ConstraintValidation, type ValidityState } from "./validation.js";
|
|
6
|
-
import { $
|
|
7
|
-
import
|
|
8
|
-
import type { EventTarget } from "../../events/EventTarget.js";
|
|
6
|
+
import { $control, $customValidity, $labels, $userValidity, $validity } from "../../keys.js";
|
|
7
|
+
import { ControlState } from "./control-state.js";
|
|
9
8
|
export declare class HTMLTextAreaElement extends HTMLElement {
|
|
10
|
-
/**
|
|
11
|
-
[$
|
|
12
|
-
/**
|
|
13
|
-
[$
|
|
14
|
-
[$
|
|
15
|
-
[$
|
|
16
|
-
|
|
17
|
-
[$
|
|
18
|
-
[$validity]: ValidityState | null;
|
|
19
|
-
[$labels]: LabelsNodeList | null;
|
|
20
|
-
/** The value was last changed by a user edit (tooLong/tooShort only apply then). */
|
|
21
|
-
[$userEdited]: boolean;
|
|
22
|
-
/** https://html.spec.whatwg.org/#user-validity (forms/user-validity.ts). */
|
|
23
|
-
[$userValidity]: boolean;
|
|
9
|
+
/** Value, checkedness, selection and UI state (./control-state.ts). */
|
|
10
|
+
[$control]: ControlState;
|
|
11
|
+
/** The custom validity error message; absent while it is the empty string. */
|
|
12
|
+
[$customValidity]?: string;
|
|
13
|
+
[$validity]?: ValidityState | null;
|
|
14
|
+
[$labels]?: LabelsNodeList | null;
|
|
15
|
+
/** https://html.spec.whatwg.org/#user-validity (forms/user-validity.ts); absent while false. */
|
|
16
|
+
[$userValidity]?: boolean;
|
|
24
17
|
/** @internal Use Document.createElement. */
|
|
25
18
|
constructor(doc: Document, localName: string, ns: string | null, prefix: string | null);
|
|
26
|
-
/** Sets user validity when a `change` event is dispatched at this control (forms/user-validity.ts). */
|
|
27
|
-
_getTheParent(event: Event): EventTarget | null;
|
|
28
19
|
get type(): string;
|
|
29
20
|
/** https://html.spec.whatwg.org/#dom-textarea-defaultvalue — the child text content. */
|
|
30
21
|
get defaultValue(): string;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { NodeImpl } from "../../nodes/NodeImpl.js";
|
|
2
|
+
import type { FileList } from "../../window/FileList.js";
|
|
3
|
+
export declare class ControlState {
|
|
4
|
+
/**
|
|
5
|
+
* The value while the dirty value flag is set: an input's in value mode "value", a textarea's
|
|
6
|
+
* raw value.
|
|
7
|
+
*/
|
|
8
|
+
value: string;
|
|
9
|
+
/** https://html.spec.whatwg.org/#concept-input-value-dirty-flag, https://html.spec.whatwg.org/#concept-textarea-dirty */
|
|
10
|
+
dirtyValue: boolean;
|
|
11
|
+
/** Checkedness, authoritative only when `checkedSet` (otherwise derived from the checked attribute). */
|
|
12
|
+
checked: boolean;
|
|
13
|
+
checkedSet: boolean;
|
|
14
|
+
/** https://html.spec.whatwg.org/#concept-input-checked-dirty-flag */
|
|
15
|
+
dirtyChecked: boolean;
|
|
16
|
+
indeterminate: boolean;
|
|
17
|
+
files: FileList | null;
|
|
18
|
+
selStart: number;
|
|
19
|
+
selEnd: number;
|
|
20
|
+
selDir: "forward" | "backward" | "none";
|
|
21
|
+
/** The value was last changed by a user edit (tooLong/tooShort only apply then). */
|
|
22
|
+
userEdited: boolean;
|
|
23
|
+
/** The user typed something the type cannot represent (e.g. "1e" in a number field). */
|
|
24
|
+
badInput: boolean;
|
|
25
|
+
/** User-event's UI value (raw typed text) — null when it equals the value. See ui.ts. */
|
|
26
|
+
uiValue: string | null;
|
|
27
|
+
preChecked: boolean;
|
|
28
|
+
preIndeterminate: boolean;
|
|
29
|
+
preCheckedRadio: NodeImpl | null;
|
|
30
|
+
/** Legacy-pre-activation ran (and changed state) for the current dispatch. */
|
|
31
|
+
preApplied: boolean;
|
|
32
|
+
constructor();
|
|
33
|
+
}
|
|
@@ -21,8 +21,9 @@ export declare class FaceState {
|
|
|
21
21
|
/** Last form owner / disabledness reported through the callbacks. */
|
|
22
22
|
lastOwner: NodeImpl | null;
|
|
23
23
|
lastDisabled: boolean;
|
|
24
|
-
|
|
25
|
-
[$
|
|
24
|
+
/** The custom validity error message; absent while it is the empty string. */
|
|
25
|
+
[$customValidity]?: string;
|
|
26
|
+
[$validity]?: ValidityState | null;
|
|
26
27
|
constructor(impl: NodeImpl);
|
|
27
28
|
_validityFlags(): number;
|
|
28
29
|
/** https://html.spec.whatwg.org/#barred-from-constraint-validation (FACE: disabled, readonly, datalist). */
|
|
@@ -25,9 +25,11 @@ export declare function parserAssociateForm(el: NodeImpl, form: NodeImpl): void;
|
|
|
25
25
|
export declare function clearParserAssociation(el: NodeImpl): void;
|
|
26
26
|
/**
|
|
27
27
|
* The subtree holding every element whose form owner is `form` (https://html.spec.whatwg.org/#form-owner).
|
|
28
|
-
* Outside
|
|
29
|
-
*
|
|
30
|
-
*
|
|
28
|
+
* Outside it only the parser's form element pointer or, for listed elements, a `form` attribute
|
|
29
|
+
* naming the form's ID can associate an element, so without either the form itself is enough.
|
|
30
|
+
* Forms usually have an ID and `form` attributes are rare: a document none of whose elements has
|
|
31
|
+
* ever had one (Document[$formAttrSeen]) needs no walk of the whole tree for a form with an ID
|
|
32
|
+
* (in a 10,000-node page, `form.elements` after a mutation 119 → 4 µs).
|
|
31
33
|
*/
|
|
32
34
|
export declare function formOwnerScope(form: NodeImpl, listed: boolean): NodeImpl;
|
|
33
35
|
/** All listed elements (excluding image buttons) whose form owner is `form`, in tree order: form.elements. */
|
|
@@ -49,9 +51,27 @@ export declare function isActuallyDisabled(el: NodeImpl): boolean;
|
|
|
49
51
|
export declare function hasDatalistAncestor(el: NodeImpl): boolean;
|
|
50
52
|
/** https://html.spec.whatwg.org/#labeled-control */
|
|
51
53
|
export declare function labeledControl(label: NodeImpl): NodeImpl | null;
|
|
52
|
-
/**
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
/**
|
|
55
|
+
* Per-document indexes of connected elements by a string key, in no particular order, kept by the
|
|
56
|
+
* elements' connected, disconnected and attribute change steps: Document[$forLabels], the labels
|
|
57
|
+
* by `for` value, and Document[$radios], the radios by name.
|
|
58
|
+
*
|
|
59
|
+
* A `for` value nearly always has one label, which never moves: an array. A radio leaves and
|
|
60
|
+
* rejoins its group constantly: on every update React sets its `name` to "" and back
|
|
61
|
+
* (react-dom's updateInput, so the radio is out of its group while its checkedness changes), and
|
|
62
|
+
* splicing each one out of an array made a re-render of a group of 500 radios 250,000 element
|
|
63
|
+
* moves (8% of a click's CPU there). A set, which costs a few hundred bytes per name: fine for
|
|
64
|
+
* radio groups, 11% more allocation building 1,000 labelled rows when the labels had one each.
|
|
65
|
+
*/
|
|
66
|
+
export declare function indexAdd(index: Map<string, NodeImpl[]>, key: string, el: NodeImpl): void;
|
|
67
|
+
export declare function indexRemove(index: Map<string, NodeImpl[]>, key: string, el: NodeImpl): void;
|
|
68
|
+
export declare function radioIndexAdd(index: Map<string, Set<NodeImpl>>, name: string, el: NodeImpl): void;
|
|
69
|
+
export declare function radioIndexRemove(index: Map<string, Set<NodeImpl>>, name: string, el: NodeImpl): void;
|
|
70
|
+
/**
|
|
71
|
+
* Label elements whose labeled control is `el`, in tree order. https://html.spec.whatwg.org/#dom-lfe-labels
|
|
72
|
+
*
|
|
73
|
+
* A label names `el` by `for` (only when `el` has an ID), or is an ancestor without `for` whose
|
|
74
|
+
* first labelable descendant is `el`. The ancestors are O(depth) and the document indexes its
|
|
75
|
+
* connected labels by `for`, so only a detached control with an ID walks its tree.
|
|
76
|
+
*/
|
|
77
|
+
export declare function labelsFor(el: NodeImpl): NodeImpl[];
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import type { NodeImpl } from "../../nodes/NodeImpl.js";
|
|
2
|
-
import type { Event } from "../../events/Event.js";
|
|
3
2
|
import { $userValidity } from "../../keys.js";
|
|
4
|
-
/** A control with a user validity flag (input, textarea, select). */
|
|
3
|
+
/** A control with a user validity flag (input, textarea, select): an own property once it is true. */
|
|
5
4
|
export interface UserValidityHolder {
|
|
6
|
-
[$userValidity]
|
|
5
|
+
[$userValidity]?: boolean;
|
|
7
6
|
}
|
|
8
7
|
/**
|
|
9
|
-
* Called
|
|
10
|
-
*
|
|
11
|
-
* listener runs
|
|
12
|
-
*
|
|
8
|
+
* Called by the event dispatch algorithm (events/dispatch.ts) with the target of a `change`
|
|
9
|
+
* event, while building the path (https://dom.spec.whatwg.org/#concept-event-dispatch step
|
|
10
|
+
* 6.8) and so before any listener runs: `change` listeners already see the new state. Only the
|
|
11
|
+
* target counts: a `change` dispatched at an `<option>` reaches its `<select>` as a parent and
|
|
13
12
|
* must not set the select's flag.
|
|
14
13
|
*/
|
|
15
|
-
export declare function noteChangeDispatch(
|
|
14
|
+
export declare function noteChangeDispatch(target: NodeImpl): void;
|
|
16
15
|
/** Whether `el` is an input, textarea or select whose user validity is true. */
|
|
17
16
|
export declare function hasUserValidity(el: NodeImpl): boolean;
|
|
18
17
|
/** https://html.spec.whatwg.org/#concept-form-submit step 6.3: set user validity of the form's submittable controls. */
|
|
@@ -12,8 +12,8 @@ export declare const V_BAD_INPUT: number;
|
|
|
12
12
|
export declare const V_CUSTOM_ERROR: number;
|
|
13
13
|
/** Internal contract every element with the constraint validation API implements. */
|
|
14
14
|
export interface Validatable extends Element {
|
|
15
|
-
[$customValidity]
|
|
16
|
-
[$validity]
|
|
15
|
+
[$customValidity]?: string;
|
|
16
|
+
[$validity]?: ValidityState | null;
|
|
17
17
|
/** Bit set of V_* flags describing the current validity state. */
|
|
18
18
|
_validityFlags(): number;
|
|
19
19
|
/** https://html.spec.whatwg.org/#barred-from-constraint-validation */
|
|
@@ -10,6 +10,7 @@ type Wrapper = {
|
|
|
10
10
|
export declare function contentAttr(el: NodeImpl, localName: string): string | null;
|
|
11
11
|
/** https://dom.spec.whatwg.org/#concept-element-attributes-set-value (null namespace). */
|
|
12
12
|
export declare function setContentAttr(el: NodeImpl, localName: string, value: string): void;
|
|
13
|
+
/** https://dom.spec.whatwg.org/#concept-element-attributes-remove-by-namespace (null namespace). */
|
|
13
14
|
export declare function removeContentAttr(el: NodeImpl, localName: string): void;
|
|
14
15
|
export declare function defineAccessor(C: Ctor, name: string, get: (this: Wrapper) => unknown, set?: (this: Wrapper, v: any) => void): void;
|
|
15
16
|
/**
|
|
@@ -5,7 +5,7 @@ import type { NodeImpl as NodeImplType } from "./nodes/NodeImpl.js";
|
|
|
5
5
|
export { NodeCache, nodeCache } from "./nodes/cache.js";
|
|
6
6
|
export { derivedCache, peekDerivedCache } from "./nodes/derived.js";
|
|
7
7
|
export { T, tagId, tagName } from "./nodes/tags.js";
|
|
8
|
-
export { nextInTree, nextSkippingChildren, previousInTree, nextElementInTree, firstElementChild, lastElementChild, nextElementSibling, previousElementSibling, treeRoot, isInclusiveAncestor, indexOf, childAt,
|
|
8
|
+
export { nextInTree, nextSkippingChildren, previousInTree, nextElementInTree, firstElementChild, lastElementChild, nextElementSibling, previousElementSibling, treeRoot, isInclusiveAncestor, indexOf, childAt, } from "./nodes/traverse.js";
|
|
9
9
|
export { attr, ariaAttr, prefixFlag, hasAttr, getAttribute, setAttribute, removeAttribute, classTokens, asciiLowercase, splitOnAsciiWhitespace, isAsciiWhitespace, } from "./nodes/attributes.js";
|
|
10
10
|
export { matches, closest, querySelector, querySelectorAll } from "./selectors/index.js";
|
|
11
11
|
export { serializeChildren, serializeNode } from "./serializer/index.js";
|
|
@@ -17,7 +17,7 @@ export { windowInterfaces } from "./window/Window.js";
|
|
|
17
17
|
export { captureInterfaceBaseline, guardInterfaceDefinitions, restoreInterfaces } from "./window/isolation.js";
|
|
18
18
|
export { COMPAT, COMPAT_PROFILES, DEFAULT_COMPAT, compatExposes, deferredCompatMembers, hiddenGlobals, resolveCompat, type CompatEntry, type CompatProfile, } from "./window/compat.js";
|
|
19
19
|
export { trackGlobalTimers } from "./window/timers.js";
|
|
20
|
-
export { VirtualClock, VirtualTimeout, installClock, clockNow, clockStats, canSkipZeroDelayWait, foreignImmediatesPending, isClockTimer, skipIdleTime, skipZeroDelayWait, virtualDate, virtualPerformance, type InstalledClock, type VirtualClockOptions, } from "./window/clock.js";
|
|
20
|
+
export { VirtualClock, VirtualTimeout, installClock, clockNow, clockStats, loopTurn, canSkipZeroDelayWait, foreignImmediatesPending, isClockTimer, skipIdleTime, skipZeroDelayWait, virtualDate, virtualPerformance, type InstalledClock, type VirtualClockOptions, } from "./window/clock.js";
|
|
21
21
|
export { FAILURE_CHANNEL, SPAN_CHANNEL, describeCall, describeNode, quote, setFailureSnapshot, setNodeDescriber, spanChannel, subscribeTestFailures, tracePromise, traceSync, tracing, type SpanContext, } from "./trace.js";
|
|
22
22
|
export { dispatch, getCurrentEvent, retarget, nodeGetTheParent, setAssignedSlotLookup } from "./events/dispatch.js";
|
|
23
23
|
export { fireAnEvent, dispatchTrusted, fireSyntheticPointerEvent } from "./events/fire.js";
|
|
@@ -26,7 +26,8 @@ export { reportException, setUncaughtExceptionHandler, type UncaughtExceptionHan
|
|
|
26
26
|
export { setNotImplementedHandler, type NotImplementedError, type NotImplementedHandler, } from "./window/not-implemented.js";
|
|
27
27
|
export { createEvent } from "./events/createEvent.js";
|
|
28
28
|
export { installEventHandlers, getEventHandler, setEventHandler, GLOBAL_EVENT_HANDLER_EVENTS, WINDOW_EVENT_HANDLER_EVENTS, type EventHandlersKind, } from "./events/handlers.js";
|
|
29
|
-
export { hasListeners, removeAllEventListeners } from "./events/listeners.js";
|
|
29
|
+
export { hasListeners, listenerCount, removeAllEventListeners, reusableElement } from "./events/listeners.js";
|
|
30
|
+
export { registerTestHooks, resetWindowBetweenFiles, testHooks, type TestLibraryHooks } from "./window/file-reset.js";
|
|
30
31
|
export type { ActivationTarget } from "./events/activation.js";
|
|
31
32
|
export { NodeList } from "./collections/NodeList.js";
|
|
32
33
|
export { HTMLCollection, withNamedProperties, ensureCollectionIndexGetters, type ElementFilter, } from "./collections/HTMLCollection.js";
|
package/dist/dom/types/keys.d.ts
CHANGED
|
@@ -5,18 +5,20 @@ export declare const $assocGen: unique symbol;
|
|
|
5
5
|
export declare const $attr: unique symbol;
|
|
6
6
|
export declare const $attributes: unique symbol;
|
|
7
7
|
export declare const $availableToElementInternals: unique symbol;
|
|
8
|
-
export declare const $badInput: unique symbol;
|
|
9
8
|
export declare const $baseFor: unique symbol;
|
|
10
9
|
export declare const $baseOverride: unique symbol;
|
|
11
10
|
export declare const $baseURL: unique symbol;
|
|
12
11
|
export declare const $baseVersion: unique symbol;
|
|
12
|
+
/** Document: how many of its version bumps could not change a computed style (css/style-deps.ts). */
|
|
13
|
+
export declare const $benign: unique symbol;
|
|
13
14
|
export declare const $block: unique symbol;
|
|
15
|
+
/** CSSStyleRule: its declaration block once parsed, and its text until then (css/cssom.ts). */
|
|
16
|
+
export declare const $blockParsed: unique symbol;
|
|
17
|
+
export declare const $blockText: unique symbol;
|
|
14
18
|
export declare const $byCtor: unique symbol;
|
|
15
19
|
export declare const $byName: unique symbol;
|
|
16
20
|
export declare const $cache: unique symbol;
|
|
17
21
|
export declare const $callback: unique symbol;
|
|
18
|
-
export declare const $checked: unique symbol;
|
|
19
|
-
export declare const $checkedSet: unique symbol;
|
|
20
22
|
export declare const $childNodes: unique symbol;
|
|
21
23
|
export declare const $childWindows: unique symbol;
|
|
22
24
|
export declare const $children: unique symbol;
|
|
@@ -49,8 +51,8 @@ export declare const $defaultValueOverride: unique symbol;
|
|
|
49
51
|
export declare const $delegatesFocus: unique symbol;
|
|
50
52
|
export declare const $devicePixelRatio: unique symbol;
|
|
51
53
|
export declare const $dirtiness: unique symbol;
|
|
52
|
-
|
|
53
|
-
export declare const $
|
|
54
|
+
/** An input's or textarea's ControlState (html/forms/control-state.ts). */
|
|
55
|
+
export declare const $control: unique symbol;
|
|
54
56
|
export declare const $disabled: unique symbol;
|
|
55
57
|
export declare const $disallowModification: unique symbol;
|
|
56
58
|
export declare const $derived: unique symbol;
|
|
@@ -70,6 +72,8 @@ export declare const $filter: unique symbol;
|
|
|
70
72
|
export declare const $firingSubmissionEvents: unique symbol;
|
|
71
73
|
export declare const $focused: unique symbol;
|
|
72
74
|
export declare const $form: unique symbol;
|
|
75
|
+
/** Document: an element of it has had a `form` attribute (sticky; html/forms/form-associated.ts formOwnerScope). */
|
|
76
|
+
export declare const $formAttrSeen: unique symbol;
|
|
73
77
|
export declare const $forLabels: unique symbol;
|
|
74
78
|
export declare const $forms: unique symbol;
|
|
75
79
|
export declare const $frameCallbacks: unique symbol;
|
|
@@ -91,7 +95,6 @@ export declare const $idleId: unique symbol;
|
|
|
91
95
|
export declare const $ids: unique symbol;
|
|
92
96
|
export declare const $impl: unique symbol;
|
|
93
97
|
export declare const $implementation: unique symbol;
|
|
94
|
-
export declare const $indeterminate: unique symbol;
|
|
95
98
|
export declare const $index: unique symbol;
|
|
96
99
|
export declare const $indexed: unique symbol;
|
|
97
100
|
export declare const $inflight: unique symbol;
|
|
@@ -130,19 +133,14 @@ export declare const $parentRule: unique symbol;
|
|
|
130
133
|
export declare const $parentWindow: unique symbol;
|
|
131
134
|
export declare const $pastNames: unique symbol;
|
|
132
135
|
export declare const $pointerBeforeReference: unique symbol;
|
|
133
|
-
export declare const $preApplied: unique symbol;
|
|
134
|
-
export declare const $preChecked: unique symbol;
|
|
135
|
-
export declare const $preCheckedRadio: unique symbol;
|
|
136
|
-
export declare const $preIndeterminate: unique symbol;
|
|
137
136
|
export declare const $prefix: unique symbol;
|
|
138
137
|
export declare const $prelude: unique symbol;
|
|
139
138
|
export declare const $presentationStyle: unique symbol;
|
|
140
139
|
export declare const $pseudo: unique symbol;
|
|
141
140
|
export declare const $queries: unique symbol;
|
|
141
|
+
export declare const $radios: unique symbol;
|
|
142
142
|
export declare const $ranges: unique symbol;
|
|
143
|
-
export declare const $rawValue: unique symbol;
|
|
144
143
|
export declare const $readonly: unique symbol;
|
|
145
|
-
export declare const $radios: unique symbol;
|
|
146
144
|
export declare const $readyState: unique symbol;
|
|
147
145
|
export declare const $rebuildVersion: unique symbol;
|
|
148
146
|
export declare const $record: unique symbol;
|
|
@@ -159,10 +157,7 @@ export declare const $screen: unique symbol;
|
|
|
159
157
|
export declare const $scrollRestoration: unique symbol;
|
|
160
158
|
export declare const $scrollX: unique symbol;
|
|
161
159
|
export declare const $scrollY: unique symbol;
|
|
162
|
-
export declare const $selDir: unique symbol;
|
|
163
|
-
export declare const $selEnd: unique symbol;
|
|
164
160
|
export declare const $selSet: unique symbol;
|
|
165
|
-
export declare const $selStart: unique symbol;
|
|
166
161
|
export declare const $selectedOptions: unique symbol;
|
|
167
162
|
export declare const $selectedness: unique symbol;
|
|
168
163
|
export declare const $selection: unique symbol;
|
|
@@ -189,13 +184,11 @@ export declare const $title: unique symbol;
|
|
|
189
184
|
export declare const $treeVersion: unique symbol;
|
|
190
185
|
export declare const $type: unique symbol;
|
|
191
186
|
export declare const $types: unique symbol;
|
|
192
|
-
export declare const $uiValue: unique symbol;
|
|
193
187
|
export declare const $updating: unique symbol;
|
|
194
188
|
export declare const $updatingSelectedContent: unique symbol;
|
|
195
189
|
export declare const $uri: unique symbol;
|
|
196
190
|
export declare const $url: unique symbol;
|
|
197
191
|
export declare const $userActivation: unique symbol;
|
|
198
|
-
export declare const $userEdited: unique symbol;
|
|
199
192
|
export declare const $userValidity: unique symbol;
|
|
200
193
|
export declare const $validity: unique symbol;
|
|
201
194
|
export declare const $value: unique symbol;
|
|
@@ -14,7 +14,7 @@ import type { Window } from "../window/Window.js";
|
|
|
14
14
|
import type { NodeList } from "../collections/NodeList.js";
|
|
15
15
|
import type { ElementCreationOptions } from "../webidl.js";
|
|
16
16
|
import type { Event } from "../events/Event.js";
|
|
17
|
-
import { $aboutBase, $baseFor, $baseOverride, $baseURL, $baseVersion, $contentType, $css, $derived, $doc, $focused, $forLabels, $forms, $ids, $implementation, $isHTML, $mode, $radios, $ranges, $selection, $styleVersion, $treeVersion, $url, $version, $window, $writeBuffer } from "../keys.js";
|
|
17
|
+
import { $aboutBase, $baseFor, $baseOverride, $baseURL, $baseVersion, $benign, $contentType, $css, $derived, $doc, $focused, $forLabels, $formAttrSeen, $forms, $ids, $implementation, $isHTML, $mode, $radios, $ranges, $selection, $styleVersion, $treeVersion, $url, $version, $window, $writeBuffer } from "../keys.js";
|
|
18
18
|
export declare class Document extends Node {
|
|
19
19
|
/** Browsing context's window, or null for documents created via DOMImplementation / new Document(). */
|
|
20
20
|
[$window]: Window | null;
|
|
@@ -27,6 +27,8 @@ export declare class Document extends Node {
|
|
|
27
27
|
[$treeVersion]: number;
|
|
28
28
|
/** Bumped when author style sheets change (src/css). */
|
|
29
29
|
[$styleVersion]: number;
|
|
30
|
+
/** Version bumps that left every computed style as it was (css/style-deps.ts). */
|
|
31
|
+
[$benign]: number;
|
|
30
32
|
/** Connected elements by id. A value is an array only when several connected elements share an id. */
|
|
31
33
|
[$ids]: Map<string, NodeImpl | NodeImpl[]>;
|
|
32
34
|
/** Focused element (https://html.spec.whatwg.org/#focused-area-of-the-document), null = viewport/body. */
|
|
@@ -56,12 +58,14 @@ export declare class Document extends Node {
|
|
|
56
58
|
* an ID without walking the tree.
|
|
57
59
|
*/
|
|
58
60
|
[$forLabels]: Map<string, NodeImpl[]> | null;
|
|
61
|
+
/** An element of this document has had a `form` attribute (never reset): formOwnerScope. */
|
|
62
|
+
[$formAttrSeen]: boolean;
|
|
59
63
|
/**
|
|
60
64
|
* Connected radio buttons with a non-empty name, by name, each list in no particular order, or
|
|
61
65
|
* null before the first (html/forms/HTMLInputElement.ts). A radio's group is looked up here
|
|
62
66
|
* instead of walking the tree.
|
|
63
67
|
*/
|
|
64
|
-
[$radios]: Map<string, NodeImpl
|
|
68
|
+
[$radios]: Map<string, Set<NodeImpl>> | null;
|
|
65
69
|
/** document.forms (named-properties proxy), created on first read. */
|
|
66
70
|
[$forms]: HTMLCollection | null;
|
|
67
71
|
/** https://html.spec.whatwg.org/#concept-document-about-base-url (about:blank / about:srcdoc documents of nested browsing contexts). */
|
|
@@ -111,12 +111,6 @@ export declare class Element extends Node {
|
|
|
111
111
|
scrollTo(_x?: unknown, _y?: number): void;
|
|
112
112
|
scrollBy(_x?: unknown, _y?: number): void;
|
|
113
113
|
scrollIntoView(_arg?: unknown): void;
|
|
114
|
-
/**
|
|
115
|
-
* Activation behavior (events/activation.ts): none unless a subclass overrides it. Defined here
|
|
116
|
-
* so dispatch reading it on every click's path is a prototype hit, not (on a <form>) a named
|
|
117
|
-
* property lookup through the form's controls.
|
|
118
|
-
*/
|
|
119
|
-
get _hasActivationBehavior(): boolean;
|
|
120
114
|
/** Runs when this element becomes connected. Only called when F_CONNECT_HOOK is set. */
|
|
121
115
|
_connectedSteps(): void;
|
|
122
116
|
/** Runs when this element becomes disconnected. Only called when F_CONNECT_HOOK is set. */
|
|
@@ -140,7 +134,7 @@ export interface Element extends ParentNode, ChildNode, NonDocumentTypeChildNode
|
|
|
140
134
|
/** https://dom.spec.whatwg.org/#concept-attach-a-shadow-root */
|
|
141
135
|
export declare function attachShadowRoot(element: Element, mode: "open" | "closed", clonable: boolean, serializable: boolean, delegatesFocus: boolean, slotAssignment: "named" | "manual"): ShadowRoot;
|
|
142
136
|
/** `structural`: `filter` reads only tag names and namespaces (HTMLCollection's module comment). */
|
|
143
|
-
export declare function cachedCollection(root: NodeImpl, key: string, filter: ((el: NodeImpl) => boolean) | null
|
|
137
|
+
export declare function cachedCollection(root: NodeImpl, key: string, structural: boolean, filter: ((el: NodeImpl) => boolean) | null): HTMLCollection;
|
|
144
138
|
/** https://dom.spec.whatwg.org/#concept-getelementsbytagname */
|
|
145
139
|
export declare function getElementsByTagName(root: NodeImpl, qualifiedName: string): HTMLCollection;
|
|
146
140
|
/** https://dom.spec.whatwg.org/#concept-getelementsbytagnamens */
|
|
@@ -97,7 +97,10 @@ export declare abstract class Node extends EventTarget {
|
|
|
97
97
|
appendChild<T extends Node>(node: T): T;
|
|
98
98
|
replaceChild<T extends Node>(node: Node, child: T): T;
|
|
99
99
|
removeChild<T extends Node>(child: T): T;
|
|
100
|
-
/**
|
|
100
|
+
/**
|
|
101
|
+
* https://dom.spec.whatwg.org/#get-the-parent — the dispatch algorithm inlines this for every
|
|
102
|
+
* node but a Document (events/dispatch.ts), so no other Node subclass may override it.
|
|
103
|
+
*/
|
|
101
104
|
_getTheParent(event: Event): import("../events/EventTarget.js").EventTarget | null;
|
|
102
105
|
/** @internal Used by textContent/innerHTML setters. */
|
|
103
106
|
_replaceAll(node: Node | null): void;
|
|
@@ -15,7 +15,7 @@ export declare function getAttribute(el: NodeImpl, qualifiedName: string): strin
|
|
|
15
15
|
/**
|
|
16
16
|
* The presence bit an attribute local name sets on its element: F_ARIA_ATTRS / F_DATA_ATTRS for
|
|
17
17
|
* names starting with `aria-` / `data-`, F_TABINDEX_ATTR, F_CONTENTEDITABLE_ATTR or F_INERT_ATTR
|
|
18
|
-
* for those names, else 0.
|
|
18
|
+
* for those names, F_FORM_ATTR for `form`, else 0.
|
|
19
19
|
*/
|
|
20
20
|
export declare function prefixFlag(localName: string): number;
|
|
21
21
|
/**
|
|
@@ -32,10 +32,32 @@ export declare function setAttribute(el: NodeImpl, qualifiedName: string, value:
|
|
|
32
32
|
export declare function changeAttribute(el: NodeImpl, a: AttrRecord, value: string): void;
|
|
33
33
|
/** https://dom.spec.whatwg.org/#concept-element-attributes-append */
|
|
34
34
|
export declare function appendAttribute(el: NodeImpl, a: AttrRecord): void;
|
|
35
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* https://dom.spec.whatwg.org/#concept-element-attributes-remove
|
|
37
|
+
*
|
|
38
|
+
* The list is rebuilt at its exact new size in the pass that drops the record (see `addRecord`;
|
|
39
|
+
* `indexOf` + `splice` kept the old backing store and cost about twice as much), and the same
|
|
40
|
+
* pass learns whether another attribute still holds the removed name's presence flag. An
|
|
41
|
+
* element whose last attribute goes returns to `attrs === null`, the state it was created in.
|
|
42
|
+
*/
|
|
36
43
|
export declare function removeAttributeRecord(el: NodeImpl, a: AttrRecord): void;
|
|
37
44
|
/** removeAttribute(qualifiedName) */
|
|
38
45
|
export declare function removeAttribute(el: NodeImpl, qualifiedName: string): AttrRecord | null;
|
|
46
|
+
/**
|
|
47
|
+
* https://dom.spec.whatwg.org/#concept-element-attributes-get-by-namespace with a null
|
|
48
|
+
* namespace: the record behind reflected IDL attributes (html/reflect.ts `contentAttr` reads the
|
|
49
|
+
* value the same way).
|
|
50
|
+
*/
|
|
51
|
+
export declare function findAttributeByLocalName(el: NodeImpl, localName: string): AttrRecord | null;
|
|
52
|
+
/**
|
|
53
|
+
* https://dom.spec.whatwg.org/#concept-element-attributes-set-value with a null namespace and
|
|
54
|
+
* prefix: what reflected IDL setters (`el.name = ...`, `el.id = ...`) do. Unlike `setAttribute`
|
|
55
|
+
* it matches by namespace and local name, so a namespaced attribute with the same local name is
|
|
56
|
+
* left alone (as in jsdom), and the name needs neither validation nor lowercasing.
|
|
57
|
+
*/
|
|
58
|
+
export declare function setAttributeValue(el: NodeImpl, localName: string, value: string): void;
|
|
59
|
+
/** https://dom.spec.whatwg.org/#concept-element-attributes-remove-by-namespace with a null namespace. */
|
|
60
|
+
export declare function removeAttributeByLocalName(el: NodeImpl, localName: string): void;
|
|
39
61
|
/**
|
|
40
62
|
* https://dom.spec.whatwg.org/#handle-attribute-changes plus this implementation's core
|
|
41
63
|
* attribute bookkeeping (id index, class token cache, style flag, document version).
|
|
@@ -21,7 +21,7 @@ export declare class NodeCache {
|
|
|
21
21
|
nameVersion: number;
|
|
22
22
|
/** Accessible name. */
|
|
23
23
|
name: string;
|
|
24
|
-
/** `Document._version` at which `style` was computed. */
|
|
24
|
+
/** `Document._version` less its benign bumps (css/style-deps.ts) at which `style` was computed. */
|
|
25
25
|
styleVersion: number;
|
|
26
26
|
/** `Document._styleVersion` at which `style` was computed. */
|
|
27
27
|
styleSheetVersion: number;
|
|
@@ -67,3 +67,8 @@ export declare const F_DATA_ATTRS: number;
|
|
|
67
67
|
export declare const F_TABINDEX_ATTR: number;
|
|
68
68
|
export declare const F_CONTENTEDITABLE_ATTR: number;
|
|
69
69
|
export declare const F_INERT_ATTR: number;
|
|
70
|
+
/**
|
|
71
|
+
* Element has a `form` attribute, kept like F_ARIA_ATTRS. A document that never held one
|
|
72
|
+
* (Document[$formAttrSeen]) has no form whose controls lie outside it (html/forms/form-associated.ts).
|
|
73
|
+
*/
|
|
74
|
+
export declare const F_FORM_ATTR: number;
|
|
@@ -15,9 +15,9 @@ export declare function append(node: NodeImpl, parent: NodeImpl): NodeImpl;
|
|
|
15
15
|
/** https://dom.spec.whatwg.org/#concept-node-insert */
|
|
16
16
|
export declare function insert(node: NodeImpl, parent: NodeImpl, child: NodeImpl | null, suppressObservers: boolean): void;
|
|
17
17
|
/**
|
|
18
|
-
* For connected steps: the root of the subtree being connected. Its
|
|
19
|
-
*
|
|
20
|
-
* runs
|
|
18
|
+
* For connected steps: the root of the subtree (or shadow tree) being connected, else null. Its
|
|
19
|
+
* nodes after the current one are in the tree but not connected yet, while
|
|
20
|
+
* https://dom.spec.whatwg.org/#concept-node-insert runs every insertion step with all of them in.
|
|
21
21
|
*/
|
|
22
22
|
export declare function connectingRoot(): NodeImpl | null;
|
|
23
23
|
/**
|
|
@@ -143,6 +143,14 @@ export declare function ancestorHashes(cx: CComplex): number[];
|
|
|
143
143
|
* Every match is then a descendant of the element with that id. "" when there is none.
|
|
144
144
|
*/
|
|
145
145
|
export declare function idRootOf(list: CList): string;
|
|
146
|
+
/** Calls `visit` with the name (as written and lowercased) of every attribute selector in `cx`, nested lists included. */
|
|
147
|
+
export declare function attributeNamesIn(cx: CComplex, visit: (name: string) => void): void;
|
|
148
|
+
/**
|
|
149
|
+
* The type selector every match of `list` must satisfy, or null: a single complex selector whose
|
|
150
|
+
* subject compound names an element type in any namespace (`input[name="a"][type="radio"]`,
|
|
151
|
+
* `form > button.primary`).
|
|
152
|
+
*/
|
|
153
|
+
export declare function subjectType(list: CList): Test | null;
|
|
146
154
|
/** Fast-path shapes for querySelector(All): a single complex with one compound of one test. */
|
|
147
155
|
export declare const FAST_NONE = 0;
|
|
148
156
|
export declare const FAST_ALL = 1;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { NodeImpl } from "../nodes/NodeImpl.js";
|
|
2
2
|
import { type NamespaceContext } from "./serialize.js";
|
|
3
|
-
import { type CComplex, CompileInfo,
|
|
3
|
+
import { type CComplex, CompileInfo, KEY_CLASS, KEY_ID, KEY_NONE, KEY_TAG, packSpecificity, unpackSpecificity } from "./compile.js";
|
|
4
4
|
import { $cx, $info } from "../keys.js";
|
|
5
5
|
export { KEY_NONE, KEY_ID, KEY_CLASS, KEY_TAG, packSpecificity, unpackSpecificity };
|
|
6
6
|
export { buildAncestorFilter, mayMatchAncestors } from "./filter.js";
|
|
@@ -39,6 +39,8 @@ export declare class CompiledSelector {
|
|
|
39
39
|
/** Specificity as an (a, b, c) tuple. */
|
|
40
40
|
get specificityTuple(): [number, number, number];
|
|
41
41
|
}
|
|
42
|
+
/** Calls `visit` with the name of every attribute selector in `selector` (as written and lowercased). */
|
|
43
|
+
export declare function selectorAttributeNames(selector: CompiledSelector, visit: (name: string) => void): void;
|
|
42
44
|
export interface CompiledSelectorList {
|
|
43
45
|
readonly text: string;
|
|
44
46
|
/** CSSOM serialization (https://drafts.csswg.org/cssom/#serialize-a-group-of-selectors), for selectorText. */
|
|
@@ -113,6 +113,8 @@ export declare class VirtualClock {
|
|
|
113
113
|
toVirtualTrack(record: TimerRecord): void;
|
|
114
114
|
fireReal(record: TimerRecord): void;
|
|
115
115
|
_refresh(record: TimerRecord): void;
|
|
116
|
+
/** Drop every pending timer; the clock goes on (a test file ended in a worker the next one shares). */
|
|
117
|
+
clearAll(): void;
|
|
116
118
|
dispose(): void;
|
|
117
119
|
/** Keep one real host timer armed for the earliest due timer (ref'd while any timer is). */
|
|
118
120
|
armHost(): void;
|
|
@@ -198,8 +200,36 @@ export declare function isClockTimer(fn: unknown): boolean;
|
|
|
198
200
|
* 5 ms slice. Without a clock every queued immediate counts.
|
|
199
201
|
*/
|
|
200
202
|
export declare function foreignImmediatesPending(): boolean;
|
|
203
|
+
/**
|
|
204
|
+
* A macrotask boundary for a caller that yields so pending work can run, and has nothing of its
|
|
205
|
+
* own to wait for: user-event between two actions and at the end of a call, Testing Library's
|
|
206
|
+
* asyncWrapper drain. `resolve` runs where a `setImmediate(resolve)` would have run it, without
|
|
207
|
+
* the event-loop turn when that turn has nothing else to do.
|
|
208
|
+
*
|
|
209
|
+
* A turn costs Node ~12.6 µs here even when empty (libuv polls for I/O on every one), and
|
|
210
|
+
* user-event takes two to four per call: half of a `user.click()`. What a turn does for such a
|
|
211
|
+
* caller is finish the microtasks (and process.nextTick callbacks) queued so far, with everything
|
|
212
|
+
* they queue in turn, then run timers that are due, I/O that is ready and the immediates queued
|
|
213
|
+
* before the caller's. So:
|
|
214
|
+
*
|
|
215
|
+
* - `resolve` is called from a process.nextTick callback queued from a microtask. Node runs its
|
|
216
|
+
* tick queue only once V8's microtask queue is empty (processTicksAndRejections in
|
|
217
|
+
* lib/internal/process/task_queues.js), so every microtask queued before, and every one those
|
|
218
|
+
* queued, has run by then, as at the end of a macrotask.
|
|
219
|
+
* - There, the loop must be idle as the driver sees it (busy(): no immediate but the clock's own,
|
|
220
|
+
* which covers React's scheduler; no I/O resource beyond the baseline) with no timer of the
|
|
221
|
+
* clock's due. Otherwise the caller gets its real turn.
|
|
222
|
+
* - Every MAX_TURNLESS_MS of real time a real turn is taken regardless, so Node's own timers (the
|
|
223
|
+
* test runner's timeout for a test that loops forever on `await user.click()`), unref'd timers
|
|
224
|
+
* and the runner's messages are never starved.
|
|
225
|
+
*
|
|
226
|
+
* Without a clock that skips idle time: `setImmediate(resolve)`.
|
|
227
|
+
*/
|
|
228
|
+
export declare function loopTurn(resolve: () => void): void;
|
|
201
229
|
/** Milliseconds the active clock has skipped (0 without one): what a traced span reads at start and end. */
|
|
202
230
|
export declare function clockSkipped(): number;
|
|
231
|
+
/** Drop the active clock's pending timers (window/file-reset.ts); nothing without one. */
|
|
232
|
+
export declare function clearActiveClockTimers(): void;
|
|
203
233
|
/** The active clock's skipped time and pending timers (for test observability), or null without one. */
|
|
204
234
|
export declare function clockStats(): {
|
|
205
235
|
skippedMs: number;
|