@gjsify/dom-elements 0.3.13 → 0.3.14

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 (41) hide show
  1. package/lib/esm/_virtual/_rolldown/runtime.js +18 -0
  2. package/lib/esm/attr.js +37 -30
  3. package/lib/esm/character-data.js +61 -54
  4. package/lib/esm/comment.js +26 -19
  5. package/lib/esm/document-fragment.js +116 -109
  6. package/lib/esm/document.js +75 -81
  7. package/lib/esm/dom-matrix.js +158 -123
  8. package/lib/esm/dom-token-list.js +114 -108
  9. package/lib/esm/element.js +244 -246
  10. package/lib/esm/font-face.js +94 -89
  11. package/lib/esm/gst-time.js +17 -6
  12. package/lib/esm/html-canvas-element.js +82 -75
  13. package/lib/esm/html-element.js +424 -424
  14. package/lib/esm/html-image-element.js +226 -225
  15. package/lib/esm/html-media-element.js +117 -114
  16. package/lib/esm/html-video-element.js +110 -108
  17. package/lib/esm/image.js +27 -21
  18. package/lib/esm/index.js +13 -45
  19. package/lib/esm/intersection-observer.js +22 -18
  20. package/lib/esm/location-stub.js +25 -23
  21. package/lib/esm/match-media.js +18 -19
  22. package/lib/esm/mutation-observer.js +18 -13
  23. package/lib/esm/named-node-map.js +121 -121
  24. package/lib/esm/namespace-uri.js +9 -8
  25. package/lib/esm/node-list.js +39 -33
  26. package/lib/esm/node-type.js +13 -12
  27. package/lib/esm/node.js +241 -246
  28. package/lib/esm/property-symbol.js +36 -30
  29. package/lib/esm/register/canvas.js +11 -7
  30. package/lib/esm/register/document.js +19 -18
  31. package/lib/esm/register/font-face.js +10 -6
  32. package/lib/esm/register/helpers.js +14 -12
  33. package/lib/esm/register/image.js +4 -0
  34. package/lib/esm/register/location.js +4 -0
  35. package/lib/esm/register/match-media.js +4 -0
  36. package/lib/esm/register/navigator.js +4 -1
  37. package/lib/esm/register/observers.js +5 -1
  38. package/lib/esm/resize-observer.js +15 -12
  39. package/lib/esm/text.js +56 -49
  40. package/lib/esm/types/index.js +3 -3
  41. package/package.json +11 -11
package/lib/esm/node.js CHANGED
@@ -1,249 +1,244 @@
1
- var _a, _b, _c, _d, _e;
2
- import { EventTarget } from "@gjsify/dom-events";
1
+ import { childNodesList, elementChildren, isConnected, nodeType, parentNode } from "./property-symbol.js";
3
2
  import { NodeType } from "./node-type.js";
4
3
  import { NodeList } from "./node-list.js";
