@solidjs/web 2.0.0-rc.3 → 2.0.0-rc.5
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/dev.cjs +398 -17
- package/dist/dev.js +396 -19
- package/dist/server.cjs +166 -38
- package/dist/server.js +165 -39
- package/dist/web.cjs +369 -17
- package/dist/web.js +367 -19
- package/frames/dist/client.cjs +41 -8
- package/frames/dist/client.dev.cjs +41 -8
- package/frames/dist/client.dev.js +41 -8
- package/frames/dist/client.js +41 -8
- package/frames/dist/server.cjs +432 -44
- package/frames/dist/server.js +432 -44
- package/package.json +2 -2
- package/serialization/dist/decode.cjs +4 -2
- package/serialization/dist/decode.js +4 -2
- package/serialization/dist/serialization.cjs +12 -8
- package/serialization/dist/serialization.js +12 -8
- package/serialization/types/index.d.ts +7 -0
- package/serialization/types/serializer-decode.d.ts +14 -1
- package/serialization/types/serializer.d.ts +7 -0
- package/serialization/types-cjs/index.d.cts +7 -0
- package/serialization/types-cjs/serializer-decode.d.cts +14 -1
- package/serialization/types-cjs/serializer.d.cts +7 -0
- package/server-functions/dist/client.cjs +271 -47
- package/server-functions/dist/client.js +264 -47
- package/server-functions/dist/server.cjs +872 -131
- package/server-functions/dist/server.dev.cjs +892 -131
- package/server-functions/dist/server.dev.js +884 -131
- package/server-functions/dist/server.js +864 -131
- package/types/client.d.ts +4 -2
- package/types/cookies.d.ts +6 -14
- package/types/frames/frame-client.d.ts +4 -0
- package/types/frames/serializer-decode.d.ts +14 -1
- package/types/frames/serializer.d.ts +7 -0
- package/types/index.d.ts +1 -0
- package/types/jsx.d.ts +11 -16
- package/types/patch-driver.d.ts +3 -0
- package/types/response.d.ts +20 -1
- package/types/serializer-decode.d.ts +14 -1
- package/types/serializer.d.ts +7 -0
- package/types/server-functions/client.d.ts +58 -7
- package/types/server-functions/flash.d.ts +9 -0
- package/types/server-functions/registry.d.ts +38 -1
- package/types/server-functions/server.d.ts +66 -14
- package/types/server-functions/shared.d.ts +122 -16
- package/types/server-mock.d.ts +17 -2
- package/types/server.d.ts +16 -2
- package/types-cjs/client.d.cts +4 -2
- package/types-cjs/cookies.d.cts +6 -14
- package/types-cjs/frames/frame-client.d.cts +4 -0
- package/types-cjs/frames/serializer-decode.d.cts +14 -1
- package/types-cjs/frames/serializer.d.cts +7 -0
- package/types-cjs/index.d.cts +1 -0
- package/types-cjs/jsx.d.cts +11 -16
- package/types-cjs/patch-driver.d.cts +3 -0
- package/types-cjs/response.d.cts +20 -1
- package/types-cjs/serializer-decode.d.cts +14 -1
- package/types-cjs/serializer.d.cts +7 -0
- package/types-cjs/server-functions/client.d.cts +58 -7
- package/types-cjs/server-functions/flash.d.cts +9 -0
- package/types-cjs/server-functions/registry.d.cts +38 -1
- package/types-cjs/server-functions/server.d.cts +66 -14
- package/types-cjs/server-functions/shared.d.cts +122 -16
- package/types-cjs/server-mock.d.cts +17 -2
- package/types-cjs/server.d.cts +16 -2
package/dist/web.cjs
CHANGED
|
@@ -215,7 +215,8 @@ function resourceIdentity(tag, props) {
|
|
|
215
215
|
let id = "res:" + tag + ":" + (props.rel || "") + ":" + (props.href || props.src || "");
|
|
216
216
|
for (let i = 0; i < RESOURCE_QUALIFIERS.length; i++) {
|
|
217
217
|
const q = RESOURCE_QUALIFIERS[i];
|
|
218
|
-
|
|
218
|
+
const value = props[q];
|
|
219
|
+
if (value != null) id += ":" + q + "=" + (value === true ? "" : value);
|
|
219
220
|
}
|
|
220
221
|
return id;
|
|
221
222
|
}
|
|
@@ -294,6 +295,7 @@ function serializeCookie(name, value, options = {}) {
|
|
|
294
295
|
if (options.expires) cookie += `; Expires=${options.expires.toUTCString()}`;
|
|
295
296
|
if (options.httpOnly) cookie += "; HttpOnly";
|
|
296
297
|
if (options.secure) cookie += "; Secure";
|
|
298
|
+
if (options.partitioned) cookie += "; Partitioned";
|
|
297
299
|
if (options.sameSite) {
|
|
298
300
|
const sameSite = options.sameSite.toLowerCase();
|
|
299
301
|
cookie += `; SameSite=${sameSite === "none" ? "None" : sameSite === "strict" ? "Strict" : "Lax"}`;
|
|
@@ -333,6 +335,10 @@ const waitAsset = promise => {
|
|
|
333
335
|
}
|
|
334
336
|
gate();
|
|
335
337
|
};
|
|
338
|
+
exports.listDriver = void 0;
|
|
339
|
+
function installListDriver(driver) {
|
|
340
|
+
exports.listDriver = driver;
|
|
341
|
+
}
|
|
336
342
|
const $$EVENT_OWNER = "_$SOLID_EVENT_OWNER";
|
|
337
343
|
const INNER_OWNED = {};
|
|
338
344
|
const delegatedEvents = new Set();
|
|
@@ -576,16 +582,18 @@ function setStyleProperty(node, name, value) {
|
|
|
576
582
|
}
|
|
577
583
|
function spread(node, props = {}, skipChildren) {
|
|
578
584
|
const prevProps = {};
|
|
579
|
-
|
|
585
|
+
const get = typeof props === "function" ? props : () => props;
|
|
586
|
+
if (!skipChildren) insert(node, () => get().children);
|
|
580
587
|
effect(() => {
|
|
581
|
-
const r =
|
|
588
|
+
const r = get().ref;
|
|
582
589
|
(typeof r === "function" || Array.isArray(r)) && ref(() => r, node);
|
|
583
590
|
}, () => {});
|
|
584
591
|
effect(() => {
|
|
592
|
+
const source = get();
|
|
585
593
|
const newProps = {};
|
|
586
|
-
for (const prop in
|
|
594
|
+
for (const prop in source) {
|
|
587
595
|
if (prop === "children" || prop === "ref") continue;
|
|
588
|
-
newProps[prop] =
|
|
596
|
+
newProps[prop] = source[prop];
|
|
589
597
|
}
|
|
590
598
|
return newProps;
|
|
591
599
|
}, props => assign(node, props, true, prevProps, true));
|
|
@@ -608,11 +616,6 @@ function ref(fn, element) {
|
|
|
608
616
|
const resolved = solidJs.untrack(fn);
|
|
609
617
|
solidJs.runWithOwner(null, () => applyRef(resolved, element));
|
|
610
618
|
}
|
|
611
|
-
const PURE_ROW = Symbol.for("solid.pure-row");
|
|
612
|
-
function rowProof(fn) {
|
|
613
|
-
fn[PURE_ROW] = true;
|
|
614
|
-
return fn;
|
|
615
|
-
}
|
|
616
619
|
function scope(fn) {
|
|
617
620
|
fn.$s = true;
|
|
618
621
|
return fn;
|
|
@@ -676,16 +679,16 @@ function stripTextSeparators(nodes) {
|
|
|
676
679
|
nodes.length = j;
|
|
677
680
|
return nodes;
|
|
678
681
|
}
|
|
679
|
-
function patchDriver(subject, body) {
|
|
680
|
-
{
|
|
681
|
-
effect(() => body(subject, subject, false), () => body(subject, undefined, true));
|
|
682
|
-
}
|
|
683
|
-
}
|
|
684
682
|
function insert(parent, accessor, marker, initial, options) {
|
|
685
683
|
const multi = marker !== undefined;
|
|
686
684
|
const host = options && options.host;
|
|
687
685
|
if (multi && !initial) initial = [];
|
|
688
686
|
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
|
+
}
|
|
689
692
|
if (typeof accessor !== "function") {
|
|
690
693
|
accessor = normalize(accessor, initial, multi, true);
|
|
691
694
|
if (typeof accessor !== "function") {
|
|
@@ -1161,6 +1164,15 @@ function hydrate(code, element, options = {}) {
|
|
|
1161
1164
|
solidJs.enableHydration();
|
|
1162
1165
|
installHydrationRuntime();
|
|
1163
1166
|
if (globalThis._$HY.done) return render(code, element, [...element.childNodes], options);
|
|
1167
|
+
const head = (element.nodeType === 9 ? element : element.ownerDocument).head;
|
|
1168
|
+
if (head && element.contains(head)) {
|
|
1169
|
+
let n = head.firstChild;
|
|
1170
|
+
while (n && n.nodeType === 1 && n.hasAttribute("data-dh") && !n.hasAttribute("data-dhf")) {
|
|
1171
|
+
const next = n.nextSibling;
|
|
1172
|
+
head.appendChild(n);
|
|
1173
|
+
n = next;
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1164
1176
|
options.renderId ||= "";
|
|
1165
1177
|
if (!globalThis._$HY.modules) globalThis._$HY.modules = {};
|
|
1166
1178
|
if (!globalThis._$HY.loading) globalThis._$HY.loading = {};
|
|
@@ -1619,6 +1631,322 @@ function getHydrationKey() {
|
|
|
1619
1631
|
}
|
|
1620
1632
|
const RequestContext = Symbol();
|
|
1621
1633
|
|
|
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
|
+
|
|
1622
1950
|
function throwInBrowser(func) {
|
|
1623
1951
|
const err = new Error(`${func.name} is not supported in the browser, returning undefined`);
|
|
1624
1952
|
console.error(err);
|
|
@@ -1692,6 +2020,7 @@ function isSafeError(value) {
|
|
|
1692
2020
|
return !!(value && (typeof value === "object" || typeof value === "function") && value[SAFE_ERROR]);
|
|
1693
2021
|
}
|
|
1694
2022
|
const REVALIDATE_HEADER = "X-Revalidate";
|
|
2023
|
+
const RESPONSE_HEADER_VALUE_LIMIT = 4096;
|
|
1695
2024
|
function initWithRevalidate(init = {}) {
|
|
1696
2025
|
const resolved = typeof init === "number" ? {
|
|
1697
2026
|
status: init
|
|
@@ -1712,7 +2041,13 @@ function initWithRevalidate(init = {}) {
|
|
|
1712
2041
|
} else {
|
|
1713
2042
|
headers = new Headers(responseInit.headers);
|
|
1714
2043
|
}
|
|
1715
|
-
revalidate !== undefined
|
|
2044
|
+
if (revalidate !== undefined) {
|
|
2045
|
+
const keys = revalidate.toString();
|
|
2046
|
+
if (keys.length > RESPONSE_HEADER_VALUE_LIMIT) {
|
|
2047
|
+
throw new TypeError(`revalidate names ${keys.length} characters of cache keys; past ` + `${RESPONSE_HEADER_VALUE_LIMIT} the ${REVALIDATE_HEADER} header would overflow ` + `receivers (an 8 KiB proxy buffer holds the whole header block) and the response ` + `dies at the socket after the mutation committed. Split the invalidation across ` + `calls or use coarser keys — a dropped key would be a silently stale cache, so ` + `the runtime refuses rather than trims.`);
|
|
2048
|
+
}
|
|
2049
|
+
headers.set(REVALIDATE_HEADER, keys);
|
|
2050
|
+
}
|
|
1716
2051
|
return {
|
|
1717
2052
|
responseInit,
|
|
1718
2053
|
headers
|
|
@@ -1729,7 +2064,13 @@ function redirect(url, init = 302) {
|
|
|
1729
2064
|
if (responseInit.status === undefined) {
|
|
1730
2065
|
responseInit.status = 302;
|
|
1731
2066
|
}
|
|
1732
|
-
|
|
2067
|
+
const target = typeof url === "string" ? url : url[HREF];
|
|
2068
|
+
const location = typeof target === "string" ? target : String(url);
|
|
2069
|
+
const encoded = location.replace(/[^\x00-\x7f]/gu, encodeURIComponent);
|
|
2070
|
+
if (encoded.length > RESPONSE_HEADER_VALUE_LIMIT) {
|
|
2071
|
+
throw new TypeError(`redirect() target is ${encoded.length} characters; past ` + `${RESPONSE_HEADER_VALUE_LIMIT} the Location header (and the scripted transport's ` + `redirect header) would overflow receivers and the response dies at the socket. ` + `A target this size is usually unbounded input echoed into the url — carry the ` + `state server-side instead. Refused rather than trimmed: a cut target is a ` + `different address.`);
|
|
2072
|
+
}
|
|
2073
|
+
headers.set("Location", encoded);
|
|
1733
2074
|
return new Response(null, {
|
|
1734
2075
|
...responseInit,
|
|
1735
2076
|
headers
|
|
@@ -1745,11 +2086,18 @@ function reload(init = {}) {
|
|
|
1745
2086
|
headers
|
|
1746
2087
|
});
|
|
1747
2088
|
}
|
|
2089
|
+
const NULL_BODY_STATUSES = new Set([204, 205, 304]);
|
|
1748
2090
|
function respond(value, init = {}) {
|
|
1749
2091
|
const {
|
|
1750
2092
|
responseInit,
|
|
1751
2093
|
headers
|
|
1752
2094
|
} = initWithRevalidate(init);
|
|
2095
|
+
if (NULL_BODY_STATUSES.has(responseInit.status)) {
|
|
2096
|
+
return new ResponseEnvelope(new Response(null, {
|
|
2097
|
+
...responseInit,
|
|
2098
|
+
headers
|
|
2099
|
+
}), value);
|
|
2100
|
+
}
|
|
1753
2101
|
headers.set("Content-Type", "application/json");
|
|
1754
2102
|
return new ResponseEnvelope(new Response(JSON.stringify(value), {
|
|
1755
2103
|
...responseInit,
|
|
@@ -1964,8 +2312,10 @@ exports.Dynamic = Dynamic;
|
|
|
1964
2312
|
exports.HREF = HREF;
|
|
1965
2313
|
exports.HydrationScript = HydrationScript;
|
|
1966
2314
|
exports.MathMLElements = MathMLElements;
|
|
2315
|
+
exports.NULL_BODY_STATUSES = NULL_BODY_STATUSES;
|
|
1967
2316
|
exports.Namespaces = Namespaces;
|
|
1968
2317
|
exports.Portal = Portal;
|
|
2318
|
+
exports.RESPONSE_HEADER_VALUE_LIMIT = RESPONSE_HEADER_VALUE_LIMIT;
|
|
1969
2319
|
exports.REVALIDATE_HEADER = REVALIDATE_HEADER;
|
|
1970
2320
|
exports.RawTextElements = RawTextElements;
|
|
1971
2321
|
exports.RequestContext = RequestContext;
|
|
@@ -1988,6 +2338,7 @@ exports.createRequestEvent = createRequestEvent;
|
|
|
1988
2338
|
exports.createResponseStub = createResponseStub;
|
|
1989
2339
|
exports.createSSRResponse = createSSRResponse;
|
|
1990
2340
|
exports.delegateEvents = delegateEvents;
|
|
2341
|
+
exports.driveList = driveList;
|
|
1991
2342
|
exports.dynamic = dynamic;
|
|
1992
2343
|
exports.dynamicProperty = dynamicProperty;
|
|
1993
2344
|
exports.effect = effect;
|
|
@@ -2010,6 +2361,7 @@ exports.httpStatus = httpStatus;
|
|
|
2010
2361
|
exports.hydrate = hydrate;
|
|
2011
2362
|
exports.insert = insert;
|
|
2012
2363
|
exports.installHydrationRuntime = installHydrationRuntime;
|
|
2364
|
+
exports.installListDriver = installListDriver;
|
|
2013
2365
|
exports.isDev = isDev;
|
|
2014
2366
|
exports.isHref = isHref;
|
|
2015
2367
|
exports.isResponseEnvelope = isResponseEnvelope;
|