@solidjs/web 2.0.0-rc.2 → 2.0.0-rc.4
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 +433 -72
- package/dist/dev.js +426 -71
- package/dist/server.cjs +39 -21
- package/dist/server.js +40 -23
- package/dist/web.cjs +421 -70
- package/dist/web.js +414 -69
- package/frames/dist/client.cjs +8 -8
- package/frames/dist/client.dev.cjs +8 -8
- package/frames/dist/client.dev.js +8 -8
- package/frames/dist/client.js +8 -8
- package/frames/dist/server.cjs +28 -18
- package/frames/dist/server.js +29 -19
- package/package.json +20 -22
- package/serialization/dist/decode.cjs +3 -3
- package/serialization/dist/decode.js +3 -3
- package/serialization/dist/serialization.cjs +7 -11
- package/serialization/dist/serialization.js +7 -6
- package/serialization/types/index.d.ts +69 -157
- package/serialization/types/serializer-decode.d.ts +89 -112
- package/serialization/types/serializer.d.ts +94 -0
- package/serialization/types-cjs/index.d.cts +69 -157
- package/serialization/types-cjs/serializer-decode.d.cts +89 -112
- package/serialization/types-cjs/serializer.d.cts +94 -0
- package/server-functions/dist/client.cjs +126 -19
- package/server-functions/dist/client.js +123 -19
- package/server-functions/dist/server.cjs +156 -28
- package/server-functions/dist/server.dev.cjs +156 -28
- package/server-functions/dist/server.dev.js +153 -28
- package/server-functions/dist/server.js +153 -28
- package/types/client.d.ts +152 -290
- package/types/constants.d.ts +18 -0
- package/types/cookies.d.ts +31 -75
- package/types/frames/frame-client.d.ts +287 -277
- package/types/frames/frame-container-plugin.d.ts +71 -0
- package/types/frames/frame-sink.d.ts +58 -160
- package/types/frames/frame-transport.d.ts +161 -194
- package/types/frames/serializer-decode.d.ts +159 -0
- package/types/frames/serializer.d.ts +69 -157
- package/types/head.d.ts +16 -0
- package/types/index.d.ts +1 -65
- package/types/index.server.d.ts +125 -0
- package/types/jsx.d.ts +5 -13
- package/types/patch-driver.d.ts +3 -0
- package/types/reconcile.d.ts +1 -0
- package/types/render.d.ts +4 -0
- package/types/response.d.ts +48 -152
- package/types/serializer-decode.d.ts +89 -112
- package/types/serializer.d.ts +69 -157
- package/types/server-functions/client.d.ts +124 -222
- package/types/server-functions/flash.d.ts +10 -30
- package/types/server-functions/registry.d.ts +100 -0
- package/types/server-functions/rich-args.d.ts +1 -10
- package/types/server-functions/server.d.ts +295 -574
- package/types/server-functions/shared.d.ts +155 -458
- package/types/server-mock.d.ts +2 -2
- package/types/server.d.ts +242 -434
- package/types-cjs/client.d.cts +152 -290
- package/types-cjs/constants.d.cts +18 -0
- package/types-cjs/cookies.d.cts +31 -75
- package/types-cjs/frames/frame-client.d.cts +287 -277
- package/types-cjs/frames/frame-container-plugin.d.cts +71 -0
- package/types-cjs/frames/frame-sink.d.cts +58 -160
- package/types-cjs/frames/frame-transport.d.cts +161 -194
- package/types-cjs/frames/serializer-decode.d.cts +159 -0
- package/types-cjs/frames/serializer.d.cts +69 -157
- package/types-cjs/head.d.cts +16 -0
- package/types-cjs/index.d.cts +1 -65
- package/types-cjs/index.server.d.cts +125 -0
- package/types-cjs/jsx.d.cts +5 -13
- package/types-cjs/patch-driver.d.cts +3 -0
- package/types-cjs/reconcile.d.cts +1 -0
- package/types-cjs/render.d.cts +4 -0
- package/types-cjs/response.d.cts +48 -152
- package/types-cjs/serializer-decode.d.cts +89 -112
- package/types-cjs/serializer.d.cts +69 -157
- package/types-cjs/server-functions/client.d.cts +124 -222
- package/types-cjs/server-functions/flash.d.cts +10 -30
- package/types-cjs/server-functions/registry.d.cts +100 -0
- package/types-cjs/server-functions/rich-args.d.cts +1 -10
- package/types-cjs/server-functions/server.d.cts +295 -574
- package/types-cjs/server-functions/shared.d.cts +155 -458
- package/types-cjs/server-mock.d.cts +2 -2
- package/types-cjs/server.d.cts +242 -434
- package/LICENSE +0 -21
- package/types/core.d.ts +0 -9
- package/types-cjs/core.d.cts +0 -9
package/dist/dev.cjs
CHANGED
|
@@ -57,23 +57,16 @@ const transparentOptions = {
|
|
|
57
57
|
const syncOptions = {
|
|
58
58
|
sync: true
|
|
59
59
|
};
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
solidJs.runWithOwner(null, () => {
|
|
71
|
-
gate = solidJs.createMemo(() => promise);
|
|
72
|
-
});
|
|
73
|
-
assetGates.set(promise, gate);
|
|
74
|
-
}
|
|
75
|
-
gate();
|
|
76
|
-
};
|
|
60
|
+
function effect(fn, effectFn, options) {
|
|
61
|
+
solidJs.createRenderEffect(fn, effectFn, options ? {
|
|
62
|
+
sync: true,
|
|
63
|
+
...options,
|
|
64
|
+
transparent: !options.scope
|
|
65
|
+
} : transparentOptions);
|
|
66
|
+
}
|
|
67
|
+
function memo(fn) {
|
|
68
|
+
return solidJs.createMemo(() => fn(), syncOptions);
|
|
69
|
+
}
|
|
77
70
|
|
|
78
71
|
function reconcileArrays(parentNode, a, b, marker) {
|
|
79
72
|
let bLength = b.length,
|
|
@@ -330,14 +323,39 @@ function getServerFunctionRPC() {
|
|
|
330
323
|
return globalThis[SERVER_FUNCTION_RPC];
|
|
331
324
|
}
|
|
332
325
|
|
|
333
|
-
const
|
|
326
|
+
const assetGates = new WeakMap();
|
|
327
|
+
const waitAsset = promise => {
|
|
328
|
+
let gate = assetGates.get(promise);
|
|
329
|
+
if (!gate) {
|
|
330
|
+
solidJs.runWithOwner(null, () => {
|
|
331
|
+
gate = solidJs.createMemo(() => promise);
|
|
332
|
+
});
|
|
333
|
+
assetGates.set(promise, gate);
|
|
334
|
+
}
|
|
335
|
+
gate();
|
|
336
|
+
};
|
|
337
|
+
exports.listDriver = void 0;
|
|
338
|
+
function installListDriver(driver) {
|
|
339
|
+
exports.listDriver = driver;
|
|
340
|
+
}
|
|
341
|
+
const $$EVENT_OWNER = "_$SOLID_EVENT_OWNER";
|
|
334
342
|
const INNER_OWNED = {};
|
|
335
343
|
const delegatedEvents = new Set();
|
|
336
344
|
const delegatedContainers = new Map();
|
|
337
|
-
function
|
|
345
|
+
function voidFn() {}
|
|
346
|
+
function generateHydrationScript(_options) {
|
|
347
|
+
return "";
|
|
348
|
+
}
|
|
349
|
+
function HydrationScript(_props) {
|
|
350
|
+
return null;
|
|
351
|
+
}
|
|
352
|
+
const getRequestEvent = voidFn;
|
|
353
|
+
function render(code, element, init, options = {}) {
|
|
338
354
|
if (!element) {
|
|
339
355
|
throw new Error("The `element` passed to `render(..., element)` doesn't exist. Make sure `element` exists in the document.");
|
|
340
356
|
}
|
|
357
|
+
solidJs.resetErrorHalt();
|
|
358
|
+
solidJs.enforceLoadingBoundary(true);
|
|
341
359
|
let disposer;
|
|
342
360
|
registerDelegatedRoot(element);
|
|
343
361
|
try {
|
|
@@ -348,15 +366,21 @@ function render$1(code, element, init, options = {}) {
|
|
|
348
366
|
effect(() => solidJs.flatten(tree), () => {});
|
|
349
367
|
} else {
|
|
350
368
|
const tree = code();
|
|
351
|
-
insert(element, () => tree, element.firstChild ? null : undefined, init,
|
|
369
|
+
insert(element, () => tree, element.firstChild ? null : undefined, init, {
|
|
370
|
+
...options.insertOptions,
|
|
371
|
+
schedule: true
|
|
372
|
+
});
|
|
352
373
|
}
|
|
353
374
|
}, {
|
|
354
375
|
id: options.renderId
|
|
355
376
|
});
|
|
377
|
+
solidJs.flush();
|
|
356
378
|
} catch (err) {
|
|
357
379
|
if (disposer) disposer();
|
|
358
380
|
unregisterDelegatedRoot(element);
|
|
359
381
|
throw err;
|
|
382
|
+
} finally {
|
|
383
|
+
solidJs.enforceLoadingBoundary(false);
|
|
360
384
|
}
|
|
361
385
|
return () => {
|
|
362
386
|
disposer();
|
|
@@ -443,7 +467,7 @@ function setProperty(node, name, value) {
|
|
|
443
467
|
node[name] = value;
|
|
444
468
|
}
|
|
445
469
|
let claimHandlers = null;
|
|
446
|
-
const CLAIM_SEAM = Symbol.for("
|
|
470
|
+
const CLAIM_SEAM = Symbol.for("solid.element-claims");
|
|
447
471
|
function registerElementClaim(handler) {
|
|
448
472
|
(claimHandlers || (claimHandlers = globalThis[CLAIM_SEAM] = [])).push(handler);
|
|
449
473
|
return () => {
|
|
@@ -597,11 +621,6 @@ function ref(fn, element) {
|
|
|
597
621
|
const resolved = solidJs.untrack(fn);
|
|
598
622
|
solidJs.runWithOwner(null, () => applyRef(resolved, element));
|
|
599
623
|
}
|
|
600
|
-
const PURE_ROW = Symbol.for("solid.pure-row");
|
|
601
|
-
function rowProof(fn) {
|
|
602
|
-
fn[PURE_ROW] = true;
|
|
603
|
-
return fn;
|
|
604
|
-
}
|
|
605
624
|
function scope(fn) {
|
|
606
625
|
fn.$s = true;
|
|
607
626
|
return fn;
|
|
@@ -665,16 +684,16 @@ function stripTextSeparators(nodes) {
|
|
|
665
684
|
nodes.length = j;
|
|
666
685
|
return nodes;
|
|
667
686
|
}
|
|
668
|
-
function patchDriver(subject, body) {
|
|
669
|
-
{
|
|
670
|
-
effect(() => body(subject, subject, false), () => body(subject, undefined, true));
|
|
671
|
-
}
|
|
672
|
-
}
|
|
673
687
|
function insert(parent, accessor, marker, initial, options) {
|
|
674
688
|
const multi = marker !== undefined;
|
|
675
689
|
const host = options && options.host;
|
|
676
690
|
if (multi && !initial) initial = [];
|
|
677
691
|
if (hydrationRt !== null) initial = hydrationRt.claimInitial(parent, multi, initial);
|
|
692
|
+
if (exports.listDriver !== undefined && typeof accessor === "function" && accessor.$ll !== undefined) {
|
|
693
|
+
const listAccessor = accessor;
|
|
694
|
+
const owner = solidJs.getOwner();
|
|
695
|
+
if (exports.listDriver(parent, accessor, marker, () => solidJs.runWithOwner(owner, () => insert(parent, () => listAccessor(), marker, marker !== undefined ? [] : undefined, options)))) return;
|
|
696
|
+
}
|
|
678
697
|
if (typeof accessor !== "function") {
|
|
679
698
|
accessor = normalize(accessor, initial, multi, true);
|
|
680
699
|
if (typeof accessor !== "function") {
|
|
@@ -1149,9 +1168,19 @@ function loadModuleAssets(mapping) {
|
|
|
1149
1168
|
}
|
|
1150
1169
|
return pending.length ? Promise.all(pending).then(() => {}) : undefined;
|
|
1151
1170
|
}
|
|
1152
|
-
function hydrate
|
|
1171
|
+
function hydrate(code, element, options = {}) {
|
|
1172
|
+
solidJs.enableHydration();
|
|
1153
1173
|
installHydrationRuntime();
|
|
1154
|
-
if (globalThis._$HY.done) return render
|
|
1174
|
+
if (globalThis._$HY.done) return render(code, element, [...element.childNodes], options);
|
|
1175
|
+
const head = (element.nodeType === 9 ? element : element.ownerDocument).head;
|
|
1176
|
+
if (head && element.contains(head)) {
|
|
1177
|
+
let n = head.firstChild;
|
|
1178
|
+
while (n && n.nodeType === 1 && n.hasAttribute("data-dh") && !n.hasAttribute("data-dhf")) {
|
|
1179
|
+
const next = n.nextSibling;
|
|
1180
|
+
head.appendChild(n);
|
|
1181
|
+
n = next;
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1155
1184
|
options.renderId ||= "";
|
|
1156
1185
|
if (!globalThis._$HY.modules) globalThis._$HY.modules = {};
|
|
1157
1186
|
if (!globalThis._$HY.loading) globalThis._$HY.loading = {};
|
|
@@ -1210,7 +1239,7 @@ function hydrate$1(code, element, options = {}) {
|
|
|
1210
1239
|
solidJs.sharedConfig.gather = gather;
|
|
1211
1240
|
solidJs.sharedConfig.hydrating = true;
|
|
1212
1241
|
try {
|
|
1213
|
-
disposer = render
|
|
1242
|
+
disposer = render(code, element, [...element.childNodes], options);
|
|
1214
1243
|
} finally {
|
|
1215
1244
|
solidJs.sharedConfig.hydrating = false;
|
|
1216
1245
|
}
|
|
@@ -1218,14 +1247,14 @@ function hydrate$1(code, element, options = {}) {
|
|
|
1218
1247
|
console.error("Hydration module preload failed, falling back to client render:", err);
|
|
1219
1248
|
solidJs.sharedConfig.hydrating = false;
|
|
1220
1249
|
solidJs.sharedConfig.registry = undefined;
|
|
1221
|
-
disposer = render
|
|
1250
|
+
disposer = render(code, element, [...element.childNodes], options);
|
|
1222
1251
|
});
|
|
1223
1252
|
return () => disposer && disposer();
|
|
1224
1253
|
}
|
|
1225
1254
|
}
|
|
1226
1255
|
try {
|
|
1227
1256
|
gatherHydratable(element, options.renderId);
|
|
1228
|
-
return render
|
|
1257
|
+
return render(code, element, [...element.childNodes], options);
|
|
1229
1258
|
} finally {
|
|
1230
1259
|
solidJs.sharedConfig.hydrating = false;
|
|
1231
1260
|
}
|
|
@@ -1457,7 +1486,7 @@ function eventHandler(e, container, state) {
|
|
|
1457
1486
|
const handleNode = () => {
|
|
1458
1487
|
let handler = node[key];
|
|
1459
1488
|
if (handler === undefined && node.hasAttribute && node.hasAttribute("_bnd")) {
|
|
1460
|
-
const seam = globalThis[Symbol.for("
|
|
1489
|
+
const seam = globalThis[Symbol.for("solid.bnd")];
|
|
1461
1490
|
if (seam) handler = seam.resolve(node, e.type);
|
|
1462
1491
|
}
|
|
1463
1492
|
if (handler && !node.disabled) {
|
|
@@ -1506,7 +1535,16 @@ function eventHandler(e, container, state) {
|
|
|
1506
1535
|
}
|
|
1507
1536
|
function insertExpression(parent, value, current, marker) {
|
|
1508
1537
|
if (hydrationRt !== null && isHydrating(parent)) {
|
|
1509
|
-
if (value && value !== current)
|
|
1538
|
+
if (value && value !== current) {
|
|
1539
|
+
const arr = Array.isArray(value);
|
|
1540
|
+
for (const n of arr ? value : [value]) {
|
|
1541
|
+
if (n && n.nodeType) {
|
|
1542
|
+
if (!isHydrating(n)) return current;
|
|
1543
|
+
} else if (arr && (typeof n === "string" || typeof n === "number")) {
|
|
1544
|
+
return current;
|
|
1545
|
+
}
|
|
1546
|
+
}
|
|
1547
|
+
}
|
|
1510
1548
|
return value;
|
|
1511
1549
|
}
|
|
1512
1550
|
if (value === current) return value;
|
|
@@ -1537,6 +1575,17 @@ function insertExpression(parent, value, current, marker) {
|
|
|
1537
1575
|
if (marker) value[$$SLOT] = marker;
|
|
1538
1576
|
} else if (Array.isArray(value)) {
|
|
1539
1577
|
const currentArray = current && Array.isArray(current);
|
|
1578
|
+
for (let i = 0, len = value.length; i < len; i++) {
|
|
1579
|
+
const item = value[i],
|
|
1580
|
+
t = typeof item;
|
|
1581
|
+
if (t === "string" || t === "number") {
|
|
1582
|
+
const prev = currentArray ? current[i] : undefined;
|
|
1583
|
+
if (prev && prev.nodeType === 3) {
|
|
1584
|
+
if (prev.data !== "" + item) prev.data = item;
|
|
1585
|
+
value[i] = prev;
|
|
1586
|
+
} else value[i] = document.createTextNode(item);
|
|
1587
|
+
}
|
|
1588
|
+
}
|
|
1540
1589
|
if (value.length === 0) {
|
|
1541
1590
|
cleanChildren(parent, current, marker);
|
|
1542
1591
|
} else if (currentArray) {
|
|
@@ -1557,12 +1606,12 @@ function normalize(value, current, multi, doNotUnwrap) {
|
|
|
1557
1606
|
});
|
|
1558
1607
|
if (doNotUnwrap && typeof value === "function") return value;
|
|
1559
1608
|
if (multi && !Array.isArray(value)) value = [value != null ? value : ""];
|
|
1560
|
-
if (Array.isArray(value)) {
|
|
1609
|
+
if (solidJs.sharedConfig.hydrating && Array.isArray(value)) {
|
|
1561
1610
|
for (let i = 0, len = value.length; i < len; i++) {
|
|
1562
1611
|
const item = value[i],
|
|
1563
1612
|
prev = current && current[i],
|
|
1564
1613
|
t = typeof item;
|
|
1565
|
-
if (t === "string" || t === "number")
|
|
1614
|
+
if ((t === "string" || t === "number") && prev && prev.nodeType === 3) value[i] = prev;
|
|
1566
1615
|
}
|
|
1567
1616
|
}
|
|
1568
1617
|
return value;
|
|
@@ -1643,9 +1692,333 @@ function gatherHydratable(element, root) {
|
|
|
1643
1692
|
function getHydrationKey() {
|
|
1644
1693
|
return solidJs.sharedConfig.getNextContextId();
|
|
1645
1694
|
}
|
|
1646
|
-
const voidFn = () => undefined;
|
|
1647
1695
|
const RequestContext = Symbol();
|
|
1648
1696
|
|
|
1697
|
+
const PURE_ROW = Symbol.for("solid.pure-row");
|
|
1698
|
+
const arm = () => {
|
|
1699
|
+
installListDriver(driveList);
|
|
1700
|
+
};
|
|
1701
|
+
function rowProof(fn) {
|
|
1702
|
+
arm();
|
|
1703
|
+
fn[PURE_ROW] = true;
|
|
1704
|
+
return fn;
|
|
1705
|
+
}
|
|
1706
|
+
let rowCollector = null;
|
|
1707
|
+
const lisPositions = sources => {
|
|
1708
|
+
const n = sources.length;
|
|
1709
|
+
const tails = [];
|
|
1710
|
+
const tailsIdx = [];
|
|
1711
|
+
const prev = new Array(n).fill(-1);
|
|
1712
|
+
for (let j = 0; j < n; j++) {
|
|
1713
|
+
const v = sources[j];
|
|
1714
|
+
if (v === -1) continue;
|
|
1715
|
+
let lo = 0,
|
|
1716
|
+
hi = tails.length;
|
|
1717
|
+
while (lo < hi) {
|
|
1718
|
+
const mid = lo + hi >> 1;
|
|
1719
|
+
if (tails[mid] < v) lo = mid + 1;else hi = mid;
|
|
1720
|
+
}
|
|
1721
|
+
if (lo > 0) prev[j] = tailsIdx[lo - 1];
|
|
1722
|
+
tails[lo] = v;
|
|
1723
|
+
tailsIdx[lo] = j;
|
|
1724
|
+
}
|
|
1725
|
+
const stable = new Set();
|
|
1726
|
+
let k = tailsIdx.length ? tailsIdx[tails.length - 1] : -1;
|
|
1727
|
+
while (k >= 0) {
|
|
1728
|
+
stable.add(k);
|
|
1729
|
+
k = prev[k];
|
|
1730
|
+
}
|
|
1731
|
+
return stable;
|
|
1732
|
+
};
|
|
1733
|
+
const driveList = (parent, listFn, marker, lateClassic) => {
|
|
1734
|
+
const meta = listFn.$ll;
|
|
1735
|
+
if (meta.row?.[PURE_ROW] !== true) return false;
|
|
1736
|
+
if (typeof meta.keyed === "function") return false;
|
|
1737
|
+
const evalOwner = solidJs.createOwner({
|
|
1738
|
+
id: "&each"
|
|
1739
|
+
});
|
|
1740
|
+
let subject = solidJs.runWithOwner(evalOwner, () => solidJs.untrack(meta.each));
|
|
1741
|
+
evalOwner.dispose();
|
|
1742
|
+
let raw = subject != null ? solidJs.patchableRaw(subject) : undefined;
|
|
1743
|
+
if (raw === undefined || !Array.isArray(raw)) return false;
|
|
1744
|
+
const optimistic = solidJs.storeHasOptimisticFamily(subject);
|
|
1745
|
+
if (optimistic) raw = solidJs.untrack(() => Array.from(subject));
|
|
1746
|
+
const hydrating = !!solidJs.sharedConfig.hydrating;
|
|
1747
|
+
if (hydrating && raw.length === 0) return false;
|
|
1748
|
+
let domRows;
|
|
1749
|
+
let rowIds;
|
|
1750
|
+
if (hydrating) {
|
|
1751
|
+
if (marker !== undefined) return false;
|
|
1752
|
+
domRows = Array.from(parent.children);
|
|
1753
|
+
if (domRows.length !== raw.length) return false;
|
|
1754
|
+
rowIds = new Array(raw.length);
|
|
1755
|
+
for (let i = 0; i < domRows.length; i++) {
|
|
1756
|
+
const key = domRows[i].getAttribute("_hk");
|
|
1757
|
+
if (key === null || !key.endsWith("0") || key.length < 2) return false;
|
|
1758
|
+
rowIds[i] = key.slice(0, -1);
|
|
1759
|
+
}
|
|
1760
|
+
}
|
|
1761
|
+
const rowFn = meta.row;
|
|
1762
|
+
const endAnchor = marker ?? null;
|
|
1763
|
+
const shallow = solidJs.storeIsShallow(subject);
|
|
1764
|
+
let lastBodies = null;
|
|
1765
|
+
let lastUnbinds = null;
|
|
1766
|
+
const collectBind = (abs, build) => {
|
|
1767
|
+
const prevC = rowCollector;
|
|
1768
|
+
rowCollector = {
|
|
1769
|
+
row: shallow ? subject[abs] : undefined,
|
|
1770
|
+
bodies: [],
|
|
1771
|
+
unbinds: []
|
|
1772
|
+
};
|
|
1773
|
+
try {
|
|
1774
|
+
return build();
|
|
1775
|
+
} finally {
|
|
1776
|
+
lastBodies = rowCollector.bodies;
|
|
1777
|
+
lastUnbinds = rowCollector.unbinds;
|
|
1778
|
+
rowCollector = prevC;
|
|
1779
|
+
}
|
|
1780
|
+
};
|
|
1781
|
+
const listOwner = solidJs.createOwner();
|
|
1782
|
+
let declined = false;
|
|
1783
|
+
const bindRow = (abs, claimId) => {
|
|
1784
|
+
{
|
|
1785
|
+
const o = listOwner;
|
|
1786
|
+
const prevChild = o._firstChild;
|
|
1787
|
+
const prevDisposal = o._disposal;
|
|
1788
|
+
const node = collectBind(abs, () => solidJs.runWithOwner(listOwner, () => claimId !== undefined ? solidJs.runWithOwner(solidJs.createOwner({
|
|
1789
|
+
id: claimId
|
|
1790
|
+
}), () => solidJs.untrack(() => rowFn(subject[abs]))) : solidJs.untrack(() => rowFn(subject[abs]))));
|
|
1791
|
+
if (o._firstChild !== prevChild || o._disposal !== prevDisposal) {
|
|
1792
|
+
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).");
|
|
1793
|
+
}
|
|
1794
|
+
return node;
|
|
1795
|
+
}
|
|
1796
|
+
};
|
|
1797
|
+
let entries = new Array(raw.length);
|
|
1798
|
+
let rowBodies = shallow ? new Array(raw.length) : null;
|
|
1799
|
+
let rowUnbinds = new Array(raw.length);
|
|
1800
|
+
const runUnbinds = list => {
|
|
1801
|
+
if (list !== undefined) for (let u = 0; u < list.length; u++) list[u]();
|
|
1802
|
+
};
|
|
1803
|
+
const unbindAllRows = () => {
|
|
1804
|
+
for (let j = 0; j < rowUnbinds.length; j++) runUnbinds(rowUnbinds[j]);
|
|
1805
|
+
rowUnbinds = [];
|
|
1806
|
+
};
|
|
1807
|
+
let prevRaws = raw.slice();
|
|
1808
|
+
try {
|
|
1809
|
+
if (hydrating) {
|
|
1810
|
+
for (let i = 0; i < raw.length; i++) {
|
|
1811
|
+
entries[i] = bindRow(i, rowIds[i]);
|
|
1812
|
+
if (rowBodies !== null) rowBodies[i] = lastBodies;
|
|
1813
|
+
rowUnbinds[i] = lastUnbinds;
|
|
1814
|
+
}
|
|
1815
|
+
} else {
|
|
1816
|
+
for (let i = 0; i < raw.length; i++) {
|
|
1817
|
+
const node = bindRow(i);
|
|
1818
|
+
entries[i] = node;
|
|
1819
|
+
if (rowBodies !== null) rowBodies[i] = lastBodies;
|
|
1820
|
+
rowUnbinds[i] = lastUnbinds;
|
|
1821
|
+
parent.insertBefore(node, endAnchor);
|
|
1822
|
+
}
|
|
1823
|
+
}
|
|
1824
|
+
} catch (err) {
|
|
1825
|
+
unbindAllRows();
|
|
1826
|
+
runUnbinds(lastUnbinds ?? undefined);
|
|
1827
|
+
for (let j = 0; j < entries.length; j++) {
|
|
1828
|
+
const n = entries[j];
|
|
1829
|
+
if (n !== undefined && n.parentNode === parent) n.remove();
|
|
1830
|
+
}
|
|
1831
|
+
listOwner.dispose();
|
|
1832
|
+
throw err;
|
|
1833
|
+
}
|
|
1834
|
+
const identityOps = nextArr => {
|
|
1835
|
+
const keyOf = r => {
|
|
1836
|
+
const w = r != null ? solidJs.patchableRaw(r) : undefined;
|
|
1837
|
+
return w !== undefined ? w : r;
|
|
1838
|
+
};
|
|
1839
|
+
const oldIndex = new Map();
|
|
1840
|
+
for (let j = 0; j < prevRaws.length; j++) {
|
|
1841
|
+
const k = keyOf(prevRaws[j]);
|
|
1842
|
+
const existing = oldIndex.get(k);
|
|
1843
|
+
if (existing === undefined) oldIndex.set(k, j);else if (Array.isArray(existing)) existing.push(j);else oldIndex.set(k, [existing, j]);
|
|
1844
|
+
}
|
|
1845
|
+
const sources = new Array(nextArr.length);
|
|
1846
|
+
for (let k = 0; k < nextArr.length; k++) {
|
|
1847
|
+
const m = oldIndex.get(keyOf(nextArr[k]));
|
|
1848
|
+
if (m === undefined) sources[k] = -1;else if (Array.isArray(m)) {
|
|
1849
|
+
sources[k] = m.shift();
|
|
1850
|
+
if (m.length === 1) oldIndex.set(keyOf(nextArr[k]), m[0]);
|
|
1851
|
+
} else {
|
|
1852
|
+
sources[k] = m;
|
|
1853
|
+
oldIndex.delete(keyOf(nextArr[k]));
|
|
1854
|
+
}
|
|
1855
|
+
}
|
|
1856
|
+
return {
|
|
1857
|
+
prefix: 0,
|
|
1858
|
+
sources
|
|
1859
|
+
};
|
|
1860
|
+
};
|
|
1861
|
+
let resyncNeeded = false;
|
|
1862
|
+
const applyOps = (next, ops) => {
|
|
1863
|
+
if (declined) return;
|
|
1864
|
+
if (resyncNeeded) ops = null;
|
|
1865
|
+
if (ops === null) ops = identityOps(next);
|
|
1866
|
+
const {
|
|
1867
|
+
prefix,
|
|
1868
|
+
sources
|
|
1869
|
+
} = ops;
|
|
1870
|
+
const built = new Array(sources.length);
|
|
1871
|
+
const builtBodies = rowBodies !== null ? new Array(sources.length) : null;
|
|
1872
|
+
const builtUnbinds = new Array(sources.length);
|
|
1873
|
+
let j = 0;
|
|
1874
|
+
try {
|
|
1875
|
+
for (; j < sources.length; j++) {
|
|
1876
|
+
const abs = prefix + j;
|
|
1877
|
+
const src = sources[j];
|
|
1878
|
+
if (src === -1 || refRebuild && src >= 0 && next[abs] !== prevRaws[src]) {
|
|
1879
|
+
built[j] = bindRow(abs);
|
|
1880
|
+
if (builtBodies !== null) builtBodies[j] = lastBodies;
|
|
1881
|
+
builtUnbinds[j] = lastUnbinds;
|
|
1882
|
+
}
|
|
1883
|
+
}
|
|
1884
|
+
} catch (err) {
|
|
1885
|
+
for (let k = 0; k < j; k++) runUnbinds(builtUnbinds[k]);
|
|
1886
|
+
runUnbinds(lastUnbinds ?? undefined);
|
|
1887
|
+
resyncNeeded = true;
|
|
1888
|
+
throw err;
|
|
1889
|
+
}
|
|
1890
|
+
const retained = new Set();
|
|
1891
|
+
for (let k = 0; k < sources.length; k++) {
|
|
1892
|
+
if (sources[k] >= 0 && built[k] === undefined) retained.add(sources[k]);
|
|
1893
|
+
}
|
|
1894
|
+
for (let k = prefix; k < entries.length; k++) {
|
|
1895
|
+
if (!retained.has(k)) {
|
|
1896
|
+
entries[k].remove();
|
|
1897
|
+
runUnbinds(rowUnbinds[k]);
|
|
1898
|
+
}
|
|
1899
|
+
}
|
|
1900
|
+
const newEntries = new Array(prefix + sources.length);
|
|
1901
|
+
const newBodies = rowBodies !== null ? new Array(prefix + sources.length) : null;
|
|
1902
|
+
const newUnbinds = new Array(prefix + sources.length);
|
|
1903
|
+
for (let i = 0; i < prefix; i++) {
|
|
1904
|
+
newEntries[i] = entries[i];
|
|
1905
|
+
if (newBodies !== null) newBodies[i] = rowBodies[i];
|
|
1906
|
+
newUnbinds[i] = rowUnbinds[i];
|
|
1907
|
+
}
|
|
1908
|
+
const stable = lisPositions(sources);
|
|
1909
|
+
let anchor = endAnchor;
|
|
1910
|
+
for (let k = sources.length - 1; k >= 0; k--) {
|
|
1911
|
+
const abs = prefix + k;
|
|
1912
|
+
const src = sources[k];
|
|
1913
|
+
let node;
|
|
1914
|
+
if (built[k] !== undefined) {
|
|
1915
|
+
node = built[k];
|
|
1916
|
+
if (newBodies !== null) newBodies[abs] = builtBodies[k];
|
|
1917
|
+
newUnbinds[abs] = builtUnbinds[k];
|
|
1918
|
+
parent.insertBefore(node, anchor);
|
|
1919
|
+
} else {
|
|
1920
|
+
node = entries[src];
|
|
1921
|
+
if (newBodies !== null) newBodies[abs] = rowBodies[src];
|
|
1922
|
+
newUnbinds[abs] = rowUnbinds[src];
|
|
1923
|
+
if (!stable.has(k)) parent.insertBefore(node, anchor);
|
|
1924
|
+
}
|
|
1925
|
+
newEntries[abs] = node;
|
|
1926
|
+
anchor = node;
|
|
1927
|
+
}
|
|
1928
|
+
entries = newEntries;
|
|
1929
|
+
if (newBodies !== null) rowBodies = newBodies;
|
|
1930
|
+
rowUnbinds = newUnbinds;
|
|
1931
|
+
prevRaws = next.slice();
|
|
1932
|
+
resyncNeeded = false;
|
|
1933
|
+
};
|
|
1934
|
+
let unbindOps = solidJs.runWithOwner(listOwner, () => solidJs.registerRowOps(subject, applyOps));
|
|
1935
|
+
const refRebuild = shallow && typeof meta.keyed !== "function";
|
|
1936
|
+
const rebuildSlot = i => {
|
|
1937
|
+
runUnbinds(rowUnbinds[i]);
|
|
1938
|
+
const old = entries[i];
|
|
1939
|
+
const node = bindRow(i);
|
|
1940
|
+
rowBodies[i] = lastBodies;
|
|
1941
|
+
rowUnbinds[i] = lastUnbinds;
|
|
1942
|
+
parent.insertBefore(node, old);
|
|
1943
|
+
old.remove();
|
|
1944
|
+
entries[i] = node;
|
|
1945
|
+
};
|
|
1946
|
+
const applySlot = (i, next, prev) => {
|
|
1947
|
+
if (declined) return;
|
|
1948
|
+
if (resyncNeeded) {
|
|
1949
|
+
const live = subject != null ? solidJs.patchableRaw(subject) : undefined;
|
|
1950
|
+
if (live !== undefined && Array.isArray(live)) applyOps(live, null);
|
|
1951
|
+
return;
|
|
1952
|
+
}
|
|
1953
|
+
if (refRebuild) {
|
|
1954
|
+
rebuildSlot(i);
|
|
1955
|
+
prevRaws[i] = next;
|
|
1956
|
+
return;
|
|
1957
|
+
}
|
|
1958
|
+
const bodies = rowBodies[i];
|
|
1959
|
+
if (bodies !== undefined) {
|
|
1960
|
+
for (let b = 0; b < bodies.length; b++) bodies[b](next, prev, false);
|
|
1961
|
+
}
|
|
1962
|
+
prevRaws[i] = next;
|
|
1963
|
+
};
|
|
1964
|
+
let unbindSlots = shallow ? solidJs.runWithOwner(listOwner, () => solidJs.registerSlotPatch(subject, applySlot)) : null;
|
|
1965
|
+
solidJs.runWithOwner(listOwner, () => effect(() => meta.each(), value => {
|
|
1966
|
+
if (declined || value === subject) return;
|
|
1967
|
+
const nextRaw = value != null ? solidJs.patchableRaw(value) : undefined;
|
|
1968
|
+
unbindOps();
|
|
1969
|
+
unbindSlots?.();
|
|
1970
|
+
if (nextRaw !== undefined && Array.isArray(nextRaw) && solidJs.storeIsShallow(value) !== shallow) {
|
|
1971
|
+
for (let j = 0; j < entries.length; j++) entries[j].remove();
|
|
1972
|
+
entries = [];
|
|
1973
|
+
prevRaws = [];
|
|
1974
|
+
unbindAllRows();
|
|
1975
|
+
subject = value;
|
|
1976
|
+
declined = true;
|
|
1977
|
+
listOwner.dispose();
|
|
1978
|
+
lateClassic?.();
|
|
1979
|
+
return;
|
|
1980
|
+
}
|
|
1981
|
+
if (nextRaw === undefined || !Array.isArray(nextRaw)) {
|
|
1982
|
+
for (let j = 0; j < entries.length; j++) entries[j].remove();
|
|
1983
|
+
entries = [];
|
|
1984
|
+
prevRaws = [];
|
|
1985
|
+
unbindAllRows();
|
|
1986
|
+
subject = value;
|
|
1987
|
+
declined = true;
|
|
1988
|
+
listOwner.dispose();
|
|
1989
|
+
lateClassic?.();
|
|
1990
|
+
return;
|
|
1991
|
+
}
|
|
1992
|
+
const swapOps = identityOps(nextRaw);
|
|
1993
|
+
subject = value;
|
|
1994
|
+
unbindOps = solidJs.runWithOwner(listOwner, () => solidJs.registerRowOps(subject, applyOps));
|
|
1995
|
+
if (shallow) unbindSlots = solidJs.runWithOwner(listOwner, () => solidJs.registerSlotPatch(subject, applySlot));
|
|
1996
|
+
applyOps(nextRaw, swapOps);
|
|
1997
|
+
}));
|
|
1998
|
+
solidJs.onCleanup(() => {
|
|
1999
|
+
unbindOps();
|
|
2000
|
+
unbindSlots?.();
|
|
2001
|
+
unbindAllRows();
|
|
2002
|
+
listOwner.dispose();
|
|
2003
|
+
});
|
|
2004
|
+
return true;
|
|
2005
|
+
};
|
|
2006
|
+
const patchDriver = (subject, body) => {
|
|
2007
|
+
const raw = solidJs.patchableRaw(subject);
|
|
2008
|
+
if (raw !== undefined) {
|
|
2009
|
+
if (!solidJs.sharedConfig.hydrating) body(raw, undefined, true);
|
|
2010
|
+
const unbind = solidJs.registerPatch(subject, body);
|
|
2011
|
+
if (rowCollector !== null) rowCollector.unbinds.push(unbind);
|
|
2012
|
+
else solidJs.onCleanup(unbind);
|
|
2013
|
+
} else if (rowCollector !== null && subject === rowCollector.row) {
|
|
2014
|
+
rowCollector.bodies.push(body);
|
|
2015
|
+
if (!solidJs.sharedConfig.hydrating) body(subject, undefined, true);
|
|
2016
|
+
} else {
|
|
2017
|
+
effect(() => body(subject, subject, false),
|
|
2018
|
+
() => solidJs.untrack(() => body(subject, undefined, true)));
|
|
2019
|
+
}
|
|
2020
|
+
};
|
|
2021
|
+
|
|
1649
2022
|
function throwInBrowser(func) {
|
|
1650
2023
|
const err = new Error(`${func.name} is not supported in the browser, returning undefined`);
|
|
1651
2024
|
console.error(err);
|
|
@@ -1719,11 +2092,14 @@ function isSafeError(value) {
|
|
|
1719
2092
|
return !!(value && (typeof value === "object" || typeof value === "function") && value[SAFE_ERROR]);
|
|
1720
2093
|
}
|
|
1721
2094
|
const REVALIDATE_HEADER = "X-Revalidate";
|
|
1722
|
-
function initWithRevalidate(init) {
|
|
2095
|
+
function initWithRevalidate(init = {}) {
|
|
2096
|
+
const resolved = typeof init === "number" ? {
|
|
2097
|
+
status: init
|
|
2098
|
+
} : init;
|
|
1723
2099
|
const {
|
|
1724
2100
|
revalidate,
|
|
1725
2101
|
...responseInit
|
|
1726
|
-
} =
|
|
2102
|
+
} = resolved;
|
|
1727
2103
|
let headers;
|
|
1728
2104
|
if (responseInit.headers && responseInit.headers.getSetCookie) {
|
|
1729
2105
|
headers = new Headers();
|
|
@@ -1749,13 +2125,12 @@ function redirect(url, init = 302) {
|
|
|
1749
2125
|
const {
|
|
1750
2126
|
responseInit,
|
|
1751
2127
|
headers
|
|
1752
|
-
} = initWithRevalidate(
|
|
1753
|
-
status: init
|
|
1754
|
-
} : init);
|
|
2128
|
+
} = initWithRevalidate(init);
|
|
1755
2129
|
if (responseInit.status === undefined) {
|
|
1756
2130
|
responseInit.status = 302;
|
|
1757
2131
|
}
|
|
1758
|
-
|
|
2132
|
+
const target = typeof url === "string" ? url : url[HREF];
|
|
2133
|
+
headers.set("Location", typeof target === "string" ? target : String(url));
|
|
1759
2134
|
return new Response(null, {
|
|
1760
2135
|
...responseInit,
|
|
1761
2136
|
headers
|
|
@@ -1783,28 +2158,8 @@ function respond(value, init = {}) {
|
|
|
1783
2158
|
}), value);
|
|
1784
2159
|
}
|
|
1785
2160
|
|
|
1786
|
-
const mergeProps = solidJs.merge;
|
|
1787
2161
|
const isServer = false;
|
|
1788
2162
|
const isDev = true;
|
|
1789
|
-
function render(code, element, init, options = {}) {
|
|
1790
|
-
solidJs.enforceLoadingBoundary(true);
|
|
1791
|
-
try {
|
|
1792
|
-
const dispose = render$1(code, element, init, {
|
|
1793
|
-
...options,
|
|
1794
|
-
insertOptions: {
|
|
1795
|
-
schedule: true
|
|
1796
|
-
}
|
|
1797
|
-
});
|
|
1798
|
-
solidJs.flush();
|
|
1799
|
-
return dispose;
|
|
1800
|
-
} finally {
|
|
1801
|
-
solidJs.enforceLoadingBoundary(false);
|
|
1802
|
-
}
|
|
1803
|
-
}
|
|
1804
|
-
const hydrate = (...args) => {
|
|
1805
|
-
solidJs.enableHydration();
|
|
1806
|
-
return hydrate$1(...args);
|
|
1807
|
-
};
|
|
1808
2163
|
function Portal(props) {
|
|
1809
2164
|
return solidJs.runWithOwner(solidJs.createOwner(), () => portalImpl(props));
|
|
1810
2165
|
}
|
|
@@ -1857,7 +2212,7 @@ function portalImpl(props) {
|
|
|
1857
2212
|
});
|
|
1858
2213
|
return treeMarker;
|
|
1859
2214
|
}
|
|
1860
|
-
const COMPONENT_BINDING = Symbol.for("
|
|
2215
|
+
const COMPONENT_BINDING = Symbol.for("solid.component-binding");
|
|
1861
2216
|
function bindingOf(value) {
|
|
1862
2217
|
return value !== null && (typeof value === "function" || typeof value === "object") && value[COMPONENT_BINDING] || undefined;
|
|
1863
2218
|
}
|
|
@@ -1997,6 +2352,10 @@ Object.defineProperty(exports, "getOwner", {
|
|
|
1997
2352
|
enumerable: true,
|
|
1998
2353
|
get: function () { return solidJs.getOwner; }
|
|
1999
2354
|
});
|
|
2355
|
+
Object.defineProperty(exports, "mergeProps", {
|
|
2356
|
+
enumerable: true,
|
|
2357
|
+
get: function () { return solidJs.merge; }
|
|
2358
|
+
});
|
|
2000
2359
|
Object.defineProperty(exports, "untrack", {
|
|
2001
2360
|
enumerable: true,
|
|
2002
2361
|
get: function () { return solidJs.untrack; }
|
|
@@ -2007,7 +2366,7 @@ exports.DOMWithState = DOMWithState;
|
|
|
2007
2366
|
exports.DelegatedEvents = DelegatedEvents;
|
|
2008
2367
|
exports.Dynamic = Dynamic;
|
|
2009
2368
|
exports.HREF = HREF;
|
|
2010
|
-
exports.HydrationScript =
|
|
2369
|
+
exports.HydrationScript = HydrationScript;
|
|
2011
2370
|
exports.MathMLElements = MathMLElements;
|
|
2012
2371
|
exports.Namespaces = Namespaces;
|
|
2013
2372
|
exports.Portal = Portal;
|
|
@@ -2033,11 +2392,12 @@ exports.createRequestEvent = createRequestEvent;
|
|
|
2033
2392
|
exports.createResponseStub = createResponseStub;
|
|
2034
2393
|
exports.createSSRResponse = createSSRResponse;
|
|
2035
2394
|
exports.delegateEvents = delegateEvents;
|
|
2395
|
+
exports.driveList = driveList;
|
|
2036
2396
|
exports.dynamic = dynamic;
|
|
2037
2397
|
exports.dynamicProperty = dynamicProperty;
|
|
2038
2398
|
exports.effect = effect;
|
|
2039
2399
|
exports.escape = escape;
|
|
2040
|
-
exports.generateHydrationScript =
|
|
2400
|
+
exports.generateHydrationScript = generateHydrationScript;
|
|
2041
2401
|
exports.getDelegatedRoot = getDelegatedRoot;
|
|
2042
2402
|
exports.getExpectedRedirectStatus = getExpectedRedirectStatus;
|
|
2043
2403
|
exports.getFirstChild = getFirstChild;
|
|
@@ -2046,7 +2406,7 @@ exports.getNextElement = getNextElement;
|
|
|
2046
2406
|
exports.getNextMarker = getNextMarker;
|
|
2047
2407
|
exports.getNextMatch = getNextMatch;
|
|
2048
2408
|
exports.getNextSibling = getNextSibling;
|
|
2049
|
-
exports.getRequestEvent =
|
|
2409
|
+
exports.getRequestEvent = getRequestEvent;
|
|
2050
2410
|
exports.getServerFunctionMetadata = getServerFunctionMetadata;
|
|
2051
2411
|
exports.getServerFunctionRPC = getServerFunctionRPC;
|
|
2052
2412
|
exports.hasFlashCookie = hasFlashCookie;
|
|
@@ -2055,6 +2415,7 @@ exports.httpStatus = httpStatus;
|
|
|
2055
2415
|
exports.hydrate = hydrate;
|
|
2056
2416
|
exports.insert = insert;
|
|
2057
2417
|
exports.installHydrationRuntime = installHydrationRuntime;
|
|
2418
|
+
exports.installListDriver = installListDriver;
|
|
2058
2419
|
exports.isDev = isDev;
|
|
2059
2420
|
exports.isHref = isHref;
|
|
2060
2421
|
exports.isResponseEnvelope = isResponseEnvelope;
|
|
@@ -2063,7 +2424,6 @@ exports.isServer = isServer;
|
|
|
2063
2424
|
exports.isServerFunction = isServerFunction;
|
|
2064
2425
|
exports.markSafeError = markSafeError;
|
|
2065
2426
|
exports.memo = memo;
|
|
2066
|
-
exports.mergeProps = mergeProps;
|
|
2067
2427
|
exports.parseCookieHeader = parseCookieHeader;
|
|
2068
2428
|
exports.patchDriver = patchDriver;
|
|
2069
2429
|
exports.redirect = redirect;
|
|
@@ -2099,4 +2459,5 @@ exports.template = template;
|
|
|
2099
2459
|
exports.unregisterDelegatedContainer = unregisterDelegatedContainer;
|
|
2100
2460
|
exports.unregisterDelegatedRoot = unregisterDelegatedRoot;
|
|
2101
2461
|
exports.useHead = useHead;
|
|
2462
|
+
exports.waitAsset = waitAsset;
|
|
2102
2463
|
exports.warmAsset = warmAsset;
|