5
- import * as PS from "./property-symbol.js";
6
- class Node extends EventTarget {
7
- constructor() {
8
- super(...arguments);
9
- // Instance node type constants (mirror static for spec compliance)
10
- this.ELEMENT_NODE = NodeType.ELEMENT_NODE;
11
- this.ATTRIBUTE_NODE = NodeType.ATTRIBUTE_NODE;
12
- this.TEXT_NODE = NodeType.TEXT_NODE;
13
- this.CDATA_SECTION_NODE = NodeType.CDATA_SECTION_NODE;
14
- this.PROCESSING_INSTRUCTION_NODE = NodeType.PROCESSING_INSTRUCTION_NODE;
15
- this.COMMENT_NODE = NodeType.COMMENT_NODE;
16
- this.DOCUMENT_NODE = NodeType.DOCUMENT_NODE;
17
- this.DOCUMENT_TYPE_NODE = NodeType.DOCUMENT_TYPE_NODE;
18
- this.DOCUMENT_FRAGMENT_NODE = NodeType.DOCUMENT_FRAGMENT_NODE;
19
- // Internal state
20
- this[_e] = NodeType.ELEMENT_NODE;
21
- this[_d] = null;
22
- this[_c] = [];
23
- this[_b] = [];
24
- this[_a] = false;
25
- }
26
- static {
27
- // Static node type constants
28
- this.ELEMENT_NODE = NodeType.ELEMENT_NODE;
29
- }
30
- static {
31
- this.ATTRIBUTE_NODE = NodeType.ATTRIBUTE_NODE;
32
- }
33
- static {
34
- this.TEXT_NODE = NodeType.TEXT_NODE;
35
- }
36
- static {
37
- this.CDATA_SECTION_NODE = NodeType.CDATA_SECTION_NODE;
38
- }
39
- static {
40
- this.PROCESSING_INSTRUCTION_NODE = NodeType.PROCESSING_INSTRUCTION_NODE;
41
- }
42
- static {
43
- this.COMMENT_NODE = NodeType.COMMENT_NODE;
44
- }
45
- static {
46
- this.DOCUMENT_NODE = NodeType.DOCUMENT_NODE;
47
- }
48
- static {
49
- this.DOCUMENT_TYPE_NODE = NodeType.DOCUMENT_TYPE_NODE;
50
- }
51
- static {
52
- this.DOCUMENT_FRAGMENT_NODE = NodeType.DOCUMENT_FRAGMENT_NODE;
53
- }
54
- static {
55
- // DOCUMENT_POSITION constants
56
- this.DOCUMENT_POSITION_DISCONNECTED = 1;
57
- }
58
- static {
59
- this.DOCUMENT_POSITION_PRECEDING = 2;
60
- }
61
- static {
62
- this.DOCUMENT_POSITION_FOLLOWING = 4;
63
- }
64
- static {
65
- this.DOCUMENT_POSITION_CONTAINS = 8;
66
- }
67
- static {
68
- this.DOCUMENT_POSITION_CONTAINED_BY = 16;
69
- }
70
- static {
71
- this.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 32;
72
- }
73
- get nodeType() {
74
- return this[PS.nodeType];
75
- }
76
- get nodeName() {
77
- return "";
78
- }
79
- get parentNode() {
80
- return this[PS.parentNode];
81
- }
82
- get parentElement() {
83
- const parent = this[PS.parentNode];
84
- return parent && parent[PS.nodeType] === NodeType.ELEMENT_NODE ? parent : null;
85
- }
86
- get childNodes() {
87
- return new NodeList(this[PS.childNodesList]);
88
- }
89
- get firstChild() {
90
- return this[PS.childNodesList][0] ?? null;
91
- }
92
- get lastChild() {
93
- const children = this[PS.childNodesList];
94
- return children[children.length - 1] ?? null;
95
- }
96
- get previousSibling() {
97
- const parent = this[PS.parentNode];
98
- if (!parent) return null;
99
- const siblings = parent[PS.childNodesList];
100
- const idx = siblings.indexOf(this);
101
- return idx > 0 ? siblings[idx - 1] : null;
102
- }
103
- get nextSibling() {
104
- const parent = this[PS.parentNode];
105
- if (!parent) return null;
106
- const siblings = parent[PS.childNodesList];
107
- const idx = siblings.indexOf(this);
108
- return idx !== -1 && idx < siblings.length - 1 ? siblings[idx + 1] : null;
109
- }
110
- get textContent() {
111
- return null;
112
- }
113
- set textContent(_value) {
114
- }
115
- get nodeValue() {
116
- return null;
117
- }
118
- set nodeValue(_value) {
119
- }
120
- get ownerDocument() {
121
- let root = this;
122
- while (root[PS.parentNode]) {
123
- root = root[PS.parentNode];
124
- }
125
- const doc = globalThis.document;
126
- return root === doc ? doc : null;
127
- }
128
- get isConnected() {
129
- return this[PS.isConnected];
130
- }
131
- hasChildNodes() {
132
- return this[PS.childNodesList].length > 0;
133
- }
134
- contains(other) {
135
- if (other === null) return false;
136
- if (other === this) return true;
137
- let node = other;
138
- while (node) {
139
- if (node === this) return true;
140
- node = node[PS.parentNode];
141
- }
142
- return false;
143
- }
144
- getRootNode() {
145
- let node = this;
146
- while (node[PS.parentNode]) {
147
- node = node[PS.parentNode];
148
- }
149
- return node;
150
- }
151
- appendChild(node) {
152
- if (node[PS.parentNode]) {
153
- node[PS.parentNode].removeChild(node);
154
- }
155
- node[PS.parentNode] = this;
156
- this[PS.childNodesList].push(node);
157
- if (node[PS.nodeType] === NodeType.ELEMENT_NODE) {
158
- this[PS.elementChildren].push(node);
159
- }
160
- return node;
161
- }
162
- removeChild(node) {
163
- const children = this[PS.childNodesList];
164
- const idx = children.indexOf(node);
165
- if (idx === -1) {
166
- throw new DOMException(
167
- "Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.",
168
- "NotFoundError"
169
- );
170
- }
171
- children.splice(idx, 1);
172
- node[PS.parentNode] = null;
173
- if (node[PS.nodeType] === NodeType.ELEMENT_NODE) {
174
- const elemIdx = this[PS.elementChildren].indexOf(node);
175
- if (elemIdx !== -1) {
176
- this[PS.elementChildren].splice(elemIdx, 1);
177
- }
178
- }
179
- return node;
180
- }
181
- insertBefore(newNode, referenceNode) {
182
- if (referenceNode === null) {
183
- return this.appendChild(newNode);
184
- }
185
- const children = this[PS.childNodesList];
186
- const refIdx = children.indexOf(referenceNode);
187
- if (refIdx === -1) {
188
- throw new DOMException(
189
- "Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted is not a child of this node.",
190
- "NotFoundError"
191
- );
192
- }
193
- if (newNode[PS.parentNode]) {
194
- newNode[PS.parentNode].removeChild(newNode);
195
- }
196
- newNode[PS.parentNode] = this;
197
- children.splice(refIdx, 0, newNode);
198
- if (newNode[PS.nodeType] === NodeType.ELEMENT_NODE) {
199
- const elemChildren = this[PS.elementChildren];
200
- let elemIdx = elemChildren.length;
201
- for (let i = refIdx; i < children.length; i++) {
202
- if (children[i][PS.nodeType] === NodeType.ELEMENT_NODE && children[i] !== newNode) {
203
- elemIdx = elemChildren.indexOf(children[i]);
204
- break;
205
- }
206
- }
207
- elemChildren.splice(elemIdx, 0, newNode);
208
- }
209
- return newNode;
210
- }
211
- replaceChild(newChild, oldChild) {
212
- this.insertBefore(newChild, oldChild);
213
- this.removeChild(oldChild);
214
- return oldChild;
215
- }
216
- cloneNode(deep = false) {
217
- const clone = new this.constructor();
218
- clone[PS.nodeType] = this[PS.nodeType];
219
- if (deep) {
220
- for (const child of this[PS.childNodesList]) {
221
- clone.appendChild(child.cloneNode(true));
222
- }
223
- }
224
- return clone;
225
- }
226
- /**
227
- * Override dispatchEvent to support event bubbling through the DOM tree.
228
- * After AT_TARGET phase, if event.bubbles is true, walk up the parentNode
229
- * chain and dispatch on each ancestor (BUBBLING_PHASE).
230
- */
231
- dispatchEvent(event) {
232
- const result = super.dispatchEvent(event);
233
- if (event.bubbles && !event.cancelBubble) {
234
- let parent = this[PS.parentNode];
235
- while (parent) {
236
- Object.getPrototypeOf(Node.prototype).dispatchEvent.call(parent, event);
237
- if (event.cancelBubble) break;
238
- parent = parent[PS.parentNode];
239
- }
240
- }
241
- return result;
242
- }
243
- get [(_e = PS.nodeType, _d = PS.parentNode, _c = PS.childNodesList, _b = PS.elementChildren, _a = PS.isConnected, Symbol.toStringTag)]() {
244
- return "Node";
245
- }
246
- }
247
- export {
248
- Node
4
+ import { EventTarget } from "@gjsify/dom-events";
5
+
6
+ //#region src/node.ts
7
+ let _PS$nodeType, _PS$parentNode, _PS$childNodesList, _PS$elementChildren, _PS$isConnected;
8
+ /**
9
+ * DOM Node base class.
10
+ *
11
+ * Reference: https://developer.mozilla.org/en-US/docs/Web/API/Node
12
+ */
13
+ var Node = class Node extends EventTarget {
14
+ constructor(..._args) {
15
+ super(..._args);
16
+ this.ELEMENT_NODE = NodeType.ELEMENT_NODE;
17
+ this.ATTRIBUTE_NODE = NodeType.ATTRIBUTE_NODE;
18
+ this.TEXT_NODE = NodeType.TEXT_NODE;
19
+ this.CDATA_SECTION_NODE = NodeType.CDATA_SECTION_NODE;
20
+ this.PROCESSING_INSTRUCTION_NODE = NodeType.PROCESSING_INSTRUCTION_NODE;
21
+ this.COMMENT_NODE = NodeType.COMMENT_NODE;
22
+ this.DOCUMENT_NODE = NodeType.DOCUMENT_NODE;
23
+ this.DOCUMENT_TYPE_NODE = NodeType.DOCUMENT_TYPE_NODE;
24
+ this.DOCUMENT_FRAGMENT_NODE = NodeType.DOCUMENT_FRAGMENT_NODE;
25
+ this[_PS$nodeType] = NodeType.ELEMENT_NODE;
26
+ this[_PS$parentNode] = null;
27
+ this[_PS$childNodesList] = [];
28
+ this[_PS$elementChildren] = [];
29
+ this[_PS$isConnected] = false;
30
+ }
31
+ static {
32
+ this.ELEMENT_NODE = NodeType.ELEMENT_NODE;
33
+ }
34
+ static {
35
+ this.ATTRIBUTE_NODE = NodeType.ATTRIBUTE_NODE;
36
+ }
37
+ static {
38
+ this.TEXT_NODE = NodeType.TEXT_NODE;
39
+ }
40
+ static {
41
+ this.CDATA_SECTION_NODE = NodeType.CDATA_SECTION_NODE;
42
+ }
43
+ static {
44
+ this.PROCESSING_INSTRUCTION_NODE = NodeType.PROCESSING_INSTRUCTION_NODE;
45
+ }
46
+ static {
47
+ this.COMMENT_NODE = NodeType.COMMENT_NODE;
48
+ }
49
+ static {
50
+ this.DOCUMENT_NODE = NodeType.DOCUMENT_NODE;
51
+ }
52
+ static {
53
+ this.DOCUMENT_TYPE_NODE = NodeType.DOCUMENT_TYPE_NODE;
54
+ }
55
+ static {
56
+ this.DOCUMENT_FRAGMENT_NODE = NodeType.DOCUMENT_FRAGMENT_NODE;
57
+ }
58
+ static {
59
+ this.DOCUMENT_POSITION_DISCONNECTED = 1;
60
+ }
61
+ static {
62
+ this.DOCUMENT_POSITION_PRECEDING = 2;
63
+ }
64
+ static {
65
+ this.DOCUMENT_POSITION_FOLLOWING = 4;
66
+ }
67
+ static {
68
+ this.DOCUMENT_POSITION_CONTAINS = 8;
69
+ }
70
+ static {
71
+ this.DOCUMENT_POSITION_CONTAINED_BY = 16;
72
+ }
73
+ static {
74
+ this.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 32;
75
+ }
76
+ get nodeType() {
77
+ return this[nodeType];
78
+ }
79
+ get nodeName() {
80
+ return "";
81
+ }
82
+ get parentNode() {
83
+ return this[parentNode];
84
+ }
85
+ get parentElement() {
86
+ const parent = this[parentNode];
87
+ return parent && parent[nodeType] === NodeType.ELEMENT_NODE ? parent : null;
88
+ }
89
+ get childNodes() {
90
+ return new NodeList(this[childNodesList]);
91
+ }
92
+ get firstChild() {
93
+ return this[childNodesList][0] ?? null;
94
+ }
95
+ get lastChild() {
96
+ const children = this[childNodesList];
97
+ return children[children.length - 1] ?? null;
98
+ }
99
+ get previousSibling() {
100
+ const parent = this[parentNode];
101
+ if (!parent) return null;
102
+ const siblings = parent[childNodesList];
103
+ const idx = siblings.indexOf(this);
104
+ return idx > 0 ? siblings[idx - 1] : null;
105
+ }
106
+ get nextSibling() {
107
+ const parent = this[parentNode];
108
+ if (!parent) return null;
109
+ const siblings = parent[childNodesList];
110
+ const idx = siblings.indexOf(this);
111
+ return idx !== -1 && idx < siblings.length - 1 ? siblings[idx + 1] : null;
112
+ }
113
+ get textContent() {
114
+ return null;
115
+ }
116
+ set textContent(_value) {}
117
+ get nodeValue() {
118
+ return null;
119
+ }
120
+ set nodeValue(_value) {}
121
+ get ownerDocument() {
122
+ let root = this;
123
+ while (root[parentNode]) {
124
+ root = root[parentNode];
125
+ }
126
+ const doc = globalThis.document;
127
+ return root === doc ? doc : null;
128
+ }
129
+ get isConnected() {
130
+ return this[isConnected];
131
+ }
132
+ hasChildNodes() {
133
+ return this[childNodesList].length > 0;
134
+ }
135
+ contains(other) {
136
+ if (other === null) return false;
137
+ if (other === this) return true;
138
+ let node = other;
139
+ while (node) {
140
+ if (node === this) return true;
141
+ node = node[parentNode];
142
+ }
143
+ return false;
144
+ }
145
+ getRootNode() {
146
+ let node = this;
147
+ while (node[parentNode]) {
148
+ node = node[parentNode];
149
+ }
150
+ return node;
151
+ }
152
+ appendChild(node) {
153
+ if (node[parentNode]) {
154
+ node[parentNode].removeChild(node);
155
+ }
156
+ node[parentNode] = this;
157
+ this[childNodesList].push(node);
158
+ if (node[nodeType] === NodeType.ELEMENT_NODE) {
159
+ this[elementChildren].push(node);
160
+ }
161
+ return node;
162
+ }
163
+ removeChild(node) {
164
+ const children = this[childNodesList];
165
+ const idx = children.indexOf(node);
166
+ if (idx === -1) {
167
+ throw new DOMException("Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.", "NotFoundError");
168
+ }
169
+ children.splice(idx, 1);
170
+ node[parentNode] = null;
171
+ if (node[nodeType] === NodeType.ELEMENT_NODE) {
172
+ const elemIdx = this[elementChildren].indexOf(node);
173
+ if (elemIdx !== -1) {
174
+ this[elementChildren].splice(elemIdx, 1);
175
+ }
176
+ }
177
+ return node;
178
+ }
179
+ insertBefore(newNode, referenceNode) {
180
+ if (referenceNode === null) {
181
+ return this.appendChild(newNode);
182
+ }
183
+ const children = this[childNodesList];
184
+ const refIdx = children.indexOf(referenceNode);
185
+ if (refIdx === -1) {
186
+ throw new DOMException("Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted is not a child of this node.", "NotFoundError");
187
+ }
188
+ if (newNode[parentNode]) {
189
+ newNode[parentNode].removeChild(newNode);
190
+ }
191
+ newNode[parentNode] = this;
192
+ children.splice(refIdx, 0, newNode);
193
+ if (newNode[nodeType] === NodeType.ELEMENT_NODE) {
194
+ const elemChildren = this[elementChildren];
195
+ let elemIdx = elemChildren.length;
196
+ for (let i = refIdx; i < children.length; i++) {
197
+ if (children[i][nodeType] === NodeType.ELEMENT_NODE && children[i] !== newNode) {
198
+ elemIdx = elemChildren.indexOf(children[i]);
199
+ break;
200
+ }
201
+ }
202
+ elemChildren.splice(elemIdx, 0, newNode);
203
+ }
204
+ return newNode;
205
+ }
206
+ replaceChild(newChild, oldChild) {
207
+ this.insertBefore(newChild, oldChild);
208
+ this.removeChild(oldChild);
209
+ return oldChild;
210
+ }
211
+ cloneNode(deep = false) {
212
+ const clone = new this.constructor();
213
+ clone[nodeType] = this[nodeType];
214
+ if (deep) {
215
+ for (const child of this[childNodesList]) {
216
+ clone.appendChild(child.cloneNode(true));
217
+ }
218
+ }
219
+ return clone;
220
+ }
221
+ /**
222
+ * Override dispatchEvent to support event bubbling through the DOM tree.
223
+ * After AT_TARGET phase, if event.bubbles is true, walk up the parentNode
224
+ * chain and dispatch on each ancestor (BUBBLING_PHASE).
225
+ */
226
+ dispatchEvent(event) {
227
+ const result = super.dispatchEvent(event);
228
+ if (event.bubbles && !event.cancelBubble) {
229
+ let parent = this[parentNode];
230
+ while (parent) {
231
+ Object.getPrototypeOf(Node.prototype).dispatchEvent.call(parent, event);
232
+ if (event.cancelBubble) break;
233
+ parent = parent[parentNode];
234
+ }
235
+ }
236
+ return result;
237
+ }
238
+ get [(_PS$nodeType = nodeType, _PS$parentNode = parentNode, _PS$childNodesList = childNodesList, _PS$elementChildren = elementChildren, _PS$isConnected = isConnected, Symbol.toStringTag)]() {
239
+ return "Node";
240
+ }
249
241
  };
242
+
243
+ //#endregion
244
+ export { Node };
@@ -1,30 +1,36 @@
1
- const nodeType = /* @__PURE__ */ Symbol("nodeType");
2
- const parentNode = /* @__PURE__ */ Symbol("parentNode");
3
- const childNodesList = /* @__PURE__ */ Symbol("childNodesList");
4
- const elementChildren = /* @__PURE__ */ Symbol("elementChildren");
5
- const isConnected = /* @__PURE__ */ Symbol("isConnected");
6
- const tagName = /* @__PURE__ */ Symbol("tagName");
7
- const localName = /* @__PURE__ */ Symbol("localName");
8
- const namespaceURI = /* @__PURE__ */ Symbol("namespaceURI");
9
- const prefix = /* @__PURE__ */ Symbol("prefix");
10
- const attributes = /* @__PURE__ */ Symbol("attributes");
11
- const propertyEventListeners = /* @__PURE__ */ Symbol("propertyEventListeners");
12
- const name = /* @__PURE__ */ Symbol("name");
13
- const value = /* @__PURE__ */ Symbol("value");
14
- const ownerElement = /* @__PURE__ */ Symbol("ownerElement");
15
- export {
16
- attributes,
17
- childNodesList,
18
- elementChildren,
19
- isConnected,
20
- localName,
21
- name,
22
- namespaceURI,
23
- nodeType,
24
- ownerElement,
25
- parentNode,
26
- prefix,
27
- propertyEventListeners,
28
- tagName,
29
- value
30
- };
1
+ import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
+
3
+ //#region src/property-symbol.ts
4
+ var property_symbol_exports = /* @__PURE__ */ __exportAll({
5
+ attributes: () => attributes,
6
+ childNodesList: () => childNodesList,
7
+ elementChildren: () => elementChildren,
8
+ isConnected: () => isConnected,
9
+ localName: () => localName,
10
+ name: () => name,
11
+ namespaceURI: () => namespaceURI,
12
+ nodeType: () => nodeType,
13
+ ownerElement: () => ownerElement,
14
+ parentNode: () => parentNode,
15
+ prefix: () => prefix,
16
+ propertyEventListeners: () => propertyEventListeners,
17
+ tagName: () => tagName,
18
+ value: () => value
19
+ });
20
+ const nodeType = Symbol("nodeType");
21
+ const parentNode = Symbol("parentNode");
22
+ const childNodesList = Symbol("childNodesList");
23
+ const elementChildren = Symbol("elementChildren");
24
+ const isConnected = Symbol("isConnected");
25
+ const tagName = Symbol("tagName");
26
+ const localName = Symbol("localName");
27
+ const namespaceURI = Symbol("namespaceURI");
28
+ const prefix = Symbol("prefix");
29
+ const attributes = Symbol("attributes");
30
+ const propertyEventListeners = Symbol("propertyEventListeners");
31
+ const name = Symbol("name");
32
+ const value = Symbol("value");
33
+ const ownerElement = Symbol("ownerElement");
34
+
35
+ //#endregion
36
+ export { attributes, childNodesList, elementChildren, isConnected, localName, name, namespaceURI, nodeType, ownerElement, parentNode, prefix, propertyEventListeners, property_symbol_exports, tagName, value };
@@ -1,16 +1,20 @@
1
- import { CanvasRenderingContext2D } from "@gjsify/canvas2d-core";
2
1
  import { HTMLCanvasElement } from "../html-canvas-element.js";
3
2
  import { DOMMatrix, DOMMatrixReadOnly } from "../dom-matrix.js";
4
3
  import { defineGlobal } from "./helpers.js";
4
+ import { CanvasRenderingContext2D } from "@gjsify/canvas2d-core";
5
+
6
+ //#region src/register/canvas.ts
5
7
  defineGlobal("HTMLCanvasElement", HTMLCanvasElement);
6
8
  defineGlobal("CanvasRenderingContext2D", CanvasRenderingContext2D);
7
9
  defineGlobal("DOMMatrix", DOMMatrix);
8
10
  defineGlobal("DOMMatrixReadOnly", DOMMatrixReadOnly);
9
- const CANVAS2D_KEY = /* @__PURE__ */ Symbol.for("gjsify_canvas2d_context");
11
+ const CANVAS2D_KEY = Symbol.for("gjsify_canvas2d_context");
10
12
  HTMLCanvasElement.registerContextFactory("2d", (canvas, options) => {
11
- const existing = canvas[CANVAS2D_KEY];
12
- if (existing) return existing;
13
- const ctx = new CanvasRenderingContext2D(canvas, options);
14
- canvas[CANVAS2D_KEY] = ctx;
15
- return ctx;
13
+ const existing = canvas[CANVAS2D_KEY];
14
+ if (existing) return existing;
15
+ const ctx = new CanvasRenderingContext2D(canvas, options);
16
+ canvas[CANVAS2D_KEY] = ctx;
17
+ return ctx;
16
18
  });
19
+
20
+ //#endregion
@@ -1,30 +1,29 @@
1
- import { EventTarget as OurEventTarget } from "@gjsify/dom-events";
2
1
  import { Comment } from "../comment.js";
3
- import { document } from "../document.js";
2
+ import { Text } from "../text.js";
4
3
  import { DocumentFragment } from "../document-fragment.js";
4
+ import { document } from "../document.js";
5
5
  import { DOMTokenList } from "../dom-token-list.js";
6
- import { Text } from "../text.js";
7
6
  import { defineGlobal, defineGlobalIfMissing } from "./helpers.js";
7
+ import { EventTarget } from "@gjsify/dom-events";
8
+
9
+ //#region src/register/document.ts
8
10
  defineGlobal("Text", Text);
9
11
  defineGlobal("Comment", Comment);
10
12
  defineGlobal("DocumentFragment", DocumentFragment);
11
13
  defineGlobal("DOMTokenList", DOMTokenList);
12
14
  defineGlobal("document", document);
13
15
  defineGlobalIfMissing("self", globalThis);
14
- class Window {
15
- }
16
+ var Window = class {};
16
17
  defineGlobalIfMissing("Window", Window);
17
18
  defineGlobalIfMissing("window", globalThis);
18
- defineGlobalIfMissing("focus", () => {
19
- });
20
- defineGlobalIfMissing("blur", () => {
21
- });
19
+ defineGlobalIfMissing("focus", () => {});
20
+ defineGlobalIfMissing("blur", () => {});
22
21
  if (typeof globalThis.addEventListener !== "function") {
23
- const _globalEventTarget = new OurEventTarget();
24
- globalThis.__gjsify_globalEventTarget = _globalEventTarget;
25
- globalThis.addEventListener = (type, listener, options) => _globalEventTarget.addEventListener(type, listener, options);
26
- globalThis.removeEventListener = (type, listener, options) => _globalEventTarget.removeEventListener(type, listener, options);
27
- globalThis.dispatchEvent = (event) => _globalEventTarget.dispatchEvent(event);
22
+ const _globalEventTarget = new EventTarget();
23
+ globalThis.__gjsify_globalEventTarget = _globalEventTarget;
24
+ globalThis.addEventListener = (type, listener, options) => _globalEventTarget.addEventListener(type, listener, options);
25
+ globalThis.removeEventListener = (type, listener, options) => _globalEventTarget.removeEventListener(type, listener, options);
26
+ globalThis.dispatchEvent = (event) => _globalEventTarget.dispatchEvent(event);
28
27
  }
29
28
  defineGlobalIfMissing("devicePixelRatio", 1);
30
29
  defineGlobalIfMissing("scrollX", 0);
@@ -33,8 +32,10 @@ defineGlobalIfMissing("pageXOffset", 0);
33
32
  defineGlobalIfMissing("pageYOffset", 0);
34
33
  defineGlobalIfMissing("alert", (...args) => console.error("alert:", ...args));
35
34
  if (typeof globalThis.top === "undefined") {
36
- Object.defineProperty(globalThis, "top", {
37
- get: () => globalThis,
38
- configurable: true
39
- });
35
+ Object.defineProperty(globalThis, "top", {
36
+ get: () => globalThis,
37
+ configurable: true
38
+ });
40
39
  }
40
+
41
+ //#endregion