@solidjs/web 2.0.0-rc.2 → 2.0.0-rc.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 +1 -1
- package/dist/server.dev.js +5165 -0
- package/dist/server.js +1876 -374
- package/dist/{server.cjs → server.observe.js} +2070 -577
- package/dist/{dev.cjs → web.dev.js} +955 -567
- package/dist/web.js +646 -350
- package/dist/{dev.js → web.observe.js} +699 -421
- package/frames/dist/assets.js +92 -0
- package/frames/dist/client.dev.js +1296 -1198
- package/frames/dist/client.js +1128 -1191
- package/frames/dist/client.observe.js +2041 -0
- package/frames/dist/regions.js +171 -0
- package/frames/dist/server.dev.js +2545 -0
- package/frames/dist/server.js +1683 -3004
- package/frames/dist/server.observe.js +2544 -0
- package/frames/dist/trace.js +45 -0
- package/frames/dist/wire.js +594 -0
- package/frames/package.json +2 -25
- package/package.json +244 -256
- package/performance-tracks/dist/performance-tracks.dev.js +679 -0
- package/performance-tracks/dist/performance-tracks.js +6 -0
- package/performance-tracks/dist/performance-tracks.observe.js +667 -0
- package/performance-tracks/package.json +7 -0
- package/performance-tracks/types/index.d.ts +69 -0
- package/serialization/decode/package.json +2 -15
- package/serialization/dist/decode.js +121 -25
- package/serialization/dist/serialization.js +282 -88
- package/serialization/package.json +2 -15
- package/serialization/types/index.d.ts +115 -153
- package/serialization/types/serializer-decode.d.ts +173 -114
- package/serialization/types/serializer.d.ts +144 -0
- package/server-functions/dist/client.dev.js +1462 -0
- package/server-functions/dist/client.js +667 -165
- package/server-functions/dist/client.observe.js +1441 -0
- package/server-functions/dist/rich-args.js +102 -1
- package/server-functions/dist/server.dev.js +2802 -299
- package/server-functions/dist/server.js +2724 -314
- package/server-functions/dist/server.observe.js +3680 -0
- package/server-functions/package.json +2 -35
- package/server-functions/rich-args/package.json +2 -15
- package/skills/server-components/SKILL.md +117 -0
- package/storage/package.json +2 -15
- package/types/client.d.ts +342 -288
- package/types/constants.d.ts +22 -0
- package/types/cookies.d.ts +32 -84
- package/types/diagnostics.d.ts +80 -0
- package/types/frames/assets-tier.d.ts +78 -0
- package/types/frames/client.d.ts +40 -1
- package/types/frames/frame-client.d.ts +443 -280
- package/types/frames/frame-container-plugin.d.ts +64 -0
- package/types/frames/frame-morph.d.ts +29 -0
- package/types/frames/frame-sink.d.ts +141 -161
- package/types/frames/frame-transport.d.ts +263 -184
- package/types/frames/regions-tier.d.ts +60 -0
- package/types/frames/serializer-decode.d.ts +241 -0
- package/types/frames/serializer.d.ts +115 -153
- package/types/frames/server.d.ts +2 -2
- package/types/frames/trace-tier.d.ts +2 -0
- package/types/frames/tree-rewrite.d.ts +39 -0
- package/types/frames/wire-tier.d.ts +169 -0
- package/types/head.d.ts +20 -0
- package/types/index.d.ts +98 -81
- package/types/index.server.d.ts +159 -0
- package/types/jsx.d.ts +49 -44
- package/types/observe.d.ts +535 -0
- package/types/reconcile.d.ts +1 -0
- package/types/render.d.ts +11 -0
- package/types/request-error-hook.d.ts +5 -0
- package/types/response.d.ts +95 -147
- package/types/serializer-decode.d.ts +173 -114
- package/types/serializer.d.ts +115 -153
- package/types/server-functions/argument-codec.d.ts +30 -0
- package/types/server-functions/client.d.ts +237 -223
- package/types/server-functions/flash.d.ts +28 -30
- package/types/server-functions/registry.d.ts +105 -0
- package/types/server-functions/rich-args.d.ts +1 -10
- package/types/server-functions/server.d.ts +538 -531
- package/types/server-functions/shared.d.ts +398 -425
- package/types/server-functions/uploads.d.ts +53 -0
- package/types/server-mock.d.ts +154 -20
- package/types/server-observe.d.ts +86 -0
- package/types/server.d.ts +601 -422
- package/types/trace.d.ts +127 -0
- package/LICENSE +0 -21
- package/dist/web.cjs +0 -2033
- package/frames/dist/client.cjs +0 -2002
- package/frames/dist/client.dev.cjs +0 -2022
- package/frames/dist/server.cjs +0 -3877
- package/serialization/dist/decode.cjs +0 -139
- package/serialization/dist/serialization.cjs +0 -261
- package/serialization/types-cjs/index.d.cts +0 -182
- package/serialization/types-cjs/package.json +0 -3
- package/serialization/types-cjs/serializer-decode.d.cts +0 -182
- package/server-functions/dist/client.cjs +0 -834
- package/server-functions/dist/rich-args.cjs +0 -11
- package/server-functions/dist/server.cjs +0 -1242
- package/server-functions/dist/server.dev.cjs +0 -1242
- package/storage/dist/storage.cjs +0 -12
- package/storage/types-cjs/index.d.cts +0 -28
- package/storage/types-cjs/package.json +0 -3
- package/types/core.d.ts +0 -9
- package/types-cjs/client.d.cts +0 -337
- package/types-cjs/cookies.d.cts +0 -93
- package/types-cjs/core.d.cts +0 -9
- package/types-cjs/frames/client.d.cts +0 -36
- package/types-cjs/frames/frame-client.d.cts +0 -356
- package/types-cjs/frames/frame-sink.d.cts +0 -194
- package/types-cjs/frames/frame-transport.d.cts +0 -222
- package/types-cjs/frames/serializer.d.cts +0 -182
- package/types-cjs/frames/server.d.cts +0 -52
- package/types-cjs/index.d.cts +0 -244
- package/types-cjs/jsx-properties.d.cts +0 -93
- package/types-cjs/jsx.d.cts +0 -4159
- package/types-cjs/package.json +0 -3
- package/types-cjs/response.d.cts +0 -174
- package/types-cjs/serializer-decode.d.cts +0 -182
- package/types-cjs/serializer.d.cts +0 -182
- package/types-cjs/server-functions/client.d.cts +0 -262
- package/types-cjs/server-functions/flash.d.cts +0 -38
- package/types-cjs/server-functions/rich-args.d.cts +0 -10
- package/types-cjs/server-functions/server.d.cts +0 -681
- package/types-cjs/server-functions/shared.d.cts +0 -523
- package/types-cjs/server-mock.d.cts +0 -286
- package/types-cjs/server.d.cts +0 -544
package/dist/web.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { createRenderEffect, createMemo,
|
|
2
|
-
export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, Show, Switch, createComponent, getOwner, untrack } from 'solid-js';
|
|
1
|
+
import { createRenderEffect, createMemo, enableHydration, $PROXY, untrack, runWithOwner, createRoot, getOwner, ROOT_ERROR_HOOK, flatten, flush, createComponent, omit, createOwner, createSignal, createEffect } from 'solid-js';
|
|
2
|
+
export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, Show, Switch, createComponent, dynamicComponent, getOwner, merge as mergeProps, untrack } from 'solid-js';
|
|
3
|
+
import { sharedConfig, enableServerComponentHydration, resolvedTable, viewOf, OmitView, hasStaticKeys, SOURCE_MEMO, sourceHas, SOURCE_OMIT, sourceGet, sourceKeys, SOURCE_PROXY, SOURCE_PLAIN, dynamicCore } from 'solid-js/internal';
|
|
3
4
|
|
|
4
5
|
const DOMWithState = {
|
|
5
6
|
INPUT: {
|
|
@@ -48,6 +49,7 @@ const Namespaces = {
|
|
|
48
49
|
const VoidElements = /*#__PURE__*/new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr"]);
|
|
49
50
|
const RawTextElements = /*#__PURE__*/new Set(["style", "script", "noscript", "template", "textarea", "title"]);
|
|
50
51
|
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(","));
|
|
52
|
+
const COMPOSED_BODY_FRAMING = /*#__PURE__*/new Set(["content-length", "content-encoding", "transfer-encoding"]);
|
|
51
53
|
|
|
52
54
|
const transparentOptions = {
|
|
53
55
|
transparent: true,
|
|
@@ -56,90 +58,76 @@ const transparentOptions = {
|
|
|
56
58
|
const syncOptions = {
|
|
57
59
|
sync: true
|
|
58
60
|
};
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
gate = createMemo(() => promise);
|
|
71
|
-
});
|
|
72
|
-
assetGates.set(promise, gate);
|
|
73
|
-
}
|
|
74
|
-
gate();
|
|
75
|
-
};
|
|
61
|
+
function effect(fn, effectFn, options) {
|
|
62
|
+
const nodeOptions = options ? {
|
|
63
|
+
sync: true,
|
|
64
|
+
...options,
|
|
65
|
+
transparent: !options.scope
|
|
66
|
+
} : transparentOptions;
|
|
67
|
+
createRenderEffect(fn, effectFn, nodeOptions);
|
|
68
|
+
}
|
|
69
|
+
function memo(fn) {
|
|
70
|
+
return createMemo(() => fn(), syncOptions);
|
|
71
|
+
}
|
|
76
72
|
|
|
77
73
|
function reconcileArrays(parentNode, a, b, marker) {
|
|
74
|
+
let active = parentNode.moveBefore && parentNode.isConnected && document.activeElement;
|
|
75
|
+
if (active === document.body) active = null;
|
|
76
|
+
const slot = marker || parentNode;
|
|
77
|
+
const insert = (n, ref) => {
|
|
78
|
+
active && n.isConnected && n.contains(active) ? parentNode.moveBefore(n, ref) : parentNode.insertBefore(n, ref);
|
|
79
|
+
if (marker || n[$$SLOT]) n[$$SLOT] = slot;
|
|
80
|
+
};
|
|
81
|
+
if (!a.length) {
|
|
82
|
+
for (const n of b) insert(n, marker);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const isLive = n => {
|
|
86
|
+
if (!n) return false;
|
|
87
|
+
const tag = n[$$SLOT];
|
|
88
|
+
return n.parentNode === parentNode && (!tag || tag === slot);
|
|
89
|
+
};
|
|
78
90
|
let bLength = b.length,
|
|
79
91
|
aEnd = a.length,
|
|
80
92
|
bEnd = bLength,
|
|
81
93
|
aStart = 0,
|
|
82
94
|
bStart = 0,
|
|
83
95
|
tail = a[aEnd - 1],
|
|
84
|
-
|
|
85
|
-
after = tail.parentNode === parentNode && (!tailTag || tailTag === marker) ? tail.nextSibling : marker || null,
|
|
96
|
+
after = isLive(tail) ? tail.nextSibling : marker || null,
|
|
86
97
|
map = null,
|
|
87
98
|
anchor,
|
|
88
99
|
anchorTag;
|
|
89
|
-
const isLive = n => {
|
|
90
|
-
if (!n) return false;
|
|
91
|
-
const tag = n[$$SLOT];
|
|
92
|
-
return n.parentNode === parentNode && (!tag || tag === marker);
|
|
93
|
-
};
|
|
94
100
|
while (aStart < aEnd || bStart < bEnd) {
|
|
95
|
-
if (a[aStart] === b[bStart]
|
|
101
|
+
if (a[aStart] === b[bStart]) {
|
|
96
102
|
aStart++;
|
|
97
103
|
bStart++;
|
|
98
104
|
continue;
|
|
99
105
|
}
|
|
100
|
-
while (a[aEnd - 1] === b[bEnd - 1]
|
|
106
|
+
while (aEnd > aStart && bEnd > bStart && a[aEnd - 1] === b[bEnd - 1]) {
|
|
101
107
|
aEnd--;
|
|
102
108
|
bEnd--;
|
|
103
109
|
}
|
|
104
110
|
if (aEnd === aStart) {
|
|
105
|
-
let
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
const prevTag = prev[$$SLOT];
|
|
110
|
-
node = prev.parentNode === parentNode && (!prevTag || prevTag === marker) ? prev.nextSibling : after;
|
|
111
|
-
} else node = b[bEnd - bStart];
|
|
112
|
-
} else node = after;
|
|
113
|
-
while (bStart < bEnd) {
|
|
114
|
-
const n = b[bStart++];
|
|
115
|
-
parentNode.insertBefore(n, node);
|
|
116
|
-
if (marker) n[$$SLOT] = marker;
|
|
117
|
-
}
|
|
111
|
+
let k = bEnd;
|
|
112
|
+
while (k < bLength && !isLive(b[k])) k++;
|
|
113
|
+
const node = k < bLength ? b[k] : after;
|
|
114
|
+
while (bStart < bEnd) insert(b[bStart++], node);
|
|
118
115
|
} else if (bEnd === bStart) {
|
|
119
116
|
while (aStart < aEnd) {
|
|
120
117
|
const n = a[aStart++];
|
|
121
|
-
if (!map || !map.has(n))
|
|
122
|
-
const tag = n[$$SLOT];
|
|
123
|
-
if (n.parentNode === parentNode && (!tag || tag === marker)) n.remove();
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
} else if ((anchor = a[aStart]) === b[bEnd - 1] && b[bStart] === a[aEnd - 1] && anchor.parentNode === parentNode && (!(anchorTag = anchor[$$SLOT]) || anchorTag === marker)) {
|
|
127
|
-
if (marker) {
|
|
128
|
-
do {
|
|
129
|
-
const n = a[--aEnd];
|
|
130
|
-
parentNode.insertBefore(n, anchor);
|
|
131
|
-
n[$$SLOT] = marker;
|
|
132
|
-
bStart++;
|
|
133
|
-
if (aStart >= aEnd - 1 || bStart >= bEnd) break;
|
|
134
|
-
} while (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]);
|
|
135
|
-
} else {
|
|
136
|
-
do {
|
|
137
|
-
parentNode.insertBefore(a[--aEnd], anchor);
|
|
138
|
-
bStart++;
|
|
139
|
-
if (aStart >= aEnd - 1 || bStart >= bEnd) break;
|
|
140
|
-
} while (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]);
|
|
118
|
+
if ((!map || !map.has(n)) && isLive(n)) n.remove();
|
|
141
119
|
}
|
|
120
|
+
} else if ((anchor = a[aStart]) === b[bEnd - 1] && b[bStart] === a[aEnd - 1] && anchor.parentNode === parentNode && (!(anchorTag = anchor[$$SLOT]) || anchorTag === slot)) {
|
|
121
|
+
do {
|
|
122
|
+
insert(a[--aEnd], anchor);
|
|
123
|
+
bStart++;
|
|
124
|
+
if (aStart >= aEnd - 1 || bStart >= bEnd) break;
|
|
125
|
+
} while (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]);
|
|
142
126
|
} else {
|
|
127
|
+
if (!isLive(a[aStart])) {
|
|
128
|
+
aStart++;
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
143
131
|
if (!map) {
|
|
144
132
|
map = new Map();
|
|
145
133
|
let i = bStart;
|
|
@@ -156,31 +144,16 @@ function reconcileArrays(parentNode, a, b, marker) {
|
|
|
156
144
|
sequence++;
|
|
157
145
|
}
|
|
158
146
|
if (sequence > index - bStart) {
|
|
159
|
-
const
|
|
160
|
-
|
|
161
|
-
const node = head.parentNode === parentNode && (!headTag || headTag === marker) ? head : after;
|
|
162
|
-
while (bStart < index) {
|
|
163
|
-
const n = b[bStart++];
|
|
164
|
-
parentNode.insertBefore(n, node);
|
|
165
|
-
if (marker) n[$$SLOT] = marker;
|
|
166
|
-
}
|
|
147
|
+
const node = a[aStart];
|
|
148
|
+
while (bStart < index) insert(b[bStart++], node);
|
|
167
149
|
} else {
|
|
168
|
-
const
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
if (
|
|
172
|
-
parentNode.replaceChild(newNode, oldNode);
|
|
173
|
-
} else {
|
|
174
|
-
parentNode.insertBefore(newNode, after);
|
|
175
|
-
}
|
|
176
|
-
if (marker) newNode[$$SLOT] = marker;
|
|
150
|
+
const newNode = b[bStart++],
|
|
151
|
+
node = a[aStart++];
|
|
152
|
+
active && parentNode.contains(active) ? insert(newNode, node) : parentNode.replaceChild(newNode, node);
|
|
153
|
+
if (marker || newNode[$$SLOT]) newNode[$$SLOT] = slot;
|
|
177
154
|
}
|
|
178
155
|
} else aStart++;
|
|
179
|
-
} else
|
|
180
|
-
const n = a[aStart++];
|
|
181
|
-
const nTag = n[$$SLOT];
|
|
182
|
-
if (n.parentNode === parentNode && (!nTag || nTag === marker)) n.remove();
|
|
183
|
-
}
|
|
156
|
+
} else a[aStart++].remove();
|
|
184
157
|
}
|
|
185
158
|
}
|
|
186
159
|
}
|
|
@@ -217,11 +190,28 @@ function classifyHeadTag(desc) {
|
|
|
217
190
|
resource: false
|
|
218
191
|
};
|
|
219
192
|
}
|
|
193
|
+
function qualifierValue(name, value) {
|
|
194
|
+
if (value == null || value === false) return null;
|
|
195
|
+
if (name === "imagesrcset" || name === "imagesizes") return typeof value === "string" && value !== "" ? value : null;
|
|
196
|
+
const v = value === true ? "" : String(value);
|
|
197
|
+
if (name === "as") return asciiLowerCase(v);
|
|
198
|
+
if (name !== "crossorigin") return v;
|
|
199
|
+
return v.length === 15 && v.toLowerCase() === "use-credentials" ? v.toLowerCase() : "anonymous";
|
|
200
|
+
}
|
|
201
|
+
function asciiLowerCase(value) {
|
|
202
|
+
return value.replace(/[A-Z]/g, c => String.fromCharCode(c.charCodeAt(0) + 32));
|
|
203
|
+
}
|
|
204
|
+
const JSON_SCRIPT_TYPE = /^(?:importmap|speculationrules)$|^[\t\n\r ]*(?:application\/json|text\/json|[\w!#$%&'*+.^`|~-]+\/[\w!#$%&'*+.^`|~-]*\+json)[\t\n\r ]*(?:;|$)/i;
|
|
205
|
+
function headBodyText(tag, props, text) {
|
|
206
|
+
return tag === "script" && JSON_SCRIPT_TYPE.test(String(props.type)) ? text.replace(/</g, "\\u003C") : text;
|
|
207
|
+
}
|
|
220
208
|
function resourceIdentity(tag, props) {
|
|
221
|
-
|
|
209
|
+
const url = String(props.href || props.src || "");
|
|
210
|
+
let id = "res:" + tag + ":" + (props.rel || "") + ":" + url.length + ":" + url;
|
|
222
211
|
for (let i = 0; i < RESOURCE_QUALIFIERS.length; i++) {
|
|
223
212
|
const q = RESOURCE_QUALIFIERS[i];
|
|
224
|
-
|
|
213
|
+
const value = qualifierValue(q, props[q]);
|
|
214
|
+
if (value !== null) id += ":" + q + "=" + value.length + ":" + value;
|
|
225
215
|
}
|
|
226
216
|
return id;
|
|
227
217
|
}
|
|
@@ -300,6 +290,7 @@ function serializeCookie(name, value, options = {}) {
|
|
|
300
290
|
if (options.expires) cookie += `; Expires=${options.expires.toUTCString()}`;
|
|
301
291
|
if (options.httpOnly) cookie += "; HttpOnly";
|
|
302
292
|
if (options.secure) cookie += "; Secure";
|
|
293
|
+
if (options.partitioned) cookie += "; Partitioned";
|
|
303
294
|
if (options.sameSite) {
|
|
304
295
|
const sameSite = options.sameSite.toLowerCase();
|
|
305
296
|
cookie += `; SameSite=${sameSite === "none" ? "None" : sameSite === "strict" ? "Strict" : "Lax"}`;
|
|
@@ -307,7 +298,7 @@ function serializeCookie(name, value, options = {}) {
|
|
|
307
298
|
return cookie;
|
|
308
299
|
}
|
|
309
300
|
const FLASH_COOKIE = "flash";
|
|
310
|
-
const FLASH_MATCHER =
|
|
301
|
+
const FLASH_MATCHER = /(?:^|;\s*)flash=([^;]+)/;
|
|
311
302
|
function hasFlashCookie(cookieHeader) {
|
|
312
303
|
return !!cookieHeader && FLASH_MATCHER.test(cookieHeader);
|
|
313
304
|
}
|
|
@@ -328,30 +319,91 @@ function getServerFunctionRPC() {
|
|
|
328
319
|
return globalThis[SERVER_FUNCTION_RPC];
|
|
329
320
|
}
|
|
330
321
|
|
|
331
|
-
const
|
|
322
|
+
const assetGates = new WeakMap();
|
|
323
|
+
const waitAsset = promise => {
|
|
324
|
+
let gate = assetGates.get(promise);
|
|
325
|
+
if (!gate) {
|
|
326
|
+
runWithOwner(null, () => {
|
|
327
|
+
gate = createMemo(() => promise, {
|
|
328
|
+
transparent: true
|
|
329
|
+
});
|
|
330
|
+
});
|
|
331
|
+
assetGates.set(promise, gate);
|
|
332
|
+
}
|
|
333
|
+
gate();
|
|
334
|
+
};
|
|
335
|
+
const EVENT_KEY = "_$$";
|
|
336
|
+
const $$EVENT_OWNER = "_$SOLID_EVENT_OWNER";
|
|
337
|
+
const $$EVENT_TUPLE = Symbol();
|
|
338
|
+
const hasOwn = Object.prototype.hasOwnProperty;
|
|
332
339
|
const INNER_OWNED = {};
|
|
333
340
|
const delegatedEvents = new Set();
|
|
334
341
|
const delegatedContainers = new Map();
|
|
335
|
-
function
|
|
342
|
+
function voidFn() {}
|
|
343
|
+
function generateHydrationScript(_options) {
|
|
344
|
+
return "";
|
|
345
|
+
}
|
|
346
|
+
function HydrationScript(_props) {
|
|
347
|
+
return null;
|
|
348
|
+
}
|
|
349
|
+
const getRequestEvent = voidFn;
|
|
350
|
+
const getHydrationWriter = voidFn;
|
|
351
|
+
function takeHydrationValue(key) {
|
|
352
|
+
const registry = globalThis._$HY && globalThis._$HY.r;
|
|
353
|
+
if (!registry || !(key in registry)) return;
|
|
354
|
+
const v = registry[key];
|
|
355
|
+
delete registry[key];
|
|
356
|
+
if (v !== null && typeof v === "object" && typeof v.then === "function") {
|
|
357
|
+
if (v.s === 1) return {
|
|
358
|
+
status: "resolved",
|
|
359
|
+
value: v.v
|
|
360
|
+
};
|
|
361
|
+
if (v.s === 2) {
|
|
362
|
+
v.then(undefined, voidFn);
|
|
363
|
+
return {
|
|
364
|
+
status: "rejected",
|
|
365
|
+
error: v.v
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
return {
|
|
369
|
+
status: "pending",
|
|
370
|
+
promise: v
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
return {
|
|
374
|
+
status: "resolved",
|
|
375
|
+
value: v
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
function setLinkClaim(_handler) {
|
|
379
|
+
return false;
|
|
380
|
+
}
|
|
381
|
+
function hasServerLinkState() {
|
|
382
|
+
const registry = globalThis._$HY && globalThis._$HY.r;
|
|
383
|
+
return !!registry && registry.links === 1;
|
|
384
|
+
}
|
|
385
|
+
const getTraceContext = voidFn;
|
|
386
|
+
function render(code, element, init, options = {}) {
|
|
336
387
|
let disposer;
|
|
337
388
|
registerDelegatedRoot(element);
|
|
338
389
|
try {
|
|
339
390
|
createRoot(dispose => {
|
|
340
391
|
disposer = dispose;
|
|
341
|
-
if (
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
}
|
|
392
|
+
if (options.onError) getOwner()[ROOT_ERROR_HOOK] = options.onError;
|
|
393
|
+
const tree = code();
|
|
394
|
+
if (element === document) effect(() => flatten(tree), () => {});else insert(element, () => tree, element.firstChild ? null : undefined, init, {
|
|
395
|
+
...options.insertOptions,
|
|
396
|
+
schedule: true
|
|
397
|
+
});
|
|
348
398
|
}, {
|
|
349
399
|
id: options.renderId
|
|
350
400
|
});
|
|
401
|
+
flush();
|
|
351
402
|
} catch (err) {
|
|
352
403
|
if (disposer) disposer();
|
|
353
404
|
unregisterDelegatedRoot(element);
|
|
354
405
|
throw err;
|
|
406
|
+
} finally {
|
|
355
407
|
}
|
|
356
408
|
return () => {
|
|
357
409
|
disposer();
|
|
@@ -362,7 +414,8 @@ function render$1(code, element, init, options = {}) {
|
|
|
362
414
|
function create(html, bypassGuard, flag) {
|
|
363
415
|
const t = document.createElement("template");
|
|
364
416
|
t.innerHTML = html;
|
|
365
|
-
|
|
417
|
+
const node = t.content.firstChild;
|
|
418
|
+
return flag === 2 ? node.firstChild : node;
|
|
366
419
|
}
|
|
367
420
|
function template(html, flag) {
|
|
368
421
|
let node;
|
|
@@ -370,8 +423,7 @@ function template(html, flag) {
|
|
|
370
423
|
return fn;
|
|
371
424
|
}
|
|
372
425
|
function delegateEvents(eventNames) {
|
|
373
|
-
for (
|
|
374
|
-
const name = eventNames[i];
|
|
426
|
+
for (const name of eventNames) {
|
|
375
427
|
if (!delegatedEvents.has(name)) {
|
|
376
428
|
delegatedEvents.add(name);
|
|
377
429
|
delegatedContainers.forEach((state, container) => attachDelegatedEvent(name, container, state));
|
|
@@ -413,12 +465,16 @@ function attachDelegatedEvent(name, container, state) {
|
|
|
413
465
|
state.handlers.set(name, handler);
|
|
414
466
|
container.addEventListener(name, handler);
|
|
415
467
|
}
|
|
468
|
+
function dispatchAsInteraction(e, fn) {
|
|
469
|
+
return fn();
|
|
470
|
+
}
|
|
416
471
|
function getDelegatedRoot(node) {
|
|
417
472
|
while (node) {
|
|
418
473
|
if (delegatedContainers.get(node)?.roots) return node;
|
|
419
|
-
node = node
|
|
474
|
+
node = parentOf(node);
|
|
420
475
|
}
|
|
421
476
|
}
|
|
477
|
+
const parentOf = node => node._$host || node.parentNode || node.host;
|
|
422
478
|
function findOwner(target, state) {
|
|
423
479
|
let node = target;
|
|
424
480
|
let distance = 0;
|
|
@@ -428,22 +484,40 @@ function findOwner(target, state) {
|
|
|
428
484
|
distance
|
|
429
485
|
};
|
|
430
486
|
distance++;
|
|
431
|
-
node = node
|
|
487
|
+
node = parentOf(node);
|
|
432
488
|
}
|
|
433
489
|
}
|
|
434
490
|
function setProperty(node, name, value) {
|
|
435
491
|
if (isHydrating(node)) return;
|
|
492
|
+
const nodeName = node.nodeName;
|
|
493
|
+
if (name === "value" && nodeName === "SELECT") writeSelectValue(node, value);else if ((name === "value" || name === "defaultValue") && (nodeName === "INPUT" || nodeName === "TEXTAREA")) {
|
|
494
|
+
if (value == null && /^(checkbox|radio)$/.test(node.type)) node.removeAttribute("value");else node[name] = value ?? "";
|
|
495
|
+
} else node[name] = value;
|
|
496
|
+
reclaimAttribute(node, name);
|
|
497
|
+
}
|
|
498
|
+
function setStatefulProperty(node, name, value) {
|
|
436
499
|
node[name] = value;
|
|
437
500
|
}
|
|
438
501
|
let claimHandlers = null;
|
|
439
|
-
const
|
|
440
|
-
|
|
502
|
+
const claimAttributeSets = [];
|
|
503
|
+
const CLAIM_SEAM = Symbol.for("solid.element-claims");
|
|
504
|
+
function registerElementClaim(handler, options) {
|
|
441
505
|
(claimHandlers || (claimHandlers = globalThis[CLAIM_SEAM] = [])).push(handler);
|
|
506
|
+
claimAttributeSets.push(options?.attributes || ["href", "action"]);
|
|
442
507
|
return () => {
|
|
443
508
|
const index = claimHandlers.indexOf(handler);
|
|
444
|
-
index > -1
|
|
509
|
+
if (index > -1) {
|
|
510
|
+
claimHandlers.splice(index, 1);
|
|
511
|
+
claimAttributeSets.splice(index, 1);
|
|
512
|
+
}
|
|
445
513
|
};
|
|
446
514
|
}
|
|
515
|
+
function runClaimHandlers(handlers, node) {
|
|
516
|
+
for (let i = 0; i < handlers.length; i++) handlers[i](node);
|
|
517
|
+
}
|
|
518
|
+
function reclaimAttribute(node, name) {
|
|
519
|
+
if (claimHandlers !== null && node._$claimed && claimAttributeSets.some(set => set.includes(name.slice(name.indexOf(":") + 1)))) runClaimHandlers(claimHandlers, node);
|
|
520
|
+
}
|
|
447
521
|
const CLAIMED_ELEMENTS = "a[href], form[action]";
|
|
448
522
|
function claimElementTree(root) {
|
|
449
523
|
const handlers = globalThis[CLAIM_SEAM];
|
|
@@ -451,46 +525,70 @@ function claimElementTree(root) {
|
|
|
451
525
|
const isElement = root.nodeType === 1;
|
|
452
526
|
if (!isElement && root.nodeType !== 11) return root;
|
|
453
527
|
if (isElement && root.matches(CLAIMED_ELEMENTS)) {
|
|
454
|
-
|
|
528
|
+
root._$claimed = true;
|
|
529
|
+
runClaimHandlers(handlers, root);
|
|
455
530
|
}
|
|
456
531
|
const found = root.querySelectorAll(CLAIMED_ELEMENTS);
|
|
457
532
|
for (let i = 0; i < found.length; i++) {
|
|
458
|
-
|
|
533
|
+
found[i]._$claimed = true;
|
|
534
|
+
runClaimHandlers(handlers, found[i]);
|
|
459
535
|
}
|
|
460
536
|
return root;
|
|
461
537
|
}
|
|
462
|
-
function claimElement(node) {
|
|
463
|
-
if (claimHandlers !== null) {
|
|
464
|
-
|
|
538
|
+
function claimElement(node, owner) {
|
|
539
|
+
if (claimHandlers !== null && !node._$claimed) {
|
|
540
|
+
node._$claimed = true;
|
|
541
|
+
if (owner === undefined) runClaimHandlers(claimHandlers, node);else runWithOwner(owner, () => runClaimHandlers(claimHandlers, node));
|
|
465
542
|
}
|
|
466
543
|
return node;
|
|
467
544
|
}
|
|
468
545
|
function setAttribute(node, name, value) {
|
|
469
546
|
if (isHydrating(node)) return;
|
|
470
|
-
|
|
471
|
-
if (
|
|
547
|
+
const selectMultiple = name === "multiple" && node.localName === "select";
|
|
548
|
+
if (value == null || value === false) node.removeAttribute(name);else {
|
|
549
|
+
node.setAttribute(name, value === true ? "" : value);
|
|
550
|
+
if (selectMultiple && !node._$multiple) {
|
|
551
|
+
const options = node.options;
|
|
552
|
+
for (let i = 0; i < options.length; i++) {
|
|
553
|
+
if (options[i].defaultSelected) options[i].selected = true;
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
if (selectMultiple) node._$multiple = true;
|
|
558
|
+
reclaimAttribute(node, name);
|
|
472
559
|
}
|
|
473
560
|
function setAttributeNS(node, namespace, name, value) {
|
|
474
561
|
if (isHydrating(node)) return;
|
|
475
562
|
if (value == null || value === false) node.removeAttributeNS(namespace, name.indexOf(":") > -1 ? name.split(":").pop() : name);else node.setAttributeNS(namespace, name, value === true ? "" : value);
|
|
563
|
+
reclaimAttribute(node, name);
|
|
476
564
|
}
|
|
477
565
|
function className(node, value, prev) {
|
|
478
|
-
if (
|
|
566
|
+
if (typeof value === "number") value = "" + value;
|
|
567
|
+
if (typeof prev === "number") prev = "" + prev;
|
|
568
|
+
if (isHydrating(node)) {
|
|
569
|
+
node._$classes = value && typeof value === "object" ? classListToObject(value) : undefined;
|
|
570
|
+
return;
|
|
571
|
+
}
|
|
479
572
|
if (value == null || value === false) {
|
|
480
|
-
prev
|
|
573
|
+
if (prev || node._$classes) {
|
|
574
|
+
node.removeAttribute("class");
|
|
575
|
+
node._$classes = undefined;
|
|
576
|
+
}
|
|
481
577
|
return;
|
|
482
578
|
}
|
|
483
579
|
if (typeof value === "string") {
|
|
580
|
+
node._$classes = undefined;
|
|
484
581
|
value !== prev && node.setAttribute("class", value);
|
|
485
582
|
return;
|
|
486
583
|
}
|
|
584
|
+
let applied;
|
|
487
585
|
if (typeof prev === "string") {
|
|
488
|
-
|
|
586
|
+
applied = {};
|
|
489
587
|
node.removeAttribute("class");
|
|
490
|
-
} else
|
|
588
|
+
} else applied = node._$classes || classListToObject(prev || {});
|
|
491
589
|
value = classListToObject(value);
|
|
492
|
-
const classKeys = Object.keys(value
|
|
493
|
-
const prevKeys = Object.keys(
|
|
590
|
+
const classKeys = Object.keys(value);
|
|
591
|
+
const prevKeys = Object.keys(applied);
|
|
494
592
|
let i, len;
|
|
495
593
|
for (i = 0, len = prevKeys.length; i < len; i++) {
|
|
496
594
|
const key = prevKeys[i];
|
|
@@ -500,22 +598,34 @@ function className(node, value, prev) {
|
|
|
500
598
|
for (i = 0, len = classKeys.length; i < len; i++) {
|
|
501
599
|
const key = classKeys[i],
|
|
502
600
|
classValue = !!value[key];
|
|
503
|
-
if (!key || key === "undefined" ||
|
|
601
|
+
if (!key || key === "undefined" || applied[key] === classValue || !classValue) continue;
|
|
504
602
|
node.classList.add(key);
|
|
505
603
|
}
|
|
604
|
+
node._$classes = value;
|
|
506
605
|
}
|
|
507
606
|
function addEvent(node, name, handler, delegate) {
|
|
508
607
|
if (delegate) {
|
|
608
|
+
const key = EVENT_KEY + name;
|
|
609
|
+
let data;
|
|
509
610
|
if (Array.isArray(handler)) {
|
|
510
|
-
|
|
511
|
-
node[
|
|
512
|
-
} else node[
|
|
513
|
-
|
|
611
|
+
data = handler[1];
|
|
612
|
+
node[key] = handler[0];
|
|
613
|
+
} else node[key] = handler;
|
|
614
|
+
node[`${key}Data`] = data;
|
|
615
|
+
return;
|
|
616
|
+
}
|
|
617
|
+
if (Array.isArray(handler)) {
|
|
514
618
|
const handlerFn = handler[0];
|
|
515
|
-
|
|
516
|
-
|
|
619
|
+
const listener = e => handlerFn.call(node, handler[1], e);
|
|
620
|
+
listener[$$EVENT_TUPLE] = handler;
|
|
621
|
+
node.addEventListener(name, listener);
|
|
622
|
+
return listener;
|
|
623
|
+
}
|
|
624
|
+
node.addEventListener(name, handler, typeof handler !== "function" && handler);
|
|
625
|
+
return handler;
|
|
517
626
|
}
|
|
518
627
|
function style(node, value, prev) {
|
|
628
|
+
if (isHydrating(node)) return;
|
|
519
629
|
if (!value) {
|
|
520
630
|
if (prev || node._$styles) {
|
|
521
631
|
setAttribute(node, "style");
|
|
@@ -540,12 +650,13 @@ function style(node, value, prev) {
|
|
|
540
650
|
}
|
|
541
651
|
let v, s;
|
|
542
652
|
for (s in applied) {
|
|
543
|
-
if (value[s] == null) {
|
|
653
|
+
if (!hasOwn.call(value, s) || value[s] == null) {
|
|
544
654
|
nodeStyle.removeProperty(s);
|
|
545
655
|
delete applied[s];
|
|
546
656
|
}
|
|
547
657
|
}
|
|
548
658
|
for (s in value) {
|
|
659
|
+
if (!hasOwn.call(value, s)) continue;
|
|
549
660
|
v = value[s];
|
|
550
661
|
if (v != null && v !== applied[s]) {
|
|
551
662
|
nodeStyle.setProperty(s, v);
|
|
@@ -553,26 +664,124 @@ function style(node, value, prev) {
|
|
|
553
664
|
}
|
|
554
665
|
}
|
|
555
666
|
}
|
|
667
|
+
function readShallow(value) {
|
|
668
|
+
if (value === null || typeof value !== "object") return value;
|
|
669
|
+
if (Array.isArray(value)) return value.map(readShallow);
|
|
670
|
+
if (value[$PROXY] !== value) return value;
|
|
671
|
+
const keys = Reflect.ownKeys(value);
|
|
672
|
+
const out = {};
|
|
673
|
+
for (let i = 0; i < keys.length; i++) {
|
|
674
|
+
const k = keys[i];
|
|
675
|
+
if (typeof k === "string") out[k] = value[k];
|
|
676
|
+
}
|
|
677
|
+
return out;
|
|
678
|
+
}
|
|
556
679
|
function setStyleProperty(node, name, value) {
|
|
680
|
+
if (isHydrating(node)) return;
|
|
557
681
|
value != null ? node.style.setProperty(name, value) : node.style.removeProperty(name);
|
|
558
682
|
}
|
|
559
|
-
function spread(node, props
|
|
683
|
+
function spread(node, props, skipChildren, skip, name, loc) {
|
|
560
684
|
const prevProps = {};
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
const r =
|
|
564
|
-
(typeof r === "function" || Array.isArray(r))
|
|
565
|
-
|
|
685
|
+
const owner = claimHandlers !== null && (node.localName === "a" || node.localName === "form") ? getOwner() : undefined;
|
|
686
|
+
const apply = newProps => {
|
|
687
|
+
const r = newProps.ref;
|
|
688
|
+
if (r !== prevProps.ref && (typeof r === "function" || Array.isArray(r))) ref(() => r, node);
|
|
689
|
+
assign(node, newProps, true, prevProps, true);
|
|
690
|
+
if (owner !== undefined) claimElement(node, owner);
|
|
691
|
+
};
|
|
692
|
+
if (Array.isArray(props)) {
|
|
693
|
+
effect(() => collectSources({}, props, undefined, skip), apply);
|
|
694
|
+
if (!skipChildren && !(skip !== undefined && skip("children"))) insert(node, () => {
|
|
695
|
+
for (let i = props.length - 1; i >= 0; i--) {
|
|
696
|
+
const s = resolveSource(props[i]);
|
|
697
|
+
if (s != null && entryHas(s, "children")) return entryGet(s, "children");
|
|
698
|
+
}
|
|
699
|
+
});
|
|
700
|
+
return prevProps;
|
|
701
|
+
}
|
|
566
702
|
effect(() => {
|
|
703
|
+
const source = resolveSource(props);
|
|
567
704
|
const newProps = {};
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
705
|
+
const table = resolvedTable(source);
|
|
706
|
+
if (table !== undefined) return collectTable(newProps, table, skip);
|
|
707
|
+
if (source != null) {
|
|
708
|
+
const view = viewOf(source);
|
|
709
|
+
if (view instanceof OmitView) collectProps(newProps, view, SOURCE_OMIT, skip);else if (view !== undefined) collectSources(newProps, view.sources, view.kinds, skip);else collectProps(newProps, source, $PROXY in source ? SOURCE_PROXY : SOURCE_PLAIN, skip);
|
|
571
710
|
}
|
|
572
711
|
return newProps;
|
|
573
|
-
},
|
|
712
|
+
}, apply);
|
|
713
|
+
if (!skipChildren && !(skip !== undefined && skip("children"))) {
|
|
714
|
+
if (typeof props !== "function" && props != null && hasStaticKeys(props)) {
|
|
715
|
+
const desc = Object.getOwnPropertyDescriptor(props, "children");
|
|
716
|
+
if (desc !== undefined) {
|
|
717
|
+
if (desc.get === undefined) insert(node, desc.value);else insert(node, () => props.children);
|
|
718
|
+
}
|
|
719
|
+
} else insert(node, () => {
|
|
720
|
+
const source = resolveSource(props);
|
|
721
|
+
return source != null && entryHas(source, "children") ? entryGet(source, "children") : undefined;
|
|
722
|
+
});
|
|
723
|
+
}
|
|
574
724
|
return prevProps;
|
|
575
725
|
}
|
|
726
|
+
function collectTable(out, table, skip) {
|
|
727
|
+
for (const [prop, leaf] of table) {
|
|
728
|
+
if (typeof prop !== "string" || prop === "children") continue;
|
|
729
|
+
if (skip !== undefined && skip(prop)) continue;
|
|
730
|
+
const v = leaf[prop];
|
|
731
|
+
out[prop] = prop === "style" || prop === "class" ? readShallow(v) : v;
|
|
732
|
+
}
|
|
733
|
+
return out;
|
|
734
|
+
}
|
|
735
|
+
function resolveSource(s) {
|
|
736
|
+
return typeof s === "function" ? s() : s;
|
|
737
|
+
}
|
|
738
|
+
function entryHas(s, key) {
|
|
739
|
+
const view = viewOf(s);
|
|
740
|
+
return view instanceof OmitView ? sourceHas(view, SOURCE_OMIT, key) : key in s;
|
|
741
|
+
}
|
|
742
|
+
function entryGet(s, key) {
|
|
743
|
+
const view = viewOf(s);
|
|
744
|
+
return view instanceof OmitView ? sourceGet(view, SOURCE_OMIT, key) : s[key];
|
|
745
|
+
}
|
|
746
|
+
function collectSources(out, sources, kinds, skip) {
|
|
747
|
+
const resolved = [];
|
|
748
|
+
const resolvedKinds = [];
|
|
749
|
+
for (let i = 0; i < sources.length; i++) pushEntry(resolved, resolvedKinds, sources[i], kinds !== undefined ? kinds[i] : SOURCE_MEMO);
|
|
750
|
+
for (let i = 0; i < resolved.length; i++) collectProps(out, resolved[i], resolvedKinds[i], skip, resolved, resolvedKinds, i + 1);
|
|
751
|
+
return out;
|
|
752
|
+
}
|
|
753
|
+
function pushEntry(resolved, kinds, s, kind) {
|
|
754
|
+
if (kind !== SOURCE_MEMO) {
|
|
755
|
+
resolved.push(s);
|
|
756
|
+
kinds.push(kind);
|
|
757
|
+
return;
|
|
758
|
+
}
|
|
759
|
+
s = resolveSource(s);
|
|
760
|
+
if (s == null) return;
|
|
761
|
+
const view = viewOf(s);
|
|
762
|
+
if (view instanceof OmitView) {
|
|
763
|
+
resolved.push(view);
|
|
764
|
+
kinds.push(SOURCE_OMIT);
|
|
765
|
+
} else if (view !== undefined) {
|
|
766
|
+
const f = view.sources,
|
|
767
|
+
k = view.kinds;
|
|
768
|
+
for (let j = 0; j < f.length; j++) pushEntry(resolved, kinds, f[j], k[j]);
|
|
769
|
+
} else {
|
|
770
|
+
resolved.push(s);
|
|
771
|
+
kinds.push($PROXY in s ? SOURCE_PROXY : SOURCE_PLAIN);
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
function collectProps(out, s, kind, skip, later, laterKinds, from) {
|
|
775
|
+
const keys = sourceKeys(s, kind);
|
|
776
|
+
outer: for (let i = 0; i < keys.length; i++) {
|
|
777
|
+
const prop = keys[i];
|
|
778
|
+
if (typeof prop !== "string" || prop === "children") continue;
|
|
779
|
+
if (skip !== undefined && skip(prop)) continue;
|
|
780
|
+
if (later !== undefined) for (let j = from; j < later.length; j++) if (sourceHas(later[j], laterKinds[j], prop)) continue outer;
|
|
781
|
+
const v = sourceGet(s, kind, prop);
|
|
782
|
+
out[prop] = prop === "style" || prop === "class" ? readShallow(v) : v;
|
|
783
|
+
}
|
|
784
|
+
}
|
|
576
785
|
function dynamicProperty(props, key) {
|
|
577
786
|
const src = props[key];
|
|
578
787
|
Object.defineProperty(props, key, {
|
|
@@ -590,11 +799,6 @@ function ref(fn, element) {
|
|
|
590
799
|
const resolved = untrack(fn);
|
|
591
800
|
runWithOwner(null, () => applyRef(resolved, element));
|
|
592
801
|
}
|
|
593
|
-
const PURE_ROW = Symbol.for("solid.pure-row");
|
|
594
|
-
function rowProof(fn) {
|
|
595
|
-
fn[PURE_ROW] = true;
|
|
596
|
-
return fn;
|
|
597
|
-
}
|
|
598
802
|
function scope(fn) {
|
|
599
803
|
fn.$s = true;
|
|
600
804
|
return fn;
|
|
@@ -603,19 +807,19 @@ const SCOPE_OPTIONS = {
|
|
|
603
807
|
scope: true
|
|
604
808
|
};
|
|
605
809
|
let hydrationRt = null;
|
|
810
|
+
let selectInsert = null;
|
|
606
811
|
function installHydrationRuntime() {
|
|
607
812
|
hydrationRt = {
|
|
608
813
|
claimInitial(parent, multi, initial) {
|
|
609
814
|
if (isHydrating(parent)) {
|
|
610
|
-
if (!multi && initial === undefined && parent) initial =
|
|
611
|
-
if (Array.isArray(initial)) stripTextSeparators(initial);
|
|
815
|
+
if (!multi && initial === undefined && parent) initial = claimChildNodes(parent);else if (Array.isArray(initial)) stripTextSeparators(initial);
|
|
612
816
|
}
|
|
613
817
|
return initial;
|
|
614
818
|
},
|
|
615
819
|
reclaimRegion(current, parent, marker) {
|
|
616
|
-
if (!sharedConfig.hydrating ||
|
|
820
|
+
if (!sharedConfig.hydrating || current == null || !parent.isConnected) return current;
|
|
617
821
|
const first = Array.isArray(current) ? current[0] : current;
|
|
618
|
-
if (
|
|
822
|
+
if (first == null || first.isConnected) return current;
|
|
619
823
|
let nodes;
|
|
620
824
|
if (marker) {
|
|
621
825
|
nodes = [];
|
|
@@ -632,7 +836,7 @@ function installHydrationRuntime() {
|
|
|
632
836
|
nodes.unshift(node);
|
|
633
837
|
node = node.previousSibling;
|
|
634
838
|
}
|
|
635
|
-
} else
|
|
839
|
+
} else return claimChildNodes(parent);
|
|
636
840
|
return stripTextSeparators(nodes);
|
|
637
841
|
},
|
|
638
842
|
dedupEvent(e) {
|
|
@@ -645,23 +849,35 @@ function stripTextSeparators(nodes) {
|
|
|
645
849
|
for (let i = 0; i < nodes.length; i++) {
|
|
646
850
|
const node = nodes[i],
|
|
647
851
|
t = node.nodeType;
|
|
648
|
-
if (t === 8) {
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
}
|
|
654
|
-
if (v.startsWith("pl-")) continue;
|
|
655
|
-
} else if (t === 1 && node.localName === "template" && node.id.startsWith("pl-")) continue;
|
|
852
|
+
if (t === 8 && node.nodeValue === "!$") {
|
|
853
|
+
node.remove();
|
|
854
|
+
continue;
|
|
855
|
+
}
|
|
856
|
+
if (isPlaceholderScaffolding(node, t)) continue;
|
|
656
857
|
nodes[j++] = node;
|
|
657
858
|
}
|
|
658
859
|
nodes.length = j;
|
|
659
860
|
return nodes;
|
|
660
861
|
}
|
|
661
|
-
function
|
|
662
|
-
|
|
663
|
-
|
|
862
|
+
function claimChildNodes(parent) {
|
|
863
|
+
const live = parent.childNodes;
|
|
864
|
+
const out = [];
|
|
865
|
+
for (let i = 0, n = live.length; i < n; i++) {
|
|
866
|
+
const node = live[i],
|
|
867
|
+
t = node.nodeType;
|
|
868
|
+
if (t === 8 && node.nodeValue === "!$") {
|
|
869
|
+
node.remove();
|
|
870
|
+
i--;
|
|
871
|
+
n--;
|
|
872
|
+
continue;
|
|
873
|
+
}
|
|
874
|
+
if (isPlaceholderScaffolding(node, t)) continue;
|
|
875
|
+
out.push(node);
|
|
664
876
|
}
|
|
877
|
+
return out;
|
|
878
|
+
}
|
|
879
|
+
function isPlaceholderScaffolding(node, t) {
|
|
880
|
+
return t === 8 ? node.nodeValue.startsWith("pl-") : t === 1 && node.localName === "template" && node.id.startsWith("pl-");
|
|
665
881
|
}
|
|
666
882
|
function insert(parent, accessor, marker, initial, options) {
|
|
667
883
|
const multi = marker !== undefined;
|
|
@@ -682,17 +898,21 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
682
898
|
initial = [placeholder];
|
|
683
899
|
}
|
|
684
900
|
let current = initial;
|
|
685
|
-
|
|
901
|
+
let ran = false;
|
|
902
|
+
effect(() => {
|
|
686
903
|
if (hydrationRt !== null) current = hydrationRt.reclaimRegion(current, parent, marker);
|
|
687
904
|
const value = normalize(accessor(), current, multi, true);
|
|
905
|
+
const again = ran;
|
|
906
|
+
ran = true;
|
|
688
907
|
if (typeof value !== "function") return value;
|
|
908
|
+
const innerOptions = again && !(options && options.schedule) ? {
|
|
909
|
+
...options,
|
|
910
|
+
schedule: true
|
|
911
|
+
} : options;
|
|
689
912
|
effect(() => (hydrationRt !== null && (current = hydrationRt.reclaimRegion(current, parent, marker)), normalize(value, current, multi)), inner => {
|
|
690
913
|
current = insertExpression(parent, inner, current, marker);
|
|
691
914
|
host && tagHost(current, host);
|
|
692
|
-
},
|
|
693
|
-
...options,
|
|
694
|
-
schedule: true
|
|
695
|
-
} : options);
|
|
915
|
+
}, innerOptions);
|
|
696
916
|
return INNER_OWNED;
|
|
697
917
|
}, value => {
|
|
698
918
|
if (value === INNER_OWNED) return;
|
|
@@ -727,10 +947,16 @@ function assetEntryKey(descriptor) {
|
|
|
727
947
|
if (descriptor.policy === "exclusive") return "x|" + descriptor.key;
|
|
728
948
|
return descriptor.type === "inline-style" ? "i|" + descriptor.id : descriptor.type + "|" + descriptor.href;
|
|
729
949
|
}
|
|
730
|
-
function findAssetElement(selector, attr, value) {
|
|
950
|
+
function findAssetElement(selector, attr, value, qualifiers) {
|
|
731
951
|
const nodes = document.querySelectorAll(selector);
|
|
732
|
-
for (let i = 0; i < nodes.length; i++) {
|
|
733
|
-
if (nodes[i].getAttribute(attr)
|
|
952
|
+
outer: for (let i = 0; i < nodes.length; i++) {
|
|
953
|
+
if (nodes[i].getAttribute(attr) !== value) continue;
|
|
954
|
+
if (!qualifiers) return nodes[i];
|
|
955
|
+
for (let q = 0; q < RESOURCE_QUALIFIERS.length; q++) {
|
|
956
|
+
const name = RESOURCE_QUALIFIERS[q];
|
|
957
|
+
if (qualifierValue(name, qualifiers[name]) !== qualifierValue(name, nodes[i].getAttribute(name))) continue outer;
|
|
958
|
+
}
|
|
959
|
+
return nodes[i];
|
|
734
960
|
}
|
|
735
961
|
return null;
|
|
736
962
|
}
|
|
@@ -774,7 +1000,7 @@ function trackAssetLoad(entry, adopted) {
|
|
|
774
1000
|
}
|
|
775
1001
|
entry.loadState = "pending";
|
|
776
1002
|
entry.loadPromise = new Promise(resolve => {
|
|
777
|
-
const settle = state => {
|
|
1003
|
+
const settle = entry.settle = state => {
|
|
778
1004
|
entry.loadState = state;
|
|
779
1005
|
resolve();
|
|
780
1006
|
};
|
|
@@ -886,6 +1112,7 @@ function acquireAsset(descriptor) {
|
|
|
886
1112
|
entry.timer = setTimeout(() => {
|
|
887
1113
|
assetRegistry.delete(key);
|
|
888
1114
|
entry.element && entry.element.remove();
|
|
1115
|
+
if (entry.loadState === "pending") entry.settle("errored");
|
|
889
1116
|
}, ASSET_REMOVAL_GRACE);
|
|
890
1117
|
};
|
|
891
1118
|
}
|
|
@@ -995,7 +1222,7 @@ function flushHeadRegistry() {
|
|
|
995
1222
|
function createHeadElement(tag, props) {
|
|
996
1223
|
const el = document.createElement(tag);
|
|
997
1224
|
for (const name in props) {
|
|
998
|
-
if (name === "children" || name === "ref" || name
|
|
1225
|
+
if (name === "children" || name === "ref" || /^on[A-Z]/.test(name)) continue;
|
|
999
1226
|
if (!HEAD_ATTR_NAME.test(name)) {
|
|
1000
1227
|
continue;
|
|
1001
1228
|
}
|
|
@@ -1003,7 +1230,7 @@ function createHeadElement(tag, props) {
|
|
|
1003
1230
|
if (v == null || v === false) continue;
|
|
1004
1231
|
el.setAttribute(name, v === true ? "" : String(v));
|
|
1005
1232
|
}
|
|
1006
|
-
if (props.children != null) el.textContent = String(props.children);
|
|
1233
|
+
if (props.children != null) el.textContent = headBodyText(tag, props, String(props.children));
|
|
1007
1234
|
return el;
|
|
1008
1235
|
}
|
|
1009
1236
|
function renderHeadElement(t, identity, existing) {
|
|
@@ -1018,7 +1245,7 @@ function renderHeadElement(t, identity, existing) {
|
|
|
1018
1245
|
function headElementMatches(el, t) {
|
|
1019
1246
|
if (el.tagName.toLowerCase() !== t.tag) return false;
|
|
1020
1247
|
for (const name in t.props) {
|
|
1021
|
-
if (name === "children" || name === "ref" || name
|
|
1248
|
+
if (name === "children" || name === "ref" || /^on[A-Z]/.test(name)) continue;
|
|
1022
1249
|
if (!HEAD_ATTR_NAME.test(name)) continue;
|
|
1023
1250
|
const v = t.props[name];
|
|
1024
1251
|
if (v == null || v === false) {
|
|
@@ -1026,7 +1253,7 @@ function headElementMatches(el, t) {
|
|
|
1026
1253
|
} else if (el.getAttribute(name) !== (v === true ? "" : String(v))) return false;
|
|
1027
1254
|
}
|
|
1028
1255
|
const children = t.props.children;
|
|
1029
|
-
return (children == null ? "" : String(children)) === el.textContent;
|
|
1256
|
+
return (children == null ? "" : headBodyText(t.tag, t.props, String(children))) === el.textContent;
|
|
1030
1257
|
}
|
|
1031
1258
|
function mountHeadResource(tag, props) {
|
|
1032
1259
|
const identity = resourceIdentity(tag, props);
|
|
@@ -1034,8 +1261,8 @@ function mountHeadResource(tag, props) {
|
|
|
1034
1261
|
headMountedResources.add(identity);
|
|
1035
1262
|
const url = props.href || props.src;
|
|
1036
1263
|
let el = null;
|
|
1037
|
-
if (url != null) {
|
|
1038
|
-
if (tag === "link") el = findAssetElement(`link[rel="${props.rel}"]`, "href", url);else if (tag === "script") el = findAssetElement("script[src]", "src", url);else el = findAssetElement("style[href]", "href", url);
|
|
1264
|
+
if (tag === "link" && url == null && typeof props.imagesrcset === "string") el = findAssetElement(`link[rel="${props.rel}"]`, "href", null, props);else if (url != null) {
|
|
1265
|
+
if (tag === "link") el = findAssetElement(`link[rel="${props.rel}"]`, "href", url, props);else if (tag === "script") el = findAssetElement("script[src]", "src", url);else el = findAssetElement("style[href]", "href", url);
|
|
1039
1266
|
}
|
|
1040
1267
|
if (!el) document.head.appendChild(createHeadElement(tag, props));
|
|
1041
1268
|
}
|
|
@@ -1057,7 +1284,7 @@ function gateHeadResource(props) {
|
|
|
1057
1284
|
if (attrs) descriptor.attrs = attrs;
|
|
1058
1285
|
effect(() => {
|
|
1059
1286
|
const entry = warmAsset(descriptor);
|
|
1060
|
-
if (gateable && entry.loadState === "pending" && typeof waitAsset === "function") waitAsset(entry.loadPromise);
|
|
1287
|
+
if (gateable && !isHydrating() && entry.loadState === "pending" && typeof waitAsset === "function") waitAsset(entry.loadPromise);
|
|
1061
1288
|
}, () => acquireAsset(descriptor));
|
|
1062
1289
|
}
|
|
1063
1290
|
function useHead(tags) {
|
|
@@ -1139,9 +1366,34 @@ function loadModuleAssets(mapping) {
|
|
|
1139
1366
|
}
|
|
1140
1367
|
return pending.length ? Promise.all(pending).then(() => {}) : undefined;
|
|
1141
1368
|
}
|
|
1142
|
-
function hydrate
|
|
1369
|
+
function hydrate(code, element, options = {}) {
|
|
1370
|
+
enableHydration();
|
|
1143
1371
|
installHydrationRuntime();
|
|
1144
|
-
|
|
1372
|
+
const hy = globalThis._$HY;
|
|
1373
|
+
const id = options.renderId || "";
|
|
1374
|
+
if (hy.s && !hy.s[id] && !hy.s[""] && !hy.done && document.readyState === "loading") {
|
|
1375
|
+
let started, disposer;
|
|
1376
|
+
const start = () => started || (started = true, disposer = hydrate(code, element, options));
|
|
1377
|
+
(hy.sp || (hy.sp = [])).push([id, start]);
|
|
1378
|
+
hy.sw = key => hy.sp.forEach(([k, f]) => (!key || k === key) && queueMicrotask(f));
|
|
1379
|
+
document.addEventListener("DOMContentLoaded", start, {
|
|
1380
|
+
once: true
|
|
1381
|
+
});
|
|
1382
|
+
return () => {
|
|
1383
|
+
started = true;
|
|
1384
|
+
disposer && disposer();
|
|
1385
|
+
};
|
|
1386
|
+
}
|
|
1387
|
+
if (hy.done) return render(code, element, [...element.childNodes], options);
|
|
1388
|
+
const head = (element.nodeType === 9 ? element : element.ownerDocument).head;
|
|
1389
|
+
if (head && element.contains(head)) {
|
|
1390
|
+
let n = head.firstChild;
|
|
1391
|
+
while (n && n.nodeType === 1 && n.hasAttribute("data-dh") && !n.hasAttribute("data-dhf")) {
|
|
1392
|
+
const next = n.nextSibling;
|
|
1393
|
+
head.appendChild(n);
|
|
1394
|
+
n = next;
|
|
1395
|
+
}
|
|
1396
|
+
}
|
|
1145
1397
|
options.renderId ||= "";
|
|
1146
1398
|
if (!globalThis._$HY.modules) globalThis._$HY.modules = {};
|
|
1147
1399
|
if (!globalThis._$HY.loading) globalThis._$HY.loading = {};
|
|
@@ -1190,31 +1442,34 @@ function hydrate$1(code, element, options = {}) {
|
|
|
1190
1442
|
sharedConfig.gather = gather;
|
|
1191
1443
|
sharedConfig.hydrating = true;
|
|
1192
1444
|
try {
|
|
1193
|
-
disposer = render
|
|
1445
|
+
disposer = render(code, element, [...element.childNodes], options);
|
|
1194
1446
|
} finally {
|
|
1195
1447
|
sharedConfig.hydrating = false;
|
|
1196
1448
|
}
|
|
1197
1449
|
}, err => {
|
|
1198
|
-
console.error("Hydration module preload failed, falling back to client render:", err);
|
|
1199
1450
|
sharedConfig.hydrating = false;
|
|
1200
1451
|
sharedConfig.registry = undefined;
|
|
1201
|
-
|
|
1452
|
+
if (element.nodeType === 9) {
|
|
1453
|
+
(globalThis.reportError || console.error)(err);
|
|
1454
|
+
return;
|
|
1455
|
+
}
|
|
1456
|
+
console.error("Hydration module preload failed, falling back to client render:", err);
|
|
1457
|
+
disposer = render(code, element, [...element.childNodes], options);
|
|
1202
1458
|
});
|
|
1203
1459
|
return () => disposer && disposer();
|
|
1204
1460
|
}
|
|
1205
1461
|
}
|
|
1206
1462
|
try {
|
|
1207
1463
|
gatherHydratable(element, options.renderId);
|
|
1208
|
-
return render
|
|
1464
|
+
return render(code, element, [...element.childNodes], options);
|
|
1209
1465
|
} finally {
|
|
1210
1466
|
sharedConfig.hydrating = false;
|
|
1211
1467
|
}
|
|
1212
1468
|
}
|
|
1213
1469
|
function getNextElement(template) {
|
|
1214
|
-
let
|
|
1215
|
-
key
|
|
1216
|
-
|
|
1217
|
-
if (!hydrating || !(node = sharedConfig.registry.get(key = getHydrationKey()))) {
|
|
1470
|
+
let key = sharedConfig.hydrating && getHydrationKey(),
|
|
1471
|
+
node = isHydrating() && sharedConfig.registry.get(key);
|
|
1472
|
+
if (!node) {
|
|
1218
1473
|
if (!template) {
|
|
1219
1474
|
throw new Error(`Hydration Mismatch. Unable to find DOM nodes for hydration key: ${key}`);
|
|
1220
1475
|
}
|
|
@@ -1294,6 +1549,7 @@ function runHydrationEvents() {
|
|
|
1294
1549
|
matches.sort((a, b) => a.distance - b.distance);
|
|
1295
1550
|
for (let i = 0; i < matches.length; i++) eventHandler(e, matches[i].container, matches[i].state);
|
|
1296
1551
|
} else if (matchContainer) eventHandler(e, matchContainer, matchState);
|
|
1552
|
+
flush();
|
|
1297
1553
|
}
|
|
1298
1554
|
if (sharedConfig.done) {
|
|
1299
1555
|
sharedConfig.events = _$HY.events = null;
|
|
@@ -1305,14 +1561,34 @@ function runHydrationEvents() {
|
|
|
1305
1561
|
}
|
|
1306
1562
|
function isHydrating(node) {
|
|
1307
1563
|
if (!sharedConfig.hydrating) return false;
|
|
1564
|
+
if (sharedConfig.isClaiming && !sharedConfig.isClaiming()) return false;
|
|
1308
1565
|
if (!node || node.isConnected) return true;
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1566
|
+
return serverComponentClaims !== null && serverComponentClaims.claimed(node);
|
|
1567
|
+
}
|
|
1568
|
+
let serverComponentClaims = null;
|
|
1569
|
+
function installServerComponentHydration() {
|
|
1570
|
+
enableServerComponentHydration();
|
|
1571
|
+
if (serverComponentClaims !== null) return;
|
|
1572
|
+
serverComponentClaims = {
|
|
1573
|
+
claimed(node) {
|
|
1574
|
+
const roots = sharedConfig.claimRoots;
|
|
1575
|
+
if (roots) {
|
|
1576
|
+
for (let i = 0; i < roots.length; i++) {
|
|
1577
|
+
if (roots[i].contains(node)) return true;
|
|
1578
|
+
}
|
|
1579
|
+
}
|
|
1580
|
+
return false;
|
|
1581
|
+
},
|
|
1582
|
+
inFrame(element) {
|
|
1583
|
+
const frames = element.querySelectorAll("[data-fid]");
|
|
1584
|
+
const frameCount = frames.length;
|
|
1585
|
+
if (frameCount === 0) return undefined;
|
|
1586
|
+
return node => {
|
|
1587
|
+
for (let j = 0; j < frameCount; j++) if (frames[j].contains(node)) return true;
|
|
1588
|
+
return false;
|
|
1589
|
+
};
|
|
1313
1590
|
}
|
|
1314
|
-
}
|
|
1315
|
-
return false;
|
|
1591
|
+
};
|
|
1316
1592
|
}
|
|
1317
1593
|
function classListToObject(classList) {
|
|
1318
1594
|
if (Array.isArray(classList)) {
|
|
@@ -1336,7 +1612,8 @@ function classListToObject(classList) {
|
|
|
1336
1612
|
function flattenClassList(list, result) {
|
|
1337
1613
|
for (let i = 0, len = list.length; i < len; i++) {
|
|
1338
1614
|
const item = list[i];
|
|
1339
|
-
if (Array.isArray(item)) flattenClassList(item, result);else if (typeof item === "object" && item != null) Object.assign(result, item);
|
|
1615
|
+
if (Array.isArray(item)) flattenClassList(item, result);else if (typeof item === "object" && item != null) Object.assign(result, item);
|
|
1616
|
+
else if (typeof item !== "boolean" && (item || item === 0)) result[item] = true;
|
|
1340
1617
|
}
|
|
1341
1618
|
}
|
|
1342
1619
|
function assignProp(node, prop, value, prev, skipRef, nodeName) {
|
|
@@ -1347,22 +1624,26 @@ function assignProp(node, prop, value, prev, skipRef, nodeName) {
|
|
|
1347
1624
|
if (!skipRef && value) ref(() => value, node);
|
|
1348
1625
|
return value;
|
|
1349
1626
|
}
|
|
1627
|
+
let c;
|
|
1350
1628
|
const hasNamespace = prop.indexOf(":") > -1;
|
|
1351
|
-
if (!hasNamespace && prop.
|
|
1629
|
+
if (!hasNamespace && prop.startsWith("on") && (c = prop.charCodeAt(2)) > 64 && c < 91) {
|
|
1352
1630
|
const name = prop.slice(2).toLowerCase();
|
|
1353
1631
|
const delegate = DelegatedEvents.has(name);
|
|
1354
1632
|
if (!delegate && prev) {
|
|
1355
|
-
|
|
1356
|
-
node.removeEventListener(name,
|
|
1633
|
+
if (Array.isArray(value) && typeof prev === "function" && prev[$$EVENT_TUPLE] === value) return prev;
|
|
1634
|
+
node.removeEventListener(name, prev, typeof prev !== "function" && prev);
|
|
1357
1635
|
}
|
|
1358
1636
|
if (delegate || value) {
|
|
1359
|
-
addEvent(node, name, value, delegate);
|
|
1637
|
+
const attached = addEvent(node, name, value, delegate);
|
|
1360
1638
|
delegate && delegateEvents([name]);
|
|
1639
|
+
if (!delegate) return attached;
|
|
1361
1640
|
}
|
|
1362
1641
|
} else if (hasNamespace && prop.slice(0, 5) === "prop:" || ChildProperties.has(prop) || DOMWithState[nodeName]?.[prop]) {
|
|
1363
1642
|
if (hasNamespace) prop = prop.slice(5);else if (isHydrating(node)) return value;
|
|
1364
|
-
if (prop === "value" && nodeName === "SELECT")
|
|
1365
|
-
|
|
1643
|
+
if (prop === "value" && nodeName === "SELECT") writeSelectValue(node, value);else if ((prop === "value" || prop === "defaultValue") && (nodeName === "INPUT" || nodeName === "TEXTAREA")) {
|
|
1644
|
+
if (value == null && /^(checkbox|radio)$/.test(node.type)) node.removeAttribute("value");else node[prop] = value ?? "";
|
|
1645
|
+
} else node[prop] = value;
|
|
1646
|
+
reclaimAttribute(node, prop);
|
|
1366
1647
|
} else {
|
|
1367
1648
|
const ns = hasNamespace && Namespaces[prop.split(":")[0]];
|
|
1368
1649
|
if (ns) setAttributeNS(node, ns, prop, value);else setAttribute(node, prop, value);
|
|
@@ -1377,47 +1658,39 @@ function eventHandler(e, container, state) {
|
|
|
1377
1658
|
if (prev === true || prev === container || !container.contains(prev)) return;
|
|
1378
1659
|
resumeNode = prev;
|
|
1379
1660
|
}
|
|
1380
|
-
const owner = state
|
|
1381
|
-
if (
|
|
1382
|
-
if (owner
|
|
1383
|
-
e[$$EVENT_OWNER] = owner
|
|
1661
|
+
const owner = state.owners.size === 1 && state.owners.has(container) ? container : findOwner(e.target, state)?.owner;
|
|
1662
|
+
if (!owner) return;
|
|
1663
|
+
if (owner === resumeNode) return;
|
|
1664
|
+
e[$$EVENT_OWNER] = owner;
|
|
1384
1665
|
let node = resumeNode || e.target;
|
|
1385
|
-
const key =
|
|
1386
|
-
const oriTarget = e.target;
|
|
1387
|
-
const boundary = owner || container || e.currentTarget;
|
|
1666
|
+
const key = EVENT_KEY + e.type;
|
|
1388
1667
|
const retarget = value => Object.defineProperty(e, "target", {
|
|
1389
1668
|
configurable: true,
|
|
1390
1669
|
value
|
|
1391
1670
|
});
|
|
1392
1671
|
const handleNode = () => {
|
|
1393
|
-
|
|
1394
|
-
if (handler === undefined && node.hasAttribute && node.hasAttribute("_bnd")) {
|
|
1395
|
-
const seam = globalThis[Symbol.for("dx.bnd")];
|
|
1396
|
-
if (seam) handler = seam.resolve(node, e.type);
|
|
1397
|
-
}
|
|
1672
|
+
const handler = node[key];
|
|
1398
1673
|
if (handler && !node.disabled) {
|
|
1399
1674
|
const data = node[`${key}Data`];
|
|
1400
|
-
data !== undefined ? handler.call(node, data, e) : handler.call(node, e);
|
|
1675
|
+
data !== undefined ? handler.call(node, data, e) : typeof handler === "function" ? handler.call(node, e) : handler.handleEvent(e);
|
|
1401
1676
|
if (e.cancelBubble) return;
|
|
1402
1677
|
}
|
|
1403
1678
|
node.host && typeof node.host !== "string" && !node.host._$host && node.contains(e.target) && retarget(node.host);
|
|
1404
1679
|
return true;
|
|
1405
1680
|
};
|
|
1681
|
+
const atOwner = () => node === owner || node.parentNode === owner;
|
|
1406
1682
|
const walkUpTree = () => {
|
|
1407
|
-
while (node && handleNode())
|
|
1408
|
-
if (node === boundary || node.parentNode === boundary) break;
|
|
1409
|
-
node = node._$host || node.parentNode || node.host;
|
|
1410
|
-
}
|
|
1683
|
+
while (node && handleNode() && !atOwner()) node = parentOf(node);
|
|
1411
1684
|
};
|
|
1412
1685
|
Object.defineProperty(e, "currentTarget", {
|
|
1413
1686
|
configurable: true,
|
|
1414
1687
|
get() {
|
|
1415
|
-
return node ||
|
|
1688
|
+
return node || owner;
|
|
1416
1689
|
}
|
|
1417
1690
|
});
|
|
1418
1691
|
if (resumeNode) {
|
|
1419
|
-
if (resumeNode === e.target) node = resumeNode
|
|
1420
|
-
if (node && node !==
|
|
1692
|
+
if (resumeNode === e.target) node = parentOf(resumeNode);
|
|
1693
|
+
if (node && node !== owner) walkUpTree();
|
|
1421
1694
|
} else if (e.composedPath) {
|
|
1422
1695
|
const path = e.composedPath();
|
|
1423
1696
|
if (path.length) {
|
|
@@ -1430,21 +1703,33 @@ function eventHandler(e, container, state) {
|
|
|
1430
1703
|
walkUpTree();
|
|
1431
1704
|
break;
|
|
1432
1705
|
}
|
|
1433
|
-
if (
|
|
1434
|
-
break;
|
|
1435
|
-
}
|
|
1706
|
+
if (atOwner()) break;
|
|
1436
1707
|
}
|
|
1437
1708
|
} else walkUpTree();
|
|
1438
1709
|
}
|
|
1439
1710
|
else walkUpTree();
|
|
1440
|
-
|
|
1711
|
+
delete e.target;
|
|
1712
|
+
delete e.currentTarget;
|
|
1441
1713
|
}
|
|
1442
1714
|
function insertExpression(parent, value, current, marker) {
|
|
1443
1715
|
if (hydrationRt !== null && isHydrating(parent)) {
|
|
1444
|
-
if (value && value !== current)
|
|
1716
|
+
if (value && value !== current) {
|
|
1717
|
+
const arr = Array.isArray(value);
|
|
1718
|
+
for (const n of arr ? value : [value]) {
|
|
1719
|
+
if (n && n.nodeType) {
|
|
1720
|
+
if (!isHydrating(n)) return current;
|
|
1721
|
+
} else if (arr && (typeof n === "string" || typeof n === "number")) {
|
|
1722
|
+
return current;
|
|
1723
|
+
}
|
|
1724
|
+
}
|
|
1725
|
+
}
|
|
1445
1726
|
return value;
|
|
1446
1727
|
}
|
|
1447
1728
|
if (value === current) return value;
|
|
1729
|
+
if (hydrationRt !== null && sharedConfig.hydrating && value && value.length !== 0) {
|
|
1730
|
+
const tracked = [].concat(current ?? []);
|
|
1731
|
+
if ([].concat(value).every(n => (n === tracked[0] && tracked.shift(), n?.parentNode === parent)) && !tracked.length) return value;
|
|
1732
|
+
}
|
|
1448
1733
|
const t = typeof value,
|
|
1449
1734
|
multi = marker !== undefined;
|
|
1450
1735
|
if (t === "string" || t === "number") {
|
|
@@ -1462,29 +1747,65 @@ function insertExpression(parent, value, current, marker) {
|
|
|
1462
1747
|
} else if (value.nodeType) {
|
|
1463
1748
|
if (Array.isArray(current)) {
|
|
1464
1749
|
cleanChildren(parent, current, multi ? marker : null, value);
|
|
1465
|
-
} else if (current && current.nodeType) {
|
|
1750
|
+
} else if (current != null && current.nodeType) {
|
|
1466
1751
|
current.parentNode === parent ? parent.replaceChild(value, current) : parent.appendChild(value);
|
|
1467
|
-
} else if (current && parent.firstChild) {
|
|
1752
|
+
} else if (current != null && parent.firstChild) {
|
|
1468
1753
|
parent.replaceChild(value, parent.firstChild);
|
|
1469
1754
|
} else {
|
|
1470
1755
|
parent.appendChild(value);
|
|
1471
1756
|
}
|
|
1472
|
-
if (marker) value[$$SLOT] = marker;
|
|
1757
|
+
if (marker || value[$$SLOT]) value[$$SLOT] = marker || parent;
|
|
1473
1758
|
} else if (Array.isArray(value)) {
|
|
1474
|
-
const currentArray =
|
|
1759
|
+
const currentArray = Array.isArray(current);
|
|
1760
|
+
for (let i = 0, len = value.length; i < len; i++) {
|
|
1761
|
+
const item = value[i],
|
|
1762
|
+
t = typeof item;
|
|
1763
|
+
if (t === "string" || t === "number") {
|
|
1764
|
+
const prev = currentArray ? current[i] : undefined;
|
|
1765
|
+
if (prev && prev.nodeType === 3) {
|
|
1766
|
+
if (prev.data !== "" + item) prev.data = item;
|
|
1767
|
+
value[i] = prev;
|
|
1768
|
+
} else value[i] = document.createTextNode(item);
|
|
1769
|
+
}
|
|
1770
|
+
}
|
|
1475
1771
|
if (value.length === 0) {
|
|
1476
1772
|
cleanChildren(parent, current, marker);
|
|
1477
1773
|
} else if (currentArray) {
|
|
1478
|
-
|
|
1479
|
-
appendNodes(parent, value, marker);
|
|
1480
|
-
} else reconcileArrays(parent, current, value, marker);
|
|
1774
|
+
reconcileArrays(parent, current, value, marker);
|
|
1481
1775
|
} else {
|
|
1482
|
-
current
|
|
1483
|
-
|
|
1776
|
+
if (current != null) cleanChildren(parent, current);
|
|
1777
|
+
reconcileArrays(parent, [], value);
|
|
1484
1778
|
}
|
|
1485
1779
|
} else ;
|
|
1780
|
+
selectInsert && selectInsert(parent);
|
|
1486
1781
|
return value;
|
|
1487
1782
|
}
|
|
1783
|
+
function selectChange(e) {
|
|
1784
|
+
(e = e.currentTarget || e)._$v = null;
|
|
1785
|
+
e.removeEventListener("change", selectChange, true);
|
|
1786
|
+
}
|
|
1787
|
+
function writeSelectValue(node, value) {
|
|
1788
|
+
const had = node._$v && node._$v.map,
|
|
1789
|
+
has = value != null && value.map;
|
|
1790
|
+
if (has) had || node.addEventListener("change", selectChange, true);else had && node.removeEventListener("change", selectChange, true);
|
|
1791
|
+
if (value == null) {
|
|
1792
|
+
node._$v = null;
|
|
1793
|
+
return queueMicrotask(() => node.value = value) || (node.value = value);
|
|
1794
|
+
}
|
|
1795
|
+
node._$v = value;
|
|
1796
|
+
(selectInsert ||= applySelectValue)(node);
|
|
1797
|
+
queueMicrotask(() => selectInsert(node));
|
|
1798
|
+
}
|
|
1799
|
+
function applySelectValue(p) {
|
|
1800
|
+
p && p._$v == null && (p = p.parentNode);
|
|
1801
|
+
const v = p && p._$v;
|
|
1802
|
+
if (v == null) return;
|
|
1803
|
+
if (v.map) {
|
|
1804
|
+
const o = [...p.options];
|
|
1805
|
+
for (let i = 0; i < o.length; i++) o[i].selected = v.some(x => x == o[i].value);
|
|
1806
|
+
v.every(x => o.some(el => el.value == x)) && selectChange(p);
|
|
1807
|
+
} else p.value = v, p.selectedIndex > -1 && p.value == v && (p._$v = null);
|
|
1808
|
+
}
|
|
1488
1809
|
function normalize(value, current, multi, doNotUnwrap) {
|
|
1489
1810
|
value = flatten(value, {
|
|
1490
1811
|
skipNonRendered: true,
|
|
@@ -1492,12 +1813,12 @@ function normalize(value, current, multi, doNotUnwrap) {
|
|
|
1492
1813
|
});
|
|
1493
1814
|
if (doNotUnwrap && typeof value === "function") return value;
|
|
1494
1815
|
if (multi && !Array.isArray(value)) value = [value != null ? value : ""];
|
|
1495
|
-
if (Array.isArray(value)) {
|
|
1816
|
+
if (hydrationRt !== null && sharedConfig.hydrating && Array.isArray(value)) {
|
|
1496
1817
|
for (let i = 0, len = value.length; i < len; i++) {
|
|
1497
1818
|
const item = value[i],
|
|
1498
1819
|
prev = current && current[i],
|
|
1499
1820
|
t = typeof item;
|
|
1500
|
-
if (t === "string" || t === "number")
|
|
1821
|
+
if ((t === "string" || t === "number") && prev && prev.nodeType === 3 && isHydrating(prev)) value[i] = prev;
|
|
1501
1822
|
}
|
|
1502
1823
|
}
|
|
1503
1824
|
return value;
|
|
@@ -1513,13 +1834,6 @@ function tagHost(value, host) {
|
|
|
1513
1834
|
});
|
|
1514
1835
|
}
|
|
1515
1836
|
}
|
|
1516
|
-
function appendNodes(parent, array, marker = null) {
|
|
1517
|
-
for (let i = 0, len = array.length; i < len; i++) {
|
|
1518
|
-
const n = array[i];
|
|
1519
|
-
parent.insertBefore(n, marker);
|
|
1520
|
-
if (marker) n[$$SLOT] = marker;
|
|
1521
|
-
}
|
|
1522
|
-
}
|
|
1523
1837
|
function ownsAllChildren(parent, current) {
|
|
1524
1838
|
if (current == null) return true;
|
|
1525
1839
|
if (Array.isArray(current)) {
|
|
@@ -1554,33 +1868,31 @@ function cleanChildren(parent, current, marker, replacement) {
|
|
|
1554
1868
|
const el = current[i];
|
|
1555
1869
|
if (replacement !== el) {
|
|
1556
1870
|
const tag = el[$$SLOT];
|
|
1557
|
-
const owns = el.parentNode === parent && (!tag || tag === marker);
|
|
1871
|
+
const owns = el.parentNode === parent && (!tag || tag === (marker || parent));
|
|
1558
1872
|
if (replacement && !inserted && !i) owns ? parent.replaceChild(replacement, el) : parent.insertBefore(replacement, marker);else if (owns) el.remove();
|
|
1559
1873
|
} else inserted = true;
|
|
1560
1874
|
}
|
|
1561
1875
|
} else if (replacement) parent.insertBefore(replacement, marker);
|
|
1562
|
-
if (replacement && marker) replacement[$$SLOT] = marker;
|
|
1876
|
+
if (replacement && (marker || replacement[$$SLOT])) replacement[$$SLOT] = marker || parent;
|
|
1563
1877
|
}
|
|
1564
1878
|
function gatherHydratable(element, root) {
|
|
1565
|
-
const templates = element.querySelectorAll(`*[_hk]`);
|
|
1879
|
+
const templates = element.querySelectorAll(root ? `[_hk^="${root.replace(/["\\]/g, "\\$&")}"]` : `*[_hk]`);
|
|
1880
|
+
const inFrame = root || serverComponentClaims === null ? undefined : serverComponentClaims.inFrame(element);
|
|
1881
|
+
const registry = sharedConfig.registry;
|
|
1566
1882
|
for (let i = 0; i < templates.length; i++) {
|
|
1567
1883
|
const node = templates[i];
|
|
1884
|
+
if (inFrame !== undefined && inFrame(node)) continue;
|
|
1568
1885
|
const key = node.getAttribute("_hk");
|
|
1569
|
-
if (
|
|
1570
|
-
if (!key.startsWith(root)) continue;
|
|
1571
|
-
} else {
|
|
1572
|
-
const frame = node.closest("[data-fid]");
|
|
1573
|
-
if (frame && frame !== element && element.contains(frame)) continue;
|
|
1574
|
-
}
|
|
1575
|
-
if (!sharedConfig.registry.has(key)) sharedConfig.registry.set(key, node);
|
|
1886
|
+
if (!registry.has(key)) registry.set(key, node);
|
|
1576
1887
|
}
|
|
1577
1888
|
}
|
|
1578
1889
|
function getHydrationKey() {
|
|
1579
1890
|
return sharedConfig.getNextContextId();
|
|
1580
1891
|
}
|
|
1581
|
-
const voidFn = () => undefined;
|
|
1582
1892
|
const RequestContext = Symbol();
|
|
1583
1893
|
|
|
1894
|
+
function configureServerErrors(_config) {}
|
|
1895
|
+
function reportRequestFailure(_error, _event) {}
|
|
1584
1896
|
function throwInBrowser(func) {
|
|
1585
1897
|
const err = new Error(`${func.name} is not supported in the browser, returning undefined`);
|
|
1586
1898
|
console.error(err);
|
|
@@ -1610,28 +1922,38 @@ function composeMiddleware(middlewares) {
|
|
|
1610
1922
|
throwInBrowser(composeMiddleware);
|
|
1611
1923
|
}
|
|
1612
1924
|
function ssr(template, ...nodes) {}
|
|
1613
|
-
function ssrElement(name, props, children, needsId) {}
|
|
1925
|
+
function ssrElement(name, props, children, needsId, skip, attrs) {}
|
|
1926
|
+
function ssrElementAttribute(key, value) {}
|
|
1927
|
+
function ssrLinkClaim(attrs) {}
|
|
1614
1928
|
function ssrClassName(value) {}
|
|
1615
1929
|
function ssrStyle(value) {}
|
|
1616
1930
|
function ssrStyleProperty(name, value) {}
|
|
1931
|
+
function ssrStyleProperties(...entries) {}
|
|
1617
1932
|
function ssrAttribute(key, value) {}
|
|
1618
1933
|
function ssrGroup(fn, n) {}
|
|
1619
1934
|
function ssrHydrationKey() {}
|
|
1620
|
-
function resolveSSRNode(node, result, top) {}
|
|
1935
|
+
function resolveSSRNode(node, result, top, nested) {}
|
|
1621
1936
|
function escape(s, attr) {}
|
|
1622
1937
|
|
|
1623
1938
|
const ENVELOPE = Symbol.for("solid.ResponseEnvelope");
|
|
1624
|
-
|
|
1625
|
-
const ResponseEnvelope =
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1939
|
+
let EnvelopeClass;
|
|
1940
|
+
const ResponseEnvelope = function ResponseEnvelope(response, value) {
|
|
1941
|
+
if (!EnvelopeClass) {
|
|
1942
|
+
EnvelopeClass = class extends Response {
|
|
1943
|
+
constructor(response, value) {
|
|
1944
|
+
super(response ? response.body : null, response && {
|
|
1945
|
+
status: response.status,
|
|
1946
|
+
statusText: response.statusText,
|
|
1947
|
+
headers: copyHeaders(response.headers)
|
|
1948
|
+
});
|
|
1949
|
+
this.response = response ? this : undefined;
|
|
1950
|
+
this.value = value;
|
|
1951
|
+
}
|
|
1952
|
+
};
|
|
1953
|
+
EnvelopeClass.prototype[ENVELOPE] = true;
|
|
1631
1954
|
}
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
})();
|
|
1955
|
+
return new EnvelopeClass(response, value);
|
|
1956
|
+
};
|
|
1635
1957
|
function isResponseEnvelope(value) {
|
|
1636
1958
|
return !!(value && typeof value === "object" && value[ENVELOPE]);
|
|
1637
1959
|
}
|
|
@@ -1654,24 +1976,38 @@ function isSafeError(value) {
|
|
|
1654
1976
|
return !!(value && (typeof value === "object" || typeof value === "function") && value[SAFE_ERROR]);
|
|
1655
1977
|
}
|
|
1656
1978
|
const REVALIDATE_HEADER = "X-Revalidate";
|
|
1657
|
-
|
|
1979
|
+
const REVALIDATE_ALL = "*";
|
|
1980
|
+
const RESPONSE_HEADER_VALUE_LIMIT = 4096;
|
|
1981
|
+
function copyHeaders(init) {
|
|
1982
|
+
const source = init;
|
|
1983
|
+
if (!source || !source.getSetCookie) return new Headers(init);
|
|
1984
|
+
const headers = new Headers();
|
|
1985
|
+
source.forEach((value, key) => {
|
|
1986
|
+
if (key !== "set-cookie") headers.append(key, value);
|
|
1987
|
+
});
|
|
1988
|
+
for (const cookie of source.getSetCookie()) headers.append("Set-Cookie", cookie);
|
|
1989
|
+
return headers;
|
|
1990
|
+
}
|
|
1991
|
+
function initWithRevalidate(init = {}) {
|
|
1992
|
+
const resolved = typeof init === "number" ? {
|
|
1993
|
+
status: init
|
|
1994
|
+
} : init;
|
|
1658
1995
|
const {
|
|
1659
1996
|
revalidate,
|
|
1660
1997
|
...responseInit
|
|
1661
|
-
} =
|
|
1662
|
-
|
|
1663
|
-
if (
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
});
|
|
1668
|
-
for (const cookie of responseInit.headers.getSetCookie()) {
|
|
1669
|
-
headers.append("Set-Cookie", cookie);
|
|
1998
|
+
} = resolved;
|
|
1999
|
+
const headers = copyHeaders(responseInit.headers);
|
|
2000
|
+
if (revalidate !== undefined) {
|
|
2001
|
+
const list = Array.isArray(revalidate) ? revalidate : [revalidate];
|
|
2002
|
+
if (list.length > 1 && list.includes(REVALIDATE_ALL)) {
|
|
2003
|
+
throw new TypeError(`revalidate names "${REVALIDATE_ALL}" alongside other keys; "${REVALIDATE_ALL}" already ` + `means every entry and stands alone — pass revalidate: "${REVALIDATE_ALL}" or the named keys.`);
|
|
1670
2004
|
}
|
|
1671
|
-
|
|
1672
|
-
|
|
2005
|
+
const keys = list.join(",");
|
|
2006
|
+
if (keys.length > RESPONSE_HEADER_VALUE_LIMIT) {
|
|
2007
|
+
throw new TypeError(`revalidate names ${keys.length} characters of cache keys; past ` + `${RESPONSE_HEADER_VALUE_LIMIT} the ${REVALIDATE_HEADER} header would overflow ` + `receivers (an 8 KiB proxy buffer holds the whole header block) and the response ` + `dies at the socket after the mutation committed. Split the invalidation across ` + `calls or use coarser keys — a dropped key would be a silently stale cache, so ` + `the runtime refuses rather than trims.`);
|
|
2008
|
+
}
|
|
2009
|
+
headers.set(REVALIDATE_HEADER, keys);
|
|
1673
2010
|
}
|
|
1674
|
-
revalidate !== undefined && headers.set(REVALIDATE_HEADER, revalidate.toString());
|
|
1675
2011
|
return {
|
|
1676
2012
|
responseInit,
|
|
1677
2013
|
headers
|
|
@@ -1684,13 +2020,17 @@ function redirect(url, init = 302) {
|
|
|
1684
2020
|
const {
|
|
1685
2021
|
responseInit,
|
|
1686
2022
|
headers
|
|
1687
|
-
} = initWithRevalidate(
|
|
1688
|
-
status: init
|
|
1689
|
-
} : init);
|
|
2023
|
+
} = initWithRevalidate(init);
|
|
1690
2024
|
if (responseInit.status === undefined) {
|
|
1691
2025
|
responseInit.status = 302;
|
|
1692
2026
|
}
|
|
1693
|
-
|
|
2027
|
+
const target = typeof url === "string" ? url : url[HREF];
|
|
2028
|
+
const location = typeof target === "string" ? target : String(url);
|
|
2029
|
+
const encoded = location.replace(/[^\x00-\x7f]/gu, encodeURIComponent);
|
|
2030
|
+
if (encoded.length > RESPONSE_HEADER_VALUE_LIMIT) {
|
|
2031
|
+
throw new TypeError(`redirect() target is ${encoded.length} characters; past ` + `${RESPONSE_HEADER_VALUE_LIMIT} the Location header (and the scripted transport's ` + `redirect header) would overflow receivers and the response dies at the socket. ` + `A target this size is usually unbounded input echoed into the url — carry the ` + `state server-side instead. Refused rather than trimmed: a cut target is a ` + `different address.`);
|
|
2032
|
+
}
|
|
2033
|
+
headers.set("Location", encoded);
|
|
1694
2034
|
return new Response(null, {
|
|
1695
2035
|
...responseInit,
|
|
1696
2036
|
headers
|
|
@@ -1706,38 +2046,33 @@ function reload(init = {}) {
|
|
|
1706
2046
|
headers
|
|
1707
2047
|
});
|
|
1708
2048
|
}
|
|
2049
|
+
const NULL_BODY_STATUSES = new Set([204, 205, 304]);
|
|
1709
2050
|
function respond(value, init = {}) {
|
|
1710
2051
|
const {
|
|
1711
2052
|
responseInit,
|
|
1712
2053
|
headers
|
|
1713
2054
|
} = initWithRevalidate(init);
|
|
2055
|
+
for (const header of COMPOSED_BODY_FRAMING) headers.delete(header);
|
|
2056
|
+
if (NULL_BODY_STATUSES.has(responseInit.status)) {
|
|
2057
|
+
return new ResponseEnvelope(new Response(null, {
|
|
2058
|
+
...responseInit,
|
|
2059
|
+
headers
|
|
2060
|
+
}), value);
|
|
2061
|
+
}
|
|
1714
2062
|
headers.set("Content-Type", "application/json");
|
|
1715
|
-
return new ResponseEnvelope(new Response(
|
|
2063
|
+
return new ResponseEnvelope(new Response(new ReadableStream({
|
|
2064
|
+
pull(controller) {
|
|
2065
|
+
controller.enqueue(new TextEncoder().encode(JSON.stringify(value)));
|
|
2066
|
+
controller.close();
|
|
2067
|
+
}
|
|
2068
|
+
}), {
|
|
1716
2069
|
...responseInit,
|
|
1717
2070
|
headers
|
|
1718
2071
|
}), value);
|
|
1719
2072
|
}
|
|
1720
2073
|
|
|
1721
|
-
const mergeProps = merge;
|
|
1722
2074
|
const isServer = false;
|
|
1723
2075
|
const isDev = false;
|
|
1724
|
-
function render(code, element, init, options = {}) {
|
|
1725
|
-
try {
|
|
1726
|
-
const dispose = render$1(code, element, init, {
|
|
1727
|
-
...options,
|
|
1728
|
-
insertOptions: {
|
|
1729
|
-
schedule: true
|
|
1730
|
-
}
|
|
1731
|
-
});
|
|
1732
|
-
flush();
|
|
1733
|
-
return dispose;
|
|
1734
|
-
} finally {
|
|
1735
|
-
}
|
|
1736
|
-
}
|
|
1737
|
-
const hydrate = (...args) => {
|
|
1738
|
-
enableHydration();
|
|
1739
|
-
return hydrate$1(...args);
|
|
1740
|
-
};
|
|
1741
2076
|
function Portal(props) {
|
|
1742
2077
|
return runWithOwner(createOwner(), () => portalImpl(props));
|
|
1743
2078
|
}
|
|
@@ -1790,64 +2125,25 @@ function portalImpl(props) {
|
|
|
1790
2125
|
});
|
|
1791
2126
|
return treeMarker;
|
|
1792
2127
|
}
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
const
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
if (!binding) return next;
|
|
1804
|
-
deliveredAddress = binding.address;
|
|
1805
|
-
const prevBinding = bindingOf(prev);
|
|
1806
|
-
if (prevBinding && prevBinding.component === binding.component) {
|
|
1807
|
-
for (const deliver of sites) deliver(binding.address);
|
|
1808
|
-
return prev;
|
|
1809
|
-
}
|
|
1810
|
-
return next;
|
|
1811
|
-
};
|
|
1812
|
-
const cached = createMemo(prev => {
|
|
1813
|
-
const next = source();
|
|
1814
|
-
if (!next || typeof next.then !== "function") return resolveBinding(next, prev);
|
|
1815
|
-
const token = ++latest;
|
|
1816
|
-
return {
|
|
1817
|
-
then: (onFulfilled, onRejected) => next.then(resolved => onFulfilled(token === latest ? resolveBinding(resolved, prev) : resolved), onRejected)
|
|
1818
|
-
};
|
|
1819
|
-
}, {
|
|
1820
|
-
lazy: true
|
|
1821
|
-
});
|
|
1822
|
-
return props => {
|
|
1823
|
-
return createMemo(() => {
|
|
1824
|
-
const component = cached();
|
|
1825
|
-
switch (typeof component) {
|
|
1826
|
-
case "function":
|
|
1827
|
-
{
|
|
1828
|
-
const binding = bindingOf(component);
|
|
1829
|
-
if (binding) {
|
|
1830
|
-
const [address, setAddress] = createSignal(deliveredAddress ?? binding.address);
|
|
1831
|
-
sites.add(setAddress);
|
|
1832
|
-
onCleanup(() => sites.delete(setAddress));
|
|
1833
|
-
return untrack(() => binding.component(props, address));
|
|
1834
|
-
}
|
|
1835
|
-
return untrack(() => component(props));
|
|
1836
|
-
}
|
|
1837
|
-
case "string":
|
|
1838
|
-
const el = sharedConfig.hydrating ? getNextElement() : createElement(component, untrack(() => props.is));
|
|
1839
|
-
spread(el, props);
|
|
1840
|
-
return el;
|
|
1841
|
-
}
|
|
1842
|
-
});
|
|
1843
|
-
};
|
|
2128
|
+
function dynamic(source, options) {
|
|
2129
|
+
return dynamicCore(source, options, staticElement);
|
|
2130
|
+
}
|
|
2131
|
+
function staticElement(tag, props) {
|
|
2132
|
+
const hydrating = sharedConfig.hydrating;
|
|
2133
|
+
const create = () => createElement(tag, untrack(() => props.is), untrack(() => props.xmlns));
|
|
2134
|
+
const el = hydrating ? getNextElement(create) : create();
|
|
2135
|
+
spread(el, props);
|
|
2136
|
+
if (hydrating) runHydrationEvents();
|
|
2137
|
+
return el;
|
|
1844
2138
|
}
|
|
1845
2139
|
function Dynamic(props) {
|
|
1846
2140
|
const Comp = dynamic(() => props.component);
|
|
1847
2141
|
return createComponent(Comp, omit(props, "component"));
|
|
1848
2142
|
}
|
|
1849
|
-
function createElement(tagName, is = undefined) {
|
|
1850
|
-
return
|
|
2143
|
+
function createElement(tagName, is = undefined, xmlns = undefined) {
|
|
2144
|
+
return xmlns ? document.createElementNS(xmlns, tagName, {
|
|
2145
|
+
is
|
|
2146
|
+
}) : SVGElements.has(tagName) ? document.createElementNS(Namespaces.svg, tagName) : MathMLElements.has(tagName) ? document.createElementNS(Namespaces.mathml, tagName) : document.createElement(tagName, {
|
|
1851
2147
|
is
|
|
1852
2148
|
});
|
|
1853
2149
|
}
|
|
@@ -1879,4 +2175,4 @@ _moduleUrl) {
|
|
|
1879
2175
|
function httpStatus(_code, _text) {}
|
|
1880
2176
|
function httpHeader(_name, _value, _options) {}
|
|
1881
2177
|
|
|
1882
|
-
export { ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF,
|
|
2178
|
+
export { ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, HydrationScript, MathMLElements, NULL_BODY_STATUSES, Namespaces, Portal, RESPONSE_HEADER_VALUE_LIMIT, REVALIDATE_ALL, REVALIDATE_HEADER, RawTextElements, RequestContext, ResponseEnvelope, SAFE_ERROR, SVGElements, VoidElements, acquireAsset, addEvent, applyRef, assign, claimElement, claimElementTree, className, clearFlashCookie, clientOnly, commitEventResponse, composeMiddleware, configureServerErrors, createRequestEvent, createResponseStub, createSSRResponse, delegateEvents, dispatchAsInteraction, dynamic, dynamicProperty, effect, escape, generateHydrationScript, getDelegatedRoot, getExpectedRedirectStatus, getFirstChild, getHydrationKey, getHydrationWriter, getNextElement, getNextMarker, getNextMatch, getNextSibling, getRequestEvent, getServerFunctionMetadata, getServerFunctionRPC, getTraceContext, hasFlashCookie, hasServerLinkState, httpHeader, httpStatus, hydrate, insert, installHydrationRuntime, installServerComponentHydration, isDev, isHref, isResponseEnvelope, isSafeError, isServer, isServerFunction, markSafeError, memo, parseCookieHeader, readShallow, redirect, ref, registerDelegatedContainer, registerDelegatedRoot, registerElementClaim, reload, render, renderToStream, renderToString, reportRequestFailure, resolveSSRNode, respond, runHydrationEvents, scope, serializeCookie, setAttribute, setAttributeNS, setLinkClaim, setProperty, setStatefulProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrElementAttribute, ssrGroup, ssrHydrationKey, ssrLinkClaim, ssrStyle, ssrStyleProperties, ssrStyleProperty, style, takeHydrationValue, template, unregisterDelegatedContainer, unregisterDelegatedRoot, useHead, waitAsset, warmAsset };
|