@solidjs/web 2.0.0-rc.2 → 2.0.0-rc.3
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 +86 -61
- package/dist/dev.js +81 -60
- package/dist/server.cjs +34 -17
- package/dist/server.js +35 -19
- package/dist/web.cjs +83 -59
- package/dist/web.js +78 -58
- 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/types/client.d.ts +150 -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 +0 -65
- package/types/index.server.d.ts +125 -0
- package/types/jsx.d.ts +5 -13
- package/types/reconcile.d.ts +1 -0
- package/types/render.d.ts +4 -0
- package/types/response.d.ts +41 -153
- package/types/serializer-decode.d.ts +89 -112
- package/types/serializer.d.ts +69 -157
- package/types/server-functions/client.d.ts +93 -222
- package/types/server-functions/flash.d.ts +10 -30
- package/types/server-functions/registry.d.ts +63 -0
- package/types/server-functions/rich-args.d.ts +1 -10
- package/types/server-functions/server.d.ts +292 -574
- package/types/server-functions/shared.d.ts +112 -458
- package/types/server-mock.d.ts +2 -2
- package/types/server.d.ts +242 -434
- package/types-cjs/client.d.cts +150 -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 +0 -65
- package/types-cjs/index.server.d.cts +125 -0
- package/types-cjs/jsx.d.cts +5 -13
- package/types-cjs/reconcile.d.cts +1 -0
- package/types-cjs/render.d.cts +4 -0
- package/types-cjs/response.d.cts +41 -153
- 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 +93 -222
- package/types-cjs/server-functions/flash.d.cts +10 -30
- package/types-cjs/server-functions/registry.d.cts +63 -0
- package/types-cjs/server-functions/rich-args.d.cts +1 -10
- package/types-cjs/server-functions/server.d.cts +292 -574
- package/types-cjs/server-functions/shared.d.cts +112 -458
- package/types-cjs/server-mock.d.cts +2 -2
- package/types-cjs/server.d.cts +242 -434
- package/LICENSE +0 -21
- package/types/core.d.ts +0 -9
- package/types-cjs/core.d.cts +0 -9
package/dist/dev.cjs
CHANGED
|
@@ -57,23 +57,16 @@ const transparentOptions = {
|
|
|
57
57
|
const syncOptions = {
|
|
58
58
|
sync: true
|
|
59
59
|
};
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
solidJs.runWithOwner(null, () => {
|
|
71
|
-
gate = solidJs.createMemo(() => promise);
|
|
72
|
-
});
|
|
73
|
-
assetGates.set(promise, gate);
|
|
74
|
-
}
|
|
75
|
-
gate();
|
|
76
|
-
};
|
|
60
|
+
function effect(fn, effectFn, options) {
|
|
61
|
+
solidJs.createRenderEffect(fn, effectFn, options ? {
|
|
62
|
+
sync: true,
|
|
63
|
+
...options,
|
|
64
|
+
transparent: !options.scope
|
|
65
|
+
} : transparentOptions);
|
|
66
|
+
}
|
|
67
|
+
function memo(fn) {
|
|
68
|
+
return solidJs.createMemo(() => fn(), syncOptions);
|
|
69
|
+
}
|
|
77
70
|
|
|
78
71
|
function reconcileArrays(parentNode, a, b, marker) {
|
|
79
72
|
let bLength = b.length,
|
|
@@ -330,14 +323,35 @@ function getServerFunctionRPC() {
|
|
|
330
323
|
return globalThis[SERVER_FUNCTION_RPC];
|
|
331
324
|
}
|
|
332
325
|
|
|
333
|
-
const
|
|
326
|
+
const assetGates = new WeakMap();
|
|
327
|
+
const waitAsset = promise => {
|
|
328
|
+
let gate = assetGates.get(promise);
|
|
329
|
+
if (!gate) {
|
|
330
|
+
solidJs.runWithOwner(null, () => {
|
|
331
|
+
gate = solidJs.createMemo(() => promise);
|
|
332
|
+
});
|
|
333
|
+
assetGates.set(promise, gate);
|
|
334
|
+
}
|
|
335
|
+
gate();
|
|
336
|
+
};
|
|
337
|
+
const $$EVENT_OWNER = "_$SOLID_EVENT_OWNER";
|
|
334
338
|
const INNER_OWNED = {};
|
|
335
339
|
const delegatedEvents = new Set();
|
|
336
340
|
const delegatedContainers = new Map();
|
|
337
|
-
function
|
|
341
|
+
function voidFn() {}
|
|
342
|
+
function generateHydrationScript(_options) {
|
|
343
|
+
return "";
|
|
344
|
+
}
|
|
345
|
+
function HydrationScript(_props) {
|
|
346
|
+
return null;
|
|
347
|
+
}
|
|
348
|
+
const getRequestEvent = voidFn;
|
|
349
|
+
function render(code, element, init, options = {}) {
|
|
338
350
|
if (!element) {
|
|
339
351
|
throw new Error("The `element` passed to `render(..., element)` doesn't exist. Make sure `element` exists in the document.");
|
|
340
352
|
}
|
|
353
|
+
solidJs.resetErrorHalt();
|
|
354
|
+
solidJs.enforceLoadingBoundary(true);
|
|
341
355
|
let disposer;
|
|
342
356
|
registerDelegatedRoot(element);
|
|
343
357
|
try {
|
|
@@ -348,15 +362,21 @@ function render$1(code, element, init, options = {}) {
|
|
|
348
362
|
effect(() => solidJs.flatten(tree), () => {});
|
|
349
363
|
} else {
|
|
350
364
|
const tree = code();
|
|
351
|
-
insert(element, () => tree, element.firstChild ? null : undefined, init,
|
|
365
|
+
insert(element, () => tree, element.firstChild ? null : undefined, init, {
|
|
366
|
+
...options.insertOptions,
|
|
367
|
+
schedule: true
|
|
368
|
+
});
|
|
352
369
|
}
|
|
353
370
|
}, {
|
|
354
371
|
id: options.renderId
|
|
355
372
|
});
|
|
373
|
+
solidJs.flush();
|
|
356
374
|
} catch (err) {
|
|
357
375
|
if (disposer) disposer();
|
|
358
376
|
unregisterDelegatedRoot(element);
|
|
359
377
|
throw err;
|
|
378
|
+
} finally {
|
|
379
|
+
solidJs.enforceLoadingBoundary(false);
|
|
360
380
|
}
|
|
361
381
|
return () => {
|
|
362
382
|
disposer();
|
|
@@ -443,7 +463,7 @@ function setProperty(node, name, value) {
|
|
|
443
463
|
node[name] = value;
|
|
444
464
|
}
|
|
445
465
|
let claimHandlers = null;
|
|
446
|
-
const CLAIM_SEAM = Symbol.for("
|
|
466
|
+
const CLAIM_SEAM = Symbol.for("solid.element-claims");
|
|
447
467
|
function registerElementClaim(handler) {
|
|
448
468
|
(claimHandlers || (claimHandlers = globalThis[CLAIM_SEAM] = [])).push(handler);
|
|
449
469
|
return () => {
|
|
@@ -1149,9 +1169,10 @@ function loadModuleAssets(mapping) {
|
|
|
1149
1169
|
}
|
|
1150
1170
|
return pending.length ? Promise.all(pending).then(() => {}) : undefined;
|
|
1151
1171
|
}
|
|
1152
|
-
function hydrate
|
|
1172
|
+
function hydrate(code, element, options = {}) {
|
|
1173
|
+
solidJs.enableHydration();
|
|
1153
1174
|
installHydrationRuntime();
|
|
1154
|
-
if (globalThis._$HY.done) return render
|
|
1175
|
+
if (globalThis._$HY.done) return render(code, element, [...element.childNodes], options);
|
|
1155
1176
|
options.renderId ||= "";
|
|
1156
1177
|
if (!globalThis._$HY.modules) globalThis._$HY.modules = {};
|
|
1157
1178
|
if (!globalThis._$HY.loading) globalThis._$HY.loading = {};
|
|
@@ -1210,7 +1231,7 @@ function hydrate$1(code, element, options = {}) {
|
|
|
1210
1231
|
solidJs.sharedConfig.gather = gather;
|
|
1211
1232
|
solidJs.sharedConfig.hydrating = true;
|
|
1212
1233
|
try {
|
|
1213
|
-
disposer = render
|
|
1234
|
+
disposer = render(code, element, [...element.childNodes], options);
|
|
1214
1235
|
} finally {
|
|
1215
1236
|
solidJs.sharedConfig.hydrating = false;
|
|
1216
1237
|
}
|
|
@@ -1218,14 +1239,14 @@ function hydrate$1(code, element, options = {}) {
|
|
|
1218
1239
|
console.error("Hydration module preload failed, falling back to client render:", err);
|
|
1219
1240
|
solidJs.sharedConfig.hydrating = false;
|
|
1220
1241
|
solidJs.sharedConfig.registry = undefined;
|
|
1221
|
-
disposer = render
|
|
1242
|
+
disposer = render(code, element, [...element.childNodes], options);
|
|
1222
1243
|
});
|
|
1223
1244
|
return () => disposer && disposer();
|
|
1224
1245
|
}
|
|
1225
1246
|
}
|
|
1226
1247
|
try {
|
|
1227
1248
|
gatherHydratable(element, options.renderId);
|
|
1228
|
-
return render
|
|
1249
|
+
return render(code, element, [...element.childNodes], options);
|
|
1229
1250
|
} finally {
|
|
1230
1251
|
solidJs.sharedConfig.hydrating = false;
|
|
1231
1252
|
}
|
|
@@ -1457,7 +1478,7 @@ function eventHandler(e, container, state) {
|
|
|
1457
1478
|
const handleNode = () => {
|
|
1458
1479
|
let handler = node[key];
|
|
1459
1480
|
if (handler === undefined && node.hasAttribute && node.hasAttribute("_bnd")) {
|
|
1460
|
-
const seam = globalThis[Symbol.for("
|
|
1481
|
+
const seam = globalThis[Symbol.for("solid.bnd")];
|
|
1461
1482
|
if (seam) handler = seam.resolve(node, e.type);
|
|
1462
1483
|
}
|
|
1463
1484
|
if (handler && !node.disabled) {
|
|
@@ -1506,7 +1527,16 @@ function eventHandler(e, container, state) {
|
|
|
1506
1527
|
}
|
|
1507
1528
|
function insertExpression(parent, value, current, marker) {
|
|
1508
1529
|
if (hydrationRt !== null && isHydrating(parent)) {
|
|
1509
|
-
if (value && value !== current)
|
|
1530
|
+
if (value && value !== current) {
|
|
1531
|
+
const arr = Array.isArray(value);
|
|
1532
|
+
for (const n of arr ? value : [value]) {
|
|
1533
|
+
if (n && n.nodeType) {
|
|
1534
|
+
if (!isHydrating(n)) return current;
|
|
1535
|
+
} else if (arr && (typeof n === "string" || typeof n === "number")) {
|
|
1536
|
+
return current;
|
|
1537
|
+
}
|
|
1538
|
+
}
|
|
1539
|
+
}
|
|
1510
1540
|
return value;
|
|
1511
1541
|
}
|
|
1512
1542
|
if (value === current) return value;
|
|
@@ -1537,6 +1567,17 @@ function insertExpression(parent, value, current, marker) {
|
|
|
1537
1567
|
if (marker) value[$$SLOT] = marker;
|
|
1538
1568
|
} else if (Array.isArray(value)) {
|
|
1539
1569
|
const currentArray = current && Array.isArray(current);
|
|
1570
|
+
for (let i = 0, len = value.length; i < len; i++) {
|
|
1571
|
+
const item = value[i],
|
|
1572
|
+
t = typeof item;
|
|
1573
|
+
if (t === "string" || t === "number") {
|
|
1574
|
+
const prev = currentArray ? current[i] : undefined;
|
|
1575
|
+
if (prev && prev.nodeType === 3) {
|
|
1576
|
+
if (prev.data !== "" + item) prev.data = item;
|
|
1577
|
+
value[i] = prev;
|
|
1578
|
+
} else value[i] = document.createTextNode(item);
|
|
1579
|
+
}
|
|
1580
|
+
}
|
|
1540
1581
|
if (value.length === 0) {
|
|
1541
1582
|
cleanChildren(parent, current, marker);
|
|
1542
1583
|
} else if (currentArray) {
|
|
@@ -1557,12 +1598,12 @@ function normalize(value, current, multi, doNotUnwrap) {
|
|
|
1557
1598
|
});
|
|
1558
1599
|
if (doNotUnwrap && typeof value === "function") return value;
|
|
1559
1600
|
if (multi && !Array.isArray(value)) value = [value != null ? value : ""];
|
|
1560
|
-
if (Array.isArray(value)) {
|
|
1601
|
+
if (solidJs.sharedConfig.hydrating && Array.isArray(value)) {
|
|
1561
1602
|
for (let i = 0, len = value.length; i < len; i++) {
|
|
1562
1603
|
const item = value[i],
|
|
1563
1604
|
prev = current && current[i],
|
|
1564
1605
|
t = typeof item;
|
|
1565
|
-
if (t === "string" || t === "number")
|
|
1606
|
+
if ((t === "string" || t === "number") && prev && prev.nodeType === 3) value[i] = prev;
|
|
1566
1607
|
}
|
|
1567
1608
|
}
|
|
1568
1609
|
return value;
|
|
@@ -1643,7 +1684,6 @@ function gatherHydratable(element, root) {
|
|
|
1643
1684
|
function getHydrationKey() {
|
|
1644
1685
|
return solidJs.sharedConfig.getNextContextId();
|
|
1645
1686
|
}
|
|
1646
|
-
const voidFn = () => undefined;
|
|
1647
1687
|
const RequestContext = Symbol();
|
|
1648
1688
|
|
|
1649
1689
|
function throwInBrowser(func) {
|
|
@@ -1719,11 +1759,14 @@ function isSafeError(value) {
|
|
|
1719
1759
|
return !!(value && (typeof value === "object" || typeof value === "function") && value[SAFE_ERROR]);
|
|
1720
1760
|
}
|
|
1721
1761
|
const REVALIDATE_HEADER = "X-Revalidate";
|
|
1722
|
-
function initWithRevalidate(init) {
|
|
1762
|
+
function initWithRevalidate(init = {}) {
|
|
1763
|
+
const resolved = typeof init === "number" ? {
|
|
1764
|
+
status: init
|
|
1765
|
+
} : init;
|
|
1723
1766
|
const {
|
|
1724
1767
|
revalidate,
|
|
1725
1768
|
...responseInit
|
|
1726
|
-
} =
|
|
1769
|
+
} = resolved;
|
|
1727
1770
|
let headers;
|
|
1728
1771
|
if (responseInit.headers && responseInit.headers.getSetCookie) {
|
|
1729
1772
|
headers = new Headers();
|
|
@@ -1749,9 +1792,7 @@ function redirect(url, init = 302) {
|
|
|
1749
1792
|
const {
|
|
1750
1793
|
responseInit,
|
|
1751
1794
|
headers
|
|
1752
|
-
} = initWithRevalidate(
|
|
1753
|
-
status: init
|
|
1754
|
-
} : init);
|
|
1795
|
+
} = initWithRevalidate(init);
|
|
1755
1796
|
if (responseInit.status === undefined) {
|
|
1756
1797
|
responseInit.status = 302;
|
|
1757
1798
|
}
|
|
@@ -1783,28 +1824,8 @@ function respond(value, init = {}) {
|
|
|
1783
1824
|
}), value);
|
|
1784
1825
|
}
|
|
1785
1826
|
|
|
1786
|
-
const mergeProps = solidJs.merge;
|
|
1787
1827
|
const isServer = false;
|
|
1788
1828
|
const isDev = true;
|
|
1789
|
-
function render(code, element, init, options = {}) {
|
|
1790
|
-
solidJs.enforceLoadingBoundary(true);
|
|
1791
|
-
try {
|
|
1792
|
-
const dispose = render$1(code, element, init, {
|
|
1793
|
-
...options,
|
|
1794
|
-
insertOptions: {
|
|
1795
|
-
schedule: true
|
|
1796
|
-
}
|
|
1797
|
-
});
|
|
1798
|
-
solidJs.flush();
|
|
1799
|
-
return dispose;
|
|
1800
|
-
} finally {
|
|
1801
|
-
solidJs.enforceLoadingBoundary(false);
|
|
1802
|
-
}
|
|
1803
|
-
}
|
|
1804
|
-
const hydrate = (...args) => {
|
|
1805
|
-
solidJs.enableHydration();
|
|
1806
|
-
return hydrate$1(...args);
|
|
1807
|
-
};
|
|
1808
1829
|
function Portal(props) {
|
|
1809
1830
|
return solidJs.runWithOwner(solidJs.createOwner(), () => portalImpl(props));
|
|
1810
1831
|
}
|
|
@@ -1857,7 +1878,7 @@ function portalImpl(props) {
|
|
|
1857
1878
|
});
|
|
1858
1879
|
return treeMarker;
|
|
1859
1880
|
}
|
|
1860
|
-
const COMPONENT_BINDING = Symbol.for("
|
|
1881
|
+
const COMPONENT_BINDING = Symbol.for("solid.component-binding");
|
|
1861
1882
|
function bindingOf(value) {
|
|
1862
1883
|
return value !== null && (typeof value === "function" || typeof value === "object") && value[COMPONENT_BINDING] || undefined;
|
|
1863
1884
|
}
|
|
@@ -1997,6 +2018,10 @@ Object.defineProperty(exports, "getOwner", {
|
|
|
1997
2018
|
enumerable: true,
|
|
1998
2019
|
get: function () { return solidJs.getOwner; }
|
|
1999
2020
|
});
|
|
2021
|
+
Object.defineProperty(exports, "mergeProps", {
|
|
2022
|
+
enumerable: true,
|
|
2023
|
+
get: function () { return solidJs.merge; }
|
|
2024
|
+
});
|
|
2000
2025
|
Object.defineProperty(exports, "untrack", {
|
|
2001
2026
|
enumerable: true,
|
|
2002
2027
|
get: function () { return solidJs.untrack; }
|
|
@@ -2007,7 +2032,7 @@ exports.DOMWithState = DOMWithState;
|
|
|
2007
2032
|
exports.DelegatedEvents = DelegatedEvents;
|
|
2008
2033
|
exports.Dynamic = Dynamic;
|
|
2009
2034
|
exports.HREF = HREF;
|
|
2010
|
-
exports.HydrationScript =
|
|
2035
|
+
exports.HydrationScript = HydrationScript;
|
|
2011
2036
|
exports.MathMLElements = MathMLElements;
|
|
2012
2037
|
exports.Namespaces = Namespaces;
|
|
2013
2038
|
exports.Portal = Portal;
|
|
@@ -2037,7 +2062,7 @@ exports.dynamic = dynamic;
|
|
|
2037
2062
|
exports.dynamicProperty = dynamicProperty;
|
|
2038
2063
|
exports.effect = effect;
|
|
2039
2064
|
exports.escape = escape;
|
|
2040
|
-
exports.generateHydrationScript =
|
|
2065
|
+
exports.generateHydrationScript = generateHydrationScript;
|
|
2041
2066
|
exports.getDelegatedRoot = getDelegatedRoot;
|
|
2042
2067
|
exports.getExpectedRedirectStatus = getExpectedRedirectStatus;
|
|
2043
2068
|
exports.getFirstChild = getFirstChild;
|
|
@@ -2046,7 +2071,7 @@ exports.getNextElement = getNextElement;
|
|
|
2046
2071
|
exports.getNextMarker = getNextMarker;
|
|
2047
2072
|
exports.getNextMatch = getNextMatch;
|
|
2048
2073
|
exports.getNextSibling = getNextSibling;
|
|
2049
|
-
exports.getRequestEvent =
|
|
2074
|
+
exports.getRequestEvent = getRequestEvent;
|
|
2050
2075
|
exports.getServerFunctionMetadata = getServerFunctionMetadata;
|
|
2051
2076
|
exports.getServerFunctionRPC = getServerFunctionRPC;
|
|
2052
2077
|
exports.hasFlashCookie = hasFlashCookie;
|
|
@@ -2063,7 +2088,6 @@ exports.isServer = isServer;
|
|
|
2063
2088
|
exports.isServerFunction = isServerFunction;
|
|
2064
2089
|
exports.markSafeError = markSafeError;
|
|
2065
2090
|
exports.memo = memo;
|
|
2066
|
-
exports.mergeProps = mergeProps;
|
|
2067
2091
|
exports.parseCookieHeader = parseCookieHeader;
|
|
2068
2092
|
exports.patchDriver = patchDriver;
|
|
2069
2093
|
exports.redirect = redirect;
|
|
@@ -2099,4 +2123,5 @@ exports.template = template;
|
|
|
2099
2123
|
exports.unregisterDelegatedContainer = unregisterDelegatedContainer;
|
|
2100
2124
|
exports.unregisterDelegatedRoot = unregisterDelegatedRoot;
|
|
2101
2125
|
exports.useHead = useHead;
|
|
2126
|
+
exports.waitAsset = waitAsset;
|
|
2102
2127
|
exports.warmAsset = warmAsset;
|
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, createComponent, omit, createOwner, createSignal, $DEVCOMP, onCleanup, getOwner, 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,35 @@ 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
|
+
const $$EVENT_OWNER = "_$SOLID_EVENT_OWNER";
|
|
333
337
|
const INNER_OWNED = {};
|
|
334
338
|
const delegatedEvents = new Set();
|
|
335
339
|
const delegatedContainers = new Map();
|
|
336
|
-
function
|
|
340
|
+
function voidFn() {}
|
|
341
|
+
function generateHydrationScript(_options) {
|
|
342
|
+
return "";
|
|
343
|
+
}
|
|
344
|
+
function HydrationScript(_props) {
|
|
345
|
+
return null;
|
|
346
|
+
}
|
|
347
|
+
const getRequestEvent = voidFn;
|
|
348
|
+
function render(code, element, init, options = {}) {
|
|
337
349
|
if (!element) {
|
|
338
350
|
throw new Error("The `element` passed to `render(..., element)` doesn't exist. Make sure `element` exists in the document.");
|
|
339
351
|
}
|
|
352
|
+
resetErrorHalt();
|
|
353
|
+
enforceLoadingBoundary(true);
|
|
340
354
|
let disposer;
|
|
341
355
|
registerDelegatedRoot(element);
|
|
342
356
|
try {
|
|
@@ -347,15 +361,21 @@ function render$1(code, element, init, options = {}) {
|
|
|
347
361
|
effect(() => flatten(tree), () => {});
|
|
348
362
|
} else {
|
|
349
363
|
const tree = code();
|
|
350
|
-
insert(element, () => tree, element.firstChild ? null : undefined, init,
|
|
364
|
+
insert(element, () => tree, element.firstChild ? null : undefined, init, {
|
|
365
|
+
...options.insertOptions,
|
|
366
|
+
schedule: true
|
|
367
|
+
});
|
|
351
368
|
}
|
|
352
369
|
}, {
|
|
353
370
|
id: options.renderId
|
|
354
371
|
});
|
|
372
|
+
flush();
|
|
355
373
|
} catch (err) {
|
|
356
374
|
if (disposer) disposer();
|
|
357
375
|
unregisterDelegatedRoot(element);
|
|
358
376
|
throw err;
|
|
377
|
+
} finally {
|
|
378
|
+
enforceLoadingBoundary(false);
|
|
359
379
|
}
|
|
360
380
|
return () => {
|
|
361
381
|
disposer();
|
|
@@ -442,7 +462,7 @@ function setProperty(node, name, value) {
|
|
|
442
462
|
node[name] = value;
|
|
443
463
|
}
|
|
444
464
|
let claimHandlers = null;
|
|
445
|
-
const CLAIM_SEAM = Symbol.for("
|
|
465
|
+
const CLAIM_SEAM = Symbol.for("solid.element-claims");
|
|
446
466
|
function registerElementClaim(handler) {
|
|
447
467
|
(claimHandlers || (claimHandlers = globalThis[CLAIM_SEAM] = [])).push(handler);
|
|
448
468
|
return () => {
|
|
@@ -1148,9 +1168,10 @@ function loadModuleAssets(mapping) {
|
|
|
1148
1168
|
}
|
|
1149
1169
|
return pending.length ? Promise.all(pending).then(() => {}) : undefined;
|
|
1150
1170
|
}
|
|
1151
|
-
function hydrate
|
|
1171
|
+
function hydrate(code, element, options = {}) {
|
|
1172
|
+
enableHydration();
|
|
1152
1173
|
installHydrationRuntime();
|
|
1153
|
-
if (globalThis._$HY.done) return render
|
|
1174
|
+
if (globalThis._$HY.done) return render(code, element, [...element.childNodes], options);
|
|
1154
1175
|
options.renderId ||= "";
|
|
1155
1176
|
if (!globalThis._$HY.modules) globalThis._$HY.modules = {};
|
|
1156
1177
|
if (!globalThis._$HY.loading) globalThis._$HY.loading = {};
|
|
@@ -1209,7 +1230,7 @@ function hydrate$1(code, element, options = {}) {
|
|
|
1209
1230
|
sharedConfig.gather = gather;
|
|
1210
1231
|
sharedConfig.hydrating = true;
|
|
1211
1232
|
try {
|
|
1212
|
-
disposer = render
|
|
1233
|
+
disposer = render(code, element, [...element.childNodes], options);
|
|
1213
1234
|
} finally {
|
|
1214
1235
|
sharedConfig.hydrating = false;
|
|
1215
1236
|
}
|
|
@@ -1217,14 +1238,14 @@ function hydrate$1(code, element, options = {}) {
|
|
|
1217
1238
|
console.error("Hydration module preload failed, falling back to client render:", err);
|
|
1218
1239
|
sharedConfig.hydrating = false;
|
|
1219
1240
|
sharedConfig.registry = undefined;
|
|
1220
|
-
disposer = render
|
|
1241
|
+
disposer = render(code, element, [...element.childNodes], options);
|
|
1221
1242
|
});
|
|
1222
1243
|
return () => disposer && disposer();
|
|
1223
1244
|
}
|
|
1224
1245
|
}
|
|
1225
1246
|
try {
|
|
1226
1247
|
gatherHydratable(element, options.renderId);
|
|
1227
|
-
return render
|
|
1248
|
+
return render(code, element, [...element.childNodes], options);
|
|
1228
1249
|
} finally {
|
|
1229
1250
|
sharedConfig.hydrating = false;
|
|
1230
1251
|
}
|
|
@@ -1456,7 +1477,7 @@ function eventHandler(e, container, state) {
|
|
|
1456
1477
|
const handleNode = () => {
|
|
1457
1478
|
let handler = node[key];
|
|
1458
1479
|
if (handler === undefined && node.hasAttribute && node.hasAttribute("_bnd")) {
|
|
1459
|
-
const seam = globalThis[Symbol.for("
|
|
1480
|
+
const seam = globalThis[Symbol.for("solid.bnd")];
|
|
1460
1481
|
if (seam) handler = seam.resolve(node, e.type);
|
|
1461
1482
|
}
|
|
1462
1483
|
if (handler && !node.disabled) {
|
|
@@ -1505,7 +1526,16 @@ function eventHandler(e, container, state) {
|
|
|
1505
1526
|
}
|
|
1506
1527
|
function insertExpression(parent, value, current, marker) {
|
|
1507
1528
|
if (hydrationRt !== null && isHydrating(parent)) {
|
|
1508
|
-
if (value && value !== current)
|
|
1529
|
+
if (value && value !== current) {
|
|
1530
|
+
const arr = Array.isArray(value);
|
|
1531
|
+
for (const n of arr ? value : [value]) {
|
|
1532
|
+
if (n && n.nodeType) {
|
|
1533
|
+
if (!isHydrating(n)) return current;
|
|
1534
|
+
} else if (arr && (typeof n === "string" || typeof n === "number")) {
|
|
1535
|
+
return current;
|
|
1536
|
+
}
|
|
1537
|
+
}
|
|
1538
|
+
}
|
|
1509
1539
|
return value;
|
|
1510
1540
|
}
|
|
1511
1541
|
if (value === current) return value;
|
|
@@ -1536,6 +1566,17 @@ function insertExpression(parent, value, current, marker) {
|
|
|
1536
1566
|
if (marker) value[$$SLOT] = marker;
|
|
1537
1567
|
} else if (Array.isArray(value)) {
|
|
1538
1568
|
const currentArray = current && Array.isArray(current);
|
|
1569
|
+
for (let i = 0, len = value.length; i < len; i++) {
|
|
1570
|
+
const item = value[i],
|
|
1571
|
+
t = typeof item;
|
|
1572
|
+
if (t === "string" || t === "number") {
|
|
1573
|
+
const prev = currentArray ? current[i] : undefined;
|
|
1574
|
+
if (prev && prev.nodeType === 3) {
|
|
1575
|
+
if (prev.data !== "" + item) prev.data = item;
|
|
1576
|
+
value[i] = prev;
|
|
1577
|
+
} else value[i] = document.createTextNode(item);
|
|
1578
|
+
}
|
|
1579
|
+
}
|
|
1539
1580
|
if (value.length === 0) {
|
|
1540
1581
|
cleanChildren(parent, current, marker);
|
|
1541
1582
|
} else if (currentArray) {
|
|
@@ -1556,12 +1597,12 @@ function normalize(value, current, multi, doNotUnwrap) {
|
|
|
1556
1597
|
});
|
|
1557
1598
|
if (doNotUnwrap && typeof value === "function") return value;
|
|
1558
1599
|
if (multi && !Array.isArray(value)) value = [value != null ? value : ""];
|
|
1559
|
-
if (Array.isArray(value)) {
|
|
1600
|
+
if (sharedConfig.hydrating && Array.isArray(value)) {
|
|
1560
1601
|
for (let i = 0, len = value.length; i < len; i++) {
|
|
1561
1602
|
const item = value[i],
|
|
1562
1603
|
prev = current && current[i],
|
|
1563
1604
|
t = typeof item;
|
|
1564
|
-
if (t === "string" || t === "number")
|
|
1605
|
+
if ((t === "string" || t === "number") && prev && prev.nodeType === 3) value[i] = prev;
|
|
1565
1606
|
}
|
|
1566
1607
|
}
|
|
1567
1608
|
return value;
|
|
@@ -1642,7 +1683,6 @@ function gatherHydratable(element, root) {
|
|
|
1642
1683
|
function getHydrationKey() {
|
|
1643
1684
|
return sharedConfig.getNextContextId();
|
|
1644
1685
|
}
|
|
1645
|
-
const voidFn = () => undefined;
|
|
1646
1686
|
const RequestContext = Symbol();
|
|
1647
1687
|
|
|
1648
1688
|
function throwInBrowser(func) {
|
|
@@ -1718,11 +1758,14 @@ function isSafeError(value) {
|
|
|
1718
1758
|
return !!(value && (typeof value === "object" || typeof value === "function") && value[SAFE_ERROR]);
|
|
1719
1759
|
}
|
|
1720
1760
|
const REVALIDATE_HEADER = "X-Revalidate";
|
|
1721
|
-
function initWithRevalidate(init) {
|
|
1761
|
+
function initWithRevalidate(init = {}) {
|
|
1762
|
+
const resolved = typeof init === "number" ? {
|
|
1763
|
+
status: init
|
|
1764
|
+
} : init;
|
|
1722
1765
|
const {
|
|
1723
1766
|
revalidate,
|
|
1724
1767
|
...responseInit
|
|
1725
|
-
} =
|
|
1768
|
+
} = resolved;
|
|
1726
1769
|
let headers;
|
|
1727
1770
|
if (responseInit.headers && responseInit.headers.getSetCookie) {
|
|
1728
1771
|
headers = new Headers();
|
|
@@ -1748,9 +1791,7 @@ function redirect(url, init = 302) {
|
|
|
1748
1791
|
const {
|
|
1749
1792
|
responseInit,
|
|
1750
1793
|
headers
|
|
1751
|
-
} = initWithRevalidate(
|
|
1752
|
-
status: init
|
|
1753
|
-
} : init);
|
|
1794
|
+
} = initWithRevalidate(init);
|
|
1754
1795
|
if (responseInit.status === undefined) {
|
|
1755
1796
|
responseInit.status = 302;
|
|
1756
1797
|
}
|
|
@@ -1782,28 +1823,8 @@ function respond(value, init = {}) {
|
|
|
1782
1823
|
}), value);
|
|
1783
1824
|
}
|
|
1784
1825
|
|
|
1785
|
-
const mergeProps = merge;
|
|
1786
1826
|
const isServer = false;
|
|
1787
1827
|
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
1828
|
function Portal(props) {
|
|
1808
1829
|
return runWithOwner(createOwner(), () => portalImpl(props));
|
|
1809
1830
|
}
|
|
@@ -1856,7 +1877,7 @@ function portalImpl(props) {
|
|
|
1856
1877
|
});
|
|
1857
1878
|
return treeMarker;
|
|
1858
1879
|
}
|
|
1859
|
-
const COMPONENT_BINDING = Symbol.for("
|
|
1880
|
+
const COMPONENT_BINDING = Symbol.for("solid.component-binding");
|
|
1860
1881
|
function bindingOf(value) {
|
|
1861
1882
|
return value !== null && (typeof value === "function" || typeof value === "object") && value[COMPONENT_BINDING] || undefined;
|
|
1862
1883
|
}
|
|
@@ -1948,4 +1969,4 @@ _moduleUrl) {
|
|
|
1948
1969
|
function httpStatus(_code, _text) {}
|
|
1949
1970
|
function httpHeader(_name, _value, _options) {}
|
|
1950
1971
|
|
|
1951
|
-
export { ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF,
|
|
1972
|
+
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, dynamic, dynamicProperty, effect, escape, generateHydrationScript, getDelegatedRoot, getExpectedRedirectStatus, getFirstChild, getHydrationKey, getNextElement, getNextMarker, getNextMatch, getNextSibling, getRequestEvent, getServerFunctionMetadata, getServerFunctionRPC, hasFlashCookie, httpHeader, httpStatus, hydrate, insert, installHydrationRuntime, isDev, isHref, isResponseEnvelope, isSafeError, isServer, isServerFunction, 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 };
|