@solidjs/web 2.0.0-rc.6 → 2.0.0-rc.8
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 → server.dev.js} +274 -272
- package/dist/server.js +119 -36
- package/dist/{dev.js → web.dev.js} +131 -399
- package/dist/web.js +78 -388
- package/dist/{web.cjs → web.observe.js} +174 -622
- package/frames/dist/client.dev.js +11 -3
- package/frames/dist/client.js +11 -3
- package/frames/dist/{server.cjs → server.dev.js} +375 -125
- package/frames/dist/server.js +253 -32
- package/frames/package.json +7 -15
- package/package.json +88 -251
- package/serialization/decode/package.json +3 -9
- package/serialization/dist/decode.js +18 -4
- package/serialization/dist/serialization.js +18 -4
- package/serialization/package.json +3 -9
- package/serialization/types/serializer-decode.d.ts +49 -2
- package/server-functions/dist/client.js +13 -14
- package/server-functions/dist/server.dev.js +359 -85
- package/server-functions/dist/server.js +352 -86
- package/server-functions/package.json +6 -24
- package/server-functions/rich-args/package.json +3 -9
- package/storage/package.json +3 -9
- package/types/client.d.ts +17 -3
- package/types/frames/frame-client.d.ts +1 -1
- package/types/frames/serializer-decode.d.ts +49 -2
- 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/serializer-decode.d.ts +49 -2
- package/types/server-functions/flash.d.ts +12 -3
- package/types/server-functions/server.d.ts +50 -3
- package/types/server-mock.d.ts +43 -7
- package/types/server.d.ts +48 -6
- package/dist/dev.cjs +0 -2590
- package/frames/dist/client.cjs +0 -2035
- package/frames/dist/client.dev.cjs +0 -2055
- package/serialization/dist/decode.cjs +0 -141
- package/serialization/dist/serialization.cjs +0 -261
- package/serialization/types-cjs/index.d.cts +0 -101
- package/serialization/types-cjs/package.json +0 -3
- package/serialization/types-cjs/serializer-decode.d.cts +0 -172
- package/serialization/types-cjs/serializer.d.cts +0 -101
- package/server-functions/dist/client.cjs +0 -1070
- package/server-functions/dist/rich-args.cjs +0 -11
- package/server-functions/dist/server.cjs +0 -2133
- package/server-functions/dist/server.dev.cjs +0 -2153
- package/storage/dist/storage.cjs +0 -12
- package/storage/types-cjs/index.d.cts +0 -28
- package/storage/types-cjs/package.json +0 -3
- package/types/patch-driver.d.ts +0 -3
- package/types-cjs/client.d.cts +0 -200
- package/types-cjs/constants.d.cts +0 -20
- package/types-cjs/cookies.d.cts +0 -41
- package/types-cjs/frames/client.d.cts +0 -36
- package/types-cjs/frames/frame-client.d.cts +0 -370
- package/types-cjs/frames/frame-container-plugin.d.cts +0 -71
- package/types-cjs/frames/frame-sink.d.cts +0 -92
- package/types-cjs/frames/frame-transport.d.cts +0 -189
- package/types-cjs/frames/serializer-decode.d.cts +0 -172
- package/types-cjs/frames/serializer.d.cts +0 -101
- package/types-cjs/frames/server.d.cts +0 -52
- package/types-cjs/head.d.cts +0 -16
- package/types-cjs/index.d.cts +0 -180
- package/types-cjs/index.server.d.cts +0 -125
- package/types-cjs/jsx-properties.d.cts +0 -93
- package/types-cjs/jsx.d.cts +0 -4146
- package/types-cjs/package.json +0 -3
- package/types-cjs/patch-driver.d.cts +0 -3
- package/types-cjs/reconcile.d.cts +0 -1
- package/types-cjs/render.d.cts +0 -4
- package/types-cjs/response.d.cts +0 -81
- package/types-cjs/serializer-decode.d.cts +0 -172
- package/types-cjs/serializer.d.cts +0 -101
- package/types-cjs/server-functions/client.d.cts +0 -184
- package/types-cjs/server-functions/flash.d.cts +0 -27
- package/types-cjs/server-functions/registry.d.cts +0 -100
- package/types-cjs/server-functions/rich-args.d.cts +0 -1
- package/types-cjs/server-functions/server.d.cts +0 -522
- package/types-cjs/server-functions/shared.d.cts +0 -283
- package/types-cjs/server-mock.d.cts +0 -301
- package/types-cjs/server.d.cts +0 -366
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, $PROXY, untrack, runWithOwner, createRoot, flatten, flush, mergeSources, 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 = {
|
|
@@ -58,11 +58,12 @@ const syncOptions = {
|
|
|
58
58
|
sync: true
|
|
59
59
|
};
|
|
60
60
|
function effect(fn, effectFn, options) {
|
|
61
|
-
|
|
61
|
+
const nodeOptions = options ? {
|
|
62
62
|
sync: true,
|
|
63
63
|
...options,
|
|
64
64
|
transparent: !options.scope
|
|
65
|
-
} : transparentOptions
|
|
65
|
+
} : transparentOptions;
|
|
66
|
+
createRenderEffect(fn, effectFn, nodeOptions);
|
|
66
67
|
}
|
|
67
68
|
function memo(fn) {
|
|
68
69
|
return createMemo(() => fn(), syncOptions);
|
|
@@ -211,12 +212,24 @@ function classifyHeadTag(desc) {
|
|
|
211
212
|
resource: false
|
|
212
213
|
};
|
|
213
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
|
+
}
|
|
214
226
|
function resourceIdentity(tag, props) {
|
|
215
|
-
|
|
227
|
+
const url = String(props.href || props.src || "");
|
|
228
|
+
let id = "res:" + tag + ":" + (props.rel || "") + ":" + url.length + ":" + url;
|
|
216
229
|
for (let i = 0; i < RESOURCE_QUALIFIERS.length; i++) {
|
|
217
230
|
const q = RESOURCE_QUALIFIERS[i];
|
|
218
|
-
const value = props[q];
|
|
219
|
-
if (value
|
|
231
|
+
const value = qualifierValue(q, props[q]);
|
|
232
|
+
if (value !== null) id += ":" + q + "=" + value.length + ":" + value;
|
|
220
233
|
}
|
|
221
234
|
return id;
|
|
222
235
|
}
|
|
@@ -335,10 +348,6 @@ const waitAsset = promise => {
|
|
|
335
348
|
}
|
|
336
349
|
gate();
|
|
337
350
|
};
|
|
338
|
-
let listDriver;
|
|
339
|
-
function installListDriver(driver) {
|
|
340
|
-
listDriver = driver;
|
|
341
|
-
}
|
|
342
351
|
const $$EVENT_OWNER = "_$SOLID_EVENT_OWNER";
|
|
343
352
|
const $$EVENT_TUPLE = Symbol();
|
|
344
353
|
const hasOwn = Object.prototype.hasOwnProperty;
|
|
@@ -613,13 +622,28 @@ function style(node, value, prev) {
|
|
|
613
622
|
}
|
|
614
623
|
}
|
|
615
624
|
}
|
|
625
|
+
function readShallow(value) {
|
|
626
|
+
if (value === null || typeof value !== "object") return value;
|
|
627
|
+
if (Array.isArray(value)) return value.map(readShallow);
|
|
628
|
+
if (value[$PROXY] !== value) return value;
|
|
629
|
+
const keys = ownKeys(value);
|
|
630
|
+
const out = {};
|
|
631
|
+
for (let i = 0; i < keys.length; i++) {
|
|
632
|
+
const k = keys[i];
|
|
633
|
+
if (typeof k === "string") out[k] = value[k];
|
|
634
|
+
}
|
|
635
|
+
return out;
|
|
636
|
+
}
|
|
637
|
+
function ownKeys(o) {
|
|
638
|
+
return o[$PROXY] === o ? Reflect.ownKeys(o) : Object.keys(o);
|
|
639
|
+
}
|
|
616
640
|
function setStyleProperty(node, name, value) {
|
|
617
641
|
if (isHydrating(node)) return;
|
|
618
642
|
value != null ? node.style.setProperty(name, value) : node.style.removeProperty(name);
|
|
619
643
|
}
|
|
620
|
-
function spread(node, props
|
|
644
|
+
function spread(node, props, skipChildren) {
|
|
621
645
|
const prevProps = {};
|
|
622
|
-
const get = typeof props === "function" ? props :
|
|
646
|
+
const get = () => (typeof props === "function" ? props() : props) ?? {};
|
|
623
647
|
if (!skipChildren) insert(node, () => {
|
|
624
648
|
const source = get();
|
|
625
649
|
return hasOwn.call(source, "children") ? source.children : undefined;
|
|
@@ -632,15 +656,27 @@ function spread(node, props = {}, skipChildren) {
|
|
|
632
656
|
effect(() => {
|
|
633
657
|
const source = get();
|
|
634
658
|
const newProps = {};
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
659
|
+
const sources = mergeSources(source);
|
|
660
|
+
if (sources !== undefined) {
|
|
661
|
+
for (let i = 0; i < sources.length; i++) {
|
|
662
|
+
let s = sources[i];
|
|
663
|
+
if (typeof s === "function") s = s();
|
|
664
|
+
if (s != null) collectProps(newProps, s);
|
|
665
|
+
}
|
|
666
|
+
} else collectProps(newProps, source);
|
|
640
667
|
return newProps;
|
|
641
668
|
}, props => assign(node, props, true, prevProps, true));
|
|
642
669
|
return prevProps;
|
|
643
670
|
}
|
|
671
|
+
function collectProps(out, s) {
|
|
672
|
+
const keys = ownKeys(s);
|
|
673
|
+
for (let i = 0; i < keys.length; i++) {
|
|
674
|
+
const prop = keys[i];
|
|
675
|
+
if (typeof prop !== "string" || prop === "children" || prop === "ref") continue;
|
|
676
|
+
const v = s[prop];
|
|
677
|
+
out[prop] = prop === "style" || prop === "class" ? readShallow(v) : v;
|
|
678
|
+
}
|
|
679
|
+
}
|
|
644
680
|
function dynamicProperty(props, key) {
|
|
645
681
|
const src = props[key];
|
|
646
682
|
Object.defineProperty(props, key, {
|
|
@@ -665,19 +701,6 @@ function scope(fn) {
|
|
|
665
701
|
const SCOPE_OPTIONS = {
|
|
666
702
|
scope: true
|
|
667
703
|
};
|
|
668
|
-
let insertionParent = null;
|
|
669
|
-
function getInsertionParent() {
|
|
670
|
-
return insertionParent;
|
|
671
|
-
}
|
|
672
|
-
function withInsertionParent(parent, fn) {
|
|
673
|
-
const prev = insertionParent;
|
|
674
|
-
insertionParent = parent;
|
|
675
|
-
try {
|
|
676
|
-
return fn();
|
|
677
|
-
} finally {
|
|
678
|
-
insertionParent = prev;
|
|
679
|
-
}
|
|
680
|
-
}
|
|
681
704
|
let hydrationRt = null;
|
|
682
705
|
function installHydrationRuntime() {
|
|
683
706
|
hydrationRt = {
|
|
@@ -739,13 +762,8 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
739
762
|
const host = options && options.host;
|
|
740
763
|
if (multi && !initial) initial = [];
|
|
741
764
|
if (hydrationRt !== null) initial = hydrationRt.claimInitial(parent, multi, initial);
|
|
742
|
-
if (listDriver !== undefined && typeof accessor === "function" && accessor.$ll !== undefined) {
|
|
743
|
-
const listAccessor = accessor;
|
|
744
|
-
const owner = getOwner();
|
|
745
|
-
if (listDriver(parent, accessor, marker, () => runWithOwner(owner, () => insert(parent, () => listAccessor(), marker, marker !== undefined ? [] : undefined, options)))) return;
|
|
746
|
-
}
|
|
747
765
|
if (typeof accessor !== "function") {
|
|
748
|
-
accessor =
|
|
766
|
+
accessor = normalize(accessor, initial, multi, true);
|
|
749
767
|
if (typeof accessor !== "function") {
|
|
750
768
|
insertExpression(parent, accessor, initial, marker);
|
|
751
769
|
host && tagHost(accessor, host);
|
|
@@ -760,9 +778,9 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
760
778
|
let current = initial;
|
|
761
779
|
effect(prev => {
|
|
762
780
|
if (hydrationRt !== null) current = hydrationRt.reclaimRegion(current, parent, marker);
|
|
763
|
-
const value =
|
|
781
|
+
const value = normalize(accessor(), current, multi, true);
|
|
764
782
|
if (typeof value !== "function") return value;
|
|
765
|
-
effect(() => (hydrationRt !== null && (current = hydrationRt.reclaimRegion(current, parent, marker)),
|
|
783
|
+
effect(() => (hydrationRt !== null && (current = hydrationRt.reclaimRegion(current, parent, marker)), normalize(value, current, multi)), inner => {
|
|
766
784
|
current = insertExpression(parent, inner, current, marker);
|
|
767
785
|
host && tagHost(current, host);
|
|
768
786
|
}, prev !== undefined && !(options && options.schedule) ? {
|
|
@@ -803,10 +821,16 @@ function assetEntryKey(descriptor) {
|
|
|
803
821
|
if (descriptor.policy === "exclusive") return "x|" + descriptor.key;
|
|
804
822
|
return descriptor.type === "inline-style" ? "i|" + descriptor.id : descriptor.type + "|" + descriptor.href;
|
|
805
823
|
}
|
|
806
|
-
function findAssetElement(selector, attr, value) {
|
|
824
|
+
function findAssetElement(selector, attr, value, qualifiers) {
|
|
807
825
|
const nodes = document.querySelectorAll(selector);
|
|
808
|
-
for (let i = 0; i < nodes.length; i++) {
|
|
809
|
-
if (nodes[i].getAttribute(attr)
|
|
826
|
+
outer: for (let i = 0; i < nodes.length; i++) {
|
|
827
|
+
if (nodes[i].getAttribute(attr) !== value) continue;
|
|
828
|
+
if (!qualifiers) return nodes[i];
|
|
829
|
+
for (let q = 0; q < RESOURCE_QUALIFIERS.length; q++) {
|
|
830
|
+
const name = RESOURCE_QUALIFIERS[q];
|
|
831
|
+
if (qualifierValue(name, qualifiers[name]) !== qualifierValue(name, nodes[i].getAttribute(name))) continue outer;
|
|
832
|
+
}
|
|
833
|
+
return nodes[i];
|
|
810
834
|
}
|
|
811
835
|
return null;
|
|
812
836
|
}
|
|
@@ -1110,8 +1134,8 @@ function mountHeadResource(tag, props) {
|
|
|
1110
1134
|
headMountedResources.add(identity);
|
|
1111
1135
|
const url = props.href || props.src;
|
|
1112
1136
|
let el = null;
|
|
1113
|
-
if (url != null) {
|
|
1114
|
-
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);
|
|
1137
|
+
if (tag === "link" && url == null && typeof props.imagesrcset === "string") el = findAssetElement(`link[rel="${props.rel}"]`, "href", null, props);else if (url != null) {
|
|
1138
|
+
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);
|
|
1115
1139
|
}
|
|
1116
1140
|
if (!el) document.head.appendChild(createHeadElement(tag, props));
|
|
1117
1141
|
}
|
|
@@ -1281,9 +1305,13 @@ function hydrate(code, element, options = {}) {
|
|
|
1281
1305
|
sharedConfig.hydrating = false;
|
|
1282
1306
|
}
|
|
1283
1307
|
}, err => {
|
|
1284
|
-
console.error("Hydration module preload failed, falling back to client render:", err);
|
|
1285
1308
|
sharedConfig.hydrating = false;
|
|
1286
1309
|
sharedConfig.registry = undefined;
|
|
1310
|
+
if (element.nodeType === 9) {
|
|
1311
|
+
(globalThis.reportError || console.error)(err);
|
|
1312
|
+
return;
|
|
1313
|
+
}
|
|
1314
|
+
console.error("Hydration module preload failed, falling back to client render:", err);
|
|
1287
1315
|
disposer = render(code, element, [...element.childNodes], options);
|
|
1288
1316
|
});
|
|
1289
1317
|
return () => disposer && disposer();
|
|
@@ -1688,322 +1716,6 @@ function getHydrationKey() {
|
|
|
1688
1716
|
}
|
|
1689
1717
|
const RequestContext = Symbol();
|
|
1690
1718
|
|
|
1691
|
-
const PURE_ROW = Symbol.for("solid.pure-row");
|
|
1692
|
-
const arm = () => {
|
|
1693
|
-
installListDriver(driveList);
|
|
1694
|
-
};
|
|
1695
|
-
function rowProof(fn) {
|
|
1696
|
-
arm();
|
|
1697
|
-
fn[PURE_ROW] = true;
|
|
1698
|
-
return fn;
|
|
1699
|
-
}
|
|
1700
|
-
let rowCollector = null;
|
|
1701
|
-
const lisPositions = sources => {
|
|
1702
|
-
const n = sources.length;
|
|
1703
|
-
const tails = [];
|
|
1704
|
-
const tailsIdx = [];
|
|
1705
|
-
const prev = new Array(n).fill(-1);
|
|
1706
|
-
for (let j = 0; j < n; j++) {
|
|
1707
|
-
const v = sources[j];
|
|
1708
|
-
if (v === -1) continue;
|
|
1709
|
-
let lo = 0,
|
|
1710
|
-
hi = tails.length;
|
|
1711
|
-
while (lo < hi) {
|
|
1712
|
-
const mid = lo + hi >> 1;
|
|
1713
|
-
if (tails[mid] < v) lo = mid + 1;else hi = mid;
|
|
1714
|
-
}
|
|
1715
|
-
if (lo > 0) prev[j] = tailsIdx[lo - 1];
|
|
1716
|
-
tails[lo] = v;
|
|
1717
|
-
tailsIdx[lo] = j;
|
|
1718
|
-
}
|
|
1719
|
-
const stable = new Set();
|
|
1720
|
-
let k = tailsIdx.length ? tailsIdx[tails.length - 1] : -1;
|
|
1721
|
-
while (k >= 0) {
|
|
1722
|
-
stable.add(k);
|
|
1723
|
-
k = prev[k];
|
|
1724
|
-
}
|
|
1725
|
-
return stable;
|
|
1726
|
-
};
|
|
1727
|
-
const driveList = (parent, listFn, marker, lateClassic) => {
|
|
1728
|
-
const meta = listFn.$ll;
|
|
1729
|
-
if (meta.row?.[PURE_ROW] !== true) return false;
|
|
1730
|
-
if (typeof meta.keyed === "function") return false;
|
|
1731
|
-
const evalOwner = createOwner({
|
|
1732
|
-
id: "&each"
|
|
1733
|
-
});
|
|
1734
|
-
let subject = runWithOwner(evalOwner, () => untrack(meta.each));
|
|
1735
|
-
evalOwner.dispose();
|
|
1736
|
-
let raw = subject != null ? patchableRaw(subject) : undefined;
|
|
1737
|
-
if (raw === undefined || !Array.isArray(raw)) return false;
|
|
1738
|
-
const optimistic = storeHasOptimisticFamily(subject);
|
|
1739
|
-
if (optimistic) raw = untrack(() => Array.from(subject));
|
|
1740
|
-
const hydrating = !!sharedConfig.hydrating;
|
|
1741
|
-
if (hydrating && raw.length === 0) return false;
|
|
1742
|
-
let domRows;
|
|
1743
|
-
let rowIds;
|
|
1744
|
-
if (hydrating) {
|
|
1745
|
-
if (marker !== undefined) return false;
|
|
1746
|
-
domRows = Array.from(parent.children);
|
|
1747
|
-
if (domRows.length !== raw.length) return false;
|
|
1748
|
-
rowIds = new Array(raw.length);
|
|
1749
|
-
for (let i = 0; i < domRows.length; i++) {
|
|
1750
|
-
const key = domRows[i].getAttribute("_hk");
|
|
1751
|
-
if (key === null || !key.endsWith("0") || key.length < 2) return false;
|
|
1752
|
-
rowIds[i] = key.slice(0, -1);
|
|
1753
|
-
}
|
|
1754
|
-
}
|
|
1755
|
-
const rowFn = meta.row;
|
|
1756
|
-
const endAnchor = marker ?? null;
|
|
1757
|
-
const shallow = storeIsShallow(subject);
|
|
1758
|
-
let lastBodies = null;
|
|
1759
|
-
let lastUnbinds = null;
|
|
1760
|
-
const collectBind = (abs, build) => {
|
|
1761
|
-
const prevC = rowCollector;
|
|
1762
|
-
rowCollector = {
|
|
1763
|
-
row: shallow ? subject[abs] : undefined,
|
|
1764
|
-
bodies: [],
|
|
1765
|
-
unbinds: []
|
|
1766
|
-
};
|
|
1767
|
-
try {
|
|
1768
|
-
return build();
|
|
1769
|
-
} finally {
|
|
1770
|
-
lastBodies = rowCollector.bodies;
|
|
1771
|
-
lastUnbinds = rowCollector.unbinds;
|
|
1772
|
-
rowCollector = prevC;
|
|
1773
|
-
}
|
|
1774
|
-
};
|
|
1775
|
-
const listOwner = createOwner();
|
|
1776
|
-
let declined = false;
|
|
1777
|
-
const bindRow = (abs, claimId) => {
|
|
1778
|
-
return collectBind(abs, () => runWithOwner(listOwner, () => claimId !== undefined ? runWithOwner(createOwner({
|
|
1779
|
-
id: claimId
|
|
1780
|
-
}), () => untrack(() => rowFn(subject[abs]))) : untrack(() => rowFn(subject[abs]))));
|
|
1781
|
-
};
|
|
1782
|
-
let entries = new Array(raw.length);
|
|
1783
|
-
let rowBodies = shallow ? new Array(raw.length) : null;
|
|
1784
|
-
let rowUnbinds = new Array(raw.length);
|
|
1785
|
-
const runUnbinds = list => {
|
|
1786
|
-
if (list !== undefined) for (let u = 0; u < list.length; u++) list[u]();
|
|
1787
|
-
};
|
|
1788
|
-
const unbindAllRows = () => {
|
|
1789
|
-
for (let j = 0; j < rowUnbinds.length; j++) runUnbinds(rowUnbinds[j]);
|
|
1790
|
-
rowUnbinds = [];
|
|
1791
|
-
};
|
|
1792
|
-
let prevRaws = raw.slice();
|
|
1793
|
-
try {
|
|
1794
|
-
if (hydrating) {
|
|
1795
|
-
for (let i = 0; i < raw.length; i++) {
|
|
1796
|
-
entries[i] = bindRow(i, rowIds[i]);
|
|
1797
|
-
if (rowBodies !== null) rowBodies[i] = lastBodies;
|
|
1798
|
-
rowUnbinds[i] = lastUnbinds;
|
|
1799
|
-
}
|
|
1800
|
-
} else {
|
|
1801
|
-
for (let i = 0; i < raw.length; i++) {
|
|
1802
|
-
const node = bindRow(i);
|
|
1803
|
-
entries[i] = node;
|
|
1804
|
-
if (rowBodies !== null) rowBodies[i] = lastBodies;
|
|
1805
|
-
rowUnbinds[i] = lastUnbinds;
|
|
1806
|
-
parent.insertBefore(node, endAnchor);
|
|
1807
|
-
}
|
|
1808
|
-
}
|
|
1809
|
-
} catch (err) {
|
|
1810
|
-
unbindAllRows();
|
|
1811
|
-
runUnbinds(lastUnbinds ?? undefined);
|
|
1812
|
-
for (let j = 0; j < entries.length; j++) {
|
|
1813
|
-
const n = entries[j];
|
|
1814
|
-
if (n !== undefined && n.parentNode === parent) n.remove();
|
|
1815
|
-
}
|
|
1816
|
-
listOwner.dispose();
|
|
1817
|
-
throw err;
|
|
1818
|
-
}
|
|
1819
|
-
const identityOps = nextArr => {
|
|
1820
|
-
const keyOf = r => {
|
|
1821
|
-
const w = r != null ? patchableRaw(r) : undefined;
|
|
1822
|
-
return w !== undefined ? w : r;
|
|
1823
|
-
};
|
|
1824
|
-
const oldIndex = new Map();
|
|
1825
|
-
for (let j = 0; j < prevRaws.length; j++) {
|
|
1826
|
-
const k = keyOf(prevRaws[j]);
|
|
1827
|
-
const existing = oldIndex.get(k);
|
|
1828
|
-
if (existing === undefined) oldIndex.set(k, j);else if (Array.isArray(existing)) existing.push(j);else oldIndex.set(k, [existing, j]);
|
|
1829
|
-
}
|
|
1830
|
-
const sources = new Array(nextArr.length);
|
|
1831
|
-
for (let k = 0; k < nextArr.length; k++) {
|
|
1832
|
-
const m = oldIndex.get(keyOf(nextArr[k]));
|
|
1833
|
-
if (m === undefined) sources[k] = -1;else if (Array.isArray(m)) {
|
|
1834
|
-
sources[k] = m.shift();
|
|
1835
|
-
if (m.length === 1) oldIndex.set(keyOf(nextArr[k]), m[0]);
|
|
1836
|
-
} else {
|
|
1837
|
-
sources[k] = m;
|
|
1838
|
-
oldIndex.delete(keyOf(nextArr[k]));
|
|
1839
|
-
}
|
|
1840
|
-
}
|
|
1841
|
-
return {
|
|
1842
|
-
prefix: 0,
|
|
1843
|
-
sources
|
|
1844
|
-
};
|
|
1845
|
-
};
|
|
1846
|
-
let resyncNeeded = false;
|
|
1847
|
-
const applyOps = (next, ops) => {
|
|
1848
|
-
if (declined) return;
|
|
1849
|
-
if (resyncNeeded) ops = null;
|
|
1850
|
-
if (ops === null) ops = identityOps(next);
|
|
1851
|
-
const {
|
|
1852
|
-
prefix,
|
|
1853
|
-
sources
|
|
1854
|
-
} = ops;
|
|
1855
|
-
const built = new Array(sources.length);
|
|
1856
|
-
const builtBodies = rowBodies !== null ? new Array(sources.length) : null;
|
|
1857
|
-
const builtUnbinds = new Array(sources.length);
|
|
1858
|
-
let j = 0;
|
|
1859
|
-
try {
|
|
1860
|
-
for (; j < sources.length; j++) {
|
|
1861
|
-
const abs = prefix + j;
|
|
1862
|
-
const src = sources[j];
|
|
1863
|
-
if (src === -1 || refRebuild && src >= 0 && next[abs] !== prevRaws[src]) {
|
|
1864
|
-
built[j] = bindRow(abs);
|
|
1865
|
-
if (builtBodies !== null) builtBodies[j] = lastBodies;
|
|
1866
|
-
builtUnbinds[j] = lastUnbinds;
|
|
1867
|
-
}
|
|
1868
|
-
}
|
|
1869
|
-
} catch (err) {
|
|
1870
|
-
for (let k = 0; k < j; k++) runUnbinds(builtUnbinds[k]);
|
|
1871
|
-
runUnbinds(lastUnbinds ?? undefined);
|
|
1872
|
-
resyncNeeded = true;
|
|
1873
|
-
throw err;
|
|
1874
|
-
}
|
|
1875
|
-
const retained = new Set();
|
|
1876
|
-
for (let k = 0; k < sources.length; k++) {
|
|
1877
|
-
if (sources[k] >= 0 && built[k] === undefined) retained.add(sources[k]);
|
|
1878
|
-
}
|
|
1879
|
-
for (let k = prefix; k < entries.length; k++) {
|
|
1880
|
-
if (!retained.has(k)) {
|
|
1881
|
-
entries[k].remove();
|
|
1882
|
-
runUnbinds(rowUnbinds[k]);
|
|
1883
|
-
}
|
|
1884
|
-
}
|
|
1885
|
-
const newEntries = new Array(prefix + sources.length);
|
|
1886
|
-
const newBodies = rowBodies !== null ? new Array(prefix + sources.length) : null;
|
|
1887
|
-
const newUnbinds = new Array(prefix + sources.length);
|
|
1888
|
-
for (let i = 0; i < prefix; i++) {
|
|
1889
|
-
newEntries[i] = entries[i];
|
|
1890
|
-
if (newBodies !== null) newBodies[i] = rowBodies[i];
|
|
1891
|
-
newUnbinds[i] = rowUnbinds[i];
|
|
1892
|
-
}
|
|
1893
|
-
const stable = lisPositions(sources);
|
|
1894
|
-
let anchor = endAnchor;
|
|
1895
|
-
for (let k = sources.length - 1; k >= 0; k--) {
|
|
1896
|
-
const abs = prefix + k;
|
|
1897
|
-
const src = sources[k];
|
|
1898
|
-
let node;
|
|
1899
|
-
if (built[k] !== undefined) {
|
|
1900
|
-
node = built[k];
|
|
1901
|
-
if (newBodies !== null) newBodies[abs] = builtBodies[k];
|
|
1902
|
-
newUnbinds[abs] = builtUnbinds[k];
|
|
1903
|
-
parent.insertBefore(node, anchor);
|
|
1904
|
-
} else {
|
|
1905
|
-
node = entries[src];
|
|
1906
|
-
if (newBodies !== null) newBodies[abs] = rowBodies[src];
|
|
1907
|
-
newUnbinds[abs] = rowUnbinds[src];
|
|
1908
|
-
if (!stable.has(k)) parent.insertBefore(node, anchor);
|
|
1909
|
-
}
|
|
1910
|
-
newEntries[abs] = node;
|
|
1911
|
-
anchor = node;
|
|
1912
|
-
}
|
|
1913
|
-
entries = newEntries;
|
|
1914
|
-
if (newBodies !== null) rowBodies = newBodies;
|
|
1915
|
-
rowUnbinds = newUnbinds;
|
|
1916
|
-
prevRaws = next.slice();
|
|
1917
|
-
resyncNeeded = false;
|
|
1918
|
-
};
|
|
1919
|
-
let unbindOps = runWithOwner(listOwner, () => registerRowOps(subject, applyOps));
|
|
1920
|
-
const refRebuild = shallow && typeof meta.keyed !== "function";
|
|
1921
|
-
const rebuildSlot = i => {
|
|
1922
|
-
runUnbinds(rowUnbinds[i]);
|
|
1923
|
-
const old = entries[i];
|
|
1924
|
-
const node = bindRow(i);
|
|
1925
|
-
rowBodies[i] = lastBodies;
|
|
1926
|
-
rowUnbinds[i] = lastUnbinds;
|
|
1927
|
-
parent.insertBefore(node, old);
|
|
1928
|
-
old.remove();
|
|
1929
|
-
entries[i] = node;
|
|
1930
|
-
};
|
|
1931
|
-
const applySlot = (i, next, prev) => {
|
|
1932
|
-
if (declined) return;
|
|
1933
|
-
if (resyncNeeded) {
|
|
1934
|
-
const live = subject != null ? patchableRaw(subject) : undefined;
|
|
1935
|
-
if (live !== undefined && Array.isArray(live)) applyOps(live, null);
|
|
1936
|
-
return;
|
|
1937
|
-
}
|
|
1938
|
-
if (refRebuild) {
|
|
1939
|
-
rebuildSlot(i);
|
|
1940
|
-
prevRaws[i] = next;
|
|
1941
|
-
return;
|
|
1942
|
-
}
|
|
1943
|
-
const bodies = rowBodies[i];
|
|
1944
|
-
if (bodies !== undefined) {
|
|
1945
|
-
for (let b = 0; b < bodies.length; b++) bodies[b](next, prev, false);
|
|
1946
|
-
}
|
|
1947
|
-
prevRaws[i] = next;
|
|
1948
|
-
};
|
|
1949
|
-
let unbindSlots = shallow ? runWithOwner(listOwner, () => registerSlotPatch(subject, applySlot)) : null;
|
|
1950
|
-
runWithOwner(listOwner, () => effect(() => meta.each(), value => {
|
|
1951
|
-
if (declined || value === subject) return;
|
|
1952
|
-
const nextRaw = value != null ? patchableRaw(value) : undefined;
|
|
1953
|
-
unbindOps();
|
|
1954
|
-
unbindSlots?.();
|
|
1955
|
-
if (nextRaw !== undefined && Array.isArray(nextRaw) && storeIsShallow(value) !== shallow) {
|
|
1956
|
-
for (let j = 0; j < entries.length; j++) entries[j].remove();
|
|
1957
|
-
entries = [];
|
|
1958
|
-
prevRaws = [];
|
|
1959
|
-
unbindAllRows();
|
|
1960
|
-
subject = value;
|
|
1961
|
-
declined = true;
|
|
1962
|
-
listOwner.dispose();
|
|
1963
|
-
lateClassic?.();
|
|
1964
|
-
return;
|
|
1965
|
-
}
|
|
1966
|
-
if (nextRaw === undefined || !Array.isArray(nextRaw)) {
|
|
1967
|
-
for (let j = 0; j < entries.length; j++) entries[j].remove();
|
|
1968
|
-
entries = [];
|
|
1969
|
-
prevRaws = [];
|
|
1970
|
-
unbindAllRows();
|
|
1971
|
-
subject = value;
|
|
1972
|
-
declined = true;
|
|
1973
|
-
listOwner.dispose();
|
|
1974
|
-
lateClassic?.();
|
|
1975
|
-
return;
|
|
1976
|
-
}
|
|
1977
|
-
const swapOps = identityOps(nextRaw);
|
|
1978
|
-
subject = value;
|
|
1979
|
-
unbindOps = runWithOwner(listOwner, () => registerRowOps(subject, applyOps));
|
|
1980
|
-
if (shallow) unbindSlots = runWithOwner(listOwner, () => registerSlotPatch(subject, applySlot));
|
|
1981
|
-
applyOps(nextRaw, swapOps);
|
|
1982
|
-
}));
|
|
1983
|
-
onCleanup(() => {
|
|
1984
|
-
unbindOps();
|
|
1985
|
-
unbindSlots?.();
|
|
1986
|
-
unbindAllRows();
|
|
1987
|
-
listOwner.dispose();
|
|
1988
|
-
});
|
|
1989
|
-
return true;
|
|
1990
|
-
};
|
|
1991
|
-
const patchDriver = (subject, body) => {
|
|
1992
|
-
const raw = patchableRaw(subject);
|
|
1993
|
-
if (raw !== undefined) {
|
|
1994
|
-
if (!sharedConfig.hydrating) body(raw, undefined, true);
|
|
1995
|
-
const unbind = registerPatch(subject, body);
|
|
1996
|
-
if (rowCollector !== null) rowCollector.unbinds.push(unbind);
|
|
1997
|
-
else onCleanup(unbind);
|
|
1998
|
-
} else if (rowCollector !== null && subject === rowCollector.row) {
|
|
1999
|
-
rowCollector.bodies.push(body);
|
|
2000
|
-
if (!sharedConfig.hydrating) body(subject, undefined, true);
|
|
2001
|
-
} else {
|
|
2002
|
-
effect(() => body(subject, subject, false),
|
|
2003
|
-
() => untrack(() => body(subject, undefined, true)));
|
|
2004
|
-
}
|
|
2005
|
-
};
|
|
2006
|
-
|
|
2007
1719
|
function throwInBrowser(func) {
|
|
2008
1720
|
const err = new Error(`${func.name} is not supported in the browser, returning undefined`);
|
|
2009
1721
|
console.error(err);
|
|
@@ -2221,7 +1933,7 @@ const COMPONENT_BINDING = Symbol.for("solid.component-binding");
|
|
|
2221
1933
|
function bindingOf(value) {
|
|
2222
1934
|
return value !== null && (typeof value === "function" || typeof value === "object") && value[COMPONENT_BINDING] || undefined;
|
|
2223
1935
|
}
|
|
2224
|
-
function dynamic(source) {
|
|
1936
|
+
function dynamic(source, _options) {
|
|
2225
1937
|
let latest = 0;
|
|
2226
1938
|
const sites = new Set();
|
|
2227
1939
|
let deliveredAddress;
|
|
@@ -2262,24 +1974,9 @@ function dynamic(source) {
|
|
|
2262
1974
|
return untrack(() => component(props));
|
|
2263
1975
|
}
|
|
2264
1976
|
case "string":
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
spread(el, props);
|
|
2269
|
-
return el;
|
|
2270
|
-
}
|
|
2271
|
-
const owner = getOwner();
|
|
2272
|
-
let el;
|
|
2273
|
-
return () => {
|
|
2274
|
-
if (!el) {
|
|
2275
|
-
runWithOwner(owner, () => {
|
|
2276
|
-
el = createElement(component, untrack(() => props.is));
|
|
2277
|
-
spread(el, props);
|
|
2278
|
-
});
|
|
2279
|
-
}
|
|
2280
|
-
return el;
|
|
2281
|
-
};
|
|
2282
|
-
}
|
|
1977
|
+
const el = sharedConfig.hydrating ? getNextElement() : createElement(component, untrack(() => props.is));
|
|
1978
|
+
spread(el, props);
|
|
1979
|
+
return el;
|
|
2283
1980
|
}
|
|
2284
1981
|
});
|
|
2285
1982
|
};
|
|
@@ -2288,15 +1985,8 @@ function Dynamic(props) {
|
|
|
2288
1985
|
const Comp = dynamic(() => props.component);
|
|
2289
1986
|
return createComponent(Comp, omit(props, "component"));
|
|
2290
1987
|
}
|
|
2291
|
-
const AmbiguousSVGElements = /*#__PURE__*/new Set(["a", "script", "style", "title"]);
|
|
2292
1988
|
function createElement(tagName, is = undefined) {
|
|
2293
|
-
|
|
2294
|
-
if (MathMLElements.has(tagName)) return document.createElementNS(Namespaces.mathml, tagName);
|
|
2295
|
-
if (AmbiguousSVGElements.has(tagName)) {
|
|
2296
|
-
const parent = getInsertionParent();
|
|
2297
|
-
if (parent && parent.namespaceURI === Namespaces.svg && parent.localName !== "foreignObject") return document.createElementNS(Namespaces.svg, tagName);
|
|
2298
|
-
}
|
|
2299
|
-
return document.createElement(tagName, {
|
|
1989
|
+
return SVGElements.has(tagName) ? document.createElementNS(Namespaces.svg, tagName) : MathMLElements.has(tagName) ? document.createElementNS(Namespaces.mathml, tagName) : document.createElement(tagName, {
|
|
2300
1990
|
is
|
|
2301
1991
|
});
|
|
2302
1992
|
}
|
|
@@ -2328,4 +2018,4 @@ _moduleUrl) {
|
|
|
2328
2018
|
function httpStatus(_code, _text) {}
|
|
2329
2019
|
function httpHeader(_name, _value, _options) {}
|
|
2330
2020
|
|
|
2331
|
-
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,
|
|
2021
|
+
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, readShallow, 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 };
|