@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
|
@@ -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, OBSERVE, 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,98 +49,96 @@ 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,
|
|
54
56
|
sync: true
|
|
55
57
|
};
|
|
58
|
+
let spreadName;
|
|
59
|
+
let spreadLoc;
|
|
60
|
+
function setSpreadName(name, loc) {
|
|
61
|
+
spreadName = name;
|
|
62
|
+
spreadLoc = loc;
|
|
63
|
+
}
|
|
56
64
|
const syncOptions = {
|
|
57
65
|
sync: true
|
|
58
66
|
};
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
};
|
|
67
|
+
function effect(fn, effectFn, options) {
|
|
68
|
+
if (spreadName !== undefined && (options === undefined || options.name === undefined)) options = {
|
|
69
|
+
...options,
|
|
70
|
+
name: spreadName + ".spread",
|
|
71
|
+
loc: spreadLoc
|
|
72
|
+
};
|
|
73
|
+
const nodeOptions = options ? {
|
|
74
|
+
sync: true,
|
|
75
|
+
...options,
|
|
76
|
+
transparent: !options.scope
|
|
77
|
+
} : transparentOptions;
|
|
78
|
+
createRenderEffect(fn, effectFn, nodeOptions);
|
|
79
|
+
}
|
|
80
|
+
function memo(fn) {
|
|
81
|
+
return createMemo(() => fn(), syncOptions);
|
|
82
|
+
}
|
|
76
83
|
|
|
77
84
|
function reconcileArrays(parentNode, a, b, marker) {
|
|
85
|
+
let active = parentNode.moveBefore && parentNode.isConnected && document.activeElement;
|
|
86
|
+
if (active === document.body) active = null;
|
|
87
|
+
const slot = marker || parentNode;
|
|
88
|
+
const insert = (n, ref) => {
|
|
89
|
+
active && n.isConnected && n.contains(active) ? parentNode.moveBefore(n, ref) : parentNode.insertBefore(n, ref);
|
|
90
|
+
if (marker || n[$$SLOT]) n[$$SLOT] = slot;
|
|
91
|
+
};
|
|
92
|
+
if (!a.length) {
|
|
93
|
+
for (const n of b) insert(n, marker);
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
const isLive = n => {
|
|
97
|
+
if (!n) return false;
|
|
98
|
+
const tag = n[$$SLOT];
|
|
99
|
+
return n.parentNode === parentNode && (!tag || tag === slot);
|
|
100
|
+
};
|
|
78
101
|
let bLength = b.length,
|
|
79
102
|
aEnd = a.length,
|
|
80
103
|
bEnd = bLength,
|
|
81
104
|
aStart = 0,
|
|
82
105
|
bStart = 0,
|
|
83
106
|
tail = a[aEnd - 1],
|
|
84
|
-
|
|
85
|
-
after = tail.parentNode === parentNode && (!tailTag || tailTag === marker) ? tail.nextSibling : marker || null,
|
|
107
|
+
after = isLive(tail) ? tail.nextSibling : marker || null,
|
|
86
108
|
map = null,
|
|
87
109
|
anchor,
|
|
88
110
|
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
111
|
while (aStart < aEnd || bStart < bEnd) {
|
|
95
|
-
if (a[aStart] === b[bStart]
|
|
112
|
+
if (a[aStart] === b[bStart]) {
|
|
96
113
|
aStart++;
|
|
97
114
|
bStart++;
|
|
98
115
|
continue;
|
|
99
116
|
}
|
|
100
|
-
while (a[aEnd - 1] === b[bEnd - 1]
|
|
117
|
+
while (aEnd > aStart && bEnd > bStart && a[aEnd - 1] === b[bEnd - 1]) {
|
|
101
118
|
aEnd--;
|
|
102
119
|
bEnd--;
|
|
103
120
|
}
|
|
104
121
|
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
|
-
}
|
|
122
|
+
let k = bEnd;
|
|
123
|
+
while (k < bLength && !isLive(b[k])) k++;
|
|
124
|
+
const node = k < bLength ? b[k] : after;
|
|
125
|
+
while (bStart < bEnd) insert(b[bStart++], node);
|
|
118
126
|
} else if (bEnd === bStart) {
|
|
119
127
|
while (aStart < aEnd) {
|
|
120
128
|
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]);
|
|
129
|
+
if ((!map || !map.has(n)) && isLive(n)) n.remove();
|
|
141
130
|
}
|
|
131
|
+
} else if ((anchor = a[aStart]) === b[bEnd - 1] && b[bStart] === a[aEnd - 1] && anchor.parentNode === parentNode && (!(anchorTag = anchor[$$SLOT]) || anchorTag === slot)) {
|
|
132
|
+
do {
|
|
133
|
+
insert(a[--aEnd], anchor);
|
|
134
|
+
bStart++;
|
|
135
|
+
if (aStart >= aEnd - 1 || bStart >= bEnd) break;
|
|
136
|
+
} while (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]);
|
|
142
137
|
} else {
|
|
138
|
+
if (!isLive(a[aStart])) {
|
|
139
|
+
aStart++;
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
143
142
|
if (!map) {
|
|
144
143
|
map = new Map();
|
|
145
144
|
let i = bStart;
|
|
@@ -156,31 +155,16 @@ function reconcileArrays(parentNode, a, b, marker) {
|
|
|
156
155
|
sequence++;
|
|
157
156
|
}
|
|
158
157
|
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
|
-
}
|
|
158
|
+
const node = a[aStart];
|
|
159
|
+
while (bStart < index) insert(b[bStart++], node);
|
|
167
160
|
} 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;
|
|
161
|
+
const newNode = b[bStart++],
|
|
162
|
+
node = a[aStart++];
|
|
163
|
+
active && parentNode.contains(active) ? insert(newNode, node) : parentNode.replaceChild(newNode, node);
|
|
164
|
+
if (marker || newNode[$$SLOT]) newNode[$$SLOT] = slot;
|
|
177
165
|
}
|
|
178
166
|
} 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
|
-
}
|
|
167
|
+
} else a[aStart++].remove();
|
|
184
168
|
}
|
|
185
169
|
}
|
|
186
170
|
}
|
|
@@ -217,11 +201,28 @@ function classifyHeadTag(desc) {
|
|
|
217
201
|
resource: false
|
|
218
202
|
};
|
|
219
203
|
}
|
|
204
|
+
function qualifierValue(name, value) {
|
|
205
|
+
if (value == null || value === false) return null;
|
|
206
|
+
if (name === "imagesrcset" || name === "imagesizes") return typeof value === "string" && value !== "" ? value : null;
|
|
207
|
+
const v = value === true ? "" : String(value);
|
|
208
|
+
if (name === "as") return asciiLowerCase(v);
|
|
209
|
+
if (name !== "crossorigin") return v;
|
|
210
|
+
return v.length === 15 && v.toLowerCase() === "use-credentials" ? v.toLowerCase() : "anonymous";
|
|
211
|
+
}
|
|
212
|
+
function asciiLowerCase(value) {
|
|
213
|
+
return value.replace(/[A-Z]/g, c => String.fromCharCode(c.charCodeAt(0) + 32));
|
|
214
|
+
}
|
|
215
|
+
const JSON_SCRIPT_TYPE = /^(?:importmap|speculationrules)$|^[\t\n\r ]*(?:application\/json|text\/json|[\w!#$%&'*+.^`|~-]+\/[\w!#$%&'*+.^`|~-]*\+json)[\t\n\r ]*(?:;|$)/i;
|
|
216
|
+
function headBodyText(tag, props, text) {
|
|
217
|
+
return tag === "script" && JSON_SCRIPT_TYPE.test(String(props.type)) ? text.replace(/</g, "\\u003C") : text;
|
|
218
|
+
}
|
|
220
219
|
function resourceIdentity(tag, props) {
|
|
221
|
-
|
|
220
|
+
const url = String(props.href || props.src || "");
|
|
221
|
+
let id = "res:" + tag + ":" + (props.rel || "") + ":" + url.length + ":" + url;
|
|
222
222
|
for (let i = 0; i < RESOURCE_QUALIFIERS.length; i++) {
|
|
223
223
|
const q = RESOURCE_QUALIFIERS[i];
|
|
224
|
-
|
|
224
|
+
const value = qualifierValue(q, props[q]);
|
|
225
|
+
if (value !== null) id += ":" + q + "=" + value.length + ":" + value;
|
|
225
226
|
}
|
|
226
227
|
return id;
|
|
227
228
|
}
|
|
@@ -255,7 +256,6 @@ function resolveHead(groups) {
|
|
|
255
256
|
}
|
|
256
257
|
for (const [identity, tags] of byIdentity) {
|
|
257
258
|
if (identity === "title") {
|
|
258
|
-
if (tags.length > 1) console.warn("Multiple <title> tags in one head group; the last one wins.");
|
|
259
259
|
winners.set(identity, {
|
|
260
260
|
seq: group.seq,
|
|
261
261
|
tags: [tags[tags.length - 1]]
|
|
@@ -301,6 +301,7 @@ function serializeCookie(name, value, options = {}) {
|
|
|
301
301
|
if (options.expires) cookie += `; Expires=${options.expires.toUTCString()}`;
|
|
302
302
|
if (options.httpOnly) cookie += "; HttpOnly";
|
|
303
303
|
if (options.secure) cookie += "; Secure";
|
|
304
|
+
if (options.partitioned) cookie += "; Partitioned";
|
|
304
305
|
if (options.sameSite) {
|
|
305
306
|
const sameSite = options.sameSite.toLowerCase();
|
|
306
307
|
cookie += `; SameSite=${sameSite === "none" ? "None" : sameSite === "strict" ? "Strict" : "Lax"}`;
|
|
@@ -308,7 +309,7 @@ function serializeCookie(name, value, options = {}) {
|
|
|
308
309
|
return cookie;
|
|
309
310
|
}
|
|
310
311
|
const FLASH_COOKIE = "flash";
|
|
311
|
-
const FLASH_MATCHER =
|
|
312
|
+
const FLASH_MATCHER = /(?:^|;\s*)flash=([^;]+)/;
|
|
312
313
|
function hasFlashCookie(cookieHeader) {
|
|
313
314
|
return !!cookieHeader && FLASH_MATCHER.test(cookieHeader);
|
|
314
315
|
}
|
|
@@ -329,33 +330,91 @@ function getServerFunctionRPC() {
|
|
|
329
330
|
return globalThis[SERVER_FUNCTION_RPC];
|
|
330
331
|
}
|
|
331
332
|
|
|
332
|
-
const
|
|
333
|
+
const assetGates = new WeakMap();
|
|
334
|
+
const waitAsset = promise => {
|
|
335
|
+
let gate = assetGates.get(promise);
|
|
336
|
+
if (!gate) {
|
|
337
|
+
runWithOwner(null, () => {
|
|
338
|
+
gate = createMemo(() => promise, {
|
|
339
|
+
transparent: true
|
|
340
|
+
});
|
|
341
|
+
});
|
|
342
|
+
assetGates.set(promise, gate);
|
|
343
|
+
}
|
|
344
|
+
gate();
|
|
345
|
+
};
|
|
346
|
+
const EVENT_KEY = "_$$";
|
|
347
|
+
const $$EVENT_OWNER = "_$SOLID_EVENT_OWNER";
|
|
348
|
+
const $$EVENT_TUPLE = Symbol();
|
|
349
|
+
const hasOwn = Object.prototype.hasOwnProperty;
|
|
333
350
|
const INNER_OWNED = {};
|
|
334
351
|
const delegatedEvents = new Set();
|
|
335
352
|
const delegatedContainers = new Map();
|
|
336
|
-
function
|
|
337
|
-
|
|
338
|
-
|
|
353
|
+
function voidFn() {}
|
|
354
|
+
function generateHydrationScript(_options) {
|
|
355
|
+
return "";
|
|
356
|
+
}
|
|
357
|
+
function HydrationScript(_props) {
|
|
358
|
+
return null;
|
|
359
|
+
}
|
|
360
|
+
const getRequestEvent = voidFn;
|
|
361
|
+
const getHydrationWriter = voidFn;
|
|
362
|
+
function takeHydrationValue(key) {
|
|
363
|
+
const registry = globalThis._$HY && globalThis._$HY.r;
|
|
364
|
+
if (!registry || !(key in registry)) return;
|
|
365
|
+
const v = registry[key];
|
|
366
|
+
delete registry[key];
|
|
367
|
+
if (v !== null && typeof v === "object" && typeof v.then === "function") {
|
|
368
|
+
if (v.s === 1) return {
|
|
369
|
+
status: "resolved",
|
|
370
|
+
value: v.v
|
|
371
|
+
};
|
|
372
|
+
if (v.s === 2) {
|
|
373
|
+
v.then(undefined, voidFn);
|
|
374
|
+
return {
|
|
375
|
+
status: "rejected",
|
|
376
|
+
error: v.v
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
return {
|
|
380
|
+
status: "pending",
|
|
381
|
+
promise: v
|
|
382
|
+
};
|
|
339
383
|
}
|
|
384
|
+
return {
|
|
385
|
+
status: "resolved",
|
|
386
|
+
value: v
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
function setLinkClaim(_handler) {
|
|
390
|
+
return false;
|
|
391
|
+
}
|
|
392
|
+
function hasServerLinkState() {
|
|
393
|
+
const registry = globalThis._$HY && globalThis._$HY.r;
|
|
394
|
+
return !!registry && registry.links === 1;
|
|
395
|
+
}
|
|
396
|
+
const getTraceContext = voidFn;
|
|
397
|
+
function render(code, element, init, options = {}) {
|
|
340
398
|
let disposer;
|
|
341
399
|
registerDelegatedRoot(element);
|
|
342
400
|
try {
|
|
343
401
|
createRoot(dispose => {
|
|
344
402
|
disposer = dispose;
|
|
345
|
-
if (
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
}
|
|
403
|
+
if (options.onError) getOwner()[ROOT_ERROR_HOOK] = options.onError;
|
|
404
|
+
const tree = code();
|
|
405
|
+
if (element === document) effect(() => flatten(tree), () => {});else insert(element, () => tree, element.firstChild ? null : undefined, init, {
|
|
406
|
+
...options.insertOptions,
|
|
407
|
+
schedule: true
|
|
408
|
+
});
|
|
352
409
|
}, {
|
|
353
410
|
id: options.renderId
|
|
354
411
|
});
|
|
412
|
+
flush();
|
|
355
413
|
} catch (err) {
|
|
356
414
|
if (disposer) disposer();
|
|
357
415
|
unregisterDelegatedRoot(element);
|
|
358
416
|
throw err;
|
|
417
|
+
} finally {
|
|
359
418
|
}
|
|
360
419
|
return () => {
|
|
361
420
|
disposer();
|
|
@@ -364,20 +423,18 @@ function render$1(code, element, init, options = {}) {
|
|
|
364
423
|
};
|
|
365
424
|
}
|
|
366
425
|
function create(html, bypassGuard, flag) {
|
|
367
|
-
if (isHydrating() && !bypassGuard) throw new Error("Failed attempt to create new DOM elements during hydration. Check that the libraries you are using support hydration.");
|
|
368
426
|
const t = document.createElement("template");
|
|
369
427
|
t.innerHTML = html;
|
|
370
|
-
|
|
428
|
+
const node = t.content.firstChild;
|
|
429
|
+
return flag === 2 ? node.firstChild : node;
|
|
371
430
|
}
|
|
372
431
|
function template(html, flag) {
|
|
373
432
|
let node;
|
|
374
433
|
const fn = flag === 1 ? bypassGuard => document.importNode(node || (node = create(html, bypassGuard, flag)), true) : bypassGuard => (node || (node = create(html, bypassGuard, flag))).cloneNode(true);
|
|
375
|
-
fn._html = flag === 2 ? html.replace(/^<[^>]+>/, "") : html;
|
|
376
434
|
return fn;
|
|
377
435
|
}
|
|
378
436
|
function delegateEvents(eventNames) {
|
|
379
|
-
for (
|
|
380
|
-
const name = eventNames[i];
|
|
437
|
+
for (const name of eventNames) {
|
|
381
438
|
if (!delegatedEvents.has(name)) {
|
|
382
439
|
delegatedEvents.add(name);
|
|
383
440
|
delegatedContainers.forEach((state, container) => attachDelegatedEvent(name, container, state));
|
|
@@ -415,16 +472,40 @@ function unregisterDelegatedContainer(container, owner = container) {
|
|
|
415
472
|
}
|
|
416
473
|
function attachDelegatedEvent(name, container, state) {
|
|
417
474
|
if (state.handlers.has(name)) return;
|
|
418
|
-
const handler = e => eventHandler(e, container, state);
|
|
475
|
+
const handler = e => dispatchAsInteraction(e, () => eventHandler(e, container, state)) ;
|
|
419
476
|
state.handlers.set(name, handler);
|
|
420
477
|
container.addEventListener(name, handler);
|
|
421
478
|
}
|
|
479
|
+
function describeEventTarget(target) {
|
|
480
|
+
if (!target || typeof target.tagName !== "string") return undefined;
|
|
481
|
+
const tag = target.tagName.toLowerCase();
|
|
482
|
+
let out = tag;
|
|
483
|
+
if (target.id) out += `#${target.id}`;else if (typeof target.name === "string" && target.name) out += `[name=${target.name}]`;
|
|
484
|
+
if (tag !== "input" && tag !== "textarea" && tag !== "select") {
|
|
485
|
+
const text = (target.textContent || "").trim().replace(/\s+/g, " ");
|
|
486
|
+
if (text) out += ` "${text.length > 30 ? text.slice(0, 29) + "…" : text}"`;
|
|
487
|
+
}
|
|
488
|
+
return out;
|
|
489
|
+
}
|
|
490
|
+
function interactionStart(e) {
|
|
491
|
+
const at = e.timeStamp;
|
|
492
|
+
return typeof at === "number" && at >= 0 && at <= performance.now() ? at : undefined;
|
|
493
|
+
}
|
|
494
|
+
function dispatchAsInteraction(e, fn) {
|
|
495
|
+
return OBSERVE.attribution.withInteraction({
|
|
496
|
+
type: e.type,
|
|
497
|
+
target: describeEventTarget(e.target),
|
|
498
|
+
at: interactionStart(e),
|
|
499
|
+
event: e
|
|
500
|
+
}, fn) ;
|
|
501
|
+
}
|
|
422
502
|
function getDelegatedRoot(node) {
|
|
423
503
|
while (node) {
|
|
424
504
|
if (delegatedContainers.get(node)?.roots) return node;
|
|
425
|
-
node = node
|
|
505
|
+
node = parentOf(node);
|
|
426
506
|
}
|
|
427
507
|
}
|
|
508
|
+
const parentOf = node => node._$host || node.parentNode || node.host;
|
|
428
509
|
function findOwner(target, state) {
|
|
429
510
|
let node = target;
|
|
430
511
|
let distance = 0;
|
|
@@ -434,22 +515,40 @@ function findOwner(target, state) {
|
|
|
434
515
|
distance
|
|
435
516
|
};
|
|
436
517
|
distance++;
|
|
437
|
-
node = node
|
|
518
|
+
node = parentOf(node);
|
|
438
519
|
}
|
|
439
520
|
}
|
|
440
521
|
function setProperty(node, name, value) {
|
|
441
522
|
if (isHydrating(node)) return;
|
|
523
|
+
const nodeName = node.nodeName;
|
|
524
|
+
if (name === "value" && nodeName === "SELECT") writeSelectValue(node, value);else if ((name === "value" || name === "defaultValue") && (nodeName === "INPUT" || nodeName === "TEXTAREA")) {
|
|
525
|
+
if (value == null && /^(checkbox|radio)$/.test(node.type)) node.removeAttribute("value");else node[name] = value ?? "";
|
|
526
|
+
} else node[name] = value;
|
|
527
|
+
reclaimAttribute(node, name);
|
|
528
|
+
}
|
|
529
|
+
function setStatefulProperty(node, name, value) {
|
|
442
530
|
node[name] = value;
|
|
443
531
|
}
|
|
444
532
|
let claimHandlers = null;
|
|
445
|
-
const
|
|
446
|
-
|
|
533
|
+
const claimAttributeSets = [];
|
|
534
|
+
const CLAIM_SEAM = Symbol.for("solid.element-claims");
|
|
535
|
+
function registerElementClaim(handler, options) {
|
|
447
536
|
(claimHandlers || (claimHandlers = globalThis[CLAIM_SEAM] = [])).push(handler);
|
|
537
|
+
claimAttributeSets.push(options?.attributes || ["href", "action"]);
|
|
448
538
|
return () => {
|
|
449
539
|
const index = claimHandlers.indexOf(handler);
|
|
450
|
-
index > -1
|
|
540
|
+
if (index > -1) {
|
|
541
|
+
claimHandlers.splice(index, 1);
|
|
542
|
+
claimAttributeSets.splice(index, 1);
|
|
543
|
+
}
|
|
451
544
|
};
|
|
452
545
|
}
|
|
546
|
+
function runClaimHandlers(handlers, node) {
|
|
547
|
+
for (let i = 0; i < handlers.length; i++) handlers[i](node);
|
|
548
|
+
}
|
|
549
|
+
function reclaimAttribute(node, name) {
|
|
550
|
+
if (claimHandlers !== null && node._$claimed && claimAttributeSets.some(set => set.includes(name.slice(name.indexOf(":") + 1)))) runClaimHandlers(claimHandlers, node);
|
|
551
|
+
}
|
|
453
552
|
const CLAIMED_ELEMENTS = "a[href], form[action]";
|
|
454
553
|
function claimElementTree(root) {
|
|
455
554
|
const handlers = globalThis[CLAIM_SEAM];
|
|
@@ -457,46 +556,70 @@ function claimElementTree(root) {
|
|
|
457
556
|
const isElement = root.nodeType === 1;
|
|
458
557
|
if (!isElement && root.nodeType !== 11) return root;
|
|
459
558
|
if (isElement && root.matches(CLAIMED_ELEMENTS)) {
|
|
460
|
-
|
|
559
|
+
root._$claimed = true;
|
|
560
|
+
runClaimHandlers(handlers, root);
|
|
461
561
|
}
|
|
462
562
|
const found = root.querySelectorAll(CLAIMED_ELEMENTS);
|
|
463
563
|
for (let i = 0; i < found.length; i++) {
|
|
464
|
-
|
|
564
|
+
found[i]._$claimed = true;
|
|
565
|
+
runClaimHandlers(handlers, found[i]);
|
|
465
566
|
}
|
|
466
567
|
return root;
|
|
467
568
|
}
|
|
468
|
-
function claimElement(node) {
|
|
469
|
-
if (claimHandlers !== null) {
|
|
470
|
-
|
|
569
|
+
function claimElement(node, owner) {
|
|
570
|
+
if (claimHandlers !== null && !node._$claimed) {
|
|
571
|
+
node._$claimed = true;
|
|
572
|
+
if (owner === undefined) runClaimHandlers(claimHandlers, node);else runWithOwner(owner, () => runClaimHandlers(claimHandlers, node));
|
|
471
573
|
}
|
|
472
574
|
return node;
|
|
473
575
|
}
|
|
474
576
|
function setAttribute(node, name, value) {
|
|
475
577
|
if (isHydrating(node)) return;
|
|
476
|
-
|
|
477
|
-
if (
|
|
578
|
+
const selectMultiple = name === "multiple" && node.localName === "select";
|
|
579
|
+
if (value == null || value === false) node.removeAttribute(name);else {
|
|
580
|
+
node.setAttribute(name, value === true ? "" : value);
|
|
581
|
+
if (selectMultiple && !node._$multiple) {
|
|
582
|
+
const options = node.options;
|
|
583
|
+
for (let i = 0; i < options.length; i++) {
|
|
584
|
+
if (options[i].defaultSelected) options[i].selected = true;
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
if (selectMultiple) node._$multiple = true;
|
|
589
|
+
reclaimAttribute(node, name);
|
|
478
590
|
}
|
|
479
591
|
function setAttributeNS(node, namespace, name, value) {
|
|
480
592
|
if (isHydrating(node)) return;
|
|
481
593
|
if (value == null || value === false) node.removeAttributeNS(namespace, name.indexOf(":") > -1 ? name.split(":").pop() : name);else node.setAttributeNS(namespace, name, value === true ? "" : value);
|
|
594
|
+
reclaimAttribute(node, name);
|
|
482
595
|
}
|
|
483
596
|
function className(node, value, prev) {
|
|
484
|
-
if (
|
|
597
|
+
if (typeof value === "number") value = "" + value;
|
|
598
|
+
if (typeof prev === "number") prev = "" + prev;
|
|
599
|
+
if (isHydrating(node)) {
|
|
600
|
+
node._$classes = value && typeof value === "object" ? classListToObject(value) : undefined;
|
|
601
|
+
return;
|
|
602
|
+
}
|
|
485
603
|
if (value == null || value === false) {
|
|
486
|
-
prev
|
|
604
|
+
if (prev || node._$classes) {
|
|
605
|
+
node.removeAttribute("class");
|
|
606
|
+
node._$classes = undefined;
|
|
607
|
+
}
|
|
487
608
|
return;
|
|
488
609
|
}
|
|
489
610
|
if (typeof value === "string") {
|
|
611
|
+
node._$classes = undefined;
|
|
490
612
|
value !== prev && node.setAttribute("class", value);
|
|
491
613
|
return;
|
|
492
614
|
}
|
|
615
|
+
let applied;
|
|
493
616
|
if (typeof prev === "string") {
|
|
494
|
-
|
|
617
|
+
applied = {};
|
|
495
618
|
node.removeAttribute("class");
|
|
496
|
-
} else
|
|
619
|
+
} else applied = node._$classes || classListToObject(prev || {});
|
|
497
620
|
value = classListToObject(value);
|
|
498
|
-
const classKeys = Object.keys(value
|
|
499
|
-
const prevKeys = Object.keys(
|
|
621
|
+
const classKeys = Object.keys(value);
|
|
622
|
+
const prevKeys = Object.keys(applied);
|
|
500
623
|
let i, len;
|
|
501
624
|
for (i = 0, len = prevKeys.length; i < len; i++) {
|
|
502
625
|
const key = prevKeys[i];
|
|
@@ -506,22 +629,39 @@ function className(node, value, prev) {
|
|
|
506
629
|
for (i = 0, len = classKeys.length; i < len; i++) {
|
|
507
630
|
const key = classKeys[i],
|
|
508
631
|
classValue = !!value[key];
|
|
509
|
-
if (!key || key === "undefined" ||
|
|
632
|
+
if (!key || key === "undefined" || applied[key] === classValue || !classValue) continue;
|
|
510
633
|
node.classList.add(key);
|
|
511
634
|
}
|
|
635
|
+
node._$classes = value;
|
|
512
636
|
}
|
|
513
637
|
function addEvent(node, name, handler, delegate) {
|
|
514
638
|
if (delegate) {
|
|
639
|
+
const key = EVENT_KEY + name;
|
|
640
|
+
let data;
|
|
515
641
|
if (Array.isArray(handler)) {
|
|
516
|
-
|
|
517
|
-
node[
|
|
518
|
-
} else node[
|
|
519
|
-
|
|
642
|
+
data = handler[1];
|
|
643
|
+
node[key] = handler[0];
|
|
644
|
+
} else node[key] = handler;
|
|
645
|
+
node[`${key}Data`] = data;
|
|
646
|
+
return;
|
|
647
|
+
}
|
|
648
|
+
if (Array.isArray(handler)) {
|
|
520
649
|
const handlerFn = handler[0];
|
|
521
|
-
|
|
522
|
-
|
|
650
|
+
const listener = e => dispatchAsInteraction(e, () => handlerFn.call(node, handler[1], e)) ;
|
|
651
|
+
listener[$$EVENT_TUPLE] = handler;
|
|
652
|
+
node.addEventListener(name, listener);
|
|
653
|
+
return listener;
|
|
654
|
+
}
|
|
655
|
+
if (typeof handler === "function") {
|
|
656
|
+
const listener = e => dispatchAsInteraction(e, () => handler.call(node, e));
|
|
657
|
+
node.addEventListener(name, listener);
|
|
658
|
+
return listener;
|
|
659
|
+
}
|
|
660
|
+
node.addEventListener(name, handler, typeof handler !== "function" && handler);
|
|
661
|
+
return handler;
|
|
523
662
|
}
|
|
524
663
|
function style(node, value, prev) {
|
|
664
|
+
if (isHydrating(node)) return;
|
|
525
665
|
if (!value) {
|
|
526
666
|
if (prev || node._$styles) {
|
|
527
667
|
setAttribute(node, "style");
|
|
@@ -546,12 +686,13 @@ function style(node, value, prev) {
|
|
|
546
686
|
}
|
|
547
687
|
let v, s;
|
|
548
688
|
for (s in applied) {
|
|
549
|
-
if (value[s] == null) {
|
|
689
|
+
if (!hasOwn.call(value, s) || value[s] == null) {
|
|
550
690
|
nodeStyle.removeProperty(s);
|
|
551
691
|
delete applied[s];
|
|
552
692
|
}
|
|
553
693
|
}
|
|
554
694
|
for (s in value) {
|
|
695
|
+
if (!hasOwn.call(value, s)) continue;
|
|
555
696
|
v = value[s];
|
|
556
697
|
if (v != null && v !== applied[s]) {
|
|
557
698
|
nodeStyle.setProperty(s, v);
|
|
@@ -559,26 +700,134 @@ function style(node, value, prev) {
|
|
|
559
700
|
}
|
|
560
701
|
}
|
|
561
702
|
}
|
|
703
|
+
function readShallow(value) {
|
|
704
|
+
if (value === null || typeof value !== "object") return value;
|
|
705
|
+
if (Array.isArray(value)) return value.map(readShallow);
|
|
706
|
+
if (value[$PROXY] !== value) return value;
|
|
707
|
+
const keys = Reflect.ownKeys(value);
|
|
708
|
+
const out = {};
|
|
709
|
+
for (let i = 0; i < keys.length; i++) {
|
|
710
|
+
const k = keys[i];
|
|
711
|
+
if (typeof k === "string") out[k] = value[k];
|
|
712
|
+
}
|
|
713
|
+
return out;
|
|
714
|
+
}
|
|
562
715
|
function setStyleProperty(node, name, value) {
|
|
716
|
+
if (isHydrating(node)) return;
|
|
563
717
|
value != null ? node.style.setProperty(name, value) : node.style.removeProperty(name);
|
|
564
718
|
}
|
|
565
|
-
function spread(node, props
|
|
719
|
+
function spread(node, props, skipChildren, skip, name, loc) {
|
|
720
|
+
if (name !== undefined) {
|
|
721
|
+
const outer = spreadName;
|
|
722
|
+
const outerLoc = spreadLoc;
|
|
723
|
+
setSpreadName(name, loc);
|
|
724
|
+
try {
|
|
725
|
+
return spread(node, props, skipChildren, skip);
|
|
726
|
+
} finally {
|
|
727
|
+
setSpreadName(outer, outerLoc);
|
|
728
|
+
}
|
|
729
|
+
}
|
|
566
730
|
const prevProps = {};
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
const r =
|
|
570
|
-
(typeof r === "function" || Array.isArray(r))
|
|
571
|
-
|
|
731
|
+
const owner = claimHandlers !== null && (node.localName === "a" || node.localName === "form") ? getOwner() : undefined;
|
|
732
|
+
const apply = newProps => {
|
|
733
|
+
const r = newProps.ref;
|
|
734
|
+
if (r !== prevProps.ref && (typeof r === "function" || Array.isArray(r))) ref(() => r, node);
|
|
735
|
+
assign(node, newProps, true, prevProps, true);
|
|
736
|
+
if (owner !== undefined) claimElement(node, owner);
|
|
737
|
+
};
|
|
738
|
+
if (Array.isArray(props)) {
|
|
739
|
+
effect(() => collectSources({}, props, undefined, skip), apply);
|
|
740
|
+
if (!skipChildren && !(skip !== undefined && skip("children"))) insert(node, () => {
|
|
741
|
+
for (let i = props.length - 1; i >= 0; i--) {
|
|
742
|
+
const s = resolveSource(props[i]);
|
|
743
|
+
if (s != null && entryHas(s, "children")) return entryGet(s, "children");
|
|
744
|
+
}
|
|
745
|
+
});
|
|
746
|
+
return prevProps;
|
|
747
|
+
}
|
|
572
748
|
effect(() => {
|
|
749
|
+
const source = resolveSource(props);
|
|
573
750
|
const newProps = {};
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
751
|
+
const table = resolvedTable(source);
|
|
752
|
+
if (table !== undefined) return collectTable(newProps, table, skip);
|
|
753
|
+
if (source != null) {
|
|
754
|
+
const view = viewOf(source);
|
|
755
|
+
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);
|
|
577
756
|
}
|
|
578
757
|
return newProps;
|
|
579
|
-
},
|
|
758
|
+
}, apply);
|
|
759
|
+
if (!skipChildren && !(skip !== undefined && skip("children"))) {
|
|
760
|
+
if (typeof props !== "function" && props != null && hasStaticKeys(props)) {
|
|
761
|
+
const desc = Object.getOwnPropertyDescriptor(props, "children");
|
|
762
|
+
if (desc !== undefined) {
|
|
763
|
+
if (desc.get === undefined) insert(node, desc.value);else insert(node, () => props.children);
|
|
764
|
+
}
|
|
765
|
+
} else insert(node, () => {
|
|
766
|
+
const source = resolveSource(props);
|
|
767
|
+
return source != null && entryHas(source, "children") ? entryGet(source, "children") : undefined;
|
|
768
|
+
});
|
|
769
|
+
}
|
|
580
770
|
return prevProps;
|
|
581
771
|
}
|
|
772
|
+
function collectTable(out, table, skip) {
|
|
773
|
+
for (const [prop, leaf] of table) {
|
|
774
|
+
if (typeof prop !== "string" || prop === "children") continue;
|
|
775
|
+
if (skip !== undefined && skip(prop)) continue;
|
|
776
|
+
const v = leaf[prop];
|
|
777
|
+
out[prop] = prop === "style" || prop === "class" ? readShallow(v) : v;
|
|
778
|
+
}
|
|
779
|
+
return out;
|
|
780
|
+
}
|
|
781
|
+
function resolveSource(s) {
|
|
782
|
+
return typeof s === "function" ? s() : s;
|
|
783
|
+
}
|
|
784
|
+
function entryHas(s, key) {
|
|
785
|
+
const view = viewOf(s);
|
|
786
|
+
return view instanceof OmitView ? sourceHas(view, SOURCE_OMIT, key) : key in s;
|
|
787
|
+
}
|
|
788
|
+
function entryGet(s, key) {
|
|
789
|
+
const view = viewOf(s);
|
|
790
|
+
return view instanceof OmitView ? sourceGet(view, SOURCE_OMIT, key) : s[key];
|
|
791
|
+
}
|
|
792
|
+
function collectSources(out, sources, kinds, skip) {
|
|
793
|
+
const resolved = [];
|
|
794
|
+
const resolvedKinds = [];
|
|
795
|
+
for (let i = 0; i < sources.length; i++) pushEntry(resolved, resolvedKinds, sources[i], kinds !== undefined ? kinds[i] : SOURCE_MEMO);
|
|
796
|
+
for (let i = 0; i < resolved.length; i++) collectProps(out, resolved[i], resolvedKinds[i], skip, resolved, resolvedKinds, i + 1);
|
|
797
|
+
return out;
|
|
798
|
+
}
|
|
799
|
+
function pushEntry(resolved, kinds, s, kind) {
|
|
800
|
+
if (kind !== SOURCE_MEMO) {
|
|
801
|
+
resolved.push(s);
|
|
802
|
+
kinds.push(kind);
|
|
803
|
+
return;
|
|
804
|
+
}
|
|
805
|
+
s = resolveSource(s);
|
|
806
|
+
if (s == null) return;
|
|
807
|
+
const view = viewOf(s);
|
|
808
|
+
if (view instanceof OmitView) {
|
|
809
|
+
resolved.push(view);
|
|
810
|
+
kinds.push(SOURCE_OMIT);
|
|
811
|
+
} else if (view !== undefined) {
|
|
812
|
+
const f = view.sources,
|
|
813
|
+
k = view.kinds;
|
|
814
|
+
for (let j = 0; j < f.length; j++) pushEntry(resolved, kinds, f[j], k[j]);
|
|
815
|
+
} else {
|
|
816
|
+
resolved.push(s);
|
|
817
|
+
kinds.push($PROXY in s ? SOURCE_PROXY : SOURCE_PLAIN);
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
function collectProps(out, s, kind, skip, later, laterKinds, from) {
|
|
821
|
+
const keys = sourceKeys(s, kind);
|
|
822
|
+
outer: for (let i = 0; i < keys.length; i++) {
|
|
823
|
+
const prop = keys[i];
|
|
824
|
+
if (typeof prop !== "string" || prop === "children") continue;
|
|
825
|
+
if (skip !== undefined && skip(prop)) continue;
|
|
826
|
+
if (later !== undefined) for (let j = from; j < later.length; j++) if (sourceHas(later[j], laterKinds[j], prop)) continue outer;
|
|
827
|
+
const v = sourceGet(s, kind, prop);
|
|
828
|
+
out[prop] = prop === "style" || prop === "class" ? readShallow(v) : v;
|
|
829
|
+
}
|
|
830
|
+
}
|
|
582
831
|
function dynamicProperty(props, key) {
|
|
583
832
|
const src = props[key];
|
|
584
833
|
Object.defineProperty(props, key, {
|
|
@@ -596,11 +845,6 @@ function ref(fn, element) {
|
|
|
596
845
|
const resolved = untrack(fn);
|
|
597
846
|
runWithOwner(null, () => applyRef(resolved, element));
|
|
598
847
|
}
|
|
599
|
-
const PURE_ROW = Symbol.for("solid.pure-row");
|
|
600
|
-
function rowProof(fn) {
|
|
601
|
-
fn[PURE_ROW] = true;
|
|
602
|
-
return fn;
|
|
603
|
-
}
|
|
604
848
|
function scope(fn) {
|
|
605
849
|
fn.$s = true;
|
|
606
850
|
return fn;
|
|
@@ -609,19 +853,19 @@ const SCOPE_OPTIONS = {
|
|
|
609
853
|
scope: true
|
|
610
854
|
};
|
|
611
855
|
let hydrationRt = null;
|
|
856
|
+
let selectInsert = null;
|
|
612
857
|
function installHydrationRuntime() {
|
|
613
858
|
hydrationRt = {
|
|
614
859
|
claimInitial(parent, multi, initial) {
|
|
615
860
|
if (isHydrating(parent)) {
|
|
616
|
-
if (!multi && initial === undefined && parent) initial =
|
|
617
|
-
if (Array.isArray(initial)) stripTextSeparators(initial);
|
|
861
|
+
if (!multi && initial === undefined && parent) initial = claimChildNodes(parent);else if (Array.isArray(initial)) stripTextSeparators(initial);
|
|
618
862
|
}
|
|
619
863
|
return initial;
|
|
620
864
|
},
|
|
621
865
|
reclaimRegion(current, parent, marker) {
|
|
622
|
-
if (!sharedConfig.hydrating ||
|
|
866
|
+
if (!sharedConfig.hydrating || current == null || !parent.isConnected) return current;
|
|
623
867
|
const first = Array.isArray(current) ? current[0] : current;
|
|
624
|
-
if (
|
|
868
|
+
if (first == null || first.isConnected) return current;
|
|
625
869
|
let nodes;
|
|
626
870
|
if (marker) {
|
|
627
871
|
nodes = [];
|
|
@@ -638,7 +882,7 @@ function installHydrationRuntime() {
|
|
|
638
882
|
nodes.unshift(node);
|
|
639
883
|
node = node.previousSibling;
|
|
640
884
|
}
|
|
641
|
-
} else
|
|
885
|
+
} else return claimChildNodes(parent);
|
|
642
886
|
return stripTextSeparators(nodes);
|
|
643
887
|
},
|
|
644
888
|
dedupEvent(e) {
|
|
@@ -651,25 +895,42 @@ function stripTextSeparators(nodes) {
|
|
|
651
895
|
for (let i = 0; i < nodes.length; i++) {
|
|
652
896
|
const node = nodes[i],
|
|
653
897
|
t = node.nodeType;
|
|
654
|
-
if (t === 8) {
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
}
|
|
660
|
-
if (v.startsWith("pl-")) continue;
|
|
661
|
-
} else if (t === 1 && node.localName === "template" && node.id.startsWith("pl-")) continue;
|
|
898
|
+
if (t === 8 && node.nodeValue === "!$") {
|
|
899
|
+
node.remove();
|
|
900
|
+
continue;
|
|
901
|
+
}
|
|
902
|
+
if (isPlaceholderScaffolding(node, t)) continue;
|
|
662
903
|
nodes[j++] = node;
|
|
663
904
|
}
|
|
664
905
|
nodes.length = j;
|
|
665
906
|
return nodes;
|
|
666
907
|
}
|
|
667
|
-
function
|
|
668
|
-
|
|
669
|
-
|
|
908
|
+
function claimChildNodes(parent) {
|
|
909
|
+
const live = parent.childNodes;
|
|
910
|
+
const out = [];
|
|
911
|
+
for (let i = 0, n = live.length; i < n; i++) {
|
|
912
|
+
const node = live[i],
|
|
913
|
+
t = node.nodeType;
|
|
914
|
+
if (t === 8 && node.nodeValue === "!$") {
|
|
915
|
+
node.remove();
|
|
916
|
+
i--;
|
|
917
|
+
n--;
|
|
918
|
+
continue;
|
|
919
|
+
}
|
|
920
|
+
if (isPlaceholderScaffolding(node, t)) continue;
|
|
921
|
+
out.push(node);
|
|
670
922
|
}
|
|
923
|
+
return out;
|
|
924
|
+
}
|
|
925
|
+
function isPlaceholderScaffolding(node, t) {
|
|
926
|
+
return t === 8 ? node.nodeValue.startsWith("pl-") : t === 1 && node.localName === "template" && node.id.startsWith("pl-");
|
|
671
927
|
}
|
|
672
928
|
function insert(parent, accessor, marker, initial, options) {
|
|
929
|
+
if (spreadName !== undefined && (options === undefined || options.name === undefined)) options = {
|
|
930
|
+
...options,
|
|
931
|
+
name: spreadName + ".children",
|
|
932
|
+
loc: spreadLoc
|
|
933
|
+
};
|
|
673
934
|
const multi = marker !== undefined;
|
|
674
935
|
const host = options && options.host;
|
|
675
936
|
if (multi && !initial) initial = [];
|
|
@@ -688,17 +949,21 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
688
949
|
initial = [placeholder];
|
|
689
950
|
}
|
|
690
951
|
let current = initial;
|
|
691
|
-
|
|
952
|
+
let ran = false;
|
|
953
|
+
effect(() => {
|
|
692
954
|
if (hydrationRt !== null) current = hydrationRt.reclaimRegion(current, parent, marker);
|
|
693
955
|
const value = normalize(accessor(), current, multi, true);
|
|
956
|
+
const again = ran;
|
|
957
|
+
ran = true;
|
|
694
958
|
if (typeof value !== "function") return value;
|
|
959
|
+
const innerOptions = again && !(options && options.schedule) ? {
|
|
960
|
+
...options,
|
|
961
|
+
schedule: true
|
|
962
|
+
} : options;
|
|
695
963
|
effect(() => (hydrationRt !== null && (current = hydrationRt.reclaimRegion(current, parent, marker)), normalize(value, current, multi)), inner => {
|
|
696
964
|
current = insertExpression(parent, inner, current, marker);
|
|
697
965
|
host && tagHost(current, host);
|
|
698
|
-
},
|
|
699
|
-
...options,
|
|
700
|
-
schedule: true
|
|
701
|
-
} : options);
|
|
966
|
+
}, innerOptions);
|
|
702
967
|
return INNER_OWNED;
|
|
703
968
|
}, value => {
|
|
704
969
|
if (value === INNER_OWNED) return;
|
|
@@ -733,10 +998,16 @@ function assetEntryKey(descriptor) {
|
|
|
733
998
|
if (descriptor.policy === "exclusive") return "x|" + descriptor.key;
|
|
734
999
|
return descriptor.type === "inline-style" ? "i|" + descriptor.id : descriptor.type + "|" + descriptor.href;
|
|
735
1000
|
}
|
|
736
|
-
function findAssetElement(selector, attr, value) {
|
|
1001
|
+
function findAssetElement(selector, attr, value, qualifiers) {
|
|
737
1002
|
const nodes = document.querySelectorAll(selector);
|
|
738
|
-
for (let i = 0; i < nodes.length; i++) {
|
|
739
|
-
if (nodes[i].getAttribute(attr)
|
|
1003
|
+
outer: for (let i = 0; i < nodes.length; i++) {
|
|
1004
|
+
if (nodes[i].getAttribute(attr) !== value) continue;
|
|
1005
|
+
if (!qualifiers) return nodes[i];
|
|
1006
|
+
for (let q = 0; q < RESOURCE_QUALIFIERS.length; q++) {
|
|
1007
|
+
const name = RESOURCE_QUALIFIERS[q];
|
|
1008
|
+
if (qualifierValue(name, qualifiers[name]) !== qualifierValue(name, nodes[i].getAttribute(name))) continue outer;
|
|
1009
|
+
}
|
|
1010
|
+
return nodes[i];
|
|
740
1011
|
}
|
|
741
1012
|
return null;
|
|
742
1013
|
}
|
|
@@ -780,7 +1051,7 @@ function trackAssetLoad(entry, adopted) {
|
|
|
780
1051
|
}
|
|
781
1052
|
entry.loadState = "pending";
|
|
782
1053
|
entry.loadPromise = new Promise(resolve => {
|
|
783
|
-
const settle = state => {
|
|
1054
|
+
const settle = entry.settle = state => {
|
|
784
1055
|
entry.loadState = state;
|
|
785
1056
|
resolve();
|
|
786
1057
|
};
|
|
@@ -892,6 +1163,7 @@ function acquireAsset(descriptor) {
|
|
|
892
1163
|
entry.timer = setTimeout(() => {
|
|
893
1164
|
assetRegistry.delete(key);
|
|
894
1165
|
entry.element && entry.element.remove();
|
|
1166
|
+
if (entry.loadState === "pending") entry.settle("errored");
|
|
895
1167
|
}, ASSET_REMOVAL_GRACE);
|
|
896
1168
|
};
|
|
897
1169
|
}
|
|
@@ -979,7 +1251,6 @@ function flushHeadRegistry() {
|
|
|
979
1251
|
if (headApplied.get(identity) === sig) continue;
|
|
980
1252
|
headApplied.set(identity, sig);
|
|
981
1253
|
if (identity === "base" || identity === "charset") {
|
|
982
|
-
console.warn(`useHead: <${winner.tags[0].tag}> (${identity}) is shell-only and ignored on the client`);
|
|
983
1254
|
continue;
|
|
984
1255
|
}
|
|
985
1256
|
if (identity === "title") {
|
|
@@ -1002,16 +1273,15 @@ function flushHeadRegistry() {
|
|
|
1002
1273
|
function createHeadElement(tag, props) {
|
|
1003
1274
|
const el = document.createElement(tag);
|
|
1004
1275
|
for (const name in props) {
|
|
1005
|
-
if (name === "children" || name === "ref" || name
|
|
1276
|
+
if (name === "children" || name === "ref" || /^on[A-Z]/.test(name)) continue;
|
|
1006
1277
|
if (!HEAD_ATTR_NAME.test(name)) {
|
|
1007
|
-
console.warn(`useHead: ignoring invalid attribute name "${name}"`);
|
|
1008
1278
|
continue;
|
|
1009
1279
|
}
|
|
1010
1280
|
const v = props[name];
|
|
1011
1281
|
if (v == null || v === false) continue;
|
|
1012
1282
|
el.setAttribute(name, v === true ? "" : String(v));
|
|
1013
1283
|
}
|
|
1014
|
-
if (props.children != null) el.textContent = String(props.children);
|
|
1284
|
+
if (props.children != null) el.textContent = headBodyText(tag, props, String(props.children));
|
|
1015
1285
|
return el;
|
|
1016
1286
|
}
|
|
1017
1287
|
function renderHeadElement(t, identity, existing) {
|
|
@@ -1026,7 +1296,7 @@ function renderHeadElement(t, identity, existing) {
|
|
|
1026
1296
|
function headElementMatches(el, t) {
|
|
1027
1297
|
if (el.tagName.toLowerCase() !== t.tag) return false;
|
|
1028
1298
|
for (const name in t.props) {
|
|
1029
|
-
if (name === "children" || name === "ref" || name
|
|
1299
|
+
if (name === "children" || name === "ref" || /^on[A-Z]/.test(name)) continue;
|
|
1030
1300
|
if (!HEAD_ATTR_NAME.test(name)) continue;
|
|
1031
1301
|
const v = t.props[name];
|
|
1032
1302
|
if (v == null || v === false) {
|
|
@@ -1034,7 +1304,7 @@ function headElementMatches(el, t) {
|
|
|
1034
1304
|
} else if (el.getAttribute(name) !== (v === true ? "" : String(v))) return false;
|
|
1035
1305
|
}
|
|
1036
1306
|
const children = t.props.children;
|
|
1037
|
-
return (children == null ? "" : String(children)) === el.textContent;
|
|
1307
|
+
return (children == null ? "" : headBodyText(t.tag, t.props, String(children))) === el.textContent;
|
|
1038
1308
|
}
|
|
1039
1309
|
function mountHeadResource(tag, props) {
|
|
1040
1310
|
const identity = resourceIdentity(tag, props);
|
|
@@ -1042,8 +1312,8 @@ function mountHeadResource(tag, props) {
|
|
|
1042
1312
|
headMountedResources.add(identity);
|
|
1043
1313
|
const url = props.href || props.src;
|
|
1044
1314
|
let el = null;
|
|
1045
|
-
if (url != null) {
|
|
1046
|
-
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);
|
|
1315
|
+
if (tag === "link" && url == null && typeof props.imagesrcset === "string") el = findAssetElement(`link[rel="${props.rel}"]`, "href", null, props);else if (url != null) {
|
|
1316
|
+
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);
|
|
1047
1317
|
}
|
|
1048
1318
|
if (!el) document.head.appendChild(createHeadElement(tag, props));
|
|
1049
1319
|
}
|
|
@@ -1065,7 +1335,7 @@ function gateHeadResource(props) {
|
|
|
1065
1335
|
if (attrs) descriptor.attrs = attrs;
|
|
1066
1336
|
effect(() => {
|
|
1067
1337
|
const entry = warmAsset(descriptor);
|
|
1068
|
-
if (gateable && entry.loadState === "pending" && typeof waitAsset === "function") waitAsset(entry.loadPromise);
|
|
1338
|
+
if (gateable && !isHydrating() && entry.loadState === "pending" && typeof waitAsset === "function") waitAsset(entry.loadPromise);
|
|
1069
1339
|
}, () => acquireAsset(descriptor));
|
|
1070
1340
|
}
|
|
1071
1341
|
function useHead(tags) {
|
|
@@ -1083,7 +1353,6 @@ function useHead(tags) {
|
|
|
1083
1353
|
for (let i = 0; i < list.length; i++) {
|
|
1084
1354
|
const desc = list[i];
|
|
1085
1355
|
if (!desc || !HEAD_ELIGIBLE_TAGS.has(desc.tag)) {
|
|
1086
|
-
console.warn(`useHead: ignoring non-head tag`, desc);
|
|
1087
1356
|
continue;
|
|
1088
1357
|
}
|
|
1089
1358
|
const cls = classifyHeadTag(desc);
|
|
@@ -1148,9 +1417,34 @@ function loadModuleAssets(mapping) {
|
|
|
1148
1417
|
}
|
|
1149
1418
|
return pending.length ? Promise.all(pending).then(() => {}) : undefined;
|
|
1150
1419
|
}
|
|
1151
|
-
function hydrate
|
|
1420
|
+
function hydrate(code, element, options = {}) {
|
|
1421
|
+
enableHydration();
|
|
1152
1422
|
installHydrationRuntime();
|
|
1153
|
-
|
|
1423
|
+
const hy = globalThis._$HY;
|
|
1424
|
+
const id = options.renderId || "";
|
|
1425
|
+
if (hy.s && !hy.s[id] && !hy.s[""] && !hy.done && document.readyState === "loading") {
|
|
1426
|
+
let started, disposer;
|
|
1427
|
+
const start = () => started || (started = true, disposer = hydrate(code, element, options));
|
|
1428
|
+
(hy.sp || (hy.sp = [])).push([id, start]);
|
|
1429
|
+
hy.sw = key => hy.sp.forEach(([k, f]) => (!key || k === key) && queueMicrotask(f));
|
|
1430
|
+
document.addEventListener("DOMContentLoaded", start, {
|
|
1431
|
+
once: true
|
|
1432
|
+
});
|
|
1433
|
+
return () => {
|
|
1434
|
+
started = true;
|
|
1435
|
+
disposer && disposer();
|
|
1436
|
+
};
|
|
1437
|
+
}
|
|
1438
|
+
if (hy.done) return render(code, element, [...element.childNodes], options);
|
|
1439
|
+
const head = (element.nodeType === 9 ? element : element.ownerDocument).head;
|
|
1440
|
+
if (head && element.contains(head)) {
|
|
1441
|
+
let n = head.firstChild;
|
|
1442
|
+
while (n && n.nodeType === 1 && n.hasAttribute("data-dh") && !n.hasAttribute("data-dhf")) {
|
|
1443
|
+
const next = n.nextSibling;
|
|
1444
|
+
head.appendChild(n);
|
|
1445
|
+
n = next;
|
|
1446
|
+
}
|
|
1447
|
+
}
|
|
1154
1448
|
options.renderId ||= "";
|
|
1155
1449
|
if (!globalThis._$HY.modules) globalThis._$HY.modules = {};
|
|
1156
1450
|
if (!globalThis._$HY.loading) globalThis._$HY.loading = {};
|
|
@@ -1185,16 +1479,6 @@ function hydrate$1(code, element, options = {}) {
|
|
|
1185
1479
|
});
|
|
1186
1480
|
};
|
|
1187
1481
|
sharedConfig.hydrating = true;
|
|
1188
|
-
{
|
|
1189
|
-
sharedConfig.verifyHydration = () => {
|
|
1190
|
-
if (sharedConfig.registry && sharedConfig.registry.size) {
|
|
1191
|
-
const orphaned = [...sharedConfig.registry.values()].filter(node => node.isConnected);
|
|
1192
|
-
sharedConfig.registry.clear();
|
|
1193
|
-
if (!orphaned.length) return;
|
|
1194
|
-
console.warn(`Hydration completed with ${orphaned.length} unclaimed server-rendered node(s):\n` + orphaned.map(node => ` ${node.outerHTML.slice(0, 100)}`).join("\n"));
|
|
1195
|
-
}
|
|
1196
|
-
};
|
|
1197
|
-
}
|
|
1198
1482
|
const hyr = globalThis._$HY.r;
|
|
1199
1483
|
const rootMapping = hyr && (hyr[options.renderId + "_assets"] || hyr["_assets"]);
|
|
1200
1484
|
if (rootMapping && typeof rootMapping === "object") {
|
|
@@ -1209,45 +1493,39 @@ function hydrate$1(code, element, options = {}) {
|
|
|
1209
1493
|
sharedConfig.gather = gather;
|
|
1210
1494
|
sharedConfig.hydrating = true;
|
|
1211
1495
|
try {
|
|
1212
|
-
disposer = render
|
|
1496
|
+
disposer = render(code, element, [...element.childNodes], options);
|
|
1213
1497
|
} finally {
|
|
1214
1498
|
sharedConfig.hydrating = false;
|
|
1215
1499
|
}
|
|
1216
1500
|
}, err => {
|
|
1217
|
-
console.error("Hydration module preload failed, falling back to client render:", err);
|
|
1218
1501
|
sharedConfig.hydrating = false;
|
|
1219
1502
|
sharedConfig.registry = undefined;
|
|
1220
|
-
|
|
1503
|
+
if (element.nodeType === 9) {
|
|
1504
|
+
(globalThis.reportError || console.error)(err);
|
|
1505
|
+
return;
|
|
1506
|
+
}
|
|
1507
|
+
console.error("Hydration module preload failed, falling back to client render:", err);
|
|
1508
|
+
disposer = render(code, element, [...element.childNodes], options);
|
|
1221
1509
|
});
|
|
1222
1510
|
return () => disposer && disposer();
|
|
1223
1511
|
}
|
|
1224
1512
|
}
|
|
1225
1513
|
try {
|
|
1226
1514
|
gatherHydratable(element, options.renderId);
|
|
1227
|
-
return render
|
|
1515
|
+
return render(code, element, [...element.childNodes], options);
|
|
1228
1516
|
} finally {
|
|
1229
1517
|
sharedConfig.hydrating = false;
|
|
1230
1518
|
}
|
|
1231
1519
|
}
|
|
1232
1520
|
function getNextElement(template) {
|
|
1233
|
-
let
|
|
1234
|
-
key
|
|
1235
|
-
|
|
1236
|
-
if (!hydrating || !(node = sharedConfig.registry.get(key = getHydrationKey()))) {
|
|
1521
|
+
let key = sharedConfig.hydrating && getHydrationKey(),
|
|
1522
|
+
node = isHydrating() && sharedConfig.registry.get(key);
|
|
1523
|
+
if (!node) {
|
|
1237
1524
|
if (!template) {
|
|
1238
1525
|
throw new Error(`Hydration Mismatch. Unable to find DOM nodes for hydration key: ${key}`);
|
|
1239
1526
|
}
|
|
1240
|
-
if (hydrating) {
|
|
1241
|
-
console.warn(`Hydration key miss for "${key}": no server-rendered element carries this key` + (template._html ? ` (template: ${template._html.slice(0, 60)})` : "") + `. A detached element was created instead; its subtree will not appear in the ` + `document or become interactive. This usually means the server and client ` + `hydration id namespaces are misaligned — when hydrating a subtree of a larger ` + `server render, wrap the document shell in <NoHydration> and re-enter with ` + `<Hydration> around the hydrated subtree (or pass hydrate() a renderId matching ` + `the server's <Hydration id>).`);
|
|
1242
|
-
}
|
|
1243
1527
|
return template(true);
|
|
1244
1528
|
}
|
|
1245
|
-
if (template && template._html) {
|
|
1246
|
-
const expected = template._html.match(/^<(\w+)/)?.[1];
|
|
1247
|
-
if (expected && node.localName !== expected) {
|
|
1248
|
-
console.warn(`Hydration tag mismatch for key "${key}": expected <${expected}> but found`, node);
|
|
1249
|
-
}
|
|
1250
|
-
}
|
|
1251
1529
|
if (sharedConfig.completed) sharedConfig.completed.add(node);
|
|
1252
1530
|
sharedConfig.registry.delete(key);
|
|
1253
1531
|
return node;
|
|
@@ -1277,48 +1555,12 @@ function getNextMarker(start) {
|
|
|
1277
1555
|
}
|
|
1278
1556
|
function getFirstChild(node, expectedTag) {
|
|
1279
1557
|
const child = node.firstChild;
|
|
1280
|
-
if (isHydrating() && expectedTag && child?.localName !== expectedTag) {
|
|
1281
|
-
const isMissing = !child || child.nodeType !== 1;
|
|
1282
|
-
console.warn("Hydration structure mismatch: expected <" + expectedTag + "> as first child of", node, "\n " + describeSiblings(node, child, expectedTag, isMissing));
|
|
1283
|
-
}
|
|
1284
1558
|
return child;
|
|
1285
1559
|
}
|
|
1286
1560
|
function getNextSibling(node, expectedTag) {
|
|
1287
1561
|
const sibling = node.nextSibling;
|
|
1288
|
-
if (isHydrating() && expectedTag && sibling?.localName !== expectedTag) {
|
|
1289
|
-
const parent = node.parentNode;
|
|
1290
|
-
const isMissing = !sibling || sibling.nodeType !== 1;
|
|
1291
|
-
console.warn("Hydration structure mismatch: expected <" + expectedTag + "> after", node, "in", parent, "\n " + describeSiblings(parent, sibling, expectedTag, isMissing));
|
|
1292
|
-
}
|
|
1293
1562
|
return sibling;
|
|
1294
1563
|
}
|
|
1295
|
-
function describeSiblings(parent, mismatchChild, expectedTag, isMissing) {
|
|
1296
|
-
if (!parent) return `<${expectedTag} \u2190 parent unavailable>`;
|
|
1297
|
-
const children = [];
|
|
1298
|
-
let child = parent.firstChild;
|
|
1299
|
-
while (child) {
|
|
1300
|
-
if (child.nodeType === 1) children.push(child);
|
|
1301
|
-
child = child.nextSibling;
|
|
1302
|
-
}
|
|
1303
|
-
const pTag = parent.localName || "#fragment";
|
|
1304
|
-
if (isMissing) {
|
|
1305
|
-
const tags = children.map(c => `<${c.localName}>`).join("");
|
|
1306
|
-
return `<${pTag}>${tags}<${expectedTag} \u2190 missing></${pTag}>`;
|
|
1307
|
-
}
|
|
1308
|
-
const idx = children.indexOf(mismatchChild);
|
|
1309
|
-
let start = 0,
|
|
1310
|
-
end = children.length;
|
|
1311
|
-
let prefix = "",
|
|
1312
|
-
suffix = "";
|
|
1313
|
-
if (children.length > 6) {
|
|
1314
|
-
start = Math.max(0, idx - 2);
|
|
1315
|
-
end = Math.min(children.length, idx + 3);
|
|
1316
|
-
if (start > 0) prefix = "...";
|
|
1317
|
-
if (end < children.length) suffix = "...";
|
|
1318
|
-
}
|
|
1319
|
-
const tags = children.slice(start, end).map(c => c === mismatchChild ? `<${c.localName} \u2190 expected ${expectedTag}>` : `<${c.localName}>`).join("");
|
|
1320
|
-
return `<${pTag}>${prefix}${tags}${suffix}</${pTag}>`;
|
|
1321
|
-
}
|
|
1322
1564
|
function runHydrationEvents() {
|
|
1323
1565
|
if (sharedConfig.events && !sharedConfig.events.queued) {
|
|
1324
1566
|
queueMicrotask(() => {
|
|
@@ -1358,6 +1600,7 @@ function runHydrationEvents() {
|
|
|
1358
1600
|
matches.sort((a, b) => a.distance - b.distance);
|
|
1359
1601
|
for (let i = 0; i < matches.length; i++) eventHandler(e, matches[i].container, matches[i].state);
|
|
1360
1602
|
} else if (matchContainer) eventHandler(e, matchContainer, matchState);
|
|
1603
|
+
flush();
|
|
1361
1604
|
}
|
|
1362
1605
|
if (sharedConfig.done) {
|
|
1363
1606
|
sharedConfig.events = _$HY.events = null;
|
|
@@ -1369,14 +1612,34 @@ function runHydrationEvents() {
|
|
|
1369
1612
|
}
|
|
1370
1613
|
function isHydrating(node) {
|
|
1371
1614
|
if (!sharedConfig.hydrating) return false;
|
|
1615
|
+
if (sharedConfig.isClaiming && !sharedConfig.isClaiming()) return false;
|
|
1372
1616
|
if (!node || node.isConnected) return true;
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1617
|
+
return serverComponentClaims !== null && serverComponentClaims.claimed(node);
|
|
1618
|
+
}
|
|
1619
|
+
let serverComponentClaims = null;
|
|
1620
|
+
function installServerComponentHydration() {
|
|
1621
|
+
enableServerComponentHydration();
|
|
1622
|
+
if (serverComponentClaims !== null) return;
|
|
1623
|
+
serverComponentClaims = {
|
|
1624
|
+
claimed(node) {
|
|
1625
|
+
const roots = sharedConfig.claimRoots;
|
|
1626
|
+
if (roots) {
|
|
1627
|
+
for (let i = 0; i < roots.length; i++) {
|
|
1628
|
+
if (roots[i].contains(node)) return true;
|
|
1629
|
+
}
|
|
1630
|
+
}
|
|
1631
|
+
return false;
|
|
1632
|
+
},
|
|
1633
|
+
inFrame(element) {
|
|
1634
|
+
const frames = element.querySelectorAll("[data-fid]");
|
|
1635
|
+
const frameCount = frames.length;
|
|
1636
|
+
if (frameCount === 0) return undefined;
|
|
1637
|
+
return node => {
|
|
1638
|
+
for (let j = 0; j < frameCount; j++) if (frames[j].contains(node)) return true;
|
|
1639
|
+
return false;
|
|
1640
|
+
};
|
|
1377
1641
|
}
|
|
1378
|
-
}
|
|
1379
|
-
return false;
|
|
1642
|
+
};
|
|
1380
1643
|
}
|
|
1381
1644
|
function classListToObject(classList) {
|
|
1382
1645
|
if (Array.isArray(classList)) {
|
|
@@ -1400,7 +1663,8 @@ function classListToObject(classList) {
|
|
|
1400
1663
|
function flattenClassList(list, result) {
|
|
1401
1664
|
for (let i = 0, len = list.length; i < len; i++) {
|
|
1402
1665
|
const item = list[i];
|
|
1403
|
-
if (Array.isArray(item)) flattenClassList(item, result);else if (typeof item === "object" && item != null) Object.assign(result, item);
|
|
1666
|
+
if (Array.isArray(item)) flattenClassList(item, result);else if (typeof item === "object" && item != null) Object.assign(result, item);
|
|
1667
|
+
else if (typeof item !== "boolean" && (item || item === 0)) result[item] = true;
|
|
1404
1668
|
}
|
|
1405
1669
|
}
|
|
1406
1670
|
function assignProp(node, prop, value, prev, skipRef, nodeName) {
|
|
@@ -1411,22 +1675,26 @@ function assignProp(node, prop, value, prev, skipRef, nodeName) {
|
|
|
1411
1675
|
if (!skipRef && value) ref(() => value, node);
|
|
1412
1676
|
return value;
|
|
1413
1677
|
}
|
|
1678
|
+
let c;
|
|
1414
1679
|
const hasNamespace = prop.indexOf(":") > -1;
|
|
1415
|
-
if (!hasNamespace && prop.
|
|
1680
|
+
if (!hasNamespace && prop.startsWith("on") && (c = prop.charCodeAt(2)) > 64 && c < 91) {
|
|
1416
1681
|
const name = prop.slice(2).toLowerCase();
|
|
1417
1682
|
const delegate = DelegatedEvents.has(name);
|
|
1418
1683
|
if (!delegate && prev) {
|
|
1419
|
-
|
|
1420
|
-
node.removeEventListener(name,
|
|
1684
|
+
if (Array.isArray(value) && typeof prev === "function" && prev[$$EVENT_TUPLE] === value) return prev;
|
|
1685
|
+
node.removeEventListener(name, prev, typeof prev !== "function" && prev);
|
|
1421
1686
|
}
|
|
1422
1687
|
if (delegate || value) {
|
|
1423
|
-
addEvent(node, name, value, delegate);
|
|
1688
|
+
const attached = addEvent(node, name, value, delegate);
|
|
1424
1689
|
delegate && delegateEvents([name]);
|
|
1690
|
+
if (!delegate) return attached;
|
|
1425
1691
|
}
|
|
1426
1692
|
} else if (hasNamespace && prop.slice(0, 5) === "prop:" || ChildProperties.has(prop) || DOMWithState[nodeName]?.[prop]) {
|
|
1427
1693
|
if (hasNamespace) prop = prop.slice(5);else if (isHydrating(node)) return value;
|
|
1428
|
-
if (prop === "value" && nodeName === "SELECT")
|
|
1429
|
-
|
|
1694
|
+
if (prop === "value" && nodeName === "SELECT") writeSelectValue(node, value);else if ((prop === "value" || prop === "defaultValue") && (nodeName === "INPUT" || nodeName === "TEXTAREA")) {
|
|
1695
|
+
if (value == null && /^(checkbox|radio)$/.test(node.type)) node.removeAttribute("value");else node[prop] = value ?? "";
|
|
1696
|
+
} else node[prop] = value;
|
|
1697
|
+
reclaimAttribute(node, prop);
|
|
1430
1698
|
} else {
|
|
1431
1699
|
const ns = hasNamespace && Namespaces[prop.split(":")[0]];
|
|
1432
1700
|
if (ns) setAttributeNS(node, ns, prop, value);else setAttribute(node, prop, value);
|
|
@@ -1441,47 +1709,39 @@ function eventHandler(e, container, state) {
|
|
|
1441
1709
|
if (prev === true || prev === container || !container.contains(prev)) return;
|
|
1442
1710
|
resumeNode = prev;
|
|
1443
1711
|
}
|
|
1444
|
-
const owner = state
|
|
1445
|
-
if (
|
|
1446
|
-
if (owner
|
|
1447
|
-
e[$$EVENT_OWNER] = owner
|
|
1712
|
+
const owner = state.owners.size === 1 && state.owners.has(container) ? container : findOwner(e.target, state)?.owner;
|
|
1713
|
+
if (!owner) return;
|
|
1714
|
+
if (owner === resumeNode) return;
|
|
1715
|
+
e[$$EVENT_OWNER] = owner;
|
|
1448
1716
|
let node = resumeNode || e.target;
|
|
1449
|
-
const key =
|
|
1450
|
-
const oriTarget = e.target;
|
|
1451
|
-
const boundary = owner || container || e.currentTarget;
|
|
1717
|
+
const key = EVENT_KEY + e.type;
|
|
1452
1718
|
const retarget = value => Object.defineProperty(e, "target", {
|
|
1453
1719
|
configurable: true,
|
|
1454
1720
|
value
|
|
1455
1721
|
});
|
|
1456
1722
|
const handleNode = () => {
|
|
1457
|
-
|
|
1458
|
-
if (handler === undefined && node.hasAttribute && node.hasAttribute("_bnd")) {
|
|
1459
|
-
const seam = globalThis[Symbol.for("dx.bnd")];
|
|
1460
|
-
if (seam) handler = seam.resolve(node, e.type);
|
|
1461
|
-
}
|
|
1723
|
+
const handler = node[key];
|
|
1462
1724
|
if (handler && !node.disabled) {
|
|
1463
1725
|
const data = node[`${key}Data`];
|
|
1464
|
-
data !== undefined ? handler.call(node, data, e) : handler.call(node, e);
|
|
1726
|
+
data !== undefined ? handler.call(node, data, e) : typeof handler === "function" ? handler.call(node, e) : handler.handleEvent(e);
|
|
1465
1727
|
if (e.cancelBubble) return;
|
|
1466
1728
|
}
|
|
1467
1729
|
node.host && typeof node.host !== "string" && !node.host._$host && node.contains(e.target) && retarget(node.host);
|
|
1468
1730
|
return true;
|
|
1469
1731
|
};
|
|
1732
|
+
const atOwner = () => node === owner || node.parentNode === owner;
|
|
1470
1733
|
const walkUpTree = () => {
|
|
1471
|
-
while (node && handleNode())
|
|
1472
|
-
if (node === boundary || node.parentNode === boundary) break;
|
|
1473
|
-
node = node._$host || node.parentNode || node.host;
|
|
1474
|
-
}
|
|
1734
|
+
while (node && handleNode() && !atOwner()) node = parentOf(node);
|
|
1475
1735
|
};
|
|
1476
1736
|
Object.defineProperty(e, "currentTarget", {
|
|
1477
1737
|
configurable: true,
|
|
1478
1738
|
get() {
|
|
1479
|
-
return node ||
|
|
1739
|
+
return node || owner;
|
|
1480
1740
|
}
|
|
1481
1741
|
});
|
|
1482
1742
|
if (resumeNode) {
|
|
1483
|
-
if (resumeNode === e.target) node = resumeNode
|
|
1484
|
-
if (node && node !==
|
|
1743
|
+
if (resumeNode === e.target) node = parentOf(resumeNode);
|
|
1744
|
+
if (node && node !== owner) walkUpTree();
|
|
1485
1745
|
} else if (e.composedPath) {
|
|
1486
1746
|
const path = e.composedPath();
|
|
1487
1747
|
if (path.length) {
|
|
@@ -1494,21 +1754,33 @@ function eventHandler(e, container, state) {
|
|
|
1494
1754
|
walkUpTree();
|
|
1495
1755
|
break;
|
|
1496
1756
|
}
|
|
1497
|
-
if (
|
|
1498
|
-
break;
|
|
1499
|
-
}
|
|
1757
|
+
if (atOwner()) break;
|
|
1500
1758
|
}
|
|
1501
1759
|
} else walkUpTree();
|
|
1502
1760
|
}
|
|
1503
1761
|
else walkUpTree();
|
|
1504
|
-
|
|
1762
|
+
delete e.target;
|
|
1763
|
+
delete e.currentTarget;
|
|
1505
1764
|
}
|
|
1506
1765
|
function insertExpression(parent, value, current, marker) {
|
|
1507
1766
|
if (hydrationRt !== null && isHydrating(parent)) {
|
|
1508
|
-
if (value && value !== current)
|
|
1767
|
+
if (value && value !== current) {
|
|
1768
|
+
const arr = Array.isArray(value);
|
|
1769
|
+
for (const n of arr ? value : [value]) {
|
|
1770
|
+
if (n && n.nodeType) {
|
|
1771
|
+
if (!isHydrating(n)) return current;
|
|
1772
|
+
} else if (arr && (typeof n === "string" || typeof n === "number")) {
|
|
1773
|
+
return current;
|
|
1774
|
+
}
|
|
1775
|
+
}
|
|
1776
|
+
}
|
|
1509
1777
|
return value;
|
|
1510
1778
|
}
|
|
1511
1779
|
if (value === current) return value;
|
|
1780
|
+
if (hydrationRt !== null && sharedConfig.hydrating && value && value.length !== 0) {
|
|
1781
|
+
const tracked = [].concat(current ?? []);
|
|
1782
|
+
if ([].concat(value).every(n => (n === tracked[0] && tracked.shift(), n?.parentNode === parent)) && !tracked.length) return value;
|
|
1783
|
+
}
|
|
1512
1784
|
const t = typeof value,
|
|
1513
1785
|
multi = marker !== undefined;
|
|
1514
1786
|
if (t === "string" || t === "number") {
|
|
@@ -1526,29 +1798,65 @@ function insertExpression(parent, value, current, marker) {
|
|
|
1526
1798
|
} else if (value.nodeType) {
|
|
1527
1799
|
if (Array.isArray(current)) {
|
|
1528
1800
|
cleanChildren(parent, current, multi ? marker : null, value);
|
|
1529
|
-
} else if (current && current.nodeType) {
|
|
1801
|
+
} else if (current != null && current.nodeType) {
|
|
1530
1802
|
current.parentNode === parent ? parent.replaceChild(value, current) : parent.appendChild(value);
|
|
1531
|
-
} else if (current && parent.firstChild) {
|
|
1803
|
+
} else if (current != null && parent.firstChild) {
|
|
1532
1804
|
parent.replaceChild(value, parent.firstChild);
|
|
1533
1805
|
} else {
|
|
1534
1806
|
parent.appendChild(value);
|
|
1535
1807
|
}
|
|
1536
|
-
if (marker) value[$$SLOT] = marker;
|
|
1808
|
+
if (marker || value[$$SLOT]) value[$$SLOT] = marker || parent;
|
|
1537
1809
|
} else if (Array.isArray(value)) {
|
|
1538
|
-
const currentArray =
|
|
1810
|
+
const currentArray = Array.isArray(current);
|
|
1811
|
+
for (let i = 0, len = value.length; i < len; i++) {
|
|
1812
|
+
const item = value[i],
|
|
1813
|
+
t = typeof item;
|
|
1814
|
+
if (t === "string" || t === "number") {
|
|
1815
|
+
const prev = currentArray ? current[i] : undefined;
|
|
1816
|
+
if (prev && prev.nodeType === 3) {
|
|
1817
|
+
if (prev.data !== "" + item) prev.data = item;
|
|
1818
|
+
value[i] = prev;
|
|
1819
|
+
} else value[i] = document.createTextNode(item);
|
|
1820
|
+
}
|
|
1821
|
+
}
|
|
1539
1822
|
if (value.length === 0) {
|
|
1540
1823
|
cleanChildren(parent, current, marker);
|
|
1541
1824
|
} else if (currentArray) {
|
|
1542
|
-
|
|
1543
|
-
appendNodes(parent, value, marker);
|
|
1544
|
-
} else reconcileArrays(parent, current, value, marker);
|
|
1825
|
+
reconcileArrays(parent, current, value, marker);
|
|
1545
1826
|
} else {
|
|
1546
|
-
current
|
|
1547
|
-
|
|
1827
|
+
if (current != null) cleanChildren(parent, current);
|
|
1828
|
+
reconcileArrays(parent, [], value);
|
|
1548
1829
|
}
|
|
1549
|
-
} else
|
|
1830
|
+
} else ;
|
|
1831
|
+
selectInsert && selectInsert(parent);
|
|
1550
1832
|
return value;
|
|
1551
1833
|
}
|
|
1834
|
+
function selectChange(e) {
|
|
1835
|
+
(e = e.currentTarget || e)._$v = null;
|
|
1836
|
+
e.removeEventListener("change", selectChange, true);
|
|
1837
|
+
}
|
|
1838
|
+
function writeSelectValue(node, value) {
|
|
1839
|
+
const had = node._$v && node._$v.map,
|
|
1840
|
+
has = value != null && value.map;
|
|
1841
|
+
if (has) had || node.addEventListener("change", selectChange, true);else had && node.removeEventListener("change", selectChange, true);
|
|
1842
|
+
if (value == null) {
|
|
1843
|
+
node._$v = null;
|
|
1844
|
+
return queueMicrotask(() => node.value = value) || (node.value = value);
|
|
1845
|
+
}
|
|
1846
|
+
node._$v = value;
|
|
1847
|
+
(selectInsert ||= applySelectValue)(node);
|
|
1848
|
+
queueMicrotask(() => selectInsert(node));
|
|
1849
|
+
}
|
|
1850
|
+
function applySelectValue(p) {
|
|
1851
|
+
p && p._$v == null && (p = p.parentNode);
|
|
1852
|
+
const v = p && p._$v;
|
|
1853
|
+
if (v == null) return;
|
|
1854
|
+
if (v.map) {
|
|
1855
|
+
const o = [...p.options];
|
|
1856
|
+
for (let i = 0; i < o.length; i++) o[i].selected = v.some(x => x == o[i].value);
|
|
1857
|
+
v.every(x => o.some(el => el.value == x)) && selectChange(p);
|
|
1858
|
+
} else p.value = v, p.selectedIndex > -1 && p.value == v && (p._$v = null);
|
|
1859
|
+
}
|
|
1552
1860
|
function normalize(value, current, multi, doNotUnwrap) {
|
|
1553
1861
|
value = flatten(value, {
|
|
1554
1862
|
skipNonRendered: true,
|
|
@@ -1556,12 +1864,12 @@ function normalize(value, current, multi, doNotUnwrap) {
|
|
|
1556
1864
|
});
|
|
1557
1865
|
if (doNotUnwrap && typeof value === "function") return value;
|
|
1558
1866
|
if (multi && !Array.isArray(value)) value = [value != null ? value : ""];
|
|
1559
|
-
if (Array.isArray(value)) {
|
|
1867
|
+
if (hydrationRt !== null && sharedConfig.hydrating && Array.isArray(value)) {
|
|
1560
1868
|
for (let i = 0, len = value.length; i < len; i++) {
|
|
1561
1869
|
const item = value[i],
|
|
1562
1870
|
prev = current && current[i],
|
|
1563
1871
|
t = typeof item;
|
|
1564
|
-
if (t === "string" || t === "number")
|
|
1872
|
+
if ((t === "string" || t === "number") && prev && prev.nodeType === 3 && isHydrating(prev)) value[i] = prev;
|
|
1565
1873
|
}
|
|
1566
1874
|
}
|
|
1567
1875
|
return value;
|
|
@@ -1577,13 +1885,6 @@ function tagHost(value, host) {
|
|
|
1577
1885
|
});
|
|
1578
1886
|
}
|
|
1579
1887
|
}
|
|
1580
|
-
function appendNodes(parent, array, marker = null) {
|
|
1581
|
-
for (let i = 0, len = array.length; i < len; i++) {
|
|
1582
|
-
const n = array[i];
|
|
1583
|
-
parent.insertBefore(n, marker);
|
|
1584
|
-
if (marker) n[$$SLOT] = marker;
|
|
1585
|
-
}
|
|
1586
|
-
}
|
|
1587
1888
|
function ownsAllChildren(parent, current) {
|
|
1588
1889
|
if (current == null) return true;
|
|
1589
1890
|
if (Array.isArray(current)) {
|
|
@@ -1618,33 +1919,31 @@ function cleanChildren(parent, current, marker, replacement) {
|
|
|
1618
1919
|
const el = current[i];
|
|
1619
1920
|
if (replacement !== el) {
|
|
1620
1921
|
const tag = el[$$SLOT];
|
|
1621
|
-
const owns = el.parentNode === parent && (!tag || tag === marker);
|
|
1922
|
+
const owns = el.parentNode === parent && (!tag || tag === (marker || parent));
|
|
1622
1923
|
if (replacement && !inserted && !i) owns ? parent.replaceChild(replacement, el) : parent.insertBefore(replacement, marker);else if (owns) el.remove();
|
|
1623
1924
|
} else inserted = true;
|
|
1624
1925
|
}
|
|
1625
1926
|
} else if (replacement) parent.insertBefore(replacement, marker);
|
|
1626
|
-
if (replacement && marker) replacement[$$SLOT] = marker;
|
|
1927
|
+
if (replacement && (marker || replacement[$$SLOT])) replacement[$$SLOT] = marker || parent;
|
|
1627
1928
|
}
|
|
1628
1929
|
function gatherHydratable(element, root) {
|
|
1629
|
-
const templates = element.querySelectorAll(`*[_hk]`);
|
|
1930
|
+
const templates = element.querySelectorAll(root ? `[_hk^="${root.replace(/["\\]/g, "\\$&")}"]` : `*[_hk]`);
|
|
1931
|
+
const inFrame = root || serverComponentClaims === null ? undefined : serverComponentClaims.inFrame(element);
|
|
1932
|
+
const registry = sharedConfig.registry;
|
|
1630
1933
|
for (let i = 0; i < templates.length; i++) {
|
|
1631
1934
|
const node = templates[i];
|
|
1935
|
+
if (inFrame !== undefined && inFrame(node)) continue;
|
|
1632
1936
|
const key = node.getAttribute("_hk");
|
|
1633
|
-
if (
|
|
1634
|
-
if (!key.startsWith(root)) continue;
|
|
1635
|
-
} else {
|
|
1636
|
-
const frame = node.closest("[data-fid]");
|
|
1637
|
-
if (frame && frame !== element && element.contains(frame)) continue;
|
|
1638
|
-
}
|
|
1639
|
-
if (!sharedConfig.registry.has(key)) sharedConfig.registry.set(key, node);
|
|
1937
|
+
if (!registry.has(key)) registry.set(key, node);
|
|
1640
1938
|
}
|
|
1641
1939
|
}
|
|
1642
1940
|
function getHydrationKey() {
|
|
1643
1941
|
return sharedConfig.getNextContextId();
|
|
1644
1942
|
}
|
|
1645
|
-
const voidFn = () => undefined;
|
|
1646
1943
|
const RequestContext = Symbol();
|
|
1647
1944
|
|
|
1945
|
+
function configureServerErrors(_config) {}
|
|
1946
|
+
function reportRequestFailure(_error, _event) {}
|
|
1648
1947
|
function throwInBrowser(func) {
|
|
1649
1948
|
const err = new Error(`${func.name} is not supported in the browser, returning undefined`);
|
|
1650
1949
|
console.error(err);
|
|
@@ -1674,28 +1973,38 @@ function composeMiddleware(middlewares) {
|
|
|
1674
1973
|
throwInBrowser(composeMiddleware);
|
|
1675
1974
|
}
|
|
1676
1975
|
function ssr(template, ...nodes) {}
|
|
1677
|
-
function ssrElement(name, props, children, needsId) {}
|
|
1976
|
+
function ssrElement(name, props, children, needsId, skip, attrs) {}
|
|
1977
|
+
function ssrElementAttribute(key, value) {}
|
|
1978
|
+
function ssrLinkClaim(attrs) {}
|
|
1678
1979
|
function ssrClassName(value) {}
|
|
1679
1980
|
function ssrStyle(value) {}
|
|
1680
1981
|
function ssrStyleProperty(name, value) {}
|
|
1982
|
+
function ssrStyleProperties(...entries) {}
|
|
1681
1983
|
function ssrAttribute(key, value) {}
|
|
1682
1984
|
function ssrGroup(fn, n) {}
|
|
1683
1985
|
function ssrHydrationKey() {}
|
|
1684
|
-
function resolveSSRNode(node, result, top) {}
|
|
1986
|
+
function resolveSSRNode(node, result, top, nested) {}
|
|
1685
1987
|
function escape(s, attr) {}
|
|
1686
1988
|
|
|
1687
1989
|
const ENVELOPE = Symbol.for("solid.ResponseEnvelope");
|
|
1688
|
-
|
|
1689
|
-
const ResponseEnvelope =
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1990
|
+
let EnvelopeClass;
|
|
1991
|
+
const ResponseEnvelope = function ResponseEnvelope(response, value) {
|
|
1992
|
+
if (!EnvelopeClass) {
|
|
1993
|
+
EnvelopeClass = class extends Response {
|
|
1994
|
+
constructor(response, value) {
|
|
1995
|
+
super(response ? response.body : null, response && {
|
|
1996
|
+
status: response.status,
|
|
1997
|
+
statusText: response.statusText,
|
|
1998
|
+
headers: copyHeaders(response.headers)
|
|
1999
|
+
});
|
|
2000
|
+
this.response = response ? this : undefined;
|
|
2001
|
+
this.value = value;
|
|
2002
|
+
}
|
|
2003
|
+
};
|
|
2004
|
+
EnvelopeClass.prototype[ENVELOPE] = true;
|
|
1695
2005
|
}
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
})();
|
|
2006
|
+
return new EnvelopeClass(response, value);
|
|
2007
|
+
};
|
|
1699
2008
|
function isResponseEnvelope(value) {
|
|
1700
2009
|
return !!(value && typeof value === "object" && value[ENVELOPE]);
|
|
1701
2010
|
}
|
|
@@ -1718,24 +2027,38 @@ function isSafeError(value) {
|
|
|
1718
2027
|
return !!(value && (typeof value === "object" || typeof value === "function") && value[SAFE_ERROR]);
|
|
1719
2028
|
}
|
|
1720
2029
|
const REVALIDATE_HEADER = "X-Revalidate";
|
|
1721
|
-
|
|
2030
|
+
const REVALIDATE_ALL = "*";
|
|
2031
|
+
const RESPONSE_HEADER_VALUE_LIMIT = 4096;
|
|
2032
|
+
function copyHeaders(init) {
|
|
2033
|
+
const source = init;
|
|
2034
|
+
if (!source || !source.getSetCookie) return new Headers(init);
|
|
2035
|
+
const headers = new Headers();
|
|
2036
|
+
source.forEach((value, key) => {
|
|
2037
|
+
if (key !== "set-cookie") headers.append(key, value);
|
|
2038
|
+
});
|
|
2039
|
+
for (const cookie of source.getSetCookie()) headers.append("Set-Cookie", cookie);
|
|
2040
|
+
return headers;
|
|
2041
|
+
}
|
|
2042
|
+
function initWithRevalidate(init = {}) {
|
|
2043
|
+
const resolved = typeof init === "number" ? {
|
|
2044
|
+
status: init
|
|
2045
|
+
} : init;
|
|
1722
2046
|
const {
|
|
1723
2047
|
revalidate,
|
|
1724
2048
|
...responseInit
|
|
1725
|
-
} =
|
|
1726
|
-
|
|
1727
|
-
if (
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
});
|
|
1732
|
-
for (const cookie of responseInit.headers.getSetCookie()) {
|
|
1733
|
-
headers.append("Set-Cookie", cookie);
|
|
2049
|
+
} = resolved;
|
|
2050
|
+
const headers = copyHeaders(responseInit.headers);
|
|
2051
|
+
if (revalidate !== undefined) {
|
|
2052
|
+
const list = Array.isArray(revalidate) ? revalidate : [revalidate];
|
|
2053
|
+
if (list.length > 1 && list.includes(REVALIDATE_ALL)) {
|
|
2054
|
+
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.`);
|
|
1734
2055
|
}
|
|
1735
|
-
|
|
1736
|
-
|
|
2056
|
+
const keys = list.join(",");
|
|
2057
|
+
if (keys.length > RESPONSE_HEADER_VALUE_LIMIT) {
|
|
2058
|
+
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.`);
|
|
2059
|
+
}
|
|
2060
|
+
headers.set(REVALIDATE_HEADER, keys);
|
|
1737
2061
|
}
|
|
1738
|
-
revalidate !== undefined && headers.set(REVALIDATE_HEADER, revalidate.toString());
|
|
1739
2062
|
return {
|
|
1740
2063
|
responseInit,
|
|
1741
2064
|
headers
|
|
@@ -1748,13 +2071,17 @@ function redirect(url, init = 302) {
|
|
|
1748
2071
|
const {
|
|
1749
2072
|
responseInit,
|
|
1750
2073
|
headers
|
|
1751
|
-
} = initWithRevalidate(
|
|
1752
|
-
status: init
|
|
1753
|
-
} : init);
|
|
2074
|
+
} = initWithRevalidate(init);
|
|
1754
2075
|
if (responseInit.status === undefined) {
|
|
1755
2076
|
responseInit.status = 302;
|
|
1756
2077
|
}
|
|
1757
|
-
|
|
2078
|
+
const target = typeof url === "string" ? url : url[HREF];
|
|
2079
|
+
const location = typeof target === "string" ? target : String(url);
|
|
2080
|
+
const encoded = location.replace(/[^\x00-\x7f]/gu, encodeURIComponent);
|
|
2081
|
+
if (encoded.length > RESPONSE_HEADER_VALUE_LIMIT) {
|
|
2082
|
+
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.`);
|
|
2083
|
+
}
|
|
2084
|
+
headers.set("Location", encoded);
|
|
1758
2085
|
return new Response(null, {
|
|
1759
2086
|
...responseInit,
|
|
1760
2087
|
headers
|
|
@@ -1770,40 +2097,33 @@ function reload(init = {}) {
|
|
|
1770
2097
|
headers
|
|
1771
2098
|
});
|
|
1772
2099
|
}
|
|
2100
|
+
const NULL_BODY_STATUSES = new Set([204, 205, 304]);
|
|
1773
2101
|
function respond(value, init = {}) {
|
|
1774
2102
|
const {
|
|
1775
2103
|
responseInit,
|
|
1776
2104
|
headers
|
|
1777
2105
|
} = initWithRevalidate(init);
|
|
2106
|
+
for (const header of COMPOSED_BODY_FRAMING) headers.delete(header);
|
|
2107
|
+
if (NULL_BODY_STATUSES.has(responseInit.status)) {
|
|
2108
|
+
return new ResponseEnvelope(new Response(null, {
|
|
2109
|
+
...responseInit,
|
|
2110
|
+
headers
|
|
2111
|
+
}), value);
|
|
2112
|
+
}
|
|
1778
2113
|
headers.set("Content-Type", "application/json");
|
|
1779
|
-
return new ResponseEnvelope(new Response(
|
|
2114
|
+
return new ResponseEnvelope(new Response(new ReadableStream({
|
|
2115
|
+
pull(controller) {
|
|
2116
|
+
controller.enqueue(new TextEncoder().encode(JSON.stringify(value)));
|
|
2117
|
+
controller.close();
|
|
2118
|
+
}
|
|
2119
|
+
}), {
|
|
1780
2120
|
...responseInit,
|
|
1781
2121
|
headers
|
|
1782
2122
|
}), value);
|
|
1783
2123
|
}
|
|
1784
2124
|
|
|
1785
|
-
const mergeProps = merge;
|
|
1786
2125
|
const isServer = false;
|
|
1787
|
-
const isDev =
|
|
1788
|
-
function render(code, element, init, options = {}) {
|
|
1789
|
-
enforceLoadingBoundary(true);
|
|
1790
|
-
try {
|
|
1791
|
-
const dispose = render$1(code, element, init, {
|
|
1792
|
-
...options,
|
|
1793
|
-
insertOptions: {
|
|
1794
|
-
schedule: true
|
|
1795
|
-
}
|
|
1796
|
-
});
|
|
1797
|
-
flush();
|
|
1798
|
-
return dispose;
|
|
1799
|
-
} finally {
|
|
1800
|
-
enforceLoadingBoundary(false);
|
|
1801
|
-
}
|
|
1802
|
-
}
|
|
1803
|
-
const hydrate = (...args) => {
|
|
1804
|
-
enableHydration();
|
|
1805
|
-
return hydrate$1(...args);
|
|
1806
|
-
};
|
|
2126
|
+
const isDev = false;
|
|
1807
2127
|
function Portal(props) {
|
|
1808
2128
|
return runWithOwner(createOwner(), () => portalImpl(props));
|
|
1809
2129
|
}
|
|
@@ -1856,67 +2176,25 @@ function portalImpl(props) {
|
|
|
1856
2176
|
});
|
|
1857
2177
|
return treeMarker;
|
|
1858
2178
|
}
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
const
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
if (!binding) return next;
|
|
1870
|
-
deliveredAddress = binding.address;
|
|
1871
|
-
const prevBinding = bindingOf(prev);
|
|
1872
|
-
if (prevBinding && prevBinding.component === binding.component) {
|
|
1873
|
-
for (const deliver of sites) deliver(binding.address);
|
|
1874
|
-
return prev;
|
|
1875
|
-
}
|
|
1876
|
-
return next;
|
|
1877
|
-
};
|
|
1878
|
-
const cached = createMemo(prev => {
|
|
1879
|
-
const next = source();
|
|
1880
|
-
if (!next || typeof next.then !== "function") return resolveBinding(next, prev);
|
|
1881
|
-
const token = ++latest;
|
|
1882
|
-
return {
|
|
1883
|
-
then: (onFulfilled, onRejected) => next.then(resolved => onFulfilled(token === latest ? resolveBinding(resolved, prev) : resolved), onRejected)
|
|
1884
|
-
};
|
|
1885
|
-
}, {
|
|
1886
|
-
lazy: true
|
|
1887
|
-
});
|
|
1888
|
-
return props => {
|
|
1889
|
-
return createMemo(() => {
|
|
1890
|
-
const component = cached();
|
|
1891
|
-
switch (typeof component) {
|
|
1892
|
-
case "function":
|
|
1893
|
-
{
|
|
1894
|
-
Object.assign(component, {
|
|
1895
|
-
[$DEVCOMP]: true
|
|
1896
|
-
});
|
|
1897
|
-
const binding = bindingOf(component);
|
|
1898
|
-
if (binding) {
|
|
1899
|
-
const [address, setAddress] = createSignal(deliveredAddress ?? binding.address);
|
|
1900
|
-
sites.add(setAddress);
|
|
1901
|
-
onCleanup(() => sites.delete(setAddress));
|
|
1902
|
-
return untrack(() => binding.component(props, address));
|
|
1903
|
-
}
|
|
1904
|
-
return untrack(() => component(props));
|
|
1905
|
-
}
|
|
1906
|
-
case "string":
|
|
1907
|
-
const el = sharedConfig.hydrating ? getNextElement() : createElement(component, untrack(() => props.is));
|
|
1908
|
-
spread(el, props);
|
|
1909
|
-
return el;
|
|
1910
|
-
}
|
|
1911
|
-
});
|
|
1912
|
-
};
|
|
2179
|
+
function dynamic(source, options) {
|
|
2180
|
+
return dynamicCore(source, options, staticElement);
|
|
2181
|
+
}
|
|
2182
|
+
function staticElement(tag, props) {
|
|
2183
|
+
const hydrating = sharedConfig.hydrating;
|
|
2184
|
+
const create = () => createElement(tag, untrack(() => props.is), untrack(() => props.xmlns));
|
|
2185
|
+
const el = hydrating ? getNextElement(create) : create();
|
|
2186
|
+
spread(el, props);
|
|
2187
|
+
if (hydrating) runHydrationEvents();
|
|
2188
|
+
return el;
|
|
1913
2189
|
}
|
|
1914
2190
|
function Dynamic(props) {
|
|
1915
2191
|
const Comp = dynamic(() => props.component);
|
|
1916
2192
|
return createComponent(Comp, omit(props, "component"));
|
|
1917
2193
|
}
|
|
1918
|
-
function createElement(tagName, is = undefined) {
|
|
1919
|
-
return
|
|
2194
|
+
function createElement(tagName, is = undefined, xmlns = undefined) {
|
|
2195
|
+
return xmlns ? document.createElementNS(xmlns, tagName, {
|
|
2196
|
+
is
|
|
2197
|
+
}) : SVGElements.has(tagName) ? document.createElementNS(Namespaces.svg, tagName) : MathMLElements.has(tagName) ? document.createElementNS(Namespaces.mathml, tagName) : document.createElement(tagName, {
|
|
1920
2198
|
is
|
|
1921
2199
|
});
|
|
1922
2200
|
}
|
|
@@ -1948,4 +2226,4 @@ _moduleUrl) {
|
|
|
1948
2226
|
function httpStatus(_code, _text) {}
|
|
1949
2227
|
function httpHeader(_name, _value, _options) {}
|
|
1950
2228
|
|
|
1951
|
-
export { ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF,
|
|
2229
|
+
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 };
|