@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/server.js
CHANGED
|
@@ -1,793 +1,686 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { LINK_IDENTITY_PROPS, META_IDENTITY_PROPS, SERVER_BOOLEAN_ATTRIBUTES, VALID_ATTRIBUTE_NAME, serverHtmlAttributeName
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
1
|
+
import { isPromiseLike } from "./shared/promise.js";
|
|
2
|
+
import { UNITLESS_STYLE_PROPERTIES } from "./dom/style-properties.js";
|
|
3
|
+
import { LINK_IDENTITY_PROPS, META_IDENTITY_PROPS, SERVER_BOOLEAN_ATTRIBUTES, VALID_ATTRIBUTE_NAME, serverHtmlAttributeName } from "./dom/attributes.js";
|
|
4
|
+
//#region src/server.ts
|
|
5
|
+
const SERVER_NODE = Symbol.for("vidact.v1.ServerNode");
|
|
6
|
+
const SERVER_NODE_KIND = Symbol.for("vidact.v1.ServerNodeKind");
|
|
7
|
+
const SERVER_CONTEXT = Symbol("Vidact.ServerContext");
|
|
8
|
+
const SERVER_ASYNC_RESOURCE = Symbol("Vidact.ServerAsyncResource");
|
|
9
|
+
const SERVER_SUSPENSION = Symbol("Vidact.ServerSuspension");
|
|
10
|
+
const SERVER_RENDERABLE = Symbol.for("vidact.v1.ServerRenderable");
|
|
11
|
+
function createRenderable(input, construct) {
|
|
12
|
+
return {
|
|
13
|
+
props: input,
|
|
14
|
+
[SERVER_RENDERABLE]: {
|
|
15
|
+
input,
|
|
16
|
+
construct
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function isRenderable(value) {
|
|
21
|
+
return typeof value === "object" && value !== null && Object.hasOwn(value, SERVER_RENDERABLE) && typeof value[SERVER_RENDERABLE]?.construct === "function";
|
|
22
|
+
}
|
|
23
|
+
function renderableToArray(value) {
|
|
24
|
+
if (!isRenderable(value)) throw new TypeError("expected a compiled server renderable");
|
|
25
|
+
return [value];
|
|
26
|
+
}
|
|
27
|
+
function renderableMarker(value) {
|
|
28
|
+
if (!isRenderable(value)) throw new TypeError("expected a compiled server renderable");
|
|
29
|
+
}
|
|
30
|
+
function cloneRenderable(value, overrides = {}, childrenOverride) {
|
|
31
|
+
if (!isRenderable(value)) throw new TypeError("expected a compiled server renderable");
|
|
32
|
+
const renderable = value[SERVER_RENDERABLE];
|
|
33
|
+
const input = {
|
|
34
|
+
...renderable.input,
|
|
35
|
+
...overrides
|
|
36
|
+
};
|
|
37
|
+
if (arguments.length >= 3) input.children = childrenOverride;
|
|
38
|
+
return renderable.construct(input);
|
|
39
|
+
}
|
|
40
|
+
function cloneRenderableComponent(props) {
|
|
41
|
+
if (Object.hasOwn(props, "childrenOverride")) return cloneRenderable(props.value, props.overrides, props.childrenOverride);
|
|
42
|
+
return cloneRenderable(props.value, props.overrides);
|
|
43
|
+
}
|
|
44
|
+
function keyedFragmentComponent(props) {
|
|
45
|
+
return props.children;
|
|
46
|
+
}
|
|
47
|
+
function renderableProps(input) {
|
|
48
|
+
return Object.fromEntries(Object.entries(input).filter(([name]) => ![
|
|
49
|
+
"children",
|
|
50
|
+
"key",
|
|
51
|
+
"ref"
|
|
52
|
+
].includes(name)));
|
|
53
|
+
}
|
|
54
|
+
function renderableChildren(input) {
|
|
55
|
+
return input.children;
|
|
56
|
+
}
|
|
57
|
+
function renderableRef(_input) {}
|
|
58
|
+
function forwardedRef(_props) {}
|
|
59
|
+
function dynamicIntrinsicComponent(props) {
|
|
60
|
+
if (typeof props.tag !== "string") throw new TypeError("dynamic intrinsic construction requires a string tag");
|
|
61
|
+
const input = { ...props.props };
|
|
62
|
+
if (Object.hasOwn(props, "childrenOverride")) input.children = props.childrenOverride;
|
|
63
|
+
return jsx(props.tag, {
|
|
64
|
+
...renderableProps(input),
|
|
65
|
+
children: renderableChildren(input)
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
const VOID_ELEMENTS = /* @__PURE__ */ new Set([
|
|
69
|
+
"area",
|
|
70
|
+
"base",
|
|
71
|
+
"br",
|
|
72
|
+
"col",
|
|
73
|
+
"embed",
|
|
74
|
+
"hr",
|
|
75
|
+
"img",
|
|
76
|
+
"input",
|
|
77
|
+
"keygen",
|
|
78
|
+
"link",
|
|
79
|
+
"menuitem",
|
|
80
|
+
"meta",
|
|
81
|
+
"param",
|
|
82
|
+
"source",
|
|
83
|
+
"track",
|
|
84
|
+
"wbr"
|
|
82
85
|
]);
|
|
83
|
-
const HYDRATION_PREFIX =
|
|
84
|
-
const UNSAFE_HTML = typeof __VIDACT_UNSAFE_HTML__ !==
|
|
86
|
+
const HYDRATION_PREFIX = "v2";
|
|
87
|
+
const UNSAFE_HTML = typeof __VIDACT_UNSAFE_HTML__ !== "undefined" && __VIDACT_UNSAFE_HTML__;
|
|
85
88
|
let activeRender;
|
|
86
89
|
let activeFrameworkRender;
|
|
87
|
-
const serverBuiltins = new WeakSet();
|
|
90
|
+
const serverBuiltins = /* @__PURE__ */ new WeakSet();
|
|
88
91
|
serverBuiltins.add(dynamicIntrinsicComponent);
|
|
89
92
|
serverBuiltins.add(cloneRenderableComponent);
|
|
90
|
-
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
+
serverBuiltins.add(keyedFragmentComponent);
|
|
94
|
+
const serverPromiseResources = /* @__PURE__ */ new WeakMap();
|
|
95
|
+
const FRAMEWORK_HEAD_PLACEHOLDER = "<!--vidact-framework:v1:head-->";
|
|
96
|
+
const Fragment = Symbol("Vidact.ServerFragment");
|
|
93
97
|
/** @internal */
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
98
|
+
function createServerFrameworkRenderContext(signal) {
|
|
99
|
+
return {
|
|
100
|
+
signal,
|
|
101
|
+
pending: /* @__PURE__ */ new Set(),
|
|
102
|
+
cache: /* @__PURE__ */ new Map(),
|
|
103
|
+
head: /* @__PURE__ */ new Map(),
|
|
104
|
+
stylePrecedence: [],
|
|
105
|
+
sawHead: false
|
|
106
|
+
};
|
|
103
107
|
}
|
|
104
108
|
/** @internal */
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
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
|
-
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
109
|
+
function withServerFrameworkRenderContext(context, operation) {
|
|
110
|
+
const previous = activeFrameworkRender;
|
|
111
|
+
activeFrameworkRender = context;
|
|
112
|
+
try {
|
|
113
|
+
return operation();
|
|
114
|
+
} finally {
|
|
115
|
+
activeFrameworkRender = previous;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
function cache(operation) {
|
|
119
|
+
return (...arguments_) => {
|
|
120
|
+
const context = activeFrameworkRender;
|
|
121
|
+
if (context === void 0) return operation(...arguments_);
|
|
122
|
+
let entries = context.cache.get(operation);
|
|
123
|
+
if (entries === void 0) {
|
|
124
|
+
entries = [];
|
|
125
|
+
context.cache.set(operation, entries);
|
|
126
|
+
}
|
|
127
|
+
const existing = entries.find((entry) => entry.args.length === arguments_.length && entry.args.every((argument, index) => Object.is(argument, arguments_[index])));
|
|
128
|
+
if (existing !== void 0) {
|
|
129
|
+
if (existing.status === "rejected") throw existing.value;
|
|
130
|
+
return existing.value;
|
|
131
|
+
}
|
|
132
|
+
try {
|
|
133
|
+
const value = operation(...arguments_);
|
|
134
|
+
entries.push({
|
|
135
|
+
args: [...arguments_],
|
|
136
|
+
status: "fulfilled",
|
|
137
|
+
value
|
|
138
|
+
});
|
|
139
|
+
return value;
|
|
140
|
+
} catch (error) {
|
|
141
|
+
entries.push({
|
|
142
|
+
args: [...arguments_],
|
|
143
|
+
status: "rejected",
|
|
144
|
+
value: error
|
|
145
|
+
});
|
|
146
|
+
throw error;
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
function cacheSignal() {
|
|
151
|
+
return activeFrameworkRender?.signal ?? null;
|
|
152
|
+
}
|
|
153
|
+
function preconnect(href, options = {}) {
|
|
154
|
+
registerResourceHint("preconnect", href, options);
|
|
155
|
+
}
|
|
156
|
+
function prefetchDNS(href) {
|
|
157
|
+
registerResourceHint("dns-prefetch", href, {});
|
|
158
|
+
}
|
|
159
|
+
function preload(href, options) {
|
|
160
|
+
registerResourceHint("preload", href, options);
|
|
161
|
+
}
|
|
162
|
+
function preloadModule(href, options = {}) {
|
|
163
|
+
registerResourceHint("modulepreload", href, options);
|
|
164
|
+
}
|
|
165
|
+
function preinit(href, options) {
|
|
166
|
+
if (options.as === "style") {
|
|
167
|
+
registerHeadEntry(`style:${href}`, `<link rel="stylesheet" href="${escapeAttribute(href)}"${serializeHintOptions(options)}>`, `2:${options.precedence ?? "default"}`);
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
registerHeadEntry(`script:${href}`, `<script src="${escapeAttribute(href)}"${serializeHintOptions(options)}><\/script>`, "3:script");
|
|
171
|
+
}
|
|
172
|
+
function preinitModule(href, options = {}) {
|
|
173
|
+
registerHeadEntry(`module:${href}`, `<script type="module" src="${escapeAttribute(href)}"${serializeHintOptions(options)}><\/script>`, "3:script");
|
|
174
|
+
}
|
|
175
|
+
function jsx(type, props, _key) {
|
|
176
|
+
return createServerElement(type, props, false);
|
|
177
|
+
}
|
|
178
|
+
function jsxs(type, props, _key) {
|
|
179
|
+
return createServerElement(type, props, true);
|
|
180
|
+
}
|
|
181
|
+
function jsxDEV(type, props, _key, isStaticChildren = false) {
|
|
182
|
+
return createServerElement(type, props, isStaticChildren);
|
|
183
|
+
}
|
|
184
|
+
function createElement(type, props, ...children) {
|
|
185
|
+
const nextProps = { ...props };
|
|
186
|
+
if (children.length === 1) nextProps.children = children[0];
|
|
187
|
+
else if (children.length > 1) nextProps.children = children;
|
|
188
|
+
return createServerElement(type, nextProps, children.length > 1);
|
|
184
189
|
}
|
|
185
190
|
/** @internal */
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
}, 'transparent');
|
|
191
|
+
function createServerHydrationBoundary(value, hostProps = {}) {
|
|
192
|
+
return serverNode((context) => {
|
|
193
|
+
const boundaryIndex = context.nextBoundary;
|
|
194
|
+
context.nextBoundary += 1;
|
|
195
|
+
const identifierPrefix = `${context.identifierPrefix}b${boundaryIndex}-`;
|
|
196
|
+
const boundaryContext = {
|
|
197
|
+
hydrationMarkers: true,
|
|
198
|
+
identifierPrefix,
|
|
199
|
+
nextBoundary: 0,
|
|
200
|
+
nextId: 0,
|
|
201
|
+
activityHidden: false
|
|
202
|
+
};
|
|
203
|
+
return `<div${serializeAttributes({
|
|
204
|
+
...hostProps,
|
|
205
|
+
"data-vidact-identifier-prefix": identifierPrefix
|
|
206
|
+
}, context.activityHidden)}>${hydrationRange("r", serializeSlot(value, boundaryContext))}</div>`;
|
|
207
|
+
}, "transparent");
|
|
204
208
|
}
|
|
205
209
|
function createServerElement(type, props, multipleChildren) {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
const builtin = serverBuiltins.has(type);
|
|
218
|
-
return serverNode((context) => {
|
|
219
|
-
const content = serializeSlot(type(props ?? {}), context);
|
|
220
|
-
return context.hydrationMarkers && !builtin ? hydrationRange('c', content) : content;
|
|
221
|
-
}, builtin ? 'transparent' : 'component');
|
|
222
|
-
}
|
|
223
|
-
if (!VALID_ATTRIBUTE_NAME.test(type))
|
|
224
|
-
throw new TypeError(`invalid server element name ${type}`);
|
|
225
|
-
return serverNode((context) => serializeIntrinsicElement(type, props, multipleChildren, context), 'intrinsic');
|
|
210
|
+
if (type === Fragment) return serverNode((context) => Object.hasOwn(props ?? {}, "children") ? multipleChildren ? serializeChildren(props?.children, context) : serializeSlot(props?.children, context) : "", "transparent");
|
|
211
|
+
if (isRenderable(type)) return serverNode((context) => serializeSlot(cloneRenderable(type, props ?? {}), context), "component");
|
|
212
|
+
if (typeof type === "function") {
|
|
213
|
+
const builtin = serverBuiltins.has(type);
|
|
214
|
+
return serverNode((context) => {
|
|
215
|
+
const content = serializeSlot(type(props ?? {}), context);
|
|
216
|
+
return context.hydrationMarkers && !builtin ? hydrationRange("c", content) : content;
|
|
217
|
+
}, builtin ? "transparent" : "component");
|
|
218
|
+
}
|
|
219
|
+
if (!VALID_ATTRIBUTE_NAME.test(type)) throw new TypeError(`invalid server element name ${type}`);
|
|
220
|
+
return serverNode((context) => serializeIntrinsicElement(type, props, multipleChildren, context), "intrinsic");
|
|
226
221
|
}
|
|
227
222
|
function serializeIntrinsicElement(type, props, multipleChildren, context) {
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
return serializeIntrinsicContents(type, props, multipleChildren, context);
|
|
223
|
+
if (activeFrameworkRender !== void 0 && isHoistableHeadElement(type, props)) {
|
|
224
|
+
const hydrationMarkers = context.hydrationMarkers;
|
|
225
|
+
context.hydrationMarkers = false;
|
|
226
|
+
try {
|
|
227
|
+
const html = serializeIntrinsicContents(type, props, multipleChildren, context);
|
|
228
|
+
registerHeadEntry(metadataKey(type, props), html, metadataPrecedence(type, props));
|
|
229
|
+
return "";
|
|
230
|
+
} finally {
|
|
231
|
+
context.hydrationMarkers = hydrationMarkers;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
return serializeIntrinsicContents(type, props, multipleChildren, context);
|
|
241
235
|
}
|
|
242
236
|
function serializeIntrinsicContents(type, props, multipleChildren, context) {
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
throw error;
|
|
450
|
-
activeFrameworkRender?.pending.add(error.resource.promise);
|
|
451
|
-
const pendingMarker = context.hydrationMarkers ? `<!--${HYDRATION_PREFIX}:p-->` : '';
|
|
452
|
-
return pendingMarker + serializeChild(fallback(), context);
|
|
453
|
-
}
|
|
454
|
-
}, 'transparent');
|
|
237
|
+
const hiddenByActivity = context.activityHidden;
|
|
238
|
+
const previousActivityHidden = context.activityHidden;
|
|
239
|
+
context.activityHidden = false;
|
|
240
|
+
try {
|
|
241
|
+
const attributes = serializeAttributes(props, hiddenByActivity);
|
|
242
|
+
if (VOID_ELEMENTS.has(type)) {
|
|
243
|
+
if (hasRenderableChild(props?.children) || readRawHtml(props) !== void 0) throw new TypeError(`${type} is a void element and cannot have children or raw HTML`);
|
|
244
|
+
return `<${type}${attributes}>`;
|
|
245
|
+
}
|
|
246
|
+
const rawHtml = readRawHtml(props);
|
|
247
|
+
if (rawHtml !== void 0 && hasRenderableChild(props?.children)) throw new TypeError("cannot set both children and dangerouslySetInnerHTML");
|
|
248
|
+
const hasChildren = Object.hasOwn(props ?? {}, "children");
|
|
249
|
+
const children = rawHtml === void 0 ? hasChildren ? serializeElementChildren(type, props?.children, multipleChildren, context) : "" : context.hydrationMarkers ? hydrationRange("h", assertSafeHydrationRawHtml(rawHtml)) : rawHtml;
|
|
250
|
+
if (type === "head" && activeFrameworkRender !== void 0) {
|
|
251
|
+
activeFrameworkRender.sawHead = true;
|
|
252
|
+
return `<head${attributes}>${children}${FRAMEWORK_HEAD_PLACEHOLDER}</head>`;
|
|
253
|
+
}
|
|
254
|
+
return `<${type}${attributes}>${children}</${type}>`;
|
|
255
|
+
} finally {
|
|
256
|
+
context.activityHidden = previousActivityHidden;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
function renderToString(value, options = {}) {
|
|
260
|
+
const previous = activeRender;
|
|
261
|
+
beginFrameworkRenderPass();
|
|
262
|
+
const context = {
|
|
263
|
+
hydrationMarkers: true,
|
|
264
|
+
identifierPrefix: options.identifierPrefix ?? "",
|
|
265
|
+
nextBoundary: 0,
|
|
266
|
+
nextId: 0,
|
|
267
|
+
activityHidden: false
|
|
268
|
+
};
|
|
269
|
+
activeRender = context;
|
|
270
|
+
try {
|
|
271
|
+
return finalizeFrameworkHtml(hydrationRange("r", serializeSlot(typeof value === "function" ? value() : value, context)));
|
|
272
|
+
} finally {
|
|
273
|
+
activeRender = previous;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
function renderToStaticMarkup(value, options = {}) {
|
|
277
|
+
const previous = activeRender;
|
|
278
|
+
beginFrameworkRenderPass();
|
|
279
|
+
const context = {
|
|
280
|
+
hydrationMarkers: false,
|
|
281
|
+
identifierPrefix: options.identifierPrefix ?? "",
|
|
282
|
+
nextBoundary: 0,
|
|
283
|
+
nextId: 0,
|
|
284
|
+
activityHidden: false
|
|
285
|
+
};
|
|
286
|
+
activeRender = context;
|
|
287
|
+
try {
|
|
288
|
+
return finalizeFrameworkHtml(serializeChild(typeof value === "function" ? value() : value, context));
|
|
289
|
+
} finally {
|
|
290
|
+
activeRender = previous;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
function useState(initial) {
|
|
294
|
+
return [typeof initial === "function" ? initial() : initial, serverDispatch];
|
|
295
|
+
}
|
|
296
|
+
function useReducer(_reducer, initial, initialize) {
|
|
297
|
+
return [initialize === void 0 ? initial : initialize(initial), serverDispatch];
|
|
298
|
+
}
|
|
299
|
+
function startTransition(action) {
|
|
300
|
+
action();
|
|
301
|
+
}
|
|
302
|
+
function useTransition() {
|
|
303
|
+
return [false, startTransition];
|
|
304
|
+
}
|
|
305
|
+
function useDeferredValue(value, _initialValue) {
|
|
306
|
+
return value;
|
|
307
|
+
}
|
|
308
|
+
function flushSync(operation) {
|
|
309
|
+
return operation?.();
|
|
310
|
+
}
|
|
311
|
+
function useActionState(_action, initialState, permalink) {
|
|
312
|
+
const dispatch = (_payload) => serverDispatch();
|
|
313
|
+
if (permalink !== void 0) Object.defineProperty(dispatch, "permalink", { value: permalink });
|
|
314
|
+
return [
|
|
315
|
+
initialState,
|
|
316
|
+
dispatch,
|
|
317
|
+
false
|
|
318
|
+
];
|
|
319
|
+
}
|
|
320
|
+
function useOptimistic(passthrough, _reducer) {
|
|
321
|
+
return [passthrough, serverDispatch];
|
|
322
|
+
}
|
|
323
|
+
function useFormStatus() {
|
|
324
|
+
return {
|
|
325
|
+
pending: false,
|
|
326
|
+
data: null,
|
|
327
|
+
method: "get",
|
|
328
|
+
action: null
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
function useMemo(factory, _dependencies) {
|
|
332
|
+
return factory();
|
|
333
|
+
}
|
|
334
|
+
function useCallback(callback, _dependencies) {
|
|
335
|
+
return callback;
|
|
336
|
+
}
|
|
337
|
+
function useRef(initial) {
|
|
338
|
+
return { current: initial };
|
|
339
|
+
}
|
|
340
|
+
function createRef() {
|
|
341
|
+
return { current: null };
|
|
342
|
+
}
|
|
343
|
+
function useEffect(_create, _dependencies) {}
|
|
344
|
+
const useLayoutEffect = useEffect;
|
|
345
|
+
const useInsertionEffect = useEffect;
|
|
346
|
+
function useImperativeHandle(_ref, _create, _dependencies) {}
|
|
347
|
+
function useEffectEvent(callback) {
|
|
348
|
+
return callback;
|
|
349
|
+
}
|
|
350
|
+
function useSyncExternalStore(_subscribe, getSnapshot, getServerSnapshot) {
|
|
351
|
+
return (getServerSnapshot ?? getSnapshot)();
|
|
352
|
+
}
|
|
353
|
+
function useId() {
|
|
354
|
+
const context = activeRender ??= {
|
|
355
|
+
hydrationMarkers: true,
|
|
356
|
+
identifierPrefix: "",
|
|
357
|
+
nextBoundary: 0,
|
|
358
|
+
nextId: 0,
|
|
359
|
+
activityHidden: false
|
|
360
|
+
};
|
|
361
|
+
const id = `:${context.identifierPrefix}r${context.nextId}:`;
|
|
362
|
+
context.nextId += 1;
|
|
363
|
+
return id;
|
|
364
|
+
}
|
|
365
|
+
function createContext(defaultValue) {
|
|
366
|
+
let context;
|
|
367
|
+
const Provider = (props) => serverNode((renderContext) => {
|
|
368
|
+
context[SERVER_CONTEXT].stack.push(props.value);
|
|
369
|
+
try {
|
|
370
|
+
return serializeChild(props.children, renderContext);
|
|
371
|
+
} finally {
|
|
372
|
+
context[SERVER_CONTEXT].stack.pop();
|
|
373
|
+
}
|
|
374
|
+
}, "transparent");
|
|
375
|
+
context = {
|
|
376
|
+
[SERVER_CONTEXT]: {
|
|
377
|
+
defaultValue,
|
|
378
|
+
stack: []
|
|
379
|
+
},
|
|
380
|
+
Provider
|
|
381
|
+
};
|
|
382
|
+
serverBuiltins.add(Provider);
|
|
383
|
+
return context;
|
|
384
|
+
}
|
|
385
|
+
function useContext(context) {
|
|
386
|
+
const state = context[SERVER_CONTEXT];
|
|
387
|
+
return state.stack.length === 0 ? state.defaultValue : state.stack.at(-1);
|
|
388
|
+
}
|
|
389
|
+
function createResource(input) {
|
|
390
|
+
if (!isPromiseLike(input)) throw new TypeError("createResource requires a promise-like value");
|
|
391
|
+
const existing = serverPromiseResources.get(input);
|
|
392
|
+
if (existing !== void 0) return existing;
|
|
393
|
+
let state = { status: "pending" };
|
|
394
|
+
const resource = { promise: input };
|
|
395
|
+
Object.defineProperty(resource, SERVER_ASYNC_RESOURCE, { get: () => state });
|
|
396
|
+
serverPromiseResources.set(input, resource);
|
|
397
|
+
Promise.resolve(input).then((value) => {
|
|
398
|
+
if (state.status === "pending") state = {
|
|
399
|
+
status: "fulfilled",
|
|
400
|
+
value
|
|
401
|
+
};
|
|
402
|
+
}, (reason) => {
|
|
403
|
+
if (state.status === "pending") state = {
|
|
404
|
+
status: "rejected",
|
|
405
|
+
reason
|
|
406
|
+
};
|
|
407
|
+
});
|
|
408
|
+
return resource;
|
|
409
|
+
}
|
|
410
|
+
function use(input) {
|
|
411
|
+
if (isServerContext(input)) return useContext(input);
|
|
412
|
+
const resource = isServerAsyncResource(input) ? input : createResource(input);
|
|
413
|
+
const state = resource[SERVER_ASYNC_RESOURCE];
|
|
414
|
+
if (state.status === "fulfilled") return state.value;
|
|
415
|
+
if (state.status === "rejected") throw state.reason;
|
|
416
|
+
throw {
|
|
417
|
+
[SERVER_SUSPENSION]: true,
|
|
418
|
+
resource
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
function lazy(load) {
|
|
422
|
+
let resource;
|
|
423
|
+
return (props) => {
|
|
424
|
+
resource ??= createResource(load());
|
|
425
|
+
const module = use(resource);
|
|
426
|
+
if (typeof module?.default !== "function") throw new TypeError("lazy loader must resolve to a default component export");
|
|
427
|
+
return module.default(props);
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
function Suspense(props) {
|
|
431
|
+
const render = props.children;
|
|
432
|
+
const fallback = props.fallback;
|
|
433
|
+
if (typeof render !== "function" || typeof fallback !== "function") throw new TypeError("Suspense children and fallback must be compiler-generated render functions");
|
|
434
|
+
return serverNode((context) => {
|
|
435
|
+
try {
|
|
436
|
+
return serializeChild(render(), context);
|
|
437
|
+
} catch (error) {
|
|
438
|
+
if (!isServerSuspension(error)) throw error;
|
|
439
|
+
activeFrameworkRender?.pending.add(error.resource.promise);
|
|
440
|
+
return (context.hydrationMarkers ? `<!--${HYDRATION_PREFIX}:p-->` : "") + serializeChild(fallback(), context);
|
|
441
|
+
}
|
|
442
|
+
}, "transparent");
|
|
455
443
|
}
|
|
456
444
|
serverBuiltins.add(Suspense);
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
}
|
|
471
|
-
finally {
|
|
472
|
-
context.activityHidden = previousActivityHidden;
|
|
473
|
-
}
|
|
474
|
-
}, 'transparent');
|
|
445
|
+
function Activity(props) {
|
|
446
|
+
const render = props.children;
|
|
447
|
+
if (typeof render !== "function") throw new TypeError("Activity children must be a compiler-generated render function");
|
|
448
|
+
if (props.mode !== "visible" && props.mode !== "hidden") throw new TypeError("Activity mode must be \"visible\" or \"hidden\"");
|
|
449
|
+
return serverNode((context) => {
|
|
450
|
+
const previousActivityHidden = context.activityHidden;
|
|
451
|
+
context.activityHidden = props.mode === "hidden" || previousActivityHidden;
|
|
452
|
+
try {
|
|
453
|
+
return serializeChild(render(), context);
|
|
454
|
+
} finally {
|
|
455
|
+
context.activityHidden = previousActivityHidden;
|
|
456
|
+
}
|
|
457
|
+
}, "transparent");
|
|
475
458
|
}
|
|
476
459
|
serverBuiltins.add(Activity);
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
throw new TypeError('Profiler id must be a string');
|
|
484
|
-
if (typeof props.onRender !== 'function') {
|
|
485
|
-
throw new TypeError('Profiler onRender must be a function');
|
|
486
|
-
}
|
|
487
|
-
return render();
|
|
460
|
+
function Profiler(props) {
|
|
461
|
+
const render = props.children;
|
|
462
|
+
if (typeof render !== "function") throw new TypeError("Profiler children must be a compiler-generated render function");
|
|
463
|
+
if (typeof props.id !== "string") throw new TypeError("Profiler id must be a string");
|
|
464
|
+
if (typeof props.onRender !== "function") throw new TypeError("Profiler onRender must be a function");
|
|
465
|
+
return render();
|
|
488
466
|
}
|
|
489
467
|
serverBuiltins.add(Profiler);
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
468
|
+
function useDebugValue(_value, _format) {}
|
|
469
|
+
function captureOwnerStack() {
|
|
470
|
+
return null;
|
|
493
471
|
}
|
|
494
|
-
|
|
495
|
-
|
|
472
|
+
function createPortal(_children, _container) {
|
|
473
|
+
throw new Error("portals cannot be emitted by the server target; render portal content in the client root");
|
|
496
474
|
}
|
|
497
475
|
function serverNode(render, kind) {
|
|
498
|
-
|
|
476
|
+
return {
|
|
477
|
+
[SERVER_NODE]: render,
|
|
478
|
+
[SERVER_NODE_KIND]: kind
|
|
479
|
+
};
|
|
499
480
|
}
|
|
500
481
|
function isServerNode(value) {
|
|
501
|
-
|
|
482
|
+
return typeof value === "object" && value !== null && SERVER_NODE in value;
|
|
502
483
|
}
|
|
503
484
|
function isServerContext(value) {
|
|
504
|
-
|
|
485
|
+
return typeof value === "object" && value !== null && SERVER_CONTEXT in value;
|
|
505
486
|
}
|
|
506
487
|
function isServerAsyncResource(value) {
|
|
507
|
-
|
|
488
|
+
return typeof value === "object" && value !== null && SERVER_ASYNC_RESOURCE in value;
|
|
508
489
|
}
|
|
509
490
|
function isServerSuspension(value) {
|
|
510
|
-
|
|
511
|
-
}
|
|
512
|
-
function serializeChild(value, context
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
if (Array.isArray(value)) {
|
|
525
|
-
const content = value.map((child) => serializeChild(child, context, markScalar)).join('');
|
|
526
|
-
return context.hydrationMarkers ? hydrationRange('a', content) : content;
|
|
527
|
-
}
|
|
528
|
-
if (typeof value === 'object' || typeof value === 'function' || typeof value === 'symbol') {
|
|
529
|
-
throw new TypeError('unsupported server child value');
|
|
530
|
-
}
|
|
531
|
-
const content = escapeText(String(value));
|
|
532
|
-
if (context.activityHidden && content !== '') {
|
|
533
|
-
throw new TypeError('initially hidden Activity server children require a host element root');
|
|
534
|
-
}
|
|
535
|
-
return context.hydrationMarkers && markScalar ? hydrationRange('t', content) : content;
|
|
491
|
+
return typeof value === "object" && value !== null && SERVER_SUSPENSION in value;
|
|
492
|
+
}
|
|
493
|
+
function serializeChild(value, context) {
|
|
494
|
+
if (value === null || value === void 0 || typeof value === "boolean") return "";
|
|
495
|
+
if (isServerNode(value)) return value[SERVER_NODE](context);
|
|
496
|
+
if (isRenderable(value)) return serializeChild(cloneRenderable(value), context);
|
|
497
|
+
if (Array.isArray(value)) {
|
|
498
|
+
const content = value.map((child) => serializeChild(child, context)).join("");
|
|
499
|
+
return context.hydrationMarkers ? hydrationRange("a", content) : content;
|
|
500
|
+
}
|
|
501
|
+
if (typeof value === "object" || typeof value === "function" || typeof value === "symbol") throw new TypeError("unsupported server child value");
|
|
502
|
+
const content = escapeText(String(value));
|
|
503
|
+
if (context.activityHidden && content !== "") throw new TypeError("initially hidden Activity server children require a host element root");
|
|
504
|
+
return content;
|
|
536
505
|
}
|
|
537
506
|
function hasRenderableChild(value) {
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
return !Array.isArray(value) || value.some(hasRenderableChild);
|
|
507
|
+
if (value === null || value === void 0 || typeof value === "boolean") return false;
|
|
508
|
+
return !Array.isArray(value) || value.some(hasRenderableChild);
|
|
541
509
|
}
|
|
542
510
|
function serializeAttributes(props, hiddenByActivity = false) {
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
.toSorted()
|
|
547
|
-
.map((name) => name === 'style'
|
|
548
|
-
? serializeStyleAttribute(props[name], hiddenByActivity)
|
|
549
|
-
: serializeAttribute(name, props[name]))
|
|
550
|
-
.join('');
|
|
551
|
-
return hiddenByActivity && !Object.hasOwn(props, 'style')
|
|
552
|
-
? `${attributes} style="display:none!important"`
|
|
553
|
-
: attributes;
|
|
511
|
+
if (props === null) return " style=\"display:none!important\"";
|
|
512
|
+
const attributes = Object.keys(props).toSorted().map((name) => name === "style" ? serializeStyleAttribute(props[name], hiddenByActivity) : serializeAttribute(name, props[name])).join("");
|
|
513
|
+
return hiddenByActivity && !Object.hasOwn(props, "style") ? `${attributes} style="display:none!important"` : attributes;
|
|
554
514
|
}
|
|
555
515
|
function serializeAttribute(name, value) {
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
name === 'ref' ||
|
|
566
|
-
/^on/i.test(name) ||
|
|
567
|
-
value === null ||
|
|
568
|
-
value === undefined ||
|
|
569
|
-
typeof value === 'function' ||
|
|
570
|
-
typeof value === 'symbol') {
|
|
571
|
-
return '';
|
|
572
|
-
}
|
|
573
|
-
if (name === 'style')
|
|
574
|
-
return serializeStyleAttribute(value);
|
|
575
|
-
const normalizedName = serverHtmlAttributeName(name);
|
|
576
|
-
if (name.startsWith('data-') || name.startsWith('aria-')) {
|
|
577
|
-
return ` ${normalizedName}="${escapeAttribute(String(value))}"`;
|
|
578
|
-
}
|
|
579
|
-
if (SERVER_BOOLEAN_ATTRIBUTES.has(name))
|
|
580
|
-
return value ? ` ${normalizedName}=""` : '';
|
|
581
|
-
if (typeof value === 'boolean')
|
|
582
|
-
return '';
|
|
583
|
-
if (!VALID_ATTRIBUTE_NAME.test(normalizedName))
|
|
584
|
-
return '';
|
|
585
|
-
return ` ${normalizedName}="${escapeAttribute(String(value))}"`;
|
|
516
|
+
if ((name === "action" || name === "formAction") && typeof value === "function" && typeof Reflect.get(value, "permalink") === "string") return ` ${serverHtmlAttributeName(name)}="${escapeAttribute(Reflect.get(value, "permalink"))}"`;
|
|
517
|
+
if (name === "children" || name === "dangerouslySetInnerHTML" || name === "key" || name === "precedence" || name === "ref" || /^on/i.test(name) || value === null || value === void 0 || typeof value === "function" || typeof value === "symbol") return "";
|
|
518
|
+
if (name === "style") return serializeStyleAttribute(value);
|
|
519
|
+
const normalizedName = serverHtmlAttributeName(name);
|
|
520
|
+
if (name.startsWith("data-") || name.startsWith("aria-")) return ` ${normalizedName}="${escapeAttribute(String(value))}"`;
|
|
521
|
+
if (SERVER_BOOLEAN_ATTRIBUTES.has(name)) return value ? ` ${normalizedName}=""` : "";
|
|
522
|
+
if (typeof value === "boolean") return "";
|
|
523
|
+
if (!VALID_ATTRIBUTE_NAME.test(normalizedName)) return "";
|
|
524
|
+
return ` ${normalizedName}="${escapeAttribute(String(value))}"`;
|
|
586
525
|
}
|
|
587
526
|
function beginFrameworkRenderPass() {
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
framework.stylePrecedence.length = 0;
|
|
596
|
-
framework.sawHead = false;
|
|
527
|
+
const framework = activeFrameworkRender;
|
|
528
|
+
if (framework === void 0) return;
|
|
529
|
+
if (framework.signal.aborted) throw frameworkAbortReason(framework.signal);
|
|
530
|
+
framework.pending.clear();
|
|
531
|
+
framework.head.clear();
|
|
532
|
+
framework.stylePrecedence.length = 0;
|
|
533
|
+
framework.sawHead = false;
|
|
597
534
|
}
|
|
598
535
|
function finalizeFrameworkHtml(html) {
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
const htmlStart = html.indexOf('<html');
|
|
611
|
-
if (htmlStart !== -1) {
|
|
612
|
-
const htmlOpenEnd = html.indexOf('>', htmlStart);
|
|
613
|
-
if (htmlOpenEnd !== -1) {
|
|
614
|
-
return `${html.slice(0, htmlOpenEnd + 1)}<head>${head}</head>${html.slice(htmlOpenEnd + 1)}`;
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
return `<head>${head}</head>${html}`;
|
|
536
|
+
const framework = activeFrameworkRender;
|
|
537
|
+
if (framework === void 0) return html;
|
|
538
|
+
const head = [...framework.head.entries()].toSorted(([, left], [, right]) => compareHeadPrecedence(framework, left, right)).map(([, entry]) => entry.html).join("");
|
|
539
|
+
if (framework.sawHead) return html.replace(FRAMEWORK_HEAD_PLACEHOLDER, head);
|
|
540
|
+
if (head === "") return html;
|
|
541
|
+
const htmlStart = html.indexOf("<html");
|
|
542
|
+
if (htmlStart !== -1) {
|
|
543
|
+
const htmlOpenEnd = html.indexOf(">", htmlStart);
|
|
544
|
+
if (htmlOpenEnd !== -1) return `${html.slice(0, htmlOpenEnd + 1)}<head>${head}</head>${html.slice(htmlOpenEnd + 1)}`;
|
|
545
|
+
}
|
|
546
|
+
return `<head>${head}</head>${html}`;
|
|
618
547
|
}
|
|
619
548
|
function isHoistableHeadElement(type, props) {
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
549
|
+
if (type === "title" || type === "meta") return !hasOwnProp(props, "itemProp");
|
|
550
|
+
if (type === "link") {
|
|
551
|
+
if ([
|
|
552
|
+
"itemProp",
|
|
553
|
+
"onLoad",
|
|
554
|
+
"onError",
|
|
555
|
+
"disabled"
|
|
556
|
+
].some((name) => hasOwnProp(props, name))) return false;
|
|
557
|
+
return props?.rel !== "stylesheet" || typeof props.precedence === "string";
|
|
558
|
+
}
|
|
559
|
+
if (type === "style") return typeof props?.href === "string" && typeof props.precedence === "string";
|
|
560
|
+
return type === "script" && props?.async === true && typeof props.src === "string";
|
|
632
561
|
}
|
|
633
562
|
function hasOwnProp(props, name) {
|
|
634
|
-
|
|
563
|
+
return props !== null && Object.hasOwn(props, name);
|
|
635
564
|
}
|
|
636
565
|
function metadataKey(type, props) {
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
if (type === 'link')
|
|
647
|
-
return `link:${LINK_IDENTITY_PROPS.map((name) => String(props?.[name] ?? '')).join(':')}`;
|
|
648
|
-
if (type === 'style')
|
|
649
|
-
return `style:${String(props?.href ?? '')}`;
|
|
650
|
-
if (type === 'script')
|
|
651
|
-
return `script:${String(props?.src ?? '')}`;
|
|
652
|
-
return `${type}:${JSON.stringify(props)}`;
|
|
566
|
+
if (type === "title") return "title";
|
|
567
|
+
if (type === "meta") for (const name of META_IDENTITY_PROPS) {
|
|
568
|
+
const value = props?.[name];
|
|
569
|
+
if (value !== void 0) return `meta:${name}:${String(value)}`;
|
|
570
|
+
}
|
|
571
|
+
if (type === "link") return `link:${LINK_IDENTITY_PROPS.map((name) => String(props?.[name] ?? "")).join(":")}`;
|
|
572
|
+
if (type === "style") return `style:${String(props?.href ?? "")}`;
|
|
573
|
+
if (type === "script") return `script:${String(props?.src ?? "")}`;
|
|
574
|
+
return `${type}:${JSON.stringify(props)}`;
|
|
653
575
|
}
|
|
654
576
|
function metadataPrecedence(type, props) {
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
if (type === 'script')
|
|
659
|
-
return '3:script';
|
|
660
|
-
return '1:metadata';
|
|
577
|
+
if (type === "style" || type === "link" && props?.rel === "stylesheet") return `2:${String(props?.precedence ?? "default")}`;
|
|
578
|
+
if (type === "script") return "3:script";
|
|
579
|
+
return "1:metadata";
|
|
661
580
|
}
|
|
662
581
|
function registerResourceHint(relation, href, options) {
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
registerHeadEntry(`hint:${relation}:${href}:${as}`, `<link rel="${relation}" href="${escapeAttribute(href)}"${as}${serializeHintOptions(options)}>`, '0:hint');
|
|
582
|
+
if (typeof href !== "string" || href.length === 0) throw new TypeError("resource href must be non-empty");
|
|
583
|
+
const as = "as" in options && typeof options.as === "string" ? ` as="${escapeAttribute(options.as)}"` : "";
|
|
584
|
+
registerHeadEntry(`hint:${relation}:${href}:${as}`, `<link rel="${relation}" href="${escapeAttribute(href)}"${as}${serializeHintOptions(options)}>`, "0:hint");
|
|
667
585
|
}
|
|
668
586
|
function registerHeadEntry(key, html, precedence) {
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
587
|
+
const framework = activeFrameworkRender;
|
|
588
|
+
if (framework === void 0) return;
|
|
589
|
+
if (precedence.startsWith("2:")) {
|
|
590
|
+
const stylePrecedence = precedence.slice(2);
|
|
591
|
+
if (!framework.stylePrecedence.includes(stylePrecedence)) framework.stylePrecedence.push(stylePrecedence);
|
|
592
|
+
}
|
|
593
|
+
framework.head.set(key, {
|
|
594
|
+
html,
|
|
595
|
+
precedence
|
|
596
|
+
});
|
|
679
597
|
}
|
|
680
598
|
function compareHeadPrecedence(framework, left, right) {
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
return 0;
|
|
687
|
-
return (framework.stylePrecedence.indexOf(left.precedence.slice(2)) -
|
|
688
|
-
framework.stylePrecedence.indexOf(right.precedence.slice(2)));
|
|
599
|
+
const leftRank = Number(left.precedence[0]);
|
|
600
|
+
const rightRank = Number(right.precedence[0]);
|
|
601
|
+
if (leftRank !== rightRank) return leftRank - rightRank;
|
|
602
|
+
if (leftRank !== 2) return 0;
|
|
603
|
+
return framework.stylePrecedence.indexOf(left.precedence.slice(2)) - framework.stylePrecedence.indexOf(right.precedence.slice(2));
|
|
689
604
|
}
|
|
690
605
|
function serializeHintOptions(options) {
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
if ('imageSrcSet' in options && options.imageSrcSet !== undefined) {
|
|
702
|
-
attributes.push(` imagesrcset="${escapeAttribute(options.imageSrcSet)}"`);
|
|
703
|
-
}
|
|
704
|
-
if ('integrity' in options && options.integrity !== undefined) {
|
|
705
|
-
attributes.push(` integrity="${escapeAttribute(options.integrity)}"`);
|
|
706
|
-
}
|
|
707
|
-
if ('nonce' in options && options.nonce !== undefined) {
|
|
708
|
-
attributes.push(` nonce="${escapeAttribute(options.nonce)}"`);
|
|
709
|
-
}
|
|
710
|
-
if ('referrerPolicy' in options && options.referrerPolicy !== undefined) {
|
|
711
|
-
attributes.push(` referrerpolicy="${escapeAttribute(options.referrerPolicy)}"`);
|
|
712
|
-
}
|
|
713
|
-
if ('type' in options && options.type !== undefined) {
|
|
714
|
-
attributes.push(` type="${escapeAttribute(options.type)}"`);
|
|
715
|
-
}
|
|
716
|
-
return attributes.join('');
|
|
606
|
+
const attributes = [];
|
|
607
|
+
if (options.crossOrigin !== void 0) attributes.push(` crossorigin="${escapeAttribute(options.crossOrigin)}"`);
|
|
608
|
+
if ("fetchPriority" in options && options.fetchPriority !== void 0) attributes.push(` fetchpriority="${options.fetchPriority}"`);
|
|
609
|
+
if ("imageSizes" in options && options.imageSizes !== void 0) attributes.push(` imagesizes="${escapeAttribute(options.imageSizes)}"`);
|
|
610
|
+
if ("imageSrcSet" in options && options.imageSrcSet !== void 0) attributes.push(` imagesrcset="${escapeAttribute(options.imageSrcSet)}"`);
|
|
611
|
+
if ("integrity" in options && options.integrity !== void 0) attributes.push(` integrity="${escapeAttribute(options.integrity)}"`);
|
|
612
|
+
if ("nonce" in options && options.nonce !== void 0) attributes.push(` nonce="${escapeAttribute(options.nonce)}"`);
|
|
613
|
+
if ("referrerPolicy" in options && options.referrerPolicy !== void 0) attributes.push(` referrerpolicy="${escapeAttribute(options.referrerPolicy)}"`);
|
|
614
|
+
if ("type" in options && options.type !== void 0) attributes.push(` type="${escapeAttribute(options.type)}"`);
|
|
615
|
+
return attributes.join("");
|
|
717
616
|
}
|
|
718
617
|
function frameworkAbortReason(signal) {
|
|
719
|
-
|
|
618
|
+
return signal.reason ?? new DOMException("The operation was aborted", "AbortError");
|
|
720
619
|
}
|
|
721
620
|
function serializeStyleAttribute(value, hiddenByActivity = false) {
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
const cssValue = typeof item === 'number' && item !== 0 && !UNITLESS_STYLE_PROPERTIES.has(name)
|
|
737
|
-
? `${item}px`
|
|
738
|
-
: item;
|
|
739
|
-
return `${cssName}:${String(cssValue)}`;
|
|
740
|
-
});
|
|
741
|
-
if (hiddenByActivity)
|
|
742
|
-
declarations.push('display:none!important');
|
|
743
|
-
return declarations.length === 0 ? '' : ` style="${escapeAttribute(declarations.join(';'))}"`;
|
|
621
|
+
if (typeof value === "string") {
|
|
622
|
+
const separator = value === "" || value.endsWith(";") ? "" : ";";
|
|
623
|
+
const style = hiddenByActivity ? `${value}${separator}display:none!important` : value;
|
|
624
|
+
return style === "" ? "" : ` style="${escapeAttribute(style)}"`;
|
|
625
|
+
}
|
|
626
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return hiddenByActivity ? " style=\"display:none!important\"" : "";
|
|
627
|
+
const declarations = Object.entries(value).toSorted(([left], [right]) => left.localeCompare(right)).flatMap(([name, item]) => {
|
|
628
|
+
if (item === null || item === void 0 || typeof item === "boolean" || item === "") return [];
|
|
629
|
+
const cssName = name.startsWith("--") ? name : camelToKebab(name);
|
|
630
|
+
const cssValue = typeof item === "number" && item !== 0 && !UNITLESS_STYLE_PROPERTIES.has(name) ? `${item}px` : item;
|
|
631
|
+
return `${cssName}:${String(cssValue)}`;
|
|
632
|
+
});
|
|
633
|
+
if (hiddenByActivity) declarations.push("display:none!important");
|
|
634
|
+
return declarations.length === 0 ? "" : ` style="${escapeAttribute(declarations.join(";"))}"`;
|
|
744
635
|
}
|
|
745
636
|
function camelToKebab(name) {
|
|
746
|
-
|
|
747
|
-
.replace(/[A-Z]/g, (character) => `-${character.toLowerCase()}`)
|
|
748
|
-
.replace(/^ms-/, '-ms-');
|
|
637
|
+
return name.replace(/[A-Z]/g, (character) => `-${character.toLowerCase()}`).replace(/^ms-/, "-ms-");
|
|
749
638
|
}
|
|
750
639
|
function readRawHtml(props) {
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
if (typeof value !== 'object' || !('__html' in value)) {
|
|
758
|
-
throw new TypeError('dangerouslySetInnerHTML must be an object with an __html property');
|
|
759
|
-
}
|
|
760
|
-
const html = Reflect.get(value, '__html');
|
|
761
|
-
return html === null || html === undefined ? '' : String(html);
|
|
640
|
+
const value = props?.dangerouslySetInnerHTML;
|
|
641
|
+
if (value === null || value === void 0) return void 0;
|
|
642
|
+
if (!UNSAFE_HTML) throw new Error("dangerouslySetInnerHTML requires the unsafe-html compiler feature");
|
|
643
|
+
if (typeof value !== "object" || !("__html" in value)) throw new TypeError("dangerouslySetInnerHTML must be an object with an __html property");
|
|
644
|
+
const html = Reflect.get(value, "__html");
|
|
645
|
+
return html === null || html === void 0 ? "" : String(html);
|
|
762
646
|
}
|
|
763
647
|
function escapeText(value) {
|
|
764
|
-
|
|
648
|
+
return value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">");
|
|
765
649
|
}
|
|
766
650
|
function escapeAttribute(value) {
|
|
767
|
-
|
|
651
|
+
return escapeText(value).replaceAll("\"", """).replaceAll("'", "'");
|
|
768
652
|
}
|
|
769
|
-
function
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
653
|
+
function serializeElementChildren(type, value, multipleChildren, context) {
|
|
654
|
+
if (!isRawTextElement(type)) return multipleChildren ? serializeChildren(value, context) : serializeSlot(value, context);
|
|
655
|
+
const hydrationMarkers = context.hydrationMarkers;
|
|
656
|
+
context.hydrationMarkers = false;
|
|
657
|
+
try {
|
|
658
|
+
return multipleChildren ? serializeChildren(value, context) : serializeSlot(value, context);
|
|
659
|
+
} finally {
|
|
660
|
+
context.hydrationMarkers = hydrationMarkers;
|
|
661
|
+
}
|
|
773
662
|
}
|
|
774
|
-
function
|
|
775
|
-
|
|
776
|
-
|
|
663
|
+
function serializeChildren(value, context) {
|
|
664
|
+
return Array.isArray(value) ? value.map((child) => serializeSlot(child, context)).join("") : serializeSlot(value, context);
|
|
665
|
+
}
|
|
666
|
+
function serializeSlot(value, context) {
|
|
667
|
+
const content = serializeChild(value, context);
|
|
668
|
+
return context.hydrationMarkers ? hydrationRange("b", content) : content;
|
|
777
669
|
}
|
|
778
670
|
function hydrationRange(kind, content) {
|
|
779
|
-
|
|
671
|
+
return `<!--${HYDRATION_PREFIX}:${kind}-->${content}<!--/${HYDRATION_PREFIX}:${kind}-->`;
|
|
780
672
|
}
|
|
781
673
|
function assertSafeHydrationRawHtml(value) {
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
}
|
|
785
|
-
return value;
|
|
674
|
+
if (/<!--\/?(?:vidact:)?v\d+:[a-z]-->/i.test(value)) throw new Error("raw HTML cannot contain Vidact hydration marker syntax");
|
|
675
|
+
return value;
|
|
786
676
|
}
|
|
787
677
|
function isRawTextElement(type) {
|
|
788
|
-
|
|
678
|
+
return type === "script" || type === "style" || type === "textarea" || type === "title";
|
|
789
679
|
}
|
|
790
680
|
function serverDispatch() {
|
|
791
|
-
|
|
681
|
+
throw new Error("state dispatch is unavailable during server rendering");
|
|
792
682
|
}
|
|
683
|
+
//#endregion
|
|
684
|
+
export { Activity, Fragment, Profiler, Suspense, cache, cacheSignal, captureOwnerStack, cloneRenderable, cloneRenderableComponent, createContext, createElement, createPortal, createRef, createRenderable, createResource, createServerFrameworkRenderContext, createServerHydrationBoundary, dynamicIntrinsicComponent, flushSync, forwardedRef, isRenderable, jsx, jsxDEV, jsxs, keyedFragmentComponent, lazy, preconnect, prefetchDNS, preinit, preinitModule, preload, preloadModule, renderToStaticMarkup, renderToString, renderableChildren, renderableMarker, renderableProps, renderableRef, renderableToArray, startTransition, use, useActionState, useCallback, useContext, useDebugValue, useDeferredValue, useEffect, useEffectEvent, useFormStatus, useId, useImperativeHandle, useInsertionEffect, useLayoutEffect, useMemo, useOptimistic, useReducer, useRef, useState, useSyncExternalStore, useTransition, withServerFrameworkRenderContext };
|
|
685
|
+
|
|
793
686
|
//# sourceMappingURL=server.js.map
|