@solidjs/web 2.0.0-rc.2 → 2.0.0-rc.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/server.dev.js +5165 -0
- package/dist/server.js +1876 -374
- package/dist/{server.cjs → server.observe.js} +2070 -577
- package/dist/{dev.cjs → web.dev.js} +955 -567
- package/dist/web.js +646 -350
- package/dist/{dev.js → web.observe.js} +699 -421
- package/frames/dist/assets.js +92 -0
- package/frames/dist/client.dev.js +1296 -1198
- package/frames/dist/client.js +1128 -1191
- package/frames/dist/client.observe.js +2041 -0
- package/frames/dist/regions.js +171 -0
- package/frames/dist/server.dev.js +2545 -0
- package/frames/dist/server.js +1683 -3004
- package/frames/dist/server.observe.js +2544 -0
- package/frames/dist/trace.js +45 -0
- package/frames/dist/wire.js +594 -0
- package/frames/package.json +2 -25
- package/package.json +244 -256
- package/performance-tracks/dist/performance-tracks.dev.js +679 -0
- package/performance-tracks/dist/performance-tracks.js +6 -0
- package/performance-tracks/dist/performance-tracks.observe.js +667 -0
- package/performance-tracks/package.json +7 -0
- package/performance-tracks/types/index.d.ts +69 -0
- package/serialization/decode/package.json +2 -15
- package/serialization/dist/decode.js +121 -25
- package/serialization/dist/serialization.js +282 -88
- package/serialization/package.json +2 -15
- package/serialization/types/index.d.ts +115 -153
- package/serialization/types/serializer-decode.d.ts +173 -114
- package/serialization/types/serializer.d.ts +144 -0
- package/server-functions/dist/client.dev.js +1462 -0
- package/server-functions/dist/client.js +667 -165
- package/server-functions/dist/client.observe.js +1441 -0
- package/server-functions/dist/rich-args.js +102 -1
- package/server-functions/dist/server.dev.js +2802 -299
- package/server-functions/dist/server.js +2724 -314
- package/server-functions/dist/server.observe.js +3680 -0
- package/server-functions/package.json +2 -35
- package/server-functions/rich-args/package.json +2 -15
- package/skills/server-components/SKILL.md +117 -0
- package/storage/package.json +2 -15
- package/types/client.d.ts +342 -288
- package/types/constants.d.ts +22 -0
- package/types/cookies.d.ts +32 -84
- package/types/diagnostics.d.ts +80 -0
- package/types/frames/assets-tier.d.ts +78 -0
- package/types/frames/client.d.ts +40 -1
- package/types/frames/frame-client.d.ts +443 -280
- package/types/frames/frame-container-plugin.d.ts +64 -0
- package/types/frames/frame-morph.d.ts +29 -0
- package/types/frames/frame-sink.d.ts +141 -161
- package/types/frames/frame-transport.d.ts +263 -184
- package/types/frames/regions-tier.d.ts +60 -0
- package/types/frames/serializer-decode.d.ts +241 -0
- package/types/frames/serializer.d.ts +115 -153
- package/types/frames/server.d.ts +2 -2
- package/types/frames/trace-tier.d.ts +2 -0
- package/types/frames/tree-rewrite.d.ts +39 -0
- package/types/frames/wire-tier.d.ts +169 -0
- package/types/head.d.ts +20 -0
- package/types/index.d.ts +98 -81
- package/types/index.server.d.ts +159 -0
- package/types/jsx.d.ts +49 -44
- package/types/observe.d.ts +535 -0
- package/types/reconcile.d.ts +1 -0
- package/types/render.d.ts +11 -0
- package/types/request-error-hook.d.ts +5 -0
- package/types/response.d.ts +95 -147
- package/types/serializer-decode.d.ts +173 -114
- package/types/serializer.d.ts +115 -153
- package/types/server-functions/argument-codec.d.ts +30 -0
- package/types/server-functions/client.d.ts +237 -223
- package/types/server-functions/flash.d.ts +28 -30
- package/types/server-functions/registry.d.ts +105 -0
- package/types/server-functions/rich-args.d.ts +1 -10
- package/types/server-functions/server.d.ts +538 -531
- package/types/server-functions/shared.d.ts +398 -425
- package/types/server-functions/uploads.d.ts +53 -0
- package/types/server-mock.d.ts +154 -20
- package/types/server-observe.d.ts +86 -0
- package/types/server.d.ts +601 -422
- package/types/trace.d.ts +127 -0
- package/LICENSE +0 -21
- package/dist/web.cjs +0 -2033
- package/frames/dist/client.cjs +0 -2002
- package/frames/dist/client.dev.cjs +0 -2022
- package/frames/dist/server.cjs +0 -3877
- package/serialization/dist/decode.cjs +0 -139
- package/serialization/dist/serialization.cjs +0 -261
- package/serialization/types-cjs/index.d.cts +0 -182
- package/serialization/types-cjs/package.json +0 -3
- package/serialization/types-cjs/serializer-decode.d.cts +0 -182
- package/server-functions/dist/client.cjs +0 -834
- package/server-functions/dist/rich-args.cjs +0 -11
- package/server-functions/dist/server.cjs +0 -1242
- package/server-functions/dist/server.dev.cjs +0 -1242
- package/storage/dist/storage.cjs +0 -12
- package/storage/types-cjs/index.d.cts +0 -28
- package/storage/types-cjs/package.json +0 -3
- package/types/core.d.ts +0 -9
- package/types-cjs/client.d.cts +0 -337
- package/types-cjs/cookies.d.cts +0 -93
- package/types-cjs/core.d.cts +0 -9
- package/types-cjs/frames/client.d.cts +0 -36
- package/types-cjs/frames/frame-client.d.cts +0 -356
- package/types-cjs/frames/frame-sink.d.cts +0 -194
- package/types-cjs/frames/frame-transport.d.cts +0 -222
- package/types-cjs/frames/serializer.d.cts +0 -182
- package/types-cjs/frames/server.d.cts +0 -52
- package/types-cjs/index.d.cts +0 -244
- package/types-cjs/jsx-properties.d.cts +0 -93
- package/types-cjs/jsx.d.cts +0 -4159
- package/types-cjs/package.json +0 -3
- package/types-cjs/response.d.cts +0 -174
- package/types-cjs/serializer-decode.d.cts +0 -182
- package/types-cjs/serializer.d.cts +0 -182
- package/types-cjs/server-functions/client.d.cts +0 -262
- package/types-cjs/server-functions/flash.d.cts +0 -38
- package/types-cjs/server-functions/rich-args.d.cts +0 -10
- package/types-cjs/server-functions/server.d.cts +0 -681
- package/types-cjs/server-functions/shared.d.cts +0 -523
- package/types-cjs/server-mock.d.cts +0 -286
- package/types-cjs/server.d.cts +0 -544
|
@@ -1,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,97 @@ 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;
|
|
346
|
-
if (
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
}
|
|
542
|
+
if (options.onError) getOwner()[ROOT_ERROR_HOOK] = options.onError;
|
|
543
|
+
const tree = code();
|
|
544
|
+
if (element === document) effect(() => flatten(tree), () => {});else insert(element, () => tree, element.firstChild ? null : undefined, init, {
|
|
545
|
+
...options.insertOptions,
|
|
546
|
+
schedule: true
|
|
547
|
+
});
|
|
353
548
|
}, {
|
|
354
549
|
id: options.renderId
|
|
355
550
|
});
|
|
551
|
+
flush();
|
|
356
552
|
} catch (err) {
|
|
357
553
|
if (disposer) disposer();
|
|
358
554
|
unregisterDelegatedRoot(element);
|
|
359
555
|
throw err;
|
|
556
|
+
} finally {
|
|
557
|
+
enforceLoadingBoundary(false);
|
|
360
558
|
}
|
|
361
559
|
return () => {
|
|
362
560
|
disposer();
|
|
@@ -366,9 +564,11 @@ function render$1(code, element, init, options = {}) {
|
|
|
366
564
|
}
|
|
367
565
|
function create(html, bypassGuard, flag) {
|
|
368
566
|
if (isHydrating() && !bypassGuard) throw new Error("Failed attempt to create new DOM elements during hydration. Check that the libraries you are using support hydration.");
|
|
567
|
+
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
568
|
const t = document.createElement("template");
|
|
370
569
|
t.innerHTML = html;
|
|
371
|
-
|
|
570
|
+
const node = t.content.firstChild;
|
|
571
|
+
return flag === 2 ? node.firstChild : node;
|
|
372
572
|
}
|
|
373
573
|
function template(html, flag) {
|
|
374
574
|
let node;
|
|
@@ -377,8 +577,7 @@ function template(html, flag) {
|
|
|
377
577
|
return fn;
|
|
378
578
|
}
|
|
379
579
|
function delegateEvents(eventNames) {
|
|
380
|
-
for (
|
|
381
|
-
const name = eventNames[i];
|
|
580
|
+
for (const name of eventNames) {
|
|
382
581
|
if (!delegatedEvents.has(name)) {
|
|
383
582
|
delegatedEvents.add(name);
|
|
384
583
|
delegatedContainers.forEach((state, container) => attachDelegatedEvent(name, container, state));
|
|
@@ -416,16 +615,40 @@ function unregisterDelegatedContainer(container, owner = container) {
|
|
|
416
615
|
}
|
|
417
616
|
function attachDelegatedEvent(name, container, state) {
|
|
418
617
|
if (state.handlers.has(name)) return;
|
|
419
|
-
const handler = e => eventHandler(e, container, state);
|
|
618
|
+
const handler = e => dispatchAsInteraction(e, () => eventHandler(e, container, state)) ;
|
|
420
619
|
state.handlers.set(name, handler);
|
|
421
620
|
container.addEventListener(name, handler);
|
|
422
621
|
}
|
|
622
|
+
function describeEventTarget(target) {
|
|
623
|
+
if (!target || typeof target.tagName !== "string") return undefined;
|
|
624
|
+
const tag = target.tagName.toLowerCase();
|
|
625
|
+
let out = tag;
|
|
626
|
+
if (target.id) out += `#${target.id}`;else if (typeof target.name === "string" && target.name) out += `[name=${target.name}]`;
|
|
627
|
+
if (tag !== "input" && tag !== "textarea" && tag !== "select") {
|
|
628
|
+
const text = (target.textContent || "").trim().replace(/\s+/g, " ");
|
|
629
|
+
if (text) out += ` "${text.length > 30 ? text.slice(0, 29) + "…" : text}"`;
|
|
630
|
+
}
|
|
631
|
+
return out;
|
|
632
|
+
}
|
|
633
|
+
function interactionStart(e) {
|
|
634
|
+
const at = e.timeStamp;
|
|
635
|
+
return typeof at === "number" && at >= 0 && at <= performance.now() ? at : undefined;
|
|
636
|
+
}
|
|
637
|
+
function dispatchAsInteraction(e, fn) {
|
|
638
|
+
return OBSERVE.attribution.withInteraction({
|
|
639
|
+
type: e.type,
|
|
640
|
+
target: describeEventTarget(e.target),
|
|
641
|
+
at: interactionStart(e),
|
|
642
|
+
event: e
|
|
643
|
+
}, fn) ;
|
|
644
|
+
}
|
|
423
645
|
function getDelegatedRoot(node) {
|
|
424
646
|
while (node) {
|
|
425
647
|
if (delegatedContainers.get(node)?.roots) return node;
|
|
426
|
-
node = node
|
|
648
|
+
node = parentOf(node);
|
|
427
649
|
}
|
|
428
650
|
}
|
|
651
|
+
const parentOf = node => node._$host || node.parentNode || node.host;
|
|
429
652
|
function findOwner(target, state) {
|
|
430
653
|
let node = target;
|
|
431
654
|
let distance = 0;
|
|
@@ -435,22 +658,45 @@ function findOwner(target, state) {
|
|
|
435
658
|
distance
|
|
436
659
|
};
|
|
437
660
|
distance++;
|
|
438
|
-
node = node
|
|
661
|
+
node = parentOf(node);
|
|
439
662
|
}
|
|
440
663
|
}
|
|
441
664
|
function setProperty(node, name, value) {
|
|
665
|
+
tagElement(node);
|
|
442
666
|
if (isHydrating(node)) return;
|
|
667
|
+
const nodeName = node.nodeName;
|
|
668
|
+
checkStatefulWrite(node, name, value);
|
|
669
|
+
if (name === "value" && nodeName === "SELECT") writeSelectValue(node, value);else if ((name === "value" || name === "defaultValue") && (nodeName === "INPUT" || nodeName === "TEXTAREA")) {
|
|
670
|
+
if (value == null && /^(checkbox|radio)$/.test(node.type)) node.removeAttribute("value");else node[name] = value ?? "";
|
|
671
|
+
} else node[name] = value;
|
|
672
|
+
recordStatefulWrite(node, name, value);
|
|
673
|
+
reclaimAttribute(node, name);
|
|
674
|
+
}
|
|
675
|
+
function setStatefulProperty(node, name, value) {
|
|
676
|
+
checkStatefulWrite(node, name, value);
|
|
443
677
|
node[name] = value;
|
|
678
|
+
recordStatefulWrite(node, name, value);
|
|
444
679
|
}
|
|
445
680
|
let claimHandlers = null;
|
|
446
|
-
const
|
|
447
|
-
|
|
681
|
+
const claimAttributeSets = [];
|
|
682
|
+
const CLAIM_SEAM = Symbol.for("solid.element-claims");
|
|
683
|
+
function registerElementClaim(handler, options) {
|
|
448
684
|
(claimHandlers || (claimHandlers = globalThis[CLAIM_SEAM] = [])).push(handler);
|
|
685
|
+
claimAttributeSets.push(options?.attributes || ["href", "action"]);
|
|
449
686
|
return () => {
|
|
450
687
|
const index = claimHandlers.indexOf(handler);
|
|
451
|
-
index > -1
|
|
688
|
+
if (index > -1) {
|
|
689
|
+
claimHandlers.splice(index, 1);
|
|
690
|
+
claimAttributeSets.splice(index, 1);
|
|
691
|
+
}
|
|
452
692
|
};
|
|
453
693
|
}
|
|
694
|
+
function runClaimHandlers(handlers, node) {
|
|
695
|
+
for (let i = 0; i < handlers.length; i++) handlers[i](node);
|
|
696
|
+
}
|
|
697
|
+
function reclaimAttribute(node, name) {
|
|
698
|
+
if (claimHandlers !== null && node._$claimed && claimAttributeSets.some(set => set.includes(name.slice(name.indexOf(":") + 1)))) runClaimHandlers(claimHandlers, node);
|
|
699
|
+
}
|
|
454
700
|
const CLAIMED_ELEMENTS = "a[href], form[action]";
|
|
455
701
|
function claimElementTree(root) {
|
|
456
702
|
const handlers = globalThis[CLAIM_SEAM];
|
|
@@ -458,46 +704,76 @@ function claimElementTree(root) {
|
|
|
458
704
|
const isElement = root.nodeType === 1;
|
|
459
705
|
if (!isElement && root.nodeType !== 11) return root;
|
|
460
706
|
if (isElement && root.matches(CLAIMED_ELEMENTS)) {
|
|
461
|
-
|
|
707
|
+
root._$claimed = true;
|
|
708
|
+
runClaimHandlers(handlers, root);
|
|
462
709
|
}
|
|
463
710
|
const found = root.querySelectorAll(CLAIMED_ELEMENTS);
|
|
464
711
|
for (let i = 0; i < found.length; i++) {
|
|
465
|
-
|
|
712
|
+
found[i]._$claimed = true;
|
|
713
|
+
runClaimHandlers(handlers, found[i]);
|
|
466
714
|
}
|
|
467
715
|
return root;
|
|
468
716
|
}
|
|
469
|
-
function claimElement(node) {
|
|
470
|
-
if (claimHandlers !== null) {
|
|
471
|
-
|
|
717
|
+
function claimElement(node, owner) {
|
|
718
|
+
if (claimHandlers !== null && !node._$claimed) {
|
|
719
|
+
node._$claimed = true;
|
|
720
|
+
if (owner === undefined) runClaimHandlers(claimHandlers, node);else runWithOwner(owner, () => runClaimHandlers(claimHandlers, node));
|
|
472
721
|
}
|
|
473
722
|
return node;
|
|
474
723
|
}
|
|
475
724
|
function setAttribute(node, name, value) {
|
|
725
|
+
{
|
|
726
|
+
tagElement(node);
|
|
727
|
+
if (typeof value === "function" && name.startsWith("on")) lowercaseEventAttribute(name, node);
|
|
728
|
+
}
|
|
476
729
|
if (isHydrating(node)) return;
|
|
477
|
-
|
|
478
|
-
if (
|
|
730
|
+
const selectMultiple = name === "multiple" && node.localName === "select";
|
|
731
|
+
if (value == null || value === false) node.removeAttribute(name);else {
|
|
732
|
+
node.setAttribute(name, value === true ? "" : value);
|
|
733
|
+
if (selectMultiple && !node._$multiple) {
|
|
734
|
+
const options = node.options;
|
|
735
|
+
for (let i = 0; i < options.length; i++) {
|
|
736
|
+
if (options[i].defaultSelected) options[i].selected = true;
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
if (selectMultiple) node._$multiple = true;
|
|
741
|
+
reclaimAttribute(node, name);
|
|
479
742
|
}
|
|
480
743
|
function setAttributeNS(node, namespace, name, value) {
|
|
744
|
+
tagElement(node);
|
|
481
745
|
if (isHydrating(node)) return;
|
|
482
746
|
if (value == null || value === false) node.removeAttributeNS(namespace, name.indexOf(":") > -1 ? name.split(":").pop() : name);else node.setAttributeNS(namespace, name, value === true ? "" : value);
|
|
747
|
+
reclaimAttribute(node, name);
|
|
483
748
|
}
|
|
484
749
|
function className(node, value, prev) {
|
|
485
|
-
|
|
750
|
+
tagElement(node);
|
|
751
|
+
if (typeof value === "number") value = "" + value;
|
|
752
|
+
if (typeof prev === "number") prev = "" + prev;
|
|
753
|
+
if (isHydrating(node)) {
|
|
754
|
+
node._$classes = value && typeof value === "object" ? classListToObject(value) : undefined;
|
|
755
|
+
return;
|
|
756
|
+
}
|
|
486
757
|
if (value == null || value === false) {
|
|
487
|
-
prev
|
|
758
|
+
if (prev || node._$classes) {
|
|
759
|
+
node.removeAttribute("class");
|
|
760
|
+
node._$classes = undefined;
|
|
761
|
+
}
|
|
488
762
|
return;
|
|
489
763
|
}
|
|
490
764
|
if (typeof value === "string") {
|
|
765
|
+
node._$classes = undefined;
|
|
491
766
|
value !== prev && node.setAttribute("class", value);
|
|
492
767
|
return;
|
|
493
768
|
}
|
|
769
|
+
let applied;
|
|
494
770
|
if (typeof prev === "string") {
|
|
495
|
-
|
|
771
|
+
applied = {};
|
|
496
772
|
node.removeAttribute("class");
|
|
497
|
-
} else
|
|
773
|
+
} else applied = node._$classes || classListToObject(prev || {});
|
|
498
774
|
value = classListToObject(value);
|
|
499
|
-
const classKeys = Object.keys(value
|
|
500
|
-
const prevKeys = Object.keys(
|
|
775
|
+
const classKeys = Object.keys(value);
|
|
776
|
+
const prevKeys = Object.keys(applied);
|
|
501
777
|
let i, len;
|
|
502
778
|
for (i = 0, len = prevKeys.length; i < len; i++) {
|
|
503
779
|
const key = prevKeys[i];
|
|
@@ -507,22 +783,40 @@ function className(node, value, prev) {
|
|
|
507
783
|
for (i = 0, len = classKeys.length; i < len; i++) {
|
|
508
784
|
const key = classKeys[i],
|
|
509
785
|
classValue = !!value[key];
|
|
510
|
-
if (!key || key === "undefined" ||
|
|
786
|
+
if (!key || key === "undefined" || applied[key] === classValue || !classValue) continue;
|
|
511
787
|
node.classList.add(key);
|
|
512
788
|
}
|
|
789
|
+
node._$classes = value;
|
|
513
790
|
}
|
|
514
791
|
function addEvent(node, name, handler, delegate) {
|
|
515
792
|
if (delegate) {
|
|
793
|
+
const key = EVENT_KEY + name;
|
|
794
|
+
let data;
|
|
516
795
|
if (Array.isArray(handler)) {
|
|
517
|
-
|
|
518
|
-
node[
|
|
519
|
-
} else node[
|
|
520
|
-
|
|
796
|
+
data = handler[1];
|
|
797
|
+
node[key] = handler[0];
|
|
798
|
+
} else node[key] = handler;
|
|
799
|
+
node[`${key}Data`] = data;
|
|
800
|
+
return;
|
|
801
|
+
}
|
|
802
|
+
if (Array.isArray(handler)) {
|
|
521
803
|
const handlerFn = handler[0];
|
|
522
|
-
|
|
523
|
-
|
|
804
|
+
const listener = e => dispatchAsInteraction(e, () => handlerFn.call(node, handler[1], e)) ;
|
|
805
|
+
listener[$$EVENT_TUPLE] = handler;
|
|
806
|
+
node.addEventListener(name, listener);
|
|
807
|
+
return listener;
|
|
808
|
+
}
|
|
809
|
+
if (typeof handler === "function") {
|
|
810
|
+
const listener = e => dispatchAsInteraction(e, () => handler.call(node, e));
|
|
811
|
+
node.addEventListener(name, listener);
|
|
812
|
+
return listener;
|
|
813
|
+
}
|
|
814
|
+
node.addEventListener(name, handler, typeof handler !== "function" && handler);
|
|
815
|
+
return handler;
|
|
524
816
|
}
|
|
525
817
|
function style(node, value, prev) {
|
|
818
|
+
tagElement(node);
|
|
819
|
+
if (isHydrating(node)) return;
|
|
526
820
|
if (!value) {
|
|
527
821
|
if (prev || node._$styles) {
|
|
528
822
|
setAttribute(node, "style");
|
|
@@ -547,12 +841,13 @@ function style(node, value, prev) {
|
|
|
547
841
|
}
|
|
548
842
|
let v, s;
|
|
549
843
|
for (s in applied) {
|
|
550
|
-
if (value[s] == null) {
|
|
844
|
+
if (!hasOwn.call(value, s) || value[s] == null) {
|
|
551
845
|
nodeStyle.removeProperty(s);
|
|
552
846
|
delete applied[s];
|
|
553
847
|
}
|
|
554
848
|
}
|
|
555
849
|
for (s in value) {
|
|
850
|
+
if (!hasOwn.call(value, s)) continue;
|
|
556
851
|
v = value[s];
|
|
557
852
|
if (v != null && v !== applied[s]) {
|
|
558
853
|
nodeStyle.setProperty(s, v);
|
|
@@ -560,26 +855,139 @@ function style(node, value, prev) {
|
|
|
560
855
|
}
|
|
561
856
|
}
|
|
562
857
|
}
|
|
858
|
+
function readShallow(value) {
|
|
859
|
+
if (value === null || typeof value !== "object") return value;
|
|
860
|
+
if (Array.isArray(value)) return value.map(readShallow);
|
|
861
|
+
if (value[$PROXY] !== value) return value;
|
|
862
|
+
const keys = Reflect.ownKeys(value);
|
|
863
|
+
const out = {};
|
|
864
|
+
for (let i = 0; i < keys.length; i++) {
|
|
865
|
+
const k = keys[i];
|
|
866
|
+
if (typeof k === "string") out[k] = value[k];
|
|
867
|
+
}
|
|
868
|
+
return out;
|
|
869
|
+
}
|
|
563
870
|
function setStyleProperty(node, name, value) {
|
|
871
|
+
tagElement(node);
|
|
872
|
+
if (isHydrating(node)) return;
|
|
564
873
|
value != null ? node.style.setProperty(name, value) : node.style.removeProperty(name);
|
|
565
874
|
}
|
|
566
|
-
function spread(node, props
|
|
875
|
+
function spread(node, props, skipChildren, skip, name, loc) {
|
|
876
|
+
if (name !== undefined) {
|
|
877
|
+
const outer = spreadName;
|
|
878
|
+
const outerLoc = spreadLoc;
|
|
879
|
+
setSpreadName(name, loc);
|
|
880
|
+
try {
|
|
881
|
+
return spread(node, props, skipChildren, skip);
|
|
882
|
+
} finally {
|
|
883
|
+
setSpreadName(outer, outerLoc);
|
|
884
|
+
}
|
|
885
|
+
}
|
|
567
886
|
const prevProps = {};
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
const r =
|
|
571
|
-
(typeof r === "function" || Array.isArray(r))
|
|
572
|
-
|
|
887
|
+
const owner = claimHandlers !== null && (node.localName === "a" || node.localName === "form") ? getOwner() : undefined;
|
|
888
|
+
const apply = newProps => {
|
|
889
|
+
const r = newProps.ref;
|
|
890
|
+
if (r !== prevProps.ref && (typeof r === "function" || Array.isArray(r))) ref(() => r, node);
|
|
891
|
+
assign(node, newProps, true, prevProps, true);
|
|
892
|
+
if (owner !== undefined) claimElement(node, owner);
|
|
893
|
+
};
|
|
894
|
+
if (Array.isArray(props)) {
|
|
895
|
+
effect(() => collectSources({}, props, undefined, skip), apply);
|
|
896
|
+
unscopedByDesign = node;
|
|
897
|
+
if (!skipChildren && !(skip !== undefined && skip("children"))) insert(node, () => {
|
|
898
|
+
for (let i = props.length - 1; i >= 0; i--) {
|
|
899
|
+
const s = resolveSource(props[i]);
|
|
900
|
+
if (s != null && entryHas(s, "children")) return entryGet(s, "children");
|
|
901
|
+
}
|
|
902
|
+
});
|
|
903
|
+
unscopedByDesign = null;
|
|
904
|
+
return prevProps;
|
|
905
|
+
}
|
|
573
906
|
effect(() => {
|
|
907
|
+
const source = resolveSource(props);
|
|
574
908
|
const newProps = {};
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
909
|
+
const table = resolvedTable(source);
|
|
910
|
+
if (table !== undefined) return collectTable(newProps, table, skip);
|
|
911
|
+
if (source != null) {
|
|
912
|
+
const view = viewOf(source);
|
|
913
|
+
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
914
|
}
|
|
579
915
|
return newProps;
|
|
580
|
-
},
|
|
916
|
+
}, apply);
|
|
917
|
+
unscopedByDesign = node;
|
|
918
|
+
if (!skipChildren && !(skip !== undefined && skip("children"))) {
|
|
919
|
+
if (typeof props !== "function" && props != null && hasStaticKeys(props)) {
|
|
920
|
+
const desc = Object.getOwnPropertyDescriptor(props, "children");
|
|
921
|
+
if (desc !== undefined) {
|
|
922
|
+
if (desc.get === undefined) insert(node, desc.value);else insert(node, () => props.children);
|
|
923
|
+
}
|
|
924
|
+
} else insert(node, () => {
|
|
925
|
+
const source = resolveSource(props);
|
|
926
|
+
return source != null && entryHas(source, "children") ? entryGet(source, "children") : undefined;
|
|
927
|
+
});
|
|
928
|
+
}
|
|
929
|
+
unscopedByDesign = null;
|
|
581
930
|
return prevProps;
|
|
582
931
|
}
|
|
932
|
+
function collectTable(out, table, skip) {
|
|
933
|
+
for (const [prop, leaf] of table) {
|
|
934
|
+
if (typeof prop !== "string" || prop === "children") continue;
|
|
935
|
+
if (skip !== undefined && skip(prop)) continue;
|
|
936
|
+
const v = leaf[prop];
|
|
937
|
+
out[prop] = prop === "style" || prop === "class" ? readShallow(v) : v;
|
|
938
|
+
}
|
|
939
|
+
return out;
|
|
940
|
+
}
|
|
941
|
+
function resolveSource(s) {
|
|
942
|
+
return typeof s === "function" ? s() : s;
|
|
943
|
+
}
|
|
944
|
+
function entryHas(s, key) {
|
|
945
|
+
const view = viewOf(s);
|
|
946
|
+
return view instanceof OmitView ? sourceHas(view, SOURCE_OMIT, key) : key in s;
|
|
947
|
+
}
|
|
948
|
+
function entryGet(s, key) {
|
|
949
|
+
const view = viewOf(s);
|
|
950
|
+
return view instanceof OmitView ? sourceGet(view, SOURCE_OMIT, key) : s[key];
|
|
951
|
+
}
|
|
952
|
+
function collectSources(out, sources, kinds, skip) {
|
|
953
|
+
const resolved = [];
|
|
954
|
+
const resolvedKinds = [];
|
|
955
|
+
for (let i = 0; i < sources.length; i++) pushEntry(resolved, resolvedKinds, sources[i], kinds !== undefined ? kinds[i] : SOURCE_MEMO);
|
|
956
|
+
for (let i = 0; i < resolved.length; i++) collectProps(out, resolved[i], resolvedKinds[i], skip, resolved, resolvedKinds, i + 1);
|
|
957
|
+
return out;
|
|
958
|
+
}
|
|
959
|
+
function pushEntry(resolved, kinds, s, kind) {
|
|
960
|
+
if (kind !== SOURCE_MEMO) {
|
|
961
|
+
resolved.push(s);
|
|
962
|
+
kinds.push(kind);
|
|
963
|
+
return;
|
|
964
|
+
}
|
|
965
|
+
s = resolveSource(s);
|
|
966
|
+
if (s == null) return;
|
|
967
|
+
const view = viewOf(s);
|
|
968
|
+
if (view instanceof OmitView) {
|
|
969
|
+
resolved.push(view);
|
|
970
|
+
kinds.push(SOURCE_OMIT);
|
|
971
|
+
} else if (view !== undefined) {
|
|
972
|
+
const f = view.sources,
|
|
973
|
+
k = view.kinds;
|
|
974
|
+
for (let j = 0; j < f.length; j++) pushEntry(resolved, kinds, f[j], k[j]);
|
|
975
|
+
} else {
|
|
976
|
+
resolved.push(s);
|
|
977
|
+
kinds.push($PROXY in s ? SOURCE_PROXY : SOURCE_PLAIN);
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
function collectProps(out, s, kind, skip, later, laterKinds, from) {
|
|
981
|
+
const keys = sourceKeys(s, kind);
|
|
982
|
+
outer: for (let i = 0; i < keys.length; i++) {
|
|
983
|
+
const prop = keys[i];
|
|
984
|
+
if (typeof prop !== "string" || prop === "children") continue;
|
|
985
|
+
if (skip !== undefined && skip(prop)) continue;
|
|
986
|
+
if (later !== undefined) for (let j = from; j < later.length; j++) if (sourceHas(later[j], laterKinds[j], prop)) continue outer;
|
|
987
|
+
const v = sourceGet(s, kind, prop);
|
|
988
|
+
out[prop] = prop === "style" || prop === "class" ? readShallow(v) : v;
|
|
989
|
+
}
|
|
990
|
+
}
|
|
583
991
|
function dynamicProperty(props, key) {
|
|
584
992
|
const src = props[key];
|
|
585
993
|
Object.defineProperty(props, key, {
|
|
@@ -594,13 +1002,8 @@ function applyRef(r, element) {
|
|
|
594
1002
|
Array.isArray(r) ? r.flat(Infinity).forEach(f => f && f(element)) : r(element);
|
|
595
1003
|
}
|
|
596
1004
|
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;
|
|
1005
|
+
const resolved = untrack(fn);
|
|
1006
|
+
runWithOwner(null, () => applyRef(resolved, element));
|
|
604
1007
|
}
|
|
605
1008
|
function scope(fn) {
|
|
606
1009
|
fn.$s = true;
|
|
@@ -609,20 +1012,42 @@ function scope(fn) {
|
|
|
609
1012
|
const SCOPE_OPTIONS = {
|
|
610
1013
|
scope: true
|
|
611
1014
|
};
|
|
1015
|
+
let unscopedByDesign = null;
|
|
1016
|
+
let reportedHoleSites = null;
|
|
1017
|
+
let hydrationKeyMisses = 0;
|
|
1018
|
+
function unscopedHoleSnapshot(accessor, parent) {
|
|
1019
|
+
if (accessor.$s || !sharedConfig.hydrating || parent === unscopedByDesign || sharedConfig.devPeekNextContextId === undefined) return undefined;
|
|
1020
|
+
return {
|
|
1021
|
+
next: sharedConfig.devPeekNextContextId(),
|
|
1022
|
+
misses: hydrationKeyMisses
|
|
1023
|
+
};
|
|
1024
|
+
}
|
|
1025
|
+
function checkUnscopedHole(snapshot, accessor, parent) {
|
|
1026
|
+
if (snapshot === undefined || hydrationKeyMisses === snapshot.misses) return;
|
|
1027
|
+
const after = sharedConfig.devPeekNextContextId();
|
|
1028
|
+
if (after === snapshot.next) return;
|
|
1029
|
+
let site = parent.nodeName + "|" + accessor.name;
|
|
1030
|
+
for (let o = getOwner(); o !== null; o = o._parent) if (o._name) site = o._name + "|" + site;
|
|
1031
|
+
if ((reportedHoleSites || (reportedHoleSites = new Set())).has(site)) return;
|
|
1032
|
+
reportedHoleSites.add(site);
|
|
1033
|
+
unscopedHoleAllocatedIds(snapshot.next, after, accessor.name ? {
|
|
1034
|
+
name: accessor.name
|
|
1035
|
+
} : {});
|
|
1036
|
+
}
|
|
612
1037
|
let hydrationRt = null;
|
|
1038
|
+
let selectInsert = null;
|
|
613
1039
|
function installHydrationRuntime() {
|
|
614
1040
|
hydrationRt = {
|
|
615
1041
|
claimInitial(parent, multi, initial) {
|
|
616
1042
|
if (isHydrating(parent)) {
|
|
617
|
-
if (!multi && initial === undefined && parent) initial =
|
|
618
|
-
if (Array.isArray(initial)) stripTextSeparators(initial);
|
|
1043
|
+
if (!multi && initial === undefined && parent) initial = claimChildNodes(parent);else if (Array.isArray(initial)) stripTextSeparators(initial);
|
|
619
1044
|
}
|
|
620
1045
|
return initial;
|
|
621
1046
|
},
|
|
622
1047
|
reclaimRegion(current, parent, marker) {
|
|
623
|
-
if (!
|
|
1048
|
+
if (!sharedConfig.hydrating || current == null || !parent.isConnected) return current;
|
|
624
1049
|
const first = Array.isArray(current) ? current[0] : current;
|
|
625
|
-
if (
|
|
1050
|
+
if (first == null || first.isConnected) return current;
|
|
626
1051
|
let nodes;
|
|
627
1052
|
if (marker) {
|
|
628
1053
|
nodes = [];
|
|
@@ -639,11 +1064,11 @@ function installHydrationRuntime() {
|
|
|
639
1064
|
nodes.unshift(node);
|
|
640
1065
|
node = node.previousSibling;
|
|
641
1066
|
}
|
|
642
|
-
} else
|
|
1067
|
+
} else return claimChildNodes(parent);
|
|
643
1068
|
return stripTextSeparators(nodes);
|
|
644
1069
|
},
|
|
645
1070
|
dedupEvent(e) {
|
|
646
|
-
return !!(
|
|
1071
|
+
return !!(sharedConfig.registry && sharedConfig.events && sharedConfig.events.find(([el, ev]) => ev === e));
|
|
647
1072
|
}
|
|
648
1073
|
};
|
|
649
1074
|
}
|
|
@@ -652,25 +1077,42 @@ function stripTextSeparators(nodes) {
|
|
|
652
1077
|
for (let i = 0; i < nodes.length; i++) {
|
|
653
1078
|
const node = nodes[i],
|
|
654
1079
|
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;
|
|
1080
|
+
if (t === 8 && node.nodeValue === "!$") {
|
|
1081
|
+
node.remove();
|
|
1082
|
+
continue;
|
|
1083
|
+
}
|
|
1084
|
+
if (isPlaceholderScaffolding(node, t)) continue;
|
|
663
1085
|
nodes[j++] = node;
|
|
664
1086
|
}
|
|
665
1087
|
nodes.length = j;
|
|
666
1088
|
return nodes;
|
|
667
1089
|
}
|
|
668
|
-
function
|
|
669
|
-
|
|
670
|
-
|
|
1090
|
+
function claimChildNodes(parent) {
|
|
1091
|
+
const live = parent.childNodes;
|
|
1092
|
+
const out = [];
|
|
1093
|
+
for (let i = 0, n = live.length; i < n; i++) {
|
|
1094
|
+
const node = live[i],
|
|
1095
|
+
t = node.nodeType;
|
|
1096
|
+
if (t === 8 && node.nodeValue === "!$") {
|
|
1097
|
+
node.remove();
|
|
1098
|
+
i--;
|
|
1099
|
+
n--;
|
|
1100
|
+
continue;
|
|
1101
|
+
}
|
|
1102
|
+
if (isPlaceholderScaffolding(node, t)) continue;
|
|
1103
|
+
out.push(node);
|
|
671
1104
|
}
|
|
1105
|
+
return out;
|
|
1106
|
+
}
|
|
1107
|
+
function isPlaceholderScaffolding(node, t) {
|
|
1108
|
+
return t === 8 ? node.nodeValue.startsWith("pl-") : t === 1 && node.localName === "template" && node.id.startsWith("pl-");
|
|
672
1109
|
}
|
|
673
1110
|
function insert(parent, accessor, marker, initial, options) {
|
|
1111
|
+
if (spreadName !== undefined && (options === undefined || options.name === undefined)) options = {
|
|
1112
|
+
...options,
|
|
1113
|
+
name: spreadName + ".children",
|
|
1114
|
+
loc: spreadLoc
|
|
1115
|
+
};
|
|
674
1116
|
const multi = marker !== undefined;
|
|
675
1117
|
const host = options && options.host;
|
|
676
1118
|
if (multi && !initial) initial = [];
|
|
@@ -689,17 +1131,27 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
689
1131
|
initial = [placeholder];
|
|
690
1132
|
}
|
|
691
1133
|
let current = initial;
|
|
692
|
-
|
|
1134
|
+
let ran = false;
|
|
1135
|
+
effect(() => {
|
|
693
1136
|
if (hydrationRt !== null) current = hydrationRt.reclaimRegion(current, parent, marker);
|
|
1137
|
+
const devNext = unscopedHoleSnapshot(accessor, parent) ;
|
|
694
1138
|
const value = normalize(accessor(), current, multi, true);
|
|
1139
|
+
checkUnscopedHole(devNext, accessor, parent);
|
|
1140
|
+
const again = ran;
|
|
1141
|
+
ran = true;
|
|
695
1142
|
if (typeof value !== "function") return value;
|
|
1143
|
+
const innerOptions = again && !(options && options.schedule) ? {
|
|
1144
|
+
...options,
|
|
1145
|
+
schedule: true
|
|
1146
|
+
} : options;
|
|
696
1147
|
effect(() => (hydrationRt !== null && (current = hydrationRt.reclaimRegion(current, parent, marker)), normalize(value, current, multi)), inner => {
|
|
697
1148
|
current = insertExpression(parent, inner, current, marker);
|
|
698
1149
|
host && tagHost(current, host);
|
|
699
|
-
},
|
|
700
|
-
...
|
|
701
|
-
|
|
702
|
-
}
|
|
1150
|
+
}, {
|
|
1151
|
+
...innerOptions,
|
|
1152
|
+
_wide: true
|
|
1153
|
+
} );
|
|
1154
|
+
checkUnscopedHole(devNext, accessor, parent);
|
|
703
1155
|
return INNER_OWNED;
|
|
704
1156
|
}, value => {
|
|
705
1157
|
if (value === INNER_OWNED) return;
|
|
@@ -712,6 +1164,7 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
712
1164
|
} : SCOPE_OPTIONS : options);
|
|
713
1165
|
}
|
|
714
1166
|
function assign(node, props, skipChildren, prevProps = {}, skipRef = false) {
|
|
1167
|
+
tagElement(node);
|
|
715
1168
|
const nodeName = node.nodeName;
|
|
716
1169
|
props || (props = {});
|
|
717
1170
|
for (const prop in prevProps) {
|
|
@@ -734,10 +1187,16 @@ function assetEntryKey(descriptor) {
|
|
|
734
1187
|
if (descriptor.policy === "exclusive") return "x|" + descriptor.key;
|
|
735
1188
|
return descriptor.type === "inline-style" ? "i|" + descriptor.id : descriptor.type + "|" + descriptor.href;
|
|
736
1189
|
}
|
|
737
|
-
function findAssetElement(selector, attr, value) {
|
|
1190
|
+
function findAssetElement(selector, attr, value, qualifiers) {
|
|
738
1191
|
const nodes = document.querySelectorAll(selector);
|
|
739
|
-
for (let i = 0; i < nodes.length; i++) {
|
|
740
|
-
if (nodes[i].getAttribute(attr)
|
|
1192
|
+
outer: for (let i = 0; i < nodes.length; i++) {
|
|
1193
|
+
if (nodes[i].getAttribute(attr) !== value) continue;
|
|
1194
|
+
if (!qualifiers) return nodes[i];
|
|
1195
|
+
for (let q = 0; q < RESOURCE_QUALIFIERS.length; q++) {
|
|
1196
|
+
const name = RESOURCE_QUALIFIERS[q];
|
|
1197
|
+
if (qualifierValue(name, qualifiers[name]) !== qualifierValue(name, nodes[i].getAttribute(name))) continue outer;
|
|
1198
|
+
}
|
|
1199
|
+
return nodes[i];
|
|
741
1200
|
}
|
|
742
1201
|
return null;
|
|
743
1202
|
}
|
|
@@ -781,7 +1240,7 @@ function trackAssetLoad(entry, adopted) {
|
|
|
781
1240
|
}
|
|
782
1241
|
entry.loadState = "pending";
|
|
783
1242
|
entry.loadPromise = new Promise(resolve => {
|
|
784
|
-
const settle = state => {
|
|
1243
|
+
const settle = entry.settle = state => {
|
|
785
1244
|
entry.loadState = state;
|
|
786
1245
|
resolve();
|
|
787
1246
|
};
|
|
@@ -893,6 +1352,7 @@ function acquireAsset(descriptor) {
|
|
|
893
1352
|
entry.timer = setTimeout(() => {
|
|
894
1353
|
assetRegistry.delete(key);
|
|
895
1354
|
entry.element && entry.element.remove();
|
|
1355
|
+
if (entry.loadState === "pending") entry.settle("errored");
|
|
896
1356
|
}, ASSET_REMOVAL_GRACE);
|
|
897
1357
|
};
|
|
898
1358
|
}
|
|
@@ -954,7 +1414,7 @@ function scheduleHeadApply() {
|
|
|
954
1414
|
queueMicrotask(flushHeadRegistry);
|
|
955
1415
|
}
|
|
956
1416
|
function flushHeadRegistry() {
|
|
957
|
-
if (
|
|
1417
|
+
if (sharedConfig.hydrating) {
|
|
958
1418
|
setTimeout(flushHeadRegistry, 0);
|
|
959
1419
|
return;
|
|
960
1420
|
}
|
|
@@ -1003,7 +1463,7 @@ function flushHeadRegistry() {
|
|
|
1003
1463
|
function createHeadElement(tag, props) {
|
|
1004
1464
|
const el = document.createElement(tag);
|
|
1005
1465
|
for (const name in props) {
|
|
1006
|
-
if (name === "children" || name === "ref" || name
|
|
1466
|
+
if (name === "children" || name === "ref" || /^on[A-Z]/.test(name)) continue;
|
|
1007
1467
|
if (!HEAD_ATTR_NAME.test(name)) {
|
|
1008
1468
|
console.warn(`useHead: ignoring invalid attribute name "${name}"`);
|
|
1009
1469
|
continue;
|
|
@@ -1012,7 +1472,7 @@ function createHeadElement(tag, props) {
|
|
|
1012
1472
|
if (v == null || v === false) continue;
|
|
1013
1473
|
el.setAttribute(name, v === true ? "" : String(v));
|
|
1014
1474
|
}
|
|
1015
|
-
if (props.children != null) el.textContent = String(props.children);
|
|
1475
|
+
if (props.children != null) el.textContent = headBodyText(tag, props, String(props.children));
|
|
1016
1476
|
return el;
|
|
1017
1477
|
}
|
|
1018
1478
|
function renderHeadElement(t, identity, existing) {
|
|
@@ -1027,7 +1487,7 @@ function renderHeadElement(t, identity, existing) {
|
|
|
1027
1487
|
function headElementMatches(el, t) {
|
|
1028
1488
|
if (el.tagName.toLowerCase() !== t.tag) return false;
|
|
1029
1489
|
for (const name in t.props) {
|
|
1030
|
-
if (name === "children" || name === "ref" || name
|
|
1490
|
+
if (name === "children" || name === "ref" || /^on[A-Z]/.test(name)) continue;
|
|
1031
1491
|
if (!HEAD_ATTR_NAME.test(name)) continue;
|
|
1032
1492
|
const v = t.props[name];
|
|
1033
1493
|
if (v == null || v === false) {
|
|
@@ -1035,7 +1495,7 @@ function headElementMatches(el, t) {
|
|
|
1035
1495
|
} else if (el.getAttribute(name) !== (v === true ? "" : String(v))) return false;
|
|
1036
1496
|
}
|
|
1037
1497
|
const children = t.props.children;
|
|
1038
|
-
return (children == null ? "" : String(children)) === el.textContent;
|
|
1498
|
+
return (children == null ? "" : headBodyText(t.tag, t.props, String(children))) === el.textContent;
|
|
1039
1499
|
}
|
|
1040
1500
|
function mountHeadResource(tag, props) {
|
|
1041
1501
|
const identity = resourceIdentity(tag, props);
|
|
@@ -1043,8 +1503,8 @@ function mountHeadResource(tag, props) {
|
|
|
1043
1503
|
headMountedResources.add(identity);
|
|
1044
1504
|
const url = props.href || props.src;
|
|
1045
1505
|
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);
|
|
1506
|
+
if (tag === "link" && url == null && typeof props.imagesrcset === "string") el = findAssetElement(`link[rel="${props.rel}"]`, "href", null, props);else if (url != null) {
|
|
1507
|
+
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
1508
|
}
|
|
1049
1509
|
if (!el) document.head.appendChild(createHeadElement(tag, props));
|
|
1050
1510
|
}
|
|
@@ -1066,7 +1526,7 @@ function gateHeadResource(props) {
|
|
|
1066
1526
|
if (attrs) descriptor.attrs = attrs;
|
|
1067
1527
|
effect(() => {
|
|
1068
1528
|
const entry = warmAsset(descriptor);
|
|
1069
|
-
if (gateable && entry.loadState === "pending" && typeof waitAsset === "function") waitAsset(entry.loadPromise);
|
|
1529
|
+
if (gateable && !isHydrating() && entry.loadState === "pending" && typeof waitAsset === "function") waitAsset(entry.loadPromise);
|
|
1070
1530
|
}, () => acquireAsset(descriptor));
|
|
1071
1531
|
}
|
|
1072
1532
|
function useHead(tags) {
|
|
@@ -1149,19 +1609,44 @@ function loadModuleAssets(mapping) {
|
|
|
1149
1609
|
}
|
|
1150
1610
|
return pending.length ? Promise.all(pending).then(() => {}) : undefined;
|
|
1151
1611
|
}
|
|
1152
|
-
function hydrate
|
|
1612
|
+
function hydrate(code, element, options = {}) {
|
|
1613
|
+
enableHydration();
|
|
1153
1614
|
installHydrationRuntime();
|
|
1154
|
-
|
|
1615
|
+
const hy = globalThis._$HY;
|
|
1616
|
+
const id = options.renderId || "";
|
|
1617
|
+
if (hy.s && !hy.s[id] && !hy.s[""] && !hy.done && document.readyState === "loading") {
|
|
1618
|
+
let started, disposer;
|
|
1619
|
+
const start = () => started || (started = true, disposer = hydrate(code, element, options));
|
|
1620
|
+
(hy.sp || (hy.sp = [])).push([id, start]);
|
|
1621
|
+
hy.sw = key => hy.sp.forEach(([k, f]) => (!key || k === key) && queueMicrotask(f));
|
|
1622
|
+
document.addEventListener("DOMContentLoaded", start, {
|
|
1623
|
+
once: true
|
|
1624
|
+
});
|
|
1625
|
+
return () => {
|
|
1626
|
+
started = true;
|
|
1627
|
+
disposer && disposer();
|
|
1628
|
+
};
|
|
1629
|
+
}
|
|
1630
|
+
if (hy.done) return render(code, element, [...element.childNodes], options);
|
|
1631
|
+
const head = (element.nodeType === 9 ? element : element.ownerDocument).head;
|
|
1632
|
+
if (head && element.contains(head)) {
|
|
1633
|
+
let n = head.firstChild;
|
|
1634
|
+
while (n && n.nodeType === 1 && n.hasAttribute("data-dh") && !n.hasAttribute("data-dhf")) {
|
|
1635
|
+
const next = n.nextSibling;
|
|
1636
|
+
head.appendChild(n);
|
|
1637
|
+
n = next;
|
|
1638
|
+
}
|
|
1639
|
+
}
|
|
1155
1640
|
options.renderId ||= "";
|
|
1156
1641
|
if (!globalThis._$HY.modules) globalThis._$HY.modules = {};
|
|
1157
1642
|
if (!globalThis._$HY.loading) globalThis._$HY.loading = {};
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1643
|
+
sharedConfig.completed = globalThis._$HY.completed;
|
|
1644
|
+
sharedConfig.events = globalThis._$HY.events;
|
|
1645
|
+
sharedConfig.load = id => globalThis._$HY.r[id];
|
|
1646
|
+
sharedConfig.has = id => id in globalThis._$HY.r;
|
|
1647
|
+
sharedConfig.gather = root => gatherHydratable(element, root);
|
|
1648
|
+
sharedConfig.loadModuleAssets = loadModuleAssets;
|
|
1649
|
+
sharedConfig.cleanupFragment = id => {
|
|
1165
1650
|
const tpl = document.getElementById("pl-" + id);
|
|
1166
1651
|
if (tpl) {
|
|
1167
1652
|
let node = tpl.nextSibling;
|
|
@@ -1177,20 +1662,20 @@ function hydrate$1(code, element, options = {}) {
|
|
|
1177
1662
|
tpl.remove();
|
|
1178
1663
|
}
|
|
1179
1664
|
};
|
|
1180
|
-
|
|
1181
|
-
if (!
|
|
1182
|
-
|
|
1183
|
-
if (
|
|
1184
|
-
registry:
|
|
1185
|
-
gather:
|
|
1665
|
+
sharedConfig.registry = new Map();
|
|
1666
|
+
if (!sharedConfig.boundaryScopes) sharedConfig.boundaryScopes = new Map();
|
|
1667
|
+
sharedConfig.captureBoundaryScope = id => {
|
|
1668
|
+
if (sharedConfig.registry) sharedConfig.boundaryScopes.set(id, {
|
|
1669
|
+
registry: sharedConfig.registry,
|
|
1670
|
+
gather: sharedConfig.gather
|
|
1186
1671
|
});
|
|
1187
1672
|
};
|
|
1188
|
-
|
|
1673
|
+
sharedConfig.hydrating = true;
|
|
1189
1674
|
{
|
|
1190
|
-
|
|
1191
|
-
if (
|
|
1192
|
-
const orphaned = [...
|
|
1193
|
-
|
|
1675
|
+
sharedConfig.verifyHydration = () => {
|
|
1676
|
+
if (sharedConfig.registry && sharedConfig.registry.size) {
|
|
1677
|
+
const orphaned = [...sharedConfig.registry.values()].filter(node => node.isConnected);
|
|
1678
|
+
sharedConfig.registry.clear();
|
|
1194
1679
|
if (!orphaned.length) return;
|
|
1195
1680
|
console.warn(`Hydration completed with ${orphaned.length} unclaimed server-rendered node(s):\n` + orphaned.map(node => ` ${node.outerHTML.slice(0, 100)}`).join("\n"));
|
|
1196
1681
|
}
|
|
@@ -1202,43 +1687,48 @@ function hydrate$1(code, element, options = {}) {
|
|
|
1202
1687
|
const p = loadModuleAssets(rootMapping);
|
|
1203
1688
|
if (p) {
|
|
1204
1689
|
gatherHydratable(element, options.renderId);
|
|
1205
|
-
const registry =
|
|
1206
|
-
const gather =
|
|
1690
|
+
const registry = sharedConfig.registry;
|
|
1691
|
+
const gather = sharedConfig.gather;
|
|
1207
1692
|
let disposer;
|
|
1208
1693
|
p.then(() => {
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1694
|
+
sharedConfig.registry = registry;
|
|
1695
|
+
sharedConfig.gather = gather;
|
|
1696
|
+
sharedConfig.hydrating = true;
|
|
1212
1697
|
try {
|
|
1213
|
-
disposer = render
|
|
1698
|
+
disposer = render(code, element, [...element.childNodes], options);
|
|
1214
1699
|
} finally {
|
|
1215
|
-
|
|
1700
|
+
sharedConfig.hydrating = false;
|
|
1216
1701
|
}
|
|
1217
1702
|
}, err => {
|
|
1703
|
+
sharedConfig.hydrating = false;
|
|
1704
|
+
sharedConfig.registry = undefined;
|
|
1705
|
+
if (element.nodeType === 9) {
|
|
1706
|
+
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.");
|
|
1707
|
+
(globalThis.reportError || console.error)(err);
|
|
1708
|
+
return;
|
|
1709
|
+
}
|
|
1218
1710
|
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);
|
|
1711
|
+
disposer = render(code, element, [...element.childNodes], options);
|
|
1222
1712
|
});
|
|
1223
1713
|
return () => disposer && disposer();
|
|
1224
1714
|
}
|
|
1225
1715
|
}
|
|
1226
1716
|
try {
|
|
1227
1717
|
gatherHydratable(element, options.renderId);
|
|
1228
|
-
return render
|
|
1718
|
+
return render(code, element, [...element.childNodes], options);
|
|
1229
1719
|
} finally {
|
|
1230
|
-
|
|
1720
|
+
sharedConfig.hydrating = false;
|
|
1231
1721
|
}
|
|
1232
1722
|
}
|
|
1233
1723
|
function getNextElement(template) {
|
|
1234
|
-
let
|
|
1235
|
-
key
|
|
1236
|
-
|
|
1237
|
-
if (!hydrating || !(node = solidJs.sharedConfig.registry.get(key = getHydrationKey()))) {
|
|
1724
|
+
let key = sharedConfig.hydrating && getHydrationKey(),
|
|
1725
|
+
node = isHydrating() && sharedConfig.registry.get(key);
|
|
1726
|
+
if (!node) {
|
|
1238
1727
|
if (!template) {
|
|
1239
1728
|
throw new Error(`Hydration Mismatch. Unable to find DOM nodes for hydration key: ${key}`);
|
|
1240
1729
|
}
|
|
1241
|
-
if (
|
|
1730
|
+
if (isHydrating()) {
|
|
1731
|
+
hydrationKeyMisses++;
|
|
1242
1732
|
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
1733
|
}
|
|
1244
1734
|
return template(true);
|
|
@@ -1249,8 +1739,8 @@ function getNextElement(template) {
|
|
|
1249
1739
|
console.warn(`Hydration tag mismatch for key "${key}": expected <${expected}> but found`, node);
|
|
1250
1740
|
}
|
|
1251
1741
|
}
|
|
1252
|
-
if (
|
|
1253
|
-
|
|
1742
|
+
if (sharedConfig.completed) sharedConfig.completed.add(node);
|
|
1743
|
+
sharedConfig.registry.delete(key);
|
|
1254
1744
|
return node;
|
|
1255
1745
|
}
|
|
1256
1746
|
function getNextMatch(el, nodeName) {
|
|
@@ -1321,12 +1811,12 @@ function describeSiblings(parent, mismatchChild, expectedTag, isMissing) {
|
|
|
1321
1811
|
return `<${pTag}>${prefix}${tags}${suffix}</${pTag}>`;
|
|
1322
1812
|
}
|
|
1323
1813
|
function runHydrationEvents() {
|
|
1324
|
-
if (
|
|
1814
|
+
if (sharedConfig.events && !sharedConfig.events.queued) {
|
|
1325
1815
|
queueMicrotask(() => {
|
|
1326
1816
|
const {
|
|
1327
1817
|
completed,
|
|
1328
1818
|
events
|
|
1329
|
-
} =
|
|
1819
|
+
} = sharedConfig;
|
|
1330
1820
|
if (!events) return;
|
|
1331
1821
|
events.queued = false;
|
|
1332
1822
|
while (events.length) {
|
|
@@ -1359,25 +1849,46 @@ function runHydrationEvents() {
|
|
|
1359
1849
|
matches.sort((a, b) => a.distance - b.distance);
|
|
1360
1850
|
for (let i = 0; i < matches.length; i++) eventHandler(e, matches[i].container, matches[i].state);
|
|
1361
1851
|
} else if (matchContainer) eventHandler(e, matchContainer, matchState);
|
|
1852
|
+
flush();
|
|
1362
1853
|
}
|
|
1363
|
-
if (
|
|
1364
|
-
|
|
1365
|
-
|
|
1854
|
+
if (sharedConfig.done) {
|
|
1855
|
+
sharedConfig.events = _$HY.events = null;
|
|
1856
|
+
sharedConfig.completed = _$HY.completed = null;
|
|
1366
1857
|
}
|
|
1367
1858
|
});
|
|
1368
|
-
|
|
1859
|
+
sharedConfig.events.queued = true;
|
|
1369
1860
|
}
|
|
1370
1861
|
}
|
|
1371
1862
|
function isHydrating(node) {
|
|
1372
|
-
if (!
|
|
1863
|
+
if (!sharedConfig.hydrating) return false;
|
|
1864
|
+
if (sharedConfig.isClaiming && !sharedConfig.isClaiming()) return false;
|
|
1373
1865
|
if (!node || node.isConnected) return true;
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1866
|
+
return serverComponentClaims !== null && serverComponentClaims.claimed(node);
|
|
1867
|
+
}
|
|
1868
|
+
let serverComponentClaims = null;
|
|
1869
|
+
function installServerComponentHydration() {
|
|
1870
|
+
enableServerComponentHydration();
|
|
1871
|
+
if (serverComponentClaims !== null) return;
|
|
1872
|
+
serverComponentClaims = {
|
|
1873
|
+
claimed(node) {
|
|
1874
|
+
const roots = sharedConfig.claimRoots;
|
|
1875
|
+
if (roots) {
|
|
1876
|
+
for (let i = 0; i < roots.length; i++) {
|
|
1877
|
+
if (roots[i].contains(node)) return true;
|
|
1878
|
+
}
|
|
1879
|
+
}
|
|
1880
|
+
return false;
|
|
1881
|
+
},
|
|
1882
|
+
inFrame(element) {
|
|
1883
|
+
const frames = element.querySelectorAll("[data-fid]");
|
|
1884
|
+
const frameCount = frames.length;
|
|
1885
|
+
if (frameCount === 0) return undefined;
|
|
1886
|
+
return node => {
|
|
1887
|
+
for (let j = 0; j < frameCount; j++) if (frames[j].contains(node)) return true;
|
|
1888
|
+
return false;
|
|
1889
|
+
};
|
|
1378
1890
|
}
|
|
1379
|
-
}
|
|
1380
|
-
return false;
|
|
1891
|
+
};
|
|
1381
1892
|
}
|
|
1382
1893
|
function classListToObject(classList) {
|
|
1383
1894
|
if (Array.isArray(classList)) {
|
|
@@ -1401,7 +1912,8 @@ function classListToObject(classList) {
|
|
|
1401
1912
|
function flattenClassList(list, result) {
|
|
1402
1913
|
for (let i = 0, len = list.length; i < len; i++) {
|
|
1403
1914
|
const item = list[i];
|
|
1404
|
-
if (Array.isArray(item)) flattenClassList(item, result);else if (typeof item === "object" && item != null) Object.assign(result, item);
|
|
1915
|
+
if (Array.isArray(item)) flattenClassList(item, result);else if (typeof item === "object" && item != null) Object.assign(result, item);
|
|
1916
|
+
else if (typeof item !== "boolean" && (item || item === 0)) result[item] = true;
|
|
1405
1917
|
}
|
|
1406
1918
|
}
|
|
1407
1919
|
function assignProp(node, prop, value, prev, skipRef, nodeName) {
|
|
@@ -1412,22 +1924,28 @@ function assignProp(node, prop, value, prev, skipRef, nodeName) {
|
|
|
1412
1924
|
if (!skipRef && value) ref(() => value, node);
|
|
1413
1925
|
return value;
|
|
1414
1926
|
}
|
|
1927
|
+
let c;
|
|
1415
1928
|
const hasNamespace = prop.indexOf(":") > -1;
|
|
1416
|
-
if (!hasNamespace && prop.
|
|
1929
|
+
if (!hasNamespace && prop.startsWith("on") && (c = prop.charCodeAt(2)) > 64 && c < 91) {
|
|
1417
1930
|
const name = prop.slice(2).toLowerCase();
|
|
1418
1931
|
const delegate = DelegatedEvents.has(name);
|
|
1419
1932
|
if (!delegate && prev) {
|
|
1420
|
-
|
|
1421
|
-
node.removeEventListener(name,
|
|
1933
|
+
if (Array.isArray(value) && typeof prev === "function" && prev[$$EVENT_TUPLE] === value) return prev;
|
|
1934
|
+
node.removeEventListener(name, prev, typeof prev !== "function" && prev);
|
|
1422
1935
|
}
|
|
1423
1936
|
if (delegate || value) {
|
|
1424
|
-
addEvent(node, name, value, delegate);
|
|
1937
|
+
const attached = addEvent(node, name, value, delegate);
|
|
1425
1938
|
delegate && delegateEvents([name]);
|
|
1939
|
+
if (!delegate) return attached;
|
|
1426
1940
|
}
|
|
1427
1941
|
} else if (hasNamespace && prop.slice(0, 5) === "prop:" || ChildProperties.has(prop) || DOMWithState[nodeName]?.[prop]) {
|
|
1428
1942
|
if (hasNamespace) prop = prop.slice(5);else if (isHydrating(node)) return value;
|
|
1429
|
-
|
|
1430
|
-
|
|
1943
|
+
checkStatefulWrite(node, prop, value);
|
|
1944
|
+
if (prop === "value" && nodeName === "SELECT") writeSelectValue(node, value);else if ((prop === "value" || prop === "defaultValue") && (nodeName === "INPUT" || nodeName === "TEXTAREA")) {
|
|
1945
|
+
if (value == null && /^(checkbox|radio)$/.test(node.type)) node.removeAttribute("value");else node[prop] = value ?? "";
|
|
1946
|
+
} else node[prop] = value;
|
|
1947
|
+
recordStatefulWrite(node, prop, value);
|
|
1948
|
+
reclaimAttribute(node, prop);
|
|
1431
1949
|
} else {
|
|
1432
1950
|
const ns = hasNamespace && Namespaces[prop.split(":")[0]];
|
|
1433
1951
|
if (ns) setAttributeNS(node, ns, prop, value);else setAttribute(node, prop, value);
|
|
@@ -1442,47 +1960,39 @@ function eventHandler(e, container, state) {
|
|
|
1442
1960
|
if (prev === true || prev === container || !container.contains(prev)) return;
|
|
1443
1961
|
resumeNode = prev;
|
|
1444
1962
|
}
|
|
1445
|
-
const owner = state
|
|
1446
|
-
if (
|
|
1447
|
-
if (owner
|
|
1448
|
-
e[$$EVENT_OWNER] = owner
|
|
1963
|
+
const owner = state.owners.size === 1 && state.owners.has(container) ? container : findOwner(e.target, state)?.owner;
|
|
1964
|
+
if (!owner) return;
|
|
1965
|
+
if (owner === resumeNode) return;
|
|
1966
|
+
e[$$EVENT_OWNER] = owner;
|
|
1449
1967
|
let node = resumeNode || e.target;
|
|
1450
|
-
const key =
|
|
1451
|
-
const oriTarget = e.target;
|
|
1452
|
-
const boundary = owner || container || e.currentTarget;
|
|
1968
|
+
const key = EVENT_KEY + e.type;
|
|
1453
1969
|
const retarget = value => Object.defineProperty(e, "target", {
|
|
1454
1970
|
configurable: true,
|
|
1455
1971
|
value
|
|
1456
1972
|
});
|
|
1457
1973
|
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
|
-
}
|
|
1974
|
+
const handler = node[key];
|
|
1463
1975
|
if (handler && !node.disabled) {
|
|
1464
1976
|
const data = node[`${key}Data`];
|
|
1465
|
-
data !== undefined ? handler.call(node, data, e) : handler.call(node, e);
|
|
1977
|
+
data !== undefined ? handler.call(node, data, e) : typeof handler === "function" ? handler.call(node, e) : handler.handleEvent(e);
|
|
1466
1978
|
if (e.cancelBubble) return;
|
|
1467
1979
|
}
|
|
1468
1980
|
node.host && typeof node.host !== "string" && !node.host._$host && node.contains(e.target) && retarget(node.host);
|
|
1469
1981
|
return true;
|
|
1470
1982
|
};
|
|
1983
|
+
const atOwner = () => node === owner || node.parentNode === owner;
|
|
1471
1984
|
const walkUpTree = () => {
|
|
1472
|
-
while (node && handleNode())
|
|
1473
|
-
if (node === boundary || node.parentNode === boundary) break;
|
|
1474
|
-
node = node._$host || node.parentNode || node.host;
|
|
1475
|
-
}
|
|
1985
|
+
while (node && handleNode() && !atOwner()) node = parentOf(node);
|
|
1476
1986
|
};
|
|
1477
1987
|
Object.defineProperty(e, "currentTarget", {
|
|
1478
1988
|
configurable: true,
|
|
1479
1989
|
get() {
|
|
1480
|
-
return node ||
|
|
1990
|
+
return node || owner;
|
|
1481
1991
|
}
|
|
1482
1992
|
});
|
|
1483
1993
|
if (resumeNode) {
|
|
1484
|
-
if (resumeNode === e.target) node = resumeNode
|
|
1485
|
-
if (node && node !==
|
|
1994
|
+
if (resumeNode === e.target) node = parentOf(resumeNode);
|
|
1995
|
+
if (node && node !== owner) walkUpTree();
|
|
1486
1996
|
} else if (e.composedPath) {
|
|
1487
1997
|
const path = e.composedPath();
|
|
1488
1998
|
if (path.length) {
|
|
@@ -1495,21 +2005,34 @@ function eventHandler(e, container, state) {
|
|
|
1495
2005
|
walkUpTree();
|
|
1496
2006
|
break;
|
|
1497
2007
|
}
|
|
1498
|
-
if (
|
|
1499
|
-
break;
|
|
1500
|
-
}
|
|
2008
|
+
if (atOwner()) break;
|
|
1501
2009
|
}
|
|
1502
2010
|
} else walkUpTree();
|
|
1503
2011
|
}
|
|
1504
2012
|
else walkUpTree();
|
|
1505
|
-
|
|
2013
|
+
delete e.target;
|
|
2014
|
+
delete e.currentTarget;
|
|
1506
2015
|
}
|
|
1507
2016
|
function insertExpression(parent, value, current, marker) {
|
|
2017
|
+
tagElement(parent);
|
|
1508
2018
|
if (hydrationRt !== null && isHydrating(parent)) {
|
|
1509
|
-
if (value && value !== current)
|
|
2019
|
+
if (value && value !== current) {
|
|
2020
|
+
const arr = Array.isArray(value);
|
|
2021
|
+
for (const n of arr ? value : [value]) {
|
|
2022
|
+
if (n && n.nodeType) {
|
|
2023
|
+
if (!isHydrating(n)) return current;
|
|
2024
|
+
} else if (arr && (typeof n === "string" || typeof n === "number")) {
|
|
2025
|
+
return current;
|
|
2026
|
+
}
|
|
2027
|
+
}
|
|
2028
|
+
}
|
|
1510
2029
|
return value;
|
|
1511
2030
|
}
|
|
1512
2031
|
if (value === current) return value;
|
|
2032
|
+
if (hydrationRt !== null && sharedConfig.hydrating && value && value.length !== 0) {
|
|
2033
|
+
const tracked = [].concat(current ?? []);
|
|
2034
|
+
if ([].concat(value).every(n => (n === tracked[0] && tracked.shift(), n?.parentNode === parent)) && !tracked.length) return value;
|
|
2035
|
+
}
|
|
1513
2036
|
const t = typeof value,
|
|
1514
2037
|
multi = marker !== undefined;
|
|
1515
2038
|
if (t === "string" || t === "number") {
|
|
@@ -1527,42 +2050,87 @@ function insertExpression(parent, value, current, marker) {
|
|
|
1527
2050
|
} else if (value.nodeType) {
|
|
1528
2051
|
if (Array.isArray(current)) {
|
|
1529
2052
|
cleanChildren(parent, current, multi ? marker : null, value);
|
|
1530
|
-
} else if (current && current.nodeType) {
|
|
2053
|
+
} else if (current != null && current.nodeType) {
|
|
1531
2054
|
current.parentNode === parent ? parent.replaceChild(value, current) : parent.appendChild(value);
|
|
1532
|
-
} else if (current && parent.firstChild) {
|
|
2055
|
+
} else if (current != null && parent.firstChild) {
|
|
1533
2056
|
parent.replaceChild(value, parent.firstChild);
|
|
1534
2057
|
} else {
|
|
1535
2058
|
parent.appendChild(value);
|
|
1536
2059
|
}
|
|
1537
|
-
if (marker) value[$$SLOT] = marker;
|
|
2060
|
+
if (marker || value[$$SLOT]) value[$$SLOT] = marker || parent;
|
|
1538
2061
|
} else if (Array.isArray(value)) {
|
|
1539
|
-
const currentArray =
|
|
2062
|
+
const currentArray = Array.isArray(current);
|
|
2063
|
+
for (let i = 0, len = value.length; i < len; i++) {
|
|
2064
|
+
const item = value[i],
|
|
2065
|
+
t = typeof item;
|
|
2066
|
+
if (t === "string" || t === "number") {
|
|
2067
|
+
const prev = currentArray ? current[i] : undefined;
|
|
2068
|
+
if (prev && prev.nodeType === 3) {
|
|
2069
|
+
if (prev.data !== "" + item) prev.data = item;
|
|
2070
|
+
value[i] = prev;
|
|
2071
|
+
} else value[i] = document.createTextNode(item);
|
|
2072
|
+
}
|
|
2073
|
+
}
|
|
1540
2074
|
if (value.length === 0) {
|
|
1541
2075
|
cleanChildren(parent, current, marker);
|
|
1542
2076
|
} else if (currentArray) {
|
|
1543
|
-
|
|
1544
|
-
appendNodes(parent, value, marker);
|
|
1545
|
-
} else reconcileArrays(parent, current, value, marker);
|
|
2077
|
+
reconcileArrays(parent, current, value, marker);
|
|
1546
2078
|
} else {
|
|
1547
|
-
current
|
|
1548
|
-
|
|
2079
|
+
if (current != null) cleanChildren(parent, current);
|
|
2080
|
+
reconcileArrays(parent, [], value);
|
|
1549
2081
|
}
|
|
1550
|
-
} else
|
|
2082
|
+
} else devCheck({
|
|
2083
|
+
code: "UNRECOGNIZED_INSERT_VALUE",
|
|
2084
|
+
kind: "render",
|
|
2085
|
+
severity: "warn",
|
|
2086
|
+
message: `[UNRECOGNIZED_INSERT_VALUE] Unrecognized value. Skipped inserting (${typeof value}).`,
|
|
2087
|
+
data: {
|
|
2088
|
+
type: typeof value,
|
|
2089
|
+
value
|
|
2090
|
+
}
|
|
2091
|
+
});
|
|
2092
|
+
selectInsert && selectInsert(parent);
|
|
1551
2093
|
return value;
|
|
1552
2094
|
}
|
|
2095
|
+
function selectChange(e) {
|
|
2096
|
+
(e = e.currentTarget || e)._$v = null;
|
|
2097
|
+
e.removeEventListener("change", selectChange, true);
|
|
2098
|
+
}
|
|
2099
|
+
function writeSelectValue(node, value) {
|
|
2100
|
+
const had = node._$v && node._$v.map,
|
|
2101
|
+
has = value != null && value.map;
|
|
2102
|
+
if (has) had || node.addEventListener("change", selectChange, true);else had && node.removeEventListener("change", selectChange, true);
|
|
2103
|
+
if (value == null) {
|
|
2104
|
+
node._$v = null;
|
|
2105
|
+
return queueMicrotask(() => node.value = value) || (node.value = value);
|
|
2106
|
+
}
|
|
2107
|
+
node._$v = value;
|
|
2108
|
+
(selectInsert ||= applySelectValue)(node);
|
|
2109
|
+
queueMicrotask(() => selectInsert(node));
|
|
2110
|
+
}
|
|
2111
|
+
function applySelectValue(p) {
|
|
2112
|
+
p && p._$v == null && (p = p.parentNode);
|
|
2113
|
+
const v = p && p._$v;
|
|
2114
|
+
if (v == null) return;
|
|
2115
|
+
if (v.map) {
|
|
2116
|
+
const o = [...p.options];
|
|
2117
|
+
for (let i = 0; i < o.length; i++) o[i].selected = v.some(x => x == o[i].value);
|
|
2118
|
+
v.every(x => o.some(el => el.value == x)) && selectChange(p);
|
|
2119
|
+
} else p.value = v, p.selectedIndex > -1 && p.value == v && (p._$v = null);
|
|
2120
|
+
}
|
|
1553
2121
|
function normalize(value, current, multi, doNotUnwrap) {
|
|
1554
|
-
value =
|
|
2122
|
+
value = flatten(value, {
|
|
1555
2123
|
skipNonRendered: true,
|
|
1556
2124
|
doNotUnwrap
|
|
1557
2125
|
});
|
|
1558
2126
|
if (doNotUnwrap && typeof value === "function") return value;
|
|
1559
2127
|
if (multi && !Array.isArray(value)) value = [value != null ? value : ""];
|
|
1560
|
-
if (Array.isArray(value)) {
|
|
2128
|
+
if (hydrationRt !== null && sharedConfig.hydrating && Array.isArray(value)) {
|
|
1561
2129
|
for (let i = 0, len = value.length; i < len; i++) {
|
|
1562
2130
|
const item = value[i],
|
|
1563
2131
|
prev = current && current[i],
|
|
1564
2132
|
t = typeof item;
|
|
1565
|
-
if (t === "string" || t === "number")
|
|
2133
|
+
if ((t === "string" || t === "number") && prev && prev.nodeType === 3 && isHydrating(prev)) value[i] = prev;
|
|
1566
2134
|
}
|
|
1567
2135
|
}
|
|
1568
2136
|
return value;
|
|
@@ -1578,13 +2146,6 @@ function tagHost(value, host) {
|
|
|
1578
2146
|
});
|
|
1579
2147
|
}
|
|
1580
2148
|
}
|
|
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
2149
|
function ownsAllChildren(parent, current) {
|
|
1589
2150
|
if (current == null) return true;
|
|
1590
2151
|
if (Array.isArray(current)) {
|
|
@@ -1619,33 +2180,31 @@ function cleanChildren(parent, current, marker, replacement) {
|
|
|
1619
2180
|
const el = current[i];
|
|
1620
2181
|
if (replacement !== el) {
|
|
1621
2182
|
const tag = el[$$SLOT];
|
|
1622
|
-
const owns = el.parentNode === parent && (!tag || tag === marker);
|
|
2183
|
+
const owns = el.parentNode === parent && (!tag || tag === (marker || parent));
|
|
1623
2184
|
if (replacement && !inserted && !i) owns ? parent.replaceChild(replacement, el) : parent.insertBefore(replacement, marker);else if (owns) el.remove();
|
|
1624
2185
|
} else inserted = true;
|
|
1625
2186
|
}
|
|
1626
2187
|
} else if (replacement) parent.insertBefore(replacement, marker);
|
|
1627
|
-
if (replacement && marker) replacement[$$SLOT] = marker;
|
|
2188
|
+
if (replacement && (marker || replacement[$$SLOT])) replacement[$$SLOT] = marker || parent;
|
|
1628
2189
|
}
|
|
1629
2190
|
function gatherHydratable(element, root) {
|
|
1630
|
-
const templates = element.querySelectorAll(`*[_hk]`);
|
|
2191
|
+
const templates = element.querySelectorAll(root ? `[_hk^="${root.replace(/["\\]/g, "\\$&")}"]` : `*[_hk]`);
|
|
2192
|
+
const inFrame = root || serverComponentClaims === null ? undefined : serverComponentClaims.inFrame(element);
|
|
2193
|
+
const registry = sharedConfig.registry;
|
|
1631
2194
|
for (let i = 0; i < templates.length; i++) {
|
|
1632
2195
|
const node = templates[i];
|
|
2196
|
+
if (inFrame !== undefined && inFrame(node)) continue;
|
|
1633
2197
|
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);
|
|
2198
|
+
if (!registry.has(key)) registry.set(key, node);
|
|
1641
2199
|
}
|
|
1642
2200
|
}
|
|
1643
2201
|
function getHydrationKey() {
|
|
1644
|
-
return
|
|
2202
|
+
return sharedConfig.getNextContextId();
|
|
1645
2203
|
}
|
|
1646
|
-
const voidFn = () => undefined;
|
|
1647
2204
|
const RequestContext = Symbol();
|
|
1648
2205
|
|
|
2206
|
+
function configureServerErrors(_config) {}
|
|
2207
|
+
function reportRequestFailure(_error, _event) {}
|
|
1649
2208
|
function throwInBrowser(func) {
|
|
1650
2209
|
const err = new Error(`${func.name} is not supported in the browser, returning undefined`);
|
|
1651
2210
|
console.error(err);
|
|
@@ -1675,28 +2234,38 @@ function composeMiddleware(middlewares) {
|
|
|
1675
2234
|
throwInBrowser(composeMiddleware);
|
|
1676
2235
|
}
|
|
1677
2236
|
function ssr(template, ...nodes) {}
|
|
1678
|
-
function ssrElement(name, props, children, needsId) {}
|
|
2237
|
+
function ssrElement(name, props, children, needsId, skip, attrs) {}
|
|
2238
|
+
function ssrElementAttribute(key, value) {}
|
|
2239
|
+
function ssrLinkClaim(attrs) {}
|
|
1679
2240
|
function ssrClassName(value) {}
|
|
1680
2241
|
function ssrStyle(value) {}
|
|
1681
2242
|
function ssrStyleProperty(name, value) {}
|
|
2243
|
+
function ssrStyleProperties(...entries) {}
|
|
1682
2244
|
function ssrAttribute(key, value) {}
|
|
1683
2245
|
function ssrGroup(fn, n) {}
|
|
1684
2246
|
function ssrHydrationKey() {}
|
|
1685
|
-
function resolveSSRNode(node, result, top) {}
|
|
2247
|
+
function resolveSSRNode(node, result, top, nested) {}
|
|
1686
2248
|
function escape(s, attr) {}
|
|
1687
2249
|
|
|
1688
2250
|
const ENVELOPE = Symbol.for("solid.ResponseEnvelope");
|
|
1689
|
-
|
|
1690
|
-
const ResponseEnvelope =
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
2251
|
+
let EnvelopeClass;
|
|
2252
|
+
const ResponseEnvelope = function ResponseEnvelope(response, value) {
|
|
2253
|
+
if (!EnvelopeClass) {
|
|
2254
|
+
EnvelopeClass = class extends Response {
|
|
2255
|
+
constructor(response, value) {
|
|
2256
|
+
super(response ? response.body : null, response && {
|
|
2257
|
+
status: response.status,
|
|
2258
|
+
statusText: response.statusText,
|
|
2259
|
+
headers: copyHeaders(response.headers)
|
|
2260
|
+
});
|
|
2261
|
+
this.response = response ? this : undefined;
|
|
2262
|
+
this.value = value;
|
|
2263
|
+
}
|
|
2264
|
+
};
|
|
2265
|
+
EnvelopeClass.prototype[ENVELOPE] = true;
|
|
1696
2266
|
}
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
})();
|
|
2267
|
+
return new EnvelopeClass(response, value);
|
|
2268
|
+
};
|
|
1700
2269
|
function isResponseEnvelope(value) {
|
|
1701
2270
|
return !!(value && typeof value === "object" && value[ENVELOPE]);
|
|
1702
2271
|
}
|
|
@@ -1719,24 +2288,38 @@ function isSafeError(value) {
|
|
|
1719
2288
|
return !!(value && (typeof value === "object" || typeof value === "function") && value[SAFE_ERROR]);
|
|
1720
2289
|
}
|
|
1721
2290
|
const REVALIDATE_HEADER = "X-Revalidate";
|
|
1722
|
-
|
|
2291
|
+
const REVALIDATE_ALL = "*";
|
|
2292
|
+
const RESPONSE_HEADER_VALUE_LIMIT = 4096;
|
|
2293
|
+
function copyHeaders(init) {
|
|
2294
|
+
const source = init;
|
|
2295
|
+
if (!source || !source.getSetCookie) return new Headers(init);
|
|
2296
|
+
const headers = new Headers();
|
|
2297
|
+
source.forEach((value, key) => {
|
|
2298
|
+
if (key !== "set-cookie") headers.append(key, value);
|
|
2299
|
+
});
|
|
2300
|
+
for (const cookie of source.getSetCookie()) headers.append("Set-Cookie", cookie);
|
|
2301
|
+
return headers;
|
|
2302
|
+
}
|
|
2303
|
+
function initWithRevalidate(init = {}) {
|
|
2304
|
+
const resolved = typeof init === "number" ? {
|
|
2305
|
+
status: init
|
|
2306
|
+
} : init;
|
|
1723
2307
|
const {
|
|
1724
2308
|
revalidate,
|
|
1725
2309
|
...responseInit
|
|
1726
|
-
} =
|
|
1727
|
-
|
|
1728
|
-
if (
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
});
|
|
1733
|
-
for (const cookie of responseInit.headers.getSetCookie()) {
|
|
1734
|
-
headers.append("Set-Cookie", cookie);
|
|
2310
|
+
} = resolved;
|
|
2311
|
+
const headers = copyHeaders(responseInit.headers);
|
|
2312
|
+
if (revalidate !== undefined) {
|
|
2313
|
+
const list = Array.isArray(revalidate) ? revalidate : [revalidate];
|
|
2314
|
+
if (list.length > 1 && list.includes(REVALIDATE_ALL)) {
|
|
2315
|
+
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
2316
|
}
|
|
1736
|
-
|
|
1737
|
-
|
|
2317
|
+
const keys = list.join(",");
|
|
2318
|
+
if (keys.length > RESPONSE_HEADER_VALUE_LIMIT) {
|
|
2319
|
+
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.`);
|
|
2320
|
+
}
|
|
2321
|
+
headers.set(REVALIDATE_HEADER, keys);
|
|
1738
2322
|
}
|
|
1739
|
-
revalidate !== undefined && headers.set(REVALIDATE_HEADER, revalidate.toString());
|
|
1740
2323
|
return {
|
|
1741
2324
|
responseInit,
|
|
1742
2325
|
headers
|
|
@@ -1749,13 +2332,17 @@ function redirect(url, init = 302) {
|
|
|
1749
2332
|
const {
|
|
1750
2333
|
responseInit,
|
|
1751
2334
|
headers
|
|
1752
|
-
} = initWithRevalidate(
|
|
1753
|
-
status: init
|
|
1754
|
-
} : init);
|
|
2335
|
+
} = initWithRevalidate(init);
|
|
1755
2336
|
if (responseInit.status === undefined) {
|
|
1756
2337
|
responseInit.status = 302;
|
|
1757
2338
|
}
|
|
1758
|
-
|
|
2339
|
+
const target = typeof url === "string" ? url : url[HREF];
|
|
2340
|
+
const location = typeof target === "string" ? target : String(url);
|
|
2341
|
+
const encoded = location.replace(/[^\x00-\x7f]/gu, encodeURIComponent);
|
|
2342
|
+
if (encoded.length > RESPONSE_HEADER_VALUE_LIMIT) {
|
|
2343
|
+
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.`);
|
|
2344
|
+
}
|
|
2345
|
+
headers.set("Location", encoded);
|
|
1759
2346
|
return new Response(null, {
|
|
1760
2347
|
...responseInit,
|
|
1761
2348
|
headers
|
|
@@ -1771,57 +2358,50 @@ function reload(init = {}) {
|
|
|
1771
2358
|
headers
|
|
1772
2359
|
});
|
|
1773
2360
|
}
|
|
2361
|
+
const NULL_BODY_STATUSES = new Set([204, 205, 304]);
|
|
1774
2362
|
function respond(value, init = {}) {
|
|
1775
2363
|
const {
|
|
1776
2364
|
responseInit,
|
|
1777
2365
|
headers
|
|
1778
2366
|
} = initWithRevalidate(init);
|
|
2367
|
+
for (const header of COMPOSED_BODY_FRAMING) headers.delete(header);
|
|
2368
|
+
if (NULL_BODY_STATUSES.has(responseInit.status)) {
|
|
2369
|
+
return new ResponseEnvelope(new Response(null, {
|
|
2370
|
+
...responseInit,
|
|
2371
|
+
headers
|
|
2372
|
+
}), value);
|
|
2373
|
+
}
|
|
1779
2374
|
headers.set("Content-Type", "application/json");
|
|
1780
|
-
return new ResponseEnvelope(new Response(
|
|
2375
|
+
return new ResponseEnvelope(new Response(new ReadableStream({
|
|
2376
|
+
pull(controller) {
|
|
2377
|
+
controller.enqueue(new TextEncoder().encode(JSON.stringify(value)));
|
|
2378
|
+
controller.close();
|
|
2379
|
+
}
|
|
2380
|
+
}), {
|
|
1781
2381
|
...responseInit,
|
|
1782
2382
|
headers
|
|
1783
2383
|
}), value);
|
|
1784
2384
|
}
|
|
1785
2385
|
|
|
1786
|
-
const mergeProps = solidJs.merge;
|
|
1787
2386
|
const isServer = false;
|
|
1788
2387
|
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
2388
|
function Portal(props) {
|
|
1809
|
-
return
|
|
2389
|
+
return runWithOwner(createOwner(), () => portalImpl(props));
|
|
1810
2390
|
}
|
|
1811
2391
|
function portalImpl(props) {
|
|
1812
2392
|
const treeMarker = document.createTextNode(""),
|
|
1813
2393
|
startMarker = document.createTextNode(""),
|
|
1814
2394
|
endMarker = document.createTextNode(""),
|
|
1815
2395
|
mount = () => props.mount || document.body,
|
|
1816
|
-
content =
|
|
2396
|
+
content = createMemo(() => [startMarker, props.children], {
|
|
1817
2397
|
ssrSource: "client",
|
|
1818
2398
|
loadingValue: undefined
|
|
1819
2399
|
});
|
|
1820
|
-
|
|
1821
|
-
() => [mount(), content(),
|
|
1822
|
-
const m =
|
|
2400
|
+
createRenderEffect(
|
|
2401
|
+
() => [mount(), content(), getOwner()], ([, c, owner]) => {
|
|
2402
|
+
const m = untrack(mount);
|
|
1823
2403
|
m.appendChild(endMarker);
|
|
1824
|
-
const dispose =
|
|
2404
|
+
const dispose = runWithOwner(owner, () => createRoot(d => {
|
|
1825
2405
|
insert(m, c, endMarker, undefined, {
|
|
1826
2406
|
host: () => treeMarker.parentNode
|
|
1827
2407
|
});
|
|
@@ -1842,8 +2422,8 @@ function portalImpl(props) {
|
|
|
1842
2422
|
schedule: true,
|
|
1843
2423
|
ssrSource: "client"
|
|
1844
2424
|
});
|
|
1845
|
-
|
|
1846
|
-
const m =
|
|
2425
|
+
createEffect(mount, () => {
|
|
2426
|
+
const m = untrack(mount);
|
|
1847
2427
|
const ownerRoot = getDelegatedRoot(treeMarker);
|
|
1848
2428
|
if (!ownerRoot || ownerRoot.contains(m)) return;
|
|
1849
2429
|
registerDelegatedContainer(m, ownerRoot);
|
|
@@ -1851,73 +2431,31 @@ function portalImpl(props) {
|
|
|
1851
2431
|
}, {
|
|
1852
2432
|
ssrSource: "client"
|
|
1853
2433
|
});
|
|
1854
|
-
if (
|
|
2434
|
+
if (sharedConfig.hydrating) return createMemo(() => treeMarker, {
|
|
1855
2435
|
ssrSource: "client",
|
|
1856
2436
|
loadingValue: undefined
|
|
1857
2437
|
});
|
|
1858
2438
|
return treeMarker;
|
|
1859
2439
|
}
|
|
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
|
-
};
|
|
2440
|
+
function dynamic(source, options) {
|
|
2441
|
+
return dynamicCore(source, options, staticElement);
|
|
2442
|
+
}
|
|
2443
|
+
function staticElement(tag, props) {
|
|
2444
|
+
const hydrating = sharedConfig.hydrating;
|
|
2445
|
+
const create = () => createElement(tag, untrack(() => props.is), untrack(() => props.xmlns));
|
|
2446
|
+
const el = hydrating ? getNextElement(create) : create();
|
|
2447
|
+
spread(el, props);
|
|
2448
|
+
if (hydrating) runHydrationEvents();
|
|
2449
|
+
return el;
|
|
1914
2450
|
}
|
|
1915
2451
|
function Dynamic(props) {
|
|
1916
2452
|
const Comp = dynamic(() => props.component);
|
|
1917
|
-
return
|
|
2453
|
+
return createComponent(Comp, omit(props, "component"));
|
|
1918
2454
|
}
|
|
1919
|
-
function createElement(tagName, is = undefined) {
|
|
1920
|
-
return
|
|
2455
|
+
function createElement(tagName, is = undefined, xmlns = undefined) {
|
|
2456
|
+
return xmlns ? document.createElementNS(xmlns, tagName, {
|
|
2457
|
+
is
|
|
2458
|
+
}) : SVGElements.has(tagName) ? document.createElementNS(Namespaces.svg, tagName) : MathMLElements.has(tagName) ? document.createElementNS(Namespaces.mathml, tagName) : document.createElement(tagName, {
|
|
1921
2459
|
is
|
|
1922
2460
|
});
|
|
1923
2461
|
}
|
|
@@ -1926,21 +2464,21 @@ function loadClientOnly(fn, setComp, exportName) {
|
|
|
1926
2464
|
}
|
|
1927
2465
|
function clientOnly(fn, options = {},
|
|
1928
2466
|
_moduleUrl) {
|
|
1929
|
-
const [comp, setComp] =
|
|
2467
|
+
const [comp, setComp] = createSignal();
|
|
1930
2468
|
let started = !options.lazy;
|
|
1931
2469
|
started && loadClientOnly(fn, setComp, options.export);
|
|
1932
2470
|
return props => {
|
|
1933
2471
|
let Comp;
|
|
1934
2472
|
let m;
|
|
1935
|
-
const rest =
|
|
2473
|
+
const rest = omit(props, "fallback");
|
|
1936
2474
|
if (!started) {
|
|
1937
2475
|
started = true;
|
|
1938
2476
|
loadClientOnly(fn, setComp, options.export);
|
|
1939
2477
|
}
|
|
1940
|
-
if ((Comp =
|
|
1941
|
-
const [mounted, setMounted] =
|
|
1942
|
-
const gate =
|
|
1943
|
-
const onHydrationEnd =
|
|
2478
|
+
if ((Comp = untrack(comp)) && !sharedConfig.hydrating) return Comp(rest);
|
|
2479
|
+
const [mounted, setMounted] = createSignal(!sharedConfig.hydrating);
|
|
2480
|
+
const gate = createMemo(() => (Comp = comp(), m = mounted(), untrack(() => Comp && m ? Comp(rest) : props.fallback)));
|
|
2481
|
+
const onHydrationEnd = sharedConfig.onHydrationEnd;
|
|
1944
2482
|
const release = () => setMounted(true);
|
|
1945
2483
|
onHydrationEnd ? onHydrationEnd(release) : queueMicrotask(release);
|
|
1946
2484
|
return gate;
|
|
@@ -1949,154 +2487,4 @@ _moduleUrl) {
|
|
|
1949
2487
|
function httpStatus(_code, _text) {}
|
|
1950
2488
|
function httpHeader(_name, _value, _options) {}
|
|
1951
2489
|
|
|
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;
|
|
2490
|
+
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 };
|