@ctrl/dom 0.1.15 → 0.3.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.
Files changed (74) hide show
  1. package/README.md +44 -0
  2. package/dist/bridge/index.js +1 -1
  3. package/dist/bridge/internal.js +1 -1
  4. package/dist/dom/_chunks/src-u_GjEFAe.js +49 -0
  5. package/dist/dom/index.js +1 -1
  6. package/dist/dom/internal.js +1 -1
  7. package/dist/dom/types/css/cascade.d.ts +10 -3
  8. package/dist/dom/types/css/cssom.d.ts +9 -3
  9. package/dist/dom/types/css/parser.d.ts +27 -0
  10. package/dist/dom/types/css/style-deps.d.ts +11 -0
  11. package/dist/dom/types/events/listeners.d.ts +24 -2
  12. package/dist/dom/types/html/elements.d.ts +3 -2
  13. package/dist/dom/types/html/forms/HTMLButtonElement.d.ts +4 -3
  14. package/dist/dom/types/html/forms/HTMLFieldSetElement.d.ts +3 -2
  15. package/dist/dom/types/html/forms/HTMLInputElement.d.ts +11 -36
  16. package/dist/dom/types/html/forms/HTMLOutputElement.d.ts +6 -5
  17. package/dist/dom/types/html/forms/HTMLSelectElement.d.ts +6 -5
  18. package/dist/dom/types/html/forms/HTMLTextAreaElement.d.ts +10 -15
  19. package/dist/dom/types/html/forms/control-state.d.ts +33 -0
  20. package/dist/dom/types/html/forms/face.d.ts +3 -2
  21. package/dist/dom/types/html/forms/form-associated.d.ts +15 -3
  22. package/dist/dom/types/html/forms/user-validity.d.ts +2 -2
  23. package/dist/dom/types/html/forms/validation.d.ts +2 -2
  24. package/dist/dom/types/index.d.ts +2 -0
  25. package/dist/dom/types/internal.d.ts +3 -2
  26. package/dist/dom/types/keys.d.ts +9 -19
  27. package/dist/dom/types/nodes/Document.d.ts +15 -2
  28. package/dist/dom/types/nodes/attributes.d.ts +1 -1
  29. package/dist/dom/types/nodes/cache.d.ts +1 -1
  30. package/dist/dom/types/nodes/constants.d.ts +5 -0
  31. package/dist/dom/types/selectors/compile.d.ts +8 -0
  32. package/dist/dom/types/selectors/internal.d.ts +3 -1
  33. package/dist/dom/types/webidl-runtime.d.ts +12 -0
  34. package/dist/dom/types/window/clock.d.ts +30 -0
  35. package/dist/dom/types/window/file-reset.d.ts +22 -0
  36. package/dist/dom/types/window/geometry.d.ts +138 -14
  37. package/dist/dom/types/window/quad.d.ts +35 -0
  38. package/dist/jest-dom/_chunks/{matchers-CkxM783o.cjs → matchers-CZ6Smfw9.cjs} +2 -2
  39. package/dist/jest-dom/_chunks/{matchers-Dt7W4g5X.js → matchers-CwGF61j-.js} +2 -2
  40. package/dist/jest-dom/index.cjs +1 -1
  41. package/dist/jest-dom/index.js +1 -1
  42. package/dist/jest-dom/jest-globals.cjs +1 -1
  43. package/dist/jest-dom/jest-globals.js +1 -1
  44. package/dist/jest-dom/matchers.cjs +1 -1
  45. package/dist/jest-dom/matchers.js +1 -1
  46. package/dist/jest-dom/vitest.cjs +1 -1
  47. package/dist/jest-dom/vitest.js +1 -1
  48. package/dist/react/_chunks/pure-CYb0HgYU.js +1 -0
  49. package/dist/react/_chunks/pure-DRugbA0j.cjs +1 -0
  50. package/dist/react/index.cjs +1 -1
  51. package/dist/react/index.js +1 -1
  52. package/dist/react/pure.cjs +1 -1
  53. package/dist/react/pure.js +1 -1
  54. package/dist/testing-library/index.cjs +2 -2
  55. package/dist/testing-library/index.js +7 -7
  56. package/dist/user-event/index.cjs +15 -15
  57. package/dist/user-event/index.js +15 -15
  58. package/dist/user-event/types/ctrl-dom.d.ts +8 -0
  59. package/dist/vitest-environment/_chunks/rolldown-runtime-H3fMLYWS.js +1 -0
  60. package/dist/vitest-environment/failure-snapshot.js +1 -1
  61. package/dist/vitest-environment/index.js +1 -1
  62. package/dist/vitest-environment/jsx-dev-runtime.js +1 -0
  63. package/dist/vitest-environment/jsx-runtime.js +1 -0
  64. package/dist/vitest-environment/plugin.js +1 -1
  65. package/dist/vitest-environment/shared-workers.js +1 -0
  66. package/dist/vitest-environment/types/jsx-dev-runtime.d.ts +3 -0
  67. package/dist/vitest-environment/types/jsx-runtime.d.ts +4 -0
  68. package/dist/vitest-environment/types/plugin.d.ts +19 -0
  69. package/dist/vitest-environment/types/shared-workers.d.ts +1 -0
  70. package/package.json +13 -1
  71. package/dist/dom/_chunks/src-C4oa-U7z.js +0 -49
  72. package/dist/react/_chunks/pure-D7Z4g4oF.js +0 -1
  73. package/dist/react/_chunks/pure-DOgNQrwu.cjs +0 -1
  74. package/dist/vitest-environment/_chunks/rolldown-runtime-BhWHdk3m.js +0 -1
