@solidjs/web 2.0.0-rc.1 → 2.0.0-rc.10
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/dist/server.dev.js +4472 -0
- package/dist/server.js +1301 -251
- package/dist/{server.cjs → server.observe.js} +1501 -452
- package/dist/{dev.cjs → web.dev.js} +699 -360
- package/dist/web.js +454 -139
- package/dist/{dev.js → web.observe.js} +505 -211
- package/frames/dist/client.dev.js +463 -71
- package/frames/dist/client.js +363 -70
- package/frames/dist/{client.dev.cjs → client.observe.js} +486 -133
- package/frames/dist/server.dev.js +1713 -0
- package/frames/dist/server.js +552 -2583
- package/frames/dist/server.observe.js +1713 -0
- package/frames/package.json +2 -25
- package/package.json +214 -255
- package/performance-tracks/dist/performance-tracks.dev.js +678 -0
- package/performance-tracks/dist/performance-tracks.js +6 -0
- package/performance-tracks/dist/performance-tracks.observe.js +666 -0
- package/performance-tracks/package.json +7 -0
- package/performance-tracks/types/index.d.ts +67 -0
- package/serialization/decode/package.json +2 -15
- package/serialization/dist/decode.js +92 -15
- package/serialization/dist/serialization.js +103 -23
- package/serialization/package.json +2 -15
- package/serialization/types/index.d.ts +76 -157
- package/serialization/types/serializer-decode.d.ts +149 -112
- package/serialization/types/serializer.d.ts +101 -0
- package/server-functions/dist/client.dev.js +1364 -0
- package/server-functions/dist/client.js +611 -97
- package/server-functions/dist/client.observe.js +1343 -0
- package/server-functions/dist/server.dev.js +2138 -202
- package/server-functions/dist/server.js +2042 -199
- package/server-functions/dist/server.observe.js +3043 -0
- package/server-functions/package.json +2 -35
- package/server-functions/rich-args/package.json +2 -15
- package/storage/package.json +2 -15
- package/types/client.d.ts +193 -288
- package/types/constants.d.ts +20 -0
- package/types/cookies.d.ts +32 -84
- package/types/diagnostics.d.ts +56 -0
- package/types/frames/client.d.ts +1 -1
- package/types/frames/frame-client.d.ts +323 -259
- package/types/frames/frame-container-plugin.d.ts +72 -0
- package/types/frames/frame-sink.d.ts +101 -158
- package/types/frames/frame-transport.d.ts +192 -190
- package/types/frames/serializer-decode.d.ts +219 -0
- package/types/frames/serializer.d.ts +76 -157
- package/types/frames/server.d.ts +1 -1
- package/types/head.d.ts +19 -0
- package/types/index.d.ts +52 -80
- package/types/index.server.d.ts +174 -0
- package/types/jsx.d.ts +33 -35
- package/types/observe.d.ts +358 -0
- package/types/reconcile.d.ts +1 -0
- package/types/render.d.ts +9 -0
- package/types/response.d.ts +75 -150
- package/types/serializer-decode.d.ts +149 -112
- package/types/serializer.d.ts +76 -157
- package/types/server-functions/client.d.ts +192 -194
- package/types/server-functions/flash.d.ts +28 -30
- package/types/server-functions/registry.d.ts +102 -0
- package/types/server-functions/rich-args.d.ts +1 -10
- package/types/server-functions/server.d.ts +511 -475
- package/types/server-functions/shared.d.ts +366 -425
- package/types/server-mock.d.ts +110 -13
- package/types/server-observe.d.ts +77 -0
- package/types/server.d.ts +425 -425
- package/types/trace.d.ts +127 -0
- package/LICENSE +0 -21
- package/dist/web.cjs +0 -2008
- package/frames/dist/client.cjs +0 -1916
- package/frames/dist/server.cjs +0 -3756
- package/serialization/dist/decode.cjs +0 -122
- package/serialization/dist/serialization.cjs +0 -244
- 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 -793
- package/server-functions/dist/rich-args.cjs +0 -11
- package/server-functions/dist/server.cjs +0 -1171
- package/server-functions/dist/server.dev.cjs +0 -1171
- 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 -6
- package/types-cjs/client.d.cts +0 -337
- package/types-cjs/cookies.d.cts +0 -93
- package/types-cjs/core.d.cts +0 -6
- package/types-cjs/frames/client.d.cts +0 -36
- package/types-cjs/frames/frame-client.d.cts +0 -338
- 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 -231
- 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 -616
- package/types-cjs/server-functions/shared.d.cts +0 -523
- package/types-cjs/server-mock.d.cts +0 -277
- package/types-cjs/server.d.cts +0 -523
package/dist/web.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { createRenderEffect, createMemo,
|
|
2
|
-
export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, Show, Switch, createComponent, getOwner, untrack } from 'solid-js';
|
|
1
|
+
import { createRenderEffect, createMemo, sharedConfig, enableHydration, $PROXY, untrack, runWithOwner, createRoot, getOwner, ROOT_ERROR_HOOK, flatten, flush, createComponent, omit, createOwner, createSignal, onCleanup, createEffect } from 'solid-js';
|
|
2
|
+
export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, Show, Switch, createComponent, getOwner, merge as mergeProps, untrack } from 'solid-js';
|
|
3
|
+
import { sourceKeys, SOURCE_PROXY, hasStaticKeys, resolvedTable, viewOf, OmitView, sourceHas, SOURCE_OMIT, sourceGet, SOURCE_MEMO, SOURCE_PLAIN } from 'solid-js/internal';
|
|
3
4
|
|
|
4
5
|
const DOMWithState = {
|
|
5
6
|
INPUT: {
|
|
@@ -48,6 +49,7 @@ const Namespaces = {
|
|
|
48
49
|
const VoidElements = /*#__PURE__*/new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr"]);
|
|
49
50
|
const RawTextElements = /*#__PURE__*/new Set(["style", "script", "noscript", "template", "textarea", "title"]);
|
|
50
51
|
const DOMElements = /*#__PURE__*/new Set(/*#__PURE__*/"a,abbr,acronym,address,applet,area,article,aside,audio,b,base,basefont,bdi,bdo,bgsound,big,blink,blockquote,body,br,button,canvas,caption,center,cite,code,col,colgroup,content,data,datalist,dd,del,details,dfn,dialog,dir,div,dl,dt,em,embed,fieldset,figcaption,figure,font,footer,form,frame,frameset,h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,i,iframe,image,img,input,ins,isindex,kbd,keygen,label,legend,li,link,listing,main,map,mark,marquee,math,menu,menuitem,meta,meter,multicol,nav,nextid,nobr,noembed,noframes,noindex,noscript,object,ol,optgroup,option,output,p,param,picture,plaintext,portal,pre,progress,q,rb,rp,rt,rtc,ruby,s,samp,script,search,section,select,shadow,slot,small,source,spacer,span,strike,strong,style,sub,summary,sup,svg,table,tbody,td,template,textarea,tfoot,th,thead,time,title,tr,track,tt,u,ul,var,video,wbr,webview,xmp".split(","));
|
|
52
|
+
const COMPOSED_BODY_FRAMING = /*#__PURE__*/new Set(["content-length", "content-encoding", "transfer-encoding"]);
|
|
51
53
|
|
|
52
54
|
const transparentOptions = {
|
|
53
55
|
transparent: true,
|
|
@@ -56,23 +58,17 @@ const transparentOptions = {
|
|
|
56
58
|
const syncOptions = {
|
|
57
59
|
sync: true
|
|
58
60
|
};
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
gate = createMemo(() => promise);
|
|
71
|
-
});
|
|
72
|
-
assetGates.set(promise, gate);
|
|
73
|
-
}
|
|
74
|
-
gate();
|
|
75
|
-
};
|
|
61
|
+
function effect(fn, effectFn, options) {
|
|
62
|
+
const nodeOptions = options ? {
|
|
63
|
+
sync: true,
|
|
64
|
+
...options,
|
|
65
|
+
transparent: !options.scope
|
|
66
|
+
} : transparentOptions;
|
|
67
|
+
createRenderEffect(fn, effectFn, nodeOptions);
|
|
68
|
+
}
|
|
69
|
+
function memo(fn) {
|
|
70
|
+
return createMemo(() => fn(), syncOptions);
|
|
71
|
+
}
|
|
76
72
|
|
|
77
73
|
function reconcileArrays(parentNode, a, b, marker) {
|
|
78
74
|
let bLength = b.length,
|
|
@@ -86,13 +82,18 @@ function reconcileArrays(parentNode, a, b, marker) {
|
|
|
86
82
|
map = null,
|
|
87
83
|
anchor,
|
|
88
84
|
anchorTag;
|
|
85
|
+
const isLive = n => {
|
|
86
|
+
if (!n) return false;
|
|
87
|
+
const tag = n[$$SLOT];
|
|
88
|
+
return n.parentNode === parentNode && (!tag || tag === marker);
|
|
89
|
+
};
|
|
89
90
|
while (aStart < aEnd || bStart < bEnd) {
|
|
90
|
-
if (a[aStart] === b[bStart]) {
|
|
91
|
+
if (a[aStart] === b[bStart] && isLive(a[aStart])) {
|
|
91
92
|
aStart++;
|
|
92
93
|
bStart++;
|
|
93
94
|
continue;
|
|
94
95
|
}
|
|
95
|
-
while (a[aEnd - 1] === b[bEnd - 1]) {
|
|
96
|
+
while (a[aEnd - 1] === b[bEnd - 1] && isLive(a[aEnd - 1])) {
|
|
96
97
|
aEnd--;
|
|
97
98
|
bEnd--;
|
|
98
99
|
}
|
|
@@ -212,11 +213,24 @@ function classifyHeadTag(desc) {
|
|
|
212
213
|
resource: false
|
|
213
214
|
};
|
|
214
215
|
}
|
|
216
|
+
function qualifierValue(name, value) {
|
|
217
|
+
if (value == null || value === false) return null;
|
|
218
|
+
if (name === "imagesrcset" || name === "imagesizes") return typeof value === "string" && value !== "" ? value : null;
|
|
219
|
+
const v = value === true ? "" : String(value);
|
|
220
|
+
if (name === "as") return asciiLowerCase(v);
|
|
221
|
+
if (name !== "crossorigin") return v;
|
|
222
|
+
return v.length === 15 && v.toLowerCase() === "use-credentials" ? v.toLowerCase() : "anonymous";
|
|
223
|
+
}
|
|
224
|
+
function asciiLowerCase(value) {
|
|
225
|
+
return value.replace(/[A-Z]/g, c => String.fromCharCode(c.charCodeAt(0) + 32));
|
|
226
|
+
}
|
|
215
227
|
function resourceIdentity(tag, props) {
|
|
216
|
-
|
|
228
|
+
const url = String(props.href || props.src || "");
|
|
229
|
+
let id = "res:" + tag + ":" + (props.rel || "") + ":" + url.length + ":" + url;
|
|
217
230
|
for (let i = 0; i < RESOURCE_QUALIFIERS.length; i++) {
|
|
218
231
|
const q = RESOURCE_QUALIFIERS[i];
|
|
219
|
-
|
|
232
|
+
const value = qualifierValue(q, props[q]);
|
|
233
|
+
if (value !== null) id += ":" + q + "=" + value.length + ":" + value;
|
|
220
234
|
}
|
|
221
235
|
return id;
|
|
222
236
|
}
|
|
@@ -295,6 +309,7 @@ function serializeCookie(name, value, options = {}) {
|
|
|
295
309
|
if (options.expires) cookie += `; Expires=${options.expires.toUTCString()}`;
|
|
296
310
|
if (options.httpOnly) cookie += "; HttpOnly";
|
|
297
311
|
if (options.secure) cookie += "; Secure";
|
|
312
|
+
if (options.partitioned) cookie += "; Partitioned";
|
|
298
313
|
if (options.sameSite) {
|
|
299
314
|
const sameSite = options.sameSite.toLowerCase();
|
|
300
315
|
cookie += `; SameSite=${sameSite === "none" ? "None" : sameSite === "strict" ? "Strict" : "Lax"}`;
|
|
@@ -323,30 +338,61 @@ function getServerFunctionRPC() {
|
|
|
323
338
|
return globalThis[SERVER_FUNCTION_RPC];
|
|
324
339
|
}
|
|
325
340
|
|
|
326
|
-
const
|
|
341
|
+
const assetGates = new WeakMap();
|
|
342
|
+
const waitAsset = promise => {
|
|
343
|
+
let gate = assetGates.get(promise);
|
|
344
|
+
if (!gate) {
|
|
345
|
+
runWithOwner(null, () => {
|
|
346
|
+
gate = createMemo(() => promise, {
|
|
347
|
+
transparent: true
|
|
348
|
+
});
|
|
349
|
+
});
|
|
350
|
+
assetGates.set(promise, gate);
|
|
351
|
+
}
|
|
352
|
+
gate();
|
|
353
|
+
};
|
|
354
|
+
const EVENT_KEY = "_$$";
|
|
355
|
+
const $$EVENT_OWNER = "_$SOLID_EVENT_OWNER";
|
|
356
|
+
const $$EVENT_TUPLE = Symbol();
|
|
357
|
+
const hasOwn = Object.prototype.hasOwnProperty;
|
|
327
358
|
const INNER_OWNED = {};
|
|
328
359
|
const delegatedEvents = new Set();
|
|
329
360
|
const delegatedContainers = new Map();
|
|
330
|
-
function
|
|
361
|
+
function voidFn() {}
|
|
362
|
+
function generateHydrationScript(_options) {
|
|
363
|
+
return "";
|
|
364
|
+
}
|
|
365
|
+
function HydrationScript(_props) {
|
|
366
|
+
return null;
|
|
367
|
+
}
|
|
368
|
+
const getRequestEvent = voidFn;
|
|
369
|
+
const getTraceContext = voidFn;
|
|
370
|
+
function render(code, element, init, options = {}) {
|
|
331
371
|
let disposer;
|
|
332
372
|
registerDelegatedRoot(element);
|
|
333
373
|
try {
|
|
334
374
|
createRoot(dispose => {
|
|
335
375
|
disposer = dispose;
|
|
376
|
+
if (options.onError) getOwner()[ROOT_ERROR_HOOK] = options.onError;
|
|
336
377
|
if (element === document) {
|
|
337
378
|
const tree = code();
|
|
338
379
|
effect(() => flatten(tree), () => {});
|
|
339
380
|
} else {
|
|
340
381
|
const tree = code();
|
|
341
|
-
insert(element, () => tree, element.firstChild ? null : undefined, init,
|
|
382
|
+
insert(element, () => tree, element.firstChild ? null : undefined, init, {
|
|
383
|
+
...options.insertOptions,
|
|
384
|
+
schedule: true
|
|
385
|
+
});
|
|
342
386
|
}
|
|
343
387
|
}, {
|
|
344
388
|
id: options.renderId
|
|
345
389
|
});
|
|
390
|
+
flush();
|
|
346
391
|
} catch (err) {
|
|
347
392
|
if (disposer) disposer();
|
|
348
393
|
unregisterDelegatedRoot(element);
|
|
349
394
|
throw err;
|
|
395
|
+
} finally {
|
|
350
396
|
}
|
|
351
397
|
return () => {
|
|
352
398
|
disposer();
|
|
@@ -428,10 +474,11 @@ function findOwner(target, state) {
|
|
|
428
474
|
}
|
|
429
475
|
function setProperty(node, name, value) {
|
|
430
476
|
if (isHydrating(node)) return;
|
|
431
|
-
|
|
477
|
+
const nodeName = node.nodeName;
|
|
478
|
+
if (name === "value" && nodeName === "SELECT") queueMicrotask(() => node.value = value) || (node.value = value);else if ((name === "value" || name === "defaultValue") && (nodeName === "INPUT" || nodeName === "TEXTAREA")) node[name] = value ?? "";else node[name] = value;
|
|
432
479
|
}
|
|
433
480
|
let claimHandlers = null;
|
|
434
|
-
const CLAIM_SEAM = Symbol.for("
|
|
481
|
+
const CLAIM_SEAM = Symbol.for("solid.element-claims");
|
|
435
482
|
function registerElementClaim(handler) {
|
|
436
483
|
(claimHandlers || (claimHandlers = globalThis[CLAIM_SEAM] = [])).push(handler);
|
|
437
484
|
return () => {
|
|
@@ -462,7 +509,17 @@ function claimElement(node) {
|
|
|
462
509
|
}
|
|
463
510
|
function setAttribute(node, name, value) {
|
|
464
511
|
if (isHydrating(node)) return;
|
|
465
|
-
|
|
512
|
+
const selectMultiple = name === "multiple" && node.localName === "select";
|
|
513
|
+
if (value == null || value === false) node.removeAttribute(name);else {
|
|
514
|
+
node.setAttribute(name, value === true ? "" : value);
|
|
515
|
+
if (selectMultiple && !node._$multiple) {
|
|
516
|
+
const options = node.options;
|
|
517
|
+
for (let i = 0; i < options.length; i++) {
|
|
518
|
+
if (options[i].defaultSelected) options[i].selected = true;
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
if (selectMultiple) node._$multiple = true;
|
|
466
523
|
if (claimHandlers !== null && (name === "href" || name === "action")) claimElement(node);
|
|
467
524
|
}
|
|
468
525
|
function setAttributeNS(node, namespace, name, value) {
|
|
@@ -470,22 +527,32 @@ function setAttributeNS(node, namespace, name, value) {
|
|
|
470
527
|
if (value == null || value === false) node.removeAttributeNS(namespace, name.indexOf(":") > -1 ? name.split(":").pop() : name);else node.setAttributeNS(namespace, name, value === true ? "" : value);
|
|
471
528
|
}
|
|
472
529
|
function className(node, value, prev) {
|
|
473
|
-
if (
|
|
530
|
+
if (typeof value === "number") value = "" + value;
|
|
531
|
+
if (typeof prev === "number") prev = "" + prev;
|
|
532
|
+
if (isHydrating(node)) {
|
|
533
|
+
node._$classes = value && typeof value === "object" ? classListToObject(value) : undefined;
|
|
534
|
+
return;
|
|
535
|
+
}
|
|
474
536
|
if (value == null || value === false) {
|
|
475
|
-
prev
|
|
537
|
+
if (prev || node._$classes) {
|
|
538
|
+
node.removeAttribute("class");
|
|
539
|
+
node._$classes = undefined;
|
|
540
|
+
}
|
|
476
541
|
return;
|
|
477
542
|
}
|
|
478
543
|
if (typeof value === "string") {
|
|
544
|
+
node._$classes = undefined;
|
|
479
545
|
value !== prev && node.setAttribute("class", value);
|
|
480
546
|
return;
|
|
481
547
|
}
|
|
548
|
+
let applied;
|
|
482
549
|
if (typeof prev === "string") {
|
|
483
|
-
|
|
550
|
+
applied = {};
|
|
484
551
|
node.removeAttribute("class");
|
|
485
|
-
} else
|
|
552
|
+
} else applied = node._$classes || classListToObject(prev || {});
|
|
486
553
|
value = classListToObject(value);
|
|
487
|
-
const classKeys = Object.keys(value
|
|
488
|
-
const prevKeys = Object.keys(
|
|
554
|
+
const classKeys = Object.keys(value);
|
|
555
|
+
const prevKeys = Object.keys(applied);
|
|
489
556
|
let i, len;
|
|
490
557
|
for (i = 0, len = prevKeys.length; i < len; i++) {
|
|
491
558
|
const key = prevKeys[i];
|
|
@@ -495,22 +562,34 @@ function className(node, value, prev) {
|
|
|
495
562
|
for (i = 0, len = classKeys.length; i < len; i++) {
|
|
496
563
|
const key = classKeys[i],
|
|
497
564
|
classValue = !!value[key];
|
|
498
|
-
if (!key || key === "undefined" ||
|
|
565
|
+
if (!key || key === "undefined" || applied[key] === classValue || !classValue) continue;
|
|
499
566
|
node.classList.add(key);
|
|
500
567
|
}
|
|
568
|
+
node._$classes = value;
|
|
501
569
|
}
|
|
502
570
|
function addEvent(node, name, handler, delegate) {
|
|
503
571
|
if (delegate) {
|
|
572
|
+
const key = EVENT_KEY + name;
|
|
573
|
+
let data;
|
|
504
574
|
if (Array.isArray(handler)) {
|
|
505
|
-
|
|
506
|
-
node[
|
|
507
|
-
} else node[
|
|
508
|
-
|
|
575
|
+
data = handler[1];
|
|
576
|
+
node[key] = handler[0];
|
|
577
|
+
} else node[key] = handler;
|
|
578
|
+
node[`${key}Data`] = data;
|
|
579
|
+
return;
|
|
580
|
+
}
|
|
581
|
+
if (Array.isArray(handler)) {
|
|
509
582
|
const handlerFn = handler[0];
|
|
510
|
-
|
|
511
|
-
|
|
583
|
+
const listener = e => handlerFn.call(node, handler[1], e);
|
|
584
|
+
listener[$$EVENT_TUPLE] = handler;
|
|
585
|
+
node.addEventListener(name, listener);
|
|
586
|
+
return listener;
|
|
587
|
+
}
|
|
588
|
+
node.addEventListener(name, handler, typeof handler !== "function" && handler);
|
|
589
|
+
return handler;
|
|
512
590
|
}
|
|
513
591
|
function style(node, value, prev) {
|
|
592
|
+
if (isHydrating(node)) return;
|
|
514
593
|
if (!value) {
|
|
515
594
|
if (prev || node._$styles) {
|
|
516
595
|
setAttribute(node, "style");
|
|
@@ -535,12 +614,13 @@ function style(node, value, prev) {
|
|
|
535
614
|
}
|
|
536
615
|
let v, s;
|
|
537
616
|
for (s in applied) {
|
|
538
|
-
if (value[s] == null) {
|
|
617
|
+
if (!hasOwn.call(value, s) || value[s] == null) {
|
|
539
618
|
nodeStyle.removeProperty(s);
|
|
540
619
|
delete applied[s];
|
|
541
620
|
}
|
|
542
621
|
}
|
|
543
622
|
for (s in value) {
|
|
623
|
+
if (!hasOwn.call(value, s)) continue;
|
|
544
624
|
v = value[s];
|
|
545
625
|
if (v != null && v !== applied[s]) {
|
|
546
626
|
nodeStyle.setProperty(s, v);
|
|
@@ -548,26 +628,122 @@ function style(node, value, prev) {
|
|
|
548
628
|
}
|
|
549
629
|
}
|
|
550
630
|
}
|
|
631
|
+
function readShallow(value) {
|
|
632
|
+
if (value === null || typeof value !== "object") return value;
|
|
633
|
+
if (Array.isArray(value)) return value.map(readShallow);
|
|
634
|
+
if (value[$PROXY] !== value) return value;
|
|
635
|
+
const keys = sourceKeys(value, SOURCE_PROXY);
|
|
636
|
+
const out = {};
|
|
637
|
+
for (let i = 0; i < keys.length; i++) {
|
|
638
|
+
const k = keys[i];
|
|
639
|
+
if (typeof k === "string") out[k] = value[k];
|
|
640
|
+
}
|
|
641
|
+
return out;
|
|
642
|
+
}
|
|
551
643
|
function setStyleProperty(node, name, value) {
|
|
644
|
+
if (isHydrating(node)) return;
|
|
552
645
|
value != null ? node.style.setProperty(name, value) : node.style.removeProperty(name);
|
|
553
646
|
}
|
|
554
|
-
function spread(node, props
|
|
647
|
+
function spread(node, props, skipChildren, skip, name) {
|
|
555
648
|
const prevProps = {};
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
(
|
|
560
|
-
}
|
|
649
|
+
const apply = newProps => {
|
|
650
|
+
const r = newProps.ref;
|
|
651
|
+
if (r !== prevProps.ref && (typeof r === "function" || Array.isArray(r))) ref(() => r, node);
|
|
652
|
+
assign(node, newProps, true, prevProps, true);
|
|
653
|
+
};
|
|
654
|
+
if (Array.isArray(props)) {
|
|
655
|
+
if (!skipChildren && !(skip !== undefined && skip("children"))) insert(node, () => {
|
|
656
|
+
for (let i = props.length - 1; i >= 0; i--) {
|
|
657
|
+
const s = resolveSource(props[i]);
|
|
658
|
+
if (s != null && entryHas(s, "children")) return entryGet(s, "children");
|
|
659
|
+
}
|
|
660
|
+
});
|
|
661
|
+
effect(() => collectSources({}, props, undefined, skip), apply);
|
|
662
|
+
return prevProps;
|
|
663
|
+
}
|
|
664
|
+
if (!skipChildren && !(skip !== undefined && skip("children"))) {
|
|
665
|
+
if (typeof props !== "function" && props != null && hasStaticKeys(props)) {
|
|
666
|
+
const desc = Object.getOwnPropertyDescriptor(props, "children");
|
|
667
|
+
if (desc !== undefined) {
|
|
668
|
+
if (desc.get === undefined) insert(node, desc.value);else insert(node, () => props.children);
|
|
669
|
+
}
|
|
670
|
+
} else insert(node, () => {
|
|
671
|
+
const source = resolveSource(props);
|
|
672
|
+
return source != null && entryHas(source, "children") ? entryGet(source, "children") : undefined;
|
|
673
|
+
});
|
|
674
|
+
}
|
|
561
675
|
effect(() => {
|
|
676
|
+
const source = resolveSource(props);
|
|
562
677
|
const newProps = {};
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
678
|
+
const table = resolvedTable(source);
|
|
679
|
+
if (table !== undefined) return collectTable(newProps, table, skip);
|
|
680
|
+
if (source != null) {
|
|
681
|
+
const view = viewOf(source);
|
|
682
|
+
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);
|
|
566
683
|
}
|
|
567
684
|
return newProps;
|
|
568
|
-
},
|
|
685
|
+
}, apply);
|
|
569
686
|
return prevProps;
|
|
570
687
|
}
|
|
688
|
+
function collectTable(out, table, skip) {
|
|
689
|
+
for (const [prop, leaf] of table) {
|
|
690
|
+
if (typeof prop !== "string" || prop === "children") continue;
|
|
691
|
+
if (skip !== undefined && skip(prop)) continue;
|
|
692
|
+
const v = leaf[prop];
|
|
693
|
+
out[prop] = prop === "style" || prop === "class" ? readShallow(v) : v;
|
|
694
|
+
}
|
|
695
|
+
return out;
|
|
696
|
+
}
|
|
697
|
+
function resolveSource(s) {
|
|
698
|
+
return typeof s === "function" ? s() : s;
|
|
699
|
+
}
|
|
700
|
+
function entryHas(s, key) {
|
|
701
|
+
const view = viewOf(s);
|
|
702
|
+
return view instanceof OmitView ? sourceHas(view, SOURCE_OMIT, key) : key in s;
|
|
703
|
+
}
|
|
704
|
+
function entryGet(s, key) {
|
|
705
|
+
const view = viewOf(s);
|
|
706
|
+
return view instanceof OmitView ? sourceGet(view, SOURCE_OMIT, key) : s[key];
|
|
707
|
+
}
|
|
708
|
+
function collectSources(out, sources, kinds, skip) {
|
|
709
|
+
const resolved = [];
|
|
710
|
+
const resolvedKinds = [];
|
|
711
|
+
for (let i = 0; i < sources.length; i++) pushEntry(resolved, resolvedKinds, sources[i], kinds !== undefined ? kinds[i] : SOURCE_MEMO);
|
|
712
|
+
for (let i = 0; i < resolved.length; i++) collectProps(out, resolved[i], resolvedKinds[i], skip, resolved, resolvedKinds, i + 1);
|
|
713
|
+
return out;
|
|
714
|
+
}
|
|
715
|
+
function pushEntry(resolved, kinds, s, kind) {
|
|
716
|
+
if (kind !== SOURCE_MEMO) {
|
|
717
|
+
resolved.push(s);
|
|
718
|
+
kinds.push(kind);
|
|
719
|
+
return;
|
|
720
|
+
}
|
|
721
|
+
s = resolveSource(s);
|
|
722
|
+
if (s == null) return;
|
|
723
|
+
const view = viewOf(s);
|
|
724
|
+
if (view instanceof OmitView) {
|
|
725
|
+
resolved.push(view);
|
|
726
|
+
kinds.push(SOURCE_OMIT);
|
|
727
|
+
} else if (view !== undefined) {
|
|
728
|
+
const f = view.sources,
|
|
729
|
+
k = view.kinds;
|
|
730
|
+
for (let j = 0; j < f.length; j++) pushEntry(resolved, kinds, f[j], k[j]);
|
|
731
|
+
} else {
|
|
732
|
+
resolved.push(s);
|
|
733
|
+
kinds.push($PROXY in s ? SOURCE_PROXY : SOURCE_PLAIN);
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
function collectProps(out, s, kind, skip, later, laterKinds, from) {
|
|
737
|
+
const keys = sourceKeys(s, kind);
|
|
738
|
+
outer: for (let i = 0; i < keys.length; i++) {
|
|
739
|
+
const prop = keys[i];
|
|
740
|
+
if (typeof prop !== "string" || prop === "children") continue;
|
|
741
|
+
if (skip !== undefined && skip(prop)) continue;
|
|
742
|
+
if (later !== undefined) for (let j = from; j < later.length; j++) if (sourceHas(later[j], laterKinds[j], prop)) continue outer;
|
|
743
|
+
const v = sourceGet(s, kind, prop);
|
|
744
|
+
out[prop] = prop === "style" || prop === "class" ? readShallow(v) : v;
|
|
745
|
+
}
|
|
746
|
+
}
|
|
571
747
|
function dynamicProperty(props, key) {
|
|
572
748
|
const src = props[key];
|
|
573
749
|
Object.defineProperty(props, key, {
|
|
@@ -597,8 +773,7 @@ function installHydrationRuntime() {
|
|
|
597
773
|
hydrationRt = {
|
|
598
774
|
claimInitial(parent, multi, initial) {
|
|
599
775
|
if (isHydrating(parent)) {
|
|
600
|
-
if (!multi && initial === undefined && parent) initial =
|
|
601
|
-
if (Array.isArray(initial)) stripTextSeparators(initial);
|
|
776
|
+
if (!multi && initial === undefined && parent) initial = claimChildNodes(parent);else if (Array.isArray(initial)) stripTextSeparators(initial);
|
|
602
777
|
}
|
|
603
778
|
return initial;
|
|
604
779
|
},
|
|
@@ -622,7 +797,7 @@ function installHydrationRuntime() {
|
|
|
622
797
|
nodes.unshift(node);
|
|
623
798
|
node = node.previousSibling;
|
|
624
799
|
}
|
|
625
|
-
} else
|
|
800
|
+
} else return claimChildNodes(parent);
|
|
626
801
|
return stripTextSeparators(nodes);
|
|
627
802
|
},
|
|
628
803
|
dedupEvent(e) {
|
|
@@ -635,19 +810,36 @@ function stripTextSeparators(nodes) {
|
|
|
635
810
|
for (let i = 0; i < nodes.length; i++) {
|
|
636
811
|
const node = nodes[i],
|
|
637
812
|
t = node.nodeType;
|
|
638
|
-
if (t === 8) {
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
}
|
|
644
|
-
if (v.startsWith("pl-")) continue;
|
|
645
|
-
} else if (t === 1 && node.localName === "template" && node.id.startsWith("pl-")) continue;
|
|
813
|
+
if (t === 8 && node.nodeValue === "!$") {
|
|
814
|
+
node.remove();
|
|
815
|
+
continue;
|
|
816
|
+
}
|
|
817
|
+
if (isPlaceholderScaffolding(node, t)) continue;
|
|
646
818
|
nodes[j++] = node;
|
|
647
819
|
}
|
|
648
820
|
nodes.length = j;
|
|
649
821
|
return nodes;
|
|
650
822
|
}
|
|
823
|
+
function claimChildNodes(parent) {
|
|
824
|
+
const live = parent.childNodes;
|
|
825
|
+
const out = [];
|
|
826
|
+
for (let i = 0, n = live.length; i < n; i++) {
|
|
827
|
+
const node = live[i],
|
|
828
|
+
t = node.nodeType;
|
|
829
|
+
if (t === 8 && node.nodeValue === "!$") {
|
|
830
|
+
node.remove();
|
|
831
|
+
i--;
|
|
832
|
+
n--;
|
|
833
|
+
continue;
|
|
834
|
+
}
|
|
835
|
+
if (isPlaceholderScaffolding(node, t)) continue;
|
|
836
|
+
out.push(node);
|
|
837
|
+
}
|
|
838
|
+
return out;
|
|
839
|
+
}
|
|
840
|
+
function isPlaceholderScaffolding(node, t) {
|
|
841
|
+
return t === 8 ? node.nodeValue.startsWith("pl-") : t === 1 && node.localName === "template" && node.id.startsWith("pl-");
|
|
842
|
+
}
|
|
651
843
|
function insert(parent, accessor, marker, initial, options) {
|
|
652
844
|
const multi = marker !== undefined;
|
|
653
845
|
const host = options && options.host;
|
|
@@ -712,10 +904,16 @@ function assetEntryKey(descriptor) {
|
|
|
712
904
|
if (descriptor.policy === "exclusive") return "x|" + descriptor.key;
|
|
713
905
|
return descriptor.type === "inline-style" ? "i|" + descriptor.id : descriptor.type + "|" + descriptor.href;
|
|
714
906
|
}
|
|
715
|
-
function findAssetElement(selector, attr, value) {
|
|
907
|
+
function findAssetElement(selector, attr, value, qualifiers) {
|
|
716
908
|
const nodes = document.querySelectorAll(selector);
|
|
717
|
-
for (let i = 0; i < nodes.length; i++) {
|
|
718
|
-
if (nodes[i].getAttribute(attr)
|
|
909
|
+
outer: for (let i = 0; i < nodes.length; i++) {
|
|
910
|
+
if (nodes[i].getAttribute(attr) !== value) continue;
|
|
911
|
+
if (!qualifiers) return nodes[i];
|
|
912
|
+
for (let q = 0; q < RESOURCE_QUALIFIERS.length; q++) {
|
|
913
|
+
const name = RESOURCE_QUALIFIERS[q];
|
|
914
|
+
if (qualifierValue(name, qualifiers[name]) !== qualifierValue(name, nodes[i].getAttribute(name))) continue outer;
|
|
915
|
+
}
|
|
916
|
+
return nodes[i];
|
|
719
917
|
}
|
|
720
918
|
return null;
|
|
721
919
|
}
|
|
@@ -888,7 +1086,7 @@ function initHeadRegistry() {
|
|
|
888
1086
|
headOwned = new Map();
|
|
889
1087
|
headApplied = new Map();
|
|
890
1088
|
const t = document.querySelector("title");
|
|
891
|
-
headFallbackTitle = t
|
|
1089
|
+
headFallbackTitle = t ? t.hasAttribute("data-dh") ? t.getAttribute("data-dhf") : t.textContent : null;
|
|
892
1090
|
if (globalThis._$HY) globalThis._$HY.h = applyServerHeadOps;
|
|
893
1091
|
}
|
|
894
1092
|
function applyServerHeadOps(ops) {
|
|
@@ -943,7 +1141,11 @@ function flushHeadRegistry() {
|
|
|
943
1141
|
headOwned.delete(identity);
|
|
944
1142
|
headApplied.delete(identity);
|
|
945
1143
|
if (identity === "title") {
|
|
946
|
-
if (headFallbackTitle != null)
|
|
1144
|
+
if (headFallbackTitle != null) {
|
|
1145
|
+
const el = setHeadTitle(headFallbackTitle);
|
|
1146
|
+
el.removeAttribute("data-dh");
|
|
1147
|
+
el.removeAttribute("data-dhf");
|
|
1148
|
+
}
|
|
947
1149
|
} else {
|
|
948
1150
|
for (let i = 0; i < els.length; i++) els[i].remove();
|
|
949
1151
|
}
|
|
@@ -1015,8 +1217,8 @@ function mountHeadResource(tag, props) {
|
|
|
1015
1217
|
headMountedResources.add(identity);
|
|
1016
1218
|
const url = props.href || props.src;
|
|
1017
1219
|
let el = null;
|
|
1018
|
-
if (url != null) {
|
|
1019
|
-
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);
|
|
1220
|
+
if (tag === "link" && url == null && typeof props.imagesrcset === "string") el = findAssetElement(`link[rel="${props.rel}"]`, "href", null, props);else if (url != null) {
|
|
1221
|
+
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);
|
|
1020
1222
|
}
|
|
1021
1223
|
if (!el) document.head.appendChild(createHeadElement(tag, props));
|
|
1022
1224
|
}
|
|
@@ -1038,7 +1240,7 @@ function gateHeadResource(props) {
|
|
|
1038
1240
|
if (attrs) descriptor.attrs = attrs;
|
|
1039
1241
|
effect(() => {
|
|
1040
1242
|
const entry = warmAsset(descriptor);
|
|
1041
|
-
if (gateable && entry.loadState === "pending" && typeof waitAsset === "function") waitAsset(entry.loadPromise);
|
|
1243
|
+
if (gateable && !sharedConfig.hydrating && entry.loadState === "pending" && typeof waitAsset === "function") waitAsset(entry.loadPromise);
|
|
1042
1244
|
}, () => acquireAsset(descriptor));
|
|
1043
1245
|
}
|
|
1044
1246
|
function useHead(tags) {
|
|
@@ -1107,7 +1309,7 @@ function loadModuleAssets(mapping) {
|
|
|
1107
1309
|
const pending = [];
|
|
1108
1310
|
for (const key in mapping) {
|
|
1109
1311
|
if (hy.modules[key]) continue;
|
|
1110
|
-
const entryUrl = mapping[key];
|
|
1312
|
+
const entryUrl = new URL(mapping[key], document.baseURI).href;
|
|
1111
1313
|
if (!hy.loading[key]) {
|
|
1112
1314
|
hy.loading[key] = import(entryUrl).then(mod => {
|
|
1113
1315
|
hy.modules[key] = mod;
|
|
@@ -1120,9 +1322,19 @@ function loadModuleAssets(mapping) {
|
|
|
1120
1322
|
}
|
|
1121
1323
|
return pending.length ? Promise.all(pending).then(() => {}) : undefined;
|
|
1122
1324
|
}
|
|
1123
|
-
function hydrate
|
|
1325
|
+
function hydrate(code, element, options = {}) {
|
|
1326
|
+
enableHydration();
|
|
1124
1327
|
installHydrationRuntime();
|
|
1125
|
-
if (globalThis._$HY.done) return render
|
|
1328
|
+
if (globalThis._$HY.done) return render(code, element, [...element.childNodes], options);
|
|
1329
|
+
const head = (element.nodeType === 9 ? element : element.ownerDocument).head;
|
|
1330
|
+
if (head && element.contains(head)) {
|
|
1331
|
+
let n = head.firstChild;
|
|
1332
|
+
while (n && n.nodeType === 1 && n.hasAttribute("data-dh") && !n.hasAttribute("data-dhf")) {
|
|
1333
|
+
const next = n.nextSibling;
|
|
1334
|
+
head.appendChild(n);
|
|
1335
|
+
n = next;
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1126
1338
|
options.renderId ||= "";
|
|
1127
1339
|
if (!globalThis._$HY.modules) globalThis._$HY.modules = {};
|
|
1128
1340
|
if (!globalThis._$HY.loading) globalThis._$HY.loading = {};
|
|
@@ -1171,22 +1383,26 @@ function hydrate$1(code, element, options = {}) {
|
|
|
1171
1383
|
sharedConfig.gather = gather;
|
|
1172
1384
|
sharedConfig.hydrating = true;
|
|
1173
1385
|
try {
|
|
1174
|
-
disposer = render
|
|
1386
|
+
disposer = render(code, element, [...element.childNodes], options);
|
|
1175
1387
|
} finally {
|
|
1176
1388
|
sharedConfig.hydrating = false;
|
|
1177
1389
|
}
|
|
1178
1390
|
}, err => {
|
|
1179
|
-
console.error("Hydration module preload failed, falling back to client render:", err);
|
|
1180
1391
|
sharedConfig.hydrating = false;
|
|
1181
1392
|
sharedConfig.registry = undefined;
|
|
1182
|
-
|
|
1393
|
+
if (element.nodeType === 9) {
|
|
1394
|
+
(globalThis.reportError || console.error)(err);
|
|
1395
|
+
return;
|
|
1396
|
+
}
|
|
1397
|
+
console.error("Hydration module preload failed, falling back to client render:", err);
|
|
1398
|
+
disposer = render(code, element, [...element.childNodes], options);
|
|
1183
1399
|
});
|
|
1184
1400
|
return () => disposer && disposer();
|
|
1185
1401
|
}
|
|
1186
1402
|
}
|
|
1187
1403
|
try {
|
|
1188
1404
|
gatherHydratable(element, options.renderId);
|
|
1189
|
-
return render
|
|
1405
|
+
return render(code, element, [...element.childNodes], options);
|
|
1190
1406
|
} finally {
|
|
1191
1407
|
sharedConfig.hydrating = false;
|
|
1192
1408
|
}
|
|
@@ -1286,6 +1502,7 @@ function runHydrationEvents() {
|
|
|
1286
1502
|
}
|
|
1287
1503
|
function isHydrating(node) {
|
|
1288
1504
|
if (!sharedConfig.hydrating) return false;
|
|
1505
|
+
if (sharedConfig.isClaiming && !sharedConfig.isClaiming()) return false;
|
|
1289
1506
|
if (!node || node.isConnected) return true;
|
|
1290
1507
|
const roots = sharedConfig.claimRoots;
|
|
1291
1508
|
if (roots) {
|
|
@@ -1317,7 +1534,8 @@ function classListToObject(classList) {
|
|
|
1317
1534
|
function flattenClassList(list, result) {
|
|
1318
1535
|
for (let i = 0, len = list.length; i < len; i++) {
|
|
1319
1536
|
const item = list[i];
|
|
1320
|
-
if (Array.isArray(item)) flattenClassList(item, result);else if (typeof item === "object" && item != null) Object.assign(result, item);
|
|
1537
|
+
if (Array.isArray(item)) flattenClassList(item, result);else if (typeof item === "object" && item != null) Object.assign(result, item);
|
|
1538
|
+
else if (typeof item !== "boolean" && (item || item === 0)) result[item] = true;
|
|
1321
1539
|
}
|
|
1322
1540
|
}
|
|
1323
1541
|
function assignProp(node, prop, value, prev, skipRef, nodeName) {
|
|
@@ -1333,12 +1551,13 @@ function assignProp(node, prop, value, prev, skipRef, nodeName) {
|
|
|
1333
1551
|
const name = prop.slice(2).toLowerCase();
|
|
1334
1552
|
const delegate = DelegatedEvents.has(name);
|
|
1335
1553
|
if (!delegate && prev) {
|
|
1336
|
-
|
|
1337
|
-
node.removeEventListener(name,
|
|
1554
|
+
if (Array.isArray(value) && typeof prev === "function" && prev[$$EVENT_TUPLE] === value) return prev;
|
|
1555
|
+
node.removeEventListener(name, prev, typeof prev !== "function" && prev);
|
|
1338
1556
|
}
|
|
1339
1557
|
if (delegate || value) {
|
|
1340
|
-
addEvent(node, name, value, delegate);
|
|
1558
|
+
const attached = addEvent(node, name, value, delegate);
|
|
1341
1559
|
delegate && delegateEvents([name]);
|
|
1560
|
+
if (!delegate) return attached;
|
|
1342
1561
|
}
|
|
1343
1562
|
} else if (hasNamespace && prop.slice(0, 5) === "prop:" || ChildProperties.has(prop) || DOMWithState[nodeName]?.[prop]) {
|
|
1344
1563
|
if (hasNamespace) prop = prop.slice(5);else if (isHydrating(node)) return value;
|
|
@@ -1363,7 +1582,7 @@ function eventHandler(e, container, state) {
|
|
|
1363
1582
|
if (owner && owner === resumeNode) return;
|
|
1364
1583
|
e[$$EVENT_OWNER] = owner || true;
|
|
1365
1584
|
let node = resumeNode || e.target;
|
|
1366
|
-
const key =
|
|
1585
|
+
const key = EVENT_KEY + e.type;
|
|
1367
1586
|
const oriTarget = e.target;
|
|
1368
1587
|
const boundary = owner || container || e.currentTarget;
|
|
1369
1588
|
const retarget = value => Object.defineProperty(e, "target", {
|
|
@@ -1371,10 +1590,14 @@ function eventHandler(e, container, state) {
|
|
|
1371
1590
|
value
|
|
1372
1591
|
});
|
|
1373
1592
|
const handleNode = () => {
|
|
1374
|
-
|
|
1593
|
+
let handler = node[key];
|
|
1594
|
+
if (handler === undefined && node.hasAttribute && node.hasAttribute("_bnd")) {
|
|
1595
|
+
const seam = globalThis[Symbol.for("solid.bnd")];
|
|
1596
|
+
if (seam) handler = seam.resolve(node, e.type);
|
|
1597
|
+
}
|
|
1375
1598
|
if (handler && !node.disabled) {
|
|
1376
1599
|
const data = node[`${key}Data`];
|
|
1377
|
-
data !== undefined ? handler.call(node, data, e) : handler.call(node, e);
|
|
1600
|
+
data !== undefined ? handler.call(node, data, e) : typeof handler === "function" ? handler.call(node, e) : handler.handleEvent(e);
|
|
1378
1601
|
if (e.cancelBubble) return;
|
|
1379
1602
|
}
|
|
1380
1603
|
node.host && typeof node.host !== "string" && !node.host._$host && node.contains(e.target) && retarget(node.host);
|
|
@@ -1418,7 +1641,16 @@ function eventHandler(e, container, state) {
|
|
|
1418
1641
|
}
|
|
1419
1642
|
function insertExpression(parent, value, current, marker) {
|
|
1420
1643
|
if (hydrationRt !== null && isHydrating(parent)) {
|
|
1421
|
-
if (value && value !== current)
|
|
1644
|
+
if (value && value !== current) {
|
|
1645
|
+
const arr = Array.isArray(value);
|
|
1646
|
+
for (const n of arr ? value : [value]) {
|
|
1647
|
+
if (n && n.nodeType) {
|
|
1648
|
+
if (!isHydrating(n)) return current;
|
|
1649
|
+
} else if (arr && (typeof n === "string" || typeof n === "number")) {
|
|
1650
|
+
return current;
|
|
1651
|
+
}
|
|
1652
|
+
}
|
|
1653
|
+
}
|
|
1422
1654
|
return value;
|
|
1423
1655
|
}
|
|
1424
1656
|
if (value === current) return value;
|
|
@@ -1439,16 +1671,27 @@ function insertExpression(parent, value, current, marker) {
|
|
|
1439
1671
|
} else if (value.nodeType) {
|
|
1440
1672
|
if (Array.isArray(current)) {
|
|
1441
1673
|
cleanChildren(parent, current, multi ? marker : null, value);
|
|
1442
|
-
} else if (current && current.nodeType) {
|
|
1674
|
+
} else if (current != null && current.nodeType) {
|
|
1443
1675
|
current.parentNode === parent ? parent.replaceChild(value, current) : parent.appendChild(value);
|
|
1444
|
-
} else if (current && parent.firstChild) {
|
|
1676
|
+
} else if (current != null && parent.firstChild) {
|
|
1445
1677
|
parent.replaceChild(value, parent.firstChild);
|
|
1446
1678
|
} else {
|
|
1447
1679
|
parent.appendChild(value);
|
|
1448
1680
|
}
|
|
1449
1681
|
if (marker) value[$$SLOT] = marker;
|
|
1450
1682
|
} else if (Array.isArray(value)) {
|
|
1451
|
-
const currentArray =
|
|
1683
|
+
const currentArray = Array.isArray(current);
|
|
1684
|
+
for (let i = 0, len = value.length; i < len; i++) {
|
|
1685
|
+
const item = value[i],
|
|
1686
|
+
t = typeof item;
|
|
1687
|
+
if (t === "string" || t === "number") {
|
|
1688
|
+
const prev = currentArray ? current[i] : undefined;
|
|
1689
|
+
if (prev && prev.nodeType === 3) {
|
|
1690
|
+
if (prev.data !== "" + item) prev.data = item;
|
|
1691
|
+
value[i] = prev;
|
|
1692
|
+
} else value[i] = document.createTextNode(item);
|
|
1693
|
+
}
|
|
1694
|
+
}
|
|
1452
1695
|
if (value.length === 0) {
|
|
1453
1696
|
cleanChildren(parent, current, marker);
|
|
1454
1697
|
} else if (currentArray) {
|
|
@@ -1456,7 +1699,7 @@ function insertExpression(parent, value, current, marker) {
|
|
|
1456
1699
|
appendNodes(parent, value, marker);
|
|
1457
1700
|
} else reconcileArrays(parent, current, value, marker);
|
|
1458
1701
|
} else {
|
|
1459
|
-
current
|
|
1702
|
+
if (current != null) cleanChildren(parent, current);
|
|
1460
1703
|
appendNodes(parent, value);
|
|
1461
1704
|
}
|
|
1462
1705
|
} else ;
|
|
@@ -1469,12 +1712,12 @@ function normalize(value, current, multi, doNotUnwrap) {
|
|
|
1469
1712
|
});
|
|
1470
1713
|
if (doNotUnwrap && typeof value === "function") return value;
|
|
1471
1714
|
if (multi && !Array.isArray(value)) value = [value != null ? value : ""];
|
|
1472
|
-
if (Array.isArray(value)) {
|
|
1715
|
+
if (sharedConfig.hydrating && Array.isArray(value)) {
|
|
1473
1716
|
for (let i = 0, len = value.length; i < len; i++) {
|
|
1474
1717
|
const item = value[i],
|
|
1475
1718
|
prev = current && current[i],
|
|
1476
1719
|
t = typeof item;
|
|
1477
|
-
if (t === "string" || t === "number")
|
|
1720
|
+
if ((t === "string" || t === "number") && prev && prev.nodeType === 3 && isHydrating(prev)) value[i] = prev;
|
|
1478
1721
|
}
|
|
1479
1722
|
}
|
|
1480
1723
|
return value;
|
|
@@ -1540,24 +1783,33 @@ function cleanChildren(parent, current, marker, replacement) {
|
|
|
1540
1783
|
}
|
|
1541
1784
|
function gatherHydratable(element, root) {
|
|
1542
1785
|
const templates = element.querySelectorAll(`*[_hk]`);
|
|
1786
|
+
const frames = root ? null : element.querySelectorAll("[data-fid]");
|
|
1787
|
+
const frameCount = frames ? frames.length : 0;
|
|
1788
|
+
const registry = sharedConfig.registry;
|
|
1543
1789
|
for (let i = 0; i < templates.length; i++) {
|
|
1544
1790
|
const node = templates[i];
|
|
1545
1791
|
const key = node.getAttribute("_hk");
|
|
1546
1792
|
if (root) {
|
|
1547
1793
|
if (!key.startsWith(root)) continue;
|
|
1548
|
-
} else {
|
|
1549
|
-
|
|
1550
|
-
|
|
1794
|
+
} else if (frameCount !== 0) {
|
|
1795
|
+
let inFrame = false;
|
|
1796
|
+
for (let j = 0; j < frameCount; j++) {
|
|
1797
|
+
if (frames[j].contains(node)) {
|
|
1798
|
+
inFrame = true;
|
|
1799
|
+
break;
|
|
1800
|
+
}
|
|
1801
|
+
}
|
|
1802
|
+
if (inFrame) continue;
|
|
1551
1803
|
}
|
|
1552
|
-
if (!
|
|
1804
|
+
if (!registry.has(key)) registry.set(key, node);
|
|
1553
1805
|
}
|
|
1554
1806
|
}
|
|
1555
1807
|
function getHydrationKey() {
|
|
1556
1808
|
return sharedConfig.getNextContextId();
|
|
1557
1809
|
}
|
|
1558
|
-
const voidFn = () => undefined;
|
|
1559
1810
|
const RequestContext = Symbol();
|
|
1560
1811
|
|
|
1812
|
+
function configureServerErrors(_config) {}
|
|
1561
1813
|
function throwInBrowser(func) {
|
|
1562
1814
|
const err = new Error(`${func.name} is not supported in the browser, returning undefined`);
|
|
1563
1815
|
console.error(err);
|
|
@@ -1587,14 +1839,15 @@ function composeMiddleware(middlewares) {
|
|
|
1587
1839
|
throwInBrowser(composeMiddleware);
|
|
1588
1840
|
}
|
|
1589
1841
|
function ssr(template, ...nodes) {}
|
|
1590
|
-
function ssrElement(name, props, children, needsId) {}
|
|
1842
|
+
function ssrElement(name, props, children, needsId, skip, attrs) {}
|
|
1843
|
+
function ssrElementAttribute(key, value) {}
|
|
1591
1844
|
function ssrClassName(value) {}
|
|
1592
1845
|
function ssrStyle(value) {}
|
|
1593
1846
|
function ssrStyleProperty(name, value) {}
|
|
1594
1847
|
function ssrAttribute(key, value) {}
|
|
1595
1848
|
function ssrGroup(fn, n) {}
|
|
1596
1849
|
function ssrHydrationKey() {}
|
|
1597
|
-
function resolveSSRNode(node, result, top) {}
|
|
1850
|
+
function resolveSSRNode(node, result, top, nested) {}
|
|
1598
1851
|
function escape(s, attr) {}
|
|
1599
1852
|
|
|
1600
1853
|
const ENVELOPE = Symbol.for("solid.ResponseEnvelope");
|
|
@@ -1631,11 +1884,16 @@ function isSafeError(value) {
|
|
|
1631
1884
|
return !!(value && (typeof value === "object" || typeof value === "function") && value[SAFE_ERROR]);
|
|
1632
1885
|
}
|
|
1633
1886
|
const REVALIDATE_HEADER = "X-Revalidate";
|
|
1634
|
-
|
|
1887
|
+
const REVALIDATE_ALL = "*";
|
|
1888
|
+
const RESPONSE_HEADER_VALUE_LIMIT = 4096;
|
|
1889
|
+
function initWithRevalidate(init = {}) {
|
|
1890
|
+
const resolved = typeof init === "number" ? {
|
|
1891
|
+
status: init
|
|
1892
|
+
} : init;
|
|
1635
1893
|
const {
|
|
1636
1894
|
revalidate,
|
|
1637
1895
|
...responseInit
|
|
1638
|
-
} =
|
|
1896
|
+
} = resolved;
|
|
1639
1897
|
let headers;
|
|
1640
1898
|
if (responseInit.headers && responseInit.headers.getSetCookie) {
|
|
1641
1899
|
headers = new Headers();
|
|
@@ -1648,7 +1906,17 @@ function initWithRevalidate(init) {
|
|
|
1648
1906
|
} else {
|
|
1649
1907
|
headers = new Headers(responseInit.headers);
|
|
1650
1908
|
}
|
|
1651
|
-
revalidate !== undefined
|
|
1909
|
+
if (revalidate !== undefined) {
|
|
1910
|
+
const list = Array.isArray(revalidate) ? revalidate : [revalidate];
|
|
1911
|
+
if (list.length > 1 && list.includes(REVALIDATE_ALL)) {
|
|
1912
|
+
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.`);
|
|
1913
|
+
}
|
|
1914
|
+
const keys = list.join(",");
|
|
1915
|
+
if (keys.length > RESPONSE_HEADER_VALUE_LIMIT) {
|
|
1916
|
+
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.`);
|
|
1917
|
+
}
|
|
1918
|
+
headers.set(REVALIDATE_HEADER, keys);
|
|
1919
|
+
}
|
|
1652
1920
|
return {
|
|
1653
1921
|
responseInit,
|
|
1654
1922
|
headers
|
|
@@ -1661,13 +1929,17 @@ function redirect(url, init = 302) {
|
|
|
1661
1929
|
const {
|
|
1662
1930
|
responseInit,
|
|
1663
1931
|
headers
|
|
1664
|
-
} = initWithRevalidate(
|
|
1665
|
-
status: init
|
|
1666
|
-
} : init);
|
|
1932
|
+
} = initWithRevalidate(init);
|
|
1667
1933
|
if (responseInit.status === undefined) {
|
|
1668
1934
|
responseInit.status = 302;
|
|
1669
1935
|
}
|
|
1670
|
-
|
|
1936
|
+
const target = typeof url === "string" ? url : url[HREF];
|
|
1937
|
+
const location = typeof target === "string" ? target : String(url);
|
|
1938
|
+
const encoded = location.replace(/[^\x00-\x7f]/gu, encodeURIComponent);
|
|
1939
|
+
if (encoded.length > RESPONSE_HEADER_VALUE_LIMIT) {
|
|
1940
|
+
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.`);
|
|
1941
|
+
}
|
|
1942
|
+
headers.set("Location", encoded);
|
|
1671
1943
|
return new Response(null, {
|
|
1672
1944
|
...responseInit,
|
|
1673
1945
|
headers
|
|
@@ -1683,11 +1955,19 @@ function reload(init = {}) {
|
|
|
1683
1955
|
headers
|
|
1684
1956
|
});
|
|
1685
1957
|
}
|
|
1958
|
+
const NULL_BODY_STATUSES = new Set([204, 205, 304]);
|
|
1686
1959
|
function respond(value, init = {}) {
|
|
1687
1960
|
const {
|
|
1688
1961
|
responseInit,
|
|
1689
1962
|
headers
|
|
1690
1963
|
} = initWithRevalidate(init);
|
|
1964
|
+
for (const header of COMPOSED_BODY_FRAMING) headers.delete(header);
|
|
1965
|
+
if (NULL_BODY_STATUSES.has(responseInit.status)) {
|
|
1966
|
+
return new ResponseEnvelope(new Response(null, {
|
|
1967
|
+
...responseInit,
|
|
1968
|
+
headers
|
|
1969
|
+
}), value);
|
|
1970
|
+
}
|
|
1691
1971
|
headers.set("Content-Type", "application/json");
|
|
1692
1972
|
return new ResponseEnvelope(new Response(JSON.stringify(value), {
|
|
1693
1973
|
...responseInit,
|
|
@@ -1695,26 +1975,8 @@ function respond(value, init = {}) {
|
|
|
1695
1975
|
}), value);
|
|
1696
1976
|
}
|
|
1697
1977
|
|
|
1698
|
-
const mergeProps = merge;
|
|
1699
1978
|
const isServer = false;
|
|
1700
1979
|
const isDev = false;
|
|
1701
|
-
function render(code, element, init, options = {}) {
|
|
1702
|
-
try {
|
|
1703
|
-
const dispose = render$1(code, element, init, {
|
|
1704
|
-
...options,
|
|
1705
|
-
insertOptions: {
|
|
1706
|
-
schedule: true
|
|
1707
|
-
}
|
|
1708
|
-
});
|
|
1709
|
-
flush();
|
|
1710
|
-
return dispose;
|
|
1711
|
-
} finally {
|
|
1712
|
-
}
|
|
1713
|
-
}
|
|
1714
|
-
const hydrate = (...args) => {
|
|
1715
|
-
enableHydration();
|
|
1716
|
-
return hydrate$1(...args);
|
|
1717
|
-
};
|
|
1718
1980
|
function Portal(props) {
|
|
1719
1981
|
return runWithOwner(createOwner(), () => portalImpl(props));
|
|
1720
1982
|
}
|
|
@@ -1767,12 +2029,13 @@ function portalImpl(props) {
|
|
|
1767
2029
|
});
|
|
1768
2030
|
return treeMarker;
|
|
1769
2031
|
}
|
|
1770
|
-
const COMPONENT_BINDING = Symbol.for("
|
|
2032
|
+
const COMPONENT_BINDING = Symbol.for("solid.component-binding");
|
|
2033
|
+
const FLIGHT = Symbol("solid.dynamic-flight");
|
|
1771
2034
|
function bindingOf(value) {
|
|
1772
2035
|
return value !== null && (typeof value === "function" || typeof value === "object") && value[COMPONENT_BINDING] || undefined;
|
|
1773
2036
|
}
|
|
1774
|
-
function dynamic(source) {
|
|
1775
|
-
|
|
2037
|
+
function dynamic(source, options) {
|
|
2038
|
+
if (options?.static) return staticDynamic(untrack(source));
|
|
1776
2039
|
const sites = new Set();
|
|
1777
2040
|
let deliveredAddress;
|
|
1778
2041
|
const resolveBinding = (next, prev) => {
|
|
@@ -1786,25 +2049,58 @@ function dynamic(source) {
|
|
|
1786
2049
|
}
|
|
1787
2050
|
return next;
|
|
1788
2051
|
};
|
|
2052
|
+
const sameInstance = (prev, next) => {
|
|
2053
|
+
if (prev === next) return true;
|
|
2054
|
+
const held = bindingOf(prev);
|
|
2055
|
+
const incoming = bindingOf(next);
|
|
2056
|
+
if (!held || !incoming || held.component !== incoming.component) return false;
|
|
2057
|
+
if (held.address === incoming.address) return true;
|
|
2058
|
+
if (deliveredAddress === undefined) return false;
|
|
2059
|
+
if (incoming.address !== deliveredAddress) {
|
|
2060
|
+
deliveredAddress = incoming.address;
|
|
2061
|
+
for (const deliver of sites) deliver(incoming.address);
|
|
2062
|
+
}
|
|
2063
|
+
return true;
|
|
2064
|
+
};
|
|
1789
2065
|
const cached = createMemo(prev => {
|
|
1790
2066
|
const next = source();
|
|
1791
2067
|
if (!next || typeof next.then !== "function") return resolveBinding(next, prev);
|
|
1792
|
-
const token = ++latest;
|
|
1793
2068
|
return {
|
|
1794
|
-
|
|
2069
|
+
[FLIGHT]: next
|
|
1795
2070
|
};
|
|
1796
2071
|
}, {
|
|
1797
|
-
lazy: true
|
|
2072
|
+
lazy: true,
|
|
2073
|
+
equals: sameInstance
|
|
1798
2074
|
});
|
|
1799
2075
|
return props => {
|
|
2076
|
+
if (sharedConfig.hydrating) {
|
|
2077
|
+
try {
|
|
2078
|
+
untrack(cached);
|
|
2079
|
+
} catch {}
|
|
2080
|
+
}
|
|
2081
|
+
let latest = 0;
|
|
2082
|
+
const value = createMemo(prev => {
|
|
2083
|
+
const c = cached();
|
|
2084
|
+
if (!c || !c[FLIGHT]) return resolveBinding(c, prev);
|
|
2085
|
+
const next = c[FLIGHT];
|
|
2086
|
+
const token = ++latest;
|
|
2087
|
+
return {
|
|
2088
|
+
then: (onFulfilled, onRejected) => next.then(resolved => {
|
|
2089
|
+
const landed = token === latest ? resolveBinding(resolved, prev) : resolved;
|
|
2090
|
+
return onFulfilled ? onFulfilled(landed) : landed;
|
|
2091
|
+
}, onRejected)
|
|
2092
|
+
};
|
|
2093
|
+
}, {
|
|
2094
|
+
equals: sameInstance
|
|
2095
|
+
});
|
|
1800
2096
|
return createMemo(() => {
|
|
1801
|
-
const component =
|
|
2097
|
+
const component = value();
|
|
1802
2098
|
switch (typeof component) {
|
|
1803
2099
|
case "function":
|
|
1804
2100
|
{
|
|
1805
2101
|
const binding = bindingOf(component);
|
|
1806
2102
|
if (binding) {
|
|
1807
|
-
const [address, setAddress] = createSignal(deliveredAddress
|
|
2103
|
+
const [address, setAddress] = createSignal(deliveredAddress ??= binding.address);
|
|
1808
2104
|
sites.add(setAddress);
|
|
1809
2105
|
onCleanup(() => sites.delete(setAddress));
|
|
1810
2106
|
return untrack(() => binding.component(props, address));
|
|
@@ -1812,19 +2108,38 @@ function dynamic(source) {
|
|
|
1812
2108
|
return untrack(() => component(props));
|
|
1813
2109
|
}
|
|
1814
2110
|
case "string":
|
|
1815
|
-
|
|
1816
|
-
spread(el, props);
|
|
1817
|
-
return el;
|
|
2111
|
+
return staticElement(component, props);
|
|
1818
2112
|
}
|
|
1819
2113
|
});
|
|
1820
2114
|
};
|
|
1821
2115
|
}
|
|
2116
|
+
function staticDynamic(component) {
|
|
2117
|
+
if (typeof component === "function") {
|
|
2118
|
+
const binding = bindingOf(component);
|
|
2119
|
+
if (binding) {
|
|
2120
|
+
const address = () => binding.address;
|
|
2121
|
+
return props => untrack(() => binding.component(props, address));
|
|
2122
|
+
}
|
|
2123
|
+
return props => untrack(() => component(props));
|
|
2124
|
+
}
|
|
2125
|
+
if (typeof component === "string") return props => staticElement(component, props);
|
|
2126
|
+
return () => undefined;
|
|
2127
|
+
}
|
|
2128
|
+
function staticElement(tag, props) {
|
|
2129
|
+
const hydrating = sharedConfig.hydrating;
|
|
2130
|
+
const el = hydrating ? getNextElement() : createElement(tag, untrack(() => props.is), untrack(() => props.xmlns));
|
|
2131
|
+
spread(el, props);
|
|
2132
|
+
if (hydrating) runHydrationEvents();
|
|
2133
|
+
return el;
|
|
2134
|
+
}
|
|
1822
2135
|
function Dynamic(props) {
|
|
1823
2136
|
const Comp = dynamic(() => props.component);
|
|
1824
2137
|
return createComponent(Comp, omit(props, "component"));
|
|
1825
2138
|
}
|
|
1826
|
-
function createElement(tagName, is = undefined) {
|
|
1827
|
-
return
|
|
2139
|
+
function createElement(tagName, is = undefined, xmlns = undefined) {
|
|
2140
|
+
return xmlns ? document.createElementNS(xmlns, tagName, {
|
|
2141
|
+
is
|
|
2142
|
+
}) : SVGElements.has(tagName) ? document.createElementNS(Namespaces.svg, tagName) : MathMLElements.has(tagName) ? document.createElementNS(Namespaces.mathml, tagName) : document.createElement(tagName, {
|
|
1828
2143
|
is
|
|
1829
2144
|
});
|
|
1830
2145
|
}
|
|
@@ -1856,4 +2171,4 @@ _moduleUrl) {
|
|
|
1856
2171
|
function httpStatus(_code, _text) {}
|
|
1857
2172
|
function httpHeader(_name, _value, _options) {}
|
|
1858
2173
|
|
|
1859
|
-
export { ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF,
|
|
2174
|
+
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, dynamic, dynamicProperty, effect, escape, generateHydrationScript, getDelegatedRoot, getExpectedRedirectStatus, getFirstChild, getHydrationKey, getNextElement, getNextMarker, getNextMatch, getNextSibling, getRequestEvent, getServerFunctionMetadata, getServerFunctionRPC, getTraceContext, hasFlashCookie, httpHeader, httpStatus, hydrate, insert, installHydrationRuntime, isDev, isHref, isResponseEnvelope, isSafeError, isServer, isServerFunction, markSafeError, memo, parseCookieHeader, readShallow, redirect, ref, registerDelegatedContainer, registerDelegatedRoot, registerElementClaim, reload, render, renderToStream, renderToString, resolveSSRNode, respond, runHydrationEvents, scope, serializeCookie, setAttribute, setAttributeNS, setProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrElementAttribute, ssrGroup, ssrHydrationKey, ssrStyle, ssrStyleProperty, style, template, unregisterDelegatedContainer, unregisterDelegatedRoot, useHead, waitAsset, warmAsset };
|