@gjsify/dom-elements 0.1.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 (84) hide show
  1. package/README.md +31 -0
  2. package/lib/esm/attr.js +31 -0
  3. package/lib/esm/character-data.js +56 -0
  4. package/lib/esm/comment.js +21 -0
  5. package/lib/esm/document-fragment.js +112 -0
  6. package/lib/esm/document.js +83 -0
  7. package/lib/esm/dom-token-list.js +109 -0
  8. package/lib/esm/element.js +237 -0
  9. package/lib/esm/html-canvas-element.js +65 -0
  10. package/lib/esm/html-element.js +346 -0
  11. package/lib/esm/html-image-element.js +184 -0
  12. package/lib/esm/image.js +23 -0
  13. package/lib/esm/index.js +112 -0
  14. package/lib/esm/intersection-observer.js +19 -0
  15. package/lib/esm/mutation-observer.js +14 -0
  16. package/lib/esm/named-node-map.js +124 -0
  17. package/lib/esm/namespace-uri.js +10 -0
  18. package/lib/esm/node-list.js +34 -0
  19. package/lib/esm/node-type.js +14 -0
  20. package/lib/esm/node.js +227 -0
  21. package/lib/esm/property-symbol.js +30 -0
  22. package/lib/esm/resize-observer.js +13 -0
  23. package/lib/esm/text.js +51 -0
  24. package/lib/esm/types/i-html-image-element.js +0 -0
  25. package/lib/esm/types/image-data.js +0 -0
  26. package/lib/esm/types/index.js +3 -0
  27. package/lib/esm/types/predefined-color-space.js +0 -0
  28. package/lib/types/attr.d.ts +22 -0
  29. package/lib/types/character-data.d.ts +24 -0
  30. package/lib/types/comment.d.ts +12 -0
  31. package/lib/types/document-fragment.d.ts +37 -0
  32. package/lib/types/document.d.ts +39 -0
  33. package/lib/types/dom-token-list.d.ts +30 -0
  34. package/lib/types/element.d.ts +58 -0
  35. package/lib/types/html-canvas-element.d.ts +40 -0
  36. package/lib/types/html-element.d.ts +119 -0
  37. package/lib/types/html-image-element.d.ts +65 -0
  38. package/lib/types/image.d.ts +17 -0
  39. package/lib/types/index.d.ts +21 -0
  40. package/lib/types/intersection-observer.d.ts +21 -0
  41. package/lib/types/mutation-observer.d.ts +24 -0
  42. package/lib/types/named-node-map.d.ts +31 -0
  43. package/lib/types/namespace-uri.d.ts +7 -0
  44. package/lib/types/node-list.d.ts +18 -0
  45. package/lib/types/node-type.d.ts +11 -0
  46. package/lib/types/node.d.ts +63 -0
  47. package/lib/types/property-symbol.d.ts +14 -0
  48. package/lib/types/resize-observer.d.ts +13 -0
  49. package/lib/types/text.d.ts +21 -0
  50. package/lib/types/types/i-html-image-element.d.ts +41 -0
  51. package/lib/types/types/image-data.d.ts +11 -0
  52. package/lib/types/types/index.d.ts +3 -0
  53. package/lib/types/types/predefined-color-space.d.ts +1 -0
  54. package/package.json +43 -0
  55. package/src/attr.ts +61 -0
  56. package/src/character-data.ts +79 -0
  57. package/src/comment.ts +31 -0
  58. package/src/document-fragment.ts +137 -0
  59. package/src/document.ts +93 -0
  60. package/src/dom-token-list.ts +140 -0
  61. package/src/element.ts +299 -0
  62. package/src/html-canvas-element.ts +81 -0
  63. package/src/html-element.ts +422 -0
  64. package/src/html-image-element.ts +242 -0
  65. package/src/image.ts +31 -0
  66. package/src/index.spec.ts +897 -0
  67. package/src/index.ts +95 -0
  68. package/src/intersection-observer.ts +42 -0
  69. package/src/mutation-observer.ts +39 -0
  70. package/src/named-node-map.ts +159 -0
  71. package/src/namespace-uri.ts +11 -0
  72. package/src/node-list.ts +52 -0
  73. package/src/node-type.ts +14 -0
  74. package/src/node.ts +250 -0
  75. package/src/property-symbol.ts +23 -0
  76. package/src/resize-observer.ts +28 -0
  77. package/src/test.mts +6 -0
  78. package/src/text.ts +67 -0
  79. package/src/types/i-html-image-element.ts +44 -0
  80. package/src/types/image-data.ts +12 -0
  81. package/src/types/index.ts +3 -0
  82. package/src/types/predefined-color-space.ts +1 -0
  83. package/tsconfig.json +37 -0
  84. package/tsconfig.tsbuildinfo +1 -0
