@solidjs/web 2.0.0-beta.2 → 2.0.0-beta.21
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 +790 -223
- package/dist/dev.js +764 -217
- package/dist/server.cjs +742 -186
- package/dist/server.js +714 -183
- package/dist/web.cjs +779 -196
- package/dist/web.js +753 -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 +448 -0
- package/server-functions/dist/client.js +435 -0
- package/server-functions/dist/server.cjs +632 -0
- package/server-functions/dist/server.js +615 -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 +137 -0
- package/types/server-functions/server.d.ts +307 -0
- package/types/server-functions/shared.d.ts +342 -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 +137 -0
- package/types-cjs/server-functions/server.d.cts +307 -0
- package/types-cjs/server-functions/shared.d.cts +342 -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) {
|
|
@@ -310,15 +661,45 @@ function hydrate$1(code, element, options = {}) {
|
|
|
310
661
|
}
|
|
311
662
|
};
|
|
312
663
|
sharedConfig.registry = new Map();
|
|
664
|
+
if (!sharedConfig.boundaryScopes) sharedConfig.boundaryScopes = new Map();
|
|
665
|
+
sharedConfig.captureBoundaryScope = id => {
|
|
666
|
+
if (sharedConfig.registry) sharedConfig.boundaryScopes.set(id, {
|
|
667
|
+
registry: sharedConfig.registry,
|
|
668
|
+
gather: sharedConfig.gather
|
|
669
|
+
});
|
|
670
|
+
};
|
|
313
671
|
sharedConfig.hydrating = true;
|
|
314
672
|
{
|
|
315
673
|
sharedConfig.verifyHydration = () => {
|
|
316
674
|
if (sharedConfig.registry && sharedConfig.registry.size) {
|
|
317
|
-
const orphaned = [...sharedConfig.registry.values()];
|
|
675
|
+
const orphaned = [...sharedConfig.registry.values()].filter(node => node.isConnected);
|
|
676
|
+
sharedConfig.registry.clear();
|
|
677
|
+
if (!orphaned.length) return;
|
|
318
678
|
console.warn(`Hydration completed with ${orphaned.length} unclaimed server-rendered node(s):\n` + orphaned.map(node => ` ${node.outerHTML.slice(0, 100)}`).join("\n"));
|
|
319
679
|
}
|
|
320
680
|
};
|
|
321
681
|
}
|
|
682
|
+
const rootMapping = globalThis._$HY.r && globalThis._$HY.r["_assets"];
|
|
683
|
+
if (rootMapping && typeof rootMapping === "object") {
|
|
684
|
+
const p = loadModuleAssets(rootMapping);
|
|
685
|
+
if (p) {
|
|
686
|
+
gatherHydratable(element, options.renderId);
|
|
687
|
+
let disposer;
|
|
688
|
+
p.then(() => {
|
|
689
|
+
try {
|
|
690
|
+
disposer = render$1(code, element, [...element.childNodes], options);
|
|
691
|
+
} finally {
|
|
692
|
+
sharedConfig.hydrating = false;
|
|
693
|
+
}
|
|
694
|
+
}, err => {
|
|
695
|
+
console.error("Hydration module preload failed, falling back to client render:", err);
|
|
696
|
+
sharedConfig.hydrating = false;
|
|
697
|
+
sharedConfig.registry = undefined;
|
|
698
|
+
disposer = render$1(code, element, [...element.childNodes], options);
|
|
699
|
+
});
|
|
700
|
+
return () => disposer && disposer();
|
|
701
|
+
}
|
|
702
|
+
}
|
|
322
703
|
try {
|
|
323
704
|
gatherHydratable(element, options.renderId);
|
|
324
705
|
return render$1(code, element, [...element.childNodes], options);
|
|
@@ -380,20 +761,21 @@ function getFirstChild(node, expectedTag) {
|
|
|
380
761
|
function getNextSibling(node, expectedTag) {
|
|
381
762
|
const sibling = node.nextSibling;
|
|
382
763
|
if (isHydrating() && expectedTag && sibling?.localName !== expectedTag) {
|
|
383
|
-
const parent = node.
|
|
764
|
+
const parent = node.parentNode;
|
|
384
765
|
const isMissing = !sibling || sibling.nodeType !== 1;
|
|
385
766
|
console.warn("Hydration structure mismatch: expected <" + expectedTag + "> after", node, "in", parent, "\n " + describeSiblings(parent, sibling, expectedTag, isMissing));
|
|
386
767
|
}
|
|
387
768
|
return sibling;
|
|
388
769
|
}
|
|
389
770
|
function describeSiblings(parent, mismatchChild, expectedTag, isMissing) {
|
|
771
|
+
if (!parent) return `<${expectedTag} \u2190 parent unavailable>`;
|
|
390
772
|
const children = [];
|
|
391
773
|
let child = parent.firstChild;
|
|
392
774
|
while (child) {
|
|
393
775
|
if (child.nodeType === 1) children.push(child);
|
|
394
776
|
child = child.nextSibling;
|
|
395
777
|
}
|
|
396
|
-
const pTag = parent.localName;
|
|
778
|
+
const pTag = parent.localName || "#fragment";
|
|
397
779
|
if (isMissing) {
|
|
398
780
|
const tags = children.map(c => `<${c.localName}>`).join("");
|
|
399
781
|
return `<${pTag}>${tags}<${expectedTag} \u2190 missing></${pTag}>`;
|
|
@@ -425,7 +807,32 @@ function runHydrationEvents() {
|
|
|
425
807
|
const [el, e] = events[0];
|
|
426
808
|
if (!completed.has(el)) return;
|
|
427
809
|
events.shift();
|
|
428
|
-
|
|
810
|
+
let matchContainer, matchState, matchDistance, matches;
|
|
811
|
+
for (const [container, state] of delegatedContainers) {
|
|
812
|
+
if (!state.handlers.has(e.type)) continue;
|
|
813
|
+
const entry = findOwner(e.target, state);
|
|
814
|
+
if (!entry) continue;
|
|
815
|
+
if (matchContainer) {
|
|
816
|
+
if (!matches) matches = [{
|
|
817
|
+
container: matchContainer,
|
|
818
|
+
state: matchState,
|
|
819
|
+
distance: matchDistance
|
|
820
|
+
}];
|
|
821
|
+
matches.push({
|
|
822
|
+
container,
|
|
823
|
+
state,
|
|
824
|
+
distance: entry.distance
|
|
825
|
+
});
|
|
826
|
+
} else {
|
|
827
|
+
matchContainer = container;
|
|
828
|
+
matchState = state;
|
|
829
|
+
matchDistance = entry.distance;
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
if (matches) {
|
|
833
|
+
matches.sort((a, b) => a.distance - b.distance);
|
|
834
|
+
for (let i = 0; i < matches.length; i++) eventHandler(e, matches[i].container, matches[i].state);
|
|
835
|
+
} else if (matchContainer) eventHandler(e, matchContainer, matchState);
|
|
429
836
|
}
|
|
430
837
|
if (sharedConfig.done) {
|
|
431
838
|
sharedConfig.events = _$HY.events = null;
|
|
@@ -438,14 +845,21 @@ function runHydrationEvents() {
|
|
|
438
845
|
function isHydrating(node) {
|
|
439
846
|
return sharedConfig.hydrating && (!node || node.isConnected);
|
|
440
847
|
}
|
|
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
848
|
function classListToObject(classList) {
|
|
446
849
|
if (Array.isArray(classList)) {
|
|
447
850
|
const result = {};
|
|
448
851
|
flattenClassList(classList, result);
|
|
852
|
+
classList = result;
|
|
853
|
+
}
|
|
854
|
+
if (classList && typeof classList === "object") {
|
|
855
|
+
const result = {},
|
|
856
|
+
keys = Object.keys(classList);
|
|
857
|
+
for (let i = 0, len = keys.length; i < len; i++) {
|
|
858
|
+
const key = keys[i];
|
|
859
|
+
if (!classList[key]) continue;
|
|
860
|
+
const classNames = key.trim().split(/\s+/);
|
|
861
|
+
for (let j = 0, nameLen = classNames.length; j < nameLen; j++) classNames[j] && (result[classNames[j]] = true);
|
|
862
|
+
}
|
|
449
863
|
return result;
|
|
450
864
|
}
|
|
451
865
|
return classList;
|
|
@@ -456,18 +870,16 @@ function flattenClassList(list, result) {
|
|
|
456
870
|
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
871
|
}
|
|
458
872
|
}
|
|
459
|
-
function assignProp(node, prop, value, prev,
|
|
460
|
-
let forceProp;
|
|
873
|
+
function assignProp(node, prop, value, prev, skipRef, nodeName) {
|
|
461
874
|
if (prop === "style") return style(node, value, prev), value;
|
|
462
|
-
if (prop === "class") return className(node, value,
|
|
463
|
-
if (value === prev) return prev;
|
|
875
|
+
if (prop === "class") return className(node, value, prev), value;
|
|
876
|
+
if (value === prev && DOMWithState[nodeName]?.[prop] !== 1) return prev;
|
|
464
877
|
if (prop === "ref") {
|
|
465
878
|
if (!skipRef && value) ref(() => value, node);
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
} else if (prop.slice(0, 2) === "on") {
|
|
879
|
+
return value;
|
|
880
|
+
}
|
|
881
|
+
const hasNamespace = prop.indexOf(":") > -1;
|
|
882
|
+
if (!hasNamespace && prop.slice(0, 2) === "on") {
|
|
471
883
|
const name = prop.slice(2).toLowerCase();
|
|
472
884
|
const delegate = DelegatedEvents.has(name);
|
|
473
885
|
if (!delegate && prev) {
|
|
@@ -475,26 +887,33 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
|
475
887
|
node.removeEventListener(name, h);
|
|
476
888
|
}
|
|
477
889
|
if (delegate || value) {
|
|
478
|
-
|
|
890
|
+
addEvent(node, name, value, delegate);
|
|
479
891
|
delegate && delegateEvents([name]);
|
|
480
892
|
}
|
|
481
|
-
} else if (
|
|
482
|
-
if (
|
|
483
|
-
if (prop === "value" &&
|
|
893
|
+
} else if (hasNamespace && prop.slice(0, 5) === "prop:" || ChildProperties.has(prop) || DOMWithState[nodeName]?.[prop]) {
|
|
894
|
+
if (hasNamespace) prop = prop.slice(5);else if (isHydrating(node)) return value;
|
|
895
|
+
if (prop === "value" && nodeName === "SELECT") queueMicrotask(() => node.value = value) || (node.value = value);else node[prop] = value;
|
|
484
896
|
} else {
|
|
485
|
-
const ns =
|
|
897
|
+
const ns = hasNamespace && Namespaces[prop.split(":")[0]];
|
|
486
898
|
if (ns) setAttributeNS(node, ns, prop, value);else setAttribute(node, prop, value);
|
|
487
899
|
}
|
|
488
900
|
return value;
|
|
489
901
|
}
|
|
490
|
-
function eventHandler(e) {
|
|
491
|
-
if (
|
|
492
|
-
|
|
902
|
+
function eventHandler(e, container, state) {
|
|
903
|
+
if (hydrationRt !== null && hydrationRt.dedupEvent(e)) return;
|
|
904
|
+
const prev = e[$$EVENT_OWNER];
|
|
905
|
+
let resumeNode;
|
|
906
|
+
if (prev) {
|
|
907
|
+
if (prev === true || prev === container || !container.contains(prev)) return;
|
|
908
|
+
resumeNode = prev;
|
|
493
909
|
}
|
|
494
|
-
|
|
910
|
+
const owner = state && (state.owners.size === 1 && state.owners.has(container) ? container : findOwner(e.target, state)?.owner);
|
|
911
|
+
if (state && !owner) return;
|
|
912
|
+
e[$$EVENT_OWNER] = owner || true;
|
|
913
|
+
let node = resumeNode || e.target;
|
|
495
914
|
const key = `$$${e.type}`;
|
|
496
915
|
const oriTarget = e.target;
|
|
497
|
-
const
|
|
916
|
+
const boundary = owner || container || e.currentTarget;
|
|
498
917
|
const retarget = value => Object.defineProperty(e, "target", {
|
|
499
918
|
configurable: true,
|
|
500
919
|
value
|
|
@@ -510,35 +929,43 @@ function eventHandler(e) {
|
|
|
510
929
|
return true;
|
|
511
930
|
};
|
|
512
931
|
const walkUpTree = () => {
|
|
513
|
-
while (handleNode()
|
|
932
|
+
while (handleNode()) {
|
|
933
|
+
if (node === boundary || node.parentNode === boundary) break;
|
|
934
|
+
node = node._$host || node.parentNode || node.host;
|
|
935
|
+
}
|
|
514
936
|
};
|
|
515
937
|
Object.defineProperty(e, "currentTarget", {
|
|
516
938
|
configurable: true,
|
|
517
939
|
get() {
|
|
518
|
-
return node || document;
|
|
940
|
+
return node || boundary || document;
|
|
519
941
|
}
|
|
520
942
|
});
|
|
521
|
-
if (
|
|
943
|
+
if (resumeNode) {
|
|
944
|
+
if (resumeNode === e.target) node = resumeNode._$host || resumeNode.parentNode || resumeNode.host;
|
|
945
|
+
if (node && node !== boundary) walkUpTree();
|
|
946
|
+
} else if (e.composedPath) {
|
|
522
947
|
const path = e.composedPath();
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
948
|
+
if (path.length) {
|
|
949
|
+
retarget(path[0]);
|
|
950
|
+
for (let i = 0; i < path.length; i++) {
|
|
951
|
+
node = path[i];
|
|
952
|
+
if (!handleNode()) break;
|
|
953
|
+
if (node._$host) {
|
|
954
|
+
node = node._$host;
|
|
955
|
+
walkUpTree();
|
|
956
|
+
break;
|
|
957
|
+
}
|
|
958
|
+
if (node === boundary || node.parentNode === boundary) {
|
|
959
|
+
break;
|
|
960
|
+
}
|
|
534
961
|
}
|
|
535
|
-
}
|
|
962
|
+
} else walkUpTree();
|
|
536
963
|
}
|
|
537
964
|
else walkUpTree();
|
|
538
965
|
retarget(oriTarget);
|
|
539
966
|
}
|
|
540
967
|
function insertExpression(parent, value, current, marker) {
|
|
541
|
-
if (isHydrating(parent)) return;
|
|
968
|
+
if (hydrationRt !== null && isHydrating(parent)) return;
|
|
542
969
|
if (value === current) return;
|
|
543
970
|
const t = typeof value,
|
|
544
971
|
multi = marker !== undefined;
|
|
@@ -546,15 +973,25 @@ function insertExpression(parent, value, current, marker) {
|
|
|
546
973
|
const tc = typeof current;
|
|
547
974
|
if (tc === "string" || tc === "number") {
|
|
548
975
|
parent.firstChild.data = value;
|
|
549
|
-
} else
|
|
976
|
+
} else {
|
|
977
|
+
if (ownsAllChildren(parent, current)) parent.textContent = value;else {
|
|
978
|
+
removeOwnedChildren(parent, current);
|
|
979
|
+
parent.insertBefore(document.createTextNode(value), parent.firstChild);
|
|
980
|
+
}
|
|
981
|
+
}
|
|
550
982
|
} else if (value === undefined) {
|
|
551
983
|
cleanChildren(parent, current, marker);
|
|
552
984
|
} else if (value.nodeType) {
|
|
553
985
|
if (Array.isArray(current)) {
|
|
554
986
|
cleanChildren(parent, current, multi ? marker : null, value);
|
|
555
|
-
} else if (current
|
|
987
|
+
} else if (current && current.nodeType) {
|
|
988
|
+
current.parentNode === parent ? parent.replaceChild(value, current) : parent.appendChild(value);
|
|
989
|
+
} else if (current && parent.firstChild) {
|
|
990
|
+
parent.replaceChild(value, parent.firstChild);
|
|
991
|
+
} else {
|
|
556
992
|
parent.appendChild(value);
|
|
557
|
-
}
|
|
993
|
+
}
|
|
994
|
+
if (marker) value[$$SLOT] = marker;
|
|
558
995
|
} else if (Array.isArray(value)) {
|
|
559
996
|
const currentArray = current && Array.isArray(current);
|
|
560
997
|
if (value.length === 0) {
|
|
@@ -562,9 +999,9 @@ function insertExpression(parent, value, current, marker) {
|
|
|
562
999
|
} else if (currentArray) {
|
|
563
1000
|
if (current.length === 0) {
|
|
564
1001
|
appendNodes(parent, value, marker);
|
|
565
|
-
} else reconcileArrays(parent, current, value);
|
|
1002
|
+
} else reconcileArrays(parent, current, value, marker);
|
|
566
1003
|
} else {
|
|
567
|
-
current && cleanChildren(parent);
|
|
1004
|
+
current && cleanChildren(parent, current);
|
|
568
1005
|
appendNodes(parent, value);
|
|
569
1006
|
}
|
|
570
1007
|
} else console.warn(`Unrecognized value. Skipped inserting`, value);
|
|
@@ -586,21 +1023,64 @@ function normalize(value, current, multi, doNotUnwrap) {
|
|
|
586
1023
|
}
|
|
587
1024
|
return value;
|
|
588
1025
|
}
|
|
1026
|
+
function tagHost(value, host) {
|
|
1027
|
+
if (Array.isArray(value)) {
|
|
1028
|
+
for (let i = 0, len = value.length; i < len; i++) tagHost(value[i], host);
|
|
1029
|
+
} else if (value && value.nodeType && value[$$HOST] !== host) {
|
|
1030
|
+
value[$$HOST] = host;
|
|
1031
|
+
Object.defineProperty(value, "_$host", {
|
|
1032
|
+
get: host,
|
|
1033
|
+
configurable: true
|
|
1034
|
+
});
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
589
1037
|
function appendNodes(parent, array, marker = null) {
|
|
590
|
-
for (let i = 0, len = array.length; i < len; i++)
|
|
1038
|
+
for (let i = 0, len = array.length; i < len; i++) {
|
|
1039
|
+
const n = array[i];
|
|
1040
|
+
parent.insertBefore(n, marker);
|
|
1041
|
+
if (marker) n[$$SLOT] = marker;
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
function ownsAllChildren(parent, current) {
|
|
1045
|
+
if (current == null) return true;
|
|
1046
|
+
if (Array.isArray(current)) {
|
|
1047
|
+
return current.length ? parent.firstChild === current[0] && parent.lastChild === current[current.length - 1] : parent.firstChild === null;
|
|
1048
|
+
}
|
|
1049
|
+
if (current === "") return parent.firstChild === null;
|
|
1050
|
+
if (current.nodeType) return parent.firstChild === current && parent.lastChild === current;
|
|
1051
|
+
const first = parent.firstChild;
|
|
1052
|
+
return first !== null && first.nodeType === 3 && parent.lastChild === first;
|
|
1053
|
+
}
|
|
1054
|
+
function removeOwnedChildren(parent, current) {
|
|
1055
|
+
if (Array.isArray(current)) {
|
|
1056
|
+
for (let i = 0; i < current.length; i++) {
|
|
1057
|
+
const el = current[i];
|
|
1058
|
+
if (el.parentNode === parent) el.remove();
|
|
1059
|
+
}
|
|
1060
|
+
} else if (current.nodeType) {
|
|
1061
|
+
if (current.parentNode === parent) current.remove();
|
|
1062
|
+
} else {
|
|
1063
|
+
const first = parent.firstChild;
|
|
1064
|
+
if (first && first.nodeType === 3) first.remove();
|
|
1065
|
+
}
|
|
591
1066
|
}
|
|
592
1067
|
function cleanChildren(parent, current, marker, replacement) {
|
|
593
|
-
if (marker === undefined)
|
|
1068
|
+
if (marker === undefined) {
|
|
1069
|
+
if (ownsAllChildren(parent, current)) return parent.textContent = "";
|
|
1070
|
+
return removeOwnedChildren(parent, current);
|
|
1071
|
+
}
|
|
594
1072
|
if (current.length) {
|
|
595
1073
|
let inserted = false;
|
|
596
1074
|
for (let i = current.length - 1; i >= 0; i--) {
|
|
597
1075
|
const el = current[i];
|
|
598
1076
|
if (replacement !== el) {
|
|
599
|
-
const
|
|
600
|
-
|
|
1077
|
+
const tag = el[$$SLOT];
|
|
1078
|
+
const owns = el.parentNode === parent && (!tag || tag === marker);
|
|
1079
|
+
if (replacement && !inserted && !i) owns ? parent.replaceChild(replacement, el) : parent.insertBefore(replacement, marker);else if (owns) el.remove();
|
|
601
1080
|
} else inserted = true;
|
|
602
1081
|
}
|
|
603
1082
|
} else if (replacement) parent.insertBefore(replacement, marker);
|
|
1083
|
+
if (replacement && marker) replacement[$$SLOT] = marker;
|
|
604
1084
|
}
|
|
605
1085
|
function gatherHydratable(element, root) {
|
|
606
1086
|
const templates = element.querySelectorAll(`*[_hk]`);
|
|
@@ -638,101 +1118,168 @@ function ssrHydrationKey() {}
|
|
|
638
1118
|
function resolveSSRNode(node) {}
|
|
639
1119
|
function escape(html) {}
|
|
640
1120
|
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
{
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
});
|
|
1121
|
+
const ENVELOPE = Symbol.for("solid.ResponseEnvelope");
|
|
1122
|
+
class ResponseEnvelope {
|
|
1123
|
+
constructor(response, value) {
|
|
1124
|
+
this.response = response;
|
|
1125
|
+
this.value = value;
|
|
647
1126
|
}
|
|
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
1127
|
}
|
|
1128
|
+
ResponseEnvelope.prototype[ENVELOPE] = true;
|
|
1129
|
+
function isResponseEnvelope(value) {
|
|
1130
|
+
return !!(value && typeof value === "object" && value[ENVELOPE]);
|
|
1131
|
+
}
|
|
1132
|
+
function initWithRevalidate(init) {
|
|
1133
|
+
const {
|
|
1134
|
+
revalidate,
|
|
1135
|
+
...responseInit
|
|
1136
|
+
} = init;
|
|
1137
|
+
const headers = new Headers(responseInit.headers);
|
|
1138
|
+
revalidate !== undefined && headers.set("X-Revalidate", revalidate.toString());
|
|
1139
|
+
return {
|
|
1140
|
+
responseInit,
|
|
1141
|
+
headers
|
|
1142
|
+
};
|
|
1143
|
+
}
|
|
1144
|
+
function redirect(url, init = 302) {
|
|
1145
|
+
const {
|
|
1146
|
+
responseInit,
|
|
1147
|
+
headers
|
|
1148
|
+
} = initWithRevalidate(typeof init === "number" ? {
|
|
1149
|
+
status: init
|
|
1150
|
+
} : init);
|
|
1151
|
+
if (responseInit.status === undefined) {
|
|
1152
|
+
responseInit.status = 302;
|
|
1153
|
+
}
|
|
1154
|
+
headers.set("Location", url);
|
|
1155
|
+
return new Response(null, {
|
|
1156
|
+
...responseInit,
|
|
1157
|
+
headers
|
|
1158
|
+
});
|
|
1159
|
+
}
|
|
1160
|
+
function reload(init = {}) {
|
|
1161
|
+
const {
|
|
1162
|
+
responseInit,
|
|
1163
|
+
headers
|
|
1164
|
+
} = initWithRevalidate(init);
|
|
1165
|
+
return new Response(null, {
|
|
1166
|
+
...responseInit,
|
|
1167
|
+
headers
|
|
1168
|
+
});
|
|
1169
|
+
}
|
|
1170
|
+
function respond(value, init = {}) {
|
|
1171
|
+
const {
|
|
1172
|
+
responseInit,
|
|
1173
|
+
headers
|
|
1174
|
+
} = initWithRevalidate(init);
|
|
1175
|
+
headers.set("Content-Type", "application/json");
|
|
1176
|
+
return new ResponseEnvelope(new Response(JSON.stringify(value), {
|
|
1177
|
+
...responseInit,
|
|
1178
|
+
headers
|
|
1179
|
+
}), value);
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1182
|
+
const mergeProps = merge;
|
|
666
1183
|
const isServer = false;
|
|
667
1184
|
const isDev = true;
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
1185
|
+
function render(code, element, init, options = {}) {
|
|
1186
|
+
enforceLoadingBoundary(true);
|
|
1187
|
+
try {
|
|
1188
|
+
const dispose = render$1(code, element, init, {
|
|
1189
|
+
...options,
|
|
1190
|
+
insertOptions: {
|
|
1191
|
+
schedule: true
|
|
1192
|
+
}
|
|
1193
|
+
});
|
|
1194
|
+
flush();
|
|
1195
|
+
return dispose;
|
|
1196
|
+
} finally {
|
|
1197
|
+
enforceLoadingBoundary(false);
|
|
1198
|
+
}
|
|
673
1199
|
}
|
|
674
1200
|
const hydrate = (...args) => {
|
|
675
1201
|
enableHydration();
|
|
676
1202
|
return hydrate$1(...args);
|
|
677
1203
|
};
|
|
678
1204
|
function Portal(props) {
|
|
1205
|
+
return runWithOwner(createOwner(), () => portalImpl(props));
|
|
1206
|
+
}
|
|
1207
|
+
function portalImpl(props) {
|
|
679
1208
|
const treeMarker = document.createTextNode(""),
|
|
680
1209
|
startMarker = document.createTextNode(""),
|
|
681
1210
|
endMarker = document.createTextNode(""),
|
|
682
|
-
mount = () =>
|
|
683
|
-
|
|
684
|
-
|
|
1211
|
+
mount = () => props.mount || document.body,
|
|
1212
|
+
content = createMemo(() => [startMarker, props.children], {
|
|
1213
|
+
ssrSource: "client"
|
|
1214
|
+
});
|
|
1215
|
+
createRenderEffect(
|
|
1216
|
+
() => [mount(), content(), getOwner()], ([, c, owner]) => {
|
|
1217
|
+
const m = untrack(mount);
|
|
685
1218
|
m.appendChild(endMarker);
|
|
686
|
-
|
|
1219
|
+
const dispose = runWithOwner(owner, () => createRoot(d => {
|
|
1220
|
+
insert(m, c, endMarker, undefined, {
|
|
1221
|
+
host: () => treeMarker.parentNode
|
|
1222
|
+
});
|
|
1223
|
+
return d;
|
|
1224
|
+
}));
|
|
687
1225
|
return () => {
|
|
1226
|
+
dispose();
|
|
688
1227
|
let c = startMarker;
|
|
689
|
-
while (c
|
|
1228
|
+
while (c) {
|
|
690
1229
|
const n = c.nextSibling;
|
|
691
1230
|
m.removeChild(c);
|
|
1231
|
+
if (c === endMarker) break;
|
|
692
1232
|
c = n;
|
|
693
1233
|
}
|
|
694
1234
|
};
|
|
1235
|
+
},
|
|
1236
|
+
{
|
|
1237
|
+
schedule: true,
|
|
1238
|
+
ssrSource: "client"
|
|
1239
|
+
});
|
|
1240
|
+
createEffect(mount, () => {
|
|
1241
|
+
const m = untrack(mount);
|
|
1242
|
+
const ownerRoot = getDelegatedRoot(treeMarker);
|
|
1243
|
+
if (!ownerRoot || ownerRoot.contains(m)) return;
|
|
1244
|
+
registerDelegatedContainer(m, ownerRoot);
|
|
1245
|
+
return () => unregisterDelegatedContainer(m, ownerRoot);
|
|
1246
|
+
}, {
|
|
1247
|
+
ssrSource: "client"
|
|
1248
|
+
});
|
|
1249
|
+
if (sharedConfig.hydrating) return createMemo(() => treeMarker, {
|
|
1250
|
+
ssrSource: "client"
|
|
695
1251
|
});
|
|
696
1252
|
return treeMarker;
|
|
697
1253
|
}
|
|
698
|
-
function
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
1254
|
+
function dynamic(source) {
|
|
1255
|
+
const cached = createMemo(source, {
|
|
1256
|
+
lazy: true
|
|
1257
|
+
});
|
|
1258
|
+
return props => {
|
|
1259
|
+
return createMemo(() => {
|
|
1260
|
+
const component = cached();
|
|
1261
|
+
switch (typeof component) {
|
|
1262
|
+
case "function":
|
|
1263
|
+
Object.assign(component, {
|
|
1264
|
+
[$DEVCOMP]: true
|
|
706
1265
|
});
|
|
707
|
-
|
|
708
|
-
|
|
1266
|
+
return untrack(() => component(props));
|
|
1267
|
+
case "string":
|
|
1268
|
+
const el = sharedConfig.hydrating ? getNextElement() : createElement(component, untrack(() => props.is));
|
|
1269
|
+
spread(el, props);
|
|
1270
|
+
return el;
|
|
709
1271
|
}
|
|
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
|
-
});
|
|
1272
|
+
});
|
|
1273
|
+
};
|
|
732
1274
|
}
|
|
733
1275
|
function Dynamic(props) {
|
|
734
|
-
const
|
|
735
|
-
return
|
|
1276
|
+
const Comp = dynamic(() => props.component);
|
|
1277
|
+
return createComponent(Comp, omit(props, "component"));
|
|
1278
|
+
}
|
|
1279
|
+
function createElement(tagName, is = undefined) {
|
|
1280
|
+
return SVGElements.has(tagName) ? document.createElementNS(Namespaces.svg, tagName) : MathMLElements.has(tagName) ? document.createElementNS(Namespaces.mathml, tagName) : document.createElement(tagName, {
|
|
1281
|
+
is
|
|
1282
|
+
});
|
|
736
1283
|
}
|
|
737
1284
|
|
|
738
|
-
export { voidFn as Assets, ChildProperties, DOMElements, DelegatedEvents, Dynamic, voidFn as HydrationScript, Portal,
|
|
1285
|
+
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 };
|