@stencil/mock-doc 5.0.0-alpha.1

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.
@@ -0,0 +1,1039 @@
1
+ //#region src/attribute.d.ts
2
+ declare class MockAttributeMap {
3
+ caseInsensitive: boolean;
4
+ __items: MockAttr[];
5
+ constructor(caseInsensitive?: boolean);
6
+ get length(): number;
7
+ item(index: number): MockAttr;
8
+ setNamedItem(attr: MockAttr): void;
9
+ setNamedItemNS(attr: MockAttr): void;
10
+ getNamedItem(attrName: string): MockAttr;
11
+ getNamedItemNS(namespaceURI: string | null, attrName: string): MockAttr;
12
+ removeNamedItem(attr: MockAttr): void;
13
+ removeNamedItemNS(attr: MockAttr): void;
14
+ [Symbol.iterator](): {
15
+ next: () => {
16
+ done: boolean;
17
+ value: MockAttr;
18
+ };
19
+ };
20
+ get [Symbol.toStringTag](): string;
21
+ }
22
+ declare function cloneAttributes(srcAttrs: MockAttributeMap, sortByName?: boolean): any;
23
+ declare class MockAttr {
24
+ private _localName;
25
+ private _prefix;
26
+ private _value;
27
+ private _namespaceURI;
28
+ constructor(attrName: string, attrValue: string, namespaceURI?: string | null, prefix?: string | null);
29
+ get name(): string;
30
+ set name(value: string);
31
+ get localName(): string;
32
+ set localName(value: string);
33
+ get prefix(): string;
34
+ set prefix(value: string);
35
+ get value(): string;
36
+ set value(value: string);
37
+ get nodeName(): string;
38
+ set nodeName(value: string);
39
+ get nodeValue(): string;
40
+ set nodeValue(value: string);
41
+ get namespaceURI(): string;
42
+ set namespaceURI(namespaceURI: string);
43
+ }
44
+ //#endregion
45
+ //#region src/css-style-declaration.d.ts
46
+ declare class MockCSSStyleDeclaration {
47
+ private _styles;
48
+ setProperty(prop: string, value: string): void;
49
+ getPropertyValue(prop: string): string;
50
+ removeProperty(prop: string): void;
51
+ get length(): number;
52
+ get cssText(): string;
53
+ set cssText(cssText: string);
54
+ }
55
+ //#endregion
56
+ //#region src/css-style-sheet.d.ts
57
+ declare class MockCSSRule {
58
+ parentStyleSheet: MockCSSStyleSheet;
59
+ cssText: string;
60
+ type: number;
61
+ constructor(parentStyleSheet: MockCSSStyleSheet);
62
+ }
63
+ declare class MockCSSStyleSheet {
64
+ ownerNode?: MockStyleElement;
65
+ type: string;
66
+ parentStyleSheet: MockCSSStyleSheet | null;
67
+ cssRules: MockCSSRule[];
68
+ constructor(ownerNode?: MockStyleElement);
69
+ get rules(): MockCSSRule[];
70
+ set rules(rules: MockCSSRule[]);
71
+ deleteRule(index: number): void;
72
+ insertRule(rule: string, index?: number): number;
73
+ replaceSync(cssText: string): void;
74
+ }
75
+ //#endregion
76
+ //#region src/document-fragment.d.ts
77
+ declare class MockDocumentFragment extends MockHTMLElement {
78
+ constructor(ownerDocument: any);
79
+ getElementById(id: string): MockElement;
80
+ get adoptedStyleSheets(): MockCSSStyleSheet[];
81
+ set adoptedStyleSheets(_adoptedStyleSheets: MockCSSStyleSheet[]);
82
+ cloneNode(deep?: boolean): MockDocumentFragment;
83
+ }
84
+ //#endregion
85
+ //#region src/element.d.ts
86
+ declare class MockStyleElement extends MockHTMLElement {
87
+ sheet: MockCSSStyleSheet;
88
+ constructor(ownerDocument: any);
89
+ get innerHTML(): string;
90
+ set innerHTML(value: string);
91
+ get innerText(): string;
92
+ set innerText(value: string);
93
+ get textContent(): string;
94
+ set textContent(value: string);
95
+ }
96
+ declare class MockSVGElement extends MockElement {
97
+ __namespaceURI: string;
98
+ get ownerSVGElement(): SVGSVGElement;
99
+ get viewportElement(): SVGElement;
100
+ onunload(): void;
101
+ get pathLength(): number;
102
+ isPointInFill(_pt: DOMPoint): boolean;
103
+ isPointInStroke(_pt: DOMPoint): boolean;
104
+ getTotalLength(): number;
105
+ }
106
+ //#endregion
107
+ //#region src/history.d.ts
108
+ declare class MockHistory {
109
+ private items;
110
+ get length(): number;
111
+ back(): void;
112
+ forward(): void;
113
+ go(_value: number): void;
114
+ pushState(_state: any, _title: string, _url: string): void;
115
+ replaceState(_state: any, _title: string, _url: string): void;
116
+ }
117
+ //#endregion
118
+ //#region src/intersection-observer.d.ts
119
+ declare class MockIntersectionObserver {
120
+ disconnect(): void;
121
+ observe(): void;
122
+ takeRecords(): any[];
123
+ unobserve(): void;
124
+ }
125
+ //#endregion
126
+ //#region src/location.d.ts
127
+ declare class MockLocation implements Location {
128
+ ancestorOrigins: any;
129
+ protocol: string;
130
+ host: string;
131
+ hostname: string;
132
+ port: string;
133
+ pathname: string;
134
+ search: string;
135
+ hash: string;
136
+ username: string;
137
+ password: string;
138
+ origin: string;
139
+ private _href;
140
+ get href(): string;
141
+ set href(value: string);
142
+ assign(_url: string): void;
143
+ reload(_forcedReload?: boolean): void;
144
+ replace(_url: string): void;
145
+ toString(): string;
146
+ }
147
+ //#endregion
148
+ //#region src/navigator.d.ts
149
+ declare class MockNavigator {
150
+ appCodeName: string;
151
+ appName: string;
152
+ appVersion: string;
153
+ platform: string;
154
+ userAgent: string;
155
+ }
156
+ //#endregion
157
+ //#region src/resize-observer.d.ts
158
+ declare class MockResizeObserver {
159
+ disconnect(): void;
160
+ observe(): void;
161
+ takeRecords(): any[];
162
+ unobserve(): void;
163
+ }
164
+ //#endregion
165
+ //#region src/shadow-root.d.ts
166
+ declare class MockShadowRoot extends MockDocumentFragment {
167
+ get activeElement(): HTMLElement | null;
168
+ get cloneable(): boolean;
169
+ get delegatesFocus(): boolean;
170
+ get fullscreenElement(): HTMLElement | null;
171
+ get host(): HTMLElement | null;
172
+ get mode(): 'open' | 'closed';
173
+ get pictureInPictureElement(): HTMLElement | null;
174
+ get pointerLockElement(): HTMLElement | null;
175
+ get serializable(): boolean;
176
+ get slotAssignment(): 'named' | 'manual';
177
+ get styleSheets(): StyleSheet[];
178
+ }
179
+ //#endregion
180
+ //#region src/storage.d.ts
181
+ declare class MockStorage {
182
+ private items;
183
+ key(_value: number): void;
184
+ getItem(key: string): string;
185
+ setItem(key: string, value: string): void;
186
+ removeItem(key: string): void;
187
+ clear(): void;
188
+ }
189
+ //#endregion
190
+ //#region src/window.d.ts
191
+ declare const nativeClearInterval: typeof clearInterval;
192
+ declare const nativeClearTimeout: typeof clearTimeout;
193
+ declare const nativeSetInterval: typeof setInterval;
194
+ declare const nativeSetTimeout: typeof setTimeout;
195
+ declare class MockWindow {
196
+ __timeouts: Set<any>;
197
+ __history: MockHistory;
198
+ __elementCstr: any;
199
+ __charDataCstr: any;
200
+ __docTypeCstr: any;
201
+ __docCstr: any;
202
+ __docFragCstr: any;
203
+ __domTokenListCstr: any;
204
+ __nodeCstr: any;
205
+ __nodeListCstr: any;
206
+ __localStorage: MockStorage;
207
+ __sessionStorage: MockStorage;
208
+ __location: MockLocation;
209
+ __navigator: MockNavigator;
210
+ __clearInterval: typeof nativeClearInterval;
211
+ __clearTimeout: typeof nativeClearTimeout;
212
+ __setInterval: typeof nativeSetInterval;
213
+ __setTimeout: typeof nativeSetTimeout;
214
+ __maxTimeout: number;
215
+ __allowInterval: boolean;
216
+ URL: typeof URL;
217
+ console: Console;
218
+ customElements: CustomElementRegistry;
219
+ document: Document;
220
+ performance: Performance;
221
+ devicePixelRatio: number;
222
+ innerHeight: number;
223
+ innerWidth: number;
224
+ pageXOffset: number;
225
+ pageYOffset: number;
226
+ screen: Screen;
227
+ screenLeft: number;
228
+ screenTop: number;
229
+ screenX: number;
230
+ screenY: number;
231
+ scrollX: number;
232
+ scrollY: number;
233
+ CustomEvent: typeof MockCustomEvent;
234
+ Event: typeof MockEvent;
235
+ Headers: typeof MockHeaders;
236
+ FocusEvent: typeof MockFocusEvent;
237
+ KeyboardEvent: typeof MockKeyboardEvent;
238
+ MouseEvent: typeof MockMouseEvent;
239
+ constructor(html?: string | boolean);
240
+ addEventListener(type: string, handler: (ev?: any) => void): void;
241
+ alert(msg: string): void;
242
+ blur(): any;
243
+ cancelAnimationFrame(id: any): void;
244
+ cancelIdleCallback(id: any): void;
245
+ get CharacterData(): any;
246
+ set CharacterData(charDataCstr: any);
247
+ clearInterval(id: any): void;
248
+ clearTimeout(id: any): void;
249
+ close(): void;
250
+ confirm(): boolean;
251
+ get CSS(): {
252
+ supports: () => boolean;
253
+ };
254
+ get Document(): any;
255
+ set Document(docCstr: any);
256
+ get DocumentFragment(): any;
257
+ set DocumentFragment(docFragCstr: any);
258
+ get ShadowRoot(): typeof MockShadowRoot;
259
+ get DocumentType(): any;
260
+ set DocumentType(docTypeCstr: any);
261
+ get DOMTokenList(): any;
262
+ set DOMTokenList(domTokenListCstr: any);
263
+ dispatchEvent(ev: MockEvent): boolean;
264
+ get Element(): typeof MockElement;
265
+ get DOMException(): {
266
+ new (message?: string, name?: string): DOMException;
267
+ prototype: DOMException;
268
+ readonly INDEX_SIZE_ERR: 1;
269
+ readonly DOMSTRING_SIZE_ERR: 2;
270
+ readonly HIERARCHY_REQUEST_ERR: 3;
271
+ readonly WRONG_DOCUMENT_ERR: 4;
272
+ readonly INVALID_CHARACTER_ERR: 5;
273
+ readonly NO_DATA_ALLOWED_ERR: 6;
274
+ readonly NO_MODIFICATION_ALLOWED_ERR: 7;
275
+ readonly NOT_FOUND_ERR: 8;
276
+ readonly NOT_SUPPORTED_ERR: 9;
277
+ readonly INUSE_ATTRIBUTE_ERR: 10;
278
+ readonly INVALID_STATE_ERR: 11;
279
+ readonly SYNTAX_ERR: 12;
280
+ readonly INVALID_MODIFICATION_ERR: 13;
281
+ readonly NAMESPACE_ERR: 14;
282
+ readonly INVALID_ACCESS_ERR: 15;
283
+ readonly VALIDATION_ERR: 16;
284
+ readonly TYPE_MISMATCH_ERR: 17;
285
+ readonly SECURITY_ERR: 18;
286
+ readonly NETWORK_ERR: 19;
287
+ readonly ABORT_ERR: 20;
288
+ readonly URL_MISMATCH_ERR: 21;
289
+ readonly QUOTA_EXCEEDED_ERR: 22;
290
+ readonly TIMEOUT_ERR: 23;
291
+ readonly INVALID_NODE_TYPE_ERR: 24;
292
+ readonly DATA_CLONE_ERR: 25;
293
+ };
294
+ fetch(input: any, init?: any): any;
295
+ focus(): any;
296
+ getComputedStyle(_: any): any;
297
+ get globalThis(): this;
298
+ get history(): any;
299
+ set history(hsty: any);
300
+ get JSON(): JSON;
301
+ get HTMLElement(): typeof MockHTMLElement;
302
+ get SVGElement(): typeof MockSVGElement;
303
+ get IntersectionObserver(): typeof MockIntersectionObserver;
304
+ get ResizeObserver(): typeof MockResizeObserver;
305
+ get localStorage(): MockStorage;
306
+ set localStorage(locStorage: MockStorage);
307
+ get location(): MockLocation;
308
+ set location(val: Location | string);
309
+ matchMedia(media: string): {
310
+ media: string;
311
+ matches: boolean;
312
+ addListener: (_handler: (ev?: any) => void) => void;
313
+ removeListener: (_handler: (ev?: any) => void) => void;
314
+ addEventListener: (_type: string, _handler: (ev?: any) => void) => void;
315
+ removeEventListener: (_type: string, _handler: (ev?: any) => void) => void;
316
+ dispatchEvent: (_ev: any) => void;
317
+ onchange: ((this: MediaQueryList, ev: MediaQueryListEvent) => any) | null;
318
+ };
319
+ get Node(): typeof MockNode;
320
+ get NodeList(): any;
321
+ get navigator(): any;
322
+ set navigator(nav: any);
323
+ get parent(): any;
324
+ prompt(): string;
325
+ open(): any;
326
+ get origin(): string;
327
+ removeEventListener(type: string, handler: any): void;
328
+ requestAnimationFrame(callback: (timestamp: number) => void): number;
329
+ requestIdleCallback(callback: (deadline: {
330
+ didTimeout: boolean;
331
+ timeRemaining: () => number;
332
+ }) => void): number;
333
+ scroll(_x?: number, _y?: number): void;
334
+ scrollBy(_x?: number, _y?: number): void;
335
+ scrollTo(_x?: number, _y?: number): void;
336
+ get self(): this;
337
+ get sessionStorage(): any;
338
+ set sessionStorage(locStorage: any);
339
+ setInterval(callback: (...args: any[]) => void, ms: number, ...args: any[]): number;
340
+ setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): number;
341
+ get top(): this;
342
+ get window(): this;
343
+ onanimationstart(): void;
344
+ onanimationend(): void;
345
+ onanimationiteration(): void;
346
+ onabort(): void;
347
+ onauxclick(): void;
348
+ onbeforecopy(): void;
349
+ onbeforecut(): void;
350
+ onbeforepaste(): void;
351
+ onblur(): void;
352
+ oncancel(): void;
353
+ oncanplay(): void;
354
+ oncanplaythrough(): void;
355
+ onchange(): void;
356
+ onclick(): void;
357
+ onclose(): void;
358
+ oncontextmenu(): void;
359
+ oncopy(): void;
360
+ oncuechange(): void;
361
+ oncut(): void;
362
+ ondblclick(): void;
363
+ ondrag(): void;
364
+ ondragend(): void;
365
+ ondragenter(): void;
366
+ ondragleave(): void;
367
+ ondragover(): void;
368
+ ondragstart(): void;
369
+ ondrop(): void;
370
+ ondurationchange(): void;
371
+ onemptied(): void;
372
+ onended(): void;
373
+ onerror(): void;
374
+ onfocus(): void;
375
+ onfocusin(): void;
376
+ onfocusout(): void;
377
+ onformdata(): void;
378
+ onfullscreenchange(): void;
379
+ onfullscreenerror(): void;
380
+ ongotpointercapture(): void;
381
+ oninput(): void;
382
+ oninvalid(): void;
383
+ onkeydown(): void;
384
+ onkeypress(): void;
385
+ onkeyup(): void;
386
+ onload(): void;
387
+ onloadeddata(): void;
388
+ onloadedmetadata(): void;
389
+ onloadstart(): void;
390
+ onlostpointercapture(): void;
391
+ onmousedown(): void;
392
+ onmouseenter(): void;
393
+ onmouseleave(): void;
394
+ onmousemove(): void;
395
+ onmouseout(): void;
396
+ onmouseover(): void;
397
+ onmouseup(): void;
398
+ onmousewheel(): void;
399
+ onpaste(): void;
400
+ onpause(): void;
401
+ onplay(): void;
402
+ onplaying(): void;
403
+ onpointercancel(): void;
404
+ onpointerdown(): void;
405
+ onpointerenter(): void;
406
+ onpointerleave(): void;
407
+ onpointermove(): void;
408
+ onpointerout(): void;
409
+ onpointerover(): void;
410
+ onpointerup(): void;
411
+ onprogress(): void;
412
+ onratechange(): void;
413
+ onreset(): void;
414
+ onresize(): void;
415
+ onscroll(): void;
416
+ onsearch(): void;
417
+ onseeked(): void;
418
+ onseeking(): void;
419
+ onselect(): void;
420
+ onselectstart(): void;
421
+ onstalled(): void;
422
+ onsubmit(): void;
423
+ onsuspend(): void;
424
+ ontimeupdate(): void;
425
+ ontoggle(): void;
426
+ onvolumechange(): void;
427
+ onwaiting(): void;
428
+ onwebkitfullscreenchange(): void;
429
+ onwebkitfullscreenerror(): void;
430
+ onwheel(): void;
431
+ }
432
+ declare function cloneWindow(srcWin: Window, opts?: {
433
+ customElementProxy?: boolean;
434
+ }): MockWindow | null;
435
+ declare function cloneDocument(srcDoc: Document): Document;
436
+ /**
437
+ * Constrain setTimeout() to 1ms, but still async. Also
438
+ * only allow setInterval() to fire once, also constrained to 1ms.
439
+ * @param win the mock window instance to update
440
+ */
441
+ declare function constrainTimeouts(win: any): void;
442
+ //#endregion
443
+ //#region src/event.d.ts
444
+ declare class MockEvent {
445
+ bubbles: boolean;
446
+ cancelBubble: boolean;
447
+ cancelable: boolean;
448
+ composed: boolean;
449
+ currentTarget: MockElement | null;
450
+ defaultPrevented: boolean;
451
+ srcElement: MockElement | null;
452
+ target: MockElement | null;
453
+ timeStamp: number;
454
+ type: string;
455
+ constructor(type: string, eventInitDict?: EventInit);
456
+ preventDefault(): void;
457
+ stopPropagation(): void;
458
+ stopImmediatePropagation(): void;
459
+ /**
460
+ * Get the composed path of event propagation.
461
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Event/composedPath
462
+ * @returns a composed path of the event
463
+ */
464
+ composedPath(): MockElement[];
465
+ }
466
+ declare class MockCustomEvent extends MockEvent {
467
+ detail: any;
468
+ constructor(type: string, customEventInitDic?: CustomEventInit);
469
+ }
470
+ declare class MockKeyboardEvent extends MockEvent {
471
+ code: string;
472
+ key: string;
473
+ altKey: boolean;
474
+ ctrlKey: boolean;
475
+ metaKey: boolean;
476
+ shiftKey: boolean;
477
+ location: number;
478
+ repeat: boolean;
479
+ constructor(type: string, keyboardEventInitDic?: KeyboardEventInit);
480
+ }
481
+ declare class MockMouseEvent extends MockEvent {
482
+ screenX: number;
483
+ screenY: number;
484
+ clientX: number;
485
+ clientY: number;
486
+ ctrlKey: boolean;
487
+ shiftKey: boolean;
488
+ altKey: boolean;
489
+ metaKey: boolean;
490
+ button: number;
491
+ buttons: number;
492
+ relatedTarget: EventTarget | null;
493
+ constructor(type: string, mouseEventInitDic?: MouseEventInit);
494
+ }
495
+ declare class MockUIEvent extends MockEvent {
496
+ detail: number | null;
497
+ view: MockWindow | null;
498
+ constructor(type: string, uiEventInitDic?: UIEventInit);
499
+ }
500
+ declare class MockFocusEvent extends MockUIEvent {
501
+ relatedTarget: EventTarget | null;
502
+ constructor(type: 'blur' | 'focus', focusEventInitDic?: FocusEventInit);
503
+ }
504
+ declare class MockEventListener {
505
+ type: string;
506
+ handler: (ev?: any) => void;
507
+ constructor(type: string, handler: any);
508
+ }
509
+ /**
510
+ * Add an event listener to an element.
511
+ *
512
+ * @param elm - the element to add the listener to
513
+ * @param type - the event type to listen for
514
+ * @param handler - the event handler function
515
+ */
516
+ interface EventTarget {
517
+ __listeners: MockEventListener[];
518
+ }
519
+ //#endregion
520
+ //#region src/serialize-node.d.ts
521
+ /**
522
+ * Serialize a node (either a DOM node or a mock-doc node) to an HTML string.
523
+ * This operation is similar to `outerHTML` but allows for more control over the
524
+ * serialization process. It is fully synchronous meaning that it will not
525
+ * wait for a component to be fully rendered before serializing it. Use `streamToHtml`
526
+ * for a streaming version of this function.
527
+ *
528
+ * @param elm the node to serialize
529
+ * @param serializationOptions options to control serialization behavior
530
+ * @returns an html string
531
+ */
532
+ declare function serializeNodeToHtml(elm: Node | MockNode, serializationOptions?: SerializeNodeToHtmlOptions): string;
533
+ /**
534
+ * Partially duplicate of https://github.com/stenciljs/core/blob/6017dad2cb6fe366242e2e0594f82c8e3a3b5d15/src/declarations/stencil-public-compiler.ts#L895
535
+ * Types can't be imported in this documented as Eslint will not embed the types
536
+ * in the d.ts file.
537
+ */
538
+ interface SerializeNodeToHtmlOptions {
539
+ approximateLineWidth?: number;
540
+ excludeTagContent?: string[];
541
+ excludeTags?: string[];
542
+ indentSpaces?: number;
543
+ newLines?: boolean;
544
+ outerHtml?: boolean;
545
+ prettyHtml?: boolean;
546
+ removeAttributeQuotes?: boolean;
547
+ removeBooleanAttributeQuotes?: boolean;
548
+ removeEmptyAttributes?: boolean;
549
+ removeHtmlComments?: boolean;
550
+ serializeShadowRoot?: 'declarative-shadow-dom' | 'scoped' | {
551
+ 'declarative-shadow-dom'?: string[];
552
+ scoped?: string[];
553
+ default: 'declarative-shadow-dom' | 'scoped';
554
+ } | boolean;
555
+ fullDocument?: boolean;
556
+ }
557
+ //#endregion
558
+ //#region src/token-list.d.ts
559
+ declare class MockTokenList {
560
+ private elm;
561
+ private attr;
562
+ constructor(elm: HTMLElement, attr: string);
563
+ add(...tokens: string[]): void;
564
+ remove(...tokens: string[]): void;
565
+ contains(token: string): boolean;
566
+ toggle(token: string): void;
567
+ get length(): number;
568
+ item(index: number): string;
569
+ toString(): string;
570
+ }
571
+ //#endregion
572
+ //#region src/node.d.ts
573
+ declare class MockNode {
574
+ private _nodeValue;
575
+ nodeName: string | null;
576
+ nodeType: number;
577
+ ownerDocument: any;
578
+ parentNode: MockNode | null;
579
+ private _childNodes;
580
+ constructor(ownerDocument: any, nodeType: number, nodeName: string | null, nodeValue: string | null);
581
+ get childNodes(): MockNode[];
582
+ set childNodes(value: MockNode[]);
583
+ appendChild(newNode: MockNode): MockNode;
584
+ append(...items: (MockNode | string)[]): void;
585
+ prepend(...items: (MockNode | string)[]): void;
586
+ cloneNode(deep?: boolean): MockNode;
587
+ compareDocumentPosition(other: MockNode): number;
588
+ get firstChild(): MockNode | null;
589
+ insertBefore(newNode: MockNode, referenceNode: MockNode | null): MockNode;
590
+ get isConnected(): boolean;
591
+ isSameNode(node: any): boolean;
592
+ get lastChild(): MockNode | null;
593
+ get nextSibling(): MockNode | null;
594
+ get nodeValue(): string;
595
+ set nodeValue(value: string);
596
+ get parentElement(): any;
597
+ set parentElement(value: any);
598
+ get previousSibling(): MockNode | null;
599
+ contains(otherNode: MockNode): boolean;
600
+ removeChild(childNode: MockNode): MockNode;
601
+ remove(): void;
602
+ replaceChild(newChild: MockNode, oldChild: MockNode): MockNode;
603
+ get textContent(): string;
604
+ set textContent(value: string);
605
+ addEventListener(type: string, handler: (ev?: any) => void): void;
606
+ removeEventListener(type: string, handler: any): void;
607
+ dispatchEvent(ev: MockEvent): boolean;
608
+ static ELEMENT_NODE: number;
609
+ static TEXT_NODE: number;
610
+ static PROCESSING_INSTRUCTION_NODE: number;
611
+ static COMMENT_NODE: number;
612
+ static DOCUMENT_NODE: number;
613
+ static DOCUMENT_TYPE_NODE: number;
614
+ static DOCUMENT_FRAGMENT_NODE: number;
615
+ }
616
+ type MockElementInternals = Record<keyof ElementInternals, null>;
617
+ declare class MockElement extends MockNode {
618
+ __namespaceURI: string | null;
619
+ __localName: string | null;
620
+ __attributeMap: MockAttributeMap | null | undefined;
621
+ __shadowRoot: ShadowRoot | null | undefined;
622
+ __style: MockCSSStyleDeclaration | null | undefined;
623
+ attachInternals(): MockElementInternals;
624
+ constructor(ownerDocument: any, nodeName: string | null, namespaceURI?: string | null);
625
+ addEventListener(type: string, handler: (ev?: any) => void): void;
626
+ attachShadow(_opts: ShadowRootInit): any;
627
+ blur(): void;
628
+ get localName(): string;
629
+ get namespaceURI(): string;
630
+ get shadowRoot(): any;
631
+ /**
632
+ * Set shadow root for element
633
+ * @param shadowRoot - ShadowRoot to set
634
+ */
635
+ set shadowRoot(shadowRoot: any);
636
+ get attributes(): MockAttributeMap;
637
+ set attributes(attrs: MockAttributeMap);
638
+ get children(): MockElement[];
639
+ get childElementCount(): number;
640
+ get className(): string;
641
+ set className(value: string);
642
+ get classList(): MockTokenList;
643
+ get part(): string | MockTokenList;
644
+ set part(value: string | MockTokenList);
645
+ click(): void;
646
+ cloneNode(_deep?: boolean): MockElement;
647
+ closest<K extends keyof HTMLElementTagNameMap>(selector: K): HTMLElementTagNameMap[K] | null;
648
+ closest<K extends keyof SVGElementTagNameMap>(selector: K): SVGElementTagNameMap[K] | null;
649
+ closest<E extends Element = Element>(selector: string): E | null;
650
+ get dataset(): any;
651
+ get dir(): string;
652
+ set dir(value: string);
653
+ dispatchEvent(ev: MockEvent): boolean;
654
+ get firstElementChild(): MockElement | null;
655
+ focus(_options?: {
656
+ preventScroll?: boolean;
657
+ }): void;
658
+ getAttribute(attrName: string): any;
659
+ getAttributeNS(namespaceURI: string | null, attrName: string): string;
660
+ getAttributeNode(attrName: string): MockAttr | null;
661
+ getAttributeNames(): string[];
662
+ getBoundingClientRect(): {
663
+ bottom: number;
664
+ height: number;
665
+ left: number;
666
+ right: number;
667
+ top: number;
668
+ width: number;
669
+ x: number;
670
+ y: number;
671
+ };
672
+ getRootNode(opts?: {
673
+ composed?: boolean;
674
+ [key: string]: any;
675
+ }): Node;
676
+ get draggable(): boolean;
677
+ set draggable(value: boolean);
678
+ hasChildNodes(): boolean;
679
+ get id(): string;
680
+ set id(value: string);
681
+ get innerHTML(): string;
682
+ set innerHTML(html: string);
683
+ get innerText(): string;
684
+ set innerText(value: string);
685
+ insertAdjacentElement(position: 'beforebegin' | 'afterbegin' | 'beforeend' | 'afterend', elm: MockHTMLElement): MockHTMLElement;
686
+ insertAdjacentHTML(position: 'beforebegin' | 'afterbegin' | 'beforeend' | 'afterend', html: string): void;
687
+ insertAdjacentText(position: 'beforebegin' | 'afterbegin' | 'beforeend' | 'afterend', text: string): void;
688
+ hasAttribute(attrName: string): boolean;
689
+ hasAttributeNS(namespaceURI: string | null, name: string): boolean;
690
+ get hidden(): boolean;
691
+ set hidden(isHidden: boolean);
692
+ get lang(): string;
693
+ set lang(value: string);
694
+ get lastElementChild(): MockElement | null;
695
+ matches(selector: string): boolean;
696
+ get nextElementSibling(): any;
697
+ get outerHTML(): string;
698
+ get previousElementSibling(): any;
699
+ getElementsByClassName(classNames: string): MockElement[];
700
+ getElementsByTagName(tagName: string): MockElement[];
701
+ querySelector<K extends keyof HTMLElementTagNameMap>(selectors: K | `${K}.${string}` | `${K}#${string}` | `${K}[${string}` | `${K}:${string}`): HTMLElementTagNameMap[K] | null;
702
+ querySelector<K extends keyof SVGElementTagNameMap>(selectors: K | `${K}.${string}` | `${K}#${string}` | `${K}[${string}` | `${K}:${string}`): SVGElementTagNameMap[K] | null;
703
+ querySelector<E extends Element = Element>(selectors: string): E | null;
704
+ querySelectorAll<K extends keyof HTMLElementTagNameMap>(selectors: K): HTMLElementTagNameMap[K][];
705
+ querySelectorAll<K extends keyof SVGElementTagNameMap>(selectors: K): SVGElementTagNameMap[K][];
706
+ querySelectorAll<E extends Element = Element>(selectors: string): E[];
707
+ removeAttribute(attrName: string): void;
708
+ removeAttributeNS(namespaceURI: string | null, attrName: string): void;
709
+ removeEventListener(type: string, handler: any): void;
710
+ setAttribute(attrName: string, value: any): void;
711
+ setAttributeNS(namespaceURI: string | null, attrName: string, value: any): void;
712
+ get style(): any;
713
+ set style(val: any);
714
+ get tabIndex(): number;
715
+ set tabIndex(value: number);
716
+ get tagName(): string;
717
+ set tagName(value: string);
718
+ get textContent(): string;
719
+ set textContent(value: string);
720
+ get title(): string;
721
+ set title(value: string);
722
+ animate(): void;
723
+ onanimationstart(): void;
724
+ onanimationend(): void;
725
+ onanimationiteration(): void;
726
+ onabort(): void;
727
+ onauxclick(): void;
728
+ onbeforecopy(): void;
729
+ onbeforecut(): void;
730
+ onbeforepaste(): void;
731
+ onblur(): void;
732
+ oncancel(): void;
733
+ oncanplay(): void;
734
+ oncanplaythrough(): void;
735
+ onchange(): void;
736
+ onclick(): void;
737
+ onclose(): void;
738
+ oncontextmenu(): void;
739
+ oncopy(): void;
740
+ oncuechange(): void;
741
+ oncut(): void;
742
+ ondblclick(): void;
743
+ ondrag(): void;
744
+ ondragend(): void;
745
+ ondragenter(): void;
746
+ ondragleave(): void;
747
+ ondragover(): void;
748
+ ondragstart(): void;
749
+ ondrop(): void;
750
+ ondurationchange(): void;
751
+ onemptied(): void;
752
+ onended(): void;
753
+ onerror(): void;
754
+ onfocus(): void;
755
+ onfocusin(): void;
756
+ onfocusout(): void;
757
+ onformdata(): void;
758
+ onfullscreenchange(): void;
759
+ onfullscreenerror(): void;
760
+ ongotpointercapture(): void;
761
+ oninput(): void;
762
+ oninvalid(): void;
763
+ onkeydown(): void;
764
+ onkeypress(): void;
765
+ onkeyup(): void;
766
+ onload(): void;
767
+ onloadeddata(): void;
768
+ onloadedmetadata(): void;
769
+ onloadstart(): void;
770
+ onlostpointercapture(): void;
771
+ onmousedown(): void;
772
+ onmouseenter(): void;
773
+ onmouseleave(): void;
774
+ onmousemove(): void;
775
+ onmouseout(): void;
776
+ onmouseover(): void;
777
+ onmouseup(): void;
778
+ onmousewheel(): void;
779
+ onpaste(): void;
780
+ onpause(): void;
781
+ onplay(): void;
782
+ onplaying(): void;
783
+ onpointercancel(): void;
784
+ onpointerdown(): void;
785
+ onpointerenter(): void;
786
+ onpointerleave(): void;
787
+ onpointermove(): void;
788
+ onpointerout(): void;
789
+ onpointerover(): void;
790
+ onpointerup(): void;
791
+ onprogress(): void;
792
+ onratechange(): void;
793
+ onreset(): void;
794
+ onresize(): void;
795
+ onscroll(): void;
796
+ onsearch(): void;
797
+ onseeked(): void;
798
+ onseeking(): void;
799
+ onselect(): void;
800
+ onselectstart(): void;
801
+ onstalled(): void;
802
+ onsubmit(): void;
803
+ onsuspend(): void;
804
+ ontimeupdate(): void;
805
+ ontoggle(): void;
806
+ onvolumechange(): void;
807
+ onwaiting(): void;
808
+ onwebkitfullscreenchange(): void;
809
+ onwebkitfullscreenerror(): void;
810
+ onwheel(): void;
811
+ requestFullscreen(): void;
812
+ scrollBy(): void;
813
+ scrollTo(): void;
814
+ scrollIntoView(): void;
815
+ toString(opts?: SerializeNodeToHtmlOptions): string;
816
+ }
817
+ declare class MockHTMLElement extends MockElement {
818
+ __namespaceURI: string;
819
+ constructor(ownerDocument: any, nodeName: string | null);
820
+ get tagName(): string;
821
+ set tagName(value: string);
822
+ /**
823
+ * A node’s parent of type Element is known as its parent element.
824
+ * If the node has a parent of a different type, its parent element
825
+ * is null.
826
+ * @returns MockElement
827
+ */
828
+ get parentElement(): any;
829
+ get attributes(): MockAttributeMap;
830
+ set attributes(attrs: MockAttributeMap);
831
+ }
832
+ declare class MockTextNode extends MockNode {
833
+ constructor(ownerDocument: any, text: string);
834
+ cloneNode(_deep?: boolean): MockTextNode;
835
+ get textContent(): string;
836
+ set textContent(text: string);
837
+ get data(): string;
838
+ set data(text: string);
839
+ get wholeText(): string;
840
+ }
841
+ //#endregion
842
+ //#region src/comment-node.d.ts
843
+ declare class MockComment extends MockNode {
844
+ constructor(ownerDocument: any, data: string);
845
+ cloneNode(_deep?: boolean): MockComment;
846
+ get textContent(): string;
847
+ set textContent(text: string);
848
+ }
849
+ //#endregion
850
+ //#region src/constants.d.ts
851
+ declare const enum NODE_TYPES {
852
+ ELEMENT_NODE = 1,
853
+ TEXT_NODE = 3,
854
+ COMMENT_NODE = 8,
855
+ DOCUMENT_NODE = 9,
856
+ DOCUMENT_TYPE_NODE = 10,
857
+ DOCUMENT_FRAGMENT_NODE = 11
858
+ }
859
+ //#endregion
860
+ //#region src/document-type-node.d.ts
861
+ declare class MockDocumentTypeNode extends MockHTMLElement {
862
+ constructor(ownerDocument: any);
863
+ }
864
+ //#endregion
865
+ //#region src/document.d.ts
866
+ /**
867
+ * Interface for nwsapi instance methods we use.
868
+ */
869
+ interface NwsapiInstance {
870
+ configure(config: {
871
+ LOGERRORS?: boolean;
872
+ VERBOSITY?: boolean;
873
+ }): void;
874
+ match(selector: string, element: unknown): boolean;
875
+ first(selector: string, context: unknown): unknown | null;
876
+ select(selector: string, context: unknown): unknown[];
877
+ closest(selector: string, element: unknown): unknown | null;
878
+ }
879
+ declare class MockDocument extends MockHTMLElement {
880
+ #private;
881
+ defaultView: any;
882
+ cookie: string;
883
+ referrer: string;
884
+ /**
885
+ * Returns 'CSS1Compat' for standards mode (the default).
886
+ * Required by nwsapi for quirks mode detection.
887
+ */
888
+ readonly compatMode = "CSS1Compat";
889
+ /**
890
+ * Returns the MIME type of the document.
891
+ * Required by nwsapi for HTML document detection.
892
+ */
893
+ readonly contentType = "text/html";
894
+ constructor(html?: string | boolean | null, win?: any);
895
+ /**
896
+ * Get the nwsapi instance for this document.
897
+ * Lazily creates one if it doesn't exist.
898
+ * Creates a window if the document doesn't have one.
899
+ * @returns the nwsapi instance
900
+ */
901
+ _getDOMSelector(): NwsapiInstance;
902
+ /**
903
+ * Clear the nwsapi cache. Call this when the document structure changes significantly.
904
+ */
905
+ _clearDOMSelector(): void;
906
+ get dir(): string;
907
+ set dir(value: string);
908
+ get localName(): never;
909
+ get location(): Location | null;
910
+ set location(val: string);
911
+ get baseURI(): string;
912
+ get URL(): string;
913
+ get styleSheets(): HTMLStyleElement[];
914
+ get scripts(): HTMLScriptElement[];
915
+ get forms(): HTMLFormElement[];
916
+ get images(): HTMLImageElement[];
917
+ get scrollingElement(): MockHTMLElement | MockElement;
918
+ get documentElement(): MockHTMLElement | MockElement;
919
+ set documentElement(documentElement: MockHTMLElement | MockElement);
920
+ get head(): MockHTMLElement | MockElement;
921
+ set head(head: MockHTMLElement | MockElement);
922
+ get body(): MockHTMLElement | MockElement;
923
+ set body(body: MockHTMLElement | MockElement);
924
+ appendChild(newNode: MockElement): MockElement;
925
+ createComment(data: string): MockComment;
926
+ createAttribute(attrName: string): MockAttr;
927
+ createAttributeNS(namespaceURI: string, attrName: string): MockAttr;
928
+ createElement(tagName: string): any;
929
+ createElementNS(namespaceURI: string, tagName: string): any;
930
+ createTextNode(text: string): MockTextNode;
931
+ createDocumentFragment(): MockDocumentFragment;
932
+ createDocumentTypeNode(): MockDocumentTypeNode;
933
+ /**
934
+ * Creates a TreeWalker for traversing the document tree.
935
+ * This is a simplified implementation for dom-selector compatibility.
936
+ * @param root - the root node for the tree walker
937
+ * @param whatToShow - a bitmask specifying which nodes to show
938
+ * @param filter - an optional node filter
939
+ * @returns a new TreeWalker instance
940
+ */
941
+ createTreeWalker(root: MockElement, whatToShow?: number, filter?: NodeFilter | null): TreeWalker;
942
+ getElementById(id: string): MockElement;
943
+ getElementsByName(elmName: string): MockElement[];
944
+ get title(): string;
945
+ set title(value: string);
946
+ }
947
+ declare function createDocument(html?: string | boolean | null): Document;
948
+ declare function createFragment(html?: string): DocumentFragment;
949
+ declare function resetDocument(doc: Document): void;
950
+ //#endregion
951
+ //#region src/global.d.ts
952
+ declare function setupGlobal(gbl: any): any;
953
+ declare function teardownGlobal(gbl: any): void;
954
+ declare function patchWindow(winToBePatched: any): void;
955
+ //#endregion
956
+ //#region src/headers.d.ts
957
+ declare class MockHeaders {
958
+ private _values;
959
+ constructor(init?: string[][] | Map<string, string> | any);
960
+ append(key: string, value: string): void;
961
+ delete(key: string): void;
962
+ entries(): any;
963
+ forEach(cb: (value: string, key: string) => void): void;
964
+ get(key: string): string;
965
+ has(key: string): boolean;
966
+ keys(): {
967
+ next(): {
968
+ value: string;
969
+ done: boolean;
970
+ };
971
+ [Symbol.iterator](): /*elided*/any;
972
+ };
973
+ set(key: string, value: string): void;
974
+ values(): any;
975
+ [Symbol.iterator](): any;
976
+ }
977
+ //#endregion
978
+ //#region src/parse-html.d.ts
979
+ declare function parseHtmlToDocument(html: string, ownerDocument?: MockDocument | null): any;
980
+ declare function parseHtmlToFragment(html: string, ownerDocument?: MockDocument | null): any;
981
+ //#endregion
982
+ //#region src/request-response.d.ts
983
+ type MockRequestInfo = MockRequest | string;
984
+ interface MockRequestInit {
985
+ body?: any;
986
+ cache?: string;
987
+ credentials?: string;
988
+ headers?: any;
989
+ integrity?: string;
990
+ keepalive?: boolean;
991
+ method?: string;
992
+ mode?: string;
993
+ redirect?: string;
994
+ referrer?: string;
995
+ referrerPolicy?: string;
996
+ }
997
+ declare class MockRequest {
998
+ private _method;
999
+ private _url;
1000
+ bodyUsed: boolean;
1001
+ cache: string;
1002
+ credentials: string;
1003
+ headers: MockHeaders;
1004
+ integrity: string;
1005
+ keepalive: boolean;
1006
+ mode: string;
1007
+ redirect: string;
1008
+ referrer: string;
1009
+ referrerPolicy: string;
1010
+ constructor(input?: any, init?: MockRequestInit);
1011
+ get url(): string;
1012
+ set url(value: string);
1013
+ get method(): string;
1014
+ set method(value: string);
1015
+ clone(): MockRequest;
1016
+ }
1017
+ interface MockResponseInit {
1018
+ headers?: any;
1019
+ ok?: boolean;
1020
+ status?: number;
1021
+ statusText?: string;
1022
+ type?: string;
1023
+ url?: string;
1024
+ }
1025
+ declare class MockResponse {
1026
+ private _body;
1027
+ headers: MockHeaders;
1028
+ ok: boolean;
1029
+ status: number;
1030
+ statusText: string;
1031
+ type: string;
1032
+ url: string;
1033
+ constructor(body?: string, init?: MockResponseInit);
1034
+ json(): Promise<any>;
1035
+ text(): Promise<string>;
1036
+ clone(): MockResponse;
1037
+ }
1038
+ //#endregion
1039
+ export { MockAttr, MockAttributeMap, MockComment, MockCustomEvent, MockDocument, MockElement, MockHTMLElement, MockHeaders, MockKeyboardEvent, MockMouseEvent, MockNode, MockRequest, type MockRequestInfo, type MockRequestInit, MockResponse, type MockResponseInit, MockTextNode, MockWindow, NODE_TYPES, type SerializeNodeToHtmlOptions, cloneAttributes, cloneDocument, cloneWindow, constrainTimeouts, createDocument, createFragment, parseHtmlToDocument, parseHtmlToFragment, patchWindow, resetDocument, serializeNodeToHtml, setupGlobal, teardownGlobal };