@@ -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]: string;
16
- [$validity]: ValidityState | null;
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 */
@@ -33,6 +33,8 @@ export { MediaQueryListEvent } from "./window/events.js";
33
33
  export { DOMParser, XMLSerializer } from "./window/fallbacks.js";
34
34
  export { ResizeObserver, IntersectionObserver } from "./window/observers.js";
35
35
  export { DOMPointReadOnly, DOMPoint, DOMRectReadOnly, DOMRect, DOMRectList, DOMMatrixReadOnly, DOMMatrix, type DOMRectInit, } from "./window/geometry.js";
36
+ export { DOMMatrix as WebKitCSSMatrix } from "./window/geometry.js";
37
+ export { DOMQuad, type DOMQuadInit } from "./window/quad.js";
36
38
  export { Event } from "./events/Event.js";
37
39
  export { UIEvent, FocusEvent, MouseEvent, PointerEvent, WheelEvent, DragEvent, KeyboardEvent, InputEvent, CompositionEvent, TextEvent, Touch, TouchList, TouchEvent, ClipboardEvent, } from "./events/UIEvents.js";
38
40
  export { CustomEvent, ErrorEvent, PromiseRejectionEvent, MessageEvent, ProgressEvent, AnimationEvent, TransitionEvent, PopStateEvent, HashChangeEvent, PageTransitionEvent, StorageEvent, SubmitEvent, FormDataEvent, ToggleEvent, BeforeUnloadEvent, CloseEvent, } from "./events/events.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";
@@ -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
- export declare const $dirtyChecked: unique symbol;
53
- export declare const $dirtyValue: unique symbol;
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,14 +95,12 @@ 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;
98
101
  export declare const $info: unique symbol;
99
102
  export declare const $innerHeight: unique symbol;
100
103
  export declare const $innerWidth: unique symbol;
101
- export declare const $is2D: unique symbol;
102
104
  export declare const $isHTML: unique symbol;
103
105
  export declare const $items: unique symbol;
104
106
  export declare const $keyText: unique symbol;
@@ -110,7 +112,6 @@ export declare const $listeners: unique symbol;
110
112
  export declare const $localStorage: unique symbol;
111
113
  export declare const $location: unique symbol;
112
114
  export declare const $lockedForReset: unique symbol;
113
- export declare const $m: unique symbol;
114
115
  export declare const $matches: unique symbol;
115
116
  export declare const $media: unique symbol;
116
117
  export declare const $mediaQueryLists: unique symbol;
@@ -130,10 +131,6 @@ export declare const $parentRule: unique symbol;
130
131
  export declare const $parentWindow: unique symbol;
131
132
  export declare const $pastNames: unique symbol;
