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