@vidact/runtime 0.2.0-beta.0 → 0.2.0-beta.5
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.
- package/CHANGELOG.md +52 -0
- package/README.md +1 -1
- package/dist/actions.d.ts +32 -30
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +251 -266
- package/dist/actions.js.map +1 -1
- package/dist/async.d.ts +20 -17
- package/dist/async.d.ts.map +1 -1
- package/dist/async.js +18 -17
- package/dist/async.js.map +1 -1
- package/dist/compiled/async-resource.d.ts +9 -6
- package/dist/compiled/async-resource.d.ts.map +1 -1
- package/dist/compiled/async-resource.js +69 -77
- package/dist/compiled/async-resource.js.map +1 -1
- package/dist/compiled/core.d.ts +136 -147
- package/dist/compiled/core.d.ts.map +1 -1
- package/dist/compiled/core.js +2672 -2985
- package/dist/compiled/core.js.map +1 -1
- package/dist/compiled/types.d.ts +44 -56
- package/dist/compiled/types.d.ts.map +1 -1
- package/dist/compiled/types.js +10 -6
- package/dist/compiled/types.js.map +1 -1
- package/dist/compiled/validation.d.ts +4 -1
- package/dist/compiled/validation.d.ts.map +1 -1
- package/dist/compiled/validation.js +17 -20
- package/dist/compiled/validation.js.map +1 -1
- package/dist/component-spread.d.ts +5 -3
- package/dist/component-spread.d.ts.map +1 -1
- package/dist/component-spread.js +49 -67
- package/dist/component-spread.js.map +1 -1
- package/dist/concurrent.d.ts +20 -18
- package/dist/concurrent.d.ts.map +1 -1
- package/dist/concurrent.js +191 -210
- package/dist/concurrent.js.map +1 -1
- package/dist/direct-dom.d.ts +17 -12
- package/dist/direct-dom.d.ts.map +1 -1
- package/dist/direct-dom.js +187 -221
- package/dist/direct-dom.js.map +1 -1
- package/dist/dom/attributes.d.ts +9 -6
- package/dist/dom/attributes.d.ts.map +1 -1
- package/dist/dom/attributes.js +65 -47
- package/dist/dom/attributes.js.map +1 -1
- package/dist/dom/events.d.ts +5 -2
- package/dist/dom/events.d.ts.map +1 -1
- package/dist/dom/events.js +53 -65
- package/dist/dom/events.js.map +1 -1
- package/dist/dom/forms.d.ts +9 -6
- package/dist/dom/forms.d.ts.map +1 -1
- package/dist/dom/forms.js +152 -198
- package/dist/dom/forms.js.map +1 -1
- package/dist/dom/intrinsic.d.ts +17 -15
- package/dist/dom/intrinsic.d.ts.map +1 -1
- package/dist/dom/intrinsic.js +48 -50
- package/dist/dom/intrinsic.js.map +1 -1
- package/dist/dom/namespace.d.ts +4 -1
- package/dist/dom/namespace.d.ts.map +1 -1
- package/dist/dom/namespace.js +25 -28
- package/dist/dom/namespace.js.map +1 -1
- package/dist/dom/namespaces.d.ts +11 -8
- package/dist/dom/namespaces.d.ts.map +1 -1
- package/dist/dom/namespaces.js +14 -12
- package/dist/dom/namespaces.js.map +1 -1
- package/dist/dom/properties.d.ts +18 -16
- package/dist/dom/properties.d.ts.map +1 -1
- package/dist/dom/properties.js +273 -296
- package/dist/dom/properties.js.map +1 -1
- package/dist/dom/style-properties.d.ts +4 -1
- package/dist/dom/style-properties.d.ts.map +1 -1
- package/dist/dom/style-properties.js +49 -45
- package/dist/dom/style-properties.js.map +1 -1
- package/dist/dom/styles.d.ts +5 -2
- package/dist/dom/styles.d.ts.map +1 -1
- package/dist/dom/styles.js +47 -67
- package/dist/dom/styles.js.map +1 -1
- package/dist/dom-forms.d.ts +4 -1
- package/dist/dom-forms.d.ts.map +1 -1
- package/dist/dom-forms.js +16 -13
- package/dist/dom-forms.js.map +1 -1
- package/dist/dom-styles.d.ts +4 -1
- package/dist/dom-styles.d.ts.map +1 -1
- package/dist/dom-styles.js +10 -7
- package/dist/dom-styles.js.map +1 -1
- package/dist/framework-hydrate.d.ts +20 -17
- package/dist/framework-hydrate.d.ts.map +1 -1
- package/dist/framework-hydrate.js +128 -146
- package/dist/framework-hydrate.js.map +1 -1
- package/dist/framework-protocol.d.ts +27 -25
- package/dist/framework-protocol.d.ts.map +1 -1
- package/dist/framework-protocol.js +173 -211
- package/dist/framework-protocol.js.map +1 -1
- package/dist/framework.d.ts +34 -32
- package/dist/framework.d.ts.map +1 -1
- package/dist/framework.js +74 -93
- package/dist/framework.js.map +1 -1
- package/dist/hydrate.d.ts +11 -8
- package/dist/hydrate.d.ts.map +1 -1
- package/dist/hydrate.js +13 -9
- package/dist/hydrate.js.map +1 -1
- package/dist/hydration-bridge.d.ts +70 -58
- package/dist/hydration-bridge.d.ts.map +1 -1
- package/dist/hydration-bridge.js +77 -66
- package/dist/hydration-bridge.js.map +1 -1
- package/dist/hydration.d.ts +54 -28
- package/dist/hydration.d.ts.map +1 -1
- package/dist/hydration.js +450 -463
- package/dist/hydration.js.map +1 -1
- package/dist/index.d.ts +13 -13
- package/dist/index.js +11 -13
- package/dist/indexed-list.d.ts +8 -5
- package/dist/indexed-list.d.ts.map +1 -1
- package/dist/indexed-list.js +14 -7
- package/dist/indexed-list.js.map +1 -1
- package/dist/jsx-runtime.d.ts +10 -8
- package/dist/jsx-runtime.d.ts.map +1 -1
- package/dist/jsx-runtime.js +28 -23
- package/dist/jsx-runtime.js.map +1 -1
- package/dist/keyed-list.d.ts +13 -14
- package/dist/keyed-list.d.ts.map +1 -1
- package/dist/keyed-list.js +132 -160
- package/dist/keyed-list.js.map +1 -1
- package/dist/metadata.d.ts +6 -3
- package/dist/metadata.d.ts.map +1 -1
- package/dist/metadata.js +131 -164
- package/dist/metadata.js.map +1 -1
- package/dist/nested-prop.d.ts +4 -2
- package/dist/nested-prop.d.ts.map +1 -1
- package/dist/nested-prop.js +17 -16
- package/dist/nested-prop.js.map +1 -1
- package/dist/profiling.d.ts +11 -8
- package/dist/profiling.d.ts.map +1 -1
- package/dist/profiling.js +17 -17
- package/dist/profiling.js.map +1 -1
- package/dist/protocol.d.ts +5 -2
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +8 -5
- package/dist/protocol.js.map +1 -1
- package/dist/raw-html.d.ts +5 -2
- package/dist/raw-html.d.ts.map +1 -1
- package/dist/raw-html.js +86 -146
- package/dist/raw-html.js.map +1 -1
- package/dist/ref.d.ts +8 -3
- package/dist/ref.d.ts.map +1 -1
- package/dist/ref.js +10 -2
- package/dist/ref.js.map +1 -1
- package/dist/renderable-protocol.d.ts +26 -8
- package/dist/renderable-protocol.d.ts.map +1 -1
- package/dist/renderable-protocol.js +30 -9
- package/dist/renderable-protocol.js.map +1 -1
- package/dist/renderable.d.ts +27 -22
- package/dist/renderable.d.ts.map +1 -1
- package/dist/renderable.js +141 -133
- package/dist/renderable.js.map +1 -1
- package/dist/retained-ui.d.ts +9 -6
- package/dist/retained-ui.d.ts.map +1 -1
- package/dist/retained-ui.js +12 -10
- package/dist/retained-ui.js.map +1 -1
- package/dist/root.d.ts +18 -15
- package/dist/root.d.ts.map +1 -1
- package/dist/root.js +73 -85
- package/dist/root.js.map +1 -1
- package/dist/scheduler.d.ts +10 -8
- package/dist/scheduler.d.ts.map +1 -1
- package/dist/scheduler.js +97 -105
- package/dist/scheduler.js.map +1 -1
- package/dist/server-framework.d.ts +45 -42
- package/dist/server-framework.d.ts.map +1 -1
- package/dist/server-framework.js +209 -217
- package/dist/server-framework.js.map +1 -1
- package/dist/server.d.ts +130 -128
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +603 -710
- package/dist/server.js.map +1 -1
- package/dist/shared/promise.d.ts +6 -3
- package/dist/shared/promise.d.ts.map +1 -1
- package/dist/shared/promise.js +21 -19
- package/dist/shared/promise.js.map +1 -1
- package/dist/source-mask.d.ts +9 -6
- package/dist/source-mask.d.ts.map +1 -1
- package/dist/source-mask.js +45 -63
- package/dist/source-mask.js.map +1 -1
- package/dist/spread.d.ts +5 -2
- package/dist/spread.d.ts.map +1 -1
- package/dist/spread.js +79 -99
- package/dist/spread.js.map +1 -1
- package/dist/state-slot.d.ts +18 -15
- package/dist/state-slot.d.ts.map +1 -1
- package/dist/state-slot.js +43 -42
- package/dist/state-slot.js.map +1 -1
- package/dist/testing.d.ts +9 -6
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +16 -12
- package/dist/testing.js.map +1 -1
- package/package.json +8 -7
- package/src/actions.ts +415 -0
- package/src/async.ts +78 -0
- package/src/compiled/async-resource.ts +113 -0
- package/src/compiled/core.ts +4041 -0
- package/src/compiled/types.ts +96 -0
- package/src/compiled/validation.ts +23 -0
- package/src/component-spread.ts +86 -0
- package/src/concurrent.ts +310 -0
- package/src/direct-dom.ts +365 -0
- package/src/dom/attributes.ts +55 -0
- package/src/dom/events.ts +93 -0
- package/src/dom/forms.ts +220 -0
- package/src/dom/intrinsic.ts +94 -0
- package/src/dom/namespace.ts +30 -0
- package/src/dom/namespaces.ts +14 -0
- package/src/dom/properties.ts +355 -0
- package/src/dom/style-properties.ts +46 -0
- package/src/dom/styles.ts +86 -0
- package/src/dom-forms.ts +23 -0
- package/src/dom-styles.ts +11 -0
- package/src/env.d.ts +6 -0
- package/src/framework-hydrate.ts +224 -0
- package/src/framework-protocol.ts +335 -0
- package/src/framework.ts +161 -0
- package/src/hydrate.ts +38 -0
- package/src/hydration-bridge.ts +196 -0
- package/src/hydration.ts +642 -0
- package/src/index.ts +92 -0
- package/src/indexed-list.ts +20 -0
- package/src/jsx-runtime.ts +55 -0
- package/src/keyed-list.ts +233 -0
- package/src/metadata.ts +212 -0
- package/src/nested-prop.ts +27 -0
- package/src/profiling.ts +43 -0
- package/src/protocol.ts +8 -0
- package/src/raw-html.ts +206 -0
- package/src/ref.ts +13 -0
- package/src/renderable-protocol.ts +63 -0
- package/src/renderable.ts +283 -0
- package/src/retained-ui.ts +19 -0
- package/src/root.ts +122 -0
- package/src/scheduler.ts +136 -0
- package/src/server-framework.ts +397 -0
- package/src/server.ts +1160 -0
- package/src/shared/promise.ts +28 -0
- package/src/source-mask.ts +83 -0
- package/src/spread.ts +131 -0
- package/src/state-slot.ts +76 -0
- package/src/testing.ts +27 -0
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
package/dist/direct-dom.js
CHANGED
|
@@ -1,239 +1,205 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
1
|
+
import { createComponentProps, createIntrinsicElement, intrinsicChildrenNamespace, readIntrinsicNamespace, resolveIntrinsicNamespace, withIntrinsicNamespace } from "./dom/intrinsic.js";
|
|
2
|
+
import { claimHydrationArrayRange, claimHydrationElement, claimHydrationNode, claimHydrationText, createHydrationFragment, finishHydrationArrayRange, hydrationFragmentChildren, isHydrating } from "./hydration-bridge.js";
|
|
3
|
+
import { isRenderableProtocol, materializeRenderable } from "./renderable-protocol.js";
|
|
4
|
+
import { hasInvalidChild } from "./compiled/validation.js";
|
|
5
|
+
import { adoptCompiledRoot, constructCompiledComponent, isCompiledBinding, isStructuralBinding, mountCompiledBinding, mountCompiledProp, mountCompiledPropTransition, mountCompiledRef, queueElementRef, registerCompiledCleanup } from "./compiled/core.js";
|
|
6
|
+
import { mountRawHtmlProp } from "./raw-html.js";
|
|
7
|
+
import { intrinsicNamespaceUrl } from "./dom/namespaces.js";
|
|
8
|
+
import { applyDomProp, ensureControlledFormRestoration, isControlledFormProp, restoreControlledFormState } from "./dom/properties.js";
|
|
9
|
+
import { attachEventProp, isEventProp } from "./dom/events.js";
|
|
10
|
+
//#region src/direct-dom.ts
|
|
11
|
+
const DEV = typeof __VIDACT_DEV__ === "undefined" || __VIDACT_DEV__;
|
|
12
|
+
const UNSAFE_HTML = typeof __VIDACT_UNSAFE_HTML__ === "undefined" || __VIDACT_UNSAFE_HTML__;
|
|
13
|
+
const Fragment = Symbol.for("vidact.v1.Fragment");
|
|
13
14
|
let frameworkMetadataHandler;
|
|
14
15
|
/** @internal */
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
function installFrameworkMetadata(handler) {
|
|
17
|
+
frameworkMetadataHandler = handler;
|
|
17
18
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
return frameworkMetadataHandler(element, props);
|
|
41
|
-
}
|
|
42
|
-
return element;
|
|
19
|
+
function h(type, props, ...children) {
|
|
20
|
+
if (typeof type === "symbol") {
|
|
21
|
+
if (isHydrating()) return createHydrationFragment(children);
|
|
22
|
+
const fragment = document.createDocumentFragment();
|
|
23
|
+
appendChildren(fragment, children);
|
|
24
|
+
return fragment;
|
|
25
|
+
}
|
|
26
|
+
if (typeof type === "function") {
|
|
27
|
+
const namespace = readIntrinsicNamespace(props);
|
|
28
|
+
const component = type;
|
|
29
|
+
const root = constructCompiledComponent(() => withIntrinsicNamespace(namespace, () => component(createComponentProps(props, children))), type);
|
|
30
|
+
adoptCompiledRoot(root);
|
|
31
|
+
return root;
|
|
32
|
+
}
|
|
33
|
+
const namespace = resolveIntrinsicNamespace(type, readIntrinsicNamespace(props));
|
|
34
|
+
const namespaceUrl = intrinsicNamespaceUrl(namespace);
|
|
35
|
+
const element = claimHydrationElement(type, namespaceUrl, (candidate) => matchesHydrationElement(candidate, props, children)) ?? createIntrinsicElement(document, type, namespace);
|
|
36
|
+
const restoreAfterChildren = applyProps(element, props, children);
|
|
37
|
+
withIntrinsicNamespace(intrinsicChildrenNamespace(type, namespace), () => appendChildren(element, children));
|
|
38
|
+
if (restoreAfterChildren) restoreControlledFormState(element);
|
|
39
|
+
if (frameworkMetadataHandler !== void 0 && namespace === "html") return frameworkMetadataHandler(element, props);
|
|
40
|
+
return element;
|
|
43
41
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
return h(type, props, ...children);
|
|
42
|
+
function createElement(type, props, ...children) {
|
|
43
|
+
if (children.length === 0 && props !== null && Object.hasOwn(props, "children")) return h(type, props, props.children);
|
|
44
|
+
return h(type, props, ...children);
|
|
49
45
|
}
|
|
50
46
|
function matchesHydrationElement(element, props, children) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
if (expectedNodes.some((node) => !element.contains(node)))
|
|
63
|
-
return false;
|
|
64
|
-
const expectedText = staticHydrationText(children);
|
|
65
|
-
return expectedText === undefined || element.textContent === expectedText;
|
|
47
|
+
const classInput = props?.className;
|
|
48
|
+
const expectedClass = isCompiledBinding(classInput) ? classInput[1]() : classInput;
|
|
49
|
+
if (typeof expectedClass === "string" && element.getAttribute("class") !== expectedClass) return false;
|
|
50
|
+
const idInput = props?.id;
|
|
51
|
+
const expectedId = isCompiledBinding(idInput) ? idInput[1]() : idInput;
|
|
52
|
+
if (typeof expectedId === "string" && element.getAttribute("id") !== expectedId) return false;
|
|
53
|
+
const expectedNodes = [];
|
|
54
|
+
collectHydrationChildNodes(children, expectedNodes);
|
|
55
|
+
if (expectedNodes.some((node) => !element.contains(node))) return false;
|
|
56
|
+
const expectedText = staticHydrationText(children);
|
|
57
|
+
return expectedText === void 0 || element.textContent === expectedText;
|
|
66
58
|
}
|
|
67
59
|
function collectHydrationChildNodes(children, nodes) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
if (child instanceof Node)
|
|
81
|
-
nodes.push(child);
|
|
82
|
-
}
|
|
60
|
+
for (const child of children) {
|
|
61
|
+
if (Array.isArray(child)) {
|
|
62
|
+
collectHydrationChildNodes(child, nodes);
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
if (child instanceof DocumentFragment) {
|
|
66
|
+
const fragmentChildren = hydrationFragmentChildren(child);
|
|
67
|
+
if (fragmentChildren !== void 0) collectHydrationChildNodes(fragmentChildren, nodes);
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
if (child instanceof Node) nodes.push(child);
|
|
71
|
+
}
|
|
83
72
|
}
|
|
84
73
|
function staticHydrationText(children) {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
return undefined;
|
|
111
|
-
}
|
|
112
|
-
return text;
|
|
74
|
+
let text = "";
|
|
75
|
+
for (const child of children) {
|
|
76
|
+
if (Array.isArray(child)) {
|
|
77
|
+
const nested = staticHydrationText(child);
|
|
78
|
+
if (nested === void 0) return void 0;
|
|
79
|
+
text += nested;
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
if (child === null || child === void 0 || typeof child === "boolean") continue;
|
|
83
|
+
if (isCompiledBinding(child)) {
|
|
84
|
+
const value = child[1]();
|
|
85
|
+
if (value === null || value === void 0 || typeof value === "boolean") continue;
|
|
86
|
+
if (typeof value === "string" || typeof value === "number" || typeof value === "bigint") {
|
|
87
|
+
text += String(value);
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
if (typeof child === "string" || typeof child === "number" || typeof child === "bigint") {
|
|
93
|
+
text += String(child);
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
return text;
|
|
113
99
|
}
|
|
114
100
|
function applyProps(element, props, children) {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
applyDomProp(element, name, value);
|
|
174
|
-
}
|
|
175
|
-
if (rawHtml === null || rawHtml === undefined)
|
|
176
|
-
return restoreAfterChildren;
|
|
177
|
-
if (!(element instanceof HTMLElement)) {
|
|
178
|
-
throw new Error(DEV ? 'dangerouslySetInnerHTML on SVG and MathML elements is not supported' : 'V102');
|
|
179
|
-
}
|
|
180
|
-
if (!UNSAFE_HTML) {
|
|
181
|
-
throw new Error(DEV ? 'dangerouslySetInnerHTML requires the unsafe-html compiler feature' : 'V104');
|
|
182
|
-
}
|
|
183
|
-
mountRawHtmlProp(element, rawHtml, children);
|
|
184
|
-
return restoreAfterChildren;
|
|
101
|
+
if (props === null) return false;
|
|
102
|
+
const rawHtml = props.dangerouslySetInnerHTML;
|
|
103
|
+
let restoreAfterChildren = false;
|
|
104
|
+
let hasControlledRestoration = false;
|
|
105
|
+
for (const name in props) {
|
|
106
|
+
if (!Object.hasOwn(props, name)) continue;
|
|
107
|
+
const value = props[name];
|
|
108
|
+
if (name.startsWith("__vidactSpread") && typeof value === "function") {
|
|
109
|
+
restoreAfterChildren = Boolean(value(element)) || restoreAfterChildren;
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
if (name === "key" || name === "children" || name === "__vidactNamespace") continue;
|
|
113
|
+
if (name === "dangerouslySetInnerHTML") continue;
|
|
114
|
+
if (!hasControlledRestoration && isControlledFormProp(element, name)) {
|
|
115
|
+
registerCompiledCleanup(ensureControlledFormRestoration(element));
|
|
116
|
+
hasControlledRestoration = true;
|
|
117
|
+
}
|
|
118
|
+
if (name === "value" && element instanceof HTMLSelectElement) restoreAfterChildren = true;
|
|
119
|
+
if (name === "ref") {
|
|
120
|
+
if (isCompiledBinding(value)) {
|
|
121
|
+
mountCompiledRef(element, value);
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
if (value !== null && value !== void 0) queueElementRef(element, value);
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
if (isCompiledBinding(value)) {
|
|
128
|
+
if (isEventProp(name)) {
|
|
129
|
+
mountCompiledProp(value, (next) => attachEventProp(element, name, next));
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
if (element instanceof HTMLSelectElement && name === "multiple") {
|
|
133
|
+
mountCompiledPropTransition(value, (initial) => applyDomProp(element, name, initial), (next, previous) => [
|
|
134
|
+
() => applyDomProp(element, name, next),
|
|
135
|
+
() => {
|
|
136
|
+
applyDomProp(element, name, previous);
|
|
137
|
+
restoreControlledFormState(element);
|
|
138
|
+
},
|
|
139
|
+
,
|
|
140
|
+
() => restoreControlledFormState(element),
|
|
141
|
+
-1
|
|
142
|
+
]);
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
mountCompiledProp(value, (next) => applyDomProp(element, name, next));
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
if (isEventProp(name)) {
|
|
149
|
+
registerCompiledCleanup(attachEventProp(element, name, value));
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
applyDomProp(element, name, value);
|
|
153
|
+
}
|
|
154
|
+
if (rawHtml === null || rawHtml === void 0) return restoreAfterChildren;
|
|
155
|
+
if (!(element instanceof HTMLElement)) throw new Error(DEV ? "dangerouslySetInnerHTML on SVG and MathML elements is not supported" : "V102");
|
|
156
|
+
if (!UNSAFE_HTML) throw new Error(DEV ? "dangerouslySetInnerHTML requires the unsafe-html compiler feature" : "V104");
|
|
157
|
+
mountRawHtmlProp(element, rawHtml, children);
|
|
158
|
+
return restoreAfterChildren;
|
|
185
159
|
}
|
|
186
160
|
function appendChildren(parent, children) {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
}
|
|
190
|
-
for (const child of children)
|
|
191
|
-
appendChild(parent, child);
|
|
161
|
+
if (hasInvalidChild(children)) throw new TypeError(DEV ? "unsupported direct child value; expected a DOM node or owned block" : "V103");
|
|
162
|
+
for (const child of children) appendChild(parent, child);
|
|
192
163
|
}
|
|
193
164
|
function appendChild(parent, child) {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
}
|
|
231
|
-
if (typeof child === 'object' || typeof child === 'function' || typeof child === 'symbol') {
|
|
232
|
-
throw new TypeError(DEV ? 'unsupported direct child value; expected a DOM node or owned block' : 'V103');
|
|
233
|
-
}
|
|
234
|
-
const content = String(child);
|
|
235
|
-
if (claimHydrationText(parent, content) === undefined) {
|
|
236
|
-
parent.appendChild(document.createTextNode(content));
|
|
237
|
-
}
|
|
165
|
+
if (child === null || child === void 0 || typeof child === "boolean") {
|
|
166
|
+
claimHydrationText(parent, "");
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
if (isStructuralBinding(child)) {
|
|
170
|
+
child[1](parent, null);
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
if (isCompiledBinding(child)) {
|
|
174
|
+
mountCompiledBinding(parent, child);
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
if (isRenderableProtocol(child)) {
|
|
178
|
+
appendChild(parent, materializeRenderable(child));
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
if (Array.isArray(child)) {
|
|
182
|
+
const hydratedRange = claimHydrationArrayRange(parent);
|
|
183
|
+
for (const item of child) appendChild(parent, item);
|
|
184
|
+
if (hydratedRange !== void 0) finishHydrationArrayRange(parent, hydratedRange[1]);
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
if (child instanceof Node) {
|
|
188
|
+
if (child instanceof DocumentFragment) {
|
|
189
|
+
const hydrationChildren = hydrationFragmentChildren(child);
|
|
190
|
+
if (hydrationChildren !== void 0) {
|
|
191
|
+
for (const item of hydrationChildren) appendChild(parent, item);
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
if (!claimHydrationNode(parent, child)) parent.appendChild(child);
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
if (typeof child === "object" || typeof child === "function" || typeof child === "symbol") throw new TypeError(DEV ? "unsupported direct child value; expected a DOM node or owned block" : "V103");
|
|
199
|
+
const content = String(child);
|
|
200
|
+
if (claimHydrationText(parent, content) === void 0) parent.appendChild(document.createTextNode(content));
|
|
238
201
|
}
|
|
202
|
+
//#endregion
|
|
203
|
+
export { Fragment, createElement, h, installFrameworkMetadata };
|
|
204
|
+
|
|
239
205
|
//# sourceMappingURL=direct-dom.js.map
|
package/dist/direct-dom.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"direct-dom.js","
|
|
1
|
+
{"version":3,"file":"direct-dom.js","names":[],"sources":["../src/direct-dom.ts"],"mappings":";;;;;;;;;;AAqDA,MAAM,MAAM,OAAO,mBAAmB,eAAe;AACrD,MAAM,cAAc,OAAO,2BAA2B,eAAe;AAiBrE,MAAa,WAAmB,OAAO,IAAI,oBAAoB;AAC/D,IAAI;;AAGJ,SAAgB,yBACd,SACM;CACN,2BAA2B;AAC7B;AAgCA,SAAgB,EACd,MACA,OACA,GAAG,UACU;CACb,IAAI,OAAO,SAAS,UAAU;EAC5B,IAAI,YAAY,GAAG,OAAO,wBAAwB,QAAQ;EAC1D,MAAM,WAAW,SAAS,uBAAuB;EACjD,eAAe,UAAU,QAAQ;EACjC,OAAO;CACT;CACA,IAAI,OAAO,SAAS,YAAY;EAC9B,MAAM,YAAY,uBAAuB,KAAK;EAC9C,MAAM,YAAY;EAClB,MAAM,OAAO,iCAET,uBAAuB,iBAAiB,UAAU,qBAAqB,OAAO,QAAQ,CAAC,CAAC,GAC1F,IACF;EACA,kBAAkB,IAAI;EACtB,OAAO;CACT;CAEA,MAAM,YAAY,0BAA0B,MAAM,uBAAuB,KAAK,CAAC;CAC/E,MAAM,eAAe,sBAAsB,SAAS;CACpD,MAAM,UACJ,sBAAsB,MAAM,eAAe,cACzC,wBAAwB,WAAW,OAAO,QAAQ,CACpD,KAAK,uBAAuB,UAAU,MAAM,SAAS;CACvD,MAAM,uBAAuB,WAAW,SAAS,OAAO,QAAQ;CAChE,uBAAuB,2BAA2B,MAAM,SAAS,SAC/D,eAAe,SAAS,QAAQ,CAClC;CACA,IAAI,sBAAsB,2BAA2B,OAA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K,GAAG;EAC9B,MAAM,EAAE,CAAC,QAAQ,IAAI;EACrB;CACF;CACA,IAAI,kBAAkB,KAAK,GAAG;EAC5B,qBAAqB,QAAQ,KAAK;EAClC;CACF;CACA,IAAI,qBAAqB,KAAK,GAAG;EAC/B,YAAY,QAAQ,sBAAsB,KAAK,CAAgB;EAC/D;CACF;CACA,IAAI,MAAM,QAAQ,KAAK,GAAG;EACxB,MAAM,gBAAgB,yBAAyB,MAAM;EACrD,KAAK,MAAM,QAAQ,OAAO,YAAY,QAAQ,IAAI;EAClD,IAAI,kBAAkB,KAAA,GAAW,0BAA0B,QAAQ,cAAc,EAAE;EACnF;CACF;CACA,IAAI,iBAAiB,MAAM;EACzB,IAAI,iBAAiB,kBAAkB;GACrC,MAAM,oBAAoB,0BAA0B,KAAK;GACzD,IAAI,sBAAsB,KAAA,GAAW;IACnC,KAAK,MAAM,QAAQ,mBAAmB,YAAY,QAAQ,IAAmB;IAC7E;GACF;EACF;EACA,IAAI,CAAC,mBAAmB,QAAQ,KAAK,GAAG,OAAO,YAAY,KAAK;EAChE;CACF;CACA,IAAI,OAAO,UAAU,YAAY,OAAO,UAAU,cAAc,OAAO,UAAU,UAC/E,MAAM,IAAI,UACR,MAAM,uEAAuE,MAC/E;CAEF,MAAM,UAAU,OAAO,KAAK;CAC5B,IAAI,mBAAmB,QAAQ,OAAO,MAAM,KAAA,GAC1C,OAAO,YAAY,SAAS,eAAe,OAAO,CAAC;AAEvD"}
|
package/dist/dom/attributes.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
//#region src/dom/attributes.d.ts
|
|
2
|
+
declare const SERVER_BOOLEAN_ATTRIBUTES: ReadonlySet<string>;
|
|
3
|
+
declare const VALID_ATTRIBUTE_NAME: RegExp;
|
|
4
|
+
declare const META_IDENTITY_PROPS: readonly ['charSet', 'name', 'property', 'httpEquiv'];
|
|
5
|
+
declare const LINK_IDENTITY_PROPS: readonly ['rel', 'href', 'as'];
|
|
6
|
+
declare const META_IDENTITY_ATTRIBUTES: readonly ['charset', 'name', 'property', 'http-equiv'];
|
|
7
|
+
declare function serverHtmlAttributeName(name: string): string;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { LINK_IDENTITY_PROPS, META_IDENTITY_ATTRIBUTES, META_IDENTITY_PROPS, SERVER_BOOLEAN_ATTRIBUTES, VALID_ATTRIBUTE_NAME, serverHtmlAttributeName };
|
|
7
10
|
//# sourceMappingURL=attributes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attributes.d.ts","
|
|
1
|
+
{"version":3,"file":"attributes.d.ts","names":[],"sources":["../../src/dom/attributes.ts"],"mappings":";cAAa,2BAA2B;cA8C3B,sBAAoB;cAEpB;cACA;cACA;iBAEG,wBAAwB"}
|