@remote-dom/polyfill 0.0.0-preview-20240219211553

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 (142) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/LICENSE.md +7 -0
  3. package/README.md +45 -0
  4. package/build/esm/Attr.mjs +52 -0
  5. package/build/esm/CharacterData.mjs +27 -0
  6. package/build/esm/ChildNode.mjs +42 -0
  7. package/build/esm/Comment.mjs +9 -0
  8. package/build/esm/CustomElementRegistry.mjs +33 -0
  9. package/build/esm/CustomEvent.mjs +26 -0
  10. package/build/esm/Document.mjs +89 -0
  11. package/build/esm/DocumentFragment.mjs +10 -0
  12. package/build/esm/Element.mjs +95 -0
  13. package/build/esm/Event.mjs +108 -0
  14. package/build/esm/EventTarget.mjs +99 -0
  15. package/build/esm/HTMLElement.mjs +5 -0
  16. package/build/esm/HTMLTemplateElement.mjs +24 -0
  17. package/build/esm/MutationObserver.mjs +5 -0
  18. package/build/esm/NamedNodeMap.mjs +121 -0
  19. package/build/esm/Node.mjs +100 -0
  20. package/build/esm/NodeList.mjs +7 -0
  21. package/build/esm/ParentNode.mjs +128 -0
  22. package/build/esm/SVGElement.mjs +17 -0
  23. package/build/esm/Text.mjs +9 -0
  24. package/build/esm/Window.mjs +66 -0
  25. package/build/esm/constants.mjs +39 -0
  26. package/build/esm/hooks.mjs +3 -0
  27. package/build/esm/index.mjs +2 -0
  28. package/build/esm/selectors.mjs +197 -0
  29. package/build/esm/serialization.mjs +92 -0
  30. package/build/esm/shared.mjs +55 -0
  31. package/build/esnext/Attr.esnext +57 -0
  32. package/build/esnext/CharacterData.esnext +27 -0
  33. package/build/esnext/ChildNode.esnext +47 -0
  34. package/build/esnext/Comment.esnext +9 -0
  35. package/build/esnext/CustomElementRegistry.esnext +34 -0
  36. package/build/esnext/CustomEvent.esnext +25 -0
  37. package/build/esnext/Document.esnext +86 -0
  38. package/build/esnext/DocumentFragment.esnext +10 -0
  39. package/build/esnext/Element.esnext +99 -0
  40. package/build/esnext/Event.esnext +109 -0
  41. package/build/esnext/EventTarget.esnext +99 -0
  42. package/build/esnext/HTMLElement.esnext +6 -0
  43. package/build/esnext/HTMLTemplateElement.esnext +26 -0
  44. package/build/esnext/MutationObserver.esnext +5 -0
  45. package/build/esnext/NamedNodeMap.esnext +131 -0
  46. package/build/esnext/Node.esnext +116 -0
  47. package/build/esnext/NodeList.esnext +7 -0
  48. package/build/esnext/ParentNode.esnext +138 -0
  49. package/build/esnext/SVGElement.esnext +17 -0
  50. package/build/esnext/Text.esnext +9 -0
  51. package/build/esnext/Window.esnext +59 -0
  52. package/build/esnext/constants.esnext +37 -0
  53. package/build/esnext/hooks.esnext +3 -0
  54. package/build/esnext/index.esnext +2 -0
  55. package/build/esnext/selectors.esnext +169 -0
  56. package/build/esnext/serialization.esnext +76 -0
  57. package/build/esnext/shared.esnext +59 -0
  58. package/build/tsconfig.tsbuildinfo +1 -0
  59. package/build/typescript/Attr.d.ts +24 -0
  60. package/build/typescript/Attr.d.ts.map +1 -0
  61. package/build/typescript/CharacterData.d.ts +10 -0
  62. package/build/typescript/CharacterData.d.ts.map +1 -0
  63. package/build/typescript/ChildNode.d.ts +10 -0
  64. package/build/typescript/ChildNode.d.ts.map +1 -0
  65. package/build/typescript/Comment.d.ts +7 -0
  66. package/build/typescript/Comment.d.ts.map +1 -0
  67. package/build/typescript/CustomElementRegistry.d.ts +9 -0
  68. package/build/typescript/CustomElementRegistry.d.ts.map +1 -0
  69. package/build/typescript/CustomEvent.d.ts +17 -0
  70. package/build/typescript/CustomEvent.d.ts.map +1 -0
  71. package/build/typescript/Document.d.ts +27 -0
  72. package/build/typescript/Document.d.ts.map +1 -0
  73. package/build/typescript/DocumentFragment.d.ts +8 -0
  74. package/build/typescript/DocumentFragment.d.ts.map +1 -0
  75. package/build/typescript/Element.d.ts +32 -0
  76. package/build/typescript/Element.d.ts.map +1 -0
  77. package/build/typescript/Event.d.ts +47 -0
  78. package/build/typescript/Event.d.ts.map +1 -0
  79. package/build/typescript/EventTarget.d.ts +12 -0
  80. package/build/typescript/EventTarget.d.ts.map +1 -0
  81. package/build/typescript/HTMLElement.d.ts +4 -0
  82. package/build/typescript/HTMLElement.d.ts.map +1 -0
  83. package/build/typescript/HTMLTemplateElement.d.ts +11 -0
  84. package/build/typescript/HTMLTemplateElement.d.ts.map +1 -0
  85. package/build/typescript/MutationObserver.d.ts +3 -0
  86. package/build/typescript/MutationObserver.d.ts.map +1 -0
  87. package/build/typescript/NamedNodeMap.d.ts +18 -0
  88. package/build/typescript/NamedNodeMap.d.ts.map +1 -0
  89. package/build/typescript/Node.d.ts +37 -0
  90. package/build/typescript/Node.d.ts.map +1 -0
  91. package/build/typescript/NodeList.d.ts +4 -0
  92. package/build/typescript/NodeList.d.ts.map +1 -0
  93. package/build/typescript/ParentNode.d.ts +18 -0
  94. package/build/typescript/ParentNode.d.ts.map +1 -0
  95. package/build/typescript/SVGElement.d.ts +7 -0
  96. package/build/typescript/SVGElement.d.ts.map +1 -0
  97. package/build/typescript/Text.d.ts +7 -0
  98. package/build/typescript/Text.d.ts.map +1 -0
  99. package/build/typescript/Window.d.ts +45 -0
  100. package/build/typescript/Window.d.ts.map +1 -0
  101. package/build/typescript/constants.d.ts +35 -0
  102. package/build/typescript/constants.d.ts.map +1 -0
  103. package/build/typescript/hooks.d.ts +13 -0
  104. package/build/typescript/hooks.d.ts.map +1 -0
  105. package/build/typescript/index.d.ts +3 -0
  106. package/build/typescript/index.d.ts.map +1 -0
  107. package/build/typescript/selectors.d.ts +32 -0
  108. package/build/typescript/selectors.d.ts.map +1 -0
  109. package/build/typescript/serialization.d.ts +6 -0
  110. package/build/typescript/serialization.d.ts.map +1 -0
  111. package/build/typescript/shared.d.ts +16 -0
  112. package/build/typescript/shared.d.ts.map +1 -0
  113. package/package.json +35 -0
  114. package/rollup.config.js +3 -0
  115. package/source/Attr.ts +70 -0
  116. package/source/CharacterData.ts +29 -0
  117. package/source/ChildNode.ts +45 -0
  118. package/source/Comment.ts +7 -0
  119. package/source/CustomElementRegistry.ts +52 -0
  120. package/source/CustomEvent.ts +30 -0
  121. package/source/Document.ts +112 -0
  122. package/source/DocumentFragment.ts +8 -0
  123. package/source/Element.ts +119 -0
  124. package/source/Event.ts +142 -0
  125. package/source/EventTarget.ts +139 -0
  126. package/source/HTMLElement.ts +3 -0
  127. package/source/HTMLTemplateElement.ts +28 -0
  128. package/source/MutationObserver.ts +3 -0
  129. package/source/NamedNodeMap.ts +156 -0
  130. package/source/Node.ts +139 -0
  131. package/source/NodeList.ts +5 -0
  132. package/source/ParentNode.ts +158 -0
  133. package/source/SVGElement.ts +16 -0
  134. package/source/Text.ts +7 -0
  135. package/source/Window.ts +64 -0
  136. package/source/constants.ts +37 -0
  137. package/source/hooks.ts +28 -0
  138. package/source/index.ts +2 -0
  139. package/source/selectors.ts +230 -0
  140. package/source/serialization.ts +110 -0
  141. package/source/shared.ts +80 -0
  142. package/tsconfig.json +10 -0
