@solidjs/web 2.0.0-rc.5 → 2.0.0-rc.7
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.cjs +122 -38
- package/dist/server.dev.cjs +3794 -0
- package/dist/server.dev.js +3627 -0
- package/dist/server.js +123 -39
- package/dist/web.cjs +102 -366
- package/dist/{dev.cjs → web.dev.cjs} +153 -376
- package/dist/{dev.js → web.dev.js} +155 -374
- package/dist/web.js +104 -364
- package/frames/dist/client.cjs +11 -3
- package/frames/dist/client.dev.cjs +11 -3
- package/frames/dist/client.dev.js +11 -3
- package/frames/dist/client.js +11 -3
- package/frames/dist/server.cjs +320 -53
- package/frames/dist/server.dev.cjs +4584 -0
- package/frames/dist/server.dev.js +4571 -0
- package/frames/dist/server.js +320 -53
- package/frames/package.json +10 -0
- package/package.json +78 -8
- package/serialization/dist/decode.cjs +18 -4
- package/serialization/dist/decode.js +18 -4
- package/serialization/dist/serialization.cjs +18 -4
- package/serialization/dist/serialization.js +18 -4
- package/server-functions/dist/client.cjs +27 -16
- package/server-functions/dist/client.js +27 -16
- package/server-functions/dist/server.cjs +529 -131
- package/server-functions/dist/server.dev.cjs +536 -130
- package/server-functions/dist/server.dev.js +536 -130
- package/server-functions/dist/server.js +529 -131
- package/types/client.d.ts +1 -3
- package/types/constants.d.ts +3 -1
- package/types/frames/frame-client.d.ts +1 -1
- package/types/head.d.ts +3 -0
- package/types/index.d.ts +18 -7
- package/types/index.server.d.ts +31 -9
- package/types/render.d.ts +3 -1
- package/types/server-functions/flash.d.ts +12 -3
- package/types/server-functions/server.d.ts +100 -5
- package/types/server-mock.d.ts +43 -7
- package/types/server.d.ts +47 -5
- package/types-cjs/client.d.cts +1 -3
- package/types-cjs/constants.d.cts +3 -1
- package/types-cjs/frames/frame-client.d.cts +1 -1
- package/types-cjs/head.d.cts +3 -0
- package/types-cjs/index.d.cts +18 -7
- package/types-cjs/index.server.d.cts +31 -9
- package/types-cjs/render.d.cts +3 -1
- package/types-cjs/server-functions/flash.d.cts +12 -3
- package/types-cjs/server-functions/server.d.cts +100 -5
- package/types-cjs/server-mock.d.cts +43 -7
- package/types-cjs/server.d.cts +47 -5
- package/types/patch-driver.d.ts +0 -3
- package/types-cjs/patch-driver.d.cts +0 -3
package/dist/web.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createRenderEffect, createMemo, sharedConfig, enableHydration, untrack, runWithOwner, createRoot, flatten, flush,
|
|
1
|
+
import { createRenderEffect, createMemo, sharedConfig, enableHydration, untrack, runWithOwner, createRoot, flatten, flush, createComponent, omit, createOwner, createSignal, onCleanup, getOwner, createEffect } from 'solid-js';
|
|
2
2
|
export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, Show, Switch, createComponent, getOwner, merge as mergeProps, untrack } from 'solid-js';
|
|
3
3
|
|
|
4
4
|
const DOMWithState = {
|
|
@@ -48,6 +48,7 @@ const Namespaces = {
|
|
|
48
48
|
const VoidElements = /*#__PURE__*/new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr"]);
|
|
49
49
|
const RawTextElements = /*#__PURE__*/new Set(["style", "script", "noscript", "template", "textarea", "title"]);
|
|
50
50
|
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(","));
|
|
51
|
+
const COMPOSED_BODY_FRAMING = /*#__PURE__*/new Set(["content-length", "content-encoding", "transfer-encoding"]);
|
|
51
52
|
|
|
52
53
|
const transparentOptions = {
|
|
53
54
|
transparent: true,
|
|
@@ -57,11 +58,12 @@ const syncOptions = {
|
|
|
57
58
|
sync: true
|
|
58
59
|
};
|
|
59
60
|
function effect(fn, effectFn, options) {
|
|
60
|
-
|
|
61
|
+
const nodeOptions = options ? {
|
|
61
62
|
sync: true,
|
|
62
63
|
...options,
|
|
63
64
|
transparent: !options.scope
|
|
64
|
-
} : transparentOptions
|
|
65
|
+
} : transparentOptions;
|
|
66
|
+
createRenderEffect(fn, effectFn, nodeOptions);
|
|
65
67
|
}
|
|
66
68
|
function memo(fn) {
|
|
67
69
|
return createMemo(() => fn(), syncOptions);
|
|
@@ -210,12 +212,24 @@ function classifyHeadTag(desc) {
|
|
|
210
212
|
resource: false
|
|
211
213
|
};
|
|
212
214
|
}
|
|
215
|
+
function qualifierValue(name, value) {
|
|
216
|
+
if (value == null || value === false) return null;
|
|
217
|
+
if (name === "imagesrcset" || name === "imagesizes") return typeof value === "string" && value !== "" ? value : null;
|
|
218
|
+
const v = value === true ? "" : String(value);
|
|
219
|
+
if (name === "as") return asciiLowerCase(v);
|
|
220
|
+
if (name !== "crossorigin") return v;
|
|
221
|
+
return v.length === 15 && v.toLowerCase() === "use-credentials" ? v.toLowerCase() : "anonymous";
|
|
222
|
+
}
|
|
223
|
+
function asciiLowerCase(value) {
|
|
224
|
+
return value.replace(/[A-Z]/g, c => String.fromCharCode(c.charCodeAt(0) + 32));
|
|
225
|
+
}
|
|
213
226
|
function resourceIdentity(tag, props) {
|
|
214
|
-
|
|
227
|
+
const url = String(props.href || props.src || "");
|
|
228
|
+
let id = "res:" + tag + ":" + (props.rel || "") + ":" + url.length + ":" + url;
|
|
215
229
|
for (let i = 0; i < RESOURCE_QUALIFIERS.length; i++) {
|
|
216
230
|
const q = RESOURCE_QUALIFIERS[i];
|
|
217
|
-
const value = props[q];
|
|
218
|
-
if (value
|
|
231
|
+
const value = qualifierValue(q, props[q]);
|
|
232
|
+
if (value !== null) id += ":" + q + "=" + value.length + ":" + value;
|
|
219
233
|
}
|
|
220
234
|
return id;
|
|
221
235
|
}
|
|
@@ -334,11 +348,9 @@ const waitAsset = promise => {
|
|
|
334
348
|
}
|
|
335
349
|
gate();
|
|
336
350
|
};
|
|
337
|
-
let listDriver;
|
|
338
|
-
function installListDriver(driver) {
|
|
339
|
-
listDriver = driver;
|
|
340
|
-
}
|
|
341
351
|
const $$EVENT_OWNER = "_$SOLID_EVENT_OWNER";
|
|
352
|
+
const $$EVENT_TUPLE = Symbol();
|
|
353
|
+
const hasOwn = Object.prototype.hasOwnProperty;
|
|
342
354
|
const INNER_OWNED = {};
|
|
343
355
|
const delegatedEvents = new Set();
|
|
344
356
|
const delegatedContainers = new Map();
|
|
@@ -456,7 +468,8 @@ function findOwner(target, state) {
|
|
|
456
468
|
}
|
|
457
469
|
function setProperty(node, name, value) {
|
|
458
470
|
if (isHydrating(node)) return;
|
|
459
|
-
|
|
471
|
+
const nodeName = node.nodeName;
|
|
472
|
+
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;
|
|
460
473
|
}
|
|
461
474
|
let claimHandlers = null;
|
|
462
475
|
const CLAIM_SEAM = Symbol.for("solid.element-claims");
|
|
@@ -490,7 +503,17 @@ function claimElement(node) {
|
|
|
490
503
|
}
|
|
491
504
|
function setAttribute(node, name, value) {
|
|
492
505
|
if (isHydrating(node)) return;
|
|
493
|
-
|
|
506
|
+
const selectMultiple = name === "multiple" && node.localName === "select";
|
|
507
|
+
if (value == null || value === false) node.removeAttribute(name);else {
|
|
508
|
+
node.setAttribute(name, value === true ? "" : value);
|
|
509
|
+
if (selectMultiple && !node._$multiple) {
|
|
510
|
+
const options = node.options;
|
|
511
|
+
for (let i = 0; i < options.length; i++) {
|
|
512
|
+
if (options[i].defaultSelected) options[i].selected = true;
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
if (selectMultiple) node._$multiple = true;
|
|
494
517
|
if (claimHandlers !== null && (name === "href" || name === "action")) claimElement(node);
|
|
495
518
|
}
|
|
496
519
|
function setAttributeNS(node, namespace, name, value) {
|
|
@@ -498,22 +521,32 @@ function setAttributeNS(node, namespace, name, value) {
|
|
|
498
521
|
if (value == null || value === false) node.removeAttributeNS(namespace, name.indexOf(":") > -1 ? name.split(":").pop() : name);else node.setAttributeNS(namespace, name, value === true ? "" : value);
|
|
499
522
|
}
|
|
500
523
|
function className(node, value, prev) {
|
|
501
|
-
if (
|
|
524
|
+
if (typeof value === "number") value = "" + value;
|
|
525
|
+
if (typeof prev === "number") prev = "" + prev;
|
|
526
|
+
if (isHydrating(node)) {
|
|
527
|
+
node._$classes = value && typeof value === "object" ? classListToObject(value) : undefined;
|
|
528
|
+
return;
|
|
529
|
+
}
|
|
502
530
|
if (value == null || value === false) {
|
|
503
|
-
prev
|
|
531
|
+
if (prev || node._$classes) {
|
|
532
|
+
node.removeAttribute("class");
|
|
533
|
+
node._$classes = undefined;
|
|
534
|
+
}
|
|
504
535
|
return;
|
|
505
536
|
}
|
|
506
537
|
if (typeof value === "string") {
|
|
538
|
+
node._$classes = undefined;
|
|
507
539
|
value !== prev && node.setAttribute("class", value);
|
|
508
540
|
return;
|
|
509
541
|
}
|
|
542
|
+
let applied;
|
|
510
543
|
if (typeof prev === "string") {
|
|
511
|
-
|
|
544
|
+
applied = {};
|
|
512
545
|
node.removeAttribute("class");
|
|
513
|
-
} else
|
|
546
|
+
} else applied = node._$classes || classListToObject(prev || {});
|
|
514
547
|
value = classListToObject(value);
|
|
515
|
-
const classKeys = Object.keys(value
|
|
516
|
-
const prevKeys = Object.keys(
|
|
548
|
+
const classKeys = Object.keys(value);
|
|
549
|
+
const prevKeys = Object.keys(applied);
|
|
517
550
|
let i, len;
|
|
518
551
|
for (i = 0, len = prevKeys.length; i < len; i++) {
|
|
519
552
|
const key = prevKeys[i];
|
|
@@ -523,22 +556,34 @@ function className(node, value, prev) {
|
|
|
523
556
|
for (i = 0, len = classKeys.length; i < len; i++) {
|
|
524
557
|
const key = classKeys[i],
|
|
525
558
|
classValue = !!value[key];
|
|
526
|
-
if (!key || key === "undefined" ||
|
|
559
|
+
if (!key || key === "undefined" || applied[key] === classValue || !classValue) continue;
|
|
527
560
|
node.classList.add(key);
|
|
528
561
|
}
|
|
562
|
+
node._$classes = value;
|
|
529
563
|
}
|
|
530
564
|
function addEvent(node, name, handler, delegate) {
|
|
531
565
|
if (delegate) {
|
|
566
|
+
const key = `$$${name}`;
|
|
567
|
+
let data;
|
|
532
568
|
if (Array.isArray(handler)) {
|
|
533
|
-
|
|
534
|
-
node[
|
|
535
|
-
} else node[
|
|
536
|
-
|
|
569
|
+
data = handler[1];
|
|
570
|
+
node[key] = handler[0];
|
|
571
|
+
} else node[key] = handler;
|
|
572
|
+
node[`${key}Data`] = data;
|
|
573
|
+
return;
|
|
574
|
+
}
|
|
575
|
+
if (Array.isArray(handler)) {
|
|
537
576
|
const handlerFn = handler[0];
|
|
538
|
-
|
|
539
|
-
|
|
577
|
+
const listener = e => handlerFn.call(node, handler[1], e);
|
|
578
|
+
listener[$$EVENT_TUPLE] = handler;
|
|
579
|
+
node.addEventListener(name, listener);
|
|
580
|
+
return listener;
|
|
581
|
+
}
|
|
582
|
+
node.addEventListener(name, handler, typeof handler !== "function" && handler);
|
|
583
|
+
return handler;
|
|
540
584
|
}
|
|
541
585
|
function style(node, value, prev) {
|
|
586
|
+
if (isHydrating(node)) return;
|
|
542
587
|
if (!value) {
|
|
543
588
|
if (prev || node._$styles) {
|
|
544
589
|
setAttribute(node, "style");
|
|
@@ -563,12 +608,13 @@ function style(node, value, prev) {
|
|
|
563
608
|
}
|
|
564
609
|
let v, s;
|
|
565
610
|
for (s in applied) {
|
|
566
|
-
if (value[s] == null) {
|
|
611
|
+
if (!hasOwn.call(value, s) || value[s] == null) {
|
|
567
612
|
nodeStyle.removeProperty(s);
|
|
568
613
|
delete applied[s];
|
|
569
614
|
}
|
|
570
615
|
}
|
|
571
616
|
for (s in value) {
|
|
617
|
+
if (!hasOwn.call(value, s)) continue;
|
|
572
618
|
v = value[s];
|
|
573
619
|
if (v != null && v !== applied[s]) {
|
|
574
620
|
nodeStyle.setProperty(s, v);
|
|
@@ -577,20 +623,26 @@ function style(node, value, prev) {
|
|
|
577
623
|
}
|
|
578
624
|
}
|
|
579
625
|
function setStyleProperty(node, name, value) {
|
|
626
|
+
if (isHydrating(node)) return;
|
|
580
627
|
value != null ? node.style.setProperty(name, value) : node.style.removeProperty(name);
|
|
581
628
|
}
|
|
582
|
-
function spread(node, props
|
|
629
|
+
function spread(node, props, skipChildren) {
|
|
583
630
|
const prevProps = {};
|
|
584
|
-
const get = typeof props === "function" ? props :
|
|
585
|
-
if (!skipChildren) insert(node, () =>
|
|
631
|
+
const get = () => (typeof props === "function" ? props() : props) ?? {};
|
|
632
|
+
if (!skipChildren) insert(node, () => {
|
|
633
|
+
const source = get();
|
|
634
|
+
return hasOwn.call(source, "children") ? source.children : undefined;
|
|
635
|
+
});
|
|
586
636
|
effect(() => {
|
|
587
|
-
const
|
|
637
|
+
const source = get();
|
|
638
|
+
const r = hasOwn.call(source, "ref") && source.ref;
|
|
588
639
|
(typeof r === "function" || Array.isArray(r)) && ref(() => r, node);
|
|
589
640
|
}, () => {});
|
|
590
641
|
effect(() => {
|
|
591
642
|
const source = get();
|
|
592
643
|
const newProps = {};
|
|
593
644
|
for (const prop in source) {
|
|
645
|
+
if (!hasOwn.call(source, prop)) continue;
|
|
594
646
|
if (prop === "children" || prop === "ref") continue;
|
|
595
647
|
newProps[prop] = source[prop];
|
|
596
648
|
}
|
|
@@ -683,11 +735,6 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
683
735
|
const host = options && options.host;
|
|
684
736
|
if (multi && !initial) initial = [];
|
|
685
737
|
if (hydrationRt !== null) initial = hydrationRt.claimInitial(parent, multi, initial);
|
|
686
|
-
if (listDriver !== undefined && typeof accessor === "function" && accessor.$ll !== undefined) {
|
|
687
|
-
const listAccessor = accessor;
|
|
688
|
-
const owner = getOwner();
|
|
689
|
-
if (listDriver(parent, accessor, marker, () => runWithOwner(owner, () => insert(parent, () => listAccessor(), marker, marker !== undefined ? [] : undefined, options)))) return;
|
|
690
|
-
}
|
|
691
738
|
if (typeof accessor !== "function") {
|
|
692
739
|
accessor = normalize(accessor, initial, multi, true);
|
|
693
740
|
if (typeof accessor !== "function") {
|
|
@@ -747,10 +794,16 @@ function assetEntryKey(descriptor) {
|
|
|
747
794
|
if (descriptor.policy === "exclusive") return "x|" + descriptor.key;
|
|
748
795
|
return descriptor.type === "inline-style" ? "i|" + descriptor.id : descriptor.type + "|" + descriptor.href;
|
|
749
796
|
}
|
|
750
|
-
function findAssetElement(selector, attr, value) {
|
|
797
|
+
function findAssetElement(selector, attr, value, qualifiers) {
|
|
751
798
|
const nodes = document.querySelectorAll(selector);
|
|
752
|
-
for (let i = 0; i < nodes.length; i++) {
|
|
753
|
-
if (nodes[i].getAttribute(attr)
|
|
799
|
+
outer: for (let i = 0; i < nodes.length; i++) {
|
|
800
|
+
if (nodes[i].getAttribute(attr) !== value) continue;
|
|
801
|
+
if (!qualifiers) return nodes[i];
|
|
802
|
+
for (let q = 0; q < RESOURCE_QUALIFIERS.length; q++) {
|
|
803
|
+
const name = RESOURCE_QUALIFIERS[q];
|
|
804
|
+
if (qualifierValue(name, qualifiers[name]) !== qualifierValue(name, nodes[i].getAttribute(name))) continue outer;
|
|
805
|
+
}
|
|
806
|
+
return nodes[i];
|
|
754
807
|
}
|
|
755
808
|
return null;
|
|
756
809
|
}
|
|
@@ -1054,8 +1107,8 @@ function mountHeadResource(tag, props) {
|
|
|
1054
1107
|
headMountedResources.add(identity);
|
|
1055
1108
|
const url = props.href || props.src;
|
|
1056
1109
|
let el = null;
|
|
1057
|
-
if (url != null) {
|
|
1058
|
-
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);
|
|
1110
|
+
if (tag === "link" && url == null && typeof props.imagesrcset === "string") el = findAssetElement(`link[rel="${props.rel}"]`, "href", null, props);else if (url != null) {
|
|
1111
|
+
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);
|
|
1059
1112
|
}
|
|
1060
1113
|
if (!el) document.head.appendChild(createHeadElement(tag, props));
|
|
1061
1114
|
}
|
|
@@ -1366,7 +1419,8 @@ function classListToObject(classList) {
|
|
|
1366
1419
|
function flattenClassList(list, result) {
|
|
1367
1420
|
for (let i = 0, len = list.length; i < len; i++) {
|
|
1368
1421
|
const item = list[i];
|
|
1369
|
-
if (Array.isArray(item)) flattenClassList(item, result);else if (typeof item === "object" && item != null) Object.assign(result, item);
|
|
1422
|
+
if (Array.isArray(item)) flattenClassList(item, result);else if (typeof item === "object" && item != null) Object.assign(result, item);
|
|
1423
|
+
else if (typeof item !== "boolean" && (item || item === 0)) result[item] = true;
|
|
1370
1424
|
}
|
|
1371
1425
|
}
|
|
1372
1426
|
function assignProp(node, prop, value, prev, skipRef, nodeName) {
|
|
@@ -1382,12 +1436,13 @@ function assignProp(node, prop, value, prev, skipRef, nodeName) {
|
|
|
1382
1436
|
const name = prop.slice(2).toLowerCase();
|
|
1383
1437
|
const delegate = DelegatedEvents.has(name);
|
|
1384
1438
|
if (!delegate && prev) {
|
|
1385
|
-
|
|
1386
|
-
node.removeEventListener(name,
|
|
1439
|
+
if (Array.isArray(value) && typeof prev === "function" && prev[$$EVENT_TUPLE] === value) return prev;
|
|
1440
|
+
node.removeEventListener(name, prev, typeof prev !== "function" && prev);
|
|
1387
1441
|
}
|
|
1388
1442
|
if (delegate || value) {
|
|
1389
|
-
addEvent(node, name, value, delegate);
|
|
1443
|
+
const attached = addEvent(node, name, value, delegate);
|
|
1390
1444
|
delegate && delegateEvents([name]);
|
|
1445
|
+
if (!delegate) return attached;
|
|
1391
1446
|
}
|
|
1392
1447
|
} else if (hasNamespace && prop.slice(0, 5) === "prop:" || ChildProperties.has(prop) || DOMWithState[nodeName]?.[prop]) {
|
|
1393
1448
|
if (hasNamespace) prop = prop.slice(5);else if (isHydrating(node)) return value;
|
|
@@ -1427,7 +1482,7 @@ function eventHandler(e, container, state) {
|
|
|
1427
1482
|
}
|
|
1428
1483
|
if (handler && !node.disabled) {
|
|
1429
1484
|
const data = node[`${key}Data`];
|
|
1430
|
-
data !== undefined ? handler.call(node, data, e) : handler.call(node, e);
|
|
1485
|
+
data !== undefined ? handler.call(node, data, e) : typeof handler === "function" ? handler.call(node, e) : handler.handleEvent(e);
|
|
1431
1486
|
if (e.cancelBubble) return;
|
|
1432
1487
|
}
|
|
1433
1488
|
node.host && typeof node.host !== "string" && !node.host._$host && node.contains(e.target) && retarget(node.host);
|
|
@@ -1547,7 +1602,7 @@ function normalize(value, current, multi, doNotUnwrap) {
|
|
|
1547
1602
|
const item = value[i],
|
|
1548
1603
|
prev = current && current[i],
|
|
1549
1604
|
t = typeof item;
|
|
1550
|
-
if ((t === "string" || t === "number") && prev && prev.nodeType === 3) value[i] = prev;
|
|
1605
|
+
if ((t === "string" || t === "number") && prev && prev.nodeType === 3 && isHydrating(prev)) value[i] = prev;
|
|
1551
1606
|
}
|
|
1552
1607
|
}
|
|
1553
1608
|
return value;
|
|
@@ -1630,322 +1685,6 @@ function getHydrationKey() {
|
|
|
1630
1685
|
}
|
|
1631
1686
|
const RequestContext = Symbol();
|
|
1632
1687
|
|
|
1633
|
-
const PURE_ROW = Symbol.for("solid.pure-row");
|
|
1634
|
-
const arm = () => {
|
|
1635
|
-
installListDriver(driveList);
|
|
1636
|
-
};
|
|
1637
|
-
function rowProof(fn) {
|
|
1638
|
-
arm();
|
|
1639
|
-
fn[PURE_ROW] = true;
|
|
1640
|
-
return fn;
|
|
1641
|
-
}
|
|
1642
|
-
let rowCollector = null;
|
|
1643
|
-
const lisPositions = sources => {
|
|
1644
|
-
const n = sources.length;
|
|
1645
|
-
const tails = [];
|
|
1646
|
-
const tailsIdx = [];
|
|
1647
|
-
const prev = new Array(n).fill(-1);
|
|
1648
|
-
for (let j = 0; j < n; j++) {
|
|
1649
|
-
const v = sources[j];
|
|
1650
|
-
if (v === -1) continue;
|
|
1651
|
-
let lo = 0,
|
|
1652
|
-
hi = tails.length;
|
|
1653
|
-
while (lo < hi) {
|
|
1654
|
-
const mid = lo + hi >> 1;
|
|
1655
|
-
if (tails[mid] < v) lo = mid + 1;else hi = mid;
|
|
1656
|
-
}
|
|
1657
|
-
if (lo > 0) prev[j] = tailsIdx[lo - 1];
|
|
1658
|
-
tails[lo] = v;
|
|
1659
|
-
tailsIdx[lo] = j;
|
|
1660
|
-
}
|
|
1661
|
-
const stable = new Set();
|
|
1662
|
-
let k = tailsIdx.length ? tailsIdx[tails.length - 1] : -1;
|
|
1663
|
-
while (k >= 0) {
|
|
1664
|
-
stable.add(k);
|
|
1665
|
-
k = prev[k];
|
|
1666
|
-
}
|
|
1667
|
-
return stable;
|
|
1668
|
-
};
|
|
1669
|
-
const driveList = (parent, listFn, marker, lateClassic) => {
|
|
1670
|
-
const meta = listFn.$ll;
|
|
1671
|
-
if (meta.row?.[PURE_ROW] !== true) return false;
|
|
1672
|
-
if (typeof meta.keyed === "function") return false;
|
|
1673
|
-
const evalOwner = createOwner({
|
|
1674
|
-
id: "&each"
|
|
1675
|
-
});
|
|
1676
|
-
let subject = runWithOwner(evalOwner, () => untrack(meta.each));
|
|
1677
|
-
evalOwner.dispose();
|
|
1678
|
-
let raw = subject != null ? patchableRaw(subject) : undefined;
|
|
1679
|
-
if (raw === undefined || !Array.isArray(raw)) return false;
|
|
1680
|
-
const optimistic = storeHasOptimisticFamily(subject);
|
|
1681
|
-
if (optimistic) raw = untrack(() => Array.from(subject));
|
|
1682
|
-
const hydrating = !!sharedConfig.hydrating;
|
|
1683
|
-
if (hydrating && raw.length === 0) return false;
|
|
1684
|
-
let domRows;
|
|
1685
|
-
let rowIds;
|
|
1686
|
-
if (hydrating) {
|
|
1687
|
-
if (marker !== undefined) return false;
|
|
1688
|
-
domRows = Array.from(parent.children);
|
|
1689
|
-
if (domRows.length !== raw.length) return false;
|
|
1690
|
-
rowIds = new Array(raw.length);
|
|
1691
|
-
for (let i = 0; i < domRows.length; i++) {
|
|
1692
|
-
const key = domRows[i].getAttribute("_hk");
|
|
1693
|
-
if (key === null || !key.endsWith("0") || key.length < 2) return false;
|
|
1694
|
-
rowIds[i] = key.slice(0, -1);
|
|
1695
|
-
}
|
|
1696
|
-
}
|
|
1697
|
-
const rowFn = meta.row;
|
|
1698
|
-
const endAnchor = marker ?? null;
|
|
1699
|
-
const shallow = storeIsShallow(subject);
|
|
1700
|
-
let lastBodies = null;
|
|
1701
|
-
let lastUnbinds = null;
|
|
1702
|
-
const collectBind = (abs, build) => {
|
|
1703
|
-
const prevC = rowCollector;
|
|
1704
|
-
rowCollector = {
|
|
1705
|
-
row: shallow ? subject[abs] : undefined,
|
|
1706
|
-
bodies: [],
|
|
1707
|
-
unbinds: []
|
|
1708
|
-
};
|
|
1709
|
-
try {
|
|
1710
|
-
return build();
|
|
1711
|
-
} finally {
|
|
1712
|
-
lastBodies = rowCollector.bodies;
|
|
1713
|
-
lastUnbinds = rowCollector.unbinds;
|
|
1714
|
-
rowCollector = prevC;
|
|
1715
|
-
}
|
|
1716
|
-
};
|
|
1717
|
-
const listOwner = createOwner();
|
|
1718
|
-
let declined = false;
|
|
1719
|
-
const bindRow = (abs, claimId) => {
|
|
1720
|
-
return collectBind(abs, () => runWithOwner(listOwner, () => claimId !== undefined ? runWithOwner(createOwner({
|
|
1721
|
-
id: claimId
|
|
1722
|
-
}), () => untrack(() => rowFn(subject[abs]))) : untrack(() => rowFn(subject[abs]))));
|
|
1723
|
-
};
|
|
1724
|
-
let entries = new Array(raw.length);
|
|
1725
|
-
let rowBodies = shallow ? new Array(raw.length) : null;
|
|
1726
|
-
let rowUnbinds = new Array(raw.length);
|
|
1727
|
-
const runUnbinds = list => {
|
|
1728
|
-
if (list !== undefined) for (let u = 0; u < list.length; u++) list[u]();
|
|
1729
|
-
};
|
|
1730
|
-
const unbindAllRows = () => {
|
|
1731
|
-
for (let j = 0; j < rowUnbinds.length; j++) runUnbinds(rowUnbinds[j]);
|
|
1732
|
-
rowUnbinds = [];
|
|
1733
|
-
};
|
|
1734
|
-
let prevRaws = raw.slice();
|
|
1735
|
-
try {
|
|
1736
|
-
if (hydrating) {
|
|
1737
|
-
for (let i = 0; i < raw.length; i++) {
|
|
1738
|
-
entries[i] = bindRow(i, rowIds[i]);
|
|
1739
|
-
if (rowBodies !== null) rowBodies[i] = lastBodies;
|
|
1740
|
-
rowUnbinds[i] = lastUnbinds;
|
|
1741
|
-
}
|
|
1742
|
-
} else {
|
|
1743
|
-
for (let i = 0; i < raw.length; i++) {
|
|
1744
|
-
const node = bindRow(i);
|
|
1745
|
-
entries[i] = node;
|
|
1746
|
-
if (rowBodies !== null) rowBodies[i] = lastBodies;
|
|
1747
|
-
rowUnbinds[i] = lastUnbinds;
|
|
1748
|
-
parent.insertBefore(node, endAnchor);
|
|
1749
|
-
}
|
|
1750
|
-
}
|
|
1751
|
-
} catch (err) {
|
|
1752
|
-
unbindAllRows();
|
|
1753
|
-
runUnbinds(lastUnbinds ?? undefined);
|
|
1754
|
-
for (let j = 0; j < entries.length; j++) {
|
|
1755
|
-
const n = entries[j];
|
|
1756
|
-
if (n !== undefined && n.parentNode === parent) n.remove();
|
|
1757
|
-
}
|
|
1758
|
-
listOwner.dispose();
|
|
1759
|
-
throw err;
|
|
1760
|
-
}
|
|
1761
|
-
const identityOps = nextArr => {
|
|
1762
|
-
const keyOf = r => {
|
|
1763
|
-
const w = r != null ? patchableRaw(r) : undefined;
|
|
1764
|
-
return w !== undefined ? w : r;
|
|
1765
|
-
};
|
|
1766
|
-
const oldIndex = new Map();
|
|
1767
|
-
for (let j = 0; j < prevRaws.length; j++) {
|
|
1768
|
-
const k = keyOf(prevRaws[j]);
|
|
1769
|
-
const existing = oldIndex.get(k);
|
|
1770
|
-
if (existing === undefined) oldIndex.set(k, j);else if (Array.isArray(existing)) existing.push(j);else oldIndex.set(k, [existing, j]);
|
|
1771
|
-
}
|
|
1772
|
-
const sources = new Array(nextArr.length);
|
|
1773
|
-
for (let k = 0; k < nextArr.length; k++) {
|
|
1774
|
-
const m = oldIndex.get(keyOf(nextArr[k]));
|
|
1775
|
-
if (m === undefined) sources[k] = -1;else if (Array.isArray(m)) {
|
|
1776
|
-
sources[k] = m.shift();
|
|
1777
|
-
if (m.length === 1) oldIndex.set(keyOf(nextArr[k]), m[0]);
|
|
1778
|
-
} else {
|
|
1779
|
-
sources[k] = m;
|
|
1780
|
-
oldIndex.delete(keyOf(nextArr[k]));
|
|
1781
|
-
}
|
|
1782
|
-
}
|
|
1783
|
-
return {
|
|
1784
|
-
prefix: 0,
|
|
1785
|
-
sources
|
|
1786
|
-
};
|
|
1787
|
-
};
|
|
1788
|
-
let resyncNeeded = false;
|
|
1789
|
-
const applyOps = (next, ops) => {
|
|
1790
|
-
if (declined) return;
|
|
1791
|
-
if (resyncNeeded) ops = null;
|
|
1792
|
-
if (ops === null) ops = identityOps(next);
|
|
1793
|
-
const {
|
|
1794
|
-
prefix,
|
|
1795
|
-
sources
|
|
1796
|
-
} = ops;
|
|
1797
|
-
const built = new Array(sources.length);
|
|
1798
|
-
const builtBodies = rowBodies !== null ? new Array(sources.length) : null;
|
|
1799
|
-
const builtUnbinds = new Array(sources.length);
|
|
1800
|
-
let j = 0;
|
|
1801
|
-
try {
|
|
1802
|
-
for (; j < sources.length; j++) {
|
|
1803
|
-
const abs = prefix + j;
|
|
1804
|
-
const src = sources[j];
|
|
1805
|
-
if (src === -1 || refRebuild && src >= 0 && next[abs] !== prevRaws[src]) {
|
|
1806
|
-
built[j] = bindRow(abs);
|
|
1807
|
-
if (builtBodies !== null) builtBodies[j] = lastBodies;
|
|
1808
|
-
builtUnbinds[j] = lastUnbinds;
|
|
1809
|
-
}
|
|
1810
|
-
}
|
|
1811
|
-
} catch (err) {
|
|
1812
|
-
for (let k = 0; k < j; k++) runUnbinds(builtUnbinds[k]);
|
|
1813
|
-
runUnbinds(lastUnbinds ?? undefined);
|
|
1814
|
-
resyncNeeded = true;
|
|
1815
|
-
throw err;
|
|
1816
|
-
}
|
|
1817
|
-
const retained = new Set();
|
|
1818
|
-
for (let k = 0; k < sources.length; k++) {
|
|
1819
|
-
if (sources[k] >= 0 && built[k] === undefined) retained.add(sources[k]);
|
|
1820
|
-
}
|
|
1821
|
-
for (let k = prefix; k < entries.length; k++) {
|
|
1822
|
-
if (!retained.has(k)) {
|
|
1823
|
-
entries[k].remove();
|
|
1824
|
-
runUnbinds(rowUnbinds[k]);
|
|
1825
|
-
}
|
|
1826
|
-
}
|
|
1827
|
-
const newEntries = new Array(prefix + sources.length);
|
|
1828
|
-
const newBodies = rowBodies !== null ? new Array(prefix + sources.length) : null;
|
|
1829
|
-
const newUnbinds = new Array(prefix + sources.length);
|
|
1830
|
-
for (let i = 0; i < prefix; i++) {
|
|
1831
|
-
newEntries[i] = entries[i];
|
|
1832
|
-
if (newBodies !== null) newBodies[i] = rowBodies[i];
|
|
1833
|
-
newUnbinds[i] = rowUnbinds[i];
|
|
1834
|
-
}
|
|
1835
|
-
const stable = lisPositions(sources);
|
|
1836
|
-
let anchor = endAnchor;
|
|
1837
|
-
for (let k = sources.length - 1; k >= 0; k--) {
|
|
1838
|
-
const abs = prefix + k;
|
|
1839
|
-
const src = sources[k];
|
|
1840
|
-
let node;
|
|
1841
|
-
if (built[k] !== undefined) {
|
|
1842
|
-
node = built[k];
|
|
1843
|
-
if (newBodies !== null) newBodies[abs] = builtBodies[k];
|
|
1844
|
-
newUnbinds[abs] = builtUnbinds[k];
|
|
1845
|
-
parent.insertBefore(node, anchor);
|
|
1846
|
-
} else {
|
|
1847
|
-
node = entries[src];
|
|
1848
|
-
if (newBodies !== null) newBodies[abs] = rowBodies[src];
|
|
1849
|
-
newUnbinds[abs] = rowUnbinds[src];
|
|
1850
|
-
if (!stable.has(k)) parent.insertBefore(node, anchor);
|
|
1851
|
-
}
|
|
1852
|
-
newEntries[abs] = node;
|
|
1853
|
-
anchor = node;
|
|
1854
|
-
}
|
|
1855
|
-
entries = newEntries;
|
|
1856
|
-
if (newBodies !== null) rowBodies = newBodies;
|
|
1857
|
-
rowUnbinds = newUnbinds;
|
|
1858
|
-
prevRaws = next.slice();
|
|
1859
|
-
resyncNeeded = false;
|
|
1860
|
-
};
|
|
1861
|
-
let unbindOps = runWithOwner(listOwner, () => registerRowOps(subject, applyOps));
|
|
1862
|
-
const refRebuild = shallow && typeof meta.keyed !== "function";
|
|
1863
|
-
const rebuildSlot = i => {
|
|
1864
|
-
runUnbinds(rowUnbinds[i]);
|
|
1865
|
-
const old = entries[i];
|
|
1866
|
-
const node = bindRow(i);
|
|
1867
|
-
rowBodies[i] = lastBodies;
|
|
1868
|
-
rowUnbinds[i] = lastUnbinds;
|
|
1869
|
-
parent.insertBefore(node, old);
|
|
1870
|
-
old.remove();
|
|
1871
|
-
entries[i] = node;
|
|
1872
|
-
};
|
|
1873
|
-
const applySlot = (i, next, prev) => {
|
|
1874
|
-
if (declined) return;
|
|
1875
|
-
if (resyncNeeded) {
|
|
1876
|
-
const live = subject != null ? patchableRaw(subject) : undefined;
|
|
1877
|
-
if (live !== undefined && Array.isArray(live)) applyOps(live, null);
|
|
1878
|
-
return;
|
|
1879
|
-
}
|
|
1880
|
-
if (refRebuild) {
|
|
1881
|
-
rebuildSlot(i);
|
|
1882
|
-
prevRaws[i] = next;
|
|
1883
|
-
return;
|
|
1884
|
-
}
|
|
1885
|
-
const bodies = rowBodies[i];
|
|
1886
|
-
if (bodies !== undefined) {
|
|
1887
|
-
for (let b = 0; b < bodies.length; b++) bodies[b](next, prev, false);
|
|
1888
|
-
}
|
|
1889
|
-
prevRaws[i] = next;
|
|
1890
|
-
};
|
|
1891
|
-
let unbindSlots = shallow ? runWithOwner(listOwner, () => registerSlotPatch(subject, applySlot)) : null;
|
|
1892
|
-
runWithOwner(listOwner, () => effect(() => meta.each(), value => {
|
|
1893
|
-
if (declined || value === subject) return;
|
|
1894
|
-
const nextRaw = value != null ? patchableRaw(value) : undefined;
|
|
1895
|
-
unbindOps();
|
|
1896
|
-
unbindSlots?.();
|
|
1897
|
-
if (nextRaw !== undefined && Array.isArray(nextRaw) && storeIsShallow(value) !== shallow) {
|
|
1898
|
-
for (let j = 0; j < entries.length; j++) entries[j].remove();
|
|
1899
|
-
entries = [];
|
|
1900
|
-
prevRaws = [];
|
|
1901
|
-
unbindAllRows();
|
|
1902
|
-
subject = value;
|
|
1903
|
-
declined = true;
|
|
1904
|
-
listOwner.dispose();
|
|
1905
|
-
lateClassic?.();
|
|
1906
|
-
return;
|
|
1907
|
-
}
|
|
1908
|
-
if (nextRaw === undefined || !Array.isArray(nextRaw)) {
|
|
1909
|
-
for (let j = 0; j < entries.length; j++) entries[j].remove();
|
|
1910
|
-
entries = [];
|
|
1911
|
-
prevRaws = [];
|
|
1912
|
-
unbindAllRows();
|
|
1913
|
-
subject = value;
|
|
1914
|
-
declined = true;
|
|
1915
|
-
listOwner.dispose();
|
|
1916
|
-
lateClassic?.();
|
|
1917
|
-
return;
|
|
1918
|
-
}
|
|
1919
|
-
const swapOps = identityOps(nextRaw);
|
|
1920
|
-
subject = value;
|
|
1921
|
-
unbindOps = runWithOwner(listOwner, () => registerRowOps(subject, applyOps));
|
|
1922
|
-
if (shallow) unbindSlots = runWithOwner(listOwner, () => registerSlotPatch(subject, applySlot));
|
|
1923
|
-
applyOps(nextRaw, swapOps);
|
|
1924
|
-
}));
|
|
1925
|
-
onCleanup(() => {
|
|
1926
|
-
unbindOps();
|
|
1927
|
-
unbindSlots?.();
|
|
1928
|
-
unbindAllRows();
|
|
1929
|
-
listOwner.dispose();
|
|
1930
|
-
});
|
|
1931
|
-
return true;
|
|
1932
|
-
};
|
|
1933
|
-
const patchDriver = (subject, body) => {
|
|
1934
|
-
const raw = patchableRaw(subject);
|
|
1935
|
-
if (raw !== undefined) {
|
|
1936
|
-
if (!sharedConfig.hydrating) body(raw, undefined, true);
|
|
1937
|
-
const unbind = registerPatch(subject, body);
|
|
1938
|
-
if (rowCollector !== null) rowCollector.unbinds.push(unbind);
|
|
1939
|
-
else onCleanup(unbind);
|
|
1940
|
-
} else if (rowCollector !== null && subject === rowCollector.row) {
|
|
1941
|
-
rowCollector.bodies.push(body);
|
|
1942
|
-
if (!sharedConfig.hydrating) body(subject, undefined, true);
|
|
1943
|
-
} else {
|
|
1944
|
-
effect(() => body(subject, subject, false),
|
|
1945
|
-
() => untrack(() => body(subject, undefined, true)));
|
|
1946
|
-
}
|
|
1947
|
-
};
|
|
1948
|
-
|
|
1949
1688
|
function throwInBrowser(func) {
|
|
1950
1689
|
const err = new Error(`${func.name} is not supported in the browser, returning undefined`);
|
|
1951
1690
|
console.error(err);
|
|
@@ -2091,6 +1830,7 @@ function respond(value, init = {}) {
|
|
|
2091
1830
|
responseInit,
|
|
2092
1831
|
headers
|
|
2093
1832
|
} = initWithRevalidate(init);
|
|
1833
|
+
for (const header of COMPOSED_BODY_FRAMING) headers.delete(header);
|
|
2094
1834
|
if (NULL_BODY_STATUSES.has(responseInit.status)) {
|
|
2095
1835
|
return new ResponseEnvelope(new Response(null, {
|
|
2096
1836
|
...responseInit,
|
|
@@ -2162,7 +1902,7 @@ const COMPONENT_BINDING = Symbol.for("solid.component-binding");
|
|
|
2162
1902
|
function bindingOf(value) {
|
|
2163
1903
|
return value !== null && (typeof value === "function" || typeof value === "object") && value[COMPONENT_BINDING] || undefined;
|
|
2164
1904
|
}
|
|
2165
|
-
function dynamic(source) {
|
|
1905
|
+
function dynamic(source, _options) {
|
|
2166
1906
|
let latest = 0;
|
|
2167
1907
|
const sites = new Set();
|
|
2168
1908
|
let deliveredAddress;
|
|
@@ -2247,4 +1987,4 @@ _moduleUrl) {
|
|
|
2247
1987
|
function httpStatus(_code, _text) {}
|
|
2248
1988
|
function httpHeader(_name, _value, _options) {}
|
|
2249
1989
|
|
|
2250
|
-
export { ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, HydrationScript, MathMLElements, NULL_BODY_STATUSES, Namespaces, Portal, RESPONSE_HEADER_VALUE_LIMIT, REVALIDATE_HEADER, RawTextElements, RequestContext, ResponseEnvelope, SAFE_ERROR, SVGElements, VoidElements, acquireAsset, addEvent, applyRef, assign, claimElement, claimElementTree, className, clearFlashCookie, clientOnly, commitEventResponse, composeMiddleware, createRequestEvent, createResponseStub, createSSRResponse, delegateEvents,
|
|
1990
|
+
export { ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, HydrationScript, MathMLElements, NULL_BODY_STATUSES, Namespaces, Portal, RESPONSE_HEADER_VALUE_LIMIT, REVALIDATE_HEADER, RawTextElements, RequestContext, ResponseEnvelope, SAFE_ERROR, SVGElements, VoidElements, acquireAsset, addEvent, applyRef, assign, claimElement, claimElementTree, className, clearFlashCookie, clientOnly, commitEventResponse, composeMiddleware, createRequestEvent, createResponseStub, createSSRResponse, delegateEvents, dynamic, dynamicProperty, effect, escape, generateHydrationScript, getDelegatedRoot, getExpectedRedirectStatus, getFirstChild, getHydrationKey, getNextElement, getNextMarker, getNextMatch, getNextSibling, getRequestEvent, getServerFunctionMetadata, getServerFunctionRPC, hasFlashCookie, httpHeader, httpStatus, hydrate, insert, installHydrationRuntime, isDev, isHref, isResponseEnvelope, isSafeError, isServer, isServerFunction, markSafeError, memo, parseCookieHeader, redirect, ref, registerDelegatedContainer, registerDelegatedRoot, registerElementClaim, reload, render, renderToStream, renderToString, resolveSSRNode, respond, runHydrationEvents, scope, serializeCookie, setAttribute, setAttributeNS, setProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrGroup, ssrHydrationKey, ssrStyle, ssrStyleProperty, style, template, unregisterDelegatedContainer, unregisterDelegatedRoot, useHead, waitAsset, warmAsset };
|