@solidjs/web 2.0.0-rc.2 → 2.0.0-rc.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/server.dev.js +5065 -0
- package/dist/server.js +1757 -355
- package/dist/{server.cjs → server.observe.js} +1951 -558
- package/dist/{dev.cjs → web.dev.js} +945 -550
- package/dist/web.js +635 -332
- package/dist/{dev.js → web.observe.js} +688 -403
- 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 +2549 -0
- package/frames/dist/server.js +1688 -3005
- package/frames/dist/server.observe.js +2548 -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 +242 -88
- package/serialization/package.json +2 -15
- package/serialization/types/index.d.ts +85 -158
- package/serialization/types/serializer-decode.d.ts +173 -114
- package/serialization/types/serializer.d.ts +109 -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 +84 -1
- package/server-functions/dist/server.dev.js +2714 -297
- package/server-functions/dist/server.js +2595 -271
- package/server-functions/dist/server.observe.js +3594 -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 +85 -158
- 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 +85 -158
- package/types/server-functions/argument-codec.d.ts +30 -0
- package/types/server-functions/client.d.ts +238 -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 +539 -531
- package/types/server-functions/shared.d.ts +398 -425
- package/types/server-functions/uploads.d.ts +50 -0
- package/types/server-mock.d.ts +120 -13
- package/types/server-observe.d.ts +86 -0
- package/types/server.d.ts +571 -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,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { createRenderEffect, getOwner, createMemo, OBSERVE, DEV, enableHydration, $PROXY, untrack, runWithOwner, resetErrorHalt, enforceLoadingBoundary, createRoot, 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';
|
|
4
4
|
|
|
5
5
|
const DOMWithState = {
|
|
6
6
|
INPUT: {
|
|
@@ -49,98 +49,115 @@ const Namespaces = {
|
|
|
49
49
|
const VoidElements = /*#__PURE__*/new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr"]);
|
|
50
50
|
const RawTextElements = /*#__PURE__*/new Set(["style", "script", "noscript", "template", "textarea", "title"]);
|
|
51
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"]);
|
|
52
53
|
|
|
53
54
|
const transparentOptions = {
|
|
54
55
|
transparent: true,
|
|
55
56
|
sync: true
|
|
56
57
|
};
|
|
58
|
+
let spreadName;
|
|
59
|
+
let spreadLoc;
|
|
60
|
+
function setSpreadName(name, loc) {
|
|
61
|
+
spreadName = name;
|
|
62
|
+
spreadLoc = loc;
|
|
63
|
+
}
|
|
57
64
|
const syncOptions = {
|
|
58
65
|
sync: true
|
|
59
66
|
};
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
67
|
+
let bindingEffect = null;
|
|
68
|
+
function tagElement(node) {
|
|
69
|
+
if (bindingEffect !== null && bindingEffect._devElement === undefined) bindingEffect._devElement = node;
|
|
70
|
+
}
|
|
71
|
+
function effect(fn, effectFn, options) {
|
|
72
|
+
if (spreadName !== undefined && (options === undefined || options.name === undefined)) options = {
|
|
73
|
+
...options,
|
|
74
|
+
name: spreadName + ".spread",
|
|
75
|
+
loc: spreadLoc
|
|
76
|
+
};
|
|
77
|
+
const nodeOptions = options ? {
|
|
78
|
+
sync: true,
|
|
79
|
+
...options,
|
|
80
|
+
transparent: !options.scope
|
|
81
|
+
} : transparentOptions;
|
|
82
|
+
{
|
|
83
|
+
let node = null;
|
|
84
|
+
createRenderEffect(prev => {
|
|
85
|
+
node = getOwner();
|
|
86
|
+
return fn(prev);
|
|
87
|
+
}, (value, prev) => {
|
|
88
|
+
const outer = bindingEffect;
|
|
89
|
+
bindingEffect = node;
|
|
90
|
+
try {
|
|
91
|
+
return effectFn(value, prev);
|
|
92
|
+
} finally {
|
|
93
|
+
bindingEffect = outer;
|
|
94
|
+
}
|
|
95
|
+
}, nodeOptions);
|
|
96
|
+
return;
|
|
74
97
|
}
|
|
75
|
-
|
|
76
|
-
|
|
98
|
+
}
|
|
99
|
+
function memo(fn) {
|
|
100
|
+
return createMemo(() => fn(), syncOptions);
|
|
101
|
+
}
|
|
77
102
|
|
|
78
103
|
function reconcileArrays(parentNode, a, b, marker) {
|
|
104
|
+
let active = parentNode.moveBefore && parentNode.isConnected && document.activeElement;
|
|
105
|
+
if (active === document.body) active = null;
|
|
106
|
+
const slot = marker || parentNode;
|
|
107
|
+
const insert = (n, ref) => {
|
|
108
|
+
active && n.isConnected && n.contains(active) ? parentNode.moveBefore(n, ref) : parentNode.insertBefore(n, ref);
|
|
109
|
+
if (marker || n[$$SLOT]) n[$$SLOT] = slot;
|
|
110
|
+
};
|
|
111
|
+
if (!a.length) {
|
|
112
|
+
for (const n of b) insert(n, marker);
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
const isLive = n => {
|
|
116
|
+
if (!n) return false;
|
|
117
|
+
const tag = n[$$SLOT];
|
|
118
|
+
return n.parentNode === parentNode && (!tag || tag === slot);
|
|
119
|
+
};
|
|
79
120
|
let bLength = b.length,
|
|
80
121
|
aEnd = a.length,
|
|
81
122
|
bEnd = bLength,
|
|
82
123
|
aStart = 0,
|
|
83
124
|
bStart = 0,
|
|
84
125
|
tail = a[aEnd - 1],
|
|
85
|
-
|
|
86
|
-
after = tail.parentNode === parentNode && (!tailTag || tailTag === marker) ? tail.nextSibling : marker || null,
|
|
126
|
+
after = isLive(tail) ? tail.nextSibling : marker || null,
|
|
87
127
|
map = null,
|
|
88
128
|
anchor,
|
|
89
129
|
anchorTag;
|
|
90
|
-
const isLive = n => {
|
|
91
|
-
if (!n) return false;
|
|
92
|
-
const tag = n[$$SLOT];
|
|
93
|
-
return n.parentNode === parentNode && (!tag || tag === marker);
|
|
94
|
-
};
|
|
95
130
|
while (aStart < aEnd || bStart < bEnd) {
|
|
96
|
-
if (a[aStart] === b[bStart]
|
|
131
|
+
if (a[aStart] === b[bStart]) {
|
|
97
132
|
aStart++;
|
|
98
133
|
bStart++;
|
|
99
134
|
continue;
|
|
100
135
|
}
|
|
101
|
-
while (a[aEnd - 1] === b[bEnd - 1]
|
|
136
|
+
while (aEnd > aStart && bEnd > bStart && a[aEnd - 1] === b[bEnd - 1]) {
|
|
102
137
|
aEnd--;
|
|
103
138
|
bEnd--;
|
|
104
139
|
}
|
|
105
140
|
if (aEnd === aStart) {
|
|
106
|
-
let
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
const prevTag = prev[$$SLOT];
|
|
111
|
-
node = prev.parentNode === parentNode && (!prevTag || prevTag === marker) ? prev.nextSibling : after;
|
|
112
|
-
} else node = b[bEnd - bStart];
|
|
113
|
-
} else node = after;
|
|
114
|
-
while (bStart < bEnd) {
|
|
115
|
-
const n = b[bStart++];
|
|
116
|
-
parentNode.insertBefore(n, node);
|
|
117
|
-
if (marker) n[$$SLOT] = marker;
|
|
118
|
-
}
|
|
141
|
+
let k = bEnd;
|
|
142
|
+
while (k < bLength && !isLive(b[k])) k++;
|
|
143
|
+
const node = k < bLength ? b[k] : after;
|
|
144
|
+
while (bStart < bEnd) insert(b[bStart++], node);
|
|
119
145
|
} else if (bEnd === bStart) {
|
|
120
146
|
while (aStart < aEnd) {
|
|
121
147
|
const n = a[aStart++];
|
|
122
|
-
if (!map || !map.has(n))
|
|
123
|
-
const tag = n[$$SLOT];
|
|
124
|
-
if (n.parentNode === parentNode && (!tag || tag === marker)) n.remove();
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
} else if ((anchor = a[aStart]) === b[bEnd - 1] && b[bStart] === a[aEnd - 1] && anchor.parentNode === parentNode && (!(anchorTag = anchor[$$SLOT]) || anchorTag === marker)) {
|
|
128
|
-
if (marker) {
|
|
129
|
-
do {
|
|
130
|
-
const n = a[--aEnd];
|
|
131
|
-
parentNode.insertBefore(n, anchor);
|
|
132
|
-
n[$$SLOT] = marker;
|
|
133
|
-
bStart++;
|
|
134
|
-
if (aStart >= aEnd - 1 || bStart >= bEnd) break;
|
|
135
|
-
} while (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]);
|
|
136
|
-
} else {
|
|
137
|
-
do {
|
|
138
|
-
parentNode.insertBefore(a[--aEnd], anchor);
|
|
139
|
-
bStart++;
|
|
140
|
-
if (aStart >= aEnd - 1 || bStart >= bEnd) break;
|
|
141
|
-
} while (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]);
|
|
148
|
+
if ((!map || !map.has(n)) && isLive(n)) n.remove();
|
|
142
149
|
}
|
|
150
|
+
} else if ((anchor = a[aStart]) === b[bEnd - 1] && b[bStart] === a[aEnd - 1] && anchor.parentNode === parentNode && (!(anchorTag = anchor[$$SLOT]) || anchorTag === slot)) {
|
|
151
|
+
do {
|
|
152
|
+
insert(a[--aEnd], anchor);
|
|
153
|
+
bStart++;
|
|
154
|
+
if (aStart >= aEnd - 1 || bStart >= bEnd) break;
|
|
155
|
+
} while (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]);
|
|
143
156
|
} else {
|
|
157
|
+
if (!isLive(a[aStart])) {
|
|
158
|
+
aStart++;
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
144
161
|
if (!map) {
|
|
145
162
|
map = new Map();
|
|
146
163
|
let i = bStart;
|
|
@@ -157,35 +174,105 @@ function reconcileArrays(parentNode, a, b, marker) {
|
|
|
157
174
|
sequence++;
|
|
158
175
|
}
|
|
159
176
|
if (sequence > index - bStart) {
|
|
160
|
-
const
|
|
161
|
-
|
|
162
|
-
const node = head.parentNode === parentNode && (!headTag || headTag === marker) ? head : after;
|
|
163
|
-
while (bStart < index) {
|
|
164
|
-
const n = b[bStart++];
|
|
165
|
-
parentNode.insertBefore(n, node);
|
|
166
|
-
if (marker) n[$$SLOT] = marker;
|
|
167
|
-
}
|
|
177
|
+
const node = a[aStart];
|
|
178
|
+
while (bStart < index) insert(b[bStart++], node);
|
|
168
179
|
} else {
|
|
169
|
-
const
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
if (
|
|
173
|
-
parentNode.replaceChild(newNode, oldNode);
|
|
174
|
-
} else {
|
|
175
|
-
parentNode.insertBefore(newNode, after);
|
|
176
|
-
}
|
|
177
|
-
if (marker) newNode[$$SLOT] = marker;
|
|
180
|
+
const newNode = b[bStart++],
|
|
181
|
+
node = a[aStart++];
|
|
182
|
+
active && parentNode.contains(active) ? insert(newNode, node) : parentNode.replaceChild(newNode, node);
|
|
183
|
+
if (marker || newNode[$$SLOT]) newNode[$$SLOT] = slot;
|
|
178
184
|
}
|
|
179
185
|
} else aStart++;
|
|
180
|
-
} else
|
|
181
|
-
const n = a[aStart++];
|
|
182
|
-
const nTag = n[$$SLOT];
|
|
183
|
-
if (n.parentNode === parentNode && (!nTag || nTag === marker)) n.remove();
|
|
184
|
-
}
|
|
186
|
+
} else a[aStart++].remove();
|
|
185
187
|
}
|
|
186
188
|
}
|
|
187
189
|
}
|
|
188
190
|
|
|
191
|
+
function emitFinding(finding, subject = getOwner()) {
|
|
192
|
+
if (OBSERVE === undefined) return;
|
|
193
|
+
const entry = OBSERVE.diagnostics.emit(finding, subject);
|
|
194
|
+
if (DEV !== undefined) DEV.report(entry);
|
|
195
|
+
}
|
|
196
|
+
function devCheck(finding, subject) {
|
|
197
|
+
emitFinding(finding, subject);
|
|
198
|
+
}
|
|
199
|
+
function unscopedHoleAllocatedIds(before, after, site, subject) {
|
|
200
|
+
const fn = site.name ? `\`${site.name}\`` : "a function";
|
|
201
|
+
const where = site.registered !== undefined ? `the server evaluated it at ${before} (→ ${after}), after the scoped holes that follow it ` + `had reserved theirs, but it was registered at ${site.registered}, where the client builds ` + `it in place` : `the client built it in place at ${before} (→ ${after}) and its content missed its ` + `server-rendered keys, because the server evaluates it after the scoped holes that follow it`;
|
|
202
|
+
devCheck({
|
|
203
|
+
code: "UNSCOPED_HOLE_ALLOCATED_IDS",
|
|
204
|
+
kind: "render",
|
|
205
|
+
severity: "warn",
|
|
206
|
+
message: `[UNSCOPED_HOLE_ALLOCATED_IDS] A JSX hole received ${fn} instead of a value, and calling it ` + `built hydratable content. The hole is unscoped, so that content took ids from the enclosing ` + `scope's counter: ${where}. The hydration keys of this hole's content and of the holes after it ` + `permute between server and client. Pass the built value — call it at the hole ` + `(\`{${site.name || "render"}()}\`) or assign the result first — rather than the function; a ` + `function is not a JSX.Element, so this shape is reached only from JavaScript or through a cast.`,
|
|
207
|
+
data: {
|
|
208
|
+
before,
|
|
209
|
+
after,
|
|
210
|
+
...site
|
|
211
|
+
}
|
|
212
|
+
}, subject);
|
|
213
|
+
}
|
|
214
|
+
const lowercaseEventAttributesReported = /*#__PURE__*/new Set();
|
|
215
|
+
function lowercaseEventAttribute(name, node) {
|
|
216
|
+
if (lowercaseEventAttributesReported.has(name)) return;
|
|
217
|
+
lowercaseEventAttributesReported.add(name);
|
|
218
|
+
const event = name.slice(name.charAt(2) === ":" ? 3 : 2);
|
|
219
|
+
const handler = "on" + event.charAt(0).toUpperCase() + event.slice(1);
|
|
220
|
+
devCheck({
|
|
221
|
+
code: "LOWERCASE_EVENT_ATTRIBUTE",
|
|
222
|
+
kind: "render",
|
|
223
|
+
severity: "warn",
|
|
224
|
+
message: `[LOWERCASE_EVENT_ATTRIBUTE] \`${name}\` received a function, but \`${name}\` is an attribute ` + `in Solid 2.0, not an event handler: the function was set as the attribute's text. ` + `Use \`${handler}\` for event handlers.`,
|
|
225
|
+
data: {
|
|
226
|
+
name,
|
|
227
|
+
handler,
|
|
228
|
+
tag: node.localName
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
const statefulWrites = /*#__PURE__*/new WeakMap();
|
|
233
|
+
function statefulRecord(node, prop) {
|
|
234
|
+
if (DOMWithState[node.nodeName]?.[prop] !== 1 || node.nodeName === "SELECT") return;
|
|
235
|
+
let records = statefulWrites.get(node);
|
|
236
|
+
if (!records) statefulWrites.set(node, records = {});
|
|
237
|
+
return records;
|
|
238
|
+
}
|
|
239
|
+
function checkStatefulWrite(node, prop, value) {
|
|
240
|
+
const record = statefulRecord(node, prop)?.[prop];
|
|
241
|
+
if (!record || record.w || value !== record.v || node[prop] === record.d) return;
|
|
242
|
+
record.w = 1;
|
|
243
|
+
const tag = node.localName;
|
|
244
|
+
const type = tag === "input" ? node.type : undefined;
|
|
245
|
+
const name = node.getAttribute("name") || undefined,
|
|
246
|
+
id = node.id || undefined;
|
|
247
|
+
let element = `<${tag}`;
|
|
248
|
+
if (type) element += ` type="${type}"`;
|
|
249
|
+
if (name) element += ` name="${name}"`;else if (id) element += ` id="${id}"`;
|
|
250
|
+
element += `>.${prop}`;
|
|
251
|
+
const handler = prop === "muted" ? "onVolumeChange" : prop === "value" ? "onInput" : "onChange";
|
|
252
|
+
const defaultProp = "default" + prop.charAt(0).toUpperCase() + prop.slice(1);
|
|
253
|
+
devCheck({
|
|
254
|
+
code: "UNCOMMITTED_INPUT_OVERWRITTEN",
|
|
255
|
+
kind: "render",
|
|
256
|
+
severity: "warn",
|
|
257
|
+
message: `[UNCOMMITTED_INPUT_OVERWRITTEN] ${element} was changed by the user, but the change was ` + `never committed to the signal bound to \`${prop}\`, and Solid is writing the bound value ` + `back over it: the user's input is lost. A compiled \`${prop}\` binding re-applies the ` + `bound value whenever its effect runs — here with the value unchanged, because another ` + `binding in the same template changed, a spread re-ran, or the source fired with an equal ` + `value — and the signal is the source of truth. Write the signal on every edit ` + `(\`${handler}={e => setValue(e.currentTarget.${prop})}\`, a draft signal you commit ` + `later), use \`${defaultProp}\` for an uncontrolled element, or write a rejected edit back ` + `explicitly (\`e.currentTarget.${prop} = next\`).`,
|
|
258
|
+
data: {
|
|
259
|
+
tag,
|
|
260
|
+
prop,
|
|
261
|
+
type,
|
|
262
|
+
name,
|
|
263
|
+
id
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
function recordStatefulWrite(node, prop, value) {
|
|
268
|
+
const records = statefulRecord(node, prop);
|
|
269
|
+
if (records) records[prop] = {
|
|
270
|
+
v: value,
|
|
271
|
+
d: node[prop],
|
|
272
|
+
w: records[prop]?.w
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
|
|
189
276
|
const HEAD_ELIGIBLE_TAGS = new Set(["title", "meta", "link", "style", "script", "base"]);
|
|
190
277
|
const HEAD_ATTR_NAME = /^[a-zA-Z_][a-zA-Z0-9_:.-]*$/;
|
|
191
278
|
const RESOURCE_LINK_RELS = new Set(["preload", "modulepreload", "prefetch", "preconnect", "dns-prefetch", "stylesheet"]);
|
|
@@ -218,11 +305,28 @@ function classifyHeadTag(desc) {
|
|
|
218
305
|
resource: false
|
|
219
306
|
};
|
|
220
307
|
}
|
|
308
|
+
function qualifierValue(name, value) {
|
|
309
|
+
if (value == null || value === false) return null;
|
|
310
|
+
if (name === "imagesrcset" || name === "imagesizes") return typeof value === "string" && value !== "" ? value : null;
|
|
311
|
+
const v = value === true ? "" : String(value);
|
|
312
|
+
if (name === "as") return asciiLowerCase(v);
|
|
313
|
+
if (name !== "crossorigin") return v;
|
|
314
|
+
return v.length === 15 && v.toLowerCase() === "use-credentials" ? v.toLowerCase() : "anonymous";
|
|
315
|
+
}
|
|
316
|
+
function asciiLowerCase(value) {
|
|
317
|
+
return value.replace(/[A-Z]/g, c => String.fromCharCode(c.charCodeAt(0) + 32));
|
|
318
|
+
}
|
|
319
|
+
const JSON_SCRIPT_TYPE = /^(?:importmap|speculationrules)$|^[\t\n\r ]*(?:application\/json|text\/json|[\w!#$%&'*+.^`|~-]+\/[\w!#$%&'*+.^`|~-]*\+json)[\t\n\r ]*(?:;|$)/i;
|
|
320
|
+
function headBodyText(tag, props, text) {
|
|
321
|
+
return tag === "script" && JSON_SCRIPT_TYPE.test(String(props.type)) ? text.replace(/</g, "\\u003C") : text;
|
|
322
|
+
}
|
|
221
323
|
function resourceIdentity(tag, props) {
|
|
222
|
-
|
|
324
|
+
const url = String(props.href || props.src || "");
|
|
325
|
+
let id = "res:" + tag + ":" + (props.rel || "") + ":" + url.length + ":" + url;
|
|
223
326
|
for (let i = 0; i < RESOURCE_QUALIFIERS.length; i++) {
|
|
224
327
|
const q = RESOURCE_QUALIFIERS[i];
|
|
225
|
-
|
|
328
|
+
const value = qualifierValue(q, props[q]);
|
|
329
|
+
if (value !== null) id += ":" + q + "=" + value.length + ":" + value;
|
|
226
330
|
}
|
|
227
331
|
return id;
|
|
228
332
|
}
|
|
@@ -256,7 +360,16 @@ function resolveHead(groups) {
|
|
|
256
360
|
}
|
|
257
361
|
for (const [identity, tags] of byIdentity) {
|
|
258
362
|
if (identity === "title") {
|
|
259
|
-
if (tags.length > 1)
|
|
363
|
+
if (tags.length > 1) devCheck({
|
|
364
|
+
code: "HEAD_TAG_INVALID",
|
|
365
|
+
kind: "head",
|
|
366
|
+
severity: "warn",
|
|
367
|
+
message: "[HEAD_TAG_INVALID] Multiple <title> tags in one head group; the last one wins.",
|
|
368
|
+
data: {
|
|
369
|
+
reason: "duplicate-title",
|
|
370
|
+
detail: tags.length
|
|
371
|
+
}
|
|
372
|
+
});
|
|
260
373
|
winners.set(identity, {
|
|
261
374
|
seq: group.seq,
|
|
262
375
|
tags: [tags[tags.length - 1]]
|
|
@@ -295,6 +408,7 @@ function decodeSafe(text) {
|
|
|
295
408
|
}
|
|
296
409
|
}
|
|
297
410
|
function serializeCookie(name, value, options = {}) {
|
|
411
|
+
assertServableCookie(name, options);
|
|
298
412
|
let cookie = `${encodeURIComponent(name)}=${encodeURIComponent(value)}`;
|
|
299
413
|
cookie += `; Path=${options.path === undefined ? "/" : options.path}`;
|
|
300
414
|
if (options.domain) cookie += `; Domain=${options.domain}`;
|
|
@@ -302,14 +416,34 @@ function serializeCookie(name, value, options = {}) {
|
|
|
302
416
|
if (options.expires) cookie += `; Expires=${options.expires.toUTCString()}`;
|
|
303
417
|
if (options.httpOnly) cookie += "; HttpOnly";
|
|
304
418
|
if (options.secure) cookie += "; Secure";
|
|
419
|
+
if (options.partitioned) cookie += "; Partitioned";
|
|
305
420
|
if (options.sameSite) {
|
|
306
421
|
const sameSite = options.sameSite.toLowerCase();
|
|
307
422
|
cookie += `; SameSite=${sameSite === "none" ? "None" : sameSite === "strict" ? "Strict" : "Lax"}`;
|
|
308
423
|
}
|
|
309
424
|
return cookie;
|
|
310
425
|
}
|
|
426
|
+
function assertServableCookie(name, options) {
|
|
427
|
+
const reject = reason => {
|
|
428
|
+
throw new Error(`serializeCookie: every browser silently rejects this cookie — ${reason}. ` + `It would never come back on a request, with no error anywhere.`);
|
|
429
|
+
};
|
|
430
|
+
const lower = name.toLowerCase();
|
|
431
|
+
if (lower.startsWith("__host-")) {
|
|
432
|
+
if (!options.secure) reject(`the __Host- prefix on \`${name}\` requires \`secure: true\``);
|
|
433
|
+
if (options.path !== undefined && options.path !== "/") reject(`the __Host- prefix on \`${name}\` requires \`Path=/\` (got \`${options.path}\`) — ` + `host-locking is the prefix's whole contract, so it cannot be path-scoped`);
|
|
434
|
+
if (options.domain) reject(`the __Host- prefix on \`${name}\` forbids \`Domain\` (got \`${options.domain}\`)`);
|
|
435
|
+
} else if (lower.startsWith("__secure-") && !options.secure) {
|
|
436
|
+
reject(`the __Secure- prefix on \`${name}\` requires \`secure: true\``);
|
|
437
|
+
}
|
|
438
|
+
if (options.sameSite && options.sameSite.toLowerCase() === "none" && !options.secure) {
|
|
439
|
+
reject("`SameSite=None` requires `secure: true`");
|
|
440
|
+
}
|
|
441
|
+
if (options.partitioned && !options.secure) {
|
|
442
|
+
reject("`Partitioned` requires `secure: true`");
|
|
443
|
+
}
|
|
444
|
+
}
|
|
311
445
|
const FLASH_COOKIE = "flash";
|
|
312
|
-
const FLASH_MATCHER =
|
|
446
|
+
const FLASH_MATCHER = /(?:^|;\s*)flash=([^;]+)/;
|
|
313
447
|
function hasFlashCookie(cookieHeader) {
|
|
314
448
|
return !!cookieHeader && FLASH_MATCHER.test(cookieHeader);
|
|
315
449
|
}
|
|
@@ -330,33 +464,102 @@ function getServerFunctionRPC() {
|
|
|
330
464
|
return globalThis[SERVER_FUNCTION_RPC];
|
|
331
465
|
}
|
|
332
466
|
|
|
333
|
-
const
|
|
467
|
+
const assetGates = new WeakMap();
|
|
468
|
+
const waitAsset = promise => {
|
|
469
|
+
let gate = assetGates.get(promise);
|
|
470
|
+
if (!gate) {
|
|
471
|
+
runWithOwner(null, () => {
|
|
472
|
+
gate = createMemo(() => promise, {
|
|
473
|
+
transparent: true
|
|
474
|
+
});
|
|
475
|
+
});
|
|
476
|
+
assetGates.set(promise, gate);
|
|
477
|
+
}
|
|
478
|
+
gate();
|
|
479
|
+
};
|
|
480
|
+
const EVENT_KEY = "_$$";
|
|
481
|
+
const $$EVENT_OWNER = "_$SOLID_EVENT_OWNER";
|
|
482
|
+
const $$EVENT_TUPLE = Symbol();
|
|
483
|
+
const hasOwn = Object.prototype.hasOwnProperty;
|
|
334
484
|
const INNER_OWNED = {};
|
|
335
485
|
const delegatedEvents = new Set();
|
|
336
486
|
const delegatedContainers = new Map();
|
|
337
|
-
function
|
|
487
|
+
function voidFn() {}
|
|
488
|
+
function generateHydrationScript(_options) {
|
|
489
|
+
return "";
|
|
490
|
+
}
|
|
491
|
+
function HydrationScript(_props) {
|
|
492
|
+
return null;
|
|
493
|
+
}
|
|
494
|
+
const getRequestEvent = voidFn;
|
|
495
|
+
const getHydrationWriter = voidFn;
|
|
496
|
+
function takeHydrationValue(key) {
|
|
497
|
+
const registry = globalThis._$HY && globalThis._$HY.r;
|
|
498
|
+
if (!registry || !(key in registry)) return;
|
|
499
|
+
const v = registry[key];
|
|
500
|
+
delete registry[key];
|
|
501
|
+
if (v !== null && typeof v === "object" && typeof v.then === "function") {
|
|
502
|
+
if (v.s === 1) return {
|
|
503
|
+
status: "resolved",
|
|
504
|
+
value: v.v
|
|
505
|
+
};
|
|
506
|
+
if (v.s === 2) {
|
|
507
|
+
v.then(undefined, voidFn);
|
|
508
|
+
return {
|
|
509
|
+
status: "rejected",
|
|
510
|
+
error: v.v
|
|
511
|
+
};
|
|
512
|
+
}
|
|
513
|
+
return {
|
|
514
|
+
status: "pending",
|
|
515
|
+
promise: v
|
|
516
|
+
};
|
|
517
|
+
}
|
|
518
|
+
return {
|
|
519
|
+
status: "resolved",
|
|
520
|
+
value: v
|
|
521
|
+
};
|
|
522
|
+
}
|
|
523
|
+
function setLinkClaim(_handler) {
|
|
524
|
+
return false;
|
|
525
|
+
}
|
|
526
|
+
function hasServerLinkState() {
|
|
527
|
+
const registry = globalThis._$HY && globalThis._$HY.r;
|
|
528
|
+
return !!registry && registry.links === 1;
|
|
529
|
+
}
|
|
530
|
+
const getTraceContext = voidFn;
|
|
531
|
+
function render(code, element, init, options = {}) {
|
|
338
532
|
if (!element) {
|
|
339
533
|
throw new Error("The `element` passed to `render(..., element)` doesn't exist. Make sure `element` exists in the document.");
|
|
340
534
|
}
|
|
535
|
+
resetErrorHalt();
|
|
536
|
+
enforceLoadingBoundary(true);
|
|
341
537
|
let disposer;
|
|
342
538
|
registerDelegatedRoot(element);
|
|
343
539
|
try {
|
|
344
|
-
|
|
540
|
+
createRoot(dispose => {
|
|
345
541
|
disposer = dispose;
|
|
542
|
+
if (options.onError) getOwner()[ROOT_ERROR_HOOK] = options.onError;
|
|
346
543
|
if (element === document) {
|
|
347
544
|
const tree = code();
|
|
348
|
-
effect(() =>
|
|
545
|
+
effect(() => flatten(tree), () => {});
|
|
349
546
|
} else {
|
|
350
547
|
const tree = code();
|
|
351
|
-
insert(element, () => tree, element.firstChild ? null : undefined, init,
|
|
548
|
+
insert(element, () => tree, element.firstChild ? null : undefined, init, {
|
|
549
|
+
...options.insertOptions,
|
|
550
|
+
schedule: true
|
|
551
|
+
});
|
|
352
552
|
}
|
|
353
553
|
}, {
|
|
354
554
|
id: options.renderId
|
|
355
555
|
});
|
|
556
|
+
flush();
|
|
356
557
|
} catch (err) {
|
|
357
558
|
if (disposer) disposer();
|
|
358
559
|
unregisterDelegatedRoot(element);
|
|
359
560
|
throw err;
|
|
561
|
+
} finally {
|
|
562
|
+
enforceLoadingBoundary(false);
|
|
360
563
|
}
|
|
361
564
|
return () => {
|
|
362
565
|
disposer();
|
|
@@ -366,6 +569,7 @@ function render$1(code, element, init, options = {}) {
|
|
|
366
569
|
}
|
|
367
570
|
function create(html, bypassGuard, flag) {
|
|
368
571
|
if (isHydrating() && !bypassGuard) throw new Error("Failed attempt to create new DOM elements during hydration. Check that the libraries you are using support hydration.");
|
|
572
|
+
if (/^<(html|head|body)[\s>]/i.test(html)) throw new Error("Document shell templates (<html>, <head>, <body>) cannot be client-created: " + "a <template> parse strips those tags. Render this component through hydrate(), " + "where the document shell already exists.");
|
|
369
573
|
const t = document.createElement("template");
|
|
370
574
|
t.innerHTML = html;
|
|
371
575
|
return flag === 2 ? t.content.firstChild.firstChild : t.content.firstChild;
|
|
@@ -416,10 +620,33 @@ function unregisterDelegatedContainer(container, owner = container) {
|
|
|
416
620
|
}
|
|
417
621
|
function attachDelegatedEvent(name, container, state) {
|
|
418
622
|
if (state.handlers.has(name)) return;
|
|
419
|
-
const handler = e => eventHandler(e, container, state);
|
|
623
|
+
const handler = e => dispatchAsInteraction(e, () => eventHandler(e, container, state)) ;
|
|
420
624
|
state.handlers.set(name, handler);
|
|
421
625
|
container.addEventListener(name, handler);
|
|
422
626
|
}
|
|
627
|
+
function describeEventTarget(target) {
|
|
628
|
+
if (!target || typeof target.tagName !== "string") return undefined;
|
|
629
|
+
const tag = target.tagName.toLowerCase();
|
|
630
|
+
let out = tag;
|
|
631
|
+
if (target.id) out += `#${target.id}`;else if (typeof target.name === "string" && target.name) out += `[name=${target.name}]`;
|
|
632
|
+
if (tag !== "input" && tag !== "textarea" && tag !== "select") {
|
|
633
|
+
const text = (target.textContent || "").trim().replace(/\s+/g, " ");
|
|
634
|
+
if (text) out += ` "${text.length > 30 ? text.slice(0, 29) + "…" : text}"`;
|
|
635
|
+
}
|
|
636
|
+
return out;
|
|
637
|
+
}
|
|
638
|
+
function interactionStart(e) {
|
|
639
|
+
const at = e.timeStamp;
|
|
640
|
+
return typeof at === "number" && at >= 0 && at <= performance.now() ? at : undefined;
|
|
641
|
+
}
|
|
642
|
+
function dispatchAsInteraction(e, fn) {
|
|
643
|
+
return OBSERVE.attribution.withInteraction({
|
|
644
|
+
type: e.type,
|
|
645
|
+
target: describeEventTarget(e.target),
|
|
646
|
+
at: interactionStart(e),
|
|
647
|
+
event: e
|
|
648
|
+
}, fn) ;
|
|
649
|
+
}
|
|
423
650
|
function getDelegatedRoot(node) {
|
|
424
651
|
while (node) {
|
|
425
652
|
if (delegatedContainers.get(node)?.roots) return node;
|
|
@@ -439,18 +666,41 @@ function findOwner(target, state) {
|
|
|
439
666
|
}
|
|
440
667
|
}
|
|
441
668
|
function setProperty(node, name, value) {
|
|
669
|
+
tagElement(node);
|
|
442
670
|
if (isHydrating(node)) return;
|
|
671
|
+
const nodeName = node.nodeName;
|
|
672
|
+
checkStatefulWrite(node, name, value);
|
|
673
|
+
if (name === "value" && nodeName === "SELECT") writeSelectValue(node, value);else if ((name === "value" || name === "defaultValue") && (nodeName === "INPUT" || nodeName === "TEXTAREA")) {
|
|
674
|
+
if (value == null && /^(checkbox|radio)$/.test(node.type)) node.removeAttribute("value");else node[name] = value ?? "";
|
|
675
|
+
} else node[name] = value;
|
|
676
|
+
recordStatefulWrite(node, name, value);
|
|
677
|
+
reclaimAttribute(node, name);
|
|
678
|
+
}
|
|
679
|
+
function setStatefulProperty(node, name, value) {
|
|
680
|
+
checkStatefulWrite(node, name, value);
|
|
443
681
|
node[name] = value;
|
|
682
|
+
recordStatefulWrite(node, name, value);
|
|
444
683
|
}
|
|
445
684
|
let claimHandlers = null;
|
|
446
|
-
const
|
|
447
|
-
|
|
685
|
+
const claimAttributeSets = [];
|
|
686
|
+
const CLAIM_SEAM = Symbol.for("solid.element-claims");
|
|
687
|
+
function registerElementClaim(handler, options) {
|
|
448
688
|
(claimHandlers || (claimHandlers = globalThis[CLAIM_SEAM] = [])).push(handler);
|
|
689
|
+
claimAttributeSets.push(options?.attributes || ["href", "action"]);
|
|
449
690
|
return () => {
|
|
450
691
|
const index = claimHandlers.indexOf(handler);
|
|
451
|
-
index > -1
|
|
692
|
+
if (index > -1) {
|
|
693
|
+
claimHandlers.splice(index, 1);
|
|
694
|
+
claimAttributeSets.splice(index, 1);
|
|
695
|
+
}
|
|
452
696
|
};
|
|
453
697
|
}
|
|
698
|
+
function runClaimHandlers(handlers, node) {
|
|
699
|
+
for (let i = 0; i < handlers.length; i++) handlers[i](node);
|
|
700
|
+
}
|
|
701
|
+
function reclaimAttribute(node, name) {
|
|
702
|
+
if (claimHandlers !== null && node._$claimed && claimAttributeSets.some(set => set.includes(name.slice(name.indexOf(":") + 1)))) runClaimHandlers(claimHandlers, node);
|
|
703
|
+
}
|
|
454
704
|
const CLAIMED_ELEMENTS = "a[href], form[action]";
|
|
455
705
|
function claimElementTree(root) {
|
|
456
706
|
const handlers = globalThis[CLAIM_SEAM];
|
|
@@ -458,46 +708,76 @@ function claimElementTree(root) {
|
|
|
458
708
|
const isElement = root.nodeType === 1;
|
|
459
709
|
if (!isElement && root.nodeType !== 11) return root;
|
|
460
710
|
if (isElement && root.matches(CLAIMED_ELEMENTS)) {
|
|
461
|
-
|
|
711
|
+
root._$claimed = true;
|
|
712
|
+
runClaimHandlers(handlers, root);
|
|
462
713
|
}
|
|
463
714
|
const found = root.querySelectorAll(CLAIMED_ELEMENTS);
|
|
464
715
|
for (let i = 0; i < found.length; i++) {
|
|
465
|
-
|
|
716
|
+
found[i]._$claimed = true;
|
|
717
|
+
runClaimHandlers(handlers, found[i]);
|
|
466
718
|
}
|
|
467
719
|
return root;
|
|
468
720
|
}
|
|
469
|
-
function claimElement(node) {
|
|
470
|
-
if (claimHandlers !== null) {
|
|
471
|
-
|
|
721
|
+
function claimElement(node, owner) {
|
|
722
|
+
if (claimHandlers !== null && !node._$claimed) {
|
|
723
|
+
node._$claimed = true;
|
|
724
|
+
if (owner === undefined) runClaimHandlers(claimHandlers, node);else runWithOwner(owner, () => runClaimHandlers(claimHandlers, node));
|
|
472
725
|
}
|
|
473
726
|
return node;
|
|
474
727
|
}
|
|
475
728
|
function setAttribute(node, name, value) {
|
|
729
|
+
{
|
|
730
|
+
tagElement(node);
|
|
731
|
+
if (typeof value === "function" && name.startsWith("on")) lowercaseEventAttribute(name, node);
|
|
732
|
+
}
|
|
476
733
|
if (isHydrating(node)) return;
|
|
477
|
-
|
|
478
|
-
if (
|
|
734
|
+
const selectMultiple = name === "multiple" && node.localName === "select";
|
|
735
|
+
if (value == null || value === false) node.removeAttribute(name);else {
|
|
736
|
+
node.setAttribute(name, value === true ? "" : value);
|
|
737
|
+
if (selectMultiple && !node._$multiple) {
|
|
738
|
+
const options = node.options;
|
|
739
|
+
for (let i = 0; i < options.length; i++) {
|
|
740
|
+
if (options[i].defaultSelected) options[i].selected = true;
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
if (selectMultiple) node._$multiple = true;
|
|
745
|
+
reclaimAttribute(node, name);
|
|
479
746
|
}
|
|
480
747
|
function setAttributeNS(node, namespace, name, value) {
|
|
748
|
+
tagElement(node);
|
|
481
749
|
if (isHydrating(node)) return;
|
|
482
750
|
if (value == null || value === false) node.removeAttributeNS(namespace, name.indexOf(":") > -1 ? name.split(":").pop() : name);else node.setAttributeNS(namespace, name, value === true ? "" : value);
|
|
751
|
+
reclaimAttribute(node, name);
|
|
483
752
|
}
|
|
484
753
|
function className(node, value, prev) {
|
|
485
|
-
|
|
754
|
+
tagElement(node);
|
|
755
|
+
if (typeof value === "number") value = "" + value;
|
|
756
|
+
if (typeof prev === "number") prev = "" + prev;
|
|
757
|
+
if (isHydrating(node)) {
|
|
758
|
+
node._$classes = value && typeof value === "object" ? classListToObject(value) : undefined;
|
|
759
|
+
return;
|
|
760
|
+
}
|
|
486
761
|
if (value == null || value === false) {
|
|
487
|
-
prev
|
|
762
|
+
if (prev || node._$classes) {
|
|
763
|
+
node.removeAttribute("class");
|
|
764
|
+
node._$classes = undefined;
|
|
765
|
+
}
|
|
488
766
|
return;
|
|
489
767
|
}
|
|
490
768
|
if (typeof value === "string") {
|
|
769
|
+
node._$classes = undefined;
|
|
491
770
|
value !== prev && node.setAttribute("class", value);
|
|
492
771
|
return;
|
|
493
772
|
}
|
|
773
|
+
let applied;
|
|
494
774
|
if (typeof prev === "string") {
|
|
495
|
-
|
|
775
|
+
applied = {};
|
|
496
776
|
node.removeAttribute("class");
|
|
497
|
-
} else
|
|
777
|
+
} else applied = node._$classes || classListToObject(prev || {});
|
|
498
778
|
value = classListToObject(value);
|
|
499
|
-
const classKeys = Object.keys(value
|
|
500
|
-
const prevKeys = Object.keys(
|
|
779
|
+
const classKeys = Object.keys(value);
|
|
780
|
+
const prevKeys = Object.keys(applied);
|
|
501
781
|
let i, len;
|
|
502
782
|
for (i = 0, len = prevKeys.length; i < len; i++) {
|
|
503
783
|
const key = prevKeys[i];
|
|
@@ -507,22 +787,40 @@ function className(node, value, prev) {
|
|
|
507
787
|
for (i = 0, len = classKeys.length; i < len; i++) {
|
|
508
788
|
const key = classKeys[i],
|
|
509
789
|
classValue = !!value[key];
|
|
510
|
-
if (!key || key === "undefined" ||
|
|
790
|
+
if (!key || key === "undefined" || applied[key] === classValue || !classValue) continue;
|
|
511
791
|
node.classList.add(key);
|
|
512
792
|
}
|
|
793
|
+
node._$classes = value;
|
|
513
794
|
}
|
|
514
795
|
function addEvent(node, name, handler, delegate) {
|
|
515
796
|
if (delegate) {
|
|
797
|
+
const key = EVENT_KEY + name;
|
|
798
|
+
let data;
|
|
516
799
|
if (Array.isArray(handler)) {
|
|
517
|
-
|
|
518
|
-
node[
|
|
519
|
-
} else node[
|
|
520
|
-
|
|
800
|
+
data = handler[1];
|
|
801
|
+
node[key] = handler[0];
|
|
802
|
+
} else node[key] = handler;
|
|
803
|
+
node[`${key}Data`] = data;
|
|
804
|
+
return;
|
|
805
|
+
}
|
|
806
|
+
if (Array.isArray(handler)) {
|
|
521
807
|
const handlerFn = handler[0];
|
|
522
|
-
|
|
523
|
-
|
|
808
|
+
const listener = e => dispatchAsInteraction(e, () => handlerFn.call(node, handler[1], e)) ;
|
|
809
|
+
listener[$$EVENT_TUPLE] = handler;
|
|
810
|
+
node.addEventListener(name, listener);
|
|
811
|
+
return listener;
|
|
812
|
+
}
|
|
813
|
+
if (typeof handler === "function") {
|
|
814
|
+
const listener = e => dispatchAsInteraction(e, () => handler.call(node, e));
|
|
815
|
+
node.addEventListener(name, listener);
|
|
816
|
+
return listener;
|
|
817
|
+
}
|
|
818
|
+
node.addEventListener(name, handler, typeof handler !== "function" && handler);
|
|
819
|
+
return handler;
|
|
524
820
|
}
|
|
525
821
|
function style(node, value, prev) {
|
|
822
|
+
tagElement(node);
|
|
823
|
+
if (isHydrating(node)) return;
|
|
526
824
|
if (!value) {
|
|
527
825
|
if (prev || node._$styles) {
|
|
528
826
|
setAttribute(node, "style");
|
|
@@ -547,12 +845,13 @@ function style(node, value, prev) {
|
|
|
547
845
|
}
|
|
548
846
|
let v, s;
|
|
549
847
|
for (s in applied) {
|
|
550
|
-
if (value[s] == null) {
|
|
848
|
+
if (!hasOwn.call(value, s) || value[s] == null) {
|
|
551
849
|
nodeStyle.removeProperty(s);
|
|
552
850
|
delete applied[s];
|
|
553
851
|
}
|
|
554
852
|
}
|
|
555
853
|
for (s in value) {
|
|
854
|
+
if (!hasOwn.call(value, s)) continue;
|
|
556
855
|
v = value[s];
|
|
557
856
|
if (v != null && v !== applied[s]) {
|
|
558
857
|
nodeStyle.setProperty(s, v);
|
|
@@ -560,26 +859,139 @@ function style(node, value, prev) {
|
|
|
560
859
|
}
|
|
561
860
|
}
|
|
562
861
|
}
|
|
862
|
+
function readShallow(value) {
|
|
863
|
+
if (value === null || typeof value !== "object") return value;
|
|
864
|
+
if (Array.isArray(value)) return value.map(readShallow);
|
|
865
|
+
if (value[$PROXY] !== value) return value;
|
|
866
|
+
const keys = Reflect.ownKeys(value);
|
|
867
|
+
const out = {};
|
|
868
|
+
for (let i = 0; i < keys.length; i++) {
|
|
869
|
+
const k = keys[i];
|
|
870
|
+
if (typeof k === "string") out[k] = value[k];
|
|
871
|
+
}
|
|
872
|
+
return out;
|
|
873
|
+
}
|
|
563
874
|
function setStyleProperty(node, name, value) {
|
|
875
|
+
tagElement(node);
|
|
876
|
+
if (isHydrating(node)) return;
|
|
564
877
|
value != null ? node.style.setProperty(name, value) : node.style.removeProperty(name);
|
|
565
878
|
}
|
|
566
|
-
function spread(node, props
|
|
879
|
+
function spread(node, props, skipChildren, skip, name, loc) {
|
|
880
|
+
if (name !== undefined) {
|
|
881
|
+
const outer = spreadName;
|
|
882
|
+
const outerLoc = spreadLoc;
|
|
883
|
+
setSpreadName(name, loc);
|
|
884
|
+
try {
|
|
885
|
+
return spread(node, props, skipChildren, skip);
|
|
886
|
+
} finally {
|
|
887
|
+
setSpreadName(outer, outerLoc);
|
|
888
|
+
}
|
|
889
|
+
}
|
|
567
890
|
const prevProps = {};
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
const r =
|
|
571
|
-
(typeof r === "function" || Array.isArray(r))
|
|
572
|
-
|
|
891
|
+
const owner = claimHandlers !== null && (node.localName === "a" || node.localName === "form") ? getOwner() : undefined;
|
|
892
|
+
const apply = newProps => {
|
|
893
|
+
const r = newProps.ref;
|
|
894
|
+
if (r !== prevProps.ref && (typeof r === "function" || Array.isArray(r))) ref(() => r, node);
|
|
895
|
+
assign(node, newProps, true, prevProps, true);
|
|
896
|
+
if (owner !== undefined) claimElement(node, owner);
|
|
897
|
+
};
|
|
898
|
+
if (Array.isArray(props)) {
|
|
899
|
+
effect(() => collectSources({}, props, undefined, skip), apply);
|
|
900
|
+
unscopedByDesign = node;
|
|
901
|
+
if (!skipChildren && !(skip !== undefined && skip("children"))) insert(node, () => {
|
|
902
|
+
for (let i = props.length - 1; i >= 0; i--) {
|
|
903
|
+
const s = resolveSource(props[i]);
|
|
904
|
+
if (s != null && entryHas(s, "children")) return entryGet(s, "children");
|
|
905
|
+
}
|
|
906
|
+
});
|
|
907
|
+
unscopedByDesign = null;
|
|
908
|
+
return prevProps;
|
|
909
|
+
}
|
|
573
910
|
effect(() => {
|
|
911
|
+
const source = resolveSource(props);
|
|
574
912
|
const newProps = {};
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
913
|
+
const table = resolvedTable(source);
|
|
914
|
+
if (table !== undefined) return collectTable(newProps, table, skip);
|
|
915
|
+
if (source != null) {
|
|
916
|
+
const view = viewOf(source);
|
|
917
|
+
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);
|
|
578
918
|
}
|
|
579
919
|
return newProps;
|
|
580
|
-
},
|
|
920
|
+
}, apply);
|
|
921
|
+
unscopedByDesign = node;
|
|
922
|
+
if (!skipChildren && !(skip !== undefined && skip("children"))) {
|
|
923
|
+
if (typeof props !== "function" && props != null && hasStaticKeys(props)) {
|
|
924
|
+
const desc = Object.getOwnPropertyDescriptor(props, "children");
|
|
925
|
+
if (desc !== undefined) {
|
|
926
|
+
if (desc.get === undefined) insert(node, desc.value);else insert(node, () => props.children);
|
|
927
|
+
}
|
|
928
|
+
} else insert(node, () => {
|
|
929
|
+
const source = resolveSource(props);
|
|
930
|
+
return source != null && entryHas(source, "children") ? entryGet(source, "children") : undefined;
|
|
931
|
+
});
|
|
932
|
+
}
|
|
933
|
+
unscopedByDesign = null;
|
|
581
934
|
return prevProps;
|
|
582
935
|
}
|
|
936
|
+
function collectTable(out, table, skip) {
|
|
937
|
+
for (const [prop, leaf] of table) {
|
|
938
|
+
if (typeof prop !== "string" || prop === "children") continue;
|
|
939
|
+
if (skip !== undefined && skip(prop)) continue;
|
|
940
|
+
const v = leaf[prop];
|
|
941
|
+
out[prop] = prop === "style" || prop === "class" ? readShallow(v) : v;
|
|
942
|
+
}
|
|
943
|
+
return out;
|
|
944
|
+
}
|
|
945
|
+
function resolveSource(s) {
|
|
946
|
+
return typeof s === "function" ? s() : s;
|
|
947
|
+
}
|
|
948
|
+
function entryHas(s, key) {
|
|
949
|
+
const view = viewOf(s);
|
|
950
|
+
return view instanceof OmitView ? sourceHas(view, SOURCE_OMIT, key) : key in s;
|
|
951
|
+
}
|
|
952
|
+
function entryGet(s, key) {
|
|
953
|
+
const view = viewOf(s);
|
|
954
|
+
return view instanceof OmitView ? sourceGet(view, SOURCE_OMIT, key) : s[key];
|
|
955
|
+
}
|
|
956
|
+
function collectSources(out, sources, kinds, skip) {
|
|
957
|
+
const resolved = [];
|
|
958
|
+
const resolvedKinds = [];
|
|
959
|
+
for (let i = 0; i < sources.length; i++) pushEntry(resolved, resolvedKinds, sources[i], kinds !== undefined ? kinds[i] : SOURCE_MEMO);
|
|
960
|
+
for (let i = 0; i < resolved.length; i++) collectProps(out, resolved[i], resolvedKinds[i], skip, resolved, resolvedKinds, i + 1);
|
|
961
|
+
return out;
|
|
962
|
+
}
|
|
963
|
+
function pushEntry(resolved, kinds, s, kind) {
|
|
964
|
+
if (kind !== SOURCE_MEMO) {
|
|
965
|
+
resolved.push(s);
|
|
966
|
+
kinds.push(kind);
|
|
967
|
+
return;
|
|
968
|
+
}
|
|
969
|
+
s = resolveSource(s);
|
|
970
|
+
if (s == null) return;
|
|
971
|
+
const view = viewOf(s);
|
|
972
|
+
if (view instanceof OmitView) {
|
|
973
|
+
resolved.push(view);
|
|
974
|
+
kinds.push(SOURCE_OMIT);
|
|
975
|
+
} else if (view !== undefined) {
|
|
976
|
+
const f = view.sources,
|
|
977
|
+
k = view.kinds;
|
|
978
|
+
for (let j = 0; j < f.length; j++) pushEntry(resolved, kinds, f[j], k[j]);
|
|
979
|
+
} else {
|
|
980
|
+
resolved.push(s);
|
|
981
|
+
kinds.push($PROXY in s ? SOURCE_PROXY : SOURCE_PLAIN);
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
function collectProps(out, s, kind, skip, later, laterKinds, from) {
|
|
985
|
+
const keys = sourceKeys(s, kind);
|
|
986
|
+
outer: for (let i = 0; i < keys.length; i++) {
|
|
987
|
+
const prop = keys[i];
|
|
988
|
+
if (typeof prop !== "string" || prop === "children") continue;
|
|
989
|
+
if (skip !== undefined && skip(prop)) continue;
|
|
990
|
+
if (later !== undefined) for (let j = from; j < later.length; j++) if (sourceHas(later[j], laterKinds[j], prop)) continue outer;
|
|
991
|
+
const v = sourceGet(s, kind, prop);
|
|
992
|
+
out[prop] = prop === "style" || prop === "class" ? readShallow(v) : v;
|
|
993
|
+
}
|
|
994
|
+
}
|
|
583
995
|
function dynamicProperty(props, key) {
|
|
584
996
|
const src = props[key];
|
|
585
997
|
Object.defineProperty(props, key, {
|
|
@@ -594,13 +1006,8 @@ function applyRef(r, element) {
|
|
|
594
1006
|
Array.isArray(r) ? r.flat(Infinity).forEach(f => f && f(element)) : r(element);
|
|
595
1007
|
}
|
|
596
1008
|
function ref(fn, element) {
|
|
597
|
-
const resolved =
|
|
598
|
-
|
|
599
|
-
}
|
|
600
|
-
const PURE_ROW = Symbol.for("solid.pure-row");
|
|
601
|
-
function rowProof(fn) {
|
|
602
|
-
fn[PURE_ROW] = true;
|
|
603
|
-
return fn;
|
|
1009
|
+
const resolved = untrack(fn);
|
|
1010
|
+
runWithOwner(null, () => applyRef(resolved, element));
|
|
604
1011
|
}
|
|
605
1012
|
function scope(fn) {
|
|
606
1013
|
fn.$s = true;
|
|
@@ -609,20 +1016,42 @@ function scope(fn) {
|
|
|
609
1016
|
const SCOPE_OPTIONS = {
|
|
610
1017
|
scope: true
|
|
611
1018
|
};
|
|
1019
|
+
let unscopedByDesign = null;
|
|
1020
|
+
let reportedHoleSites = null;
|
|
1021
|
+
let hydrationKeyMisses = 0;
|
|
1022
|
+
function unscopedHoleSnapshot(accessor, parent) {
|
|
1023
|
+
if (accessor.$s || !sharedConfig.hydrating || parent === unscopedByDesign || sharedConfig.devPeekNextContextId === undefined) return undefined;
|
|
1024
|
+
return {
|
|
1025
|
+
next: sharedConfig.devPeekNextContextId(),
|
|
1026
|
+
misses: hydrationKeyMisses
|
|
1027
|
+
};
|
|
1028
|
+
}
|
|
1029
|
+
function checkUnscopedHole(snapshot, accessor, parent) {
|
|
1030
|
+
if (snapshot === undefined || hydrationKeyMisses === snapshot.misses) return;
|
|
1031
|
+
const after = sharedConfig.devPeekNextContextId();
|
|
1032
|
+
if (after === snapshot.next) return;
|
|
1033
|
+
let site = parent.nodeName + "|" + accessor.name;
|
|
1034
|
+
for (let o = getOwner(); o !== null; o = o._parent) if (o._name) site = o._name + "|" + site;
|
|
1035
|
+
if ((reportedHoleSites || (reportedHoleSites = new Set())).has(site)) return;
|
|
1036
|
+
reportedHoleSites.add(site);
|
|
1037
|
+
unscopedHoleAllocatedIds(snapshot.next, after, accessor.name ? {
|
|
1038
|
+
name: accessor.name
|
|
1039
|
+
} : {});
|
|
1040
|
+
}
|
|
612
1041
|
let hydrationRt = null;
|
|
1042
|
+
let selectInsert = null;
|
|
613
1043
|
function installHydrationRuntime() {
|
|
614
1044
|
hydrationRt = {
|
|
615
1045
|
claimInitial(parent, multi, initial) {
|
|
616
1046
|
if (isHydrating(parent)) {
|
|
617
|
-
if (!multi && initial === undefined && parent) initial =
|
|
618
|
-
if (Array.isArray(initial)) stripTextSeparators(initial);
|
|
1047
|
+
if (!multi && initial === undefined && parent) initial = claimChildNodes(parent);else if (Array.isArray(initial)) stripTextSeparators(initial);
|
|
619
1048
|
}
|
|
620
1049
|
return initial;
|
|
621
1050
|
},
|
|
622
1051
|
reclaimRegion(current, parent, marker) {
|
|
623
|
-
if (!
|
|
1052
|
+
if (!sharedConfig.hydrating || current == null || !parent.isConnected) return current;
|
|
624
1053
|
const first = Array.isArray(current) ? current[0] : current;
|
|
625
|
-
if (
|
|
1054
|
+
if (first == null || first.isConnected) return current;
|
|
626
1055
|
let nodes;
|
|
627
1056
|
if (marker) {
|
|
628
1057
|
nodes = [];
|
|
@@ -639,11 +1068,11 @@ function installHydrationRuntime() {
|
|
|
639
1068
|
nodes.unshift(node);
|
|
640
1069
|
node = node.previousSibling;
|
|
641
1070
|
}
|
|
642
|
-
} else
|
|
1071
|
+
} else return claimChildNodes(parent);
|
|
643
1072
|
return stripTextSeparators(nodes);
|
|
644
1073
|
},
|
|
645
1074
|
dedupEvent(e) {
|
|
646
|
-
return !!(
|
|
1075
|
+
return !!(sharedConfig.registry && sharedConfig.events && sharedConfig.events.find(([el, ev]) => ev === e));
|
|
647
1076
|
}
|
|
648
1077
|
};
|
|
649
1078
|
}
|
|
@@ -652,25 +1081,42 @@ function stripTextSeparators(nodes) {
|
|
|
652
1081
|
for (let i = 0; i < nodes.length; i++) {
|
|
653
1082
|
const node = nodes[i],
|
|
654
1083
|
t = node.nodeType;
|
|
655
|
-
if (t === 8) {
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
}
|
|
661
|
-
if (v.startsWith("pl-")) continue;
|
|
662
|
-
} else if (t === 1 && node.localName === "template" && node.id.startsWith("pl-")) continue;
|
|
1084
|
+
if (t === 8 && node.nodeValue === "!$") {
|
|
1085
|
+
node.remove();
|
|
1086
|
+
continue;
|
|
1087
|
+
}
|
|
1088
|
+
if (isPlaceholderScaffolding(node, t)) continue;
|
|
663
1089
|
nodes[j++] = node;
|
|
664
1090
|
}
|
|
665
1091
|
nodes.length = j;
|
|
666
1092
|
return nodes;
|
|
667
1093
|
}
|
|
668
|
-
function
|
|
669
|
-
|
|
670
|
-
|
|
1094
|
+
function claimChildNodes(parent) {
|
|
1095
|
+
const live = parent.childNodes;
|
|
1096
|
+
const out = [];
|
|
1097
|
+
for (let i = 0, n = live.length; i < n; i++) {
|
|
1098
|
+
const node = live[i],
|
|
1099
|
+
t = node.nodeType;
|
|
1100
|
+
if (t === 8 && node.nodeValue === "!$") {
|
|
1101
|
+
node.remove();
|
|
1102
|
+
i--;
|
|
1103
|
+
n--;
|
|
1104
|
+
continue;
|
|
1105
|
+
}
|
|
1106
|
+
if (isPlaceholderScaffolding(node, t)) continue;
|
|
1107
|
+
out.push(node);
|
|
671
1108
|
}
|
|
1109
|
+
return out;
|
|
1110
|
+
}
|
|
1111
|
+
function isPlaceholderScaffolding(node, t) {
|
|
1112
|
+
return t === 8 ? node.nodeValue.startsWith("pl-") : t === 1 && node.localName === "template" && node.id.startsWith("pl-");
|
|
672
1113
|
}
|
|
673
1114
|
function insert(parent, accessor, marker, initial, options) {
|
|
1115
|
+
if (spreadName !== undefined && (options === undefined || options.name === undefined)) options = {
|
|
1116
|
+
...options,
|
|
1117
|
+
name: spreadName + ".children",
|
|
1118
|
+
loc: spreadLoc
|
|
1119
|
+
};
|
|
674
1120
|
const multi = marker !== undefined;
|
|
675
1121
|
const host = options && options.host;
|
|
676
1122
|
if (multi && !initial) initial = [];
|
|
@@ -689,17 +1135,27 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
689
1135
|
initial = [placeholder];
|
|
690
1136
|
}
|
|
691
1137
|
let current = initial;
|
|
692
|
-
|
|
1138
|
+
let ran = false;
|
|
1139
|
+
effect(() => {
|
|
693
1140
|
if (hydrationRt !== null) current = hydrationRt.reclaimRegion(current, parent, marker);
|
|
1141
|
+
const devNext = unscopedHoleSnapshot(accessor, parent) ;
|
|
694
1142
|
const value = normalize(accessor(), current, multi, true);
|
|
1143
|
+
checkUnscopedHole(devNext, accessor, parent);
|
|
1144
|
+
const again = ran;
|
|
1145
|
+
ran = true;
|
|
695
1146
|
if (typeof value !== "function") return value;
|
|
1147
|
+
const innerOptions = again && !(options && options.schedule) ? {
|
|
1148
|
+
...options,
|
|
1149
|
+
schedule: true
|
|
1150
|
+
} : options;
|
|
696
1151
|
effect(() => (hydrationRt !== null && (current = hydrationRt.reclaimRegion(current, parent, marker)), normalize(value, current, multi)), inner => {
|
|
697
1152
|
current = insertExpression(parent, inner, current, marker);
|
|
698
1153
|
host && tagHost(current, host);
|
|
699
|
-
},
|
|
700
|
-
...
|
|
701
|
-
|
|
702
|
-
}
|
|
1154
|
+
}, {
|
|
1155
|
+
...innerOptions,
|
|
1156
|
+
_wide: true
|
|
1157
|
+
} );
|
|
1158
|
+
checkUnscopedHole(devNext, accessor, parent);
|
|
703
1159
|
return INNER_OWNED;
|
|
704
1160
|
}, value => {
|
|
705
1161
|
if (value === INNER_OWNED) return;
|
|
@@ -712,6 +1168,7 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
712
1168
|
} : SCOPE_OPTIONS : options);
|
|
713
1169
|
}
|
|
714
1170
|
function assign(node, props, skipChildren, prevProps = {}, skipRef = false) {
|
|
1171
|
+
tagElement(node);
|
|
715
1172
|
const nodeName = node.nodeName;
|
|
716
1173
|
props || (props = {});
|
|
717
1174
|
for (const prop in prevProps) {
|
|
@@ -734,10 +1191,16 @@ function assetEntryKey(descriptor) {
|
|
|
734
1191
|
if (descriptor.policy === "exclusive") return "x|" + descriptor.key;
|
|
735
1192
|
return descriptor.type === "inline-style" ? "i|" + descriptor.id : descriptor.type + "|" + descriptor.href;
|
|
736
1193
|
}
|
|
737
|
-
function findAssetElement(selector, attr, value) {
|
|
1194
|
+
function findAssetElement(selector, attr, value, qualifiers) {
|
|
738
1195
|
const nodes = document.querySelectorAll(selector);
|
|
739
|
-
for (let i = 0; i < nodes.length; i++) {
|
|
740
|
-
if (nodes[i].getAttribute(attr)
|
|
1196
|
+
outer: for (let i = 0; i < nodes.length; i++) {
|
|
1197
|
+
if (nodes[i].getAttribute(attr) !== value) continue;
|
|
1198
|
+
if (!qualifiers) return nodes[i];
|
|
1199
|
+
for (let q = 0; q < RESOURCE_QUALIFIERS.length; q++) {
|
|
1200
|
+
const name = RESOURCE_QUALIFIERS[q];
|
|
1201
|
+
if (qualifierValue(name, qualifiers[name]) !== qualifierValue(name, nodes[i].getAttribute(name))) continue outer;
|
|
1202
|
+
}
|
|
1203
|
+
return nodes[i];
|
|
741
1204
|
}
|
|
742
1205
|
return null;
|
|
743
1206
|
}
|
|
@@ -954,7 +1417,7 @@ function scheduleHeadApply() {
|
|
|
954
1417
|
queueMicrotask(flushHeadRegistry);
|
|
955
1418
|
}
|
|
956
1419
|
function flushHeadRegistry() {
|
|
957
|
-
if (
|
|
1420
|
+
if (sharedConfig.hydrating) {
|
|
958
1421
|
setTimeout(flushHeadRegistry, 0);
|
|
959
1422
|
return;
|
|
960
1423
|
}
|
|
@@ -1003,7 +1466,7 @@ function flushHeadRegistry() {
|
|
|
1003
1466
|
function createHeadElement(tag, props) {
|
|
1004
1467
|
const el = document.createElement(tag);
|
|
1005
1468
|
for (const name in props) {
|
|
1006
|
-
if (name === "children" || name === "ref" || name
|
|
1469
|
+
if (name === "children" || name === "ref" || /^on[A-Z]/.test(name)) continue;
|
|
1007
1470
|
if (!HEAD_ATTR_NAME.test(name)) {
|
|
1008
1471
|
console.warn(`useHead: ignoring invalid attribute name "${name}"`);
|
|
1009
1472
|
continue;
|
|
@@ -1012,7 +1475,7 @@ function createHeadElement(tag, props) {
|
|
|
1012
1475
|
if (v == null || v === false) continue;
|
|
1013
1476
|
el.setAttribute(name, v === true ? "" : String(v));
|
|
1014
1477
|
}
|
|
1015
|
-
if (props.children != null) el.textContent = String(props.children);
|
|
1478
|
+
if (props.children != null) el.textContent = headBodyText(tag, props, String(props.children));
|
|
1016
1479
|
return el;
|
|
1017
1480
|
}
|
|
1018
1481
|
function renderHeadElement(t, identity, existing) {
|
|
@@ -1027,7 +1490,7 @@ function renderHeadElement(t, identity, existing) {
|
|
|
1027
1490
|
function headElementMatches(el, t) {
|
|
1028
1491
|
if (el.tagName.toLowerCase() !== t.tag) return false;
|
|
1029
1492
|
for (const name in t.props) {
|
|
1030
|
-
if (name === "children" || name === "ref" || name
|
|
1493
|
+
if (name === "children" || name === "ref" || /^on[A-Z]/.test(name)) continue;
|
|
1031
1494
|
if (!HEAD_ATTR_NAME.test(name)) continue;
|
|
1032
1495
|
const v = t.props[name];
|
|
1033
1496
|
if (v == null || v === false) {
|
|
@@ -1035,7 +1498,7 @@ function headElementMatches(el, t) {
|
|
|
1035
1498
|
} else if (el.getAttribute(name) !== (v === true ? "" : String(v))) return false;
|
|
1036
1499
|
}
|
|
1037
1500
|
const children = t.props.children;
|
|
1038
|
-
return (children == null ? "" : String(children)) === el.textContent;
|
|
1501
|
+
return (children == null ? "" : headBodyText(t.tag, t.props, String(children))) === el.textContent;
|
|
1039
1502
|
}
|
|
1040
1503
|
function mountHeadResource(tag, props) {
|
|
1041
1504
|
const identity = resourceIdentity(tag, props);
|
|
@@ -1043,8 +1506,8 @@ function mountHeadResource(tag, props) {
|
|
|
1043
1506
|
headMountedResources.add(identity);
|
|
1044
1507
|
const url = props.href || props.src;
|
|
1045
1508
|
let el = null;
|
|
1046
|
-
if (url != null) {
|
|
1047
|
-
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);
|
|
1509
|
+
if (tag === "link" && url == null && typeof props.imagesrcset === "string") el = findAssetElement(`link[rel="${props.rel}"]`, "href", null, props);else if (url != null) {
|
|
1510
|
+
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);
|
|
1048
1511
|
}
|
|
1049
1512
|
if (!el) document.head.appendChild(createHeadElement(tag, props));
|
|
1050
1513
|
}
|
|
@@ -1066,7 +1529,7 @@ function gateHeadResource(props) {
|
|
|
1066
1529
|
if (attrs) descriptor.attrs = attrs;
|
|
1067
1530
|
effect(() => {
|
|
1068
1531
|
const entry = warmAsset(descriptor);
|
|
1069
|
-
if (gateable && entry.loadState === "pending" && typeof waitAsset === "function") waitAsset(entry.loadPromise);
|
|
1532
|
+
if (gateable && !isHydrating() && entry.loadState === "pending" && typeof waitAsset === "function") waitAsset(entry.loadPromise);
|
|
1070
1533
|
}, () => acquireAsset(descriptor));
|
|
1071
1534
|
}
|
|
1072
1535
|
function useHead(tags) {
|
|
@@ -1149,19 +1612,44 @@ function loadModuleAssets(mapping) {
|
|
|
1149
1612
|
}
|
|
1150
1613
|
return pending.length ? Promise.all(pending).then(() => {}) : undefined;
|
|
1151
1614
|
}
|
|
1152
|
-
function hydrate
|
|
1615
|
+
function hydrate(code, element, options = {}) {
|
|
1616
|
+
enableHydration();
|
|
1153
1617
|
installHydrationRuntime();
|
|
1154
|
-
|
|
1618
|
+
const hy = globalThis._$HY;
|
|
1619
|
+
const id = options.renderId || "";
|
|
1620
|
+
if (hy.s && !hy.s[id] && !hy.s[""] && !hy.done && document.readyState === "loading") {
|
|
1621
|
+
let started, disposer;
|
|
1622
|
+
const start = () => started || (started = true, disposer = hydrate(code, element, options));
|
|
1623
|
+
(hy.sp || (hy.sp = [])).push([id, start]);
|
|
1624
|
+
hy.sw = key => hy.sp.forEach(([k, f]) => (!key || k === key) && queueMicrotask(f));
|
|
1625
|
+
document.addEventListener("DOMContentLoaded", start, {
|
|
1626
|
+
once: true
|
|
1627
|
+
});
|
|
1628
|
+
return () => {
|
|
1629
|
+
started = true;
|
|
1630
|
+
disposer && disposer();
|
|
1631
|
+
};
|
|
1632
|
+
}
|
|
1633
|
+
if (hy.done) return render(code, element, [...element.childNodes], options);
|
|
1634
|
+
const head = (element.nodeType === 9 ? element : element.ownerDocument).head;
|
|
1635
|
+
if (head && element.contains(head)) {
|
|
1636
|
+
let n = head.firstChild;
|
|
1637
|
+
while (n && n.nodeType === 1 && n.hasAttribute("data-dh") && !n.hasAttribute("data-dhf")) {
|
|
1638
|
+
const next = n.nextSibling;
|
|
1639
|
+
head.appendChild(n);
|
|
1640
|
+
n = next;
|
|
1641
|
+
}
|
|
1642
|
+
}
|
|
1155
1643
|
options.renderId ||= "";
|
|
1156
1644
|
if (!globalThis._$HY.modules) globalThis._$HY.modules = {};
|
|
1157
1645
|
if (!globalThis._$HY.loading) globalThis._$HY.loading = {};
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1646
|
+
sharedConfig.completed = globalThis._$HY.completed;
|
|
1647
|
+
sharedConfig.events = globalThis._$HY.events;
|
|
1648
|
+
sharedConfig.load = id => globalThis._$HY.r[id];
|
|
1649
|
+
sharedConfig.has = id => id in globalThis._$HY.r;
|
|
1650
|
+
sharedConfig.gather = root => gatherHydratable(element, root);
|
|
1651
|
+
sharedConfig.loadModuleAssets = loadModuleAssets;
|
|
1652
|
+
sharedConfig.cleanupFragment = id => {
|
|
1165
1653
|
const tpl = document.getElementById("pl-" + id);
|
|
1166
1654
|
if (tpl) {
|
|
1167
1655
|
let node = tpl.nextSibling;
|
|
@@ -1177,20 +1665,20 @@ function hydrate$1(code, element, options = {}) {
|
|
|
1177
1665
|
tpl.remove();
|
|
1178
1666
|
}
|
|
1179
1667
|
};
|
|
1180
|
-
|
|
1181
|
-
if (!
|
|
1182
|
-
|
|
1183
|
-
if (
|
|
1184
|
-
registry:
|
|
1185
|
-
gather:
|
|
1668
|
+
sharedConfig.registry = new Map();
|
|
1669
|
+
if (!sharedConfig.boundaryScopes) sharedConfig.boundaryScopes = new Map();
|
|
1670
|
+
sharedConfig.captureBoundaryScope = id => {
|
|
1671
|
+
if (sharedConfig.registry) sharedConfig.boundaryScopes.set(id, {
|
|
1672
|
+
registry: sharedConfig.registry,
|
|
1673
|
+
gather: sharedConfig.gather
|
|
1186
1674
|
});
|
|
1187
1675
|
};
|
|
1188
|
-
|
|
1676
|
+
sharedConfig.hydrating = true;
|
|
1189
1677
|
{
|
|
1190
|
-
|
|
1191
|
-
if (
|
|
1192
|
-
const orphaned = [...
|
|
1193
|
-
|
|
1678
|
+
sharedConfig.verifyHydration = () => {
|
|
1679
|
+
if (sharedConfig.registry && sharedConfig.registry.size) {
|
|
1680
|
+
const orphaned = [...sharedConfig.registry.values()].filter(node => node.isConnected);
|
|
1681
|
+
sharedConfig.registry.clear();
|
|
1194
1682
|
if (!orphaned.length) return;
|
|
1195
1683
|
console.warn(`Hydration completed with ${orphaned.length} unclaimed server-rendered node(s):\n` + orphaned.map(node => ` ${node.outerHTML.slice(0, 100)}`).join("\n"));
|
|
1196
1684
|
}
|
|
@@ -1202,43 +1690,48 @@ function hydrate$1(code, element, options = {}) {
|
|
|
1202
1690
|
const p = loadModuleAssets(rootMapping);
|
|
1203
1691
|
if (p) {
|
|
1204
1692
|
gatherHydratable(element, options.renderId);
|
|
1205
|
-
const registry =
|
|
1206
|
-
const gather =
|
|
1693
|
+
const registry = sharedConfig.registry;
|
|
1694
|
+
const gather = sharedConfig.gather;
|
|
1207
1695
|
let disposer;
|
|
1208
1696
|
p.then(() => {
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1697
|
+
sharedConfig.registry = registry;
|
|
1698
|
+
sharedConfig.gather = gather;
|
|
1699
|
+
sharedConfig.hydrating = true;
|
|
1212
1700
|
try {
|
|
1213
|
-
disposer = render
|
|
1701
|
+
disposer = render(code, element, [...element.childNodes], options);
|
|
1214
1702
|
} finally {
|
|
1215
|
-
|
|
1703
|
+
sharedConfig.hydrating = false;
|
|
1216
1704
|
}
|
|
1217
1705
|
}, err => {
|
|
1706
|
+
sharedConfig.hydrating = false;
|
|
1707
|
+
sharedConfig.registry = undefined;
|
|
1708
|
+
if (element.nodeType === 9) {
|
|
1709
|
+
console.error("Hydration module preload failed for a document root; a document shell cannot " + "be client-rendered, so hydration was abandoned and the page is not interactive.");
|
|
1710
|
+
(globalThis.reportError || console.error)(err);
|
|
1711
|
+
return;
|
|
1712
|
+
}
|
|
1218
1713
|
console.error("Hydration module preload failed, falling back to client render:", err);
|
|
1219
|
-
|
|
1220
|
-
solidJs.sharedConfig.registry = undefined;
|
|
1221
|
-
disposer = render$1(code, element, [...element.childNodes], options);
|
|
1714
|
+
disposer = render(code, element, [...element.childNodes], options);
|
|
1222
1715
|
});
|
|
1223
1716
|
return () => disposer && disposer();
|
|
1224
1717
|
}
|
|
1225
1718
|
}
|
|
1226
1719
|
try {
|
|
1227
1720
|
gatherHydratable(element, options.renderId);
|
|
1228
|
-
return render
|
|
1721
|
+
return render(code, element, [...element.childNodes], options);
|
|
1229
1722
|
} finally {
|
|
1230
|
-
|
|
1723
|
+
sharedConfig.hydrating = false;
|
|
1231
1724
|
}
|
|
1232
1725
|
}
|
|
1233
1726
|
function getNextElement(template) {
|
|
1234
|
-
let
|
|
1235
|
-
key
|
|
1236
|
-
|
|
1237
|
-
if (!hydrating || !(node = solidJs.sharedConfig.registry.get(key = getHydrationKey()))) {
|
|
1727
|
+
let key = sharedConfig.hydrating && getHydrationKey(),
|
|
1728
|
+
node = isHydrating() && sharedConfig.registry.get(key);
|
|
1729
|
+
if (!node) {
|
|
1238
1730
|
if (!template) {
|
|
1239
1731
|
throw new Error(`Hydration Mismatch. Unable to find DOM nodes for hydration key: ${key}`);
|
|
1240
1732
|
}
|
|
1241
|
-
if (
|
|
1733
|
+
if (isHydrating()) {
|
|
1734
|
+
hydrationKeyMisses++;
|
|
1242
1735
|
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>).`);
|
|
1243
1736
|
}
|
|
1244
1737
|
return template(true);
|
|
@@ -1249,8 +1742,8 @@ function getNextElement(template) {
|
|
|
1249
1742
|
console.warn(`Hydration tag mismatch for key "${key}": expected <${expected}> but found`, node);
|
|
1250
1743
|
}
|
|
1251
1744
|
}
|
|
1252
|
-
if (
|
|
1253
|
-
|
|
1745
|
+
if (sharedConfig.completed) sharedConfig.completed.add(node);
|
|
1746
|
+
sharedConfig.registry.delete(key);
|
|
1254
1747
|
return node;
|
|
1255
1748
|
}
|
|
1256
1749
|
function getNextMatch(el, nodeName) {
|
|
@@ -1321,12 +1814,12 @@ function describeSiblings(parent, mismatchChild, expectedTag, isMissing) {
|
|
|
1321
1814
|
return `<${pTag}>${prefix}${tags}${suffix}</${pTag}>`;
|
|
1322
1815
|
}
|
|
1323
1816
|
function runHydrationEvents() {
|
|
1324
|
-
if (
|
|
1817
|
+
if (sharedConfig.events && !sharedConfig.events.queued) {
|
|
1325
1818
|
queueMicrotask(() => {
|
|
1326
1819
|
const {
|
|
1327
1820
|
completed,
|
|
1328
1821
|
events
|
|
1329
|
-
} =
|
|
1822
|
+
} = sharedConfig;
|
|
1330
1823
|
if (!events) return;
|
|
1331
1824
|
events.queued = false;
|
|
1332
1825
|
while (events.length) {
|
|
@@ -1359,25 +1852,46 @@ function runHydrationEvents() {
|
|
|
1359
1852
|
matches.sort((a, b) => a.distance - b.distance);
|
|
1360
1853
|
for (let i = 0; i < matches.length; i++) eventHandler(e, matches[i].container, matches[i].state);
|
|
1361
1854
|
} else if (matchContainer) eventHandler(e, matchContainer, matchState);
|
|
1855
|
+
flush();
|
|
1362
1856
|
}
|
|
1363
|
-
if (
|
|
1364
|
-
|
|
1365
|
-
|
|
1857
|
+
if (sharedConfig.done) {
|
|
1858
|
+
sharedConfig.events = _$HY.events = null;
|
|
1859
|
+
sharedConfig.completed = _$HY.completed = null;
|
|
1366
1860
|
}
|
|
1367
1861
|
});
|
|
1368
|
-
|
|
1862
|
+
sharedConfig.events.queued = true;
|
|
1369
1863
|
}
|
|
1370
1864
|
}
|
|
1371
1865
|
function isHydrating(node) {
|
|
1372
|
-
if (!
|
|
1866
|
+
if (!sharedConfig.hydrating) return false;
|
|
1867
|
+
if (sharedConfig.isClaiming && !sharedConfig.isClaiming()) return false;
|
|
1373
1868
|
if (!node || node.isConnected) return true;
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1869
|
+
return serverComponentClaims !== null && serverComponentClaims.claimed(node);
|
|
1870
|
+
}
|
|
1871
|
+
let serverComponentClaims = null;
|
|
1872
|
+
function installServerComponentHydration() {
|
|
1873
|
+
enableServerComponentHydration();
|
|
1874
|
+
if (serverComponentClaims !== null) return;
|
|
1875
|
+
serverComponentClaims = {
|
|
1876
|
+
claimed(node) {
|
|
1877
|
+
const roots = sharedConfig.claimRoots;
|
|
1878
|
+
if (roots) {
|
|
1879
|
+
for (let i = 0; i < roots.length; i++) {
|
|
1880
|
+
if (roots[i].contains(node)) return true;
|
|
1881
|
+
}
|
|
1882
|
+
}
|
|
1883
|
+
return false;
|
|
1884
|
+
},
|
|
1885
|
+
inFrame(element) {
|
|
1886
|
+
const frames = element.querySelectorAll("[data-fid]");
|
|
1887
|
+
const frameCount = frames.length;
|
|
1888
|
+
if (frameCount === 0) return undefined;
|
|
1889
|
+
return node => {
|
|
1890
|
+
for (let j = 0; j < frameCount; j++) if (frames[j].contains(node)) return true;
|
|
1891
|
+
return false;
|
|
1892
|
+
};
|
|
1378
1893
|
}
|
|
1379
|
-
}
|
|
1380
|
-
return false;
|
|
1894
|
+
};
|
|
1381
1895
|
}
|
|
1382
1896
|
function classListToObject(classList) {
|
|
1383
1897
|
if (Array.isArray(classList)) {
|
|
@@ -1401,7 +1915,8 @@ function classListToObject(classList) {
|
|
|
1401
1915
|
function flattenClassList(list, result) {
|
|
1402
1916
|
for (let i = 0, len = list.length; i < len; i++) {
|
|
1403
1917
|
const item = list[i];
|
|
1404
|
-
if (Array.isArray(item)) flattenClassList(item, result);else if (typeof item === "object" && item != null) Object.assign(result, item);
|
|
1918
|
+
if (Array.isArray(item)) flattenClassList(item, result);else if (typeof item === "object" && item != null) Object.assign(result, item);
|
|
1919
|
+
else if (typeof item !== "boolean" && (item || item === 0)) result[item] = true;
|
|
1405
1920
|
}
|
|
1406
1921
|
}
|
|
1407
1922
|
function assignProp(node, prop, value, prev, skipRef, nodeName) {
|
|
@@ -1412,22 +1927,28 @@ function assignProp(node, prop, value, prev, skipRef, nodeName) {
|
|
|
1412
1927
|
if (!skipRef && value) ref(() => value, node);
|
|
1413
1928
|
return value;
|
|
1414
1929
|
}
|
|
1930
|
+
let c;
|
|
1415
1931
|
const hasNamespace = prop.indexOf(":") > -1;
|
|
1416
|
-
if (!hasNamespace && prop.
|
|
1932
|
+
if (!hasNamespace && prop.startsWith("on") && (c = prop.charCodeAt(2)) > 64 && c < 91) {
|
|
1417
1933
|
const name = prop.slice(2).toLowerCase();
|
|
1418
1934
|
const delegate = DelegatedEvents.has(name);
|
|
1419
1935
|
if (!delegate && prev) {
|
|
1420
|
-
|
|
1421
|
-
node.removeEventListener(name,
|
|
1936
|
+
if (Array.isArray(value) && typeof prev === "function" && prev[$$EVENT_TUPLE] === value) return prev;
|
|
1937
|
+
node.removeEventListener(name, prev, typeof prev !== "function" && prev);
|
|
1422
1938
|
}
|
|
1423
1939
|
if (delegate || value) {
|
|
1424
|
-
addEvent(node, name, value, delegate);
|
|
1940
|
+
const attached = addEvent(node, name, value, delegate);
|
|
1425
1941
|
delegate && delegateEvents([name]);
|
|
1942
|
+
if (!delegate) return attached;
|
|
1426
1943
|
}
|
|
1427
1944
|
} else if (hasNamespace && prop.slice(0, 5) === "prop:" || ChildProperties.has(prop) || DOMWithState[nodeName]?.[prop]) {
|
|
1428
1945
|
if (hasNamespace) prop = prop.slice(5);else if (isHydrating(node)) return value;
|
|
1429
|
-
|
|
1430
|
-
|
|
1946
|
+
checkStatefulWrite(node, prop, value);
|
|
1947
|
+
if (prop === "value" && nodeName === "SELECT") writeSelectValue(node, value);else if ((prop === "value" || prop === "defaultValue") && (nodeName === "INPUT" || nodeName === "TEXTAREA")) {
|
|
1948
|
+
if (value == null && /^(checkbox|radio)$/.test(node.type)) node.removeAttribute("value");else node[prop] = value ?? "";
|
|
1949
|
+
} else node[prop] = value;
|
|
1950
|
+
recordStatefulWrite(node, prop, value);
|
|
1951
|
+
reclaimAttribute(node, prop);
|
|
1431
1952
|
} else {
|
|
1432
1953
|
const ns = hasNamespace && Namespaces[prop.split(":")[0]];
|
|
1433
1954
|
if (ns) setAttributeNS(node, ns, prop, value);else setAttribute(node, prop, value);
|
|
@@ -1442,27 +1963,21 @@ function eventHandler(e, container, state) {
|
|
|
1442
1963
|
if (prev === true || prev === container || !container.contains(prev)) return;
|
|
1443
1964
|
resumeNode = prev;
|
|
1444
1965
|
}
|
|
1445
|
-
const owner = state
|
|
1446
|
-
if (
|
|
1447
|
-
if (owner
|
|
1448
|
-
e[$$EVENT_OWNER] = owner
|
|
1966
|
+
const owner = state.owners.size === 1 && state.owners.has(container) ? container : findOwner(e.target, state)?.owner;
|
|
1967
|
+
if (!owner) return;
|
|
1968
|
+
if (owner === resumeNode) return;
|
|
1969
|
+
e[$$EVENT_OWNER] = owner;
|
|
1449
1970
|
let node = resumeNode || e.target;
|
|
1450
|
-
const key =
|
|
1451
|
-
const oriTarget = e.target;
|
|
1452
|
-
const boundary = owner || container || e.currentTarget;
|
|
1971
|
+
const key = EVENT_KEY + e.type;
|
|
1453
1972
|
const retarget = value => Object.defineProperty(e, "target", {
|
|
1454
1973
|
configurable: true,
|
|
1455
1974
|
value
|
|
1456
1975
|
});
|
|
1457
1976
|
const handleNode = () => {
|
|
1458
|
-
|
|
1459
|
-
if (handler === undefined && node.hasAttribute && node.hasAttribute("_bnd")) {
|
|
1460
|
-
const seam = globalThis[Symbol.for("dx.bnd")];
|
|
1461
|
-
if (seam) handler = seam.resolve(node, e.type);
|
|
1462
|
-
}
|
|
1977
|
+
const handler = node[key];
|
|
1463
1978
|
if (handler && !node.disabled) {
|
|
1464
1979
|
const data = node[`${key}Data`];
|
|
1465
|
-
data !== undefined ? handler.call(node, data, e) : handler.call(node, e);
|
|
1980
|
+
data !== undefined ? handler.call(node, data, e) : typeof handler === "function" ? handler.call(node, e) : handler.handleEvent(e);
|
|
1466
1981
|
if (e.cancelBubble) return;
|
|
1467
1982
|
}
|
|
1468
1983
|
node.host && typeof node.host !== "string" && !node.host._$host && node.contains(e.target) && retarget(node.host);
|
|
@@ -1470,19 +1985,19 @@ function eventHandler(e, container, state) {
|
|
|
1470
1985
|
};
|
|
1471
1986
|
const walkUpTree = () => {
|
|
1472
1987
|
while (node && handleNode()) {
|
|
1473
|
-
if (node ===
|
|
1988
|
+
if (node === owner || node.parentNode === owner) break;
|
|
1474
1989
|
node = node._$host || node.parentNode || node.host;
|
|
1475
1990
|
}
|
|
1476
1991
|
};
|
|
1477
1992
|
Object.defineProperty(e, "currentTarget", {
|
|
1478
1993
|
configurable: true,
|
|
1479
1994
|
get() {
|
|
1480
|
-
return node ||
|
|
1995
|
+
return node || owner;
|
|
1481
1996
|
}
|
|
1482
1997
|
});
|
|
1483
1998
|
if (resumeNode) {
|
|
1484
1999
|
if (resumeNode === e.target) node = resumeNode._$host || resumeNode.parentNode || resumeNode.host;
|
|
1485
|
-
if (node && node !==
|
|
2000
|
+
if (node && node !== owner) walkUpTree();
|
|
1486
2001
|
} else if (e.composedPath) {
|
|
1487
2002
|
const path = e.composedPath();
|
|
1488
2003
|
if (path.length) {
|
|
@@ -1495,21 +2010,36 @@ function eventHandler(e, container, state) {
|
|
|
1495
2010
|
walkUpTree();
|
|
1496
2011
|
break;
|
|
1497
2012
|
}
|
|
1498
|
-
if (node ===
|
|
2013
|
+
if (node === owner || node.parentNode === owner) {
|
|
1499
2014
|
break;
|
|
1500
2015
|
}
|
|
1501
2016
|
}
|
|
1502
2017
|
} else walkUpTree();
|
|
1503
2018
|
}
|
|
1504
2019
|
else walkUpTree();
|
|
1505
|
-
|
|
2020
|
+
delete e.target;
|
|
2021
|
+
delete e.currentTarget;
|
|
1506
2022
|
}
|
|
1507
2023
|
function insertExpression(parent, value, current, marker) {
|
|
2024
|
+
tagElement(parent);
|
|
1508
2025
|
if (hydrationRt !== null && isHydrating(parent)) {
|
|
1509
|
-
if (value && value !== current)
|
|
2026
|
+
if (value && value !== current) {
|
|
2027
|
+
const arr = Array.isArray(value);
|
|
2028
|
+
for (const n of arr ? value : [value]) {
|
|
2029
|
+
if (n && n.nodeType) {
|
|
2030
|
+
if (!isHydrating(n)) return current;
|
|
2031
|
+
} else if (arr && (typeof n === "string" || typeof n === "number")) {
|
|
2032
|
+
return current;
|
|
2033
|
+
}
|
|
2034
|
+
}
|
|
2035
|
+
}
|
|
1510
2036
|
return value;
|
|
1511
2037
|
}
|
|
1512
2038
|
if (value === current) return value;
|
|
2039
|
+
if (hydrationRt !== null && sharedConfig.hydrating && value && value.length !== 0) {
|
|
2040
|
+
const tracked = [].concat(current ?? []);
|
|
2041
|
+
if ([].concat(value).every(n => (n === tracked[0] && tracked.shift(), n?.parentNode === parent)) && !tracked.length) return value;
|
|
2042
|
+
}
|
|
1513
2043
|
const t = typeof value,
|
|
1514
2044
|
multi = marker !== undefined;
|
|
1515
2045
|
if (t === "string" || t === "number") {
|
|
@@ -1527,42 +2057,87 @@ function insertExpression(parent, value, current, marker) {
|
|
|
1527
2057
|
} else if (value.nodeType) {
|
|
1528
2058
|
if (Array.isArray(current)) {
|
|
1529
2059
|
cleanChildren(parent, current, multi ? marker : null, value);
|
|
1530
|
-
} else if (current && current.nodeType) {
|
|
2060
|
+
} else if (current != null && current.nodeType) {
|
|
1531
2061
|
current.parentNode === parent ? parent.replaceChild(value, current) : parent.appendChild(value);
|
|
1532
|
-
} else if (current && parent.firstChild) {
|
|
2062
|
+
} else if (current != null && parent.firstChild) {
|
|
1533
2063
|
parent.replaceChild(value, parent.firstChild);
|
|
1534
2064
|
} else {
|
|
1535
2065
|
parent.appendChild(value);
|
|
1536
2066
|
}
|
|
1537
|
-
if (marker) value[$$SLOT] = marker;
|
|
2067
|
+
if (marker || value[$$SLOT]) value[$$SLOT] = marker || parent;
|
|
1538
2068
|
} else if (Array.isArray(value)) {
|
|
1539
|
-
const currentArray =
|
|
2069
|
+
const currentArray = Array.isArray(current);
|
|
2070
|
+
for (let i = 0, len = value.length; i < len; i++) {
|
|
2071
|
+
const item = value[i],
|
|
2072
|
+
t = typeof item;
|
|
2073
|
+
if (t === "string" || t === "number") {
|
|
2074
|
+
const prev = currentArray ? current[i] : undefined;
|
|
2075
|
+
if (prev && prev.nodeType === 3) {
|
|
2076
|
+
if (prev.data !== "" + item) prev.data = item;
|
|
2077
|
+
value[i] = prev;
|
|
2078
|
+
} else value[i] = document.createTextNode(item);
|
|
2079
|
+
}
|
|
2080
|
+
}
|
|
1540
2081
|
if (value.length === 0) {
|
|
1541
2082
|
cleanChildren(parent, current, marker);
|
|
1542
2083
|
} else if (currentArray) {
|
|
1543
|
-
|
|
1544
|
-
appendNodes(parent, value, marker);
|
|
1545
|
-
} else reconcileArrays(parent, current, value, marker);
|
|
2084
|
+
reconcileArrays(parent, current, value, marker);
|
|
1546
2085
|
} else {
|
|
1547
|
-
current
|
|
1548
|
-
|
|
2086
|
+
if (current != null) cleanChildren(parent, current);
|
|
2087
|
+
reconcileArrays(parent, [], value);
|
|
1549
2088
|
}
|
|
1550
|
-
} else
|
|
2089
|
+
} else devCheck({
|
|
2090
|
+
code: "UNRECOGNIZED_INSERT_VALUE",
|
|
2091
|
+
kind: "render",
|
|
2092
|
+
severity: "warn",
|
|
2093
|
+
message: `[UNRECOGNIZED_INSERT_VALUE] Unrecognized value. Skipped inserting (${typeof value}).`,
|
|
2094
|
+
data: {
|
|
2095
|
+
type: typeof value,
|
|
2096
|
+
value
|
|
2097
|
+
}
|
|
2098
|
+
});
|
|
2099
|
+
selectInsert && selectInsert(parent);
|
|
1551
2100
|
return value;
|
|
1552
2101
|
}
|
|
2102
|
+
function selectChange(e) {
|
|
2103
|
+
(e = e.currentTarget || e)._$v = null;
|
|
2104
|
+
e.removeEventListener("change", selectChange, true);
|
|
2105
|
+
}
|
|
2106
|
+
function writeSelectValue(node, value) {
|
|
2107
|
+
const had = node._$v && node._$v.map,
|
|
2108
|
+
has = value != null && value.map;
|
|
2109
|
+
if (has) had || node.addEventListener("change", selectChange, true);else had && node.removeEventListener("change", selectChange, true);
|
|
2110
|
+
if (value == null) {
|
|
2111
|
+
node._$v = null;
|
|
2112
|
+
return queueMicrotask(() => node.value = value) || (node.value = value);
|
|
2113
|
+
}
|
|
2114
|
+
node._$v = value;
|
|
2115
|
+
(selectInsert ||= applySelectValue)(node);
|
|
2116
|
+
queueMicrotask(() => selectInsert(node));
|
|
2117
|
+
}
|
|
2118
|
+
function applySelectValue(p) {
|
|
2119
|
+
p && p._$v == null && (p = p.parentNode);
|
|
2120
|
+
const v = p && p._$v;
|
|
2121
|
+
if (v == null) return;
|
|
2122
|
+
if (v.map) {
|
|
2123
|
+
const o = [...p.options];
|
|
2124
|
+
for (let i = 0; i < o.length; i++) o[i].selected = v.some(x => x == o[i].value);
|
|
2125
|
+
v.every(x => o.some(el => el.value == x)) && selectChange(p);
|
|
2126
|
+
} else p.value = v, p.selectedIndex > -1 && p.value == v && (p._$v = null);
|
|
2127
|
+
}
|
|
1553
2128
|
function normalize(value, current, multi, doNotUnwrap) {
|
|
1554
|
-
value =
|
|
2129
|
+
value = flatten(value, {
|
|
1555
2130
|
skipNonRendered: true,
|
|
1556
2131
|
doNotUnwrap
|
|
1557
2132
|
});
|
|
1558
2133
|
if (doNotUnwrap && typeof value === "function") return value;
|
|
1559
2134
|
if (multi && !Array.isArray(value)) value = [value != null ? value : ""];
|
|
1560
|
-
if (Array.isArray(value)) {
|
|
2135
|
+
if (hydrationRt !== null && sharedConfig.hydrating && Array.isArray(value)) {
|
|
1561
2136
|
for (let i = 0, len = value.length; i < len; i++) {
|
|
1562
2137
|
const item = value[i],
|
|
1563
2138
|
prev = current && current[i],
|
|
1564
2139
|
t = typeof item;
|
|
1565
|
-
if (t === "string" || t === "number")
|
|
2140
|
+
if ((t === "string" || t === "number") && prev && prev.nodeType === 3 && isHydrating(prev)) value[i] = prev;
|
|
1566
2141
|
}
|
|
1567
2142
|
}
|
|
1568
2143
|
return value;
|
|
@@ -1578,13 +2153,6 @@ function tagHost(value, host) {
|
|
|
1578
2153
|
});
|
|
1579
2154
|
}
|
|
1580
2155
|
}
|
|
1581
|
-
function appendNodes(parent, array, marker = null) {
|
|
1582
|
-
for (let i = 0, len = array.length; i < len; i++) {
|
|
1583
|
-
const n = array[i];
|
|
1584
|
-
parent.insertBefore(n, marker);
|
|
1585
|
-
if (marker) n[$$SLOT] = marker;
|
|
1586
|
-
}
|
|
1587
|
-
}
|
|
1588
2156
|
function ownsAllChildren(parent, current) {
|
|
1589
2157
|
if (current == null) return true;
|
|
1590
2158
|
if (Array.isArray(current)) {
|
|
@@ -1619,33 +2187,31 @@ function cleanChildren(parent, current, marker, replacement) {
|
|
|
1619
2187
|
const el = current[i];
|
|
1620
2188
|
if (replacement !== el) {
|
|
1621
2189
|
const tag = el[$$SLOT];
|
|
1622
|
-
const owns = el.parentNode === parent && (!tag || tag === marker);
|
|
2190
|
+
const owns = el.parentNode === parent && (!tag || tag === (marker || parent));
|
|
1623
2191
|
if (replacement && !inserted && !i) owns ? parent.replaceChild(replacement, el) : parent.insertBefore(replacement, marker);else if (owns) el.remove();
|
|
1624
2192
|
} else inserted = true;
|
|
1625
2193
|
}
|
|
1626
2194
|
} else if (replacement) parent.insertBefore(replacement, marker);
|
|
1627
|
-
if (replacement && marker) replacement[$$SLOT] = marker;
|
|
2195
|
+
if (replacement && (marker || replacement[$$SLOT])) replacement[$$SLOT] = marker || parent;
|
|
1628
2196
|
}
|
|
1629
2197
|
function gatherHydratable(element, root) {
|
|
1630
|
-
const templates = element.querySelectorAll(`*[_hk]`);
|
|
2198
|
+
const templates = element.querySelectorAll(root ? `[_hk^="${root.replace(/["\\]/g, "\\$&")}"]` : `*[_hk]`);
|
|
2199
|
+
const inFrame = root || serverComponentClaims === null ? undefined : serverComponentClaims.inFrame(element);
|
|
2200
|
+
const registry = sharedConfig.registry;
|
|
1631
2201
|
for (let i = 0; i < templates.length; i++) {
|
|
1632
2202
|
const node = templates[i];
|
|
2203
|
+
if (inFrame !== undefined && inFrame(node)) continue;
|
|
1633
2204
|
const key = node.getAttribute("_hk");
|
|
1634
|
-
if (
|
|
1635
|
-
if (!key.startsWith(root)) continue;
|
|
1636
|
-
} else {
|
|
1637
|
-
const frame = node.closest("[data-fid]");
|
|
1638
|
-
if (frame && frame !== element && element.contains(frame)) continue;
|
|
1639
|
-
}
|
|
1640
|
-
if (!solidJs.sharedConfig.registry.has(key)) solidJs.sharedConfig.registry.set(key, node);
|
|
2205
|
+
if (!registry.has(key)) registry.set(key, node);
|
|
1641
2206
|
}
|
|
1642
2207
|
}
|
|
1643
2208
|
function getHydrationKey() {
|
|
1644
|
-
return
|
|
2209
|
+
return sharedConfig.getNextContextId();
|
|
1645
2210
|
}
|
|
1646
|
-
const voidFn = () => undefined;
|
|
1647
2211
|
const RequestContext = Symbol();
|
|
1648
2212
|
|
|
2213
|
+
function configureServerErrors(_config) {}
|
|
2214
|
+
function reportRequestFailure(_error, _event) {}
|
|
1649
2215
|
function throwInBrowser(func) {
|
|
1650
2216
|
const err = new Error(`${func.name} is not supported in the browser, returning undefined`);
|
|
1651
2217
|
console.error(err);
|
|
@@ -1675,28 +2241,38 @@ function composeMiddleware(middlewares) {
|
|
|
1675
2241
|
throwInBrowser(composeMiddleware);
|
|
1676
2242
|
}
|
|
1677
2243
|
function ssr(template, ...nodes) {}
|
|
1678
|
-
function ssrElement(name, props, children, needsId) {}
|
|
2244
|
+
function ssrElement(name, props, children, needsId, skip, attrs) {}
|
|
2245
|
+
function ssrElementAttribute(key, value) {}
|
|
2246
|
+
function ssrLinkClaim(attrs) {}
|
|
1679
2247
|
function ssrClassName(value) {}
|
|
1680
2248
|
function ssrStyle(value) {}
|
|
1681
2249
|
function ssrStyleProperty(name, value) {}
|
|
2250
|
+
function ssrStyleProperties(...entries) {}
|
|
1682
2251
|
function ssrAttribute(key, value) {}
|
|
1683
2252
|
function ssrGroup(fn, n) {}
|
|
1684
2253
|
function ssrHydrationKey() {}
|
|
1685
|
-
function resolveSSRNode(node, result, top) {}
|
|
2254
|
+
function resolveSSRNode(node, result, top, nested) {}
|
|
1686
2255
|
function escape(s, attr) {}
|
|
1687
2256
|
|
|
1688
2257
|
const ENVELOPE = Symbol.for("solid.ResponseEnvelope");
|
|
1689
|
-
|
|
1690
|
-
const ResponseEnvelope =
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
2258
|
+
let EnvelopeClass;
|
|
2259
|
+
const ResponseEnvelope = function ResponseEnvelope(response, value) {
|
|
2260
|
+
if (!EnvelopeClass) {
|
|
2261
|
+
EnvelopeClass = class extends Response {
|
|
2262
|
+
constructor(response, value) {
|
|
2263
|
+
super(response ? response.body : null, response && {
|
|
2264
|
+
status: response.status,
|
|
2265
|
+
statusText: response.statusText,
|
|
2266
|
+
headers: copyHeaders(response.headers)
|
|
2267
|
+
});
|
|
2268
|
+
this.response = response ? this : undefined;
|
|
2269
|
+
this.value = value;
|
|
2270
|
+
}
|
|
2271
|
+
};
|
|
2272
|
+
EnvelopeClass.prototype[ENVELOPE] = true;
|
|
1696
2273
|
}
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
})();
|
|
2274
|
+
return new EnvelopeClass(response, value);
|
|
2275
|
+
};
|
|
1700
2276
|
function isResponseEnvelope(value) {
|
|
1701
2277
|
return !!(value && typeof value === "object" && value[ENVELOPE]);
|
|
1702
2278
|
}
|
|
@@ -1719,24 +2295,38 @@ function isSafeError(value) {
|
|
|
1719
2295
|
return !!(value && (typeof value === "object" || typeof value === "function") && value[SAFE_ERROR]);
|
|
1720
2296
|
}
|
|
1721
2297
|
const REVALIDATE_HEADER = "X-Revalidate";
|
|
1722
|
-
|
|
2298
|
+
const REVALIDATE_ALL = "*";
|
|
2299
|
+
const RESPONSE_HEADER_VALUE_LIMIT = 4096;
|
|
2300
|
+
function copyHeaders(init) {
|
|
2301
|
+
const source = init;
|
|
2302
|
+
if (!source || !source.getSetCookie) return new Headers(init);
|
|
2303
|
+
const headers = new Headers();
|
|
2304
|
+
source.forEach((value, key) => {
|
|
2305
|
+
if (key !== "set-cookie") headers.append(key, value);
|
|
2306
|
+
});
|
|
2307
|
+
for (const cookie of source.getSetCookie()) headers.append("Set-Cookie", cookie);
|
|
2308
|
+
return headers;
|
|
2309
|
+
}
|
|
2310
|
+
function initWithRevalidate(init = {}) {
|
|
2311
|
+
const resolved = typeof init === "number" ? {
|
|
2312
|
+
status: init
|
|
2313
|
+
} : init;
|
|
1723
2314
|
const {
|
|
1724
2315
|
revalidate,
|
|
1725
2316
|
...responseInit
|
|
1726
|
-
} =
|
|
1727
|
-
|
|
1728
|
-
if (
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
});
|
|
1733
|
-
for (const cookie of responseInit.headers.getSetCookie()) {
|
|
1734
|
-
headers.append("Set-Cookie", cookie);
|
|
2317
|
+
} = resolved;
|
|
2318
|
+
const headers = copyHeaders(responseInit.headers);
|
|
2319
|
+
if (revalidate !== undefined) {
|
|
2320
|
+
const list = Array.isArray(revalidate) ? revalidate : [revalidate];
|
|
2321
|
+
if (list.length > 1 && list.includes(REVALIDATE_ALL)) {
|
|
2322
|
+
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.`);
|
|
1735
2323
|
}
|
|
1736
|
-
|
|
1737
|
-
|
|
2324
|
+
const keys = list.join(",");
|
|
2325
|
+
if (keys.length > RESPONSE_HEADER_VALUE_LIMIT) {
|
|
2326
|
+
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.`);
|
|
2327
|
+
}
|
|
2328
|
+
headers.set(REVALIDATE_HEADER, keys);
|
|
1738
2329
|
}
|
|
1739
|
-
revalidate !== undefined && headers.set(REVALIDATE_HEADER, revalidate.toString());
|
|
1740
2330
|
return {
|
|
1741
2331
|
responseInit,
|
|
1742
2332
|
headers
|
|
@@ -1749,13 +2339,17 @@ function redirect(url, init = 302) {
|
|
|
1749
2339
|
const {
|
|
1750
2340
|
responseInit,
|
|
1751
2341
|
headers
|
|
1752
|
-
} = initWithRevalidate(
|
|
1753
|
-
status: init
|
|
1754
|
-
} : init);
|
|
2342
|
+
} = initWithRevalidate(init);
|
|
1755
2343
|
if (responseInit.status === undefined) {
|
|
1756
2344
|
responseInit.status = 302;
|
|
1757
2345
|
}
|
|
1758
|
-
|
|
2346
|
+
const target = typeof url === "string" ? url : url[HREF];
|
|
2347
|
+
const location = typeof target === "string" ? target : String(url);
|
|
2348
|
+
const encoded = location.replace(/[^\x00-\x7f]/gu, encodeURIComponent);
|
|
2349
|
+
if (encoded.length > RESPONSE_HEADER_VALUE_LIMIT) {
|
|
2350
|
+
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.`);
|
|
2351
|
+
}
|
|
2352
|
+
headers.set("Location", encoded);
|
|
1759
2353
|
return new Response(null, {
|
|
1760
2354
|
...responseInit,
|
|
1761
2355
|
headers
|
|
@@ -1771,57 +2365,50 @@ function reload(init = {}) {
|
|
|
1771
2365
|
headers
|
|
1772
2366
|
});
|
|
1773
2367
|
}
|
|
2368
|
+
const NULL_BODY_STATUSES = new Set([204, 205, 304]);
|
|
1774
2369
|
function respond(value, init = {}) {
|
|
1775
2370
|
const {
|
|
1776
2371
|
responseInit,
|
|
1777
2372
|
headers
|
|
1778
2373
|
} = initWithRevalidate(init);
|
|
2374
|
+
for (const header of COMPOSED_BODY_FRAMING) headers.delete(header);
|
|
2375
|
+
if (NULL_BODY_STATUSES.has(responseInit.status)) {
|
|
2376
|
+
return new ResponseEnvelope(new Response(null, {
|
|
2377
|
+
...responseInit,
|
|
2378
|
+
headers
|
|
2379
|
+
}), value);
|
|
2380
|
+
}
|
|
1779
2381
|
headers.set("Content-Type", "application/json");
|
|
1780
|
-
return new ResponseEnvelope(new Response(
|
|
2382
|
+
return new ResponseEnvelope(new Response(new ReadableStream({
|
|
2383
|
+
pull(controller) {
|
|
2384
|
+
controller.enqueue(new TextEncoder().encode(JSON.stringify(value)));
|
|
2385
|
+
controller.close();
|
|
2386
|
+
}
|
|
2387
|
+
}), {
|
|
1781
2388
|
...responseInit,
|
|
1782
2389
|
headers
|
|
1783
2390
|
}), value);
|
|
1784
2391
|
}
|
|
1785
2392
|
|
|
1786
|
-
const mergeProps = solidJs.merge;
|
|
1787
2393
|
const isServer = false;
|
|
1788
2394
|
const isDev = true;
|
|
1789
|
-
function render(code, element, init, options = {}) {
|
|
1790
|
-
solidJs.enforceLoadingBoundary(true);
|
|
1791
|
-
try {
|
|
1792
|
-
const dispose = render$1(code, element, init, {
|
|
1793
|
-
...options,
|
|
1794
|
-
insertOptions: {
|
|
1795
|
-
schedule: true
|
|
1796
|
-
}
|
|
1797
|
-
});
|
|
1798
|
-
solidJs.flush();
|
|
1799
|
-
return dispose;
|
|
1800
|
-
} finally {
|
|
1801
|
-
solidJs.enforceLoadingBoundary(false);
|
|
1802
|
-
}
|
|
1803
|
-
}
|
|
1804
|
-
const hydrate = (...args) => {
|
|
1805
|
-
solidJs.enableHydration();
|
|
1806
|
-
return hydrate$1(...args);
|
|
1807
|
-
};
|
|
1808
2395
|
function Portal(props) {
|
|
1809
|
-
return
|
|
2396
|
+
return runWithOwner(createOwner(), () => portalImpl(props));
|
|
1810
2397
|
}
|
|
1811
2398
|
function portalImpl(props) {
|
|
1812
2399
|
const treeMarker = document.createTextNode(""),
|
|
1813
2400
|
startMarker = document.createTextNode(""),
|
|
1814
2401
|
endMarker = document.createTextNode(""),
|
|
1815
2402
|
mount = () => props.mount || document.body,
|
|
1816
|
-
content =
|
|
2403
|
+
content = createMemo(() => [startMarker, props.children], {
|
|
1817
2404
|
ssrSource: "client",
|
|
1818
2405
|
loadingValue: undefined
|
|
1819
2406
|
});
|
|
1820
|
-
|
|
1821
|
-
() => [mount(), content(),
|
|
1822
|
-
const m =
|
|
2407
|
+
createRenderEffect(
|
|
2408
|
+
() => [mount(), content(), getOwner()], ([, c, owner]) => {
|
|
2409
|
+
const m = untrack(mount);
|
|
1823
2410
|
m.appendChild(endMarker);
|
|
1824
|
-
const dispose =
|
|
2411
|
+
const dispose = runWithOwner(owner, () => createRoot(d => {
|
|
1825
2412
|
insert(m, c, endMarker, undefined, {
|
|
1826
2413
|
host: () => treeMarker.parentNode
|
|
1827
2414
|
});
|
|
@@ -1842,8 +2429,8 @@ function portalImpl(props) {
|
|
|
1842
2429
|
schedule: true,
|
|
1843
2430
|
ssrSource: "client"
|
|
1844
2431
|
});
|
|
1845
|
-
|
|
1846
|
-
const m =
|
|
2432
|
+
createEffect(mount, () => {
|
|
2433
|
+
const m = untrack(mount);
|
|
1847
2434
|
const ownerRoot = getDelegatedRoot(treeMarker);
|
|
1848
2435
|
if (!ownerRoot || ownerRoot.contains(m)) return;
|
|
1849
2436
|
registerDelegatedContainer(m, ownerRoot);
|
|
@@ -1851,73 +2438,31 @@ function portalImpl(props) {
|
|
|
1851
2438
|
}, {
|
|
1852
2439
|
ssrSource: "client"
|
|
1853
2440
|
});
|
|
1854
|
-
if (
|
|
2441
|
+
if (sharedConfig.hydrating) return createMemo(() => treeMarker, {
|
|
1855
2442
|
ssrSource: "client",
|
|
1856
2443
|
loadingValue: undefined
|
|
1857
2444
|
});
|
|
1858
2445
|
return treeMarker;
|
|
1859
2446
|
}
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
const
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
if (!binding) return next;
|
|
1871
|
-
deliveredAddress = binding.address;
|
|
1872
|
-
const prevBinding = bindingOf(prev);
|
|
1873
|
-
if (prevBinding && prevBinding.component === binding.component) {
|
|
1874
|
-
for (const deliver of sites) deliver(binding.address);
|
|
1875
|
-
return prev;
|
|
1876
|
-
}
|
|
1877
|
-
return next;
|
|
1878
|
-
};
|
|
1879
|
-
const cached = solidJs.createMemo(prev => {
|
|
1880
|
-
const next = source();
|
|
1881
|
-
if (!next || typeof next.then !== "function") return resolveBinding(next, prev);
|
|
1882
|
-
const token = ++latest;
|
|
1883
|
-
return {
|
|
1884
|
-
then: (onFulfilled, onRejected) => next.then(resolved => onFulfilled(token === latest ? resolveBinding(resolved, prev) : resolved), onRejected)
|
|
1885
|
-
};
|
|
1886
|
-
}, {
|
|
1887
|
-
lazy: true
|
|
1888
|
-
});
|
|
1889
|
-
return props => {
|
|
1890
|
-
return solidJs.createMemo(() => {
|
|
1891
|
-
const component = cached();
|
|
1892
|
-
switch (typeof component) {
|
|
1893
|
-
case "function":
|
|
1894
|
-
{
|
|
1895
|
-
Object.assign(component, {
|
|
1896
|
-
[solidJs.$DEVCOMP]: true
|
|
1897
|
-
});
|
|
1898
|
-
const binding = bindingOf(component);
|
|
1899
|
-
if (binding) {
|
|
1900
|
-
const [address, setAddress] = solidJs.createSignal(deliveredAddress ?? binding.address);
|
|
1901
|
-
sites.add(setAddress);
|
|
1902
|
-
solidJs.onCleanup(() => sites.delete(setAddress));
|
|
1903
|
-
return solidJs.untrack(() => binding.component(props, address));
|
|
1904
|
-
}
|
|
1905
|
-
return solidJs.untrack(() => component(props));
|
|
1906
|
-
}
|
|
1907
|
-
case "string":
|
|
1908
|
-
const el = solidJs.sharedConfig.hydrating ? getNextElement() : createElement(component, solidJs.untrack(() => props.is));
|
|
1909
|
-
spread(el, props);
|
|
1910
|
-
return el;
|
|
1911
|
-
}
|
|
1912
|
-
});
|
|
1913
|
-
};
|
|
2447
|
+
function dynamic(source, options) {
|
|
2448
|
+
return dynamicCore(source, options, staticElement);
|
|
2449
|
+
}
|
|
2450
|
+
function staticElement(tag, props) {
|
|
2451
|
+
const hydrating = sharedConfig.hydrating;
|
|
2452
|
+
const create = () => createElement(tag, untrack(() => props.is), untrack(() => props.xmlns));
|
|
2453
|
+
const el = hydrating ? getNextElement(create) : create();
|
|
2454
|
+
spread(el, props);
|
|
2455
|
+
if (hydrating) runHydrationEvents();
|
|
2456
|
+
return el;
|
|
1914
2457
|
}
|
|
1915
2458
|
function Dynamic(props) {
|
|
1916
2459
|
const Comp = dynamic(() => props.component);
|
|
1917
|
-
return
|
|
2460
|
+
return createComponent(Comp, omit(props, "component"));
|
|
1918
2461
|
}
|
|
1919
|
-
function createElement(tagName, is = undefined) {
|
|
1920
|
-
return
|
|
2462
|
+
function createElement(tagName, is = undefined, xmlns = undefined) {
|
|
2463
|
+
return xmlns ? document.createElementNS(xmlns, tagName, {
|
|
2464
|
+
is
|
|
2465
|
+
}) : SVGElements.has(tagName) ? document.createElementNS(Namespaces.svg, tagName) : MathMLElements.has(tagName) ? document.createElementNS(Namespaces.mathml, tagName) : document.createElement(tagName, {
|
|
1921
2466
|
is
|
|
1922
2467
|
});
|
|
1923
2468
|
}
|
|
@@ -1926,21 +2471,21 @@ function loadClientOnly(fn, setComp, exportName) {
|
|
|
1926
2471
|
}
|
|
1927
2472
|
function clientOnly(fn, options = {},
|
|
1928
2473
|
_moduleUrl) {
|
|
1929
|
-
const [comp, setComp] =
|
|
2474
|
+
const [comp, setComp] = createSignal();
|
|
1930
2475
|
let started = !options.lazy;
|
|
1931
2476
|
started && loadClientOnly(fn, setComp, options.export);
|
|
1932
2477
|
return props => {
|
|
1933
2478
|
let Comp;
|
|
1934
2479
|
let m;
|
|
1935
|
-
const rest =
|
|
2480
|
+
const rest = omit(props, "fallback");
|
|
1936
2481
|
if (!started) {
|
|
1937
2482
|
started = true;
|
|
1938
2483
|
loadClientOnly(fn, setComp, options.export);
|
|
1939
2484
|
}
|
|
1940
|
-
if ((Comp =
|
|
1941
|
-
const [mounted, setMounted] =
|
|
1942
|
-
const gate =
|
|
1943
|
-
const onHydrationEnd =
|
|
2485
|
+
if ((Comp = untrack(comp)) && !sharedConfig.hydrating) return Comp(rest);
|
|
2486
|
+
const [mounted, setMounted] = createSignal(!sharedConfig.hydrating);
|
|
2487
|
+
const gate = createMemo(() => (Comp = comp(), m = mounted(), untrack(() => Comp && m ? Comp(rest) : props.fallback)));
|
|
2488
|
+
const onHydrationEnd = sharedConfig.onHydrationEnd;
|
|
1944
2489
|
const release = () => setMounted(true);
|
|
1945
2490
|
onHydrationEnd ? onHydrationEnd(release) : queueMicrotask(release);
|
|
1946
2491
|
return gate;
|
|
@@ -1949,154 +2494,4 @@ _moduleUrl) {
|
|
|
1949
2494
|
function httpStatus(_code, _text) {}
|
|
1950
2495
|
function httpHeader(_name, _value, _options) {}
|
|
1951
2496
|
|
|
1952
|
-
|
|
1953
|
-
enumerable: true,
|
|
1954
|
-
get: function () { return solidJs.Errored; }
|
|
1955
|
-
});
|
|
1956
|
-
Object.defineProperty(exports, "For", {
|
|
1957
|
-
enumerable: true,
|
|
1958
|
-
get: function () { return solidJs.For; }
|
|
1959
|
-
});
|
|
1960
|
-
Object.defineProperty(exports, "Hydration", {
|
|
1961
|
-
enumerable: true,
|
|
1962
|
-
get: function () { return solidJs.Hydration; }
|
|
1963
|
-
});
|
|
1964
|
-
Object.defineProperty(exports, "Loading", {
|
|
1965
|
-
enumerable: true,
|
|
1966
|
-
get: function () { return solidJs.Loading; }
|
|
1967
|
-
});
|
|
1968
|
-
Object.defineProperty(exports, "Match", {
|
|
1969
|
-
enumerable: true,
|
|
1970
|
-
get: function () { return solidJs.Match; }
|
|
1971
|
-
});
|
|
1972
|
-
Object.defineProperty(exports, "NoHydration", {
|
|
1973
|
-
enumerable: true,
|
|
1974
|
-
get: function () { return solidJs.NoHydration; }
|
|
1975
|
-
});
|
|
1976
|
-
Object.defineProperty(exports, "Repeat", {
|
|
1977
|
-
enumerable: true,
|
|
1978
|
-
get: function () { return solidJs.Repeat; }
|
|
1979
|
-
});
|
|
1980
|
-
Object.defineProperty(exports, "Reveal", {
|
|
1981
|
-
enumerable: true,
|
|
1982
|
-
get: function () { return solidJs.Reveal; }
|
|
1983
|
-
});
|
|
1984
|
-
Object.defineProperty(exports, "Show", {
|
|
1985
|
-
enumerable: true,
|
|
1986
|
-
get: function () { return solidJs.Show; }
|
|
1987
|
-
});
|
|
1988
|
-
Object.defineProperty(exports, "Switch", {
|
|
1989
|
-
enumerable: true,
|
|
1990
|
-
get: function () { return solidJs.Switch; }
|
|
1991
|
-
});
|
|
1992
|
-
Object.defineProperty(exports, "createComponent", {
|
|
1993
|
-
enumerable: true,
|
|
1994
|
-
get: function () { return solidJs.createComponent; }
|
|
1995
|
-
});
|
|
1996
|
-
Object.defineProperty(exports, "getOwner", {
|
|
1997
|
-
enumerable: true,
|
|
1998
|
-
get: function () { return solidJs.getOwner; }
|
|
1999
|
-
});
|
|
2000
|
-
Object.defineProperty(exports, "untrack", {
|
|
2001
|
-
enumerable: true,
|
|
2002
|
-
get: function () { return solidJs.untrack; }
|
|
2003
|
-
});
|
|
2004
|
-
exports.ChildProperties = ChildProperties;
|
|
2005
|
-
exports.DOMElements = DOMElements;
|
|
2006
|
-
exports.DOMWithState = DOMWithState;
|
|
2007
|
-
exports.DelegatedEvents = DelegatedEvents;
|
|
2008
|
-
exports.Dynamic = Dynamic;
|
|
2009
|
-
exports.HREF = HREF;
|
|
2010
|
-
exports.HydrationScript = voidFn;
|
|
2011
|
-
exports.MathMLElements = MathMLElements;
|
|
2012
|
-
exports.Namespaces = Namespaces;
|
|
2013
|
-
exports.Portal = Portal;
|
|
2014
|
-
exports.REVALIDATE_HEADER = REVALIDATE_HEADER;
|
|
2015
|
-
exports.RawTextElements = RawTextElements;
|
|
2016
|
-
exports.RequestContext = RequestContext;
|
|
2017
|
-
exports.ResponseEnvelope = ResponseEnvelope;
|
|
2018
|
-
exports.SAFE_ERROR = SAFE_ERROR;
|
|
2019
|
-
exports.SVGElements = SVGElements;
|
|
2020
|
-
exports.VoidElements = VoidElements;
|
|
2021
|
-
exports.acquireAsset = acquireAsset;
|
|
2022
|
-
exports.addEvent = addEvent;
|
|
2023
|
-
exports.applyRef = applyRef;
|
|
2024
|
-
exports.assign = assign;
|
|
2025
|
-
exports.claimElement = claimElement;
|
|
2026
|
-
exports.claimElementTree = claimElementTree;
|
|
2027
|
-
exports.className = className;
|
|
2028
|
-
exports.clearFlashCookie = clearFlashCookie;
|
|
2029
|
-
exports.clientOnly = clientOnly;
|
|
2030
|
-
exports.commitEventResponse = commitEventResponse;
|
|
2031
|
-
exports.composeMiddleware = composeMiddleware;
|
|
2032
|
-
exports.createRequestEvent = createRequestEvent;
|
|
2033
|
-
exports.createResponseStub = createResponseStub;
|
|
2034
|
-
exports.createSSRResponse = createSSRResponse;
|
|
2035
|
-
exports.delegateEvents = delegateEvents;
|
|
2036
|
-
exports.dynamic = dynamic;
|
|
2037
|
-
exports.dynamicProperty = dynamicProperty;
|
|
2038
|
-
exports.effect = effect;
|
|
2039
|
-
exports.escape = escape;
|
|
2040
|
-
exports.generateHydrationScript = voidFn;
|
|
2041
|
-
exports.getDelegatedRoot = getDelegatedRoot;
|
|
2042
|
-
exports.getExpectedRedirectStatus = getExpectedRedirectStatus;
|
|
2043
|
-
exports.getFirstChild = getFirstChild;
|
|
2044
|
-
exports.getHydrationKey = getHydrationKey;
|
|
2045
|
-
exports.getNextElement = getNextElement;
|
|
2046
|
-
exports.getNextMarker = getNextMarker;
|
|
2047
|
-
exports.getNextMatch = getNextMatch;
|
|
2048
|
-
exports.getNextSibling = getNextSibling;
|
|
2049
|
-
exports.getRequestEvent = voidFn;
|
|
2050
|
-
exports.getServerFunctionMetadata = getServerFunctionMetadata;
|
|
2051
|
-
exports.getServerFunctionRPC = getServerFunctionRPC;
|
|
2052
|
-
exports.hasFlashCookie = hasFlashCookie;
|
|
2053
|
-
exports.httpHeader = httpHeader;
|
|
2054
|
-
exports.httpStatus = httpStatus;
|
|
2055
|
-
exports.hydrate = hydrate;
|
|
2056
|
-
exports.insert = insert;
|
|
2057
|
-
exports.installHydrationRuntime = installHydrationRuntime;
|
|
2058
|
-
exports.isDev = isDev;
|
|
2059
|
-
exports.isHref = isHref;
|
|
2060
|
-
exports.isResponseEnvelope = isResponseEnvelope;
|
|
2061
|
-
exports.isSafeError = isSafeError;
|
|
2062
|
-
exports.isServer = isServer;
|
|
2063
|
-
exports.isServerFunction = isServerFunction;
|
|
2064
|
-
exports.markSafeError = markSafeError;
|
|
2065
|
-
exports.memo = memo;
|
|
2066
|
-
exports.mergeProps = mergeProps;
|
|
2067
|
-
exports.parseCookieHeader = parseCookieHeader;
|
|
2068
|
-
exports.patchDriver = patchDriver;
|
|
2069
|
-
exports.redirect = redirect;
|
|
2070
|
-
exports.ref = ref;
|
|
2071
|
-
exports.registerDelegatedContainer = registerDelegatedContainer;
|
|
2072
|
-
exports.registerDelegatedRoot = registerDelegatedRoot;
|
|
2073
|
-
exports.registerElementClaim = registerElementClaim;
|
|
2074
|
-
exports.reload = reload;
|
|
2075
|
-
exports.render = render;
|
|
2076
|
-
exports.renderToStream = renderToStream;
|
|
2077
|
-
exports.renderToString = renderToString;
|
|
2078
|
-
exports.resolveSSRNode = resolveSSRNode;
|
|
2079
|
-
exports.respond = respond;
|
|
2080
|
-
exports.rowProof = rowProof;
|
|
2081
|
-
exports.runHydrationEvents = runHydrationEvents;
|
|
2082
|
-
exports.scope = scope;
|
|
2083
|
-
exports.serializeCookie = serializeCookie;
|
|
2084
|
-
exports.setAttribute = setAttribute;
|
|
2085
|
-
exports.setAttributeNS = setAttributeNS;
|
|
2086
|
-
exports.setProperty = setProperty;
|
|
2087
|
-
exports.setStyleProperty = setStyleProperty;
|
|
2088
|
-
exports.spread = spread;
|
|
2089
|
-
exports.ssr = ssr;
|
|
2090
|
-
exports.ssrAttribute = ssrAttribute;
|
|
2091
|
-
exports.ssrClassName = ssrClassName;
|
|
2092
|
-
exports.ssrElement = ssrElement;
|
|
2093
|
-
exports.ssrGroup = ssrGroup;
|
|
2094
|
-
exports.ssrHydrationKey = ssrHydrationKey;
|
|
2095
|
-
exports.ssrStyle = ssrStyle;
|
|
2096
|
-
exports.ssrStyleProperty = ssrStyleProperty;
|
|
2097
|
-
exports.style = style;
|
|
2098
|
-
exports.template = template;
|
|
2099
|
-
exports.unregisterDelegatedContainer = unregisterDelegatedContainer;
|
|
2100
|
-
exports.unregisterDelegatedRoot = unregisterDelegatedRoot;
|
|
2101
|
-
exports.useHead = useHead;
|
|
2102
|
-
exports.warmAsset = warmAsset;
|
|
2497
|
+
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 };
|