@solidjs/web 2.0.0-beta.2 → 2.0.0-beta.20
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/README.md +27 -4
- package/dist/dev.cjs +783 -223
- package/dist/dev.js +757 -217
- package/dist/server.cjs +742 -186
- package/dist/server.js +714 -183
- package/dist/web.cjs +772 -196
- package/dist/web.js +746 -190
- package/package.json +193 -38
- package/serialization/dist/serialization.cjs +83 -0
- package/serialization/dist/serialization.js +75 -0
- package/serialization/package.json +20 -0
- package/serialization/types/index.d.ts +139 -0
- package/serialization/types-cjs/index.d.cts +139 -0
- package/serialization/types-cjs/package.json +3 -0
- package/server-functions/dist/client.cjs +370 -0
- package/server-functions/dist/client.js +363 -0
- package/server-functions/dist/server.cjs +542 -0
- package/server-functions/dist/server.js +531 -0
- package/server-functions/package.json +30 -0
- package/storage/package.json +8 -3
- package/storage/types/index.d.ts +26 -0
- package/storage/types-cjs/index.d.cts +28 -0
- package/storage/types-cjs/package.json +3 -0
- package/types/client.d.ts +64 -21
- package/types/core.d.ts +3 -3
- package/types/index.d.ts +156 -24
- package/types/jsx-properties.d.ts +93 -0
- package/types/jsx.d.ts +4135 -1
- package/types/response.d.ts +93 -0
- package/types/serializer.d.ts +139 -0
- package/types/server-functions/client.d.ts +63 -0
- package/types/server-functions/server.d.ts +188 -0
- package/types/server-functions/shared.d.ts +171 -0
- package/types/server-mock.d.ts +89 -0
- package/types/server.d.ts +123 -28
- package/types-cjs/client.d.cts +131 -0
- package/types-cjs/core.d.cts +3 -0
- package/types-cjs/index.d.cts +178 -0
- package/types-cjs/jsx-properties.d.cts +93 -0
- package/types-cjs/jsx.d.cts +4135 -0
- package/types-cjs/package.json +3 -0
- package/types-cjs/response.d.cts +93 -0
- package/types-cjs/serializer.d.cts +139 -0
- package/types-cjs/server-functions/client.d.cts +63 -0
- package/types-cjs/server-functions/server.d.cts +188 -0
- package/types-cjs/server-functions/shared.d.cts +171 -0
- package/types-cjs/server-mock.d.cts +161 -0
- package/types-cjs/server.d.cts +251 -0
- package/storage/types/src/client.d.ts +0 -1
- package/storage/types/src/index.d.ts +0 -46
- package/storage/types/src/server-mock.d.ts +0 -72
- package/storage/types/storage/src/index.d.ts +0 -2
package/dist/dev.js
CHANGED
|
@@ -1,39 +1,80 @@
|
|
|
1
|
-
import { createRenderEffect, createMemo
|
|
2
|
-
export { Errored, For, Hydration, Loading, Match, NoHydration, Show, Switch, createComponent, getOwner,
|
|
3
|
-
import { createMemo } from '@solidjs/signals';
|
|
1
|
+
import { createRenderEffect, createMemo, sharedConfig, untrack, runWithOwner, flatten, createRoot, merge, createComponent, omit, createOwner, $DEVCOMP, enableHydration, enforceLoadingBoundary, flush, getOwner, createEffect } from 'solid-js';
|
|
2
|
+
export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, Show, Switch, createComponent, getOwner, untrack } from 'solid-js';
|
|
4
3
|
|
|
5
|
-
const
|
|
6
|
-
|
|
4
|
+
const DOMWithState = {
|
|
5
|
+
INPUT: {
|
|
6
|
+
value: 1,
|
|
7
|
+
defaultValue: 2,
|
|
8
|
+
checked: 1,
|
|
9
|
+
defaultChecked: 2
|
|
10
|
+
},
|
|
11
|
+
SELECT: {
|
|
12
|
+
value: 1
|
|
13
|
+
},
|
|
14
|
+
OPTION: {
|
|
15
|
+
value: 1,
|
|
16
|
+
selected: 1,
|
|
17
|
+
defaultSelected: 2
|
|
18
|
+
},
|
|
19
|
+
TEXTAREA: {
|
|
20
|
+
value: 1,
|
|
21
|
+
defaultValue: 2
|
|
22
|
+
},
|
|
23
|
+
VIDEO: {
|
|
24
|
+
muted: 1,
|
|
25
|
+
defaultMuted: 2
|
|
26
|
+
},
|
|
27
|
+
AUDIO: {
|
|
28
|
+
muted: 1,
|
|
29
|
+
defaultMuted: 2
|
|
30
|
+
}
|
|
31
|
+
};
|
|
7
32
|
const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
|
|
33
|
+
const $$SLOT = /*#__PURE__*/Symbol("slot");
|
|
34
|
+
const $$HOST = /*#__PURE__*/Symbol("host");
|
|
8
35
|
const DelegatedEvents = /*#__PURE__*/new Set(["beforeinput", "click", "dblclick", "contextmenu", "focusin", "focusout", "input", "keydown", "keyup", "mousedown", "mousemove", "mouseout", "mouseover", "mouseup", "pointerdown", "pointermove", "pointerout", "pointerover", "pointerup", "touchend", "touchmove", "touchstart"]);
|
|
9
36
|
const SVGElements = /*#__PURE__*/new Set([
|
|
10
37
|
"altGlyph", "altGlyphDef", "altGlyphItem", "animate", "animateColor", "animateMotion", "animateTransform", "circle", "clipPath", "color-profile", "cursor", "defs", "desc", "ellipse", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence", "filter", "font", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignObject", "g", "glyph", "glyphRef", "hkern", "image", "line", "linearGradient", "marker", "mask", "metadata", "missing-glyph", "mpath", "path", "pattern", "polygon", "polyline", "radialGradient", "rect",
|
|
11
38
|
"set", "stop",
|
|
12
39
|
"svg", "switch", "symbol", "text", "textPath",
|
|
13
40
|
"tref", "tspan", "use", "view", "vkern"]);
|
|
14
|
-
const
|
|
41
|
+
const MathMLElements = /*#__PURE__*/new Set(["annotation", "annotation-xml", "maction", "math", "menclose", "merror", "mfenced", "mfrac", "mi", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mprescripts", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msubsup", "msup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "semantics"]);
|
|
42
|
+
const Namespaces = {
|
|
43
|
+
svg: "http://www.w3.org/2000/svg",
|
|
44
|
+
mathml: "http://www.w3.org/1998/Math/MathML",
|
|
15
45
|
xlink: "http://www.w3.org/1999/xlink",
|
|
16
46
|
xml: "http://www.w3.org/XML/1998/namespace"
|
|
17
47
|
};
|
|
18
|
-
const
|
|
19
|
-
"
|
|
20
|
-
"isindex
|
|
48
|
+
const VoidElements = /*#__PURE__*/new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr"]);
|
|
49
|
+
const RawTextElements = /*#__PURE__*/new Set(["style", "script", "noscript", "template", "textarea", "title"]);
|
|
50
|
+
const DOMElements = /*#__PURE__*/new Set(/*#__PURE__*/"a,abbr,acronym,address,applet,area,article,aside,audio,b,base,basefont,bdi,bdo,bgsound,big,blink,blockquote,body,br,button,canvas,caption,center,cite,code,col,colgroup,content,data,datalist,dd,del,details,dfn,dialog,dir,div,dl,dt,em,embed,fieldset,figcaption,figure,font,footer,form,frame,frameset,h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,i,iframe,image,img,input,ins,isindex,kbd,keygen,label,legend,li,link,listing,main,map,mark,marquee,math,menu,menuitem,meta,meter,multicol,nav,nextid,nobr,noembed,noframes,noindex,noscript,object,ol,optgroup,option,output,p,param,picture,plaintext,portal,pre,progress,q,rb,rp,rt,rtc,ruby,s,samp,script,search,section,select,shadow,slot,small,source,spacer,span,strike,strong,style,sub,summary,sup,svg,table,tbody,td,template,textarea,tfoot,th,thead,time,title,tr,track,tt,u,ul,var,video,wbr,webview,xmp".split(","));
|
|
21
51
|
|
|
22
|
-
const
|
|
23
|
-
transparent: true
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
52
|
+
const transparentOptions = {
|
|
53
|
+
transparent: true,
|
|
54
|
+
sync: true
|
|
55
|
+
};
|
|
56
|
+
const syncOptions = {
|
|
57
|
+
sync: true
|
|
58
|
+
};
|
|
59
|
+
const effect = (fn, effectFn, options) => createRenderEffect(fn, effectFn, options ? {
|
|
60
|
+
sync: true,
|
|
61
|
+
...options,
|
|
62
|
+
transparent: !options.scope
|
|
63
|
+
} : transparentOptions);
|
|
64
|
+
const memo = fn => createMemo(() => fn(), syncOptions);
|
|
28
65
|
|
|
29
|
-
function reconcileArrays(parentNode, a, b) {
|
|
66
|
+
function reconcileArrays(parentNode, a, b, marker) {
|
|
30
67
|
let bLength = b.length,
|
|
31
68
|
aEnd = a.length,
|
|
32
69
|
bEnd = bLength,
|
|
33
70
|
aStart = 0,
|
|
34
71
|
bStart = 0,
|
|
35
|
-
|
|
36
|
-
|
|
72
|
+
tail = a[aEnd - 1],
|
|
73
|
+
tailTag = tail[$$SLOT],
|
|
74
|
+
after = tail.parentNode === parentNode && (!tailTag || tailTag === marker) ? tail.nextSibling : marker || null,
|
|
75
|
+
map = null,
|
|
76
|
+
anchor,
|
|
77
|
+
anchorTag;
|
|
37
78
|
while (aStart < aEnd || bStart < bEnd) {
|
|
38
79
|
if (a[aStart] === b[bStart]) {
|
|
39
80
|
aStart++;
|
|
@@ -45,18 +86,43 @@ function reconcileArrays(parentNode, a, b) {
|
|
|
45
86
|
bEnd--;
|
|
46
87
|
}
|
|
47
88
|
if (aEnd === aStart) {
|
|
48
|
-
|
|
49
|
-
|
|
89
|
+
let node;
|
|
90
|
+
if (bEnd < bLength) {
|
|
91
|
+
if (bStart) {
|
|
92
|
+
const prev = b[bStart - 1];
|
|
93
|
+
const prevTag = prev[$$SLOT];
|
|
94
|
+
node = prev.parentNode === parentNode && (!prevTag || prevTag === marker) ? prev.nextSibling : after;
|
|
95
|
+
} else node = b[bEnd - bStart];
|
|
96
|
+
} else node = after;
|
|
97
|
+
while (bStart < bEnd) {
|
|
98
|
+
const n = b[bStart++];
|
|
99
|
+
parentNode.insertBefore(n, node);
|
|
100
|
+
if (marker) n[$$SLOT] = marker;
|
|
101
|
+
}
|
|
50
102
|
} else if (bEnd === bStart) {
|
|
51
103
|
while (aStart < aEnd) {
|
|
52
|
-
|
|
53
|
-
|
|
104
|
+
const n = a[aStart++];
|
|
105
|
+
if (!map || !map.has(n)) {
|
|
106
|
+
const tag = n[$$SLOT];
|
|
107
|
+
if (n.parentNode === parentNode && (!tag || tag === marker)) n.remove();
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
} else if ((anchor = a[aStart]) === b[bEnd - 1] && b[bStart] === a[aEnd - 1] && anchor.parentNode === parentNode && (!(anchorTag = anchor[$$SLOT]) || anchorTag === marker)) {
|
|
111
|
+
if (marker) {
|
|
112
|
+
do {
|
|
113
|
+
const n = a[--aEnd];
|
|
114
|
+
parentNode.insertBefore(n, anchor);
|
|
115
|
+
n[$$SLOT] = marker;
|
|
116
|
+
bStart++;
|
|
117
|
+
if (aStart >= aEnd - 1 || bStart >= bEnd) break;
|
|
118
|
+
} while (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]);
|
|
119
|
+
} else {
|
|
120
|
+
do {
|
|
121
|
+
parentNode.insertBefore(a[--aEnd], anchor);
|
|
122
|
+
bStart++;
|
|
123
|
+
if (aStart >= aEnd - 1 || bStart >= bEnd) break;
|
|
124
|
+
} while (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]);
|
|
54
125
|
}
|
|
55
|
-
} else if (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]) {
|
|
56
|
-
const node = a[--aEnd].nextSibling;
|
|
57
|
-
parentNode.insertBefore(b[bStart++], a[aStart++].nextSibling);
|
|
58
|
-
parentNode.insertBefore(b[--bEnd], node);
|
|
59
|
-
a[aEnd] = b[bEnd];
|
|
60
126
|
} else {
|
|
61
127
|
if (!map) {
|
|
62
128
|
map = new Map();
|
|
@@ -74,58 +140,141 @@ function reconcileArrays(parentNode, a, b) {
|
|
|
74
140
|
sequence++;
|
|
75
141
|
}
|
|
76
142
|
if (sequence > index - bStart) {
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
143
|
+
const head = a[aStart];
|
|
144
|
+
const headTag = head[$$SLOT];
|
|
145
|
+
const node = head.parentNode === parentNode && (!headTag || headTag === marker) ? head : after;
|
|
146
|
+
while (bStart < index) {
|
|
147
|
+
const n = b[bStart++];
|
|
148
|
+
parentNode.insertBefore(n, node);
|
|
149
|
+
if (marker) n[$$SLOT] = marker;
|
|
150
|
+
}
|
|
151
|
+
} else {
|
|
152
|
+
const oldNode = a[aStart++];
|
|
153
|
+
const newNode = b[bStart++];
|
|
154
|
+
const oldTag = oldNode[$$SLOT];
|
|
155
|
+
if (oldNode.parentNode === parentNode && (!oldTag || oldTag === marker)) {
|
|
156
|
+
parentNode.replaceChild(newNode, oldNode);
|
|
157
|
+
} else {
|
|
158
|
+
parentNode.insertBefore(newNode, after);
|
|
159
|
+
}
|
|
160
|
+
if (marker) newNode[$$SLOT] = marker;
|
|
161
|
+
}
|
|
80
162
|
} else aStart++;
|
|
81
|
-
} else
|
|
163
|
+
} else {
|
|
164
|
+
const n = a[aStart++];
|
|
165
|
+
const nTag = n[$$SLOT];
|
|
166
|
+
if (n.parentNode === parentNode && (!nTag || nTag === marker)) n.remove();
|
|
167
|
+
}
|
|
82
168
|
}
|
|
83
169
|
}
|
|
84
170
|
}
|
|
85
171
|
|
|
86
|
-
const $$
|
|
172
|
+
const $$EVENT_OWNER = "_$DX_EVENT_OWNER";
|
|
173
|
+
const INNER_OWNED = {};
|
|
174
|
+
const delegatedEvents = new Set();
|
|
175
|
+
const delegatedContainers = new Map();
|
|
87
176
|
function render$1(code, element, init, options = {}) {
|
|
88
177
|
if (!element) {
|
|
89
178
|
throw new Error("The `element` passed to `render(..., element)` doesn't exist. Make sure `element` exists in the document.");
|
|
90
179
|
}
|
|
91
180
|
let disposer;
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
181
|
+
registerDelegatedRoot(element);
|
|
182
|
+
try {
|
|
183
|
+
createRoot(dispose => {
|
|
184
|
+
disposer = dispose;
|
|
185
|
+
if (element === document) {
|
|
186
|
+
const tree = code();
|
|
187
|
+
effect(() => flatten(tree), () => {});
|
|
188
|
+
} else {
|
|
189
|
+
const tree = code();
|
|
190
|
+
insert(element, () => tree, element.firstChild ? null : undefined, init, options.insertOptions);
|
|
191
|
+
}
|
|
192
|
+
}, {
|
|
193
|
+
id: options.renderId
|
|
194
|
+
});
|
|
195
|
+
} catch (err) {
|
|
196
|
+
if (disposer) disposer();
|
|
197
|
+
unregisterDelegatedRoot(element);
|
|
198
|
+
throw err;
|
|
199
|
+
}
|
|
98
200
|
return () => {
|
|
99
201
|
disposer();
|
|
202
|
+
unregisterDelegatedRoot(element);
|
|
100
203
|
element.textContent = "";
|
|
101
204
|
};
|
|
102
205
|
}
|
|
103
|
-
function
|
|
206
|
+
function create(html, bypassGuard, flag) {
|
|
207
|
+
if (isHydrating() && !bypassGuard) throw new Error("Failed attempt to create new DOM elements during hydration. Check that the libraries you are using support hydration.");
|
|
208
|
+
const t = document.createElement("template");
|
|
209
|
+
t.innerHTML = html;
|
|
210
|
+
return flag === 2 ? t.content.firstChild.firstChild : t.content.firstChild;
|
|
211
|
+
}
|
|
212
|
+
function template(html, flag) {
|
|
104
213
|
let node;
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
const t = isMathML ? document.createElementNS("http://www.w3.org/1998/Math/MathML", "template") : document.createElement("template");
|
|
108
|
-
t.innerHTML = html;
|
|
109
|
-
return isSVG ? t.content.firstChild.firstChild : isMathML ? t.firstChild : t.content.firstChild;
|
|
110
|
-
};
|
|
111
|
-
const fn = isImportNode ? bypassGuard => untrack(() => document.importNode(node || (node = create(bypassGuard)), true)) : bypassGuard => (node || (node = create(bypassGuard))).cloneNode(true);
|
|
112
|
-
fn._html = html;
|
|
214
|
+
const fn = flag === 1 ? bypassGuard => document.importNode(node || (node = create(html, bypassGuard, flag)), true) : bypassGuard => (node || (node = create(html, bypassGuard, flag))).cloneNode(true);
|
|
215
|
+
fn._html = flag === 2 ? html.replace(/^<[^>]+>/, "") : html;
|
|
113
216
|
return fn;
|
|
114
217
|
}
|
|
115
|
-
function delegateEvents(eventNames
|
|
116
|
-
const e = document[$$EVENTS] || (document[$$EVENTS] = new Set());
|
|
218
|
+
function delegateEvents(eventNames) {
|
|
117
219
|
for (let i = 0, l = eventNames.length; i < l; i++) {
|
|
118
220
|
const name = eventNames[i];
|
|
119
|
-
if (!
|
|
120
|
-
|
|
121
|
-
|
|
221
|
+
if (!delegatedEvents.has(name)) {
|
|
222
|
+
delegatedEvents.add(name);
|
|
223
|
+
delegatedContainers.forEach((state, container) => attachDelegatedEvent(name, container, state));
|
|
122
224
|
}
|
|
123
225
|
}
|
|
124
226
|
}
|
|
125
|
-
function
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
227
|
+
function registerDelegatedRoot(root) {
|
|
228
|
+
const state = registerDelegatedContainer(root, root);
|
|
229
|
+
if (state) state.roots = (state.roots || 0) + 1;
|
|
230
|
+
}
|
|
231
|
+
function unregisterDelegatedRoot(root) {
|
|
232
|
+
const state = delegatedContainers.get(root);
|
|
233
|
+
if (state) state.roots > 1 ? state.roots-- : delete state.roots;
|
|
234
|
+
unregisterDelegatedContainer(root, root);
|
|
235
|
+
}
|
|
236
|
+
function registerDelegatedContainer(container, owner = container) {
|
|
237
|
+
if (!container || !owner) return;
|
|
238
|
+
let state = delegatedContainers.get(container);
|
|
239
|
+
if (!state) delegatedContainers.set(container, state = {
|
|
240
|
+
owners: new Map(),
|
|
241
|
+
handlers: new Map()
|
|
242
|
+
});
|
|
243
|
+
state.owners.set(owner, (state.owners.get(owner) || 0) + 1);
|
|
244
|
+
delegatedEvents.forEach(name => attachDelegatedEvent(name, container, state));
|
|
245
|
+
return state;
|
|
246
|
+
}
|
|
247
|
+
function unregisterDelegatedContainer(container, owner = container) {
|
|
248
|
+
const state = delegatedContainers.get(container);
|
|
249
|
+
if (!state) return;
|
|
250
|
+
const count = state.owners.get(owner);
|
|
251
|
+
if (count > 1) state.owners.set(owner, count - 1);else state.owners.delete(owner);
|
|
252
|
+
if (state.owners.size) return;
|
|
253
|
+
state.handlers.forEach((handler, name) => container.removeEventListener(name, handler));
|
|
254
|
+
delegatedContainers.delete(container);
|
|
255
|
+
}
|
|
256
|
+
function attachDelegatedEvent(name, container, state) {
|
|
257
|
+
if (state.handlers.has(name)) return;
|
|
258
|
+
const handler = e => eventHandler(e, container, state);
|
|
259
|
+
state.handlers.set(name, handler);
|
|
260
|
+
container.addEventListener(name, handler);
|
|
261
|
+
}
|
|
262
|
+
function getDelegatedRoot(node) {
|
|
263
|
+
while (node) {
|
|
264
|
+
if (delegatedContainers.get(node)?.roots) return node;
|
|
265
|
+
node = node._$host || node.parentNode || node.host;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
function findOwner(target, state) {
|
|
269
|
+
let node = target;
|
|
270
|
+
let distance = 0;
|
|
271
|
+
while (node) {
|
|
272
|
+
if (state.owners.has(node)) return {
|
|
273
|
+
owner: node,
|
|
274
|
+
distance
|
|
275
|
+
};
|
|
276
|
+
distance++;
|
|
277
|
+
node = node._$host || node.parentNode || node.host;
|
|
129
278
|
}
|
|
130
279
|
}
|
|
131
280
|
function setProperty(node, name, value) {
|
|
@@ -138,16 +287,16 @@ function setAttribute(node, name, value) {
|
|
|
138
287
|
}
|
|
139
288
|
function setAttributeNS(node, namespace, name, value) {
|
|
140
289
|
if (isHydrating(node)) return;
|
|
141
|
-
if (value == null) node.removeAttributeNS(namespace, name);else node.setAttributeNS(namespace, name, value);
|
|
290
|
+
if (value == null || value === false) node.removeAttributeNS(namespace, name.indexOf(":") > -1 ? name.split(":").pop() : name);else node.setAttributeNS(namespace, name, value === true ? "" : value);
|
|
142
291
|
}
|
|
143
|
-
function className(node, value,
|
|
292
|
+
function className(node, value, prev) {
|
|
144
293
|
if (isHydrating(node)) return;
|
|
145
294
|
if (value == null || value === false) {
|
|
146
295
|
prev && node.removeAttribute("class");
|
|
147
296
|
return;
|
|
148
297
|
}
|
|
149
298
|
if (typeof value === "string") {
|
|
150
|
-
value !== prev &&
|
|
299
|
+
value !== prev && node.setAttribute("class", value);
|
|
151
300
|
return;
|
|
152
301
|
}
|
|
153
302
|
if (typeof prev === "string") {
|
|
@@ -161,16 +310,16 @@ function className(node, value, isSVG, prev) {
|
|
|
161
310
|
for (i = 0, len = prevKeys.length; i < len; i++) {
|
|
162
311
|
const key = prevKeys[i];
|
|
163
312
|
if (!key || key === "undefined" || value[key]) continue;
|
|
164
|
-
|
|
313
|
+
node.classList.remove(key);
|
|
165
314
|
}
|
|
166
315
|
for (i = 0, len = classKeys.length; i < len; i++) {
|
|
167
316
|
const key = classKeys[i],
|
|
168
317
|
classValue = !!value[key];
|
|
169
318
|
if (!key || key === "undefined" || prev[key] === classValue || !classValue) continue;
|
|
170
|
-
|
|
319
|
+
node.classList.add(key);
|
|
171
320
|
}
|
|
172
321
|
}
|
|
173
|
-
function
|
|
322
|
+
function addEvent(node, name, handler, delegate) {
|
|
174
323
|
if (delegate) {
|
|
175
324
|
if (Array.isArray(handler)) {
|
|
176
325
|
node[`$$${name}`] = handler[0];
|
|
@@ -183,33 +332,48 @@ function addEventListener(node, name, handler, delegate) {
|
|
|
183
332
|
}
|
|
184
333
|
function style(node, value, prev) {
|
|
185
334
|
if (!value) {
|
|
186
|
-
if (prev
|
|
335
|
+
if (prev || node._$styles) {
|
|
336
|
+
setAttribute(node, "style");
|
|
337
|
+
node._$styles = undefined;
|
|
338
|
+
}
|
|
187
339
|
return;
|
|
188
340
|
}
|
|
189
341
|
const nodeStyle = node.style;
|
|
190
|
-
if (typeof value === "string")
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
342
|
+
if (typeof value === "string") {
|
|
343
|
+
node._$styles = undefined;
|
|
344
|
+
return nodeStyle.cssText = value;
|
|
345
|
+
}
|
|
346
|
+
if (typeof prev === "string") {
|
|
347
|
+
nodeStyle.cssText = "";
|
|
348
|
+
prev = undefined;
|
|
349
|
+
}
|
|
350
|
+
let applied = node._$styles;
|
|
351
|
+
if (!applied) {
|
|
352
|
+
applied = node._$styles = prev ? {
|
|
353
|
+
...prev
|
|
354
|
+
} : {};
|
|
355
|
+
}
|
|
194
356
|
let v, s;
|
|
357
|
+
for (s in applied) {
|
|
358
|
+
if (value[s] == null) {
|
|
359
|
+
nodeStyle.removeProperty(s);
|
|
360
|
+
delete applied[s];
|
|
361
|
+
}
|
|
362
|
+
}
|
|
195
363
|
for (s in value) {
|
|
196
364
|
v = value[s];
|
|
197
|
-
if (v !==
|
|
198
|
-
|
|
365
|
+
if (v != null && v !== applied[s]) {
|
|
366
|
+
nodeStyle.setProperty(s, v);
|
|
367
|
+
applied[s] = v;
|
|
368
|
+
}
|
|
199
369
|
}
|
|
200
|
-
for (s in prev) value[s] == null && nodeStyle.removeProperty(s);
|
|
201
370
|
}
|
|
202
371
|
function setStyleProperty(node, name, value) {
|
|
203
372
|
value != null ? node.style.setProperty(name, value) : node.style.removeProperty(name);
|
|
204
373
|
}
|
|
205
|
-
function spread(node, props = {},
|
|
374
|
+
function spread(node, props = {}, skipChildren) {
|
|
206
375
|
const prevProps = {};
|
|
207
|
-
if (!skipChildren)
|
|
208
|
-
effect(() => normalize(props.children, prevProps.children), value => {
|
|
209
|
-
insertExpression(node, value, prevProps.children);
|
|
210
|
-
prevProps.children = value;
|
|
211
|
-
});
|
|
212
|
-
}
|
|
376
|
+
if (!skipChildren) insert(node, () => props.children);
|
|
213
377
|
effect(() => {
|
|
214
378
|
const r = props.ref;
|
|
215
379
|
(typeof r === "function" || Array.isArray(r)) && ref(() => r, node);
|
|
@@ -221,7 +385,7 @@ function spread(node, props = {}, isSVG, skipChildren) {
|
|
|
221
385
|
newProps[prop] = props[prop];
|
|
222
386
|
}
|
|
223
387
|
return newProps;
|
|
224
|
-
}, props => assign(node, props,
|
|
388
|
+
}, props => assign(node, props, true, prevProps, true));
|
|
225
389
|
return prevProps;
|
|
226
390
|
}
|
|
227
391
|
function dynamicProperty(props, key) {
|
|
@@ -241,49 +405,235 @@ function ref(fn, element) {
|
|
|
241
405
|
const resolved = untrack(fn);
|
|
242
406
|
runWithOwner(null, () => applyRef(resolved, element));
|
|
243
407
|
}
|
|
244
|
-
function
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
408
|
+
function scope(fn) {
|
|
409
|
+
fn.$s = true;
|
|
410
|
+
return fn;
|
|
411
|
+
}
|
|
412
|
+
const SCOPE_OPTIONS = {
|
|
413
|
+
scope: true
|
|
414
|
+
};
|
|
415
|
+
let hydrationRt = null;
|
|
416
|
+
function installHydrationRuntime() {
|
|
417
|
+
hydrationRt = {
|
|
418
|
+
claimInitial(parent, multi, initial) {
|
|
419
|
+
if (isHydrating(parent)) {
|
|
420
|
+
if (!multi && initial === undefined && parent) initial = [...parent.childNodes];
|
|
421
|
+
if (Array.isArray(initial)) stripTextSeparators(initial);
|
|
253
422
|
}
|
|
254
|
-
initial
|
|
423
|
+
return initial;
|
|
424
|
+
},
|
|
425
|
+
reclaimRegion(current, parent, marker) {
|
|
426
|
+
if (!sharedConfig.hydrating || !current || !parent.isConnected) return current;
|
|
427
|
+
const first = Array.isArray(current) ? current[0] : current;
|
|
428
|
+
if (!first || !first.nodeType || first.isConnected) return current;
|
|
429
|
+
let nodes;
|
|
430
|
+
if (marker) {
|
|
431
|
+
nodes = [];
|
|
432
|
+
let node = marker.previousSibling,
|
|
433
|
+
depth = 0;
|
|
434
|
+
while (node) {
|
|
435
|
+
if (node.nodeType === 8) {
|
|
436
|
+
const v = node.nodeValue;
|
|
437
|
+
if (v === "/") depth++;else if (v === "$") {
|
|
438
|
+
if (depth === 0) break;
|
|
439
|
+
depth--;
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
nodes.unshift(node);
|
|
443
|
+
node = node.previousSibling;
|
|
444
|
+
}
|
|
445
|
+
} else nodes = [...parent.childNodes];
|
|
446
|
+
return stripTextSeparators(nodes);
|
|
447
|
+
},
|
|
448
|
+
dedupEvent(e) {
|
|
449
|
+
return !!(sharedConfig.registry && sharedConfig.events && sharedConfig.events.find(([el, ev]) => ev === e));
|
|
255
450
|
}
|
|
451
|
+
};
|
|
452
|
+
}
|
|
453
|
+
function stripTextSeparators(nodes) {
|
|
454
|
+
let j = 0;
|
|
455
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
456
|
+
if (nodes[i].nodeType === 8 && nodes[i].nodeValue === "!$") nodes[i].remove();else nodes[j++] = nodes[i];
|
|
256
457
|
}
|
|
458
|
+
nodes.length = j;
|
|
459
|
+
return nodes;
|
|
460
|
+
}
|
|
461
|
+
function insert(parent, accessor, marker, initial, options) {
|
|
462
|
+
const multi = marker !== undefined;
|
|
463
|
+
const host = options && options.host;
|
|
464
|
+
if (multi && !initial) initial = [];
|
|
465
|
+
if (hydrationRt !== null) initial = hydrationRt.claimInitial(parent, multi, initial);
|
|
257
466
|
if (typeof accessor !== "function") {
|
|
258
467
|
accessor = normalize(accessor, initial, multi, true);
|
|
259
|
-
if (typeof accessor !== "function")
|
|
468
|
+
if (typeof accessor !== "function") {
|
|
469
|
+
insertExpression(parent, accessor, initial, marker);
|
|
470
|
+
host && tagHost(accessor, host);
|
|
471
|
+
return;
|
|
472
|
+
}
|
|
260
473
|
}
|
|
261
|
-
|
|
262
|
-
if (multi && initial.length === 0 && !isHydrating(parent)) {
|
|
474
|
+
if (multi && initial.length === 0) {
|
|
263
475
|
const placeholder = document.createTextNode("");
|
|
264
476
|
parent.insertBefore(placeholder, marker);
|
|
265
477
|
initial = [placeholder];
|
|
266
478
|
}
|
|
267
|
-
|
|
479
|
+
let current = initial;
|
|
480
|
+
effect(prev => {
|
|
481
|
+
if (hydrationRt !== null) current = hydrationRt.reclaimRegion(current, parent, marker);
|
|
482
|
+
const value = normalize(accessor(), current, multi, true);
|
|
483
|
+
if (typeof value !== "function") return value;
|
|
484
|
+
effect(() => (hydrationRt !== null && (current = hydrationRt.reclaimRegion(current, parent, marker)), normalize(value, current, multi)), inner => {
|
|
485
|
+
insertExpression(parent, inner, current, marker);
|
|
486
|
+
current = inner;
|
|
487
|
+
host && tagHost(current, host);
|
|
488
|
+
}, prev !== undefined && !(options && options.schedule) ? {
|
|
489
|
+
...options,
|
|
490
|
+
schedule: true
|
|
491
|
+
} : options);
|
|
492
|
+
return INNER_OWNED;
|
|
493
|
+
}, value => {
|
|
494
|
+
if (value === INNER_OWNED) return;
|
|
495
|
+
insertExpression(parent, value, current, marker);
|
|
496
|
+
current = value;
|
|
497
|
+
host && tagHost(current, host);
|
|
498
|
+
},
|
|
499
|
+
accessor.$s ? options ? {
|
|
500
|
+
...options,
|
|
501
|
+
scope: true
|
|
502
|
+
} : SCOPE_OPTIONS : options);
|
|
268
503
|
}
|
|
269
|
-
function assign(node, props,
|
|
504
|
+
function assign(node, props, skipChildren, prevProps = {}, skipRef = false) {
|
|
505
|
+
const nodeName = node.nodeName;
|
|
270
506
|
props || (props = {});
|
|
271
507
|
for (const prop in prevProps) {
|
|
272
508
|
if (!(prop in props)) {
|
|
273
509
|
if (prop === "children") continue;
|
|
274
|
-
prevProps[prop] = assignProp(node, prop, null, prevProps[prop],
|
|
510
|
+
prevProps[prop] = assignProp(node, prop, null, prevProps[prop], skipRef, nodeName);
|
|
275
511
|
}
|
|
276
512
|
}
|
|
277
513
|
for (const prop in props) {
|
|
278
514
|
if (prop === "children") {
|
|
279
|
-
if (!skipChildren) insertExpression(node, props.children);
|
|
515
|
+
if (!skipChildren) insertExpression(node, normalize(props.children, undefined, false));
|
|
280
516
|
continue;
|
|
281
517
|
}
|
|
282
|
-
|
|
283
|
-
|
|
518
|
+
prevProps[prop] = assignProp(node, prop, props[prop], prevProps[prop], skipRef, nodeName);
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
const ASSET_REMOVAL_GRACE = 100;
|
|
522
|
+
const assetRegistry = new Map();
|
|
523
|
+
function assetEntryKey(descriptor) {
|
|
524
|
+
if (descriptor.policy === "exclusive") return "x|" + descriptor.key;
|
|
525
|
+
return descriptor.type === "inline-style" ? "i|" + descriptor.id : descriptor.type + "|" + descriptor.href;
|
|
526
|
+
}
|
|
527
|
+
function findAssetElement(selector, attr, value) {
|
|
528
|
+
const nodes = document.querySelectorAll(selector);
|
|
529
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
530
|
+
if (nodes[i].getAttribute(attr) === value) return nodes[i];
|
|
531
|
+
}
|
|
532
|
+
return null;
|
|
533
|
+
}
|
|
534
|
+
function mountAssetElement(descriptor) {
|
|
535
|
+
let el;
|
|
536
|
+
if (descriptor.type === "inline-style") {
|
|
537
|
+
el = findAssetElement("style[data-asset]", "data-asset", descriptor.id);
|
|
538
|
+
if (!el) {
|
|
539
|
+
el = document.createElement("style");
|
|
540
|
+
el.setAttribute("data-asset", descriptor.id);
|
|
541
|
+
el.textContent = descriptor.content || "";
|
|
542
|
+
}
|
|
543
|
+
} else {
|
|
544
|
+
const rel = descriptor.type === "module" ? "modulepreload" : "stylesheet";
|
|
545
|
+
el = findAssetElement(`link[rel="${rel}"]`, "href", descriptor.href);
|
|
546
|
+
if (!el) {
|
|
547
|
+
el = document.createElement("link");
|
|
548
|
+
el.rel = rel;
|
|
549
|
+
el.href = descriptor.href;
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
if (descriptor.attrs) {
|
|
553
|
+
for (const name in descriptor.attrs) el.setAttribute(name, descriptor.attrs[name]);
|
|
554
|
+
}
|
|
555
|
+
if (!el.isConnected) document.head.appendChild(el);
|
|
556
|
+
return el;
|
|
557
|
+
}
|
|
558
|
+
function acquireAsset(descriptor) {
|
|
559
|
+
const key = assetEntryKey(descriptor);
|
|
560
|
+
let entry = assetRegistry.get(key);
|
|
561
|
+
if (descriptor.policy === "exclusive") {
|
|
562
|
+
if (!entry) {
|
|
563
|
+
entry = {
|
|
564
|
+
original: descriptor.get(),
|
|
565
|
+
set: descriptor.set,
|
|
566
|
+
writers: []
|
|
567
|
+
};
|
|
568
|
+
assetRegistry.set(key, entry);
|
|
569
|
+
}
|
|
570
|
+
const writer = {
|
|
571
|
+
value: descriptor.value
|
|
572
|
+
};
|
|
573
|
+
entry.writers.push(writer);
|
|
574
|
+
entry.set(writer.value);
|
|
575
|
+
let released = false;
|
|
576
|
+
return () => {
|
|
577
|
+
if (released) return;
|
|
578
|
+
released = true;
|
|
579
|
+
const index = entry.writers.indexOf(writer);
|
|
580
|
+
const wasTop = index === entry.writers.length - 1;
|
|
581
|
+
entry.writers.splice(index, 1);
|
|
582
|
+
if (!wasTop) return;
|
|
583
|
+
if (entry.writers.length) {
|
|
584
|
+
entry.set(entry.writers[entry.writers.length - 1].value);
|
|
585
|
+
} else {
|
|
586
|
+
entry.set(entry.original);
|
|
587
|
+
assetRegistry.delete(key);
|
|
588
|
+
}
|
|
589
|
+
};
|
|
590
|
+
}
|
|
591
|
+
if (!entry) {
|
|
592
|
+
entry = {
|
|
593
|
+
count: 0,
|
|
594
|
+
element: null,
|
|
595
|
+
timer: null
|
|
596
|
+
};
|
|
597
|
+
assetRegistry.set(key, entry);
|
|
598
|
+
}
|
|
599
|
+
if (entry.timer) {
|
|
600
|
+
clearTimeout(entry.timer);
|
|
601
|
+
entry.timer = null;
|
|
602
|
+
}
|
|
603
|
+
entry.count++;
|
|
604
|
+
if (!entry.element || !entry.element.isConnected) entry.element = mountAssetElement(descriptor);
|
|
605
|
+
let released = false;
|
|
606
|
+
return () => {
|
|
607
|
+
if (released) return;
|
|
608
|
+
released = true;
|
|
609
|
+
if (--entry.count > 0) return;
|
|
610
|
+
entry.timer = setTimeout(() => {
|
|
611
|
+
assetRegistry.delete(key);
|
|
612
|
+
entry.element && entry.element.remove();
|
|
613
|
+
}, ASSET_REMOVAL_GRACE);
|
|
614
|
+
};
|
|
615
|
+
}
|
|
616
|
+
function loadModuleAssets(mapping) {
|
|
617
|
+
const hy = globalThis._$HY;
|
|
618
|
+
if (!hy) return;
|
|
619
|
+
const pending = [];
|
|
620
|
+
for (const key in mapping) {
|
|
621
|
+
if (hy.modules[key]) continue;
|
|
622
|
+
const entryUrl = mapping[key];
|
|
623
|
+
if (!hy.loading[key]) {
|
|
624
|
+
hy.loading[key] = import(entryUrl).then(mod => {
|
|
625
|
+
hy.modules[key] = mod;
|
|
626
|
+
}, err => {
|
|
627
|
+
delete hy.loading[key];
|
|
628
|
+
throw err;
|
|
629
|
+
});
|
|
630
|
+
}
|
|
631
|
+
pending.push(hy.loading[key]);
|
|
284
632
|
}
|
|
633
|
+
return pending.length ? Promise.all(pending).then(() => {}) : undefined;
|
|
285
634
|
}
|
|
286
635
|
function hydrate$1(code, element, options = {}) {
|
|
636
|
+
installHydrationRuntime();
|
|
287
637
|
if (globalThis._$HY.done) return render$1(code, element, [...element.childNodes], options);
|
|
288
638
|
options.renderId ||= "";
|
|
289
639
|
if (!globalThis._$HY.modules) globalThis._$HY.modules = {};
|
|
@@ -293,6 +643,7 @@ function hydrate$1(code, element, options = {}) {
|
|
|
293
643
|
sharedConfig.load = id => globalThis._$HY.r[id];
|
|
294
644
|
sharedConfig.has = id => id in globalThis._$HY.r;
|
|
295
645
|
sharedConfig.gather = root => gatherHydratable(element, root);
|
|
646
|
+
sharedConfig.loadModuleAssets = loadModuleAssets;
|
|
296
647
|
sharedConfig.cleanupFragment = id => {
|
|
297
648
|
const tpl = document.getElementById("pl-" + id);
|
|
298
649
|
if (tpl) {
|
|
@@ -314,11 +665,34 @@ function hydrate$1(code, element, options = {}) {
|
|
|
314
665
|
{
|
|
315
666
|
sharedConfig.verifyHydration = () => {
|
|
316
667
|
if (sharedConfig.registry && sharedConfig.registry.size) {
|
|
317
|
-
const orphaned = [...sharedConfig.registry.values()];
|
|
668
|
+
const orphaned = [...sharedConfig.registry.values()].filter(node => node.isConnected);
|
|
669
|
+
sharedConfig.registry.clear();
|
|
670
|
+
if (!orphaned.length) return;
|
|
318
671
|
console.warn(`Hydration completed with ${orphaned.length} unclaimed server-rendered node(s):\n` + orphaned.map(node => ` ${node.outerHTML.slice(0, 100)}`).join("\n"));
|
|
319
672
|
}
|
|
320
673
|
};
|
|
321
674
|
}
|
|
675
|
+
const rootMapping = globalThis._$HY.r && globalThis._$HY.r["_assets"];
|
|
676
|
+
if (rootMapping && typeof rootMapping === "object") {
|
|
677
|
+
const p = loadModuleAssets(rootMapping);
|
|
678
|
+
if (p) {
|
|
679
|
+
gatherHydratable(element, options.renderId);
|
|
680
|
+
let disposer;
|
|
681
|
+
p.then(() => {
|
|
682
|
+
try {
|
|
683
|
+
disposer = render$1(code, element, [...element.childNodes], options);
|
|
684
|
+
} finally {
|
|
685
|
+
sharedConfig.hydrating = false;
|
|
686
|
+
}
|
|
687
|
+
}, err => {
|
|
688
|
+
console.error("Hydration module preload failed, falling back to client render:", err);
|
|
689
|
+
sharedConfig.hydrating = false;
|
|
690
|
+
sharedConfig.registry = undefined;
|
|
691
|
+
disposer = render$1(code, element, [...element.childNodes], options);
|
|
692
|
+
});
|
|
693
|
+
return () => disposer && disposer();
|
|
694
|
+
}
|
|
695
|
+
}
|
|
322
696
|
try {
|
|
323
697
|
gatherHydratable(element, options.renderId);
|
|
324
698
|
return render$1(code, element, [...element.childNodes], options);
|
|
@@ -380,20 +754,21 @@ function getFirstChild(node, expectedTag) {
|
|
|
380
754
|
function getNextSibling(node, expectedTag) {
|
|
381
755
|
const sibling = node.nextSibling;
|
|
382
756
|
if (isHydrating() && expectedTag && sibling?.localName !== expectedTag) {
|
|
383
|
-
const parent = node.
|
|
757
|
+
const parent = node.parentNode;
|
|
384
758
|
const isMissing = !sibling || sibling.nodeType !== 1;
|
|
385
759
|
console.warn("Hydration structure mismatch: expected <" + expectedTag + "> after", node, "in", parent, "\n " + describeSiblings(parent, sibling, expectedTag, isMissing));
|
|
386
760
|
}
|
|
387
761
|
return sibling;
|
|
388
762
|
}
|
|
389
763
|
function describeSiblings(parent, mismatchChild, expectedTag, isMissing) {
|
|
764
|
+
if (!parent) return `<${expectedTag} \u2190 parent unavailable>`;
|
|
390
765
|
const children = [];
|
|
391
766
|
let child = parent.firstChild;
|
|
392
767
|
while (child) {
|
|
393
768
|
if (child.nodeType === 1) children.push(child);
|
|
394
769
|
child = child.nextSibling;
|
|
395
770
|
}
|
|
396
|
-
const pTag = parent.localName;
|
|
771
|
+
const pTag = parent.localName || "#fragment";
|
|
397
772
|
if (isMissing) {
|
|
398
773
|
const tags = children.map(c => `<${c.localName}>`).join("");
|
|
399
774
|
return `<${pTag}>${tags}<${expectedTag} \u2190 missing></${pTag}>`;
|
|
@@ -425,7 +800,32 @@ function runHydrationEvents() {
|
|
|
425
800
|
const [el, e] = events[0];
|
|
426
801
|
if (!completed.has(el)) return;
|
|
427
802
|
events.shift();
|
|
428
|
-
|
|
803
|
+
let matchContainer, matchState, matchDistance, matches;
|
|
804
|
+
for (const [container, state] of delegatedContainers) {
|
|
805
|
+
if (!state.handlers.has(e.type)) continue;
|
|
806
|
+
const entry = findOwner(e.target, state);
|
|
807
|
+
if (!entry) continue;
|
|
808
|
+
if (matchContainer) {
|
|
809
|
+
if (!matches) matches = [{
|
|
810
|
+
container: matchContainer,
|
|
811
|
+
state: matchState,
|
|
812
|
+
distance: matchDistance
|
|
813
|
+
}];
|
|
814
|
+
matches.push({
|
|
815
|
+
container,
|
|
816
|
+
state,
|
|
817
|
+
distance: entry.distance
|
|
818
|
+
});
|
|
819
|
+
} else {
|
|
820
|
+
matchContainer = container;
|
|
821
|
+
matchState = state;
|
|
822
|
+
matchDistance = entry.distance;
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
if (matches) {
|
|
826
|
+
matches.sort((a, b) => a.distance - b.distance);
|
|
827
|
+
for (let i = 0; i < matches.length; i++) eventHandler(e, matches[i].container, matches[i].state);
|
|
828
|
+
} else if (matchContainer) eventHandler(e, matchContainer, matchState);
|
|
429
829
|
}
|
|
430
830
|
if (sharedConfig.done) {
|
|
431
831
|
sharedConfig.events = _$HY.events = null;
|
|
@@ -438,14 +838,21 @@ function runHydrationEvents() {
|
|
|
438
838
|
function isHydrating(node) {
|
|
439
839
|
return sharedConfig.hydrating && (!node || node.isConnected);
|
|
440
840
|
}
|
|
441
|
-
function toggleClassKey(node, key, value) {
|
|
442
|
-
const classNames = key.trim().split(/\s+/);
|
|
443
|
-
for (let i = 0, nameLen = classNames.length; i < nameLen; i++) node.classList.toggle(classNames[i], value);
|
|
444
|
-
}
|
|
445
841
|
function classListToObject(classList) {
|
|
446
842
|
if (Array.isArray(classList)) {
|
|
447
843
|
const result = {};
|
|
448
844
|
flattenClassList(classList, result);
|
|
845
|
+
classList = result;
|
|
846
|
+
}
|
|
847
|
+
if (classList && typeof classList === "object") {
|
|
848
|
+
const result = {},
|
|
849
|
+
keys = Object.keys(classList);
|
|
850
|
+
for (let i = 0, len = keys.length; i < len; i++) {
|
|
851
|
+
const key = keys[i];
|
|
852
|
+
if (!classList[key]) continue;
|
|
853
|
+
const classNames = key.trim().split(/\s+/);
|
|
854
|
+
for (let j = 0, nameLen = classNames.length; j < nameLen; j++) classNames[j] && (result[classNames[j]] = true);
|
|
855
|
+
}
|
|
449
856
|
return result;
|
|
450
857
|
}
|
|
451
858
|
return classList;
|
|
@@ -456,18 +863,16 @@ function flattenClassList(list, result) {
|
|
|
456
863
|
if (Array.isArray(item)) flattenClassList(item, result);else if (typeof item === "object" && item != null) Object.assign(result, item);else if (item || item === 0) result[item] = true;
|
|
457
864
|
}
|
|
458
865
|
}
|
|
459
|
-
function assignProp(node, prop, value, prev,
|
|
460
|
-
let forceProp;
|
|
866
|
+
function assignProp(node, prop, value, prev, skipRef, nodeName) {
|
|
461
867
|
if (prop === "style") return style(node, value, prev), value;
|
|
462
|
-
if (prop === "class") return className(node, value,
|
|
463
|
-
if (value === prev) return prev;
|
|
868
|
+
if (prop === "class") return className(node, value, prev), value;
|
|
869
|
+
if (value === prev && DOMWithState[nodeName]?.[prop] !== 1) return prev;
|
|
464
870
|
if (prop === "ref") {
|
|
465
871
|
if (!skipRef && value) ref(() => value, node);
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
} else if (prop.slice(0, 2) === "on") {
|
|
872
|
+
return value;
|
|
873
|
+
}
|
|
874
|
+
const hasNamespace = prop.indexOf(":") > -1;
|
|
875
|
+
if (!hasNamespace && prop.slice(0, 2) === "on") {
|
|
471
876
|
const name = prop.slice(2).toLowerCase();
|
|
472
877
|
const delegate = DelegatedEvents.has(name);
|
|
473
878
|
if (!delegate && prev) {
|
|
@@ -475,26 +880,33 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
|
475
880
|
node.removeEventListener(name, h);
|
|
476
881
|
}
|
|
477
882
|
if (delegate || value) {
|
|
478
|
-
|
|
883
|
+
addEvent(node, name, value, delegate);
|
|
479
884
|
delegate && delegateEvents([name]);
|
|
480
885
|
}
|
|
481
|
-
} else if (
|
|
482
|
-
if (
|
|
483
|
-
if (prop === "value" &&
|
|
886
|
+
} else if (hasNamespace && prop.slice(0, 5) === "prop:" || ChildProperties.has(prop) || DOMWithState[nodeName]?.[prop]) {
|
|
887
|
+
if (hasNamespace) prop = prop.slice(5);else if (isHydrating(node)) return value;
|
|
888
|
+
if (prop === "value" && nodeName === "SELECT") queueMicrotask(() => node.value = value) || (node.value = value);else node[prop] = value;
|
|
484
889
|
} else {
|
|
485
|
-
const ns =
|
|
890
|
+
const ns = hasNamespace && Namespaces[prop.split(":")[0]];
|
|
486
891
|
if (ns) setAttributeNS(node, ns, prop, value);else setAttribute(node, prop, value);
|
|
487
892
|
}
|
|
488
893
|
return value;
|
|
489
894
|
}
|
|
490
|
-
function eventHandler(e) {
|
|
491
|
-
if (
|
|
492
|
-
|
|
895
|
+
function eventHandler(e, container, state) {
|
|
896
|
+
if (hydrationRt !== null && hydrationRt.dedupEvent(e)) return;
|
|
897
|
+
const prev = e[$$EVENT_OWNER];
|
|
898
|
+
let resumeNode;
|
|
899
|
+
if (prev) {
|
|
900
|
+
if (prev === true || prev === container || !container.contains(prev)) return;
|
|
901
|
+
resumeNode = prev;
|
|
493
902
|
}
|
|
494
|
-
|
|
903
|
+
const owner = state && (state.owners.size === 1 && state.owners.has(container) ? container : findOwner(e.target, state)?.owner);
|
|
904
|
+
if (state && !owner) return;
|
|
905
|
+
e[$$EVENT_OWNER] = owner || true;
|
|
906
|
+
let node = resumeNode || e.target;
|
|
495
907
|
const key = `$$${e.type}`;
|
|
496
908
|
const oriTarget = e.target;
|
|
497
|
-
const
|
|
909
|
+
const boundary = owner || container || e.currentTarget;
|
|
498
910
|
const retarget = value => Object.defineProperty(e, "target", {
|
|
499
911
|
configurable: true,
|
|
500
912
|
value
|
|
@@ -510,35 +922,43 @@ function eventHandler(e) {
|
|
|
510
922
|
return true;
|
|
511
923
|
};
|
|
512
924
|
const walkUpTree = () => {
|
|
513
|
-
while (handleNode()
|
|
925
|
+
while (handleNode()) {
|
|
926
|
+
if (node === boundary || node.parentNode === boundary) break;
|
|
927
|
+
node = node._$host || node.parentNode || node.host;
|
|
928
|
+
}
|
|
514
929
|
};
|
|
515
930
|
Object.defineProperty(e, "currentTarget", {
|
|
516
931
|
configurable: true,
|
|
517
932
|
get() {
|
|
518
|
-
return node || document;
|
|
933
|
+
return node || boundary || document;
|
|
519
934
|
}
|
|
520
935
|
});
|
|
521
|
-
if (
|
|
936
|
+
if (resumeNode) {
|
|
937
|
+
if (resumeNode === e.target) node = resumeNode._$host || resumeNode.parentNode || resumeNode.host;
|
|
938
|
+
if (node && node !== boundary) walkUpTree();
|
|
939
|
+
} else if (e.composedPath) {
|
|
522
940
|
const path = e.composedPath();
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
941
|
+
if (path.length) {
|
|
942
|
+
retarget(path[0]);
|
|
943
|
+
for (let i = 0; i < path.length; i++) {
|
|
944
|
+
node = path[i];
|
|
945
|
+
if (!handleNode()) break;
|
|
946
|
+
if (node._$host) {
|
|
947
|
+
node = node._$host;
|
|
948
|
+
walkUpTree();
|
|
949
|
+
break;
|
|
950
|
+
}
|
|
951
|
+
if (node === boundary || node.parentNode === boundary) {
|
|
952
|
+
break;
|
|
953
|
+
}
|
|
534
954
|
}
|
|
535
|
-
}
|
|
955
|
+
} else walkUpTree();
|
|
536
956
|
}
|
|
537
957
|
else walkUpTree();
|
|
538
958
|
retarget(oriTarget);
|
|
539
959
|
}
|
|
540
960
|
function insertExpression(parent, value, current, marker) {
|
|
541
|
-
if (isHydrating(parent)) return;
|
|
961
|
+
if (hydrationRt !== null && isHydrating(parent)) return;
|
|
542
962
|
if (value === current) return;
|
|
543
963
|
const t = typeof value,
|
|
544
964
|
multi = marker !== undefined;
|
|
@@ -546,15 +966,25 @@ function insertExpression(parent, value, current, marker) {
|
|
|
546
966
|
const tc = typeof current;
|
|
547
967
|
if (tc === "string" || tc === "number") {
|
|
548
968
|
parent.firstChild.data = value;
|
|
549
|
-
} else
|
|
969
|
+
} else {
|
|
970
|
+
if (ownsAllChildren(parent, current)) parent.textContent = value;else {
|
|
971
|
+
removeOwnedChildren(parent, current);
|
|
972
|
+
parent.insertBefore(document.createTextNode(value), parent.firstChild);
|
|
973
|
+
}
|
|
974
|
+
}
|
|
550
975
|
} else if (value === undefined) {
|
|
551
976
|
cleanChildren(parent, current, marker);
|
|
552
977
|
} else if (value.nodeType) {
|
|
553
978
|
if (Array.isArray(current)) {
|
|
554
979
|
cleanChildren(parent, current, multi ? marker : null, value);
|
|
555
|
-
} else if (current
|
|
980
|
+
} else if (current && current.nodeType) {
|
|
981
|
+
current.parentNode === parent ? parent.replaceChild(value, current) : parent.appendChild(value);
|
|
982
|
+
} else if (current && parent.firstChild) {
|
|
983
|
+
parent.replaceChild(value, parent.firstChild);
|
|
984
|
+
} else {
|
|
556
985
|
parent.appendChild(value);
|
|
557
|
-
}
|
|
986
|
+
}
|
|
987
|
+
if (marker) value[$$SLOT] = marker;
|
|
558
988
|
} else if (Array.isArray(value)) {
|
|
559
989
|
const currentArray = current && Array.isArray(current);
|
|
560
990
|
if (value.length === 0) {
|
|
@@ -562,9 +992,9 @@ function insertExpression(parent, value, current, marker) {
|
|
|
562
992
|
} else if (currentArray) {
|
|
563
993
|
if (current.length === 0) {
|
|
564
994
|
appendNodes(parent, value, marker);
|
|
565
|
-
} else reconcileArrays(parent, current, value);
|
|
995
|
+
} else reconcileArrays(parent, current, value, marker);
|
|
566
996
|
} else {
|
|
567
|
-
current && cleanChildren(parent);
|
|
997
|
+
current && cleanChildren(parent, current);
|
|
568
998
|
appendNodes(parent, value);
|
|
569
999
|
}
|
|
570
1000
|
} else console.warn(`Unrecognized value. Skipped inserting`, value);
|
|
@@ -586,21 +1016,64 @@ function normalize(value, current, multi, doNotUnwrap) {
|
|
|
586
1016
|
}
|
|
587
1017
|
return value;
|
|
588
1018
|
}
|
|
1019
|
+
function tagHost(value, host) {
|
|
1020
|
+
if (Array.isArray(value)) {
|
|
1021
|
+
for (let i = 0, len = value.length; i < len; i++) tagHost(value[i], host);
|
|
1022
|
+
} else if (value && value.nodeType && value[$$HOST] !== host) {
|
|
1023
|
+
value[$$HOST] = host;
|
|
1024
|
+
Object.defineProperty(value, "_$host", {
|
|
1025
|
+
get: host,
|
|
1026
|
+
configurable: true
|
|
1027
|
+
});
|
|
1028
|
+
}
|
|
1029
|
+
}
|
|
589
1030
|
function appendNodes(parent, array, marker = null) {
|
|
590
|
-
for (let i = 0, len = array.length; i < len; i++)
|
|
1031
|
+
for (let i = 0, len = array.length; i < len; i++) {
|
|
1032
|
+
const n = array[i];
|
|
1033
|
+
parent.insertBefore(n, marker);
|
|
1034
|
+
if (marker) n[$$SLOT] = marker;
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
function ownsAllChildren(parent, current) {
|
|
1038
|
+
if (current == null) return true;
|
|
1039
|
+
if (Array.isArray(current)) {
|
|
1040
|
+
return current.length ? parent.firstChild === current[0] && parent.lastChild === current[current.length - 1] : parent.firstChild === null;
|
|
1041
|
+
}
|
|
1042
|
+
if (current === "") return parent.firstChild === null;
|
|
1043
|
+
if (current.nodeType) return parent.firstChild === current && parent.lastChild === current;
|
|
1044
|
+
const first = parent.firstChild;
|
|
1045
|
+
return first !== null && first.nodeType === 3 && parent.lastChild === first;
|
|
1046
|
+
}
|
|
1047
|
+
function removeOwnedChildren(parent, current) {
|
|
1048
|
+
if (Array.isArray(current)) {
|
|
1049
|
+
for (let i = 0; i < current.length; i++) {
|
|
1050
|
+
const el = current[i];
|
|
1051
|
+
if (el.parentNode === parent) el.remove();
|
|
1052
|
+
}
|
|
1053
|
+
} else if (current.nodeType) {
|
|
1054
|
+
if (current.parentNode === parent) current.remove();
|
|
1055
|
+
} else {
|
|
1056
|
+
const first = parent.firstChild;
|
|
1057
|
+
if (first && first.nodeType === 3) first.remove();
|
|
1058
|
+
}
|
|
591
1059
|
}
|
|
592
1060
|
function cleanChildren(parent, current, marker, replacement) {
|
|
593
|
-
if (marker === undefined)
|
|
1061
|
+
if (marker === undefined) {
|
|
1062
|
+
if (ownsAllChildren(parent, current)) return parent.textContent = "";
|
|
1063
|
+
return removeOwnedChildren(parent, current);
|
|
1064
|
+
}
|
|
594
1065
|
if (current.length) {
|
|
595
1066
|
let inserted = false;
|
|
596
1067
|
for (let i = current.length - 1; i >= 0; i--) {
|
|
597
1068
|
const el = current[i];
|
|
598
1069
|
if (replacement !== el) {
|
|
599
|
-
const
|
|
600
|
-
|
|
1070
|
+
const tag = el[$$SLOT];
|
|
1071
|
+
const owns = el.parentNode === parent && (!tag || tag === marker);
|
|
1072
|
+
if (replacement && !inserted && !i) owns ? parent.replaceChild(replacement, el) : parent.insertBefore(replacement, marker);else if (owns) el.remove();
|
|
601
1073
|
} else inserted = true;
|
|
602
1074
|
}
|
|
603
1075
|
} else if (replacement) parent.insertBefore(replacement, marker);
|
|
1076
|
+
if (replacement && marker) replacement[$$SLOT] = marker;
|
|
604
1077
|
}
|
|
605
1078
|
function gatherHydratable(element, root) {
|
|
606
1079
|
const templates = element.querySelectorAll(`*[_hk]`);
|
|
@@ -638,101 +1111,168 @@ function ssrHydrationKey() {}
|
|
|
638
1111
|
function resolveSSRNode(node) {}
|
|
639
1112
|
function escape(html) {}
|
|
640
1113
|
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
{
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
});
|
|
1114
|
+
const ENVELOPE = Symbol.for("solid.ResponseEnvelope");
|
|
1115
|
+
class ResponseEnvelope {
|
|
1116
|
+
constructor(response, value) {
|
|
1117
|
+
this.response = response;
|
|
1118
|
+
this.value = value;
|
|
647
1119
|
}
|
|
648
|
-
const result = render$1(...args);
|
|
649
|
-
{
|
|
650
|
-
setOnUnhandledAsync(null);
|
|
651
|
-
if (unhandledAsync) {
|
|
652
|
-
const message = "Async content was used in JSX without a <Loading> boundary. " + "Wrap async content in <Loading> to show a fallback while loading.";
|
|
653
|
-
result();
|
|
654
|
-
const container = args[1];
|
|
655
|
-
container.textContent = "";
|
|
656
|
-
const msg = document.createElement("pre");
|
|
657
|
-
msg.style.cssText = "color:#e53e3e;background:#fff5f5;border:2px solid #e53e3e;" + "border-radius:4px;padding:16px;margin:16px;font-family:monospace;" + "white-space:pre-wrap;word-break:break-word;";
|
|
658
|
-
msg.textContent = message;
|
|
659
|
-
container.appendChild(msg);
|
|
660
|
-
console.error(message);
|
|
661
|
-
return () => {};
|
|
662
|
-
}
|
|
663
|
-
}
|
|
664
|
-
return result;
|
|
665
1120
|
}
|
|
1121
|
+
ResponseEnvelope.prototype[ENVELOPE] = true;
|
|
1122
|
+
function isResponseEnvelope(value) {
|
|
1123
|
+
return !!(value && typeof value === "object" && value[ENVELOPE]);
|
|
1124
|
+
}
|
|
1125
|
+
function initWithRevalidate(init) {
|
|
1126
|
+
const {
|
|
1127
|
+
revalidate,
|
|
1128
|
+
...responseInit
|
|
1129
|
+
} = init;
|
|
1130
|
+
const headers = new Headers(responseInit.headers);
|
|
1131
|
+
revalidate !== undefined && headers.set("X-Revalidate", revalidate.toString());
|
|
1132
|
+
return {
|
|
1133
|
+
responseInit,
|
|
1134
|
+
headers
|
|
1135
|
+
};
|
|
1136
|
+
}
|
|
1137
|
+
function redirect(url, init = 302) {
|
|
1138
|
+
const {
|
|
1139
|
+
responseInit,
|
|
1140
|
+
headers
|
|
1141
|
+
} = initWithRevalidate(typeof init === "number" ? {
|
|
1142
|
+
status: init
|
|
1143
|
+
} : init);
|
|
1144
|
+
if (responseInit.status === undefined) {
|
|
1145
|
+
responseInit.status = 302;
|
|
1146
|
+
}
|
|
1147
|
+
headers.set("Location", url);
|
|
1148
|
+
return new Response(null, {
|
|
1149
|
+
...responseInit,
|
|
1150
|
+
headers
|
|
1151
|
+
});
|
|
1152
|
+
}
|
|
1153
|
+
function reload(init = {}) {
|
|
1154
|
+
const {
|
|
1155
|
+
responseInit,
|
|
1156
|
+
headers
|
|
1157
|
+
} = initWithRevalidate(init);
|
|
1158
|
+
return new Response(null, {
|
|
1159
|
+
...responseInit,
|
|
1160
|
+
headers
|
|
1161
|
+
});
|
|
1162
|
+
}
|
|
1163
|
+
function respond(value, init = {}) {
|
|
1164
|
+
const {
|
|
1165
|
+
responseInit,
|
|
1166
|
+
headers
|
|
1167
|
+
} = initWithRevalidate(init);
|
|
1168
|
+
headers.set("Content-Type", "application/json");
|
|
1169
|
+
return new ResponseEnvelope(new Response(JSON.stringify(value), {
|
|
1170
|
+
...responseInit,
|
|
1171
|
+
headers
|
|
1172
|
+
}), value);
|
|
1173
|
+
}
|
|
1174
|
+
|
|
1175
|
+
const mergeProps = merge;
|
|
666
1176
|
const isServer = false;
|
|
667
1177
|
const isDev = true;
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
1178
|
+
function render(code, element, init, options = {}) {
|
|
1179
|
+
enforceLoadingBoundary(true);
|
|
1180
|
+
try {
|
|
1181
|
+
const dispose = render$1(code, element, init, {
|
|
1182
|
+
...options,
|
|
1183
|
+
insertOptions: {
|
|
1184
|
+
schedule: true
|
|
1185
|
+
}
|
|
1186
|
+
});
|
|
1187
|
+
flush();
|
|
1188
|
+
return dispose;
|
|
1189
|
+
} finally {
|
|
1190
|
+
enforceLoadingBoundary(false);
|
|
1191
|
+
}
|
|
673
1192
|
}
|
|
674
1193
|
const hydrate = (...args) => {
|
|
675
1194
|
enableHydration();
|
|
676
1195
|
return hydrate$1(...args);
|
|
677
1196
|
};
|
|
678
1197
|
function Portal(props) {
|
|
1198
|
+
return runWithOwner(createOwner(), () => portalImpl(props));
|
|
1199
|
+
}
|
|
1200
|
+
function portalImpl(props) {
|
|
679
1201
|
const treeMarker = document.createTextNode(""),
|
|
680
1202
|
startMarker = document.createTextNode(""),
|
|
681
1203
|
endMarker = document.createTextNode(""),
|
|
682
|
-
mount = () =>
|
|
683
|
-
|
|
684
|
-
|
|
1204
|
+
mount = () => props.mount || document.body,
|
|
1205
|
+
content = createMemo(() => [startMarker, props.children], {
|
|
1206
|
+
ssrSource: "client"
|
|
1207
|
+
});
|
|
1208
|
+
createRenderEffect(
|
|
1209
|
+
() => [mount(), content(), getOwner()], ([, c, owner]) => {
|
|
1210
|
+
const m = untrack(mount);
|
|
685
1211
|
m.appendChild(endMarker);
|
|
686
|
-
|
|
1212
|
+
const dispose = runWithOwner(owner, () => createRoot(d => {
|
|
1213
|
+
insert(m, c, endMarker, undefined, {
|
|
1214
|
+
host: () => treeMarker.parentNode
|
|
1215
|
+
});
|
|
1216
|
+
return d;
|
|
1217
|
+
}));
|
|
687
1218
|
return () => {
|
|
1219
|
+
dispose();
|
|
688
1220
|
let c = startMarker;
|
|
689
|
-
while (c
|
|
1221
|
+
while (c) {
|
|
690
1222
|
const n = c.nextSibling;
|
|
691
1223
|
m.removeChild(c);
|
|
1224
|
+
if (c === endMarker) break;
|
|
692
1225
|
c = n;
|
|
693
1226
|
}
|
|
694
1227
|
};
|
|
1228
|
+
},
|
|
1229
|
+
{
|
|
1230
|
+
schedule: true,
|
|
1231
|
+
ssrSource: "client"
|
|
1232
|
+
});
|
|
1233
|
+
createEffect(mount, () => {
|
|
1234
|
+
const m = untrack(mount);
|
|
1235
|
+
const ownerRoot = getDelegatedRoot(treeMarker);
|
|
1236
|
+
if (!ownerRoot || ownerRoot.contains(m)) return;
|
|
1237
|
+
registerDelegatedContainer(m, ownerRoot);
|
|
1238
|
+
return () => unregisterDelegatedContainer(m, ownerRoot);
|
|
1239
|
+
}, {
|
|
1240
|
+
ssrSource: "client"
|
|
1241
|
+
});
|
|
1242
|
+
if (sharedConfig.hydrating) return createMemo(() => treeMarker, {
|
|
1243
|
+
ssrSource: "client"
|
|
695
1244
|
});
|
|
696
1245
|
return treeMarker;
|
|
697
1246
|
}
|
|
698
|
-
function
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
1247
|
+
function dynamic(source) {
|
|
1248
|
+
const cached = createMemo(source, {
|
|
1249
|
+
lazy: true
|
|
1250
|
+
});
|
|
1251
|
+
return props => {
|
|
1252
|
+
return createMemo(() => {
|
|
1253
|
+
const component = cached();
|
|
1254
|
+
switch (typeof component) {
|
|
1255
|
+
case "function":
|
|
1256
|
+
Object.assign(component, {
|
|
1257
|
+
[$DEVCOMP]: true
|
|
706
1258
|
});
|
|
707
|
-
|
|
708
|
-
|
|
1259
|
+
return untrack(() => component(props));
|
|
1260
|
+
case "string":
|
|
1261
|
+
const el = sharedConfig.hydrating ? getNextElement() : createElement(component, untrack(() => props.is));
|
|
1262
|
+
spread(el, props);
|
|
1263
|
+
return el;
|
|
709
1264
|
}
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
}
|
|
713
|
-
});
|
|
714
|
-
}
|
|
715
|
-
function createDynamic(component, props) {
|
|
716
|
-
const cached = createMemo$1(component);
|
|
717
|
-
return createMemo$1(() => {
|
|
718
|
-
const component = cached();
|
|
719
|
-
switch (typeof component) {
|
|
720
|
-
case "function":
|
|
721
|
-
Object.assign(component, {
|
|
722
|
-
[$DEVCOMP]: true
|
|
723
|
-
});
|
|
724
|
-
return untrack(() => component(props));
|
|
725
|
-
case "string":
|
|
726
|
-
const isSvg = SVGElements.has(component);
|
|
727
|
-
const el = sharedConfig.hydrating ? getNextElement() : createElement(component, isSvg, untrack(() => props.is));
|
|
728
|
-
spread(el, props, isSvg);
|
|
729
|
-
return el;
|
|
730
|
-
}
|
|
731
|
-
});
|
|
1265
|
+
});
|
|
1266
|
+
};
|
|
732
1267
|
}
|
|
733
1268
|
function Dynamic(props) {
|
|
734
|
-
const
|
|
735
|
-
return
|
|
1269
|
+
const Comp = dynamic(() => props.component);
|
|
1270
|
+
return createComponent(Comp, omit(props, "component"));
|
|
1271
|
+
}
|
|
1272
|
+
function createElement(tagName, is = undefined) {
|
|
1273
|
+
return SVGElements.has(tagName) ? document.createElementNS(Namespaces.svg, tagName) : MathMLElements.has(tagName) ? document.createElementNS(Namespaces.mathml, tagName) : document.createElement(tagName, {
|
|
1274
|
+
is
|
|
1275
|
+
});
|
|
736
1276
|
}
|
|
737
1277
|
|
|
738
|
-
export { voidFn as Assets, ChildProperties, DOMElements, DelegatedEvents, Dynamic, voidFn as HydrationScript, Portal,
|
|
1278
|
+
export { voidFn as Assets, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, voidFn as HydrationScript, MathMLElements, Namespaces, Portal, RawTextElements, RequestContext, ResponseEnvelope, SVGElements, VoidElements, acquireAsset, addEvent, applyRef, assign, className, delegateEvents, dynamic, dynamicProperty, effect, escape, voidFn as generateHydrationScript, voidFn as getAssets, getDelegatedRoot, getFirstChild, getHydrationKey, getNextElement, getNextMarker, getNextMatch, getNextSibling, voidFn as getRequestEvent, hydrate, insert, installHydrationRuntime, isDev, isResponseEnvelope, isServer, memo, mergeProps, redirect, ref, registerDelegatedContainer, registerDelegatedRoot, reload, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, respond, runHydrationEvents, scope, setAttribute, setAttributeNS, setProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrStyle, style, template, unregisterDelegatedContainer, unregisterDelegatedRoot, voidFn as useAssets };
|