@@ -0,0 +1,24 @@
1
+ import { CONTENT } from './constants.mjs';
2
+ import { Element } from './Element.mjs';
3
+ import { parseHtml, serializeChildren } from './serialization.mjs';
4
+
5
+ class HTMLTemplateElement extends Element {
6
+ get content() {
7
+ let content = this[CONTENT];
8
+ if (!content) {
9
+ content = this.ownerDocument.createDocumentFragment();
10
+ this[CONTENT] = content;
11
+ }
12
+ return content;
13
+ }
14
+ set content(_) {}
15
+ set innerHTML(html) {
16
+ this.content.replaceChildren(parseHtml(String(html), this));
17
+ }
18
+ get innerHTML() {
19
+ const content = this[CONTENT];
20
+ return content ? serializeChildren(content) : '';
21
+ }
22
+ }
23
+
24
+ export { HTMLTemplateElement };
@@ -0,0 +1,5 @@
1
+ class MutationObserver {
2
+ // stub implementation
3
+ }
4
+
5
+ export { MutationObserver };
@@ -0,0 +1,121 @@
1
+ import { hooks } from './hooks.mjs';
2
+ import { CHILD, OWNER_ELEMENT, NS, NEXT } from './constants.mjs';
3
+
4
+ class NamedNodeMap {
5
+ [CHILD] = null;
6
+ constructor(ownerElement) {
7
+ this[OWNER_ELEMENT] = ownerElement;
8
+ }
9
+ getNamedItem(name) {
10
+ return this.getNamedItemNS(null, name);
11
+ }
12
+ getNamedItemNS(namespaceURI, name) {
13
+ let attr = this[CHILD];
14
+ while (attr) {
15
+ if (attr.name === name && attr[NS] == namespaceURI) {
16
+ return attr;
17
+ }
18
+ attr = attr[NEXT];
19
+ }
20
+ return null;
21
+ }
22
+ item(index) {
23
+ let attr = this[CHILD];
24
+ let i = 0;
25
+ while (attr) {
26
+ if (i++ === index) return attr;
27
+ attr = attr[NEXT];
28
+ }
29
+ return null;
30
+ }
31
+ get length() {
32
+ let index = 0;
33
+ let attr = this[CHILD];
34
+ while (attr) {
35
+ index++;
36
+ attr = attr[NEXT];
37
+ }
38
+ return index;
39
+ }
40
+ removeNamedItem(name) {
41
+ return this.removeNamedItemNS(null, name);
42
+ }
43
+ removeNamedItemNS(namespaceURI, name) {
44
+ const ownerElement = this[OWNER_ELEMENT];
45
+ let attr = this[CHILD];
46
+ let prev = null;
47
+ while (attr != null) {
48
+ if (attr.name === name && attr[NS] == namespaceURI) {
49
+ if (prev) prev[NEXT] = attr[NEXT];
50
+ if (this[CHILD] === attr) this[CHILD] = attr[NEXT];
51
+ updateElementAttribute(ownerElement, attr.name, attr.value, null);
52
+ hooks.removeAttribute?.(ownerElement, name, namespaceURI);
53
+ return attr;
54
+ }
55
+ prev = attr;
56
+ attr = attr[NEXT];
57
+ }
58
+ return null;
59
+ }
60
+ setNamedItem(attr) {
61
+ const ownerElement = this[OWNER_ELEMENT];
62
+ let old = null;
63
+ let child = this[CHILD];
64
+ attr[OWNER_ELEMENT] = ownerElement;
65
+ if (child == null) {
66
+ this[CHILD] = attr;
67
+ // return null;
68
+ } else {
69
+ let prev;
70
+ while (child) {
71
+ if (child.name === attr.name && child[NS] == attr[NS]) {
72
+ if (prev) prev[NEXT] = attr;else this[CHILD] = attr;
73
+ attr[NEXT] = child[NEXT];
74
+ child[NEXT] = null;
75
+ old = child;
76
+ break;
77
+ // return child;
78
+ }
79
+
80
+ prev = child;
81
+ child = child[NEXT];
82
+ }
83
+ if (prev) prev[NEXT] = attr;else this[CHILD] = attr;
84
+ // return null;
85
+ }
86
+
87
+ // only invoke the protocol if the value changed
88
+ if (!old || old.value !== attr.value) {
89
+ updateElementAttribute(ownerElement, attr.name, old?.value ?? null, attr.value);
90
+ hooks.setAttribute?.(ownerElement, attr.name, attr.value, attr[NS]);
91
+ }
92
+ return old;
93
+ }
94
+ setNamedItemNS(attr) {
95
+ return this.setNamedItem(attr);
96
+ }
97
+ *[Symbol.iterator]() {
98
+ let attr = this[CHILD];
99
+ while (attr) {
100
+ yield attr;
101
+ attr = attr[NEXT];
102
+ }
103
+ }
104
+ }
105
+ function updateElementAttribute(element, name, oldValue, newValue) {
106
+ const {
107
+ observedAttributes
108
+ } = element.constructor;
109
+ const {
110
+ attributeChangedCallback
111
+ } = element;
112
+ if (name === 'slot' && element.slot !== newValue) {
113
+ element.slot = newValue ?? '';
114
+ }
115
+ if (attributeChangedCallback == null || observedAttributes == null || !observedAttributes.includes(name)) {
116
+ return;
117
+ }
118
+ return attributeChangedCallback.call(element, name, oldValue, newValue);
119
+ }
120
+
121
+ export { NamedNodeMap };
@@ -0,0 +1,100 @@
1
+ import { NodeType, NAME, PARENT, CHILD, PREV, NEXT, OWNER_DOCUMENT, NamespaceURI } from './constants.mjs';
2
+ import { EventTarget } from './EventTarget.mjs';
3
+ import { isCharacterData, isParentNode, cloneNode, isTextNode } from './shared.mjs';
4
+
5
+ class Node extends EventTarget {
6
+ nodeType = NodeType.NODE;
7
+ [NAME] = '';
8
+ [PARENT] = null;
9
+ [CHILD] = null;
10
+ [PREV] = null;
11
+ [NEXT] = null;
12
+ get localName() {
13
+ return this[NAME];
14
+ }
15
+ get nodeName() {
16
+ return this[NAME].toUpperCase();
17
+ }
18
+ get ownerDocument() {
19
+ return this[OWNER_DOCUMENT];
20
+ }
21
+ isDefaultNamespace(namespace) {
22
+ return namespace === NamespaceURI.XHTML;
23
+ }
24
+ get parentNode() {
25
+ return this[PARENT];
26
+ }
27
+ set parentNode(_readonly) {}
28
+ get previousSibling() {
29
+ return this[PREV];
30
+ }
31
+ set previousSibling(_readonly) {}
32
+ get nextSibling() {
33
+ return this[NEXT];
34
+ }
35
+ set nextSibling(_readonly) {}
36
+ get previousElementSibling() {
37
+ let sib = this[PREV];
38
+ while (sib && sib.nodeType !== 1) sib = sib[PREV];
39
+ return sib;
40
+ }
41
+ set previousElementSibling(_readonly) {}
42
+ get nextElementSibling() {
43
+ let sib = this[NEXT];
44
+ while (sib && sib.nodeType !== 1) sib = sib[NEXT];
45
+ return sib;
46
+ }
47
+ set nextElementSibling(_readonly) {}
48
+ get firstChild() {
49
+ return this[CHILD];
50
+ }
51
+ set firstChild(_readonly) {}
52
+ get lastChild() {
53
+ let child = this[CHILD];
54
+ while (child) {
55
+ const next = child[NEXT];
56
+ if (next == null) break;
57
+ child = next;
58
+ }
59
+ return child;
60
+ }
61
+ set lastChild(_readonly) {}
62
+ get nodeValue() {
63
+ if (isCharacterData(this)) return this.data;
64
+ return null;
65
+ }
66
+ set nodeValue(data) {
67
+ if (isCharacterData(this)) this.data = data;
68
+ }
69
+ get textContent() {
70
+ if (isCharacterData(this)) return this.data;
71
+ let text = '';
72
+ function walk(node) {
73
+ if (isTextNode(node)) {
74
+ text += node.data;
75
+ }
76
+ const child = node[CHILD];
77
+ if (child) walk(child);
78
+ const sibling = node[NEXT];
79
+ if (sibling) walk(sibling);
80
+ }
81
+ walk(this);
82
+ return text;
83
+ }
84
+ set textContent(data) {
85
+ if (isCharacterData(this)) {
86
+ this.data = data;
87
+ } else if (isParentNode(this)) {
88
+ let child;
89
+ while (child = this[CHILD]) {
90
+ this.removeChild(child);
91
+ }
92
+ this.append(data);
93
+ }
94
+ }
95
+ cloneNode(deep) {
96
+ return cloneNode(this, deep);
97
+ }
98
+ }
99
+
100
+ export { Node };
@@ -0,0 +1,7 @@
1
+ class NodeList extends Array {
2
+ item(index) {
3
+ return this[index];
4
+ }
5
+ }
6
+
7
+ export { NodeList };
@@ -0,0 +1,128 @@
1
+ import { hooks } from './hooks.mjs';
2
+ import { PREV, NEXT, CHILD, NodeType, OWNER_DOCUMENT, PARENT } from './constants.mjs';
3
+ import { ChildNode, toNode } from './ChildNode.mjs';
4
+ import { NodeList } from './NodeList.mjs';
5
+ import { querySelectorAll, querySelector } from './selectors.mjs';
6
+
7
+ class ParentNode extends ChildNode {
8
+ childNodes = new NodeList();
9
+ children = new NodeList();
10
+ appendChild(child) {
11
+ this.insertInto(child, null);
12
+ }
13
+ insertBefore(child, ref) {
14
+ this.insertInto(child, ref || null);
15
+ }
16
+ append(...nodes) {
17
+ for (const child of nodes) {
18
+ if (child == null) continue;
19
+ this.appendChild(toNode(this, child));
20
+ }
21
+ }
22
+ prepend(...nodes) {
23
+ const before = this.firstChild;
24
+ for (const child of nodes) {
25
+ if (child == null) continue;
26
+ this.insertBefore(toNode(this, child), before);
27
+ }
28
+ }
29
+ replaceChildren(...nodes) {
30
+ let child;
31
+ while (child = this.firstChild) {
32
+ this.removeChild(child);
33
+ }
34
+ this.append(...nodes);
35
+ }
36
+ removeChild(child) {
37
+ if (child.parentNode !== this) throw Error(`not a child of this node`);
38
+ const prev = child[PREV];
39
+ const next = child[NEXT];
40
+ if (prev) prev[NEXT] = next;else this[CHILD] = next;
41
+ if (next) next[PREV] = prev;
42
+ const childNodes = this.childNodes;
43
+ const childNodesIndex = childNodes.indexOf(child);
44
+ childNodes.splice(childNodesIndex, 1);
45
+ if (child.nodeType === 1) {
46
+ const children = this.children;
47
+ children.splice(children.indexOf(child), 1);
48
+ }
49
+ hooks.removeChild?.(this, child, childNodesIndex);
50
+ }
51
+ replaceChild(newChild, oldChild) {
52
+ if (oldChild.parentNode !== this) {
53
+ throw Error('reference node is not a child of this parent');
54
+ }
55
+ const next = oldChild[NEXT];
56
+ this.removeChild(oldChild);
57
+ this.insertInto(newChild, next);
58
+ }
59
+ querySelectorAll(selector) {
60
+ return querySelectorAll(this, selector);
61
+ }
62
+ querySelector(selector) {
63
+ return querySelector(this, selector);
64
+ }
65
+ insertInto(child, before) {
66
+ // append the children of a DocumentFragment:
67
+ if (child.nodeType === NodeType.DOCUMENT_FRAGMENT_NODE) {
68
+ let node = child[CHILD];
69
+ while (node) {
70
+ const next = node[NEXT];
71
+ this.insertInto(node, before);
72
+ node = next;
73
+ }
74
+ return;
75
+ }
76
+ if (child.parentNode !== null) {
77
+ child.parentNode.removeChild(child);
78
+ }
79
+ if (before) {
80
+ if (before.parentNode !== this) {
81
+ throw Error('reference node is not a child of this parent');
82
+ }
83
+ child[NEXT] = before;
84
+ child[PREV] = before[PREV];
85
+ if (before[PREV] === null) this[CHILD] = child;
86
+ before[PREV] = child;
87
+ } else {
88
+ child[NEXT] = null;
89
+ let last = this[CHILD];
90
+ if (last) {
91
+ let next;
92
+ while (next = last[NEXT]) last = next;
93
+ last[NEXT] = child;
94
+ child[PREV] = last;
95
+ } else {
96
+ this[CHILD] = child;
97
+ child[PREV] = null;
98
+ }
99
+ }
100
+ const ownerDocument = this[OWNER_DOCUMENT];
101
+ const isElement = child.nodeType === NodeType.ELEMENT_NODE;
102
+ child[PARENT] = this;
103
+ child[OWNER_DOCUMENT] = ownerDocument;
104
+ const childNodes = this.childNodes;
105
+ let insertIndex;
106
+ if (before) {
107
+ insertIndex = childNodes.indexOf(before);
108
+ childNodes.splice(insertIndex, 0, child);
109
+ if (isElement) {
110
+ const children = this.children;
111
+ let ref = before;
112
+ while (ref && ref.nodeType !== 1) ref = ref[NEXT];
113
+ if (ref) {
114
+ children.splice(children.indexOf(ref), 0, child);
115
+ } else {
116
+ children.push(child);
117
+ }
118
+ }
119
+ } else {
120
+ insertIndex = childNodes.length;
121
+ childNodes.push(child);
122
+ if (isElement) this.children.push(child);
123
+ }
124
+ hooks.insertChild?.(this, child, insertIndex);
125
+ }
126
+ }
127
+
128
+ export { ParentNode };
@@ -0,0 +1,17 @@
1
+ import { NS, NamespaceURI } from './constants.mjs';
2
+ import { Element } from './Element.mjs';
3
+
4
+ class SVGElement extends Element {
5
+ [NS] = NamespaceURI.SVG;
6
+ get ownerSVGElement() {
7
+ let root = null;
8
+ let parent = this.parentNode;
9
+ while (parent instanceof SVGElement) {
10
+ root = parent;
11
+ parent = parent.parentNode;
12
+ }
13
+ return root;
14
+ }
15
+ }
16
+
17
+ export { SVGElement };
@@ -0,0 +1,9 @@
1
+ import { NodeType, NAME } from './constants.mjs';
2
+ import { CharacterData } from './CharacterData.mjs';
3
+
4
+ class Text extends CharacterData {
5
+ nodeType = NodeType.TEXT_NODE;
6
+ [NAME] = '#text';
7
+ }
8
+
9
+ export { Text };
@@ -0,0 +1,66 @@
1
+ import { Document } from './Document.mjs';
2
+ import { Event } from './Event.mjs';
3
+ import { EventTarget } from './EventTarget.mjs';
4
+ import { CustomEvent } from './CustomEvent.mjs';
5
+ import { Node } from './Node.mjs';
6
+ import { ParentNode } from './ParentNode.mjs';
7
+ import { ChildNode } from './ChildNode.mjs';
8
+ import { Element } from './Element.mjs';
9
+ import { HTMLElement } from './HTMLElement.mjs';
10
+ import { SVGElement } from './SVGElement.mjs';
11
+ import { CharacterData } from './CharacterData.mjs';
12
+ import { Text } from './Text.mjs';
13
+ import { Comment } from './Comment.mjs';
14
+ import { DocumentFragment } from './DocumentFragment.mjs';
15
+ import { HTMLTemplateElement } from './HTMLTemplateElement.mjs';
16
+ import { CustomElementRegistryImplementation } from './CustomElementRegistry.mjs';
17
+ import { MutationObserver } from './MutationObserver.mjs';
18
+
19
+ class Window extends EventTarget {
20
+ name = '';
21
+ parent = this;
22
+ self = this;
23
+ top = this;
24
+ document = new Document(this);
25
+ customElements = new CustomElementRegistryImplementation();
26
+ location = globalThis.location;
27
+ navigator = globalThis.navigator;
28
+ Event = Event;
29
+ EventTarget = EventTarget;
30
+ CustomEvent = CustomEvent;
31
+ Node = Node;
32
+ ParentNode = ParentNode;
33
+ ChildNode = ChildNode;
34
+ DocumentFragment = DocumentFragment;
35
+ Document = Document;
36
+ CharacterData = CharacterData;
37
+ Comment = Comment;
38
+ Text = Text;
39
+ Element = Element;
40
+ HTMLElement = HTMLElement;
41
+ SVGElement = SVGElement;
42
+ HTMLTemplateElement = HTMLTemplateElement;
43
+ MutationObserver = MutationObserver;
44
+ static setGlobal(window) {
45
+ const properties = Object.getOwnPropertyDescriptors(window);
46
+ delete properties.self;
47
+ Object.defineProperties(globalThis, {
48
+ ...properties,
49
+ window: {
50
+ value: window
51
+ }
52
+ });
53
+ if (typeof self === 'undefined') {
54
+ Object.defineProperty(globalThis, 'self', {
55
+ value: window
56
+ });
57
+ } else {
58
+ // There can already be a `self`, like when polyfilling the DOM
59
+ // in a Web Worker. In those cases, just mirror all the `Window`
60
+ // properties onto `self`, rather than wholly redefining it.
61
+ Object.defineProperties(self, properties);
62
+ }
63
+ }
64
+ }
65
+
66
+ export { Window };
@@ -0,0 +1,39 @@
1
+ const NAME = Symbol('name');
2
+ const VALUE = Symbol('value');
3
+ const NS = Symbol('ns');
4
+ const OWNER_ELEMENT = Symbol('owner');
5
+ const OWNER_DOCUMENT = Symbol('owner_document');
6
+ const ATTRIBUTES = Symbol('attributes');
7
+ const PREV = Symbol('prev');
8
+ const NEXT = Symbol('next');
9
+ const CHILD = Symbol('child');
10
+ const PARENT = Symbol('parent');
11
+ const DATA = Symbol('data');
12
+ const LISTENERS = Symbol('listeners');
13
+ const IS_TRUSTED = Symbol('isTrusted');
14
+ const CONTENT = Symbol('content');
15
+ const SLOT = Symbol('slot');
16
+
17
+ // @TODO remove explicit values
18
+ let NodeType = /*#__PURE__*/function (NodeType) {
19
+ NodeType[NodeType["NODE"] = 0] = "NODE";
20
+ NodeType[NodeType["ELEMENT_NODE"] = 1] = "ELEMENT_NODE";
21
+ NodeType[NodeType["ATTRIBUTE_NODE"] = 2] = "ATTRIBUTE_NODE";
22
+ NodeType[NodeType["TEXT_NODE"] = 3] = "TEXT_NODE";
23
+ NodeType[NodeType["CDATA_SECTION_NODE"] = 4] = "CDATA_SECTION_NODE";
24
+ NodeType[NodeType["ENTITY_REFERENCE_NODE"] = 5] = "ENTITY_REFERENCE_NODE";
25
+ NodeType[NodeType["ENTITY_NODE"] = 6] = "ENTITY_NODE";
26
+ NodeType[NodeType["PROCESSING_INSTRUCTION_NODE"] = 7] = "PROCESSING_INSTRUCTION_NODE";
27
+ NodeType[NodeType["COMMENT_NODE"] = 8] = "COMMENT_NODE";
28
+ NodeType[NodeType["DOCUMENT_NODE"] = 9] = "DOCUMENT_NODE";
29
+ NodeType[NodeType["DOCUMENT_TYPE_NODE"] = 10] = "DOCUMENT_TYPE_NODE";
30
+ NodeType[NodeType["DOCUMENT_FRAGMENT_NODE"] = 11] = "DOCUMENT_FRAGMENT_NODE";
31
+ return NodeType;
32
+ }({});
33
+ let NamespaceURI = /*#__PURE__*/function (NamespaceURI) {
34
+ NamespaceURI["XHTML"] = "http://www.w3.org/1999/xhtml";
35
+ NamespaceURI["SVG"] = "http://www.w3.org/2000/svg";
36
+ return NamespaceURI;
37
+ }({});
38
+
39
+ export { ATTRIBUTES, CHILD, CONTENT, DATA, IS_TRUSTED, LISTENERS, NAME, NEXT, NS, NamespaceURI, NodeType, OWNER_DOCUMENT, OWNER_ELEMENT, PARENT, PREV, SLOT, VALUE };
@@ -0,0 +1,3 @@
1
+ const hooks = {};
2
+
3
+ export { hooks };
@@ -0,0 +1,2 @@
1
+ export { hooks } from './hooks.mjs';
2
+ export { Window } from './Window.mjs';