@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/web.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,
|
|
@@ -329,11 +322,34 @@ 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
|
+
solidJs.runWithOwner(null, () => {
|
|
330
|
+
gate = solidJs.createMemo(() => promise);
|
|
331
|
+
});
|
|
332
|
+
assetGates.set(promise, gate);
|
|
333
|
+
}
|
|
334
|
+
gate();
|
|
335
|
+
};
|
|
336
|
+
exports.listDriver = void 0;
|
|
337
|
+
function installListDriver(driver) {
|
|
338
|
+
exports.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
|
let disposer;
|
|
338
354
|
registerDelegatedRoot(element);
|
|
339
355
|
try {
|
|
@@ -344,15 +360,20 @@ function render$1(code, element, init, options = {}) {
|
|
|
344
360
|
effect(() => solidJs.flatten(tree), () => {});
|
|
345
361
|
} else {
|
|
346
362
|
const tree = code();
|
|
347
|
-
insert(element, () => tree, element.firstChild ? null : undefined, init,
|
|
363
|
+
insert(element, () => tree, element.firstChild ? null : undefined, init, {
|
|
364
|
+
...options.insertOptions,
|
|
365
|
+
schedule: true
|
|
366
|
+
});
|
|
348
367
|
}
|
|
349
368
|
}, {
|
|
350
369
|
id: options.renderId
|
|
351
370
|
});
|
|
371
|
+
solidJs.flush();
|
|
352
372
|
} catch (err) {
|
|
353
373
|
if (disposer) disposer();
|
|
354
374
|
unregisterDelegatedRoot(element);
|
|
355
375
|
throw err;
|
|
376
|
+
} finally {
|
|
356
377
|
}
|
|
357
378
|
return () => {
|
|
358
379
|
disposer();
|
|
@@ -437,7 +458,7 @@ function setProperty(node, name, value) {
|
|
|
437
458
|
node[name] = value;
|
|
438
459
|
}
|
|
439
460
|
let claimHandlers = null;
|
|
440
|
-
const CLAIM_SEAM = Symbol.for("
|
|
461
|
+
const CLAIM_SEAM = Symbol.for("solid.element-claims");
|
|
441
462
|
function registerElementClaim(handler) {
|
|
442
463
|
(claimHandlers || (claimHandlers = globalThis[CLAIM_SEAM] = [])).push(handler);
|
|
443
464
|
return () => {
|
|
@@ -591,11 +612,6 @@ function ref(fn, element) {
|
|
|
591
612
|
const resolved = solidJs.untrack(fn);
|
|
592
613
|
solidJs.runWithOwner(null, () => applyRef(resolved, element));
|
|
593
614
|
}
|
|
594
|
-
const PURE_ROW = Symbol.for("solid.pure-row");
|
|
595
|
-
function rowProof(fn) {
|
|
596
|
-
fn[PURE_ROW] = true;
|
|
597
|
-
return fn;
|
|
598
|
-
}
|
|
599
615
|
function scope(fn) {
|
|
600
616
|
fn.$s = true;
|
|
601
617
|
return fn;
|
|
@@ -659,16 +675,16 @@ function stripTextSeparators(nodes) {
|
|
|
659
675
|
nodes.length = j;
|
|
660
676
|
return nodes;
|
|
661
677
|
}
|
|
662
|
-
function patchDriver(subject, body) {
|
|
663
|
-
{
|
|
664
|
-
effect(() => body(subject, subject, false), () => body(subject, undefined, true));
|
|
665
|
-
}
|
|
666
|
-
}
|
|
667
678
|
function insert(parent, accessor, marker, initial, options) {
|
|
668
679
|
const multi = marker !== undefined;
|
|
669
680
|
const host = options && options.host;
|
|
670
681
|
if (multi && !initial) initial = [];
|
|
671
682
|
if (hydrationRt !== null) initial = hydrationRt.claimInitial(parent, multi, initial);
|
|
683
|
+
if (exports.listDriver !== undefined && typeof accessor === "function" && accessor.$ll !== undefined) {
|
|
684
|
+
const listAccessor = accessor;
|
|
685
|
+
const owner = solidJs.getOwner();
|
|
686
|
+
if (exports.listDriver(parent, accessor, marker, () => solidJs.runWithOwner(owner, () => insert(parent, () => listAccessor(), marker, marker !== undefined ? [] : undefined, options)))) return;
|
|
687
|
+
}
|
|
672
688
|
if (typeof accessor !== "function") {
|
|
673
689
|
accessor = normalize(accessor, initial, multi, true);
|
|
674
690
|
if (typeof accessor !== "function") {
|
|
@@ -1140,9 +1156,19 @@ function loadModuleAssets(mapping) {
|
|
|
1140
1156
|
}
|
|
1141
1157
|
return pending.length ? Promise.all(pending).then(() => {}) : undefined;
|
|
1142
1158
|
}
|
|
1143
|
-
function hydrate
|
|
1159
|
+
function hydrate(code, element, options = {}) {
|
|
1160
|
+
solidJs.enableHydration();
|
|
1144
1161
|
installHydrationRuntime();
|
|
1145
|
-
if (globalThis._$HY.done) return render
|
|
1162
|
+
if (globalThis._$HY.done) return render(code, element, [...element.childNodes], options);
|
|
1163
|
+
const head = (element.nodeType === 9 ? element : element.ownerDocument).head;
|
|
1164
|
+
if (head && element.contains(head)) {
|
|
1165
|
+
let n = head.firstChild;
|
|
1166
|
+
while (n && n.nodeType === 1 && n.hasAttribute("data-dh") && !n.hasAttribute("data-dhf")) {
|
|
1167
|
+
const next = n.nextSibling;
|
|
1168
|
+
head.appendChild(n);
|
|
1169
|
+
n = next;
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1146
1172
|
options.renderId ||= "";
|
|
1147
1173
|
if (!globalThis._$HY.modules) globalThis._$HY.modules = {};
|
|
1148
1174
|
if (!globalThis._$HY.loading) globalThis._$HY.loading = {};
|
|
@@ -1191,7 +1217,7 @@ function hydrate$1(code, element, options = {}) {
|
|
|
1191
1217
|
solidJs.sharedConfig.gather = gather;
|
|
1192
1218
|
solidJs.sharedConfig.hydrating = true;
|
|
1193
1219
|
try {
|
|
1194
|
-
disposer = render
|
|
1220
|
+
disposer = render(code, element, [...element.childNodes], options);
|
|
1195
1221
|
} finally {
|
|
1196
1222
|
solidJs.sharedConfig.hydrating = false;
|
|
1197
1223
|
}
|
|
@@ -1199,14 +1225,14 @@ function hydrate$1(code, element, options = {}) {
|
|
|
1199
1225
|
console.error("Hydration module preload failed, falling back to client render:", err);
|
|
1200
1226
|
solidJs.sharedConfig.hydrating = false;
|
|
1201
1227
|
solidJs.sharedConfig.registry = undefined;
|
|
1202
|
-
disposer = render
|
|
1228
|
+
disposer = render(code, element, [...element.childNodes], options);
|
|
1203
1229
|
});
|
|
1204
1230
|
return () => disposer && disposer();
|
|
1205
1231
|
}
|
|
1206
1232
|
}
|
|
1207
1233
|
try {
|
|
1208
1234
|
gatherHydratable(element, options.renderId);
|
|
1209
|
-
return render
|
|
1235
|
+
return render(code, element, [...element.childNodes], options);
|
|
1210
1236
|
} finally {
|
|
1211
1237
|
solidJs.sharedConfig.hydrating = false;
|
|
1212
1238
|
}
|
|
@@ -1393,7 +1419,7 @@ function eventHandler(e, container, state) {
|
|
|
1393
1419
|
const handleNode = () => {
|
|
1394
1420
|
let handler = node[key];
|
|
1395
1421
|
if (handler === undefined && node.hasAttribute && node.hasAttribute("_bnd")) {
|
|
1396
|
-
const seam = globalThis[Symbol.for("
|
|
1422
|
+
const seam = globalThis[Symbol.for("solid.bnd")];
|
|
1397
1423
|
if (seam) handler = seam.resolve(node, e.type);
|
|
1398
1424
|
}
|
|
1399
1425
|
if (handler && !node.disabled) {
|
|
@@ -1442,7 +1468,16 @@ function eventHandler(e, container, state) {
|
|
|
1442
1468
|
}
|
|
1443
1469
|
function insertExpression(parent, value, current, marker) {
|
|
1444
1470
|
if (hydrationRt !== null && isHydrating(parent)) {
|
|
1445
|
-
if (value && value !== current)
|
|
1471
|
+
if (value && value !== current) {
|
|
1472
|
+
const arr = Array.isArray(value);
|
|
1473
|
+
for (const n of arr ? value : [value]) {
|
|
1474
|
+
if (n && n.nodeType) {
|
|
1475
|
+
if (!isHydrating(n)) return current;
|
|
1476
|
+
} else if (arr && (typeof n === "string" || typeof n === "number")) {
|
|
1477
|
+
return current;
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1480
|
+
}
|
|
1446
1481
|
return value;
|
|
1447
1482
|
}
|
|
1448
1483
|
if (value === current) return value;
|
|
@@ -1473,6 +1508,17 @@ function insertExpression(parent, value, current, marker) {
|
|
|
1473
1508
|
if (marker) value[$$SLOT] = marker;
|
|
1474
1509
|
} else if (Array.isArray(value)) {
|
|
1475
1510
|
const currentArray = current && Array.isArray(current);
|
|
1511
|
+
for (let i = 0, len = value.length; i < len; i++) {
|
|
1512
|
+
const item = value[i],
|
|
1513
|
+
t = typeof item;
|
|
1514
|
+
if (t === "string" || t === "number") {
|
|
1515
|
+
const prev = currentArray ? current[i] : undefined;
|
|
1516
|
+
if (prev && prev.nodeType === 3) {
|
|
1517
|
+
if (prev.data !== "" + item) prev.data = item;
|
|
1518
|
+
value[i] = prev;
|
|
1519
|
+
} else value[i] = document.createTextNode(item);
|
|
1520
|
+
}
|
|
1521
|
+
}
|
|
1476
1522
|
if (value.length === 0) {
|
|
1477
1523
|
cleanChildren(parent, current, marker);
|
|
1478
1524
|
} else if (currentArray) {
|
|
@@ -1493,12 +1539,12 @@ function normalize(value, current, multi, doNotUnwrap) {
|
|
|
1493
1539
|
});
|
|
1494
1540
|
if (doNotUnwrap && typeof value === "function") return value;
|
|
1495
1541
|
if (multi && !Array.isArray(value)) value = [value != null ? value : ""];
|
|
1496
|
-
if (Array.isArray(value)) {
|
|
1542
|
+
if (solidJs.sharedConfig.hydrating && Array.isArray(value)) {
|
|
1497
1543
|
for (let i = 0, len = value.length; i < len; i++) {
|
|
1498
1544
|
const item = value[i],
|
|
1499
1545
|
prev = current && current[i],
|
|
1500
1546
|
t = typeof item;
|
|
1501
|
-
if (t === "string" || t === "number")
|
|
1547
|
+
if ((t === "string" || t === "number") && prev && prev.nodeType === 3) value[i] = prev;
|
|
1502
1548
|
}
|
|
1503
1549
|
}
|
|
1504
1550
|
return value;
|
|
@@ -1579,9 +1625,324 @@ function gatherHydratable(element, root) {
|
|
|
1579
1625
|
function getHydrationKey() {
|
|
1580
1626
|
return solidJs.sharedConfig.getNextContextId();
|
|
1581
1627
|
}
|
|
1582
|
-
const voidFn = () => undefined;
|
|
1583
1628
|
const RequestContext = Symbol();
|
|
1584
1629
|
|
|
1630
|
+
const PURE_ROW = Symbol.for("solid.pure-row");
|
|
1631
|
+
const arm = () => {
|
|
1632
|
+
installListDriver(driveList);
|
|
1633
|
+
};
|
|
1634
|
+
function rowProof(fn) {
|
|
1635
|
+
arm();
|
|
1636
|
+
fn[PURE_ROW] = true;
|
|
1637
|
+
return fn;
|
|
1638
|
+
}
|
|
1639
|
+
let rowCollector = null;
|
|
1640
|
+
const lisPositions = sources => {
|
|
1641
|
+
const n = sources.length;
|
|
1642
|
+
const tails = [];
|
|
1643
|
+
const tailsIdx = [];
|
|
1644
|
+
const prev = new Array(n).fill(-1);
|
|
1645
|
+
for (let j = 0; j < n; j++) {
|
|
1646
|
+
const v = sources[j];
|
|
1647
|
+
if (v === -1) continue;
|
|
1648
|
+
let lo = 0,
|
|
1649
|
+
hi = tails.length;
|
|
1650
|
+
while (lo < hi) {
|
|
1651
|
+
const mid = lo + hi >> 1;
|
|
1652
|
+
if (tails[mid] < v) lo = mid + 1;else hi = mid;
|
|
1653
|
+
}
|
|
1654
|
+
if (lo > 0) prev[j] = tailsIdx[lo - 1];
|
|
1655
|
+
tails[lo] = v;
|
|
1656
|
+
tailsIdx[lo] = j;
|
|
1657
|
+
}
|
|
1658
|
+
const stable = new Set();
|
|
1659
|
+
let k = tailsIdx.length ? tailsIdx[tails.length - 1] : -1;
|
|
1660
|
+
while (k >= 0) {
|
|
1661
|
+
stable.add(k);
|
|
1662
|
+
k = prev[k];
|
|
1663
|
+
}
|
|
1664
|
+
return stable;
|
|
1665
|
+
};
|
|
1666
|
+
const driveList = (parent, listFn, marker, lateClassic) => {
|
|
1667
|
+
const meta = listFn.$ll;
|
|
1668
|
+
if (meta.row?.[PURE_ROW] !== true) return false;
|
|
1669
|
+
if (typeof meta.keyed === "function") return false;
|
|
1670
|
+
const evalOwner = solidJs.createOwner({
|
|
1671
|
+
id: "&each"
|
|
1672
|
+
});
|
|
1673
|
+
let subject = solidJs.runWithOwner(evalOwner, () => solidJs.untrack(meta.each));
|
|
1674
|
+
evalOwner.dispose();
|
|
1675
|
+
let raw = subject != null ? solidJs.patchableRaw(subject) : undefined;
|
|
1676
|
+
if (raw === undefined || !Array.isArray(raw)) return false;
|
|
1677
|
+
const optimistic = solidJs.storeHasOptimisticFamily(subject);
|
|
1678
|
+
if (optimistic) raw = solidJs.untrack(() => Array.from(subject));
|
|
1679
|
+
const hydrating = !!solidJs.sharedConfig.hydrating;
|
|
1680
|
+
if (hydrating && raw.length === 0) return false;
|
|
1681
|
+
let domRows;
|
|
1682
|
+
let rowIds;
|
|
1683
|
+
if (hydrating) {
|
|
1684
|
+
if (marker !== undefined) return false;
|
|
1685
|
+
domRows = Array.from(parent.children);
|
|
1686
|
+
if (domRows.length !== raw.length) return false;
|
|
1687
|
+
rowIds = new Array(raw.length);
|
|
1688
|
+
for (let i = 0; i < domRows.length; i++) {
|
|
1689
|
+
const key = domRows[i].getAttribute("_hk");
|
|
1690
|
+
if (key === null || !key.endsWith("0") || key.length < 2) return false;
|
|
1691
|
+
rowIds[i] = key.slice(0, -1);
|
|
1692
|
+
}
|
|
1693
|
+
}
|
|
1694
|
+
const rowFn = meta.row;
|
|
1695
|
+
const endAnchor = marker ?? null;
|
|
1696
|
+
const shallow = solidJs.storeIsShallow(subject);
|
|
1697
|
+
let lastBodies = null;
|
|
1698
|
+
let lastUnbinds = null;
|
|
1699
|
+
const collectBind = (abs, build) => {
|
|
1700
|
+
const prevC = rowCollector;
|
|
1701
|
+
rowCollector = {
|
|
1702
|
+
row: shallow ? subject[abs] : undefined,
|
|
1703
|
+
bodies: [],
|
|
1704
|
+
unbinds: []
|
|
1705
|
+
};
|
|
1706
|
+
try {
|
|
1707
|
+
return build();
|
|
1708
|
+
} finally {
|
|
1709
|
+
lastBodies = rowCollector.bodies;
|
|
1710
|
+
lastUnbinds = rowCollector.unbinds;
|
|
1711
|
+
rowCollector = prevC;
|
|
1712
|
+
}
|
|
1713
|
+
};
|
|
1714
|
+
const listOwner = solidJs.createOwner();
|
|
1715
|
+
let declined = false;
|
|
1716
|
+
const bindRow = (abs, claimId) => {
|
|
1717
|
+
return collectBind(abs, () => solidJs.runWithOwner(listOwner, () => claimId !== undefined ? solidJs.runWithOwner(solidJs.createOwner({
|
|
1718
|
+
id: claimId
|
|
1719
|
+
}), () => solidJs.untrack(() => rowFn(subject[abs]))) : solidJs.untrack(() => rowFn(subject[abs]))));
|
|
1720
|
+
};
|
|
1721
|
+
let entries = new Array(raw.length);
|
|
1722
|
+
let rowBodies = shallow ? new Array(raw.length) : null;
|
|
1723
|
+
let rowUnbinds = new Array(raw.length);
|
|
1724
|
+
const runUnbinds = list => {
|
|
1725
|
+
if (list !== undefined) for (let u = 0; u < list.length; u++) list[u]();
|
|
1726
|
+
};
|
|
1727
|
+
const unbindAllRows = () => {
|
|
1728
|
+
for (let j = 0; j < rowUnbinds.length; j++) runUnbinds(rowUnbinds[j]);
|
|
1729
|
+
rowUnbinds = [];
|
|
1730
|
+
};
|
|
1731
|
+
let prevRaws = raw.slice();
|
|
1732
|
+
try {
|
|
1733
|
+
if (hydrating) {
|
|
1734
|
+
for (let i = 0; i < raw.length; i++) {
|
|
1735
|
+
entries[i] = bindRow(i, rowIds[i]);
|
|
1736
|
+
if (rowBodies !== null) rowBodies[i] = lastBodies;
|
|
1737
|
+
rowUnbinds[i] = lastUnbinds;
|
|
1738
|
+
}
|
|
1739
|
+
} else {
|
|
1740
|
+
for (let i = 0; i < raw.length; i++) {
|
|
1741
|
+
const node = bindRow(i);
|
|
1742
|
+
entries[i] = node;
|
|
1743
|
+
if (rowBodies !== null) rowBodies[i] = lastBodies;
|
|
1744
|
+
rowUnbinds[i] = lastUnbinds;
|
|
1745
|
+
parent.insertBefore(node, endAnchor);
|
|
1746
|
+
}
|
|
1747
|
+
}
|
|
1748
|
+
} catch (err) {
|
|
1749
|
+
unbindAllRows();
|
|
1750
|
+
runUnbinds(lastUnbinds ?? undefined);
|
|
1751
|
+
for (let j = 0; j < entries.length; j++) {
|
|
1752
|
+
const n = entries[j];
|
|
1753
|
+
if (n !== undefined && n.parentNode === parent) n.remove();
|
|
1754
|
+
}
|
|
1755
|
+
listOwner.dispose();
|
|
1756
|
+
throw err;
|
|
1757
|
+
}
|
|
1758
|
+
const identityOps = nextArr => {
|
|
1759
|
+
const keyOf = r => {
|
|
1760
|
+
const w = r != null ? solidJs.patchableRaw(r) : undefined;
|
|
1761
|
+
return w !== undefined ? w : r;
|
|
1762
|
+
};
|
|
1763
|
+
const oldIndex = new Map();
|
|
1764
|
+
for (let j = 0; j < prevRaws.length; j++) {
|
|
1765
|
+
const k = keyOf(prevRaws[j]);
|
|
1766
|
+
const existing = oldIndex.get(k);
|
|
1767
|
+
if (existing === undefined) oldIndex.set(k, j);else if (Array.isArray(existing)) existing.push(j);else oldIndex.set(k, [existing, j]);
|
|
1768
|
+
}
|
|
1769
|
+
const sources = new Array(nextArr.length);
|
|
1770
|
+
for (let k = 0; k < nextArr.length; k++) {
|
|
1771
|
+
const m = oldIndex.get(keyOf(nextArr[k]));
|
|
1772
|
+
if (m === undefined) sources[k] = -1;else if (Array.isArray(m)) {
|
|
1773
|
+
sources[k] = m.shift();
|
|
1774
|
+
if (m.length === 1) oldIndex.set(keyOf(nextArr[k]), m[0]);
|
|
1775
|
+
} else {
|
|
1776
|
+
sources[k] = m;
|
|
1777
|
+
oldIndex.delete(keyOf(nextArr[k]));
|
|
1778
|
+
}
|
|
1779
|
+
}
|
|
1780
|
+
return {
|
|
1781
|
+
prefix: 0,
|
|
1782
|
+
sources
|
|
1783
|
+
};
|
|
1784
|
+
};
|
|
1785
|
+
let resyncNeeded = false;
|
|
1786
|
+
const applyOps = (next, ops) => {
|
|
1787
|
+
if (declined) return;
|
|
1788
|
+
if (resyncNeeded) ops = null;
|
|
1789
|
+
if (ops === null) ops = identityOps(next);
|
|
1790
|
+
const {
|
|
1791
|
+
prefix,
|
|
1792
|
+
sources
|
|
1793
|
+
} = ops;
|
|
1794
|
+
const built = new Array(sources.length);
|
|
1795
|
+
const builtBodies = rowBodies !== null ? new Array(sources.length) : null;
|
|
1796
|
+
const builtUnbinds = new Array(sources.length);
|
|
1797
|
+
let j = 0;
|
|
1798
|
+
try {
|
|
1799
|
+
for (; j < sources.length; j++) {
|
|
1800
|
+
const abs = prefix + j;
|
|
1801
|
+
const src = sources[j];
|
|
1802
|
+
if (src === -1 || refRebuild && src >= 0 && next[abs] !== prevRaws[src]) {
|
|
1803
|
+
built[j] = bindRow(abs);
|
|
1804
|
+
if (builtBodies !== null) builtBodies[j] = lastBodies;
|
|
1805
|
+
builtUnbinds[j] = lastUnbinds;
|
|
1806
|
+
}
|
|
1807
|
+
}
|
|
1808
|
+
} catch (err) {
|
|
1809
|
+
for (let k = 0; k < j; k++) runUnbinds(builtUnbinds[k]);
|
|
1810
|
+
runUnbinds(lastUnbinds ?? undefined);
|
|
1811
|
+
resyncNeeded = true;
|
|
1812
|
+
throw err;
|
|
1813
|
+
}
|
|
1814
|
+
const retained = new Set();
|
|
1815
|
+
for (let k = 0; k < sources.length; k++) {
|
|
1816
|
+
if (sources[k] >= 0 && built[k] === undefined) retained.add(sources[k]);
|
|
1817
|
+
}
|
|
1818
|
+
for (let k = prefix; k < entries.length; k++) {
|
|
1819
|
+
if (!retained.has(k)) {
|
|
1820
|
+
entries[k].remove();
|
|
1821
|
+
runUnbinds(rowUnbinds[k]);
|
|
1822
|
+
}
|
|
1823
|
+
}
|
|
1824
|
+
const newEntries = new Array(prefix + sources.length);
|
|
1825
|
+
const newBodies = rowBodies !== null ? new Array(prefix + sources.length) : null;
|
|
1826
|
+
const newUnbinds = new Array(prefix + sources.length);
|
|
1827
|
+
for (let i = 0; i < prefix; i++) {
|
|
1828
|
+
newEntries[i] = entries[i];
|
|
1829
|
+
if (newBodies !== null) newBodies[i] = rowBodies[i];
|
|
1830
|
+
newUnbinds[i] = rowUnbinds[i];
|
|
1831
|
+
}
|
|
1832
|
+
const stable = lisPositions(sources);
|
|
1833
|
+
let anchor = endAnchor;
|
|
1834
|
+
for (let k = sources.length - 1; k >= 0; k--) {
|
|
1835
|
+
const abs = prefix + k;
|
|
1836
|
+
const src = sources[k];
|
|
1837
|
+
let node;
|
|
1838
|
+
if (built[k] !== undefined) {
|
|
1839
|
+
node = built[k];
|
|
1840
|
+
if (newBodies !== null) newBodies[abs] = builtBodies[k];
|
|
1841
|
+
newUnbinds[abs] = builtUnbinds[k];
|
|
1842
|
+
parent.insertBefore(node, anchor);
|
|
1843
|
+
} else {
|
|
1844
|
+
node = entries[src];
|
|
1845
|
+
if (newBodies !== null) newBodies[abs] = rowBodies[src];
|
|
1846
|
+
newUnbinds[abs] = rowUnbinds[src];
|
|
1847
|
+
if (!stable.has(k)) parent.insertBefore(node, anchor);
|
|
1848
|
+
}
|
|
1849
|
+
newEntries[abs] = node;
|
|
1850
|
+
anchor = node;
|
|
1851
|
+
}
|
|
1852
|
+
entries = newEntries;
|
|
1853
|
+
if (newBodies !== null) rowBodies = newBodies;
|
|
1854
|
+
rowUnbinds = newUnbinds;
|
|
1855
|
+
prevRaws = next.slice();
|
|
1856
|
+
resyncNeeded = false;
|
|
1857
|
+
};
|
|
1858
|
+
let unbindOps = solidJs.runWithOwner(listOwner, () => solidJs.registerRowOps(subject, applyOps));
|
|
1859
|
+
const refRebuild = shallow && typeof meta.keyed !== "function";
|
|
1860
|
+
const rebuildSlot = i => {
|
|
1861
|
+
runUnbinds(rowUnbinds[i]);
|
|
1862
|
+
const old = entries[i];
|
|
1863
|
+
const node = bindRow(i);
|
|
1864
|
+
rowBodies[i] = lastBodies;
|
|
1865
|
+
rowUnbinds[i] = lastUnbinds;
|
|
1866
|
+
parent.insertBefore(node, old);
|
|
1867
|
+
old.remove();
|
|
1868
|
+
entries[i] = node;
|
|
1869
|
+
};
|
|
1870
|
+
const applySlot = (i, next, prev) => {
|
|
1871
|
+
if (declined) return;
|
|
1872
|
+
if (resyncNeeded) {
|
|
1873
|
+
const live = subject != null ? solidJs.patchableRaw(subject) : undefined;
|
|
1874
|
+
if (live !== undefined && Array.isArray(live)) applyOps(live, null);
|
|
1875
|
+
return;
|
|
1876
|
+
}
|
|
1877
|
+
if (refRebuild) {
|
|
1878
|
+
rebuildSlot(i);
|
|
1879
|
+
prevRaws[i] = next;
|
|
1880
|
+
return;
|
|
1881
|
+
}
|
|
1882
|
+
const bodies = rowBodies[i];
|
|
1883
|
+
if (bodies !== undefined) {
|
|
1884
|
+
for (let b = 0; b < bodies.length; b++) bodies[b](next, prev, false);
|
|
1885
|
+
}
|
|
1886
|
+
prevRaws[i] = next;
|
|
1887
|
+
};
|
|
1888
|
+
let unbindSlots = shallow ? solidJs.runWithOwner(listOwner, () => solidJs.registerSlotPatch(subject, applySlot)) : null;
|
|
1889
|
+
solidJs.runWithOwner(listOwner, () => effect(() => meta.each(), value => {
|
|
1890
|
+
if (declined || value === subject) return;
|
|
1891
|
+
const nextRaw = value != null ? solidJs.patchableRaw(value) : undefined;
|
|
1892
|
+
unbindOps();
|
|
1893
|
+
unbindSlots?.();
|
|
1894
|
+
if (nextRaw !== undefined && Array.isArray(nextRaw) && solidJs.storeIsShallow(value) !== shallow) {
|
|
1895
|
+
for (let j = 0; j < entries.length; j++) entries[j].remove();
|
|
1896
|
+
entries = [];
|
|
1897
|
+
prevRaws = [];
|
|
1898
|
+
unbindAllRows();
|
|
1899
|
+
subject = value;
|
|
1900
|
+
declined = true;
|
|
1901
|
+
listOwner.dispose();
|
|
1902
|
+
lateClassic?.();
|
|
1903
|
+
return;
|
|
1904
|
+
}
|
|
1905
|
+
if (nextRaw === undefined || !Array.isArray(nextRaw)) {
|
|
1906
|
+
for (let j = 0; j < entries.length; j++) entries[j].remove();
|
|
1907
|
+
entries = [];
|
|
1908
|
+
prevRaws = [];
|
|
1909
|
+
unbindAllRows();
|
|
1910
|
+
subject = value;
|
|
1911
|
+
declined = true;
|
|
1912
|
+
listOwner.dispose();
|
|
1913
|
+
lateClassic?.();
|
|
1914
|
+
return;
|
|
1915
|
+
}
|
|
1916
|
+
const swapOps = identityOps(nextRaw);
|
|
1917
|
+
subject = value;
|
|
1918
|
+
unbindOps = solidJs.runWithOwner(listOwner, () => solidJs.registerRowOps(subject, applyOps));
|
|
1919
|
+
if (shallow) unbindSlots = solidJs.runWithOwner(listOwner, () => solidJs.registerSlotPatch(subject, applySlot));
|
|
1920
|
+
applyOps(nextRaw, swapOps);
|
|
1921
|
+
}));
|
|
1922
|
+
solidJs.onCleanup(() => {
|
|
1923
|
+
unbindOps();
|
|
1924
|
+
unbindSlots?.();
|
|
1925
|
+
unbindAllRows();
|
|
1926
|
+
listOwner.dispose();
|
|
1927
|
+
});
|
|
1928
|
+
return true;
|
|
1929
|
+
};
|
|
1930
|
+
const patchDriver = (subject, body) => {
|
|
1931
|
+
const raw = solidJs.patchableRaw(subject);
|
|
1932
|
+
if (raw !== undefined) {
|
|
1933
|
+
if (!solidJs.sharedConfig.hydrating) body(raw, undefined, true);
|
|
1934
|
+
const unbind = solidJs.registerPatch(subject, body);
|
|
1935
|
+
if (rowCollector !== null) rowCollector.unbinds.push(unbind);
|
|
1936
|
+
else solidJs.onCleanup(unbind);
|
|
1937
|
+
} else if (rowCollector !== null && subject === rowCollector.row) {
|
|
1938
|
+
rowCollector.bodies.push(body);
|
|
1939
|
+
if (!solidJs.sharedConfig.hydrating) body(subject, undefined, true);
|
|
1940
|
+
} else {
|
|
1941
|
+
effect(() => body(subject, subject, false),
|
|
1942
|
+
() => solidJs.untrack(() => body(subject, undefined, true)));
|
|
1943
|
+
}
|
|
1944
|
+
};
|
|
1945
|
+
|
|
1585
1946
|
function throwInBrowser(func) {
|
|
1586
1947
|
const err = new Error(`${func.name} is not supported in the browser, returning undefined`);
|
|
1587
1948
|
console.error(err);
|
|
@@ -1655,11 +2016,14 @@ function isSafeError(value) {
|
|
|
1655
2016
|
return !!(value && (typeof value === "object" || typeof value === "function") && value[SAFE_ERROR]);
|
|
1656
2017
|
}
|
|
1657
2018
|
const REVALIDATE_HEADER = "X-Revalidate";
|
|
1658
|
-
function initWithRevalidate(init) {
|
|
2019
|
+
function initWithRevalidate(init = {}) {
|
|
2020
|
+
const resolved = typeof init === "number" ? {
|
|
2021
|
+
status: init
|
|
2022
|
+
} : init;
|
|
1659
2023
|
const {
|
|
1660
2024
|
revalidate,
|
|
1661
2025
|
...responseInit
|
|
1662
|
-
} =
|
|
2026
|
+
} = resolved;
|
|
1663
2027
|
let headers;
|
|
1664
2028
|
if (responseInit.headers && responseInit.headers.getSetCookie) {
|
|
1665
2029
|
headers = new Headers();
|
|
@@ -1685,13 +2049,12 @@ function redirect(url, init = 302) {
|
|
|
1685
2049
|
const {
|
|
1686
2050
|
responseInit,
|
|
1687
2051
|
headers
|
|
1688
|
-
} = initWithRevalidate(
|
|
1689
|
-
status: init
|
|
1690
|
-
} : init);
|
|
2052
|
+
} = initWithRevalidate(init);
|
|
1691
2053
|
if (responseInit.status === undefined) {
|
|
1692
2054
|
responseInit.status = 302;
|
|
1693
2055
|
}
|
|
1694
|
-
|
|
2056
|
+
const target = typeof url === "string" ? url : url[HREF];
|
|
2057
|
+
headers.set("Location", typeof target === "string" ? target : String(url));
|
|
1695
2058
|
return new Response(null, {
|
|
1696
2059
|
...responseInit,
|
|
1697
2060
|
headers
|
|
@@ -1719,26 +2082,8 @@ function respond(value, init = {}) {
|
|
|
1719
2082
|
}), value);
|
|
1720
2083
|
}
|
|
1721
2084
|
|
|
1722
|
-
const mergeProps = solidJs.merge;
|
|
1723
2085
|
const isServer = false;
|
|
1724
2086
|
const isDev = false;
|
|
1725
|
-
function render(code, element, init, options = {}) {
|
|
1726
|
-
try {
|
|
1727
|
-
const dispose = render$1(code, element, init, {
|
|
1728
|
-
...options,
|
|
1729
|
-
insertOptions: {
|
|
1730
|
-
schedule: true
|
|
1731
|
-
}
|
|
1732
|
-
});
|
|
1733
|
-
solidJs.flush();
|
|
1734
|
-
return dispose;
|
|
1735
|
-
} finally {
|
|
1736
|
-
}
|
|
1737
|
-
}
|
|
1738
|
-
const hydrate = (...args) => {
|
|
1739
|
-
solidJs.enableHydration();
|
|
1740
|
-
return hydrate$1(...args);
|
|
1741
|
-
};
|
|
1742
2087
|
function Portal(props) {
|
|
1743
2088
|
return solidJs.runWithOwner(solidJs.createOwner(), () => portalImpl(props));
|
|
1744
2089
|
}
|
|
@@ -1791,7 +2136,7 @@ function portalImpl(props) {
|
|
|
1791
2136
|
});
|
|
1792
2137
|
return treeMarker;
|
|
1793
2138
|
}
|
|
1794
|
-
const COMPONENT_BINDING = Symbol.for("
|
|
2139
|
+
const COMPONENT_BINDING = Symbol.for("solid.component-binding");
|
|
1795
2140
|
function bindingOf(value) {
|
|
1796
2141
|
return value !== null && (typeof value === "function" || typeof value === "object") && value[COMPONENT_BINDING] || undefined;
|
|
1797
2142
|
}
|
|
@@ -1928,6 +2273,10 @@ Object.defineProperty(exports, "getOwner", {
|
|
|
1928
2273
|
enumerable: true,
|
|
1929
2274
|
get: function () { return solidJs.getOwner; }
|
|
1930
2275
|
});
|
|
2276
|
+
Object.defineProperty(exports, "mergeProps", {
|
|
2277
|
+
enumerable: true,
|
|
2278
|
+
get: function () { return solidJs.merge; }
|
|
2279
|
+
});
|
|
1931
2280
|
Object.defineProperty(exports, "untrack", {
|
|
1932
2281
|
enumerable: true,
|
|
1933
2282
|
get: function () { return solidJs.untrack; }
|
|
@@ -1938,7 +2287,7 @@ exports.DOMWithState = DOMWithState;
|
|
|
1938
2287
|
exports.DelegatedEvents = DelegatedEvents;
|
|
1939
2288
|
exports.Dynamic = Dynamic;
|
|
1940
2289
|
exports.HREF = HREF;
|
|
1941
|
-
exports.HydrationScript =
|
|
2290
|
+
exports.HydrationScript = HydrationScript;
|
|
1942
2291
|
exports.MathMLElements = MathMLElements;
|
|
1943
2292
|
exports.Namespaces = Namespaces;
|
|
1944
2293
|
exports.Portal = Portal;
|
|
@@ -1964,11 +2313,12 @@ exports.createRequestEvent = createRequestEvent;
|
|
|
1964
2313
|
exports.createResponseStub = createResponseStub;
|
|
1965
2314
|
exports.createSSRResponse = createSSRResponse;
|
|
1966
2315
|
exports.delegateEvents = delegateEvents;
|
|
2316
|
+
exports.driveList = driveList;
|
|
1967
2317
|
exports.dynamic = dynamic;
|
|
1968
2318
|
exports.dynamicProperty = dynamicProperty;
|
|
1969
2319
|
exports.effect = effect;
|
|
1970
2320
|
exports.escape = escape;
|
|
1971
|
-
exports.generateHydrationScript =
|
|
2321
|
+
exports.generateHydrationScript = generateHydrationScript;
|
|
1972
2322
|
exports.getDelegatedRoot = getDelegatedRoot;
|
|
1973
2323
|
exports.getExpectedRedirectStatus = getExpectedRedirectStatus;
|
|
1974
2324
|
exports.getFirstChild = getFirstChild;
|
|
@@ -1977,7 +2327,7 @@ exports.getNextElement = getNextElement;
|
|
|
1977
2327
|
exports.getNextMarker = getNextMarker;
|
|
1978
2328
|
exports.getNextMatch = getNextMatch;
|
|
1979
2329
|
exports.getNextSibling = getNextSibling;
|
|
1980
|
-
exports.getRequestEvent =
|
|
2330
|
+
exports.getRequestEvent = getRequestEvent;
|
|
1981
2331
|
exports.getServerFunctionMetadata = getServerFunctionMetadata;
|
|
1982
2332
|
exports.getServerFunctionRPC = getServerFunctionRPC;
|
|
1983
2333
|
exports.hasFlashCookie = hasFlashCookie;
|
|
@@ -1986,6 +2336,7 @@ exports.httpStatus = httpStatus;
|
|
|
1986
2336
|
exports.hydrate = hydrate;
|
|
1987
2337
|
exports.insert = insert;
|
|
1988
2338
|
exports.installHydrationRuntime = installHydrationRuntime;
|
|
2339
|
+
exports.installListDriver = installListDriver;
|
|
1989
2340
|
exports.isDev = isDev;
|
|
1990
2341
|
exports.isHref = isHref;
|
|
1991
2342
|
exports.isResponseEnvelope = isResponseEnvelope;
|
|
@@ -1994,7 +2345,6 @@ exports.isServer = isServer;
|
|
|
1994
2345
|
exports.isServerFunction = isServerFunction;
|
|
1995
2346
|
exports.markSafeError = markSafeError;
|
|
1996
2347
|
exports.memo = memo;
|
|
1997
|
-
exports.mergeProps = mergeProps;
|
|
1998
2348
|
exports.parseCookieHeader = parseCookieHeader;
|
|
1999
2349
|
exports.patchDriver = patchDriver;
|
|
2000
2350
|
exports.redirect = redirect;
|
|
@@ -2030,4 +2380,5 @@ exports.template = template;
|
|
|
2030
2380
|
exports.unregisterDelegatedContainer = unregisterDelegatedContainer;
|
|
2031
2381
|
exports.unregisterDelegatedRoot = unregisterDelegatedRoot;
|
|
2032
2382
|
exports.useHead = useHead;
|
|
2383
|
+
exports.waitAsset = waitAsset;
|
|
2033
2384
|
exports.warmAsset = warmAsset;
|