@solidjs/web 2.0.0-rc.7 → 2.0.0-rc.8
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/server.dev.js +15 -2
- package/dist/server.js +15 -2
- package/dist/web.dev.js +41 -9
- package/dist/web.js +39 -8
- package/dist/{web.cjs → web.observe.js} +137 -239
- package/frames/dist/server.dev.js +19 -0
- package/frames/dist/server.js +19 -0
- package/frames/package.json +6 -24
- package/package.json +81 -314
- package/serialization/decode/package.json +3 -9
- package/serialization/package.json +3 -9
- package/serialization/types/serializer-decode.d.ts +49 -2
- package/server-functions/dist/server.dev.js +28 -10
- package/server-functions/dist/server.js +28 -10
- package/server-functions/package.json +6 -24
- package/server-functions/rich-args/package.json +3 -9
- package/storage/package.json +3 -9
- package/types/client.d.ts +17 -0
- package/types/frames/serializer-decode.d.ts +49 -2
- package/types/serializer-decode.d.ts +49 -2
- package/types/server-functions/server.d.ts +27 -4
- package/types/server.d.ts +1 -1
- package/dist/server.cjs +0 -3708
- package/dist/server.dev.cjs +0 -3794
- package/dist/web.dev.cjs +0 -2285
- package/frames/dist/client.cjs +0 -2043
- package/frames/dist/client.dev.cjs +0 -2063
- package/frames/dist/server.cjs +0 -4542
- package/frames/dist/server.dev.cjs +0 -4584
- package/serialization/dist/decode.cjs +0 -155
- package/serialization/dist/serialization.cjs +0 -275
- package/serialization/types-cjs/index.d.cts +0 -101
- package/serialization/types-cjs/package.json +0 -3
- package/serialization/types-cjs/serializer-decode.d.cts +0 -172
- package/serialization/types-cjs/serializer.d.cts +0 -101
- package/server-functions/dist/client.cjs +0 -1069
- package/server-functions/dist/rich-args.cjs +0 -11
- package/server-functions/dist/server.cjs +0 -2381
- package/server-functions/dist/server.dev.cjs +0 -2409
- package/storage/dist/storage.cjs +0 -12
- package/storage/types-cjs/index.d.cts +0 -28
- package/storage/types-cjs/package.json +0 -3
- package/types-cjs/client.d.cts +0 -197
- package/types-cjs/constants.d.cts +0 -20
- package/types-cjs/cookies.d.cts +0 -41
- package/types-cjs/frames/client.d.cts +0 -36
- package/types-cjs/frames/frame-client.d.cts +0 -370
- package/types-cjs/frames/frame-container-plugin.d.cts +0 -71
- package/types-cjs/frames/frame-sink.d.cts +0 -92
- package/types-cjs/frames/frame-transport.d.cts +0 -189
- package/types-cjs/frames/serializer-decode.d.cts +0 -172
- package/types-cjs/frames/serializer.d.cts +0 -101
- package/types-cjs/frames/server.d.cts +0 -52
- package/types-cjs/head.d.cts +0 -19
- package/types-cjs/index.d.cts +0 -191
- package/types-cjs/index.server.d.cts +0 -147
- package/types-cjs/jsx-properties.d.cts +0 -93
- package/types-cjs/jsx.d.cts +0 -4146
- package/types-cjs/package.json +0 -3
- package/types-cjs/reconcile.d.cts +0 -1
- package/types-cjs/render.d.cts +0 -6
- package/types-cjs/response.d.cts +0 -81
- package/types-cjs/serializer-decode.d.cts +0 -172
- package/types-cjs/serializer.d.cts +0 -101
- package/types-cjs/server-functions/client.d.cts +0 -184
- package/types-cjs/server-functions/flash.d.cts +0 -36
- package/types-cjs/server-functions/registry.d.cts +0 -100
- package/types-cjs/server-functions/rich-args.d.cts +0 -1
- package/types-cjs/server-functions/server.d.cts +0 -546
- package/types-cjs/server-functions/shared.d.cts +0 -283
- package/types-cjs/server-mock.d.cts +0 -337
- package/types-cjs/server.d.cts +0 -408
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var solidJs = require('solid-js');
|
|
1
|
+
import { createRenderEffect, createMemo, sharedConfig, enableHydration, $PROXY, untrack, runWithOwner, createRoot, flatten, flush, mergeSources, OBSERVE, createComponent, omit, createOwner, createSignal, 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';
|
|
4
3
|
|
|
5
4
|
const DOMWithState = {
|
|
6
5
|
INPUT: {
|
|
@@ -64,10 +63,10 @@ function effect(fn, effectFn, options) {
|
|
|
64
63
|
...options,
|
|
65
64
|
transparent: !options.scope
|
|
66
65
|
} : transparentOptions;
|
|
67
|
-
|
|
66
|
+
createRenderEffect(fn, effectFn, nodeOptions);
|
|
68
67
|
}
|
|
69
68
|
function memo(fn) {
|
|
70
|
-
return
|
|
69
|
+
return createMemo(() => fn(), syncOptions);
|
|
71
70
|
}
|
|
72
71
|
|
|
73
72
|
function reconcileArrays(parentNode, a, b, marker) {
|
|
@@ -342,8 +341,8 @@ const assetGates = new WeakMap();
|
|
|
342
341
|
const waitAsset = promise => {
|
|
343
342
|
let gate = assetGates.get(promise);
|
|
344
343
|
if (!gate) {
|
|
345
|
-
|
|
346
|
-
gate =
|
|
344
|
+
runWithOwner(null, () => {
|
|
345
|
+
gate = createMemo(() => promise);
|
|
347
346
|
});
|
|
348
347
|
assetGates.set(promise, gate);
|
|
349
348
|
}
|
|
@@ -367,11 +366,11 @@ function render(code, element, init, options = {}) {
|
|
|
367
366
|
let disposer;
|
|
368
367
|
registerDelegatedRoot(element);
|
|
369
368
|
try {
|
|
370
|
-
|
|
369
|
+
createRoot(dispose => {
|
|
371
370
|
disposer = dispose;
|
|
372
371
|
if (element === document) {
|
|
373
372
|
const tree = code();
|
|
374
|
-
effect(() =>
|
|
373
|
+
effect(() => flatten(tree), () => {});
|
|
375
374
|
} else {
|
|
376
375
|
const tree = code();
|
|
377
376
|
insert(element, () => tree, element.firstChild ? null : undefined, init, {
|
|
@@ -382,7 +381,7 @@ function render(code, element, init, options = {}) {
|
|
|
382
381
|
}, {
|
|
383
382
|
id: options.renderId
|
|
384
383
|
});
|
|
385
|
-
|
|
384
|
+
flush();
|
|
386
385
|
} catch (err) {
|
|
387
386
|
if (disposer) disposer();
|
|
388
387
|
unregisterDelegatedRoot(element);
|
|
@@ -445,10 +444,27 @@ function unregisterDelegatedContainer(container, owner = container) {
|
|
|
445
444
|
}
|
|
446
445
|
function attachDelegatedEvent(name, container, state) {
|
|
447
446
|
if (state.handlers.has(name)) return;
|
|
448
|
-
const handler = e => eventHandler(e, container, state);
|
|
447
|
+
const handler = e => dispatchAsInteraction(e, () => eventHandler(e, container, state)) ;
|
|
449
448
|
state.handlers.set(name, handler);
|
|
450
449
|
container.addEventListener(name, handler);
|
|
451
450
|
}
|
|
451
|
+
function describeEventTarget(target) {
|
|
452
|
+
if (!target || typeof target.tagName !== "string") return undefined;
|
|
453
|
+
const tag = target.tagName.toLowerCase();
|
|
454
|
+
let out = tag;
|
|
455
|
+
if (target.id) out += `#${target.id}`;else if (typeof target.name === "string" && target.name) out += `[name=${target.name}]`;
|
|
456
|
+
if (tag !== "input" && tag !== "textarea" && tag !== "select") {
|
|
457
|
+
const text = (target.textContent || "").trim().replace(/\s+/g, " ");
|
|
458
|
+
if (text) out += ` "${text.length > 30 ? text.slice(0, 29) + "…" : text}"`;
|
|
459
|
+
}
|
|
460
|
+
return out;
|
|
461
|
+
}
|
|
462
|
+
function dispatchAsInteraction(e, fn) {
|
|
463
|
+
return OBSERVE.attribution.withInteraction({
|
|
464
|
+
type: e.type,
|
|
465
|
+
target: describeEventTarget(e.target)
|
|
466
|
+
}, fn);
|
|
467
|
+
}
|
|
452
468
|
function getDelegatedRoot(node) {
|
|
453
469
|
while (node) {
|
|
454
470
|
if (delegatedContainers.get(node)?.roots) return node;
|
|
@@ -575,11 +591,16 @@ function addEvent(node, name, handler, delegate) {
|
|
|
575
591
|
}
|
|
576
592
|
if (Array.isArray(handler)) {
|
|
577
593
|
const handlerFn = handler[0];
|
|
578
|
-
const listener = e => handlerFn.call(node, handler[1], e);
|
|
594
|
+
const listener = e => dispatchAsInteraction(e, () => handlerFn.call(node, handler[1], e)) ;
|
|
579
595
|
listener[$$EVENT_TUPLE] = handler;
|
|
580
596
|
node.addEventListener(name, listener);
|
|
581
597
|
return listener;
|
|
582
598
|
}
|
|
599
|
+
if (typeof handler === "function") {
|
|
600
|
+
const listener = e => dispatchAsInteraction(e, () => handler.call(node, e));
|
|
601
|
+
node.addEventListener(name, listener);
|
|
602
|
+
return listener;
|
|
603
|
+
}
|
|
583
604
|
node.addEventListener(name, handler, typeof handler !== "function" && handler);
|
|
584
605
|
return handler;
|
|
585
606
|
}
|
|
@@ -623,6 +644,21 @@ function style(node, value, prev) {
|
|
|
623
644
|
}
|
|
624
645
|
}
|
|
625
646
|
}
|
|
647
|
+
function readShallow(value) {
|
|
648
|
+
if (value === null || typeof value !== "object") return value;
|
|
649
|
+
if (Array.isArray(value)) return value.map(readShallow);
|
|
650
|
+
if (value[$PROXY] !== value) return value;
|
|
651
|
+
const keys = ownKeys(value);
|
|
652
|
+
const out = {};
|
|
653
|
+
for (let i = 0; i < keys.length; i++) {
|
|
654
|
+
const k = keys[i];
|
|
655
|
+
if (typeof k === "string") out[k] = value[k];
|
|
656
|
+
}
|
|
657
|
+
return out;
|
|
658
|
+
}
|
|
659
|
+
function ownKeys(o) {
|
|
660
|
+
return o[$PROXY] === o ? Reflect.ownKeys(o) : Object.keys(o);
|
|
661
|
+
}
|
|
626
662
|
function setStyleProperty(node, name, value) {
|
|
627
663
|
if (isHydrating(node)) return;
|
|
628
664
|
value != null ? node.style.setProperty(name, value) : node.style.removeProperty(name);
|
|
@@ -642,15 +678,27 @@ function spread(node, props, skipChildren) {
|
|
|
642
678
|
effect(() => {
|
|
643
679
|
const source = get();
|
|
644
680
|
const newProps = {};
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
681
|
+
const sources = mergeSources(source);
|
|
682
|
+
if (sources !== undefined) {
|
|
683
|
+
for (let i = 0; i < sources.length; i++) {
|
|
684
|
+
let s = sources[i];
|
|
685
|
+
if (typeof s === "function") s = s();
|
|
686
|
+
if (s != null) collectProps(newProps, s);
|
|
687
|
+
}
|
|
688
|
+
} else collectProps(newProps, source);
|
|
650
689
|
return newProps;
|
|
651
690
|
}, props => assign(node, props, true, prevProps, true));
|
|
652
691
|
return prevProps;
|
|
653
692
|
}
|
|
693
|
+
function collectProps(out, s) {
|
|
694
|
+
const keys = ownKeys(s);
|
|
695
|
+
for (let i = 0; i < keys.length; i++) {
|
|
696
|
+
const prop = keys[i];
|
|
697
|
+
if (typeof prop !== "string" || prop === "children" || prop === "ref") continue;
|
|
698
|
+
const v = s[prop];
|
|
699
|
+
out[prop] = prop === "style" || prop === "class" ? readShallow(v) : v;
|
|
700
|
+
}
|
|
701
|
+
}
|
|
654
702
|
function dynamicProperty(props, key) {
|
|
655
703
|
const src = props[key];
|
|
656
704
|
Object.defineProperty(props, key, {
|
|
@@ -665,8 +713,8 @@ function applyRef(r, element) {
|
|
|
665
713
|
Array.isArray(r) ? r.flat(Infinity).forEach(f => f && f(element)) : r(element);
|
|
666
714
|
}
|
|
667
715
|
function ref(fn, element) {
|
|
668
|
-
const resolved =
|
|
669
|
-
|
|
716
|
+
const resolved = untrack(fn);
|
|
717
|
+
runWithOwner(null, () => applyRef(resolved, element));
|
|
670
718
|
}
|
|
671
719
|
function scope(fn) {
|
|
672
720
|
fn.$s = true;
|
|
@@ -686,7 +734,7 @@ function installHydrationRuntime() {
|
|
|
686
734
|
return initial;
|
|
687
735
|
},
|
|
688
736
|
reclaimRegion(current, parent, marker) {
|
|
689
|
-
if (!
|
|
737
|
+
if (!sharedConfig.hydrating || !current || !parent.isConnected) return current;
|
|
690
738
|
const first = Array.isArray(current) ? current[0] : current;
|
|
691
739
|
if (!first || !first.nodeType || first.isConnected) return current;
|
|
692
740
|
let nodes;
|
|
@@ -709,7 +757,7 @@ function installHydrationRuntime() {
|
|
|
709
757
|
return stripTextSeparators(nodes);
|
|
710
758
|
},
|
|
711
759
|
dedupEvent(e) {
|
|
712
|
-
return !!(
|
|
760
|
+
return !!(sharedConfig.registry && sharedConfig.events && sharedConfig.events.find(([el, ev]) => ev === e));
|
|
713
761
|
}
|
|
714
762
|
};
|
|
715
763
|
}
|
|
@@ -1021,7 +1069,7 @@ function scheduleHeadApply() {
|
|
|
1021
1069
|
queueMicrotask(flushHeadRegistry);
|
|
1022
1070
|
}
|
|
1023
1071
|
function flushHeadRegistry() {
|
|
1024
|
-
if (
|
|
1072
|
+
if (sharedConfig.hydrating) {
|
|
1025
1073
|
setTimeout(flushHeadRegistry, 0);
|
|
1026
1074
|
return;
|
|
1027
1075
|
}
|
|
@@ -1214,7 +1262,7 @@ function loadModuleAssets(mapping) {
|
|
|
1214
1262
|
return pending.length ? Promise.all(pending).then(() => {}) : undefined;
|
|
1215
1263
|
}
|
|
1216
1264
|
function hydrate(code, element, options = {}) {
|
|
1217
|
-
|
|
1265
|
+
enableHydration();
|
|
1218
1266
|
installHydrationRuntime();
|
|
1219
1267
|
if (globalThis._$HY.done) return render(code, element, [...element.childNodes], options);
|
|
1220
1268
|
const head = (element.nodeType === 9 ? element : element.ownerDocument).head;
|
|
@@ -1229,13 +1277,13 @@ function hydrate(code, element, options = {}) {
|
|
|
1229
1277
|
options.renderId ||= "";
|
|
1230
1278
|
if (!globalThis._$HY.modules) globalThis._$HY.modules = {};
|
|
1231
1279
|
if (!globalThis._$HY.loading) globalThis._$HY.loading = {};
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1280
|
+
sharedConfig.completed = globalThis._$HY.completed;
|
|
1281
|
+
sharedConfig.events = globalThis._$HY.events;
|
|
1282
|
+
sharedConfig.load = id => globalThis._$HY.r[id];
|
|
1283
|
+
sharedConfig.has = id => id in globalThis._$HY.r;
|
|
1284
|
+
sharedConfig.gather = root => gatherHydratable(element, root);
|
|
1285
|
+
sharedConfig.loadModuleAssets = loadModuleAssets;
|
|
1286
|
+
sharedConfig.cleanupFragment = id => {
|
|
1239
1287
|
const tpl = document.getElementById("pl-" + id);
|
|
1240
1288
|
if (tpl) {
|
|
1241
1289
|
let node = tpl.nextSibling;
|
|
@@ -1251,37 +1299,41 @@ function hydrate(code, element, options = {}) {
|
|
|
1251
1299
|
tpl.remove();
|
|
1252
1300
|
}
|
|
1253
1301
|
};
|
|
1254
|
-
|
|
1255
|
-
if (!
|
|
1256
|
-
|
|
1257
|
-
if (
|
|
1258
|
-
registry:
|
|
1259
|
-
gather:
|
|
1302
|
+
sharedConfig.registry = new Map();
|
|
1303
|
+
if (!sharedConfig.boundaryScopes) sharedConfig.boundaryScopes = new Map();
|
|
1304
|
+
sharedConfig.captureBoundaryScope = id => {
|
|
1305
|
+
if (sharedConfig.registry) sharedConfig.boundaryScopes.set(id, {
|
|
1306
|
+
registry: sharedConfig.registry,
|
|
1307
|
+
gather: sharedConfig.gather
|
|
1260
1308
|
});
|
|
1261
1309
|
};
|
|
1262
|
-
|
|
1310
|
+
sharedConfig.hydrating = true;
|
|
1263
1311
|
const hyr = globalThis._$HY.r;
|
|
1264
1312
|
const rootMapping = hyr && (hyr[options.renderId + "_assets"] || hyr["_assets"]);
|
|
1265
1313
|
if (rootMapping && typeof rootMapping === "object") {
|
|
1266
1314
|
const p = loadModuleAssets(rootMapping);
|
|
1267
1315
|
if (p) {
|
|
1268
1316
|
gatherHydratable(element, options.renderId);
|
|
1269
|
-
const registry =
|
|
1270
|
-
const gather =
|
|
1317
|
+
const registry = sharedConfig.registry;
|
|
1318
|
+
const gather = sharedConfig.gather;
|
|
1271
1319
|
let disposer;
|
|
1272
1320
|
p.then(() => {
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1321
|
+
sharedConfig.registry = registry;
|
|
1322
|
+
sharedConfig.gather = gather;
|
|
1323
|
+
sharedConfig.hydrating = true;
|
|
1276
1324
|
try {
|
|
1277
1325
|
disposer = render(code, element, [...element.childNodes], options);
|
|
1278
1326
|
} finally {
|
|
1279
|
-
|
|
1327
|
+
sharedConfig.hydrating = false;
|
|
1280
1328
|
}
|
|
1281
1329
|
}, err => {
|
|
1330
|
+
sharedConfig.hydrating = false;
|
|
1331
|
+
sharedConfig.registry = undefined;
|
|
1332
|
+
if (element.nodeType === 9) {
|
|
1333
|
+
(globalThis.reportError || console.error)(err);
|
|
1334
|
+
return;
|
|
1335
|
+
}
|
|
1282
1336
|
console.error("Hydration module preload failed, falling back to client render:", err);
|
|
1283
|
-
solidJs.sharedConfig.hydrating = false;
|
|
1284
|
-
solidJs.sharedConfig.registry = undefined;
|
|
1285
1337
|
disposer = render(code, element, [...element.childNodes], options);
|
|
1286
1338
|
});
|
|
1287
1339
|
return () => disposer && disposer();
|
|
@@ -1291,21 +1343,21 @@ function hydrate(code, element, options = {}) {
|
|
|
1291
1343
|
gatherHydratable(element, options.renderId);
|
|
1292
1344
|
return render(code, element, [...element.childNodes], options);
|
|
1293
1345
|
} finally {
|
|
1294
|
-
|
|
1346
|
+
sharedConfig.hydrating = false;
|
|
1295
1347
|
}
|
|
1296
1348
|
}
|
|
1297
1349
|
function getNextElement(template) {
|
|
1298
1350
|
let node,
|
|
1299
1351
|
key,
|
|
1300
1352
|
hydrating = isHydrating();
|
|
1301
|
-
if (!hydrating || !(node =
|
|
1353
|
+
if (!hydrating || !(node = sharedConfig.registry.get(key = getHydrationKey()))) {
|
|
1302
1354
|
if (!template) {
|
|
1303
1355
|
throw new Error(`Hydration Mismatch. Unable to find DOM nodes for hydration key: ${key}`);
|
|
1304
1356
|
}
|
|
1305
1357
|
return template(true);
|
|
1306
1358
|
}
|
|
1307
|
-
if (
|
|
1308
|
-
|
|
1359
|
+
if (sharedConfig.completed) sharedConfig.completed.add(node);
|
|
1360
|
+
sharedConfig.registry.delete(key);
|
|
1309
1361
|
return node;
|
|
1310
1362
|
}
|
|
1311
1363
|
function getNextMatch(el, nodeName) {
|
|
@@ -1340,12 +1392,12 @@ function getNextSibling(node, expectedTag) {
|
|
|
1340
1392
|
return sibling;
|
|
1341
1393
|
}
|
|
1342
1394
|
function runHydrationEvents() {
|
|
1343
|
-
if (
|
|
1395
|
+
if (sharedConfig.events && !sharedConfig.events.queued) {
|
|
1344
1396
|
queueMicrotask(() => {
|
|
1345
1397
|
const {
|
|
1346
1398
|
completed,
|
|
1347
1399
|
events
|
|
1348
|
-
} =
|
|
1400
|
+
} = sharedConfig;
|
|
1349
1401
|
if (!events) return;
|
|
1350
1402
|
events.queued = false;
|
|
1351
1403
|
while (events.length) {
|
|
@@ -1379,18 +1431,18 @@ function runHydrationEvents() {
|
|
|
1379
1431
|
for (let i = 0; i < matches.length; i++) eventHandler(e, matches[i].container, matches[i].state);
|
|
1380
1432
|
} else if (matchContainer) eventHandler(e, matchContainer, matchState);
|
|
1381
1433
|
}
|
|
1382
|
-
if (
|
|
1383
|
-
|
|
1384
|
-
|
|
1434
|
+
if (sharedConfig.done) {
|
|
1435
|
+
sharedConfig.events = _$HY.events = null;
|
|
1436
|
+
sharedConfig.completed = _$HY.completed = null;
|
|
1385
1437
|
}
|
|
1386
1438
|
});
|
|
1387
|
-
|
|
1439
|
+
sharedConfig.events.queued = true;
|
|
1388
1440
|
}
|
|
1389
1441
|
}
|
|
1390
1442
|
function isHydrating(node) {
|
|
1391
|
-
if (!
|
|
1443
|
+
if (!sharedConfig.hydrating) return false;
|
|
1392
1444
|
if (!node || node.isConnected) return true;
|
|
1393
|
-
const roots =
|
|
1445
|
+
const roots = sharedConfig.claimRoots;
|
|
1394
1446
|
if (roots) {
|
|
1395
1447
|
for (let i = 0; i < roots.length; i++) {
|
|
1396
1448
|
if (roots[i].contains(node)) return true;
|
|
@@ -1592,13 +1644,13 @@ function insertExpression(parent, value, current, marker) {
|
|
|
1592
1644
|
return value;
|
|
1593
1645
|
}
|
|
1594
1646
|
function normalize(value, current, multi, doNotUnwrap) {
|
|
1595
|
-
value =
|
|
1647
|
+
value = flatten(value, {
|
|
1596
1648
|
skipNonRendered: true,
|
|
1597
1649
|
doNotUnwrap
|
|
1598
1650
|
});
|
|
1599
1651
|
if (doNotUnwrap && typeof value === "function") return value;
|
|
1600
1652
|
if (multi && !Array.isArray(value)) value = [value != null ? value : ""];
|
|
1601
|
-
if (
|
|
1653
|
+
if (sharedConfig.hydrating && Array.isArray(value)) {
|
|
1602
1654
|
for (let i = 0, len = value.length; i < len; i++) {
|
|
1603
1655
|
const item = value[i],
|
|
1604
1656
|
prev = current && current[i],
|
|
@@ -1678,11 +1730,11 @@ function gatherHydratable(element, root) {
|
|
|
1678
1730
|
const frame = node.closest("[data-fid]");
|
|
1679
1731
|
if (frame && frame !== element && element.contains(frame)) continue;
|
|
1680
1732
|
}
|
|
1681
|
-
if (!
|
|
1733
|
+
if (!sharedConfig.registry.has(key)) sharedConfig.registry.set(key, node);
|
|
1682
1734
|
}
|
|
1683
1735
|
}
|
|
1684
1736
|
function getHydrationKey() {
|
|
1685
|
-
return
|
|
1737
|
+
return sharedConfig.getNextContextId();
|
|
1686
1738
|
}
|
|
1687
1739
|
const RequestContext = Symbol();
|
|
1688
1740
|
|
|
@@ -1848,22 +1900,22 @@ function respond(value, init = {}) {
|
|
|
1848
1900
|
const isServer = false;
|
|
1849
1901
|
const isDev = false;
|
|
1850
1902
|
function Portal(props) {
|
|
1851
|
-
return
|
|
1903
|
+
return runWithOwner(createOwner(), () => portalImpl(props));
|
|
1852
1904
|
}
|
|
1853
1905
|
function portalImpl(props) {
|
|
1854
1906
|
const treeMarker = document.createTextNode(""),
|
|
1855
1907
|
startMarker = document.createTextNode(""),
|
|
1856
1908
|
endMarker = document.createTextNode(""),
|
|
1857
1909
|
mount = () => props.mount || document.body,
|
|
1858
|
-
content =
|
|
1910
|
+
content = createMemo(() => [startMarker, props.children], {
|
|
1859
1911
|
ssrSource: "client",
|
|
1860
1912
|
loadingValue: undefined
|
|
1861
1913
|
});
|
|
1862
|
-
|
|
1863
|
-
() => [mount(), content(),
|
|
1864
|
-
const m =
|
|
1914
|
+
createRenderEffect(
|
|
1915
|
+
() => [mount(), content(), getOwner()], ([, c, owner]) => {
|
|
1916
|
+
const m = untrack(mount);
|
|
1865
1917
|
m.appendChild(endMarker);
|
|
1866
|
-
const dispose =
|
|
1918
|
+
const dispose = runWithOwner(owner, () => createRoot(d => {
|
|
1867
1919
|
insert(m, c, endMarker, undefined, {
|
|
1868
1920
|
host: () => treeMarker.parentNode
|
|
1869
1921
|
});
|
|
@@ -1884,8 +1936,8 @@ function portalImpl(props) {
|
|
|
1884
1936
|
schedule: true,
|
|
1885
1937
|
ssrSource: "client"
|
|
1886
1938
|
});
|
|
1887
|
-
|
|
1888
|
-
const m =
|
|
1939
|
+
createEffect(mount, () => {
|
|
1940
|
+
const m = untrack(mount);
|
|
1889
1941
|
const ownerRoot = getDelegatedRoot(treeMarker);
|
|
1890
1942
|
if (!ownerRoot || ownerRoot.contains(m)) return;
|
|
1891
1943
|
registerDelegatedContainer(m, ownerRoot);
|
|
@@ -1893,7 +1945,7 @@ function portalImpl(props) {
|
|
|
1893
1945
|
}, {
|
|
1894
1946
|
ssrSource: "client"
|
|
1895
1947
|
});
|
|
1896
|
-
if (
|
|
1948
|
+
if (sharedConfig.hydrating) return createMemo(() => treeMarker, {
|
|
1897
1949
|
ssrSource: "client",
|
|
1898
1950
|
loadingValue: undefined
|
|
1899
1951
|
});
|
|
@@ -1918,7 +1970,7 @@ function dynamic(source, _options) {
|
|
|
1918
1970
|
}
|
|
1919
1971
|
return next;
|
|
1920
1972
|
};
|
|
1921
|
-
const cached =
|
|
1973
|
+
const cached = createMemo(prev => {
|
|
1922
1974
|
const next = source();
|
|
1923
1975
|
if (!next || typeof next.then !== "function") return resolveBinding(next, prev);
|
|
1924
1976
|
const token = ++latest;
|
|
@@ -1929,22 +1981,22 @@ function dynamic(source, _options) {
|
|
|
1929
1981
|
lazy: true
|
|
1930
1982
|
});
|
|
1931
1983
|
return props => {
|
|
1932
|
-
return
|
|
1984
|
+
return createMemo(() => {
|
|
1933
1985
|
const component = cached();
|
|
1934
1986
|
switch (typeof component) {
|
|
1935
1987
|
case "function":
|
|
1936
1988
|
{
|
|
1937
1989
|
const binding = bindingOf(component);
|
|
1938
1990
|
if (binding) {
|
|
1939
|
-
const [address, setAddress] =
|
|
1991
|
+
const [address, setAddress] = createSignal(deliveredAddress ?? binding.address);
|
|
1940
1992
|
sites.add(setAddress);
|
|
1941
|
-
|
|
1942
|
-
return
|
|
1993
|
+
onCleanup(() => sites.delete(setAddress));
|
|
1994
|
+
return untrack(() => binding.component(props, address));
|
|
1943
1995
|
}
|
|
1944
|
-
return
|
|
1996
|
+
return untrack(() => component(props));
|
|
1945
1997
|
}
|
|
1946
1998
|
case "string":
|
|
1947
|
-
const el =
|
|
1999
|
+
const el = sharedConfig.hydrating ? getNextElement() : createElement(component, untrack(() => props.is));
|
|
1948
2000
|
spread(el, props);
|
|
1949
2001
|
return el;
|
|
1950
2002
|
}
|
|
@@ -1953,7 +2005,7 @@ function dynamic(source, _options) {
|
|
|
1953
2005
|
}
|
|
1954
2006
|
function Dynamic(props) {
|
|
1955
2007
|
const Comp = dynamic(() => props.component);
|
|
1956
|
-
return
|
|
2008
|
+
return createComponent(Comp, omit(props, "component"));
|
|
1957
2009
|
}
|
|
1958
2010
|
function createElement(tagName, is = undefined) {
|
|
1959
2011
|
return SVGElements.has(tagName) ? document.createElementNS(Namespaces.svg, tagName) : MathMLElements.has(tagName) ? document.createElementNS(Namespaces.mathml, tagName) : document.createElement(tagName, {
|
|
@@ -1965,21 +2017,21 @@ function loadClientOnly(fn, setComp, exportName) {
|
|
|
1965
2017
|
}
|
|
1966
2018
|
function clientOnly(fn, options = {},
|
|
1967
2019
|
_moduleUrl) {
|
|
1968
|
-
const [comp, setComp] =
|
|
2020
|
+
const [comp, setComp] = createSignal();
|
|
1969
2021
|
let started = !options.lazy;
|
|
1970
2022
|
started && loadClientOnly(fn, setComp, options.export);
|
|
1971
2023
|
return props => {
|
|
1972
2024
|
let Comp;
|
|
1973
2025
|
let m;
|
|
1974
|
-
const rest =
|
|
2026
|
+
const rest = omit(props, "fallback");
|
|
1975
2027
|
if (!started) {
|
|
1976
2028
|
started = true;
|
|
1977
2029
|
loadClientOnly(fn, setComp, options.export);
|
|
1978
2030
|
}
|
|
1979
|
-
if ((Comp =
|
|
1980
|
-
const [mounted, setMounted] =
|
|
1981
|
-
const gate =
|
|
1982
|
-
const onHydrationEnd =
|
|
2031
|
+
if ((Comp = untrack(comp)) && !sharedConfig.hydrating) return Comp(rest);
|
|
2032
|
+
const [mounted, setMounted] = createSignal(!sharedConfig.hydrating);
|
|
2033
|
+
const gate = createMemo(() => (Comp = comp(), m = mounted(), untrack(() => Comp && m ? Comp(rest) : props.fallback)));
|
|
2034
|
+
const onHydrationEnd = sharedConfig.onHydrationEnd;
|
|
1983
2035
|
const release = () => setMounted(true);
|
|
1984
2036
|
onHydrationEnd ? onHydrationEnd(release) : queueMicrotask(release);
|
|
1985
2037
|
return gate;
|
|
@@ -1988,158 +2040,4 @@ _moduleUrl) {
|
|
|
1988
2040
|
function httpStatus(_code, _text) {}
|
|
1989
2041
|
function httpHeader(_name, _value, _options) {}
|
|
1990
2042
|
|
|
1991
|
-
|
|
1992
|
-
enumerable: true,
|
|
1993
|
-
get: function () { return solidJs.Errored; }
|
|
1994
|
-
});
|
|
1995
|
-
Object.defineProperty(exports, "For", {
|
|
1996
|
-
enumerable: true,
|
|
1997
|
-
get: function () { return solidJs.For; }
|
|
1998
|
-
});
|
|
1999
|
-
Object.defineProperty(exports, "Hydration", {
|
|
2000
|
-
enumerable: true,
|
|
2001
|
-
get: function () { return solidJs.Hydration; }
|
|
2002
|
-
});
|
|
2003
|
-
Object.defineProperty(exports, "Loading", {
|
|
2004
|
-
enumerable: true,
|
|
2005
|
-
get: function () { return solidJs.Loading; }
|
|
2006
|
-
});
|
|
2007
|
-
Object.defineProperty(exports, "Match", {
|
|
2008
|
-
enumerable: true,
|
|
2009
|
-
get: function () { return solidJs.Match; }
|
|
2010
|
-
});
|
|
2011
|
-
Object.defineProperty(exports, "NoHydration", {
|
|
2012
|
-
enumerable: true,
|
|
2013
|
-
get: function () { return solidJs.NoHydration; }
|
|
2014
|
-
});
|
|
2015
|
-
Object.defineProperty(exports, "Repeat", {
|
|
2016
|
-
enumerable: true,
|
|
2017
|
-
get: function () { return solidJs.Repeat; }
|
|
2018
|
-
});
|
|
2019
|
-
Object.defineProperty(exports, "Reveal", {
|
|
2020
|
-
enumerable: true,
|
|
2021
|
-
get: function () { return solidJs.Reveal; }
|
|
2022
|
-
});
|
|
2023
|
-
Object.defineProperty(exports, "Show", {
|
|
2024
|
-
enumerable: true,
|
|
2025
|
-
get: function () { return solidJs.Show; }
|
|
2026
|
-
});
|
|
2027
|
-
Object.defineProperty(exports, "Switch", {
|
|
2028
|
-
enumerable: true,
|
|
2029
|
-
get: function () { return solidJs.Switch; }
|
|
2030
|
-
});
|
|
2031
|
-
Object.defineProperty(exports, "createComponent", {
|
|
2032
|
-
enumerable: true,
|
|
2033
|
-
get: function () { return solidJs.createComponent; }
|
|
2034
|
-
});
|
|
2035
|
-
Object.defineProperty(exports, "getOwner", {
|
|
2036
|
-
enumerable: true,
|
|
2037
|
-
get: function () { return solidJs.getOwner; }
|
|
2038
|
-
});
|
|
2039
|
-
Object.defineProperty(exports, "mergeProps", {
|
|
2040
|
-
enumerable: true,
|
|
2041
|
-
get: function () { return solidJs.merge; }
|
|
2042
|
-
});
|
|
2043
|
-
Object.defineProperty(exports, "untrack", {
|
|
2044
|
-
enumerable: true,
|
|
2045
|
-
get: function () { return solidJs.untrack; }
|
|
2046
|
-
});
|
|
2047
|
-
exports.ChildProperties = ChildProperties;
|
|
2048
|
-
exports.DOMElements = DOMElements;
|
|
2049
|
-
exports.DOMWithState = DOMWithState;
|
|
2050
|
-
exports.DelegatedEvents = DelegatedEvents;
|
|
2051
|
-
exports.Dynamic = Dynamic;
|
|
2052
|
-
exports.HREF = HREF;
|
|
2053
|
-
exports.HydrationScript = HydrationScript;
|
|
2054
|
-
exports.MathMLElements = MathMLElements;
|
|
2055
|
-
exports.NULL_BODY_STATUSES = NULL_BODY_STATUSES;
|
|
2056
|
-
exports.Namespaces = Namespaces;
|
|
2057
|
-
exports.Portal = Portal;
|
|
2058
|
-
exports.RESPONSE_HEADER_VALUE_LIMIT = RESPONSE_HEADER_VALUE_LIMIT;
|
|
2059
|
-
exports.REVALIDATE_HEADER = REVALIDATE_HEADER;
|
|
2060
|
-
exports.RawTextElements = RawTextElements;
|
|
2061
|
-
exports.RequestContext = RequestContext;
|
|
2062
|
-
exports.ResponseEnvelope = ResponseEnvelope;
|
|
2063
|
-
exports.SAFE_ERROR = SAFE_ERROR;
|
|
2064
|
-
exports.SVGElements = SVGElements;
|
|
2065
|
-
exports.VoidElements = VoidElements;
|
|
2066
|
-
exports.acquireAsset = acquireAsset;
|
|
2067
|
-
exports.addEvent = addEvent;
|
|
2068
|
-
exports.applyRef = applyRef;
|
|
2069
|
-
exports.assign = assign;
|
|
2070
|
-
exports.claimElement = claimElement;
|
|
2071
|
-
exports.claimElementTree = claimElementTree;
|
|
2072
|
-
exports.className = className;
|
|
2073
|
-
exports.clearFlashCookie = clearFlashCookie;
|
|
2074
|
-
exports.clientOnly = clientOnly;
|
|
2075
|
-
exports.commitEventResponse = commitEventResponse;
|
|
2076
|
-
exports.composeMiddleware = composeMiddleware;
|
|
2077
|
-
exports.createRequestEvent = createRequestEvent;
|
|
2078
|
-
exports.createResponseStub = createResponseStub;
|
|
2079
|
-
exports.createSSRResponse = createSSRResponse;
|
|
2080
|
-
exports.delegateEvents = delegateEvents;
|
|
2081
|
-
exports.dynamic = dynamic;
|
|
2082
|
-
exports.dynamicProperty = dynamicProperty;
|
|
2083
|
-
exports.effect = effect;
|
|
2084
|
-
exports.escape = escape;
|
|
2085
|
-
exports.generateHydrationScript = generateHydrationScript;
|
|
2086
|
-
exports.getDelegatedRoot = getDelegatedRoot;
|
|
2087
|
-
exports.getExpectedRedirectStatus = getExpectedRedirectStatus;
|
|
2088
|
-
exports.getFirstChild = getFirstChild;
|
|
2089
|
-
exports.getHydrationKey = getHydrationKey;
|
|
2090
|
-
exports.getNextElement = getNextElement;
|
|
2091
|
-
exports.getNextMarker = getNextMarker;
|
|
2092
|
-
exports.getNextMatch = getNextMatch;
|
|
2093
|
-
exports.getNextSibling = getNextSibling;
|
|
2094
|
-
exports.getRequestEvent = getRequestEvent;
|
|
2095
|
-
exports.getServerFunctionMetadata = getServerFunctionMetadata;
|
|
2096
|
-
exports.getServerFunctionRPC = getServerFunctionRPC;
|
|
2097
|
-
exports.hasFlashCookie = hasFlashCookie;
|
|
2098
|
-
exports.httpHeader = httpHeader;
|
|
2099
|
-
exports.httpStatus = httpStatus;
|
|
2100
|
-
exports.hydrate = hydrate;
|
|
2101
|
-
exports.insert = insert;
|
|
2102
|
-
exports.installHydrationRuntime = installHydrationRuntime;
|
|
2103
|
-
exports.isDev = isDev;
|
|
2104
|
-
exports.isHref = isHref;
|
|
2105
|
-
exports.isResponseEnvelope = isResponseEnvelope;
|
|
2106
|
-
exports.isSafeError = isSafeError;
|
|
2107
|
-
exports.isServer = isServer;
|
|
2108
|
-
exports.isServerFunction = isServerFunction;
|
|
2109
|
-
exports.markSafeError = markSafeError;
|
|
2110
|
-
exports.memo = memo;
|
|
2111
|
-
exports.parseCookieHeader = parseCookieHeader;
|
|
2112
|
-
exports.redirect = redirect;
|
|
2113
|
-
exports.ref = ref;
|
|
2114
|
-
exports.registerDelegatedContainer = registerDelegatedContainer;
|
|
2115
|
-
exports.registerDelegatedRoot = registerDelegatedRoot;
|
|
2116
|
-
exports.registerElementClaim = registerElementClaim;
|
|
2117
|
-
exports.reload = reload;
|
|
2118
|
-
exports.render = render;
|
|
2119
|
-
exports.renderToStream = renderToStream;
|
|
2120
|
-
exports.renderToString = renderToString;
|
|
2121
|
-
exports.resolveSSRNode = resolveSSRNode;
|
|
2122
|
-
exports.respond = respond;
|
|
2123
|
-
exports.runHydrationEvents = runHydrationEvents;
|
|
2124
|
-
exports.scope = scope;
|
|
2125
|
-
exports.serializeCookie = serializeCookie;
|
|
2126
|
-
exports.setAttribute = setAttribute;
|
|
2127
|
-
exports.setAttributeNS = setAttributeNS;
|
|
2128
|
-
exports.setProperty = setProperty;
|
|
2129
|
-
exports.setStyleProperty = setStyleProperty;
|
|
2130
|
-
exports.spread = spread;
|
|
2131
|
-
exports.ssr = ssr;
|
|
2132
|
-
exports.ssrAttribute = ssrAttribute;
|
|
2133
|
-
exports.ssrClassName = ssrClassName;
|
|
2134
|
-
exports.ssrElement = ssrElement;
|
|
2135
|
-
exports.ssrGroup = ssrGroup;
|
|
2136
|
-
exports.ssrHydrationKey = ssrHydrationKey;
|
|
2137
|
-
exports.ssrStyle = ssrStyle;
|
|
2138
|
-
exports.ssrStyleProperty = ssrStyleProperty;
|
|
2139
|
-
exports.style = style;
|
|
2140
|
-
exports.template = template;
|
|
2141
|
-
exports.unregisterDelegatedContainer = unregisterDelegatedContainer;
|
|
2142
|
-
exports.unregisterDelegatedRoot = unregisterDelegatedRoot;
|
|
2143
|
-
exports.useHead = useHead;
|
|
2144
|
-
exports.waitAsset = waitAsset;
|
|
2145
|
-
exports.warmAsset = warmAsset;
|
|
2043
|
+
export { ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, HydrationScript, MathMLElements, NULL_BODY_STATUSES, Namespaces, Portal, RESPONSE_HEADER_VALUE_LIMIT, 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, readShallow, redirect, ref, registerDelegatedContainer, registerDelegatedRoot, registerElementClaim, reload, render, renderToStream, renderToString, resolveSSRNode, respond, runHydrationEvents, scope, serializeCookie, setAttribute, setAttributeNS, setProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrGroup, ssrHydrationKey, ssrStyle, ssrStyleProperty, style, template, unregisterDelegatedContainer, unregisterDelegatedRoot, useHead, waitAsset, warmAsset };
|