132
133
  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
134
  export declare const $prefix: unique symbol;
138
135
  export declare const $prelude: unique symbol;
139
136
  export declare const $presentationStyle: unique symbol;
@@ -141,13 +138,11 @@ export declare const $pseudo: unique symbol;
141
138
  export declare const $queries: unique symbol;
142
139
  export declare const $radios: unique symbol;
143
140
  export declare const $ranges: unique symbol;
144
- export declare const $rawValue: unique symbol;
145
141
  export declare const $readonly: unique symbol;
146
142
  export declare const $readyState: unique symbol;
147
143
  export declare const $rebuildVersion: unique symbol;
148
144
  export declare const $record: unique symbol;
149
145
  export declare const $records: unique symbol;
150
- export declare const $rects: unique symbol;
151
146
  export declare const $reference: unique symbol;
152
147
  export declare const $result: unique symbol;
153
148
  export declare const $root: unique symbol;
@@ -159,10 +154,7 @@ export declare const $screen: unique symbol;
159
154
  export declare const $scrollRestoration: unique symbol;
160
155
  export declare const $scrollX: unique symbol;
161
156
  export declare const $scrollY: unique symbol;
162
- export declare const $selDir: unique symbol;
163
- export declare const $selEnd: unique symbol;
164
157
  export declare const $selSet: unique symbol;
165
- export declare const $selStart: unique symbol;
166
158
  export declare const $selectedOptions: unique symbol;
167
159
  export declare const $selectedness: unique symbol;
168
160
  export declare const $selection: unique symbol;
@@ -189,13 +181,11 @@ export declare const $title: unique symbol;
189
181
  export declare const $treeVersion: unique symbol;
190
182
  export declare const $type: unique symbol;
191
183
  export declare const $types: unique symbol;
192
- export declare const $uiValue: unique symbol;
193
184
  export declare const $updating: unique symbol;
194
185
  export declare const $updatingSelectedContent: unique symbol;
195
186
  export declare const $uri: unique symbol;
196
187
  export declare const $url: unique symbol;
197
188
  export declare const $userActivation: unique symbol;
198
- export declare const $userEdited: unique symbol;
199
189
  export declare const $userValidity: unique symbol;
200
190
  export declare const $validity: unique symbol;