@@ -0,0 +1,24 @@
1
+ import { Node } from './node.js';
2
+ /**
3
+ * CharacterData base class for Text and Comment nodes.
4
+ *
5
+ * Reference: https://developer.mozilla.org/en-US/docs/Web/API/CharacterData
6
+ */
7
+ export declare class CharacterData extends Node {
8
+ private _data;
9
+ constructor(data?: string);
10
+ get data(): string;
11
+ set data(value: string);
12
+ get textContent(): string;
13
+ set textContent(value: string);
14
+ get nodeValue(): string;
15
+ set nodeValue(value: string);
16
+ get length(): number;
17
+ appendData(data: string): void;
18
+ deleteData(offset: number, count: number): void;
19
+ insertData(offset: number, data: string): void;
20
+ replaceData(offset: number, count: number, data: string): void;
21
+ substringData(offset: number, count: number): string;
22
+ cloneNode(_deep?: boolean): CharacterData;
23
+ get [Symbol.toStringTag](): string;
24
+ }
@@ -0,0 +1,12 @@
1
+ import { CharacterData } from './character-data.js';
2
+ /**
3
+ * Comment node.
4
+ *
5
+ * Reference: https://developer.mozilla.org/en-US/docs/Web/API/Comment
6
+ */
7
+ export declare class Comment extends CharacterData {
8
+ constructor(data?: string);
9
+ get nodeName(): string;
10
+ cloneNode(_deep?: boolean): Comment;
11
+ get [Symbol.toStringTag](): string;
12
+ }
@@ -0,0 +1,37 @@
1
+ import { Node } from './node.js';
2
+ import { Element } from './element.js';
3
+ /**
4
+ * DocumentFragment.
5
+ *
6
+ * Reference: https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment
7
+ */
8
+ export declare class DocumentFragment extends Node {
9
+ constructor();
10
+ get nodeName(): string;
11
+ /** Element children only (excludes text/comment nodes) */
12
+ get children(): Element[];
13
+ get childElementCount(): number;
14
+ get firstElementChild(): Element | null;
15
+ get lastElementChild(): Element | null;
16
+ get textContent(): string;
17
+ set textContent(value: string);
18
+ /**
19
+ * Append nodes or strings to this fragment.
20
+ */
21
+ append(...nodes: (Node | string)[]): void;
22
+ /**
23
+ * Prepend nodes or strings to this fragment.
24
+ */
25
+ prepend(...nodes: (Node | string)[]): void;
26
+ /**
27
+ * Replace all children with the given nodes.
28
+ */
29
+ replaceChildren(...nodes: (Node | string)[]): void;
30
+ /**
31
+ * Find an element by ID in this fragment's children.
32
+ */
33
+ getElementById(id: string): Element | null;
34
+ private _findById;
35
+ cloneNode(deep?: boolean): DocumentFragment;
36
+ get [Symbol.toStringTag](): string;
37
+ }
@@ -0,0 +1,39 @@
1
+ import { Node } from './node.js';
2
+ import { Element } from './element.js';
3
+ import { HTMLElement } from './html-element.js';
4
+ import { Text } from './text.js';
5
+ import { Comment } from './comment.js';
6
+ import { DocumentFragment } from './document-fragment.js';
7
+ import { Event } from '@gjsify/dom-events';
8
+ type ElementFactory = () => HTMLElement;
9
+ export declare class Document extends Node {
10
+ /** External packages register element factories here (e.g. @gjsify/iframe registers 'iframe') */
11
+ private static _elementFactories;
12
+ /** Stub body element */
13
+ readonly body: HTMLElement;
14
+ /** Stub head element */
15
+ readonly head: HTMLElement;
16
+ /** Stub documentElement */
17
+ readonly documentElement: HTMLElement;
18
+ /**
19
+ * Register a factory for a custom element tag name.
20
+ * Called as a side-effect by DOM packages to avoid circular dependencies.
21
+ *
22
+ * Example: `Document.registerElementFactory('iframe', () => new HTMLIFrameElement())`
23
+ */
24
+ static registerElementFactory(tagName: string, factory: ElementFactory): void;
25
+ createElementNS(_namespace: string | null, tagName: string): HTMLElement;
26
+ createElement(tagName: string): HTMLElement;
27
+ createTextNode(data: string): Text;
28
+ createComment(data: string): Comment;
29
+ createDocumentFragment(): DocumentFragment;
30
+ createEvent(type: string): Event;
31
+ /**
32
+ * Find an element by ID. Searches body's descendants.
33
+ */
34
+ getElementById(id: string): Element | null;
35
+ private _findById;
36
+ get [Symbol.toStringTag](): string;
37
+ }
38
+ export declare const document: Document;
39
+ export {};
@@ -0,0 +1,30 @@
1
+ import type { Element } from './element.js';
2
+ /**
3
+ * DOMTokenList — manages a set of space-separated tokens on an attribute.
4
+ *
5
+ * Reference: https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList
6
+ */
7
+ export declare class DOMTokenList {
8
+ private _ownerElement;
9
+ private _attributeName;
10
+ constructor(ownerElement: Element, attributeName: string);
11
+ private _getTokens;
12
+ private _setTokens;
13
+ get length(): number;
14
+ get value(): string;
15
+ set value(val: string);
16
+ item(index: number): string | null;
17
+ contains(token: string): boolean;
18
+ add(...tokens: string[]): void;
19
+ remove(...tokens: string[]): void;
20
+ toggle(token: string, force?: boolean): boolean;
21
+ replace(token: string, newToken: string): boolean;
22
+ supports(_token: string): boolean;
23
+ forEach(callback: (value: string, index: number, list: DOMTokenList) => void): void;
24
+ keys(): IterableIterator<number>;
25
+ values(): IterableIterator<string>;
26
+ entries(): IterableIterator<[number, string]>;
27
+ [Symbol.iterator](): IterableIterator<string>;
28
+ toString(): string;
29
+ get [Symbol.toStringTag](): string;
30
+ }
@@ -0,0 +1,58 @@
1
+ import { Event } from '@gjsify/dom-events';
2
+ import { Node } from './node.js';
3
+ import { NamedNodeMap } from './named-node-map.js';
4
+ import * as PS from './property-symbol.js';
5
+ /**
6
+ * DOM Element class.
7
+ *
8
+ * Reference: https://developer.mozilla.org/en-US/docs/Web/API/Element
9
+ */
10
+ export declare class Element extends Node {
11
+ [PS.tagName]: string;
12
+ [PS.localName]: string;
13
+ [PS.namespaceURI]: string | null;
14
+ [PS.prefix]: string | null;
15
+ [PS.attributes]: NamedNodeMap;
16
+ [PS.propertyEventListeners]: Map<string, ((event: Event) => void) | null>;
17
+ constructor();
18
+ get tagName(): string;
19
+ get localName(): string;
20
+ get namespaceURI(): string | null;
21
+ get prefix(): string | null;
22
+ get nodeName(): string;
23
+ get attributes(): NamedNodeMap;
24
+ get id(): string;
25
+ set id(value: string);
26
+ get className(): string;
27
+ set className(value: string);
28
+ get children(): Element[];
29
+ get childElementCount(): number;
30
+ get firstElementChild(): Element | null;
31
+ get lastElementChild(): Element | null;
32
+ get previousElementSibling(): Element | null;
33
+ get nextElementSibling(): Element | null;
34
+ get textContent(): string;
35
+ set textContent(_value: string | null);
36
+ getAttribute(qualifiedName: string): string | null;
37
+ getAttributeNS(namespace: string | null, localName: string): string | null;
38
+ setAttribute(qualifiedName: string, value: string): void;
39
+ setAttributeNS(namespace: string | null, qualifiedName: string, value: string): void;
40
+ removeAttribute(qualifiedName: string): void;
41
+ removeAttributeNS(namespace: string | null, localName: string): void;
42
+ hasAttribute(qualifiedName: string): boolean;
43
+ hasAttributeNS(namespace: string | null, localName: string): boolean;
44
+ getAttributeNode(qualifiedName: string): unknown;
45
+ setAttributeNode(attr: unknown): unknown;
46
+ removeAttributeNode(attr: unknown): unknown;
47
+ toggleAttribute(qualifiedName: string, force?: boolean): boolean;
48
+ hasAttributes(): boolean;
49
+ dispatchEvent(event: Event): boolean;
50
+ querySelector(_selectors: string): Element | null;
51
+ querySelectorAll(_selectors: string): Element[];
52
+ matches(_selectors: string): boolean;
53
+ closest(_selectors: string): Element | null;
54
+ getElementsByTagName(tagName: string): Element[];
55
+ getElementsByClassName(className: string): Element[];
56
+ cloneNode(deep?: boolean): Element;
57
+ get [Symbol.toStringTag](): string;
58
+ }
@@ -0,0 +1,40 @@
1
+ import { HTMLElement } from './html-element.js';
2
+ /**
3
+ * HTMLCanvasElement base class.
4
+ *
5
+ * This is a DOM-spec-compliant stub. The GTK-backed implementation lives in
6
+ * `@gjsify/webgl` and extends this class, overriding `getContext()`.
7
+ *
8
+ * Reference: https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement
9
+ */
10
+ export declare class HTMLCanvasElement extends HTMLElement {
11
+ private static _contextFactories;
12
+ /**
13
+ * Register a rendering context factory for a given context type.
14
+ * Called by packages like @gjsify/canvas2d and @gjsify/webgl to plug in their implementations.
15
+ */
16
+ static registerContextFactory(contextId: string, factory: (canvas: HTMLCanvasElement, options?: any) => any): void;
17
+ oncontextlost: ((ev: Event) => any) | null;
18
+ oncontextrestored: ((ev: Event) => any) | null;
19
+ onwebglcontextcreationerror: ((ev: Event) => any) | null;
20
+ onwebglcontextlost: ((ev: Event) => any) | null;
21
+ onwebglcontextrestored: ((ev: Event) => any) | null;
22
+ /** Returns the width of the canvas element. Default: 300. */
23
+ get width(): number;
24
+ set width(value: number);
25
+ /** Returns the height of the canvas element. Default: 150. */
26
+ get height(): number;
27
+ set height(value: number);
28
+ /**
29
+ * Returns a rendering context.
30
+ * Checks the static context factory registry for a matching factory.
31
+ * Subclasses (e.g. @gjsify/webgl) may override and fall through via super.getContext().
32
+ */
33
+ getContext(contextId: string, options?: any): any;
34
+ /** Returns a data URL representing the canvas image. Stub — returns empty string. */
35
+ toDataURL(_type?: string, _quality?: any): string;
36
+ /** Converts the canvas to a Blob and passes it to the callback. Stub — returns empty Blob. */
37
+ toBlob(callback: ((blob: Blob | null) => void), _type?: string, _quality?: any): void;
38
+ /** Returns a MediaStream capturing the canvas. Stub — returns empty object. */
39
+ captureStream(_frameRequestRate?: number): any;
40
+ }
@@ -0,0 +1,119 @@
1
+ import { Event } from '@gjsify/dom-events';
2
+ import { Element } from './element.js';
3
+ /**
4
+ * Minimal CSSStyleDeclaration stub — stores property strings but has no effect.
5
+ * GTK manages layout; CSS values written here (e.g. by three.js WebGLRenderer.setSize)
6
+ * are silently accepted and ignored.
7
+ */
8
+ export declare class CSSStyleDeclaration {
9
+ [key: string]: unknown;
10
+ cssText: string;
11
+ }
12
+ /**
13
+ * HTML Element base class.
14
+ *
15
+ * Reference: https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement
16
+ */
17
+ export declare class HTMLElement extends Element {
18
+ readonly style: CSSStyleDeclaration;
19
+ get title(): string;
20
+ set title(value: string);
21
+ get lang(): string;
22
+ set lang(value: string);
23
+ get dir(): string;
24
+ set dir(value: string);
25
+ get accessKey(): string;
26
+ set accessKey(value: string);
27
+ get accessKeyLabel(): string;
28
+ get hidden(): boolean;
29
+ set hidden(value: boolean);
30
+ get draggable(): boolean;
31
+ set draggable(value: boolean);
32
+ get spellcheck(): boolean;
33
+ set spellcheck(value: boolean);
34
+ get translate(): boolean;
35
+ set translate(value: boolean);
36
+ get tabIndex(): number;
37
+ set tabIndex(value: number);
38
+ get contentEditable(): string;
39
+ set contentEditable(value: string);
40
+ get isContentEditable(): boolean;
41
+ get offsetHeight(): number;
42
+ get offsetWidth(): number;
43
+ get offsetLeft(): number;
44
+ get offsetTop(): number;
45
+ get offsetParent(): Element | null;
46
+ get clientHeight(): number;
47
+ get clientWidth(): number;
48
+ get clientLeft(): number;
49
+ get clientTop(): number;
50
+ get scrollHeight(): number;
51
+ get scrollWidth(): number;
52
+ get scrollTop(): number;
53
+ set scrollTop(_value: number);
54
+ get scrollLeft(): number;
55
+ set scrollLeft(_value: number);
56
+ click(): void;
57
+ blur(): void;
58
+ focus(): void;
59
+ get onclick(): ((event: Event) => void) | null;
60
+ set onclick(value: ((event: Event) => void) | null);
61
+ get ondblclick(): ((event: Event) => void) | null;
62
+ set ondblclick(value: ((event: Event) => void) | null);
63
+ get onload(): ((event: Event) => void) | null;
64
+ set onload(value: ((event: Event) => void) | null);
65
+ get onerror(): ((event: Event) => void) | null;
66
+ set onerror(value: ((event: Event) => void) | null);
67
+ get onabort(): ((event: Event) => void) | null;
68
+ set onabort(value: ((event: Event) => void) | null);
69
+ get onfocus(): ((event: Event) => void) | null;
70
+ set onfocus(value: ((event: Event) => void) | null);
71
+ get onblur(): ((event: Event) => void) | null;
72
+ set onblur(value: ((event: Event) => void) | null);
73
+ get onchange(): ((event: Event) => void) | null;
74
+ set onchange(value: ((event: Event) => void) | null);
75
+ get oninput(): ((event: Event) => void) | null;
76
+ set oninput(value: ((event: Event) => void) | null);
77
+ get onsubmit(): ((event: Event) => void) | null;
78
+ set onsubmit(value: ((event: Event) => void) | null);
79
+ get onreset(): ((event: Event) => void) | null;
80
+ set onreset(value: ((event: Event) => void) | null);
81
+ get onscroll(): ((event: Event) => void) | null;
82
+ set onscroll(value: ((event: Event) => void) | null);
83
+ get onresize(): ((event: Event) => void) | null;
84
+ set onresize(value: ((event: Event) => void) | null);
85
+ get onmousedown(): ((event: Event) => void) | null;
86
+ set onmousedown(value: ((event: Event) => void) | null);
87
+ get onmouseup(): ((event: Event) => void) | null;
88
+ set onmouseup(value: ((event: Event) => void) | null);
89
+ get onmousemove(): ((event: Event) => void) | null;
90
+ set onmousemove(value: ((event: Event) => void) | null);
91
+ get onmouseover(): ((event: Event) => void) | null;
92
+ set onmouseover(value: ((event: Event) => void) | null);
93
+ get onmouseout(): ((event: Event) => void) | null;
94
+ set onmouseout(value: ((event: Event) => void) | null);
95
+ get onmouseenter(): ((event: Event) => void) | null;
96
+ set onmouseenter(value: ((event: Event) => void) | null);
97
+ get onmouseleave(): ((event: Event) => void) | null;
98
+ set onmouseleave(value: ((event: Event) => void) | null);
99
+ get oncontextmenu(): ((event: Event) => void) | null;
100
+ set oncontextmenu(value: ((event: Event) => void) | null);
101
+ get onkeydown(): ((event: Event) => void) | null;
102
+ set onkeydown(value: ((event: Event) => void) | null);
103
+ get onkeyup(): ((event: Event) => void) | null;
104
+ set onkeyup(value: ((event: Event) => void) | null);
105
+ get ontouchstart(): ((event: Event) => void) | null;
106
+ set ontouchstart(value: ((event: Event) => void) | null);
107
+ get ontouchend(): ((event: Event) => void) | null;
108
+ set ontouchend(value: ((event: Event) => void) | null);
109
+ get ontouchmove(): ((event: Event) => void) | null;
110
+ set ontouchmove(value: ((event: Event) => void) | null);
111
+ get onpointerdown(): ((event: Event) => void) | null;
112
+ set onpointerdown(value: ((event: Event) => void) | null);
113
+ get onpointerup(): ((event: Event) => void) | null;
114
+ set onpointerup(value: ((event: Event) => void) | null);
115
+ get onpointermove(): ((event: Event) => void) | null;
116
+ set onpointermove(value: ((event: Event) => void) | null);
117
+ cloneNode(deep?: boolean): HTMLElement;
118
+ get [Symbol.toStringTag](): string;
119
+ }
@@ -0,0 +1,65 @@
1
+ import GdkPixbuf from '@girs/gdkpixbuf-2.0';
2
+ import { HTMLElement } from './html-element.js';
3
+ import type { ImageData } from './types/index.js';
4
+ /**
5
+ * HTML Image Element.
6
+ *
7
+ * Reference: https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement
8
+ */
9
+ export declare class HTMLImageElement extends HTMLElement {
10
+ private _complete;
11
+ private _naturalHeight;
12
+ private _naturalWidth;
13
+ protected _pixbuf?: GdkPixbuf.Pixbuf;
14
+ constructor();
15
+ get complete(): boolean;
16
+ get naturalHeight(): number;
17
+ get naturalWidth(): number;
18
+ get currentSrc(): string;
19
+ get x(): number;
20
+ get y(): number;
21
+ get alt(): string;
22
+ set alt(value: string);
23
+ get crossOrigin(): string | null;
24
+ set crossOrigin(value: string | null);
25
+ get decoding(): string;
26
+ set decoding(value: string);
27
+ get loading(): string;
28
+ set loading(value: string);
29
+ get referrerPolicy(): string;
30
+ set referrerPolicy(value: string);
31
+ get sizes(): string;
32
+ set sizes(value: string);
33
+ get src(): string;
34
+ set src(src: string);
35
+ get srcset(): string;
36
+ set srcset(value: string);
37
+ get useMap(): string;
38
+ set useMap(value: string);
39
+ get height(): number;
40
+ set height(value: number);
41
+ get width(): number;
42
+ set width(value: number);
43
+ get isMap(): boolean;
44
+ set isMap(value: boolean);
45
+ /**
46
+ * Decode the image. Returns a promise that resolves when the image is decoded.
47
+ */
48
+ decode(): Promise<void>;
49
+ /**
50
+ * Clone this node.
51
+ */
52
+ cloneNode(deep?: boolean): HTMLImageElement;
53
+ /**
54
+ * Get the pixels of the loaded GdkPixbuf as ImageData.
55
+ * Always returns RGBA (4 channels) — matches standard browser ImageData behaviour
56
+ * and what WebGL expects for texSubImage2D with format=RGBA.
57
+ * JPEG and other non-alpha formats are promoted to RGBA via add_alpha().
58
+ */
59
+ getImageData(): ImageData | null;
60
+ /**
61
+ * Check if this image is backed by a GdkPixbuf.
62
+ */
63
+ isPixbuf(): boolean;
64
+ get [Symbol.toStringTag](): string;
65
+ }
@@ -0,0 +1,17 @@
1
+ import { HTMLImageElement } from './html-image-element.js';
2
+ /**
3
+ * Image as constructor.
4
+ *
5
+ * Reference:
6
+ * https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/Image.
7
+ */
8
+ export default class Image extends HTMLImageElement {
9
+ /**
10
+ * Constructor.
11
+ *
12
+ * @param [width] Width.
13
+ * @param [height] Height.
14
+ */
15
+ constructor(width?: number | null, height?: number | null);
16
+ }
17
+ export { HTMLImageElement, Image };
@@ -0,0 +1,21 @@
1
+ export { Attr } from './attr.js';
2
+ export { NamedNodeMap } from './named-node-map.js';
3
+ export { NodeList } from './node-list.js';
4
+ export { Node } from './node.js';
5
+ export { CharacterData } from './character-data.js';
6
+ export { Text } from './text.js';
7
+ export { Comment } from './comment.js';
8
+ export { DocumentFragment } from './document-fragment.js';
9
+ export { DOMTokenList } from './dom-token-list.js';
10
+ export { Element } from './element.js';
11
+ export { HTMLElement, CSSStyleDeclaration } from './html-element.js';
12
+ export { HTMLCanvasElement } from './html-canvas-element.js';
13
+ export { HTMLImageElement } from './html-image-element.js';
14
+ export { Image } from './image.js';
15
+ export { Document, document } from './document.js';
16
+ export { MutationObserver } from './mutation-observer.js';
17
+ export { ResizeObserver } from './resize-observer.js';
18
+ export { IntersectionObserver } from './intersection-observer.js';
19
+ export { NodeType } from './node-type.js';
20
+ export { NamespaceURI } from './namespace-uri.js';
21
+ export * as PropertySymbol from './property-symbol.js';
@@ -0,0 +1,21 @@
1
+ import type { Element } from './element.js';
2
+ /**
3
+ * IntersectionObserver stub.
4
+ * Many libraries check for IntersectionObserver existence; this prevents crashes.
5
+ *
6
+ * Reference: https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserver
7
+ */
8
+ export declare class IntersectionObserver {
9
+ readonly root: Element | null;
10
+ readonly rootMargin: string;
11
+ readonly thresholds: readonly number[];
12
+ constructor(_callback: (...args: unknown[]) => void, options?: {
13
+ root?: Element | null;
14
+ rootMargin?: string;
15
+ threshold?: number | number[];
16
+ });
17
+ observe(_target: Element): void;
18
+ unobserve(_target: Element): void;
19
+ disconnect(): void;
20
+ takeRecords(): unknown[];
21
+ }
@@ -0,0 +1,24 @@
1
+ import type { Node } from './node.js';
2
+ interface MutationObserverOptions {
3
+ childList?: boolean;
4
+ attributes?: boolean;
5
+ characterData?: boolean;
6
+ subtree?: boolean;
7
+ attributeOldValue?: boolean;
8
+ characterDataOldValue?: boolean;
9
+ attributeFilter?: string[];
10
+ }
11
+ /**
12
+ * MutationObserver stub.
13
+ * Many libraries check for MutationObserver existence; this prevents crashes.
14
+ * Does not actually observe DOM mutations (no layout engine).
15
+ *
16
+ * Reference: https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver
17
+ */
18
+ export declare class MutationObserver {
19
+ constructor(_callback: (...args: unknown[]) => void);
20
+ observe(_target: Node, _options?: MutationObserverOptions): void;
21
+ disconnect(): void;
22
+ takeRecords(): unknown[];
23
+ }
24
+ export {};
@@ -0,0 +1,31 @@
1
+ import { Attr } from './attr.js';
2
+ import type { Element } from './element.js';
3
+ /**
4
+ * Simplified NamedNodeMap for attribute storage.
5
+ *
6
+ * Reference: https://developer.mozilla.org/en-US/docs/Web/API/NamedNodeMap
7
+ */
8
+ export declare class NamedNodeMap {
9
+ private _items;
10
+ private _ownerElement;
11
+ constructor(ownerElement: Element);
12
+ get length(): number;
13
+ item(index: number): Attr | null;
14
+ getNamedItem(qualifiedName: string): Attr | null;
15
+ getNamedItemNS(namespace: string | null, localName: string): Attr | null;
16
+ setNamedItem(attr: Attr): Attr | null;
17
+ setNamedItemNS(attr: Attr): Attr | null;
18
+ removeNamedItem(qualifiedName: string): Attr;
19
+ removeNamedItemNS(namespace: string | null, localName: string): Attr;
20
+ [Symbol.iterator](): IterableIterator<Attr>;
21
+ get [Symbol.toStringTag](): string;
22
+ /** @internal Add or replace an attribute by name. */
23
+ _setNamedItem(name: string, value: string, namespaceURI?: string | null, prefix?: string | null): void;
24
+ /** @internal Remove an attribute by name. Returns true if removed. */
25
+ _removeNamedItem(name: string): boolean;
26
+ /** @internal Remove an attribute by namespace + localName. Returns true if removed. */
27
+ _removeNamedItemNS(namespace: string | null, localName: string): boolean;
28
+ private _findByName;
29
+ private _setAttr;
30
+ private _removeAttr;
31
+ }
@@ -0,0 +1,7 @@
1
+ export declare const NamespaceURI: {
2
+ readonly html: "http://www.w3.org/1999/xhtml";
3
+ readonly svg: "http://www.w3.org/2000/svg";
4
+ readonly mathML: "http://www.w3.org/1998/Math/MathML";
5
+ readonly xml: "http://www.w3.org/XML/1998/namespace";
6
+ readonly xmlns: "http://www.w3.org/2000/xmlns/";
7
+ };
@@ -0,0 +1,18 @@
1
+ import type { Node } from './node.js';
2
+ /**
3
+ * Minimal NodeList backed by an external array.
4
+ *
5
+ * Reference: https://developer.mozilla.org/en-US/docs/Web/API/NodeList
6
+ */
7
+ export declare class NodeList {
8
+ private _items;
9
+ constructor(items: Node[]);
10
+ get length(): number;
11
+ item(index: number): Node | null;
12
+ forEach(callback: (node: Node, index: number, list: NodeList) => void, thisArg?: unknown): void;
13
+ entries(): IterableIterator<[number, Node]>;
14
+ keys(): IterableIterator<number>;
15
+ values(): IterableIterator<Node>;
16
+ [Symbol.iterator](): IterableIterator<Node>;
17
+ get [Symbol.toStringTag](): string;
18
+ }
@@ -0,0 +1,11 @@
1
+ export declare const NodeType: {
2
+ readonly ELEMENT_NODE: 1;
3
+ readonly ATTRIBUTE_NODE: 2;
4
+ readonly TEXT_NODE: 3;
5
+ readonly CDATA_SECTION_NODE: 4;
6
+ readonly PROCESSING_INSTRUCTION_NODE: 7;
7
+ readonly COMMENT_NODE: 8;
8
+ readonly DOCUMENT_NODE: 9;
9
+ readonly DOCUMENT_TYPE_NODE: 10;
10
+ readonly DOCUMENT_FRAGMENT_NODE: 11;
11
+ };
@@ -0,0 +1,63 @@
1
+ import { EventTarget } from '@gjsify/dom-events';
2
+ import { NodeList } from './node-list.js';
3
+ import * as PS from './property-symbol.js';
4
+ /**
5
+ * DOM Node base class.
6
+ *
7
+ * Reference: https://developer.mozilla.org/en-US/docs/Web/API/Node
8
+ */
9
+ export declare class Node extends EventTarget {
10
+ static readonly ELEMENT_NODE: 1;
11
+ static readonly ATTRIBUTE_NODE: 2;
12
+ static readonly TEXT_NODE: 3;
13
+ static readonly CDATA_SECTION_NODE: 4;
14
+ static readonly PROCESSING_INSTRUCTION_NODE: 7;
15
+ static readonly COMMENT_NODE: 8;
16
+ static readonly DOCUMENT_NODE: 9;
17
+ static readonly DOCUMENT_TYPE_NODE: 10;
18
+ static readonly DOCUMENT_FRAGMENT_NODE: 11;
19
+ readonly ELEMENT_NODE: 1;
20
+ readonly ATTRIBUTE_NODE: 2;
21
+ readonly TEXT_NODE: 3;
22
+ readonly CDATA_SECTION_NODE: 4;
23
+ readonly PROCESSING_INSTRUCTION_NODE: 7;
24
+ readonly COMMENT_NODE: 8;
25
+ readonly DOCUMENT_NODE: 9;
26
+ readonly DOCUMENT_TYPE_NODE: 10;
27
+ readonly DOCUMENT_FRAGMENT_NODE: 11;
28
+ static readonly DOCUMENT_POSITION_DISCONNECTED = 1;
29
+ static readonly DOCUMENT_POSITION_PRECEDING = 2;
30
+ static readonly DOCUMENT_POSITION_FOLLOWING = 4;
31
+ static readonly DOCUMENT_POSITION_CONTAINS = 8;
32
+ static readonly DOCUMENT_POSITION_CONTAINED_BY = 16;
33
+ static readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 32;
34
+ [PS.nodeType]: number;
35
+ [PS.parentNode]: Node | null;
36
+ [PS.childNodesList]: Node[];
37
+ [PS.elementChildren]: Node[];
38
+ [PS.isConnected]: boolean;
39
+ get nodeType(): number;
40
+ get nodeName(): string;
41
+ get parentNode(): Node | null;
42
+ get parentElement(): Node | null;
43
+ get childNodes(): NodeList;
44
+ get firstChild(): Node | null;
45
+ get lastChild(): Node | null;
46
+ get previousSibling(): Node | null;
47
+ get nextSibling(): Node | null;
48
+ get textContent(): string | null;
49
+ set textContent(_value: string | null);
50
+ get nodeValue(): string | null;
51
+ set nodeValue(_value: string | null);
52
+ get ownerDocument(): null;
53
+ get isConnected(): boolean;
54
+ hasChildNodes(): boolean;
55
+ contains(other: Node | null): boolean;
56
+ getRootNode(): Node;
57
+ appendChild(node: Node): Node;
58
+ removeChild(node: Node): Node;
59
+ insertBefore(newNode: Node, referenceNode: Node | null): Node;
60
+ replaceChild(newChild: Node, oldChild: Node): Node;
61
+ cloneNode(deep?: boolean): Node;
62
+ get [Symbol.toStringTag](): string;
63
+ }
@@ -0,0 +1,14 @@
1
+ export declare const nodeType: unique symbol;
2
+ export declare const parentNode: unique symbol;
3
+ export declare const childNodesList: unique symbol;
4
+ export declare const elementChildren: unique symbol;
5
+ export declare const isConnected: unique symbol;
6
+ export declare const tagName: unique symbol;
7
+ export declare const localName: unique symbol;
8
+ export declare const namespaceURI: unique symbol;
9
+ export declare const prefix: unique symbol;
10
+ export declare const attributes: unique symbol;
11
+ export declare const propertyEventListeners: unique symbol;
12
+ export declare const name: unique symbol;
13
+ export declare const value: unique symbol;
14
+ export declare const ownerElement: unique symbol;