@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.cjs
CHANGED
|
@@ -49,6 +49,7 @@ const Namespaces = {
|
|
|
49
49
|
const VoidElements = /*#__PURE__*/new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr"]);
|
|
50
50
|
const RawTextElements = /*#__PURE__*/new Set(["style", "script", "noscript", "template", "textarea", "title"]);
|
|
51
51
|
const DOMElements = /*#__PURE__*/new Set(/*#__PURE__*/"a,abbr,acronym,address,applet,area,article,aside,audio,b,base,basefont,bdi,bdo,bgsound,big,blink,blockquote,body,br,button,canvas,caption,center,cite,code,col,colgroup,content,data,datalist,dd,del,details,dfn,dialog,dir,div,dl,dt,em,embed,fieldset,figcaption,figure,font,footer,form,frame,frameset,h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,i,iframe,image,img,input,ins,isindex,kbd,keygen,label,legend,li,link,listing,main,map,mark,marquee,math,menu,menuitem,meta,meter,multicol,nav,nextid,nobr,noembed,noframes,noindex,noscript,object,ol,optgroup,option,output,p,param,picture,plaintext,portal,pre,progress,q,rb,rp,rt,rtc,ruby,s,samp,script,search,section,select,shadow,slot,small,source,spacer,span,strike,strong,style,sub,summary,sup,svg,table,tbody,td,template,textarea,tfoot,th,thead,time,title,tr,track,tt,u,ul,var,video,wbr,webview,xmp".split(","));
|
|
52
|
+
const COMPOSED_BODY_FRAMING = /*#__PURE__*/new Set(["content-length", "content-encoding", "transfer-encoding"]);
|
|
52
53
|
|
|
53
54
|
const transparentOptions = {
|
|
54
55
|
transparent: true,
|
|
@@ -58,11 +59,12 @@ const syncOptions = {
|
|
|
58
59
|
sync: true
|
|
59
60
|
};
|
|
60
61
|
function effect(fn, effectFn, options) {
|
|
61
|
-
|
|
62
|
+
const nodeOptions = options ? {
|
|
62
63
|
sync: true,
|
|
63
64
|
...options,
|
|
64
65
|
transparent: !options.scope
|
|
65
|
-
} : transparentOptions
|
|
66
|
+
} : transparentOptions;
|
|
67
|
+
solidJs.createRenderEffect(fn, effectFn, nodeOptions);
|
|
66
68
|
}
|
|
67
69
|
function memo(fn) {
|
|
68
70
|
return solidJs.createMemo(() => fn(), syncOptions);
|
|
@@ -211,12 +213,24 @@ function classifyHeadTag(desc) {
|
|
|
211
213
|
resource: false
|
|
212
214
|
};
|
|
213
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
|
+
}
|
|
214
227
|
function resourceIdentity(tag, props) {
|
|
215
|
-
|
|
228
|
+
const url = String(props.href || props.src || "");
|
|
229
|
+
let id = "res:" + tag + ":" + (props.rel || "") + ":" + url.length + ":" + url;
|
|
216
230
|
for (let i = 0; i < RESOURCE_QUALIFIERS.length; i++) {
|
|
217
231
|
const q = RESOURCE_QUALIFIERS[i];
|
|
218
|
-
const value = props[q];
|
|
219
|
-
if (value
|
|
232
|
+
const value = qualifierValue(q, props[q]);
|
|
233
|
+
if (value !== null) id += ":" + q + "=" + value.length + ":" + value;
|
|
220
234
|
}
|
|
221
235
|
return id;
|
|
222
236
|
}
|
|
@@ -335,11 +349,9 @@ const waitAsset = promise => {
|
|
|
335
349
|
}
|
|
336
350
|
gate();
|
|
337
351
|
};
|
|
338
|
-
exports.listDriver = void 0;
|
|
339
|
-
function installListDriver(driver) {
|
|
340
|
-
exports.listDriver = driver;
|
|
341
|
-
}
|
|
342
352
|
const $$EVENT_OWNER = "_$SOLID_EVENT_OWNER";
|
|
353
|
+
const $$EVENT_TUPLE = Symbol();
|
|
354
|
+
const hasOwn = Object.prototype.hasOwnProperty;
|
|
343
355
|
const INNER_OWNED = {};
|
|
344
356
|
const delegatedEvents = new Set();
|
|
345
357
|
const delegatedContainers = new Map();
|
|
@@ -457,7 +469,8 @@ function findOwner(target, state) {
|
|
|
457
469
|
}
|
|
458
470
|
function setProperty(node, name, value) {
|
|
459
471
|
if (isHydrating(node)) return;
|
|
460
|
-
|
|
472
|
+
const nodeName = node.nodeName;
|
|
473
|
+
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;
|
|
461
474
|
}
|
|
462
475
|
let claimHandlers = null;
|
|
463
476
|
const CLAIM_SEAM = Symbol.for("solid.element-claims");
|
|
@@ -491,7 +504,17 @@ function claimElement(node) {
|
|
|
491
504
|
}
|
|
492
505
|
function setAttribute(node, name, value) {
|
|
493
506
|
if (isHydrating(node)) return;
|
|
494
|
-
|
|
507
|
+
const selectMultiple = name === "multiple" && node.localName === "select";
|
|
508
|
+
if (value == null || value === false) node.removeAttribute(name);else {
|
|
509
|
+
node.setAttribute(name, value === true ? "" : value);
|
|
510
|
+
if (selectMultiple && !node._$multiple) {
|
|
511
|
+
const options = node.options;
|
|
512
|
+
for (let i = 0; i < options.length; i++) {
|
|
513
|
+
if (options[i].defaultSelected) options[i].selected = true;
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
if (selectMultiple) node._$multiple = true;
|
|
495
518
|
if (claimHandlers !== null && (name === "href" || name === "action")) claimElement(node);
|
|
496
519
|
}
|
|
497
520
|
function setAttributeNS(node, namespace, name, value) {
|
|
@@ -499,22 +522,32 @@ function setAttributeNS(node, namespace, name, value) {
|
|
|
499
522
|
if (value == null || value === false) node.removeAttributeNS(namespace, name.indexOf(":") > -1 ? name.split(":").pop() : name);else node.setAttributeNS(namespace, name, value === true ? "" : value);
|
|
500
523
|
}
|
|
501
524
|
function className(node, value, prev) {
|
|
502
|
-
if (
|
|
525
|
+
if (typeof value === "number") value = "" + value;
|
|
526
|
+
if (typeof prev === "number") prev = "" + prev;
|
|
527
|
+
if (isHydrating(node)) {
|
|
528
|
+
node._$classes = value && typeof value === "object" ? classListToObject(value) : undefined;
|
|
529
|
+
return;
|
|
530
|
+
}
|
|
503
531
|
if (value == null || value === false) {
|
|
504
|
-
prev
|
|
532
|
+
if (prev || node._$classes) {
|
|
533
|
+
node.removeAttribute("class");
|
|
534
|
+
node._$classes = undefined;
|
|
535
|
+
}
|
|
505
536
|
return;
|
|
506
537
|
}
|
|
507
538
|
if (typeof value === "string") {
|
|
539
|
+
node._$classes = undefined;
|
|
508
540
|
value !== prev && node.setAttribute("class", value);
|
|
509
541
|
return;
|
|
510
542
|
}
|
|
543
|
+
let applied;
|
|
511
544
|
if (typeof prev === "string") {
|
|
512
|
-
|
|
545
|
+
applied = {};
|
|
513
546
|
node.removeAttribute("class");
|
|
514
|
-
} else
|
|
547
|
+
} else applied = node._$classes || classListToObject(prev || {});
|
|
515
548
|
value = classListToObject(value);
|
|
516
|
-
const classKeys = Object.keys(value
|
|
517
|
-
const prevKeys = Object.keys(
|
|
549
|
+
const classKeys = Object.keys(value);
|
|
550
|
+
const prevKeys = Object.keys(applied);
|
|
518
551
|
let i, len;
|
|
519
552
|
for (i = 0, len = prevKeys.length; i < len; i++) {
|
|
520
553
|
const key = prevKeys[i];
|
|
@@ -524,22 +557,34 @@ function className(node, value, prev) {
|
|
|
524
557
|
for (i = 0, len = classKeys.length; i < len; i++) {
|
|
525
558
|
const key = classKeys[i],
|
|
526
559
|
classValue = !!value[key];
|
|
527
|
-
if (!key || key === "undefined" ||
|
|
560
|
+
if (!key || key === "undefined" || applied[key] === classValue || !classValue) continue;
|
|
528
561
|
node.classList.add(key);
|
|
529
562
|
}
|
|
563
|
+
node._$classes = value;
|
|
530
564
|
}
|
|
531
565
|
function addEvent(node, name, handler, delegate) {
|
|
532
566
|
if (delegate) {
|
|
567
|
+
const key = `$$${name}`;
|
|
568
|
+
let data;
|
|
533
569
|
if (Array.isArray(handler)) {
|
|
534
|
-
|
|
535
|
-
node[
|
|
536
|
-
} else node[
|
|
537
|
-
|
|
570
|
+
data = handler[1];
|
|
571
|
+
node[key] = handler[0];
|
|
572
|
+
} else node[key] = handler;
|
|
573
|
+
node[`${key}Data`] = data;
|
|
574
|
+
return;
|
|
575
|
+
}
|
|
576
|
+
if (Array.isArray(handler)) {
|
|
538
577
|
const handlerFn = handler[0];
|
|
539
|
-
|
|
540
|
-
|
|
578
|
+
const listener = e => handlerFn.call(node, handler[1], e);
|
|
579
|
+
listener[$$EVENT_TUPLE] = handler;
|
|
580
|
+
node.addEventListener(name, listener);
|
|
581
|
+
return listener;
|
|
582
|
+
}
|
|
583
|
+
node.addEventListener(name, handler, typeof handler !== "function" && handler);
|
|
584
|
+
return handler;
|
|
541
585
|
}
|
|
542
586
|
function style(node, value, prev) {
|
|
587
|
+
if (isHydrating(node)) return;
|
|
543
588
|
if (!value) {
|
|
544
589
|
if (prev || node._$styles) {
|
|
545
590
|
setAttribute(node, "style");
|
|
@@ -564,12 +609,13 @@ function style(node, value, prev) {
|
|
|
564
609
|
}
|
|
565
610
|
let v, s;
|
|
566
611
|
for (s in applied) {
|
|
567
|
-
if (value[s] == null) {
|
|
612
|
+
if (!hasOwn.call(value, s) || value[s] == null) {
|
|
568
613
|
nodeStyle.removeProperty(s);
|
|
569
614
|
delete applied[s];
|
|
570
615
|
}
|
|
571
616
|
}
|
|
572
617
|
for (s in value) {
|
|
618
|
+
if (!hasOwn.call(value, s)) continue;
|
|
573
619
|
v = value[s];
|
|
574
620
|
if (v != null && v !== applied[s]) {
|
|
575
621
|
nodeStyle.setProperty(s, v);
|
|
@@ -578,20 +624,26 @@ function style(node, value, prev) {
|
|
|
578
624
|
}
|
|
579
625
|
}
|
|
580
626
|
function setStyleProperty(node, name, value) {
|
|
627
|
+
if (isHydrating(node)) return;
|
|
581
628
|
value != null ? node.style.setProperty(name, value) : node.style.removeProperty(name);
|
|
582
629
|
}
|
|
583
|
-
function spread(node, props
|
|
630
|
+
function spread(node, props, skipChildren) {
|
|
584
631
|
const prevProps = {};
|
|
585
|
-
const get = typeof props === "function" ? props :
|
|
586
|
-
if (!skipChildren) insert(node, () =>
|
|
632
|
+
const get = () => (typeof props === "function" ? props() : props) ?? {};
|
|
633
|
+
if (!skipChildren) insert(node, () => {
|
|
634
|
+
const source = get();
|
|
635
|
+
return hasOwn.call(source, "children") ? source.children : undefined;
|
|
636
|
+
});
|
|
587
637
|
effect(() => {
|
|
588
|
-
const
|
|
638
|
+
const source = get();
|
|
639
|
+
const r = hasOwn.call(source, "ref") && source.ref;
|
|
589
640
|
(typeof r === "function" || Array.isArray(r)) && ref(() => r, node);
|
|
590
641
|
}, () => {});
|
|
591
642
|
effect(() => {
|
|
592
643
|
const source = get();
|
|
593
644
|
const newProps = {};
|
|
594
645
|
for (const prop in source) {
|
|
646
|
+
if (!hasOwn.call(source, prop)) continue;
|
|
595
647
|
if (prop === "children" || prop === "ref") continue;
|
|
596
648
|
newProps[prop] = source[prop];
|
|
597
649
|
}
|
|
@@ -684,11 +736,6 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
684
736
|
const host = options && options.host;
|
|
685
737
|
if (multi && !initial) initial = [];
|
|
686
738
|
if (hydrationRt !== null) initial = hydrationRt.claimInitial(parent, multi, initial);
|
|
687
|
-
if (exports.listDriver !== undefined && typeof accessor === "function" && accessor.$ll !== undefined) {
|
|
688
|
-
const listAccessor = accessor;
|
|
689
|
-
const owner = solidJs.getOwner();
|
|
690
|
-
if (exports.listDriver(parent, accessor, marker, () => solidJs.runWithOwner(owner, () => insert(parent, () => listAccessor(), marker, marker !== undefined ? [] : undefined, options)))) return;
|
|
691
|
-
}
|
|
692
739
|
if (typeof accessor !== "function") {
|
|
693
740
|
accessor = normalize(accessor, initial, multi, true);
|
|
694
741
|
if (typeof accessor !== "function") {
|
|
@@ -748,10 +795,16 @@ function assetEntryKey(descriptor) {
|
|
|
748
795
|
if (descriptor.policy === "exclusive") return "x|" + descriptor.key;
|
|
749
796
|
return descriptor.type === "inline-style" ? "i|" + descriptor.id : descriptor.type + "|" + descriptor.href;
|
|
750
797
|
}
|
|
751
|
-
function findAssetElement(selector, attr, value) {
|
|
798
|
+
function findAssetElement(selector, attr, value, qualifiers) {
|
|
752
799
|
const nodes = document.querySelectorAll(selector);
|
|
753
|
-
for (let i = 0; i < nodes.length; i++) {
|
|
754
|
-
if (nodes[i].getAttribute(attr)
|
|
800
|
+
outer: for (let i = 0; i < nodes.length; i++) {
|
|
801
|
+
if (nodes[i].getAttribute(attr) !== value) continue;
|
|
802
|
+
if (!qualifiers) return nodes[i];
|
|
803
|
+
for (let q = 0; q < RESOURCE_QUALIFIERS.length; q++) {
|
|
804
|
+
const name = RESOURCE_QUALIFIERS[q];
|
|
805
|
+
if (qualifierValue(name, qualifiers[name]) !== qualifierValue(name, nodes[i].getAttribute(name))) continue outer;
|
|
806
|
+
}
|
|
807
|
+
return nodes[i];
|
|
755
808
|
}
|
|
756
809
|
return null;
|
|
757
810
|
}
|
|
@@ -1055,8 +1108,8 @@ function mountHeadResource(tag, props) {
|
|
|
1055
1108
|
headMountedResources.add(identity);
|
|
1056
1109
|
const url = props.href || props.src;
|
|
1057
1110
|
let el = null;
|
|
1058
|
-
if (url != null) {
|
|
1059
|
-
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);
|
|
1111
|
+
if (tag === "link" && url == null && typeof props.imagesrcset === "string") el = findAssetElement(`link[rel="${props.rel}"]`, "href", null, props);else if (url != null) {
|
|
1112
|
+
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);
|
|
1060
1113
|
}
|
|
1061
1114
|
if (!el) document.head.appendChild(createHeadElement(tag, props));
|
|
1062
1115
|
}
|
|
@@ -1367,7 +1420,8 @@ function classListToObject(classList) {
|
|
|
1367
1420
|
function flattenClassList(list, result) {
|
|
1368
1421
|
for (let i = 0, len = list.length; i < len; i++) {
|
|
1369
1422
|
const item = list[i];
|
|
1370
|
-
if (Array.isArray(item)) flattenClassList(item, result);else if (typeof item === "object" && item != null) Object.assign(result, item);
|
|
1423
|
+
if (Array.isArray(item)) flattenClassList(item, result);else if (typeof item === "object" && item != null) Object.assign(result, item);
|
|
1424
|
+
else if (typeof item !== "boolean" && (item || item === 0)) result[item] = true;
|
|
1371
1425
|
}
|
|
1372
1426
|
}
|
|
1373
1427
|
function assignProp(node, prop, value, prev, skipRef, nodeName) {
|
|
@@ -1383,12 +1437,13 @@ function assignProp(node, prop, value, prev, skipRef, nodeName) {
|
|
|
1383
1437
|
const name = prop.slice(2).toLowerCase();
|
|
1384
1438
|
const delegate = DelegatedEvents.has(name);
|
|
1385
1439
|
if (!delegate && prev) {
|
|
1386
|
-
|
|
1387
|
-
node.removeEventListener(name,
|
|
1440
|
+
if (Array.isArray(value) && typeof prev === "function" && prev[$$EVENT_TUPLE] === value) return prev;
|
|
1441
|
+
node.removeEventListener(name, prev, typeof prev !== "function" && prev);
|
|
1388
1442
|
}
|
|
1389
1443
|
if (delegate || value) {
|
|
1390
|
-
addEvent(node, name, value, delegate);
|
|
1444
|
+
const attached = addEvent(node, name, value, delegate);
|
|
1391
1445
|
delegate && delegateEvents([name]);
|
|
1446
|
+
if (!delegate) return attached;
|
|
1392
1447
|
}
|
|
1393
1448
|
} else if (hasNamespace && prop.slice(0, 5) === "prop:" || ChildProperties.has(prop) || DOMWithState[nodeName]?.[prop]) {
|
|
1394
1449
|
if (hasNamespace) prop = prop.slice(5);else if (isHydrating(node)) return value;
|
|
@@ -1428,7 +1483,7 @@ function eventHandler(e, container, state) {
|
|
|
1428
1483
|
}
|
|
1429
1484
|
if (handler && !node.disabled) {
|
|
1430
1485
|
const data = node[`${key}Data`];
|
|
1431
|
-
data !== undefined ? handler.call(node, data, e) : handler.call(node, e);
|
|
1486
|
+
data !== undefined ? handler.call(node, data, e) : typeof handler === "function" ? handler.call(node, e) : handler.handleEvent(e);
|
|
1432
1487
|
if (e.cancelBubble) return;
|
|
1433
1488
|
}
|
|
1434
1489
|
node.host && typeof node.host !== "string" && !node.host._$host && node.contains(e.target) && retarget(node.host);
|
|
@@ -1548,7 +1603,7 @@ function normalize(value, current, multi, doNotUnwrap) {
|
|
|
1548
1603
|
const item = value[i],
|
|
1549
1604
|
prev = current && current[i],
|
|
1550
1605
|
t = typeof item;
|
|
1551
|
-
if ((t === "string" || t === "number") && prev && prev.nodeType === 3) value[i] = prev;
|
|
1606
|
+
if ((t === "string" || t === "number") && prev && prev.nodeType === 3 && isHydrating(prev)) value[i] = prev;
|
|
1552
1607
|
}
|
|
1553
1608
|
}
|
|
1554
1609
|
return value;
|
|
@@ -1631,322 +1686,6 @@ function getHydrationKey() {
|
|
|
1631
1686
|
}
|
|
1632
1687
|
const RequestContext = Symbol();
|
|
1633
1688
|
|
|
1634
|
-
const PURE_ROW = Symbol.for("solid.pure-row");
|
|
1635
|
-
const arm = () => {
|
|
1636
|
-
installListDriver(driveList);
|
|
1637
|
-
};
|
|
1638
|
-
function rowProof(fn) {
|
|
1639
|
-
arm();
|
|
1640
|
-
fn[PURE_ROW] = true;
|
|
1641
|
-
return fn;
|
|
1642
|
-
}
|
|
1643
|
-
let rowCollector = null;
|
|
1644
|
-
const lisPositions = sources => {
|
|
1645
|
-
const n = sources.length;
|
|
1646
|
-
const tails = [];
|
|
1647
|
-
const tailsIdx = [];
|
|
1648
|
-
const prev = new Array(n).fill(-1);
|
|
1649
|
-
for (let j = 0; j < n; j++) {
|
|
1650
|
-
const v = sources[j];
|
|
1651
|
-
if (v === -1) continue;
|
|
1652
|
-
let lo = 0,
|
|
1653
|
-
hi = tails.length;
|
|
1654
|
-
while (lo < hi) {
|
|
1655
|
-
const mid = lo + hi >> 1;
|
|
1656
|
-
if (tails[mid] < v) lo = mid + 1;else hi = mid;
|
|
1657
|
-
}
|
|
1658
|
-
if (lo > 0) prev[j] = tailsIdx[lo - 1];
|
|
1659
|
-
tails[lo] = v;
|
|
1660
|
-
tailsIdx[lo] = j;
|
|
1661
|
-
}
|
|
1662
|
-
const stable = new Set();
|
|
1663
|
-
let k = tailsIdx.length ? tailsIdx[tails.length - 1] : -1;
|
|
1664
|
-
while (k >= 0) {
|
|
1665
|
-
stable.add(k);
|
|
1666
|
-
k = prev[k];
|
|
1667
|
-
}
|
|
1668
|
-
return stable;
|
|
1669
|
-
};
|
|
1670
|
-
const driveList = (parent, listFn, marker, lateClassic) => {
|
|
1671
|
-
const meta = listFn.$ll;
|
|
1672
|
-
if (meta.row?.[PURE_ROW] !== true) return false;
|
|
1673
|
-
if (typeof meta.keyed === "function") return false;
|
|
1674
|
-
const evalOwner = solidJs.createOwner({
|
|
1675
|
-
id: "&each"
|
|
1676
|
-
});
|
|
1677
|
-
let subject = solidJs.runWithOwner(evalOwner, () => solidJs.untrack(meta.each));
|
|
1678
|
-
evalOwner.dispose();
|
|
1679
|
-
let raw = subject != null ? solidJs.patchableRaw(subject) : undefined;
|
|
1680
|
-
if (raw === undefined || !Array.isArray(raw)) return false;
|
|
1681
|
-
const optimistic = solidJs.storeHasOptimisticFamily(subject);
|
|
1682
|
-
if (optimistic) raw = solidJs.untrack(() => Array.from(subject));
|
|
1683
|
-
const hydrating = !!solidJs.sharedConfig.hydrating;
|
|
1684
|
-
if (hydrating && raw.length === 0) return false;
|
|
1685
|
-
let domRows;
|
|
1686
|
-
let rowIds;
|
|
1687
|
-
if (hydrating) {
|
|
1688
|
-
if (marker !== undefined) return false;
|
|
1689
|
-
domRows = Array.from(parent.children);
|
|
1690
|
-
if (domRows.length !== raw.length) return false;
|
|
1691
|
-
rowIds = new Array(raw.length);
|
|
1692
|
-
for (let i = 0; i < domRows.length; i++) {
|
|
1693
|
-
const key = domRows[i].getAttribute("_hk");
|
|
1694
|
-
if (key === null || !key.endsWith("0") || key.length < 2) return false;
|
|
1695
|
-
rowIds[i] = key.slice(0, -1);
|
|
1696
|
-
}
|
|
1697
|
-
}
|
|
1698
|
-
const rowFn = meta.row;
|
|
1699
|
-
const endAnchor = marker ?? null;
|
|
1700
|
-
const shallow = solidJs.storeIsShallow(subject);
|
|
1701
|
-
let lastBodies = null;
|
|
1702
|
-
let lastUnbinds = null;
|
|
1703
|
-
const collectBind = (abs, build) => {
|
|
1704
|
-
const prevC = rowCollector;
|
|
1705
|
-
rowCollector = {
|
|
1706
|
-
row: shallow ? subject[abs] : undefined,
|
|
1707
|
-
bodies: [],
|
|
1708
|
-
unbinds: []
|
|
1709
|
-
};
|
|
1710
|
-
try {
|
|
1711
|
-
return build();
|
|
1712
|
-
} finally {
|
|
1713
|
-
lastBodies = rowCollector.bodies;
|
|
1714
|
-
lastUnbinds = rowCollector.unbinds;
|
|
1715
|
-
rowCollector = prevC;
|
|
1716
|
-
}
|
|
1717
|
-
};
|
|
1718
|
-
const listOwner = solidJs.createOwner();
|
|
1719
|
-
let declined = false;
|
|
1720
|
-
const bindRow = (abs, claimId) => {
|
|
1721
|
-
return collectBind(abs, () => solidJs.runWithOwner(listOwner, () => claimId !== undefined ? solidJs.runWithOwner(solidJs.createOwner({
|
|
1722
|
-
id: claimId
|
|
1723
|
-
}), () => solidJs.untrack(() => rowFn(subject[abs]))) : solidJs.untrack(() => rowFn(subject[abs]))));
|
|
1724
|
-
};
|
|
1725
|
-
let entries = new Array(raw.length);
|
|
1726
|
-
let rowBodies = shallow ? new Array(raw.length) : null;
|
|
1727
|
-
let rowUnbinds = new Array(raw.length);
|
|
1728
|
-
const runUnbinds = list => {
|
|
1729
|
-
if (list !== undefined) for (let u = 0; u < list.length; u++) list[u]();
|
|
1730
|
-
};
|
|
1731
|
-
const unbindAllRows = () => {
|
|
1732
|
-
for (let j = 0; j < rowUnbinds.length; j++) runUnbinds(rowUnbinds[j]);
|
|
1733
|
-
rowUnbinds = [];
|
|
1734
|
-
};
|
|
1735
|
-
let prevRaws = raw.slice();
|
|
1736
|
-
try {
|
|
1737
|
-
if (hydrating) {
|
|
1738
|
-
for (let i = 0; i < raw.length; i++) {
|
|
1739
|
-
entries[i] = bindRow(i, rowIds[i]);
|
|
1740
|
-
if (rowBodies !== null) rowBodies[i] = lastBodies;
|
|
1741
|
-
rowUnbinds[i] = lastUnbinds;
|
|
1742
|
-
}
|
|
1743
|
-
} else {
|
|
1744
|
-
for (let i = 0; i < raw.length; i++) {
|
|
1745
|
-
const node = bindRow(i);
|
|
1746
|
-
entries[i] = node;
|
|
1747
|
-
if (rowBodies !== null) rowBodies[i] = lastBodies;
|
|
1748
|
-
rowUnbinds[i] = lastUnbinds;
|
|
1749
|
-
parent.insertBefore(node, endAnchor);
|
|
1750
|
-
}
|
|
1751
|
-
}
|
|
1752
|
-
} catch (err) {
|
|
1753
|
-
unbindAllRows();
|
|
1754
|
-
runUnbinds(lastUnbinds ?? undefined);
|
|
1755
|
-
for (let j = 0; j < entries.length; j++) {
|
|
1756
|
-
const n = entries[j];
|
|
1757
|
-
if (n !== undefined && n.parentNode === parent) n.remove();
|
|
1758
|
-
}
|
|
1759
|
-
listOwner.dispose();
|
|
1760
|
-
throw err;
|
|
1761
|
-
}
|
|
1762
|
-
const identityOps = nextArr => {
|
|
1763
|
-
const keyOf = r => {
|
|
1764
|
-
const w = r != null ? solidJs.patchableRaw(r) : undefined;
|
|
1765
|
-
return w !== undefined ? w : r;
|
|
1766
|
-
};
|
|
1767
|
-
const oldIndex = new Map();
|
|
1768
|
-
for (let j = 0; j < prevRaws.length; j++) {
|
|
1769
|
-
const k = keyOf(prevRaws[j]);
|
|
1770
|
-
const existing = oldIndex.get(k);
|
|
1771
|
-
if (existing === undefined) oldIndex.set(k, j);else if (Array.isArray(existing)) existing.push(j);else oldIndex.set(k, [existing, j]);
|
|
1772
|
-
}
|
|
1773
|
-
const sources = new Array(nextArr.length);
|
|
1774
|
-
for (let k = 0; k < nextArr.length; k++) {
|
|
1775
|
-
const m = oldIndex.get(keyOf(nextArr[k]));
|
|
1776
|
-
if (m === undefined) sources[k] = -1;else if (Array.isArray(m)) {
|
|
1777
|
-
sources[k] = m.shift();
|
|
1778
|
-
if (m.length === 1) oldIndex.set(keyOf(nextArr[k]), m[0]);
|
|
1779
|
-
} else {
|
|
1780
|
-
sources[k] = m;
|
|
1781
|
-
oldIndex.delete(keyOf(nextArr[k]));
|
|
1782
|
-
}
|
|
1783
|
-
}
|
|
1784
|
-
return {
|
|
1785
|
-
prefix: 0,
|
|
1786
|
-
sources
|
|
1787
|
-
};
|
|
1788
|
-
};
|
|
1789
|
-
let resyncNeeded = false;
|
|
1790
|
-
const applyOps = (next, ops) => {
|
|
1791
|
-
if (declined) return;
|
|
1792
|
-
if (resyncNeeded) ops = null;
|
|
1793
|
-
if (ops === null) ops = identityOps(next);
|
|
1794
|
-
const {
|
|
1795
|
-
prefix,
|
|
1796
|
-
sources
|
|
1797
|
-
} = ops;
|
|
1798
|
-
const built = new Array(sources.length);
|
|
1799
|
-
const builtBodies = rowBodies !== null ? new Array(sources.length) : null;
|
|
1800
|
-
const builtUnbinds = new Array(sources.length);
|
|
1801
|
-
let j = 0;
|
|
1802
|
-
try {
|
|
1803
|
-
for (; j < sources.length; j++) {
|
|
1804
|
-
const abs = prefix + j;
|
|
1805
|
-
const src = sources[j];
|
|
1806
|
-
if (src === -1 || refRebuild && src >= 0 && next[abs] !== prevRaws[src]) {
|
|
1807
|
-
built[j] = bindRow(abs);
|
|
1808
|
-
if (builtBodies !== null) builtBodies[j] = lastBodies;
|
|
1809
|
-
builtUnbinds[j] = lastUnbinds;
|
|
1810
|
-
}
|
|
1811
|
-
}
|
|
1812
|
-
} catch (err) {
|
|
1813
|
-
for (let k = 0; k < j; k++) runUnbinds(builtUnbinds[k]);
|
|
1814
|
-
runUnbinds(lastUnbinds ?? undefined);
|
|
1815
|
-
resyncNeeded = true;
|
|
1816
|
-
throw err;
|
|
1817
|
-
}
|
|
1818
|
-
const retained = new Set();
|
|
1819
|
-
for (let k = 0; k < sources.length; k++) {
|
|
1820
|
-
if (sources[k] >= 0 && built[k] === undefined) retained.add(sources[k]);
|
|
1821
|
-
}
|
|
1822
|
-
for (let k = prefix; k < entries.length; k++) {
|
|
1823
|
-
if (!retained.has(k)) {
|
|
1824
|
-
entries[k].remove();
|
|
1825
|
-
runUnbinds(rowUnbinds[k]);
|
|
1826
|
-
}
|
|
1827
|
-
}
|
|
1828
|
-
const newEntries = new Array(prefix + sources.length);
|
|
1829
|
-
const newBodies = rowBodies !== null ? new Array(prefix + sources.length) : null;
|
|
1830
|
-
const newUnbinds = new Array(prefix + sources.length);
|
|
1831
|
-
for (let i = 0; i < prefix; i++) {
|
|
1832
|
-
newEntries[i] = entries[i];
|
|
1833
|
-
if (newBodies !== null) newBodies[i] = rowBodies[i];
|
|
1834
|
-
newUnbinds[i] = rowUnbinds[i];
|
|
1835
|
-
}
|
|
1836
|
-
const stable = lisPositions(sources);
|
|
1837
|
-
let anchor = endAnchor;
|
|
1838
|
-
for (let k = sources.length - 1; k >= 0; k--) {
|
|
1839
|
-
const abs = prefix + k;
|
|
1840
|
-
const src = sources[k];
|
|
1841
|
-
let node;
|
|
1842
|
-
if (built[k] !== undefined) {
|
|
1843
|
-
node = built[k];
|
|
1844
|
-
if (newBodies !== null) newBodies[abs] = builtBodies[k];
|
|
1845
|
-
newUnbinds[abs] = builtUnbinds[k];
|
|
1846
|
-
parent.insertBefore(node, anchor);
|
|
1847
|
-
} else {
|
|
1848
|
-
node = entries[src];
|
|
1849
|
-
if (newBodies !== null) newBodies[abs] = rowBodies[src];
|
|
1850
|
-
newUnbinds[abs] = rowUnbinds[src];
|
|
1851
|
-
if (!stable.has(k)) parent.insertBefore(node, anchor);
|
|
1852
|
-
}
|
|
1853
|
-
newEntries[abs] = node;
|
|
1854
|
-
anchor = node;
|
|
1855
|
-
}
|
|
1856
|
-
entries = newEntries;
|
|
1857
|
-
if (newBodies !== null) rowBodies = newBodies;
|
|
1858
|
-
rowUnbinds = newUnbinds;
|
|
1859
|
-
prevRaws = next.slice();
|
|
1860
|
-
resyncNeeded = false;
|
|
1861
|
-
};
|
|
1862
|
-
let unbindOps = solidJs.runWithOwner(listOwner, () => solidJs.registerRowOps(subject, applyOps));
|
|
1863
|
-
const refRebuild = shallow && typeof meta.keyed !== "function";
|
|
1864
|
-
const rebuildSlot = i => {
|
|
1865
|
-
runUnbinds(rowUnbinds[i]);
|
|
1866
|
-
const old = entries[i];
|
|
1867
|
-
const node = bindRow(i);
|
|
1868
|
-
rowBodies[i] = lastBodies;
|
|
1869
|
-
rowUnbinds[i] = lastUnbinds;
|
|
1870
|
-
parent.insertBefore(node, old);
|
|
1871
|
-
old.remove();
|
|
1872
|
-
entries[i] = node;
|
|
1873
|
-
};
|
|
1874
|
-
const applySlot = (i, next, prev) => {
|
|
1875
|
-
if (declined) return;
|
|
1876
|
-
if (resyncNeeded) {
|
|
1877
|
-
const live = subject != null ? solidJs.patchableRaw(subject) : undefined;
|
|
1878
|
-
if (live !== undefined && Array.isArray(live)) applyOps(live, null);
|
|
1879
|
-
return;
|
|
1880
|
-
}
|
|
1881
|
-
if (refRebuild) {
|
|
1882
|
-
rebuildSlot(i);
|
|
1883
|
-
prevRaws[i] = next;
|
|
1884
|
-
return;
|
|
1885
|
-
}
|
|
1886
|
-
const bodies = rowBodies[i];
|
|
1887
|
-
if (bodies !== undefined) {
|
|
1888
|
-
for (let b = 0; b < bodies.length; b++) bodies[b](next, prev, false);
|
|
1889
|
-
}
|
|
1890
|
-
prevRaws[i] = next;
|
|
1891
|
-
};
|
|
1892
|
-
let unbindSlots = shallow ? solidJs.runWithOwner(listOwner, () => solidJs.registerSlotPatch(subject, applySlot)) : null;
|
|
1893
|
-
solidJs.runWithOwner(listOwner, () => effect(() => meta.each(), value => {
|
|
1894
|
-
if (declined || value === subject) return;
|
|
1895
|
-
const nextRaw = value != null ? solidJs.patchableRaw(value) : undefined;
|
|
1896
|
-
unbindOps();
|
|
1897
|
-
unbindSlots?.();
|
|
1898
|
-
if (nextRaw !== undefined && Array.isArray(nextRaw) && solidJs.storeIsShallow(value) !== shallow) {
|
|
1899
|
-
for (let j = 0; j < entries.length; j++) entries[j].remove();
|
|
1900
|
-
entries = [];
|
|
1901
|
-
prevRaws = [];
|
|
1902
|
-
unbindAllRows();
|
|
1903
|
-
subject = value;
|
|
1904
|
-
declined = true;
|
|
1905
|
-
listOwner.dispose();
|
|
1906
|
-
lateClassic?.();
|
|
1907
|
-
return;
|
|
1908
|
-
}
|
|
1909
|
-
if (nextRaw === undefined || !Array.isArray(nextRaw)) {
|
|
1910
|
-
for (let j = 0; j < entries.length; j++) entries[j].remove();
|
|
1911
|
-
entries = [];
|
|
1912
|
-
prevRaws = [];
|
|
1913
|
-
unbindAllRows();
|
|
1914
|
-
subject = value;
|
|
1915
|
-
declined = true;
|
|
1916
|
-
listOwner.dispose();
|
|
1917
|
-
lateClassic?.();
|
|
1918
|
-
return;
|
|
1919
|
-
}
|
|
1920
|
-
const swapOps = identityOps(nextRaw);
|
|
1921
|
-
subject = value;
|
|
1922
|
-
unbindOps = solidJs.runWithOwner(listOwner, () => solidJs.registerRowOps(subject, applyOps));
|
|
1923
|
-
if (shallow) unbindSlots = solidJs.runWithOwner(listOwner, () => solidJs.registerSlotPatch(subject, applySlot));
|
|
1924
|
-
applyOps(nextRaw, swapOps);
|
|
1925
|
-
}));
|
|
1926
|
-
solidJs.onCleanup(() => {
|
|
1927
|
-
unbindOps();
|
|
1928
|
-
unbindSlots?.();
|
|
1929
|
-
unbindAllRows();
|
|
1930
|
-
listOwner.dispose();
|
|
1931
|
-
});
|
|
1932
|
-
return true;
|
|
1933
|
-
};
|
|
1934
|
-
const patchDriver = (subject, body) => {
|
|
1935
|
-
const raw = solidJs.patchableRaw(subject);
|
|
1936
|
-
if (raw !== undefined) {
|
|
1937
|
-
if (!solidJs.sharedConfig.hydrating) body(raw, undefined, true);
|
|
1938
|
-
const unbind = solidJs.registerPatch(subject, body);
|
|
1939
|
-
if (rowCollector !== null) rowCollector.unbinds.push(unbind);
|
|
1940
|
-
else solidJs.onCleanup(unbind);
|
|
1941
|
-
} else if (rowCollector !== null && subject === rowCollector.row) {
|
|
1942
|
-
rowCollector.bodies.push(body);
|
|
1943
|
-
if (!solidJs.sharedConfig.hydrating) body(subject, undefined, true);
|
|
1944
|
-
} else {
|
|
1945
|
-
effect(() => body(subject, subject, false),
|
|
1946
|
-
() => solidJs.untrack(() => body(subject, undefined, true)));
|
|
1947
|
-
}
|
|
1948
|
-
};
|
|
1949
|
-
|
|
1950
1689
|
function throwInBrowser(func) {
|
|
1951
1690
|
const err = new Error(`${func.name} is not supported in the browser, returning undefined`);
|
|
1952
1691
|
console.error(err);
|
|
@@ -2092,6 +1831,7 @@ function respond(value, init = {}) {
|
|
|
2092
1831
|
responseInit,
|
|
2093
1832
|
headers
|
|
2094
1833
|
} = initWithRevalidate(init);
|
|
1834
|
+
for (const header of COMPOSED_BODY_FRAMING) headers.delete(header);
|
|
2095
1835
|
if (NULL_BODY_STATUSES.has(responseInit.status)) {
|
|
2096
1836
|
return new ResponseEnvelope(new Response(null, {
|
|
2097
1837
|
...responseInit,
|
|
@@ -2163,7 +1903,7 @@ const COMPONENT_BINDING = Symbol.for("solid.component-binding");
|
|
|
2163
1903
|
function bindingOf(value) {
|
|
2164
1904
|
return value !== null && (typeof value === "function" || typeof value === "object") && value[COMPONENT_BINDING] || undefined;
|
|
2165
1905
|
}
|
|
2166
|
-
function dynamic(source) {
|
|
1906
|
+
function dynamic(source, _options) {
|
|
2167
1907
|
let latest = 0;
|
|
2168
1908
|
const sites = new Set();
|
|
2169
1909
|
let deliveredAddress;
|
|
@@ -2338,7 +2078,6 @@ exports.createRequestEvent = createRequestEvent;
|
|
|
2338
2078
|
exports.createResponseStub = createResponseStub;
|
|
2339
2079
|
exports.createSSRResponse = createSSRResponse;
|
|
2340
2080
|
exports.delegateEvents = delegateEvents;
|
|
2341
|
-
exports.driveList = driveList;
|
|
2342
2081
|
exports.dynamic = dynamic;
|
|
2343
2082
|
exports.dynamicProperty = dynamicProperty;
|
|
2344
2083
|
exports.effect = effect;
|
|
@@ -2361,7 +2100,6 @@ exports.httpStatus = httpStatus;
|
|
|
2361
2100
|
exports.hydrate = hydrate;
|
|
2362
2101
|
exports.insert = insert;
|
|
2363
2102
|
exports.installHydrationRuntime = installHydrationRuntime;
|
|
2364
|
-
exports.installListDriver = installListDriver;
|
|
2365
2103
|
exports.isDev = isDev;
|
|
2366
2104
|
exports.isHref = isHref;
|
|
2367
2105
|
exports.isResponseEnvelope = isResponseEnvelope;
|
|
@@ -2371,7 +2109,6 @@ exports.isServerFunction = isServerFunction;
|
|
|
2371
2109
|
exports.markSafeError = markSafeError;
|
|
2372
2110
|
exports.memo = memo;
|
|
2373
2111
|
exports.parseCookieHeader = parseCookieHeader;
|
|
2374
|
-
exports.patchDriver = patchDriver;
|
|
2375
2112
|
exports.redirect = redirect;
|
|
2376
2113
|
exports.ref = ref;
|
|
2377
2114
|
exports.registerDelegatedContainer = registerDelegatedContainer;
|
|
@@ -2383,7 +2120,6 @@ exports.renderToStream = renderToStream;
|
|
|
2383
2120
|
exports.renderToString = renderToString;
|
|
2384
2121
|
exports.resolveSSRNode = resolveSSRNode;
|
|
2385
2122
|
exports.respond = respond;
|
|
2386
|
-
exports.rowProof = rowProof;
|
|
2387
2123
|
exports.runHydrationEvents = runHydrationEvents;
|
|
2388
2124
|
exports.scope = scope;
|
|
2389
2125
|
exports.serializeCookie = serializeCookie;
|