@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.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createRenderEffect, createMemo,
|
|
2
|
-
export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, Show, Switch, createComponent, getOwner, untrack } from 'solid-js';
|
|
1
|
+
import { createRenderEffect, createMemo, sharedConfig, enableHydration, untrack, runWithOwner, resetErrorHalt, enforceLoadingBoundary, createRoot, flatten, flush, getOwner, createOwner, patchableRaw, storeHasOptimisticFamily, storeIsShallow, registerRowOps, registerSlotPatch, onCleanup, registerPatch, createComponent, omit, createSignal, $DEVCOMP, createEffect } from 'solid-js';
|
|
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 = {
|
|
5
5
|
INPUT: {
|
|
@@ -56,23 +56,16 @@ const transparentOptions = {
|
|
|
56
56
|
const syncOptions = {
|
|
57
57
|
sync: true
|
|
58
58
|
};
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
runWithOwner(null, () => {
|
|
70
|
-
gate = createMemo(() => promise);
|
|
71
|
-
});
|
|
72
|
-
assetGates.set(promise, gate);
|
|
73
|
-
}
|
|
74
|
-
gate();
|
|
75
|
-
};
|
|
59
|
+
function effect(fn, effectFn, options) {
|
|
60
|
+
createRenderEffect(fn, effectFn, options ? {
|
|
61
|
+
sync: true,
|
|
62
|
+
...options,
|
|
63
|
+
transparent: !options.scope
|
|
64
|
+
} : transparentOptions);
|
|
65
|
+
}
|
|
66
|
+
function memo(fn) {
|
|
67
|
+
return createMemo(() => fn(), syncOptions);
|
|
68
|
+
}
|
|
76
69
|
|
|
77
70
|
function reconcileArrays(parentNode, a, b, marker) {
|
|
78
71
|
let bLength = b.length,
|
|
@@ -329,14 +322,39 @@ function getServerFunctionRPC() {
|
|
|
329
322
|
return globalThis[SERVER_FUNCTION_RPC];
|
|
330
323
|
}
|
|
331
324
|
|
|
332
|
-
const
|
|
325
|
+
const assetGates = new WeakMap();
|
|
326
|
+
const waitAsset = promise => {
|
|
327
|
+
let gate = assetGates.get(promise);
|
|
328
|
+
if (!gate) {
|
|
329
|
+
runWithOwner(null, () => {
|
|
330
|
+
gate = createMemo(() => promise);
|
|
331
|
+
});
|
|
332
|
+
assetGates.set(promise, gate);
|
|
333
|
+
}
|
|
334
|
+
gate();
|
|
335
|
+
};
|
|
336
|
+
let listDriver;
|
|
337
|
+
function installListDriver(driver) {
|
|
338
|
+
listDriver = driver;
|
|
339
|
+
}
|
|
340
|
+
const $$EVENT_OWNER = "_$SOLID_EVENT_OWNER";
|
|
333
341
|
const INNER_OWNED = {};
|
|
334
342
|
const delegatedEvents = new Set();
|
|
335
343
|
const delegatedContainers = new Map();
|
|
336
|
-
function
|
|
344
|
+
function voidFn() {}
|
|
345
|
+
function generateHydrationScript(_options) {
|
|
346
|
+
return "";
|
|
347
|
+
}
|
|
348
|
+
function HydrationScript(_props) {
|
|
349
|
+
return null;
|
|
350
|
+
}
|
|
351
|
+
const getRequestEvent = voidFn;
|
|
352
|
+
function render(code, element, init, options = {}) {
|
|
337
353
|
if (!element) {
|
|
338
354
|
throw new Error("The `element` passed to `render(..., element)` doesn't exist. Make sure `element` exists in the document.");
|
|
339
355
|
}
|
|
356
|
+
resetErrorHalt();
|
|
357
|
+
enforceLoadingBoundary(true);
|
|
340
358
|
let disposer;
|
|
341
359
|
registerDelegatedRoot(element);
|
|
342
360
|
try {
|
|
@@ -347,15 +365,21 @@ function render$1(code, element, init, options = {}) {
|
|
|
347
365
|
effect(() => flatten(tree), () => {});
|
|
348
366
|
} else {
|
|
349
367
|
const tree = code();
|
|
350
|
-
insert(element, () => tree, element.firstChild ? null : undefined, init,
|
|
368
|
+
insert(element, () => tree, element.firstChild ? null : undefined, init, {
|
|
369
|
+
...options.insertOptions,
|
|
370
|
+
schedule: true
|
|
371
|
+
});
|
|
351
372
|
}
|
|
352
373
|
}, {
|
|
353
374
|
id: options.renderId
|
|
354
375
|
});
|
|
376
|
+
flush();
|
|
355
377
|
} catch (err) {
|
|
356
378
|
if (disposer) disposer();
|
|
357
379
|
unregisterDelegatedRoot(element);
|
|
358
380
|
throw err;
|
|
381
|
+
} finally {
|
|
382
|
+
enforceLoadingBoundary(false);
|
|
359
383
|
}
|
|
360
384
|
return () => {
|
|
361
385
|
disposer();
|
|
@@ -442,7 +466,7 @@ function setProperty(node, name, value) {
|
|
|
442
466
|
node[name] = value;
|
|
443
467
|
}
|
|
444
468
|
let claimHandlers = null;
|
|
445
|
-
const CLAIM_SEAM = Symbol.for("
|
|
469
|
+
const CLAIM_SEAM = Symbol.for("solid.element-claims");
|
|
446
470
|
function registerElementClaim(handler) {
|
|
447
471
|
(claimHandlers || (claimHandlers = globalThis[CLAIM_SEAM] = [])).push(handler);
|
|
448
472
|
return () => {
|
|
@@ -596,11 +620,6 @@ function ref(fn, element) {
|
|
|
596
620
|
const resolved = untrack(fn);
|
|
597
621
|
runWithOwner(null, () => applyRef(resolved, element));
|
|
598
622
|
}
|
|
599
|
-
const PURE_ROW = Symbol.for("solid.pure-row");
|
|
600
|
-
function rowProof(fn) {
|
|
601
|
-
fn[PURE_ROW] = true;
|
|
602
|
-
return fn;
|
|
603
|
-
}
|
|
604
623
|
function scope(fn) {
|
|
605
624
|
fn.$s = true;
|
|
606
625
|
return fn;
|
|
@@ -664,16 +683,16 @@ function stripTextSeparators(nodes) {
|
|
|
664
683
|
nodes.length = j;
|
|
665
684
|
return nodes;
|
|
666
685
|
}
|
|
667
|
-
function patchDriver(subject, body) {
|
|
668
|
-
{
|
|
669
|
-
effect(() => body(subject, subject, false), () => body(subject, undefined, true));
|
|
670
|
-
}
|
|
671
|
-
}
|
|
672
686
|
function insert(parent, accessor, marker, initial, options) {
|
|
673
687
|
const multi = marker !== undefined;
|
|
674
688
|
const host = options && options.host;
|
|
675
689
|
if (multi && !initial) initial = [];
|
|
676
690
|
if (hydrationRt !== null) initial = hydrationRt.claimInitial(parent, multi, initial);
|
|
691
|
+
if (listDriver !== undefined && typeof accessor === "function" && accessor.$ll !== undefined) {
|
|
692
|
+
const listAccessor = accessor;
|
|
693
|
+
const owner = getOwner();
|
|
694
|
+
if (listDriver(parent, accessor, marker, () => runWithOwner(owner, () => insert(parent, () => listAccessor(), marker, marker !== undefined ? [] : undefined, options)))) return;
|
|
695
|
+
}
|
|
677
696
|
if (typeof accessor !== "function") {
|
|
678
697
|
accessor = normalize(accessor, initial, multi, true);
|
|
679
698
|
if (typeof accessor !== "function") {
|
|
@@ -1148,9 +1167,19 @@ function loadModuleAssets(mapping) {
|
|
|
1148
1167
|
}
|
|
1149
1168
|
return pending.length ? Promise.all(pending).then(() => {}) : undefined;
|
|
1150
1169
|
}
|
|
1151
|
-
function hydrate
|
|
1170
|
+
function hydrate(code, element, options = {}) {
|
|
1171
|
+
enableHydration();
|
|
1152
1172
|
installHydrationRuntime();
|
|
1153
|
-
if (globalThis._$HY.done) return render
|
|
1173
|
+
if (globalThis._$HY.done) return render(code, element, [...element.childNodes], options);
|
|
1174
|
+
const head = (element.nodeType === 9 ? element : element.ownerDocument).head;
|
|
1175
|
+
if (head && element.contains(head)) {
|
|
1176
|
+
let n = head.firstChild;
|
|
1177
|
+
while (n && n.nodeType === 1 && n.hasAttribute("data-dh") && !n.hasAttribute("data-dhf")) {
|
|
1178
|
+
const next = n.nextSibling;
|
|
1179
|
+
head.appendChild(n);
|
|
1180
|
+
n = next;
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1154
1183
|
options.renderId ||= "";
|
|
1155
1184
|
if (!globalThis._$HY.modules) globalThis._$HY.modules = {};
|
|
1156
1185
|
if (!globalThis._$HY.loading) globalThis._$HY.loading = {};
|
|
@@ -1209,7 +1238,7 @@ function hydrate$1(code, element, options = {}) {
|
|
|
1209
1238
|
sharedConfig.gather = gather;
|
|
1210
1239
|
sharedConfig.hydrating = true;
|
|
1211
1240
|
try {
|
|
1212
|
-
disposer = render
|
|
1241
|
+
disposer = render(code, element, [...element.childNodes], options);
|
|
1213
1242
|
} finally {
|
|
1214
1243
|
sharedConfig.hydrating = false;
|
|
1215
1244
|
}
|
|
@@ -1217,14 +1246,14 @@ function hydrate$1(code, element, options = {}) {
|
|
|
1217
1246
|
console.error("Hydration module preload failed, falling back to client render:", err);
|
|
1218
1247
|
sharedConfig.hydrating = false;
|
|
1219
1248
|
sharedConfig.registry = undefined;
|
|
1220
|
-
disposer = render
|
|
1249
|
+
disposer = render(code, element, [...element.childNodes], options);
|
|
1221
1250
|
});
|
|
1222
1251
|
return () => disposer && disposer();
|
|
1223
1252
|
}
|
|
1224
1253
|
}
|
|
1225
1254
|
try {
|
|
1226
1255
|
gatherHydratable(element, options.renderId);
|
|
1227
|
-
return render
|
|
1256
|
+
return render(code, element, [...element.childNodes], options);
|
|
1228
1257
|
} finally {
|
|
1229
1258
|
sharedConfig.hydrating = false;
|
|
1230
1259
|
}
|
|
@@ -1456,7 +1485,7 @@ function eventHandler(e, container, state) {
|
|
|
1456
1485
|
const handleNode = () => {
|
|
1457
1486
|
let handler = node[key];
|
|
1458
1487
|
if (handler === undefined && node.hasAttribute && node.hasAttribute("_bnd")) {
|
|
1459
|
-
const seam = globalThis[Symbol.for("
|
|
1488
|
+
const seam = globalThis[Symbol.for("solid.bnd")];
|
|
1460
1489
|
if (seam) handler = seam.resolve(node, e.type);
|
|
1461
1490
|
}
|
|
1462
1491
|
if (handler && !node.disabled) {
|
|
@@ -1505,7 +1534,16 @@ function eventHandler(e, container, state) {
|
|
|
1505
1534
|
}
|
|
1506
1535
|
function insertExpression(parent, value, current, marker) {
|
|
1507
1536
|
if (hydrationRt !== null && isHydrating(parent)) {
|
|
1508
|
-
if (value && value !== current)
|
|
1537
|
+
if (value && value !== current) {
|
|
1538
|
+
const arr = Array.isArray(value);
|
|
1539
|
+
for (const n of arr ? value : [value]) {
|
|
1540
|
+
if (n && n.nodeType) {
|
|
1541
|
+
if (!isHydrating(n)) return current;
|
|
1542
|
+
} else if (arr && (typeof n === "string" || typeof n === "number")) {
|
|
1543
|
+
return current;
|
|
1544
|
+
}
|
|
1545
|
+
}
|
|
1546
|
+
}
|
|
1509
1547
|
return value;
|
|
1510
1548
|
}
|
|
1511
1549
|
if (value === current) return value;
|
|
@@ -1536,6 +1574,17 @@ function insertExpression(parent, value, current, marker) {
|
|
|
1536
1574
|
if (marker) value[$$SLOT] = marker;
|
|
1537
1575
|
} else if (Array.isArray(value)) {
|
|
1538
1576
|
const currentArray = current && Array.isArray(current);
|
|
1577
|
+
for (let i = 0, len = value.length; i < len; i++) {
|
|
1578
|
+
const item = value[i],
|
|
1579
|
+
t = typeof item;
|
|
1580
|
+
if (t === "string" || t === "number") {
|
|
1581
|
+
const prev = currentArray ? current[i] : undefined;
|
|
1582
|
+
if (prev && prev.nodeType === 3) {
|
|
1583
|
+
if (prev.data !== "" + item) prev.data = item;
|
|
1584
|
+
value[i] = prev;
|
|
1585
|
+
} else value[i] = document.createTextNode(item);
|
|
1586
|
+
}
|
|
1587
|
+
}
|
|
1539
1588
|
if (value.length === 0) {
|
|
1540
1589
|
cleanChildren(parent, current, marker);
|
|
1541
1590
|
} else if (currentArray) {
|
|
@@ -1556,12 +1605,12 @@ function normalize(value, current, multi, doNotUnwrap) {
|
|
|
1556
1605
|
});
|
|
1557
1606
|
if (doNotUnwrap && typeof value === "function") return value;
|
|
1558
1607
|
if (multi && !Array.isArray(value)) value = [value != null ? value : ""];
|
|
1559
|
-
if (Array.isArray(value)) {
|
|
1608
|
+
if (sharedConfig.hydrating && Array.isArray(value)) {
|
|
1560
1609
|
for (let i = 0, len = value.length; i < len; i++) {
|
|
1561
1610
|
const item = value[i],
|
|
1562
1611
|
prev = current && current[i],
|
|
1563
1612
|
t = typeof item;
|
|
1564
|
-
if (t === "string" || t === "number")
|
|
1613
|
+
if ((t === "string" || t === "number") && prev && prev.nodeType === 3) value[i] = prev;
|
|
1565
1614
|
}
|
|
1566
1615
|
}
|
|
1567
1616
|
return value;
|
|
@@ -1642,9 +1691,333 @@ function gatherHydratable(element, root) {
|
|
|
1642
1691
|
function getHydrationKey() {
|
|
1643
1692
|
return sharedConfig.getNextContextId();
|
|
1644
1693
|
}
|
|
1645
|
-
const voidFn = () => undefined;
|
|
1646
1694
|
const RequestContext = Symbol();
|
|
1647
1695
|
|
|
1696
|
+
const PURE_ROW = Symbol.for("solid.pure-row");
|
|
1697
|
+
const arm = () => {
|
|
1698
|
+
installListDriver(driveList);
|
|
1699
|
+
};
|
|
1700
|
+
function rowProof(fn) {
|
|
1701
|
+
arm();
|
|
1702
|
+
fn[PURE_ROW] = true;
|
|
1703
|
+
return fn;
|
|
1704
|
+
}
|
|
1705
|
+
let rowCollector = null;
|
|
1706
|
+
const lisPositions = sources => {
|
|
1707
|
+
const n = sources.length;
|
|
1708
|
+
const tails = [];
|
|
1709
|
+
const tailsIdx = [];
|
|
1710
|
+
const prev = new Array(n).fill(-1);
|
|
1711
|
+
for (let j = 0; j < n; j++) {
|
|
1712
|
+
const v = sources[j];
|
|
1713
|
+
if (v === -1) continue;
|
|
1714
|
+
let lo = 0,
|
|
1715
|
+
hi = tails.length;
|
|
1716
|
+
while (lo < hi) {
|
|
1717
|
+
const mid = lo + hi >> 1;
|
|
1718
|
+
if (tails[mid] < v) lo = mid + 1;else hi = mid;
|
|
1719
|
+
}
|
|
1720
|
+
if (lo > 0) prev[j] = tailsIdx[lo - 1];
|
|
1721
|
+
tails[lo] = v;
|
|
1722
|
+
tailsIdx[lo] = j;
|
|
1723
|
+
}
|
|
1724
|
+
const stable = new Set();
|
|
1725
|
+
let k = tailsIdx.length ? tailsIdx[tails.length - 1] : -1;
|
|
1726
|
+
while (k >= 0) {
|
|
1727
|
+
stable.add(k);
|
|
1728
|
+
k = prev[k];
|
|
1729
|
+
}
|
|
1730
|
+
return stable;
|
|
1731
|
+
};
|
|
1732
|
+
const driveList = (parent, listFn, marker, lateClassic) => {
|
|
1733
|
+
const meta = listFn.$ll;
|
|
1734
|
+
if (meta.row?.[PURE_ROW] !== true) return false;
|
|
1735
|
+
if (typeof meta.keyed === "function") return false;
|
|
1736
|
+
const evalOwner = createOwner({
|
|
1737
|
+
id: "&each"
|
|
1738
|
+
});
|
|
1739
|
+
let subject = runWithOwner(evalOwner, () => untrack(meta.each));
|
|
1740
|
+
evalOwner.dispose();
|
|
1741
|
+
let raw = subject != null ? patchableRaw(subject) : undefined;
|
|
1742
|
+
if (raw === undefined || !Array.isArray(raw)) return false;
|
|
1743
|
+
const optimistic = storeHasOptimisticFamily(subject);
|
|
1744
|
+
if (optimistic) raw = untrack(() => Array.from(subject));
|
|
1745
|
+
const hydrating = !!sharedConfig.hydrating;
|
|
1746
|
+
if (hydrating && raw.length === 0) return false;
|
|
1747
|
+
let domRows;
|
|
1748
|
+
let rowIds;
|
|
1749
|
+
if (hydrating) {
|
|
1750
|
+
if (marker !== undefined) return false;
|
|
1751
|
+
domRows = Array.from(parent.children);
|
|
1752
|
+
if (domRows.length !== raw.length) return false;
|
|
1753
|
+
rowIds = new Array(raw.length);
|
|
1754
|
+
for (let i = 0; i < domRows.length; i++) {
|
|
1755
|
+
const key = domRows[i].getAttribute("_hk");
|
|
1756
|
+
if (key === null || !key.endsWith("0") || key.length < 2) return false;
|
|
1757
|
+
rowIds[i] = key.slice(0, -1);
|
|
1758
|
+
}
|
|
1759
|
+
}
|
|
1760
|
+
const rowFn = meta.row;
|
|
1761
|
+
const endAnchor = marker ?? null;
|
|
1762
|
+
const shallow = storeIsShallow(subject);
|
|
1763
|
+
let lastBodies = null;
|
|
1764
|
+
let lastUnbinds = null;
|
|
1765
|
+
const collectBind = (abs, build) => {
|
|
1766
|
+
const prevC = rowCollector;
|
|
1767
|
+
rowCollector = {
|
|
1768
|
+
row: shallow ? subject[abs] : undefined,
|
|
1769
|
+
bodies: [],
|
|
1770
|
+
unbinds: []
|
|
1771
|
+
};
|
|
1772
|
+
try {
|
|
1773
|
+
return build();
|
|
1774
|
+
} finally {
|
|
1775
|
+
lastBodies = rowCollector.bodies;
|
|
1776
|
+
lastUnbinds = rowCollector.unbinds;
|
|
1777
|
+
rowCollector = prevC;
|
|
1778
|
+
}
|
|
1779
|
+
};
|
|
1780
|
+
const listOwner = createOwner();
|
|
1781
|
+
let declined = false;
|
|
1782
|
+
const bindRow = (abs, claimId) => {
|
|
1783
|
+
{
|
|
1784
|
+
const o = listOwner;
|
|
1785
|
+
const prevChild = o._firstChild;
|
|
1786
|
+
const prevDisposal = o._disposal;
|
|
1787
|
+
const node = collectBind(abs, () => runWithOwner(listOwner, () => claimId !== undefined ? runWithOwner(createOwner({
|
|
1788
|
+
id: claimId
|
|
1789
|
+
}), () => untrack(() => rowFn(subject[abs]))) : untrack(() => rowFn(subject[abs]))));
|
|
1790
|
+
if (o._firstChild !== prevChild || o._disposal !== prevDisposal) {
|
|
1791
|
+
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).");
|
|
1792
|
+
}
|
|
1793
|
+
return node;
|
|
1794
|
+
}
|
|
1795
|
+
};
|
|
1796
|
+
let entries = new Array(raw.length);
|
|
1797
|
+
let rowBodies = shallow ? new Array(raw.length) : null;
|
|
1798
|
+
let rowUnbinds = new Array(raw.length);
|
|
1799
|
+
const runUnbinds = list => {
|
|
1800
|
+
if (list !== undefined) for (let u = 0; u < list.length; u++) list[u]();
|
|
1801
|
+
};
|
|
1802
|
+
const unbindAllRows = () => {
|
|
1803
|
+
for (let j = 0; j < rowUnbinds.length; j++) runUnbinds(rowUnbinds[j]);
|
|
1804
|
+
rowUnbinds = [];
|
|
1805
|
+
};
|
|
1806
|
+
let prevRaws = raw.slice();
|
|
1807
|
+
try {
|
|
1808
|
+
if (hydrating) {
|
|
1809
|
+
for (let i = 0; i < raw.length; i++) {
|
|
1810
|
+
entries[i] = bindRow(i, rowIds[i]);
|
|
1811
|
+
if (rowBodies !== null) rowBodies[i] = lastBodies;
|
|
1812
|
+
rowUnbinds[i] = lastUnbinds;
|
|
1813
|
+
}
|
|
1814
|
+
} else {
|
|
1815
|
+
for (let i = 0; i < raw.length; i++) {
|
|
1816
|
+
const node = bindRow(i);
|
|
1817
|
+
entries[i] = node;
|
|
1818
|
+
if (rowBodies !== null) rowBodies[i] = lastBodies;
|
|
1819
|
+
rowUnbinds[i] = lastUnbinds;
|
|
1820
|
+
parent.insertBefore(node, endAnchor);
|
|
1821
|
+
}
|
|
1822
|
+
}
|
|
1823
|
+
} catch (err) {
|
|
1824
|
+
unbindAllRows();
|
|
1825
|
+
runUnbinds(lastUnbinds ?? undefined);
|
|
1826
|
+
for (let j = 0; j < entries.length; j++) {
|
|
1827
|
+
const n = entries[j];
|
|
1828
|
+
if (n !== undefined && n.parentNode === parent) n.remove();
|
|
1829
|
+
}
|
|
1830
|
+
listOwner.dispose();
|
|
1831
|
+
throw err;
|
|
1832
|
+
}
|
|
1833
|
+
const identityOps = nextArr => {
|
|
1834
|
+
const keyOf = r => {
|
|
1835
|
+
const w = r != null ? patchableRaw(r) : undefined;
|
|
1836
|
+
return w !== undefined ? w : r;
|
|
1837
|
+
};
|
|
1838
|
+
const oldIndex = new Map();
|
|
1839
|
+
for (let j = 0; j < prevRaws.length; j++) {
|
|
1840
|
+
const k = keyOf(prevRaws[j]);
|
|
1841
|
+
const existing = oldIndex.get(k);
|
|
1842
|
+
if (existing === undefined) oldIndex.set(k, j);else if (Array.isArray(existing)) existing.push(j);else oldIndex.set(k, [existing, j]);
|
|
1843
|
+
}
|
|
1844
|
+
const sources = new Array(nextArr.length);
|
|
1845
|
+
for (let k = 0; k < nextArr.length; k++) {
|
|
1846
|
+
const m = oldIndex.get(keyOf(nextArr[k]));
|
|
1847
|
+
if (m === undefined) sources[k] = -1;else if (Array.isArray(m)) {
|
|
1848
|
+
sources[k] = m.shift();
|
|
1849
|
+
if (m.length === 1) oldIndex.set(keyOf(nextArr[k]), m[0]);
|
|
1850
|
+
} else {
|
|
1851
|
+
sources[k] = m;
|
|
1852
|
+
oldIndex.delete(keyOf(nextArr[k]));
|
|
1853
|
+
}
|
|
1854
|
+
}
|
|
1855
|
+
return {
|
|
1856
|
+
prefix: 0,
|
|
1857
|
+
sources
|
|
1858
|
+
};
|
|
1859
|
+
};
|
|
1860
|
+
let resyncNeeded = false;
|
|
1861
|
+
const applyOps = (next, ops) => {
|
|
1862
|
+
if (declined) return;
|
|
1863
|
+
if (resyncNeeded) ops = null;
|
|
1864
|
+
if (ops === null) ops = identityOps(next);
|
|
1865
|
+
const {
|
|
1866
|
+
prefix,
|
|
1867
|
+
sources
|
|
1868
|
+
} = ops;
|
|
1869
|
+
const built = new Array(sources.length);
|
|
1870
|
+
const builtBodies = rowBodies !== null ? new Array(sources.length) : null;
|
|
1871
|
+
const builtUnbinds = new Array(sources.length);
|
|
1872
|
+
let j = 0;
|
|
1873
|
+
try {
|
|
1874
|
+
for (; j < sources.length; j++) {
|
|
1875
|
+
const abs = prefix + j;
|
|
1876
|
+
const src = sources[j];
|
|
1877
|
+
if (src === -1 || refRebuild && src >= 0 && next[abs] !== prevRaws[src]) {
|
|
1878
|
+
built[j] = bindRow(abs);
|
|
1879
|
+
if (builtBodies !== null) builtBodies[j] = lastBodies;
|
|
1880
|
+
builtUnbinds[j] = lastUnbinds;
|
|
1881
|
+
}
|
|
1882
|
+
}
|
|
1883
|
+
} catch (err) {
|
|
1884
|
+
for (let k = 0; k < j; k++) runUnbinds(builtUnbinds[k]);
|
|
1885
|
+
runUnbinds(lastUnbinds ?? undefined);
|
|
1886
|
+
resyncNeeded = true;
|
|
1887
|
+
throw err;
|
|
1888
|
+
}
|
|
1889
|
+
const retained = new Set();
|
|
1890
|
+
for (let k = 0; k < sources.length; k++) {
|
|
1891
|
+
if (sources[k] >= 0 && built[k] === undefined) retained.add(sources[k]);
|
|
1892
|
+
}
|
|
1893
|
+
for (let k = prefix; k < entries.length; k++) {
|
|
1894
|
+
if (!retained.has(k)) {
|
|
1895
|
+
entries[k].remove();
|
|
1896
|
+
runUnbinds(rowUnbinds[k]);
|
|
1897
|
+
}
|
|
1898
|
+
}
|
|
1899
|
+
const newEntries = new Array(prefix + sources.length);
|
|
1900
|
+
const newBodies = rowBodies !== null ? new Array(prefix + sources.length) : null;
|
|
1901
|
+
const newUnbinds = new Array(prefix + sources.length);
|
|
1902
|
+
for (let i = 0; i < prefix; i++) {
|
|
1903
|
+
newEntries[i] = entries[i];
|
|
1904
|
+
if (newBodies !== null) newBodies[i] = rowBodies[i];
|
|
1905
|
+
newUnbinds[i] = rowUnbinds[i];
|
|
1906
|
+
}
|
|
1907
|
+
const stable = lisPositions(sources);
|
|
1908
|
+
let anchor = endAnchor;
|
|
1909
|
+
for (let k = sources.length - 1; k >= 0; k--) {
|
|
1910
|
+
const abs = prefix + k;
|
|
1911
|
+
const src = sources[k];
|
|
1912
|
+
let node;
|
|
1913
|
+
if (built[k] !== undefined) {
|
|
1914
|
+
node = built[k];
|
|
1915
|
+
if (newBodies !== null) newBodies[abs] = builtBodies[k];
|
|
1916
|
+
newUnbinds[abs] = builtUnbinds[k];
|
|
1917
|
+
parent.insertBefore(node, anchor);
|
|
1918
|
+
} else {
|
|
1919
|
+
node = entries[src];
|
|
1920
|
+
if (newBodies !== null) newBodies[abs] = rowBodies[src];
|
|
1921
|
+
newUnbinds[abs] = rowUnbinds[src];
|
|
1922
|
+
if (!stable.has(k)) parent.insertBefore(node, anchor);
|
|
1923
|
+
}
|
|
1924
|
+
newEntries[abs] = node;
|
|
1925
|
+
anchor = node;
|
|
1926
|
+
}
|
|
1927
|
+
entries = newEntries;
|
|
1928
|
+
if (newBodies !== null) rowBodies = newBodies;
|
|
1929
|
+
rowUnbinds = newUnbinds;
|
|
1930
|
+
prevRaws = next.slice();
|
|
1931
|
+
resyncNeeded = false;
|
|
1932
|
+
};
|
|
1933
|
+
let unbindOps = runWithOwner(listOwner, () => registerRowOps(subject, applyOps));
|
|
1934
|
+
const refRebuild = shallow && typeof meta.keyed !== "function";
|
|
1935
|
+
const rebuildSlot = i => {
|
|
1936
|
+
runUnbinds(rowUnbinds[i]);
|
|
1937
|
+
const old = entries[i];
|
|
1938
|
+
const node = bindRow(i);
|
|
1939
|
+
rowBodies[i] = lastBodies;
|
|
1940
|
+
rowUnbinds[i] = lastUnbinds;
|
|
1941
|
+
parent.insertBefore(node, old);
|
|
1942
|
+
old.remove();
|
|
1943
|
+
entries[i] = node;
|
|
1944
|
+
};
|
|
1945
|
+
const applySlot = (i, next, prev) => {
|
|
1946
|
+
if (declined) return;
|
|
1947
|
+
if (resyncNeeded) {
|
|
1948
|
+
const live = subject != null ? patchableRaw(subject) : undefined;
|
|
1949
|
+
if (live !== undefined && Array.isArray(live)) applyOps(live, null);
|
|
1950
|
+
return;
|
|
1951
|
+
}
|
|
1952
|
+
if (refRebuild) {
|
|
1953
|
+
rebuildSlot(i);
|
|
1954
|
+
prevRaws[i] = next;
|
|
1955
|
+
return;
|
|
1956
|
+
}
|
|
1957
|
+
const bodies = rowBodies[i];
|
|
1958
|
+
if (bodies !== undefined) {
|
|
1959
|
+
for (let b = 0; b < bodies.length; b++) bodies[b](next, prev, false);
|
|
1960
|
+
}
|
|
1961
|
+
prevRaws[i] = next;
|
|
1962
|
+
};
|
|
1963
|
+
let unbindSlots = shallow ? runWithOwner(listOwner, () => registerSlotPatch(subject, applySlot)) : null;
|
|
1964
|
+
runWithOwner(listOwner, () => effect(() => meta.each(), value => {
|
|
1965
|
+
if (declined || value === subject) return;
|
|
1966
|
+
const nextRaw = value != null ? patchableRaw(value) : undefined;
|
|
1967
|
+
unbindOps();
|
|
1968
|
+
unbindSlots?.();
|
|
1969
|
+
if (nextRaw !== undefined && Array.isArray(nextRaw) && storeIsShallow(value) !== shallow) {
|
|
1970
|
+
for (let j = 0; j < entries.length; j++) entries[j].remove();
|
|
1971
|
+
entries = [];
|
|
1972
|
+
prevRaws = [];
|
|
1973
|
+
unbindAllRows();
|
|
1974
|
+
subject = value;
|
|
1975
|
+
declined = true;
|
|
1976
|
+
listOwner.dispose();
|
|
1977
|
+
lateClassic?.();
|
|
1978
|
+
return;
|
|
1979
|
+
}
|
|
1980
|
+
if (nextRaw === undefined || !Array.isArray(nextRaw)) {
|
|
1981
|
+
for (let j = 0; j < entries.length; j++) entries[j].remove();
|
|
1982
|
+
entries = [];
|
|
1983
|
+
prevRaws = [];
|
|
1984
|
+
unbindAllRows();
|
|
1985
|
+
subject = value;
|
|
1986
|
+
declined = true;
|
|
1987
|
+
listOwner.dispose();
|
|
1988
|
+
lateClassic?.();
|
|
1989
|
+
return;
|
|
1990
|
+
}
|
|
1991
|
+
const swapOps = identityOps(nextRaw);
|
|
1992
|
+
subject = value;
|
|
1993
|
+
unbindOps = runWithOwner(listOwner, () => registerRowOps(subject, applyOps));
|
|
1994
|
+
if (shallow) unbindSlots = runWithOwner(listOwner, () => registerSlotPatch(subject, applySlot));
|
|
1995
|
+
applyOps(nextRaw, swapOps);
|
|
1996
|
+
}));
|
|
1997
|
+
onCleanup(() => {
|
|
1998
|
+
unbindOps();
|
|
1999
|
+
unbindSlots?.();
|
|
2000
|
+
unbindAllRows();
|
|
2001
|
+
listOwner.dispose();
|
|
2002
|
+
});
|
|
2003
|
+
return true;
|
|
2004
|
+
};
|
|
2005
|
+
const patchDriver = (subject, body) => {
|
|
2006
|
+
const raw = patchableRaw(subject);
|
|
2007
|
+
if (raw !== undefined) {
|
|
2008
|
+
if (!sharedConfig.hydrating) body(raw, undefined, true);
|
|
2009
|
+
const unbind = registerPatch(subject, body);
|
|
2010
|
+
if (rowCollector !== null) rowCollector.unbinds.push(unbind);
|
|
2011
|
+
else onCleanup(unbind);
|
|
2012
|
+
} else if (rowCollector !== null && subject === rowCollector.row) {
|
|
2013
|
+
rowCollector.bodies.push(body);
|
|
2014
|
+
if (!sharedConfig.hydrating) body(subject, undefined, true);
|
|
2015
|
+
} else {
|
|
2016
|
+
effect(() => body(subject, subject, false),
|
|
2017
|
+
() => untrack(() => body(subject, undefined, true)));
|
|
2018
|
+
}
|
|
2019
|
+
};
|
|
2020
|
+
|
|
1648
2021
|
function throwInBrowser(func) {
|
|
1649
2022
|
const err = new Error(`${func.name} is not supported in the browser, returning undefined`);
|
|
1650
2023
|
console.error(err);
|
|
@@ -1718,11 +2091,14 @@ function isSafeError(value) {
|
|
|
1718
2091
|
return !!(value && (typeof value === "object" || typeof value === "function") && value[SAFE_ERROR]);
|
|
1719
2092
|
}
|
|
1720
2093
|
const REVALIDATE_HEADER = "X-Revalidate";
|
|
1721
|
-
function initWithRevalidate(init) {
|
|
2094
|
+
function initWithRevalidate(init = {}) {
|
|
2095
|
+
const resolved = typeof init === "number" ? {
|
|
2096
|
+
status: init
|
|
2097
|
+
} : init;
|
|
1722
2098
|
const {
|
|
1723
2099
|
revalidate,
|
|
1724
2100
|
...responseInit
|
|
1725
|
-
} =
|
|
2101
|
+
} = resolved;
|
|
1726
2102
|
let headers;
|
|
1727
2103
|
if (responseInit.headers && responseInit.headers.getSetCookie) {
|
|
1728
2104
|
headers = new Headers();
|
|
@@ -1748,13 +2124,12 @@ function redirect(url, init = 302) {
|
|
|
1748
2124
|
const {
|
|
1749
2125
|
responseInit,
|
|
1750
2126
|
headers
|
|
1751
|
-
} = initWithRevalidate(
|
|
1752
|
-
status: init
|
|
1753
|
-
} : init);
|
|
2127
|
+
} = initWithRevalidate(init);
|
|
1754
2128
|
if (responseInit.status === undefined) {
|
|
1755
2129
|
responseInit.status = 302;
|
|
1756
2130
|
}
|
|
1757
|
-
|
|
2131
|
+
const target = typeof url === "string" ? url : url[HREF];
|
|
2132
|
+
headers.set("Location", typeof target === "string" ? target : String(url));
|
|
1758
2133
|
return new Response(null, {
|
|
1759
2134
|
...responseInit,
|
|
1760
2135
|
headers
|
|
@@ -1782,28 +2157,8 @@ function respond(value, init = {}) {
|
|
|
1782
2157
|
}), value);
|
|
1783
2158
|
}
|
|
1784
2159
|
|
|
1785
|
-
const mergeProps = merge;
|
|
1786
2160
|
const isServer = false;
|
|
1787
2161
|
const isDev = true;
|
|
1788
|
-
function render(code, element, init, options = {}) {
|
|
1789
|
-
enforceLoadingBoundary(true);
|
|
1790
|
-
try {
|
|
1791
|
-
const dispose = render$1(code, element, init, {
|
|
1792
|
-
...options,
|
|
1793
|
-
insertOptions: {
|
|
1794
|
-
schedule: true
|
|
1795
|
-
}
|
|
1796
|
-
});
|
|
1797
|
-
flush();
|
|
1798
|
-
return dispose;
|
|
1799
|
-
} finally {
|
|
1800
|
-
enforceLoadingBoundary(false);
|
|
1801
|
-
}
|
|
1802
|
-
}
|
|
1803
|
-
const hydrate = (...args) => {
|
|
1804
|
-
enableHydration();
|
|
1805
|
-
return hydrate$1(...args);
|
|
1806
|
-
};
|
|
1807
2162
|
function Portal(props) {
|
|
1808
2163
|
return runWithOwner(createOwner(), () => portalImpl(props));
|
|
1809
2164
|
}
|
|
@@ -1856,7 +2211,7 @@ function portalImpl(props) {
|
|
|
1856
2211
|
});
|
|
1857
2212
|
return treeMarker;
|
|
1858
2213
|
}
|
|
1859
|
-
const COMPONENT_BINDING = Symbol.for("
|
|
2214
|
+
const COMPONENT_BINDING = Symbol.for("solid.component-binding");
|
|
1860
2215
|
function bindingOf(value) {
|
|
1861
2216
|
return value !== null && (typeof value === "function" || typeof value === "object") && value[COMPONENT_BINDING] || undefined;
|
|
1862
2217
|
}
|
|
@@ -1948,4 +2303,4 @@ _moduleUrl) {
|
|
|
1948
2303
|
function httpStatus(_code, _text) {}
|
|
1949
2304
|
function httpHeader(_name, _value, _options) {}
|
|
1950
2305
|
|
|
1951
|
-
export { ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF,
|
|
2306
|
+
export { ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, HydrationScript, MathMLElements, Namespaces, Portal, REVALIDATE_HEADER, RawTextElements, RequestContext, ResponseEnvelope, SAFE_ERROR, SVGElements, VoidElements, acquireAsset, addEvent, applyRef, assign, claimElement, claimElementTree, className, clearFlashCookie, clientOnly, commitEventResponse, composeMiddleware, createRequestEvent, createResponseStub, createSSRResponse, delegateEvents, driveList, dynamic, dynamicProperty, effect, escape, generateHydrationScript, getDelegatedRoot, getExpectedRedirectStatus, getFirstChild, getHydrationKey, getNextElement, getNextMarker, getNextMatch, getNextSibling, getRequestEvent, getServerFunctionMetadata, getServerFunctionRPC, hasFlashCookie, httpHeader, httpStatus, hydrate, insert, installHydrationRuntime, installListDriver, isDev, isHref, isResponseEnvelope, isSafeError, isServer, isServerFunction, listDriver, markSafeError, memo, parseCookieHeader, patchDriver, redirect, ref, registerDelegatedContainer, registerDelegatedRoot, registerElementClaim, reload, render, renderToStream, renderToString, resolveSSRNode, respond, rowProof, runHydrationEvents, scope, serializeCookie, setAttribute, setAttributeNS, setProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrGroup, ssrHydrationKey, ssrStyle, ssrStyleProperty, style, template, unregisterDelegatedContainer, unregisterDelegatedRoot, useHead, waitAsset, warmAsset };
|