201
191
  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[]> | null;
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). */
@@ -141,6 +145,15 @@ export declare class Document extends Node {
141
145
  createTreeWalker(root: Node, whatToShow?: number, filter?: NodeFilterArg): TreeWalker;
142
146
  /** https://dom.spec.whatwg.org/#dom-document-createnodeiterator */
143
147
  createNodeIterator(root: Node, whatToShow?: number, filter?: NodeFilterArg): NodeIterator;
148
+ /**
149
+ * https://drafts.csswg.org/cssom-view/#dom-document-elementfrompoint — the DocumentOrShadowRoot
150
+ * hit test (ShadowRoot.ts has the same pair). With no layout there is no box at any point, so
151
+ * the result is null, as for a point outside the viewport. jsdom has neither method
152
+ * (window/compat.ts).
153
+ */
154
+ elementFromPoint(_x: number, _y: number): Element | null;
155
+ /** https://drafts.csswg.org/cssom-view/#dom-document-elementsfrompoint — an empty sequence, as above. */
156
+ elementsFromPoint(_x: number, _y: number): Element[];
144
157
  /** https://w3c.github.io/selection-api/#dom-document-getselection */
145
158
  getSelection(): Selection | null;
146
159
  /**
@@ -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
  /**
@@ -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;
@@ -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, unpackSpecificity, packSpecificity, KEY_NONE, KEY_ID, KEY_CLASS, KEY_TAG } from "./compile.js";
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. */
@@ -3,6 +3,18 @@ type Ctor = {
3
3
  };
4
4
  /** Make the public members of each interface prototype enumerable (one-time, at module load). */
5
5
  export declare function exposeMembers(...ctors: Ctor[]): void;
6
+ /**
7
+ * Give an interface object what class syntax gets wrong (one-time, at module load):
8
+ * - @@toStringTag on the prototype, so `Object.prototype.toString` gives `[object Name]`
9
+ * (https://webidl.spec.whatwg.org/#dfn-class-string);
10
+ * - each operation's and the constructor's `length`: the number of required arguments
11
+ * (https://webidl.spec.whatwg.org/#es-operations, https://webidl.spec.whatwg.org/#es-interface-call),
12
+ * where TypeScript `x?: T` parameters would count. `required` maps operation names (and
13
+ * "constructor") to their required-argument count; every other operation gets 0.
14
+ */
15
+ export declare function defineInterfaceShape(ctor: Ctor & {
16
+ name: string;
17
+ }, required?: Readonly<Record<string, number>>): void;
6
18
  /**
7
19
  * Make an instance's internal own fields (`_`-prefixed or symbol-keyed, see keys.ts)
8
20
  * non-enumerable, so spreads and Jest's symbol-aware equality skip them too. Call at the end of
@@ -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;
@@ -0,0 +1,22 @@
1
+ import type { Window } from "./Window.js";
2
+ /**
3
+ * What a testing library does around tests, for a runner hook to call. A library registers these
4
+ * when it is loaded, under the conditions it would register the runner's own hooks; loaded once
5
+ * for a worker's files, its own registration reaches only the first.
6
+ */
7
+ export interface TestLibraryHooks {
8
+ /** A test file ended with the window going on: unmount what is still mounted. */
9
+ fileEnd?: () => void;
10
+ afterEach?: () => void;
11
+ beforeAll?: () => void;
12
+ afterAll?: () => void;
13
+ }
14
+ /**
15
+ * Testing library `name`'s hooks, added to the ones it registered before. A fresh instance of the
16
+ * library (after a module reset) replaces the previous one's.
17
+ */
18
+ export declare function registerTestHooks(name: string, hooks: TestLibraryHooks): void;
19
+ /** The hooks registered for the current window, by library. */
20
+ export declare function testHooks(): TestLibraryHooks[];
21
+ /** A test file is about to start in `window`, which other files have used or will use. */
22
+ export declare function resetWindowBetweenFiles(window: Window): void;
@@ -4,7 +4,6 @@ export interface DOMPointInit {
4
4
  z?: number;
5
5
  w?: number;
6
6
  }
7
- import { $is2D, $m, $rects } from "../keys.js";
8
7
  export declare class DOMPointReadOnly {
9
8
  #private;
10
9
  constructor(x?: number, y?: number, z?: number, w?: number);
@@ -13,7 +12,8 @@ export declare class DOMPointReadOnly {
13
12
  get y(): number;
14
13
  get z(): number;
15
14
  get w(): number;
16
- matrixTransform(matrix: DOMMatrixReadOnly): DOMPoint;
15
+ /** https://drafts.csswg.org/geometry/#dom-dompointreadonly-matrixtransform */
16
+ matrixTransform(matrix?: DOMMatrixInit): DOMPoint;
17
17
  toJSON(): Required<DOMPointInit>;
18
18
  }
19
19
  export declare class DOMPoint extends DOMPointReadOnly {
@@ -60,21 +60,57 @@ export declare class DOMRect extends DOMRectReadOnly {
60
60
  }
61
61
  /** https://drafts.fxtf.org/geometry/#domrectlist */
62
62
  export declare class DOMRectList {
63
- [$rects]: DOMRect[];
63
+ #private;
64
64
  [index: number]: DOMRect;
65
65
  constructor(rects?: DOMRect[]);
66
66
  get length(): number;
67
+ /** https://drafts.csswg.org/geometry/#dom-domrectlist-item */
67
68
  item(index: number): DOMRect | null;
68
69
  [Symbol.iterator](): IterableIterator<DOMRect>;
69
70
  }
70
- /** https://drafts.fxtf.org/geometry/#dommatrixreadonly — storage is column-major m11..m44. */
71
+ /** https://drafts.csswg.org/geometry/#dictdef-dommatrix2dinit */
72
+ export interface DOMMatrix2DInit {
73
+ a?: number;
74
+ b?: number;
75
+ c?: number;
76
+ d?: number;
77
+ e?: number;
78
+ f?: number;
79
+ m11?: number;
80
+ m12?: number;
81
+ m21?: number;
82
+ m22?: number;
83
+ m41?: number;
84
+ m42?: number;
85
+ }
86
+ /** https://drafts.csswg.org/geometry/#dictdef-dommatrixinit */
87
+ export interface DOMMatrixInit extends DOMMatrix2DInit {
88
+ m13?: number;
89
+ m14?: number;
90
+ m23?: number;
91
+ m24?: number;
92
+ m31?: number;
93
+ m32?: number;
94
+ m33?: number;
95
+ m34?: number;
96
+ m43?: number;
97
+ m44?: number;
98
+ is2D?: boolean;
99
+ }
100
+ /**
101
+ * https://drafts.csswg.org/geometry/#dommatrixreadonly — storage is column-major m11..m44.
102
+ * The non-mutating operations copy the matrix and run the matching *Self algorithm on the copy.
103
+ */
71
104
  export declare class DOMMatrixReadOnly {
72
- [$m]: number[];
73
- [$is2D]: boolean;
74
- constructor(init?: string | number[]);
75
- static fromMatrix(other?: Partial<Record<string, number>>): DOMMatrixReadOnly;
76
- static fromFloat64Array(array: Float64Array): DOMMatrixReadOnly;
105
+ #private;
106
+ /** https://drafts.csswg.org/geometry/#dom-dommatrixreadonly-dommatrixreadonly */
107
+ constructor(init?: string | ArrayLike<number>);
108
+ /** https://drafts.csswg.org/geometry/#dom-dommatrixreadonly-frommatrix */
109
+ static fromMatrix(other?: DOMMatrixInit): DOMMatrixReadOnly;
110
+ /** https://drafts.csswg.org/geometry/#dom-dommatrixreadonly-fromfloat32array */
77
111
  static fromFloat32Array(array: Float32Array): DOMMatrixReadOnly;
112
+ /** https://drafts.csswg.org/geometry/#dom-dommatrixreadonly-fromfloat64array */
113
+ static fromFloat64Array(array: Float64Array): DOMMatrixReadOnly;
78
114
  get a(): number;
79
115
  get b(): number;
80
116
  get c(): number;
@@ -97,21 +133,53 @@ export declare class DOMMatrixReadOnly {
97
133
  get m42(): number;
98
134
  get m43(): number;
99
135
  get m44(): number;
136
+ /** https://drafts.csswg.org/geometry/#dom-dommatrixreadonly-is2d */
100
137
  get is2D(): boolean;
138
+ /** https://drafts.csswg.org/geometry/#dom-dommatrixreadonly-isidentity */
101
139
  get isIdentity(): boolean;
102
- multiply(other: DOMMatrixReadOnly): DOMMatrix;
140
+ /** https://drafts.csswg.org/geometry/#dom-dommatrixreadonly-translate */
103
141
  translate(tx?: number, ty?: number, tz?: number): DOMMatrix;
104
- scale(sx?: number, sy?: number, sz?: number): DOMMatrix;
105
- /** 2D inverse (3D matrices other than affine 2D return NaN-filled matrices, as unsupported). */
142
+ /** https://drafts.csswg.org/geometry/#dom-dommatrixreadonly-scale */
143
+ scale(scaleX?: number, scaleY?: number, scaleZ?: number, originX?: number, originY?: number, originZ?: number): DOMMatrix;
144
+ /** https://drafts.csswg.org/geometry/#dom-dommatrixreadonly-scalenonuniform */
145
+ scaleNonUniform(scaleX?: number, scaleY?: number): DOMMatrix;
146
+ /** https://drafts.csswg.org/geometry/#dom-dommatrixreadonly-scale3d */
147
+ scale3d(scale?: number, originX?: number, originY?: number, originZ?: number): DOMMatrix;
148
+ /** https://drafts.csswg.org/geometry/#dom-dommatrixreadonly-rotate */
149
+ rotate(rotX?: number, rotY?: number, rotZ?: number): DOMMatrix;
150
+ /** https://drafts.csswg.org/geometry/#dom-dommatrixreadonly-rotatefromvector */
151
+ rotateFromVector(x?: number, y?: number): DOMMatrix;
152
+ /** https://drafts.csswg.org/geometry/#dom-dommatrixreadonly-rotateaxisangle */
153
+ rotateAxisAngle(x?: number, y?: number, z?: number, angle?: number): DOMMatrix;
154
+ /** https://drafts.csswg.org/geometry/#dom-dommatrixreadonly-skewx */
155
+ skewX(sx?: number): DOMMatrix;
156
+ /** https://drafts.csswg.org/geometry/#dom-dommatrixreadonly-skewy */
157
+ skewY(sy?: number): DOMMatrix;
158
+ /** https://drafts.csswg.org/geometry/#dom-dommatrixreadonly-multiply */
159
+ multiply(other?: DOMMatrixInit): DOMMatrix;
160
+ /** https://drafts.csswg.org/geometry/#dom-dommatrixreadonly-flipx */
161
+ flipX(): DOMMatrix;
162
+ /** https://drafts.csswg.org/geometry/#dom-dommatrixreadonly-flipy */
163
+ flipY(): DOMMatrix;
164
+ /** https://drafts.csswg.org/geometry/#dom-dommatrixreadonly-inverse */
106
165
  inverse(): DOMMatrix;
166
+ /** https://drafts.csswg.org/geometry/#dom-dommatrixreadonly-transformpoint */
107
167
  transformPoint(point?: DOMPointInit): DOMPoint;
108
- toFloat64Array(): Float64Array;
168
+ /** https://drafts.csswg.org/geometry/#dom-dommatrixreadonly-tofloat32array */
109
169
  toFloat32Array(): Float32Array;
170
+ /** https://drafts.csswg.org/geometry/#dom-dommatrixreadonly-tofloat64array */
171
+ toFloat64Array(): Float64Array;
172
+ /** https://drafts.csswg.org/geometry/#dom-dommatrixreadonly-tojson */
110
173
  toJSON(): Record<string, number | boolean>;
174
+ /** https://drafts.csswg.org/geometry/#dommatrixreadonly-stringification-behavior */
111
175
  toString(): string;
112
176
  }
177
+ /** https://drafts.csswg.org/geometry/#dommatrix */
113
178
  export declare class DOMMatrix extends DOMMatrixReadOnly {
114
- static fromMatrix(other?: Partial<Record<string, number>>): DOMMatrix;
179
+ /** https://drafts.csswg.org/geometry/#dom-dommatrix-frommatrix */
180
+ static fromMatrix(other?: DOMMatrixInit): DOMMatrix;
181
+ static fromFloat32Array(array: Float32Array): DOMMatrix;
182
+ static fromFloat64Array(array: Float64Array): DOMMatrix;
115
183
  get a(): number;
116
184
  set a(v: number);
117
185
  get b(): number;
@@ -124,4 +192,60 @@ export declare class DOMMatrix extends DOMMatrixReadOnly {
124
192
  set e(v: number);
125
193
  get f(): number;
126
194
  set f(v: number);
195
+ get m11(): number;
196
+ set m11(v: number);
197
+ get m12(): number;
198
+ set m12(v: number);
199
+ get m13(): number;
200
+ set m13(v: number);
201
+ get m14(): number;
202
+ set m14(v: number);
203
+ get m21(): number;
204
+ set m21(v: number);
205
+ get m22(): number;
206
+ set m22(v: number);
207
+ get m23(): number;
208
+ set m23(v: number);
209
+ get m24(): number;
210
+ set m24(v: number);
211
+ get m31(): number;
212
+ set m31(v: number);
213
+ get m32(): number;
214
+ set m32(v: number);
215
+ get m33(): number;
216
+ set m33(v: number);
217
+ get m34(): number;
218
+ set m34(v: number);
219
+ get m41(): number;
220
+ set m41(v: number);
221
+ get m42(): number;
222
+ set m42(v: number);
223
+ get m43(): number;
224
+ set m43(v: number);
225
+ get m44(): number;
226
+ set m44(v: number);
227
+ /** https://drafts.csswg.org/geometry/#dom-dommatrix-multiplyself */
228
+ multiplySelf(other?: DOMMatrixInit): DOMMatrix;
229
+ /** https://drafts.csswg.org/geometry/#dom-dommatrix-premultiplyself */
230
+ preMultiplySelf(other?: DOMMatrixInit): DOMMatrix;
231
+ /** https://drafts.csswg.org/geometry/#dom-dommatrix-translateself */
232
+ translateSelf(tx?: number, ty?: number, tz?: number): DOMMatrix;
233
+ /** https://drafts.csswg.org/geometry/#dom-dommatrix-scaleself */
234
+ scaleSelf(scaleX?: number, scaleY?: number, scaleZ?: number, originX?: number, originY?: number, originZ?: number): DOMMatrix;
235
+ /** https://drafts.csswg.org/geometry/#dom-dommatrix-scale3dself */
236
+ scale3dSelf(scale?: number, originX?: number, originY?: number, originZ?: number): DOMMatrix;
237
+ /** https://drafts.csswg.org/geometry/#dom-dommatrix-rotateself */
238
+ rotateSelf(rotX?: number, rotY?: number, rotZ?: number): DOMMatrix;
239
+ /** https://drafts.csswg.org/geometry/#dom-dommatrix-rotatefromvectorself */
240
+ rotateFromVectorSelf(x?: number, y?: number): DOMMatrix;
241
+ /** https://drafts.csswg.org/geometry/#dom-dommatrix-rotateaxisangleself */
242
+ rotateAxisAngleSelf(x?: number, y?: number, z?: number, angle?: number): DOMMatrix;
243
+ /** https://drafts.csswg.org/geometry/#dom-dommatrix-skewxself */
244
+ skewXSelf(sx?: number): DOMMatrix;
245
+ /** https://drafts.csswg.org/geometry/#dom-dommatrix-skewyself */
246
+ skewYSelf(sy?: number): DOMMatrix;
247
+ /** https://drafts.csswg.org/geometry/#dom-dommatrix-invertself */
248
+ invertSelf(): DOMMatrix;
249
+ /** https://drafts.csswg.org/geometry/#dom-dommatrix-setmatrixvalue */
250
+ setMatrixValue(transformList: string): DOMMatrix;
127
251
  }
@@ -0,0 +1,35 @@
1
+ import { DOMPoint, DOMRect, type DOMPointInit, type DOMRectInit } from "./geometry.js";
2
+ /** https://drafts.csswg.org/geometry/#dictdef-domquadinit */
3
+ export interface DOMQuadInit {
4
+ p1?: DOMPointInit;
5
+ p2?: DOMPointInit;
6
+ p3?: DOMPointInit;
7
+ p4?: DOMPointInit;
8
+ }
9
+ /** https://drafts.csswg.org/geometry/#domquad */
10
+ export declare class DOMQuad {
11
+ #private;
12
+ /** https://drafts.csswg.org/geometry/#dom-domquad-domquad */
13
+ constructor(p1?: DOMPointInit, p2?: DOMPointInit, p3?: DOMPointInit, p4?: DOMPointInit);
14
+ /** https://drafts.csswg.org/geometry/#dom-domquad-fromrect */
15
+ static fromRect(other?: DOMRectInit): DOMQuad;
16
+ /** https://drafts.csswg.org/geometry/#dom-domquad-fromquad */
17
+ static fromQuad(other?: DOMQuadInit): DOMQuad;
18
+ /** https://drafts.csswg.org/geometry/#dom-domquad-p1 — [SameObject]. */
19
+ get p1(): DOMPoint;
20
+ get p2(): DOMPoint;
21
+ get p3(): DOMPoint;
22
+ get p4(): DOMPoint;
23
+ /**
24
+ * https://drafts.csswg.org/geometry/#dom-domquad-getbounds — the NaN-safe minimum and maximum
25
+ * of the x and y coordinates: any NaN makes that edge NaN, which Math.min/max already do.
26
+ */
27
+ getBounds(): DOMRect;
28
+ /** https://webidl.spec.whatwg.org/#default-tojson-steps — each point via its own toJSON. */
29
+ toJSON(): {
30
+ p1: Required<DOMPointInit>;
31
+ p2: Required<DOMPointInit>;
32
+ p3: Required<DOMPointInit>;
33
+ p4: Required<DOMPointInit>;
34
+ };
35
+ }