@solidjs/web 2.0.0-rc.6 → 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 +105 -35
- package/dist/server.dev.cjs +3794 -0
- package/dist/server.dev.js +3627 -0
- package/dist/server.js +106 -36
- package/dist/web.cjs +39 -385
- package/dist/{dev.cjs → web.dev.cjs} +91 -396
- package/dist/{dev.js → web.dev.js} +93 -393
- package/dist/web.js +41 -382
- 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 +234 -32
- package/frames/dist/server.dev.cjs +4584 -0
- package/frames/dist/server.dev.js +4571 -0
- package/frames/dist/server.js +234 -32
- 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 +13 -14
- package/server-functions/dist/client.js +13 -14
- package/server-functions/dist/server.cjs +331 -83
- package/server-functions/dist/server.dev.cjs +338 -82
- package/server-functions/dist/server.dev.js +338 -82
- package/server-functions/dist/server.js +331 -83
- package/types/client.d.ts +0 -3
- 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 +27 -3
- package/types/server-mock.d.ts +43 -7
- package/types/server.d.ts +47 -5
- package/types-cjs/client.d.cts +0 -3
- 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 +27 -3
- 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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createRenderEffect, createMemo, sharedConfig, enableHydration, untrack, runWithOwner, resetErrorHalt, enforceLoadingBoundary, createRoot, flatten, flush,
|
|
1
|
+
import { createRenderEffect, getOwner, createMemo, sharedConfig, enableHydration, untrack, runWithOwner, resetErrorHalt, enforceLoadingBoundary, createRoot, flatten, flush, DEV, createComponent, omit, createOwner, createSignal, $DEVCOMP, onCleanup, 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 = {
|
|
@@ -57,12 +57,32 @@ const transparentOptions = {
|
|
|
57
57
|
const syncOptions = {
|
|
58
58
|
sync: true
|
|
59
59
|
};
|
|
60
|
+
let bindingEffect = null;
|
|
61
|
+
function tagElement(node) {
|
|
62
|
+
if (bindingEffect !== null && bindingEffect._devElement === undefined) bindingEffect._devElement = node;
|
|
63
|
+
}
|
|
60
64
|
function effect(fn, effectFn, options) {
|
|
61
|
-
|
|
65
|
+
const nodeOptions = options ? {
|
|
62
66
|
sync: true,
|
|
63
67
|
...options,
|
|
64
68
|
transparent: !options.scope
|
|
65
|
-
} : transparentOptions
|
|
69
|
+
} : transparentOptions;
|
|
70
|
+
{
|
|
71
|
+
let node = null;
|
|
72
|
+
createRenderEffect(prev => {
|
|
73
|
+
node = getOwner();
|
|
74
|
+
return fn(prev);
|
|
75
|
+
}, (value, prev) => {
|
|
76
|
+
const outer = bindingEffect;
|
|
77
|
+
bindingEffect = node;
|
|
78
|
+
try {
|
|
79
|
+
return effectFn(value, prev);
|
|
80
|
+
} finally {
|
|
81
|
+
bindingEffect = outer;
|
|
82
|
+
}
|
|
83
|
+
}, nodeOptions);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
66
86
|
}
|
|
67
87
|
function memo(fn) {
|
|
68
88
|
return createMemo(() => fn(), syncOptions);
|
|
@@ -211,12 +231,24 @@ function classifyHeadTag(desc) {
|
|
|
211
231
|
resource: false
|
|
212
232
|
};
|
|
213
233
|
}
|
|
234
|
+
function qualifierValue(name, value) {
|
|
235
|
+
if (value == null || value === false) return null;
|
|
236
|
+
if (name === "imagesrcset" || name === "imagesizes") return typeof value === "string" && value !== "" ? value : null;
|
|
237
|
+
const v = value === true ? "" : String(value);
|
|
238
|
+
if (name === "as") return asciiLowerCase(v);
|
|
239
|
+
if (name !== "crossorigin") return v;
|
|
240
|
+
return v.length === 15 && v.toLowerCase() === "use-credentials" ? v.toLowerCase() : "anonymous";
|
|
241
|
+
}
|
|
242
|
+
function asciiLowerCase(value) {
|
|
243
|
+
return value.replace(/[A-Z]/g, c => String.fromCharCode(c.charCodeAt(0) + 32));
|
|
244
|
+
}
|
|
214
245
|
function resourceIdentity(tag, props) {
|
|
215
|
-
|
|
246
|
+
const url = String(props.href || props.src || "");
|
|
247
|
+
let id = "res:" + tag + ":" + (props.rel || "") + ":" + url.length + ":" + url;
|
|
216
248
|
for (let i = 0; i < RESOURCE_QUALIFIERS.length; i++) {
|
|
217
249
|
const q = RESOURCE_QUALIFIERS[i];
|
|
218
|
-
const value = props[q];
|
|
219
|
-
if (value
|
|
250
|
+
const value = qualifierValue(q, props[q]);
|
|
251
|
+
if (value !== null) id += ":" + q + "=" + value.length + ":" + value;
|
|
220
252
|
}
|
|
221
253
|
return id;
|
|
222
254
|
}
|
|
@@ -356,10 +388,6 @@ const waitAsset = promise => {
|
|
|
356
388
|
}
|
|
357
389
|
gate();
|
|
358
390
|
};
|
|
359
|
-
let listDriver;
|
|
360
|
-
function installListDriver(driver) {
|
|
361
|
-
listDriver = driver;
|
|
362
|
-
}
|
|
363
391
|
const $$EVENT_OWNER = "_$SOLID_EVENT_OWNER";
|
|
364
392
|
const $$EVENT_TUPLE = Symbol();
|
|
365
393
|
const hasOwn = Object.prototype.hasOwnProperty;
|
|
@@ -414,6 +442,7 @@ function render(code, element, init, options = {}) {
|
|
|
414
442
|
}
|
|
415
443
|
function create(html, bypassGuard, flag) {
|
|
416
444
|
if (isHydrating() && !bypassGuard) throw new Error("Failed attempt to create new DOM elements during hydration. Check that the libraries you are using support hydration.");
|
|
445
|
+
if (/^<(html|head|body)[\s>]/i.test(html)) throw new Error("Document shell templates (<html>, <head>, <body>) cannot be client-created: " + "a <template> parse strips those tags. Render this component through hydrate(), " + "where the document shell already exists.");
|
|
417
446
|
const t = document.createElement("template");
|
|
418
447
|
t.innerHTML = html;
|
|
419
448
|
return flag === 2 ? t.content.firstChild.firstChild : t.content.firstChild;
|
|
@@ -464,10 +493,27 @@ function unregisterDelegatedContainer(container, owner = container) {
|
|
|
464
493
|
}
|
|
465
494
|
function attachDelegatedEvent(name, container, state) {
|
|
466
495
|
if (state.handlers.has(name)) return;
|
|
467
|
-
const handler = e => eventHandler(e, container, state);
|
|
496
|
+
const handler = e => dispatchAsInteraction(e, () => eventHandler(e, container, state)) ;
|
|
468
497
|
state.handlers.set(name, handler);
|
|
469
498
|
container.addEventListener(name, handler);
|
|
470
499
|
}
|
|
500
|
+
function describeEventTarget(target) {
|
|
501
|
+
if (!target || typeof target.tagName !== "string") return undefined;
|
|
502
|
+
const tag = target.tagName.toLowerCase();
|
|
503
|
+
let out = tag;
|
|
504
|
+
if (target.id) out += `#${target.id}`;else if (typeof target.name === "string" && target.name) out += `[name=${target.name}]`;
|
|
505
|
+
if (tag !== "input" && tag !== "textarea" && tag !== "select") {
|
|
506
|
+
const text = (target.textContent || "").trim().replace(/\s+/g, " ");
|
|
507
|
+
if (text) out += ` "${text.length > 30 ? text.slice(0, 29) + "…" : text}"`;
|
|
508
|
+
}
|
|
509
|
+
return out;
|
|
510
|
+
}
|
|
511
|
+
function dispatchAsInteraction(e, fn) {
|
|
512
|
+
return DEV.attribution.withInteraction({
|
|
513
|
+
type: e.type,
|
|
514
|
+
target: describeEventTarget(e.target)
|
|
515
|
+
}, fn);
|
|
516
|
+
}
|
|
471
517
|
function getDelegatedRoot(node) {
|
|
472
518
|
while (node) {
|
|
473
519
|
if (delegatedContainers.get(node)?.roots) return node;
|
|
@@ -487,6 +533,7 @@ function findOwner(target, state) {
|
|
|
487
533
|
}
|
|
488
534
|
}
|
|
489
535
|
function setProperty(node, name, value) {
|
|
536
|
+
tagElement(node);
|
|
490
537
|
if (isHydrating(node)) return;
|
|
491
538
|
const nodeName = node.nodeName;
|
|
492
539
|
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;
|
|
@@ -522,6 +569,7 @@ function claimElement(node) {
|
|
|
522
569
|
return node;
|
|
523
570
|
}
|
|
524
571
|
function setAttribute(node, name, value) {
|
|
572
|
+
tagElement(node);
|
|
525
573
|
if (isHydrating(node)) return;
|
|
526
574
|
const selectMultiple = name === "multiple" && node.localName === "select";
|
|
527
575
|
if (value == null || value === false) node.removeAttribute(name);else {
|
|
@@ -537,10 +585,12 @@ function setAttribute(node, name, value) {
|
|
|
537
585
|
if (claimHandlers !== null && (name === "href" || name === "action")) claimElement(node);
|
|
538
586
|
}
|
|
539
587
|
function setAttributeNS(node, namespace, name, value) {
|
|
588
|
+
tagElement(node);
|
|
540
589
|
if (isHydrating(node)) return;
|
|
541
590
|
if (value == null || value === false) node.removeAttributeNS(namespace, name.indexOf(":") > -1 ? name.split(":").pop() : name);else node.setAttributeNS(namespace, name, value === true ? "" : value);
|
|
542
591
|
}
|
|
543
592
|
function className(node, value, prev) {
|
|
593
|
+
tagElement(node);
|
|
544
594
|
if (typeof value === "number") value = "" + value;
|
|
545
595
|
if (typeof prev === "number") prev = "" + prev;
|
|
546
596
|
if (isHydrating(node)) {
|
|
@@ -594,15 +644,21 @@ function addEvent(node, name, handler, delegate) {
|
|
|
594
644
|
}
|
|
595
645
|
if (Array.isArray(handler)) {
|
|
596
646
|
const handlerFn = handler[0];
|
|
597
|
-
const listener = e => handlerFn.call(node, handler[1], e);
|
|
647
|
+
const listener = e => dispatchAsInteraction(e, () => handlerFn.call(node, handler[1], e)) ;
|
|
598
648
|
listener[$$EVENT_TUPLE] = handler;
|
|
599
649
|
node.addEventListener(name, listener);
|
|
600
650
|
return listener;
|
|
601
651
|
}
|
|
652
|
+
if (typeof handler === "function") {
|
|
653
|
+
const listener = e => dispatchAsInteraction(e, () => handler.call(node, e));
|
|
654
|
+
node.addEventListener(name, listener);
|
|
655
|
+
return listener;
|
|
656
|
+
}
|
|
602
657
|
node.addEventListener(name, handler, typeof handler !== "function" && handler);
|
|
603
658
|
return handler;
|
|
604
659
|
}
|
|
605
660
|
function style(node, value, prev) {
|
|
661
|
+
tagElement(node);
|
|
606
662
|
if (isHydrating(node)) return;
|
|
607
663
|
if (!value) {
|
|
608
664
|
if (prev || node._$styles) {
|
|
@@ -643,12 +699,13 @@ function style(node, value, prev) {
|
|
|
643
699
|
}
|
|
644
700
|
}
|
|
645
701
|
function setStyleProperty(node, name, value) {
|
|
702
|
+
tagElement(node);
|
|
646
703
|
if (isHydrating(node)) return;
|
|
647
704
|
value != null ? node.style.setProperty(name, value) : node.style.removeProperty(name);
|
|
648
705
|
}
|
|
649
|
-
function spread(node, props
|
|
706
|
+
function spread(node, props, skipChildren) {
|
|
650
707
|
const prevProps = {};
|
|
651
|
-
const get = typeof props === "function" ? props :
|
|
708
|
+
const get = () => (typeof props === "function" ? props() : props) ?? {};
|
|
652
709
|
if (!skipChildren) insert(node, () => {
|
|
653
710
|
const source = get();
|
|
654
711
|
return hasOwn.call(source, "children") ? source.children : undefined;
|
|
@@ -694,19 +751,6 @@ function scope(fn) {
|
|
|
694
751
|
const SCOPE_OPTIONS = {
|
|
695
752
|
scope: true
|
|
696
753
|
};
|
|
697
|
-
let insertionParent = null;
|
|
698
|
-
function getInsertionParent() {
|
|
699
|
-
return insertionParent;
|
|
700
|
-
}
|
|
701
|
-
function withInsertionParent(parent, fn) {
|
|
702
|
-
const prev = insertionParent;
|
|
703
|
-
insertionParent = parent;
|
|
704
|
-
try {
|
|
705
|
-
return fn();
|
|
706
|
-
} finally {
|
|
707
|
-
insertionParent = prev;
|
|
708
|
-
}
|
|
709
|
-
}
|
|
710
754
|
let hydrationRt = null;
|
|
711
755
|
function installHydrationRuntime() {
|
|
712
756
|
hydrationRt = {
|
|
@@ -768,13 +812,8 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
768
812
|
const host = options && options.host;
|
|
769
813
|
if (multi && !initial) initial = [];
|
|
770
814
|
if (hydrationRt !== null) initial = hydrationRt.claimInitial(parent, multi, initial);
|
|
771
|
-
if (listDriver !== undefined && typeof accessor === "function" && accessor.$ll !== undefined) {
|
|
772
|
-
const listAccessor = accessor;
|
|
773
|
-
const owner = getOwner();
|
|
774
|
-
if (listDriver(parent, accessor, marker, () => runWithOwner(owner, () => insert(parent, () => listAccessor(), marker, marker !== undefined ? [] : undefined, options)))) return;
|
|
775
|
-
}
|
|
776
815
|
if (typeof accessor !== "function") {
|
|
777
|
-
accessor =
|
|
816
|
+
accessor = normalize(accessor, initial, multi, true);
|
|
778
817
|
if (typeof accessor !== "function") {
|
|
779
818
|
insertExpression(parent, accessor, initial, marker);
|
|
780
819
|
host && tagHost(accessor, host);
|
|
@@ -789,9 +828,9 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
789
828
|
let current = initial;
|
|
790
829
|
effect(prev => {
|
|
791
830
|
if (hydrationRt !== null) current = hydrationRt.reclaimRegion(current, parent, marker);
|
|
792
|
-
const value =
|
|
831
|
+
const value = normalize(accessor(), current, multi, true);
|
|
793
832
|
if (typeof value !== "function") return value;
|
|
794
|
-
effect(() => (hydrationRt !== null && (current = hydrationRt.reclaimRegion(current, parent, marker)),
|
|
833
|
+
effect(() => (hydrationRt !== null && (current = hydrationRt.reclaimRegion(current, parent, marker)), normalize(value, current, multi)), inner => {
|
|
795
834
|
current = insertExpression(parent, inner, current, marker);
|
|
796
835
|
host && tagHost(current, host);
|
|
797
836
|
}, prev !== undefined && !(options && options.schedule) ? {
|
|
@@ -810,6 +849,7 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
810
849
|
} : SCOPE_OPTIONS : options);
|
|
811
850
|
}
|
|
812
851
|
function assign(node, props, skipChildren, prevProps = {}, skipRef = false) {
|
|
852
|
+
tagElement(node);
|
|
813
853
|
const nodeName = node.nodeName;
|
|
814
854
|
props || (props = {});
|
|
815
855
|
for (const prop in prevProps) {
|
|
@@ -832,10 +872,16 @@ function assetEntryKey(descriptor) {
|
|
|
832
872
|
if (descriptor.policy === "exclusive") return "x|" + descriptor.key;
|
|
833
873
|
return descriptor.type === "inline-style" ? "i|" + descriptor.id : descriptor.type + "|" + descriptor.href;
|
|
834
874
|
}
|
|
835
|
-
function findAssetElement(selector, attr, value) {
|
|
875
|
+
function findAssetElement(selector, attr, value, qualifiers) {
|
|
836
876
|
const nodes = document.querySelectorAll(selector);
|
|
837
|
-
for (let i = 0; i < nodes.length; i++) {
|
|
838
|
-
if (nodes[i].getAttribute(attr)
|
|
877
|
+
outer: for (let i = 0; i < nodes.length; i++) {
|
|
878
|
+
if (nodes[i].getAttribute(attr) !== value) continue;
|
|
879
|
+
if (!qualifiers) return nodes[i];
|
|
880
|
+
for (let q = 0; q < RESOURCE_QUALIFIERS.length; q++) {
|
|
881
|
+
const name = RESOURCE_QUALIFIERS[q];
|
|
882
|
+
if (qualifierValue(name, qualifiers[name]) !== qualifierValue(name, nodes[i].getAttribute(name))) continue outer;
|
|
883
|
+
}
|
|
884
|
+
return nodes[i];
|
|
839
885
|
}
|
|
840
886
|
return null;
|
|
841
887
|
}
|
|
@@ -1141,8 +1187,8 @@ function mountHeadResource(tag, props) {
|
|
|
1141
1187
|
headMountedResources.add(identity);
|
|
1142
1188
|
const url = props.href || props.src;
|
|
1143
1189
|
let el = null;
|
|
1144
|
-
if (url != null) {
|
|
1145
|
-
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);
|
|
1190
|
+
if (tag === "link" && url == null && typeof props.imagesrcset === "string") el = findAssetElement(`link[rel="${props.rel}"]`, "href", null, props);else if (url != null) {
|
|
1191
|
+
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);
|
|
1146
1192
|
}
|
|
1147
1193
|
if (!el) document.head.appendChild(createHeadElement(tag, props));
|
|
1148
1194
|
}
|
|
@@ -1615,6 +1661,7 @@ function eventHandler(e, container, state) {
|
|
|
1615
1661
|
retarget(oriTarget);
|
|
1616
1662
|
}
|
|
1617
1663
|
function insertExpression(parent, value, current, marker) {
|
|
1664
|
+
tagElement(parent);
|
|
1618
1665
|
if (hydrationRt !== null && isHydrating(parent)) {
|
|
1619
1666
|
if (value && value !== current) {
|
|
1620
1667
|
const arr = Array.isArray(value);
|
|
@@ -1775,331 +1822,6 @@ function getHydrationKey() {
|
|
|
1775
1822
|
}
|
|
1776
1823
|
const RequestContext = Symbol();
|
|
1777
1824
|
|
|
1778
|
-
const PURE_ROW = Symbol.for("solid.pure-row");
|
|
1779
|
-
const arm = () => {
|
|
1780
|
-
installListDriver(driveList);
|
|
1781
|
-
};
|
|
1782
|
-
function rowProof(fn) {
|
|
1783
|
-
arm();
|
|
1784
|
-
fn[PURE_ROW] = true;
|
|
1785
|
-
return fn;
|
|
1786
|
-
}
|
|
1787
|
-
let rowCollector = null;
|
|
1788
|
-
const lisPositions = sources => {
|
|
1789
|
-
const n = sources.length;
|
|
1790
|
-
const tails = [];
|
|
1791
|
-
const tailsIdx = [];
|
|
1792
|
-
const prev = new Array(n).fill(-1);
|
|
1793
|
-
for (let j = 0; j < n; j++) {
|
|
1794
|
-
const v = sources[j];
|
|
1795
|
-
if (v === -1) continue;
|
|
1796
|
-
let lo = 0,
|
|
1797
|
-
hi = tails.length;
|
|
1798
|
-
while (lo < hi) {
|
|
1799
|
-
const mid = lo + hi >> 1;
|
|
1800
|
-
if (tails[mid] < v) lo = mid + 1;else hi = mid;
|
|
1801
|
-
}
|
|
1802
|
-
if (lo > 0) prev[j] = tailsIdx[lo - 1];
|
|
1803
|
-
tails[lo] = v;
|
|
1804
|
-
tailsIdx[lo] = j;
|
|
1805
|
-
}
|
|
1806
|
-
const stable = new Set();
|
|
1807
|
-
let k = tailsIdx.length ? tailsIdx[tails.length - 1] : -1;
|
|
1808
|
-
while (k >= 0) {
|
|
1809
|
-
stable.add(k);
|
|
1810
|
-
k = prev[k];
|
|
1811
|
-
}
|
|
1812
|
-
return stable;
|
|
1813
|
-
};
|
|
1814
|
-
const driveList = (parent, listFn, marker, lateClassic) => {
|
|
1815
|
-
const meta = listFn.$ll;
|
|
1816
|
-
if (meta.row?.[PURE_ROW] !== true) return false;
|
|
1817
|
-
if (typeof meta.keyed === "function") return false;
|
|
1818
|
-
const evalOwner = createOwner({
|
|
1819
|
-
id: "&each"
|
|
1820
|
-
});
|
|
1821
|
-
let subject = runWithOwner(evalOwner, () => untrack(meta.each));
|
|
1822
|
-
evalOwner.dispose();
|
|
1823
|
-
let raw = subject != null ? patchableRaw(subject) : undefined;
|
|
1824
|
-
if (raw === undefined || !Array.isArray(raw)) return false;
|
|
1825
|
-
const optimistic = storeHasOptimisticFamily(subject);
|
|
1826
|
-
if (optimistic) raw = untrack(() => Array.from(subject));
|
|
1827
|
-
const hydrating = !!sharedConfig.hydrating;
|
|
1828
|
-
if (hydrating && raw.length === 0) return false;
|
|
1829
|
-
let domRows;
|
|
1830
|
-
let rowIds;
|
|
1831
|
-
if (hydrating) {
|
|
1832
|
-
if (marker !== undefined) return false;
|
|
1833
|
-
domRows = Array.from(parent.children);
|
|
1834
|
-
if (domRows.length !== raw.length) return false;
|
|
1835
|
-
rowIds = new Array(raw.length);
|
|
1836
|
-
for (let i = 0; i < domRows.length; i++) {
|
|
1837
|
-
const key = domRows[i].getAttribute("_hk");
|
|
1838
|
-
if (key === null || !key.endsWith("0") || key.length < 2) return false;
|
|
1839
|
-
rowIds[i] = key.slice(0, -1);
|
|
1840
|
-
}
|
|
1841
|
-
}
|
|
1842
|
-
const rowFn = meta.row;
|
|
1843
|
-
const endAnchor = marker ?? null;
|
|
1844
|
-
const shallow = storeIsShallow(subject);
|
|
1845
|
-
let lastBodies = null;
|
|
1846
|
-
let lastUnbinds = null;
|
|
1847
|
-
const collectBind = (abs, build) => {
|
|
1848
|
-
const prevC = rowCollector;
|
|
1849
|
-
rowCollector = {
|
|
1850
|
-
row: shallow ? subject[abs] : undefined,
|
|
1851
|
-
bodies: [],
|
|
1852
|
-
unbinds: []
|
|
1853
|
-
};
|
|
1854
|
-
try {
|
|
1855
|
-
return build();
|
|
1856
|
-
} finally {
|
|
1857
|
-
lastBodies = rowCollector.bodies;
|
|
1858
|
-
lastUnbinds = rowCollector.unbinds;
|
|
1859
|
-
rowCollector = prevC;
|
|
1860
|
-
}
|
|
1861
|
-
};
|
|
1862
|
-
const listOwner = createOwner();
|
|
1863
|
-
let declined = false;
|
|
1864
|
-
const bindRow = (abs, claimId) => {
|
|
1865
|
-
{
|
|
1866
|
-
const o = listOwner;
|
|
1867
|
-
const prevChild = o._firstChild;
|
|
1868
|
-
const prevDisposal = o._disposal;
|
|
1869
|
-
const node = collectBind(abs, () => runWithOwner(listOwner, () => claimId !== undefined ? runWithOwner(createOwner({
|
|
1870
|
-
id: claimId
|
|
1871
|
-
}), () => untrack(() => rowFn(subject[abs]))) : untrack(() => rowFn(subject[abs]))));
|
|
1872
|
-
if (o._firstChild !== prevChild || o._disposal !== prevDisposal) {
|
|
1873
|
-
console.warn("A patch-mode list row created reactive computations or cleanups " + "during build (likely a handler/attribute value expression calling " + "createEffect/onCleanup). This work attaches to the LIST, not the " + "row, and will not dispose when the row is removed. Move owned " + "work into effects/refs (which opt the row out of patch mode).");
|
|
1874
|
-
}
|
|
1875
|
-
return node;
|
|
1876
|
-
}
|
|
1877
|
-
};
|
|
1878
|
-
let entries = new Array(raw.length);
|
|
1879
|
-
let rowBodies = shallow ? new Array(raw.length) : null;
|
|
1880
|
-
let rowUnbinds = new Array(raw.length);
|
|
1881
|
-
const runUnbinds = list => {
|
|
1882
|
-
if (list !== undefined) for (let u = 0; u < list.length; u++) list[u]();
|
|
1883
|
-
};
|
|
1884
|
-
const unbindAllRows = () => {
|
|
1885
|
-
for (let j = 0; j < rowUnbinds.length; j++) runUnbinds(rowUnbinds[j]);
|
|
1886
|
-
rowUnbinds = [];
|
|
1887
|
-
};
|
|
1888
|
-
let prevRaws = raw.slice();
|
|
1889
|
-
try {
|
|
1890
|
-
if (hydrating) {
|
|
1891
|
-
for (let i = 0; i < raw.length; i++) {
|
|
1892
|
-
entries[i] = bindRow(i, rowIds[i]);
|
|
1893
|
-
if (rowBodies !== null) rowBodies[i] = lastBodies;
|
|
1894
|
-
rowUnbinds[i] = lastUnbinds;
|
|
1895
|
-
}
|
|
1896
|
-
} else {
|
|
1897
|
-
for (let i = 0; i < raw.length; i++) {
|
|
1898
|
-
const node = bindRow(i);
|
|
1899
|
-
entries[i] = node;
|
|
1900
|
-
if (rowBodies !== null) rowBodies[i] = lastBodies;
|
|
1901
|
-
rowUnbinds[i] = lastUnbinds;
|
|
1902
|
-
parent.insertBefore(node, endAnchor);
|
|
1903
|
-
}
|
|
1904
|
-
}
|
|
1905
|
-
} catch (err) {
|
|
1906
|
-
unbindAllRows();
|
|
1907
|
-
runUnbinds(lastUnbinds ?? undefined);
|
|
1908
|
-
for (let j = 0; j < entries.length; j++) {
|
|
1909
|
-
const n = entries[j];
|
|
1910
|
-
if (n !== undefined && n.parentNode === parent) n.remove();
|
|
1911
|
-
}
|
|
1912
|
-
listOwner.dispose();
|
|
1913
|
-
throw err;
|
|
1914
|
-
}
|
|
1915
|
-
const identityOps = nextArr => {
|
|
1916
|
-
const keyOf = r => {
|
|
1917
|
-
const w = r != null ? patchableRaw(r) : undefined;
|
|
1918
|
-
return w !== undefined ? w : r;
|
|
1919
|
-
};
|
|
1920
|
-
const oldIndex = new Map();
|
|
1921
|
-
for (let j = 0; j < prevRaws.length; j++) {
|
|
1922
|
-
const k = keyOf(prevRaws[j]);
|
|
1923
|
-
const existing = oldIndex.get(k);
|
|
1924
|
-
if (existing === undefined) oldIndex.set(k, j);else if (Array.isArray(existing)) existing.push(j);else oldIndex.set(k, [existing, j]);
|
|
1925
|
-
}
|
|
1926
|
-
const sources = new Array(nextArr.length);
|
|
1927
|
-
for (let k = 0; k < nextArr.length; k++) {
|
|
1928
|
-
const m = oldIndex.get(keyOf(nextArr[k]));
|
|
1929
|
-
if (m === undefined) sources[k] = -1;else if (Array.isArray(m)) {
|
|
1930
|
-
sources[k] = m.shift();
|
|
1931
|
-
if (m.length === 1) oldIndex.set(keyOf(nextArr[k]), m[0]);
|
|
1932
|
-
} else {
|
|
1933
|
-
sources[k] = m;
|
|
1934
|
-
oldIndex.delete(keyOf(nextArr[k]));
|
|
1935
|
-
}
|
|
1936
|
-
}
|
|
1937
|
-
return {
|
|
1938
|
-
prefix: 0,
|
|
1939
|
-
sources
|
|
1940
|
-
};
|
|
1941
|
-
};
|
|
1942
|
-
let resyncNeeded = false;
|
|
1943
|
-
const applyOps = (next, ops) => {
|
|
1944
|
-
if (declined) return;
|
|
1945
|
-
if (resyncNeeded) ops = null;
|
|
1946
|
-
if (ops === null) ops = identityOps(next);
|
|
1947
|
-
const {
|
|
1948
|
-
prefix,
|
|
1949
|
-
sources
|
|
1950
|
-
} = ops;
|
|
1951
|
-
const built = new Array(sources.length);
|
|
1952
|
-
const builtBodies = rowBodies !== null ? new Array(sources.length) : null;
|
|
1953
|
-
const builtUnbinds = new Array(sources.length);
|
|
1954
|
-
let j = 0;
|
|
1955
|
-
try {
|
|
1956
|
-
for (; j < sources.length; j++) {
|
|
1957
|
-
const abs = prefix + j;
|
|
1958
|
-
const src = sources[j];
|
|
1959
|
-
if (src === -1 || refRebuild && src >= 0 && next[abs] !== prevRaws[src]) {
|
|
1960
|
-
built[j] = bindRow(abs);
|
|
1961
|
-
if (builtBodies !== null) builtBodies[j] = lastBodies;
|
|
1962
|
-
builtUnbinds[j] = lastUnbinds;
|
|
1963
|
-
}
|
|
1964
|
-
}
|
|
1965
|
-
} catch (err) {
|
|
1966
|
-
for (let k = 0; k < j; k++) runUnbinds(builtUnbinds[k]);
|
|
1967
|
-
runUnbinds(lastUnbinds ?? undefined);
|
|
1968
|
-
resyncNeeded = true;
|
|
1969
|
-
throw err;
|
|
1970
|
-
}
|
|
1971
|
-
const retained = new Set();
|
|
1972
|
-
for (let k = 0; k < sources.length; k++) {
|
|
1973
|
-
if (sources[k] >= 0 && built[k] === undefined) retained.add(sources[k]);
|
|
1974
|
-
}
|
|
1975
|
-
for (let k = prefix; k < entries.length; k++) {
|
|
1976
|
-
if (!retained.has(k)) {
|
|
1977
|
-
entries[k].remove();
|
|
1978
|
-
runUnbinds(rowUnbinds[k]);
|
|
1979
|
-
}
|
|
1980
|
-
}
|
|
1981
|
-
const newEntries = new Array(prefix + sources.length);
|
|
1982
|
-
const newBodies = rowBodies !== null ? new Array(prefix + sources.length) : null;
|
|
1983
|
-
const newUnbinds = new Array(prefix + sources.length);
|
|
1984
|
-
for (let i = 0; i < prefix; i++) {
|
|
1985
|
-
newEntries[i] = entries[i];
|
|
1986
|
-
if (newBodies !== null) newBodies[i] = rowBodies[i];
|
|
1987
|
-
newUnbinds[i] = rowUnbinds[i];
|
|
1988
|
-
}
|
|
1989
|
-
const stable = lisPositions(sources);
|
|
1990
|
-
let anchor = endAnchor;
|
|
1991
|
-
for (let k = sources.length - 1; k >= 0; k--) {
|
|
1992
|
-
const abs = prefix + k;
|
|
1993
|
-
const src = sources[k];
|
|
1994
|
-
let node;
|
|
1995
|
-
if (built[k] !== undefined) {
|
|
1996
|
-
node = built[k];
|
|
1997
|
-
if (newBodies !== null) newBodies[abs] = builtBodies[k];
|
|
1998
|
-
newUnbinds[abs] = builtUnbinds[k];
|
|
1999
|
-
parent.insertBefore(node, anchor);
|
|
2000
|
-
} else {
|
|
2001
|
-
node = entries[src];
|
|
2002
|
-
if (newBodies !== null) newBodies[abs] = rowBodies[src];
|
|
2003
|
-
newUnbinds[abs] = rowUnbinds[src];
|
|
2004
|
-
if (!stable.has(k)) parent.insertBefore(node, anchor);
|
|
2005
|
-
}
|
|
2006
|
-
newEntries[abs] = node;
|
|
2007
|
-
anchor = node;
|
|
2008
|
-
}
|
|
2009
|
-
entries = newEntries;
|
|
2010
|
-
if (newBodies !== null) rowBodies = newBodies;
|
|
2011
|
-
rowUnbinds = newUnbinds;
|
|
2012
|
-
prevRaws = next.slice();
|
|
2013
|
-
resyncNeeded = false;
|
|
2014
|
-
};
|
|
2015
|
-
let unbindOps = runWithOwner(listOwner, () => registerRowOps(subject, applyOps));
|
|
2016
|
-
const refRebuild = shallow && typeof meta.keyed !== "function";
|
|
2017
|
-
const rebuildSlot = i => {
|
|
2018
|
-
runUnbinds(rowUnbinds[i]);
|
|
2019
|
-
const old = entries[i];
|
|
2020
|
-
const node = bindRow(i);
|
|
2021
|
-
rowBodies[i] = lastBodies;
|
|
2022
|
-
rowUnbinds[i] = lastUnbinds;
|
|
2023
|
-
parent.insertBefore(node, old);
|
|
2024
|
-
old.remove();
|
|
2025
|
-
entries[i] = node;
|
|
2026
|
-
};
|
|
2027
|
-
const applySlot = (i, next, prev) => {
|
|
2028
|
-
if (declined) return;
|
|
2029
|
-
if (resyncNeeded) {
|
|
2030
|
-
const live = subject != null ? patchableRaw(subject) : undefined;
|
|
2031
|
-
if (live !== undefined && Array.isArray(live)) applyOps(live, null);
|
|
2032
|
-
return;
|
|
2033
|
-
}
|
|
2034
|
-
if (refRebuild) {
|
|
2035
|
-
rebuildSlot(i);
|
|
2036
|
-
prevRaws[i] = next;
|
|
2037
|
-
return;
|
|
2038
|
-
}
|
|
2039
|
-
const bodies = rowBodies[i];
|
|
2040
|
-
if (bodies !== undefined) {
|
|
2041
|
-
for (let b = 0; b < bodies.length; b++) bodies[b](next, prev, false);
|
|
2042
|
-
}
|
|
2043
|
-
prevRaws[i] = next;
|
|
2044
|
-
};
|
|
2045
|
-
let unbindSlots = shallow ? runWithOwner(listOwner, () => registerSlotPatch(subject, applySlot)) : null;
|
|
2046
|
-
runWithOwner(listOwner, () => effect(() => meta.each(), value => {
|
|
2047
|
-
if (declined || value === subject) return;
|
|
2048
|
-
const nextRaw = value != null ? patchableRaw(value) : undefined;
|
|
2049
|
-
unbindOps();
|
|
2050
|
-
unbindSlots?.();
|
|
2051
|
-
if (nextRaw !== undefined && Array.isArray(nextRaw) && storeIsShallow(value) !== shallow) {
|
|
2052
|
-
for (let j = 0; j < entries.length; j++) entries[j].remove();
|
|
2053
|
-
entries = [];
|
|
2054
|
-
prevRaws = [];
|
|
2055
|
-
unbindAllRows();
|
|
2056
|
-
subject = value;
|
|
2057
|
-
declined = true;
|
|
2058
|
-
listOwner.dispose();
|
|
2059
|
-
lateClassic?.();
|
|
2060
|
-
return;
|
|
2061
|
-
}
|
|
2062
|
-
if (nextRaw === undefined || !Array.isArray(nextRaw)) {
|
|
2063
|
-
for (let j = 0; j < entries.length; j++) entries[j].remove();
|
|
2064
|
-
entries = [];
|
|
2065
|
-
prevRaws = [];
|
|
2066
|
-
unbindAllRows();
|
|
2067
|
-
subject = value;
|
|
2068
|
-
declined = true;
|
|
2069
|
-
listOwner.dispose();
|
|
2070
|
-
lateClassic?.();
|
|
2071
|
-
return;
|
|
2072
|
-
}
|
|
2073
|
-
const swapOps = identityOps(nextRaw);
|
|
2074
|
-
subject = value;
|
|
2075
|
-
unbindOps = runWithOwner(listOwner, () => registerRowOps(subject, applyOps));
|
|
2076
|
-
if (shallow) unbindSlots = runWithOwner(listOwner, () => registerSlotPatch(subject, applySlot));
|
|
2077
|
-
applyOps(nextRaw, swapOps);
|
|
2078
|
-
}));
|
|
2079
|
-
onCleanup(() => {
|
|
2080
|
-
unbindOps();
|
|
2081
|
-
unbindSlots?.();
|
|
2082
|
-
unbindAllRows();
|
|
2083
|
-
listOwner.dispose();
|
|
2084
|
-
});
|
|
2085
|
-
return true;
|
|
2086
|
-
};
|
|
2087
|
-
const patchDriver = (subject, body) => {
|
|
2088
|
-
const raw = patchableRaw(subject);
|
|
2089
|
-
if (raw !== undefined) {
|
|
2090
|
-
if (!sharedConfig.hydrating) body(raw, undefined, true);
|
|
2091
|
-
const unbind = registerPatch(subject, body);
|
|
2092
|
-
if (rowCollector !== null) rowCollector.unbinds.push(unbind);
|
|
2093
|
-
else onCleanup(unbind);
|
|
2094
|
-
} else if (rowCollector !== null && subject === rowCollector.row) {
|
|
2095
|
-
rowCollector.bodies.push(body);
|
|
2096
|
-
if (!sharedConfig.hydrating) body(subject, undefined, true);
|
|
2097
|
-
} else {
|
|
2098
|
-
effect(() => body(subject, subject, false),
|
|
2099
|
-
() => untrack(() => body(subject, undefined, true)));
|
|
2100
|
-
}
|
|
2101
|
-
};
|
|
2102
|
-
|
|
2103
1825
|
function throwInBrowser(func) {
|
|
2104
1826
|
const err = new Error(`${func.name} is not supported in the browser, returning undefined`);
|
|
2105
1827
|
console.error(err);
|
|
@@ -2317,7 +2039,7 @@ const COMPONENT_BINDING = Symbol.for("solid.component-binding");
|
|
|
2317
2039
|
function bindingOf(value) {
|
|
2318
2040
|
return value !== null && (typeof value === "function" || typeof value === "object") && value[COMPONENT_BINDING] || undefined;
|
|
2319
2041
|
}
|
|
2320
|
-
function dynamic(source) {
|
|
2042
|
+
function dynamic(source, _options) {
|
|
2321
2043
|
let latest = 0;
|
|
2322
2044
|
const sites = new Set();
|
|
2323
2045
|
let deliveredAddress;
|
|
@@ -2361,24 +2083,9 @@ function dynamic(source) {
|
|
|
2361
2083
|
return untrack(() => component(props));
|
|
2362
2084
|
}
|
|
2363
2085
|
case "string":
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
spread(el, props);
|
|
2368
|
-
return el;
|
|
2369
|
-
}
|
|
2370
|
-
const owner = getOwner();
|
|
2371
|
-
let el;
|
|
2372
|
-
return () => {
|
|
2373
|
-
if (!el) {
|
|
2374
|
-
runWithOwner(owner, () => {
|
|
2375
|
-
el = createElement(component, untrack(() => props.is));
|
|
2376
|
-
spread(el, props);
|
|
2377
|
-
});
|
|
2378
|
-
}
|
|
2379
|
-
return el;
|
|
2380
|
-
};
|
|
2381
|
-
}
|
|
2086
|
+
const el = sharedConfig.hydrating ? getNextElement() : createElement(component, untrack(() => props.is));
|
|
2087
|
+
spread(el, props);
|
|
2088
|
+
return el;
|
|
2382
2089
|
}
|
|
2383
2090
|
});
|
|
2384
2091
|
};
|
|
@@ -2387,15 +2094,8 @@ function Dynamic(props) {
|
|
|
2387
2094
|
const Comp = dynamic(() => props.component);
|
|
2388
2095
|
return createComponent(Comp, omit(props, "component"));
|
|
2389
2096
|
}
|
|
2390
|
-
const AmbiguousSVGElements = /*#__PURE__*/new Set(["a", "script", "style", "title"]);
|
|
2391
2097
|
function createElement(tagName, is = undefined) {
|
|
2392
|
-
|
|
2393
|
-
if (MathMLElements.has(tagName)) return document.createElementNS(Namespaces.mathml, tagName);
|
|
2394
|
-
if (AmbiguousSVGElements.has(tagName)) {
|
|
2395
|
-
const parent = getInsertionParent();
|
|
2396
|
-
if (parent && parent.namespaceURI === Namespaces.svg && parent.localName !== "foreignObject") return document.createElementNS(Namespaces.svg, tagName);
|
|
2397
|
-
}
|
|
2398
|
-
return document.createElement(tagName, {
|
|
2098
|
+
return SVGElements.has(tagName) ? document.createElementNS(Namespaces.svg, tagName) : MathMLElements.has(tagName) ? document.createElementNS(Namespaces.mathml, tagName) : document.createElement(tagName, {
|
|
2399
2099
|
is
|
|
2400
2100
|
});
|
|
2401
2101
|
}
|
|
@@ -2427,4 +2127,4 @@ _moduleUrl) {
|
|
|
2427
2127
|
function httpStatus(_code, _text) {}
|
|
2428
2128
|
function httpHeader(_name, _value, _options) {}
|
|
2429
2129
|
|
|
2430
|
-
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,
|
|
2130
|
+
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 };
|