@solidjs/web 2.0.0-beta.14 → 2.0.0-beta.16
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 +154 -52
- package/dist/dev.js +155 -54
- package/dist/server.cjs +97 -67
- package/dist/server.js +92 -69
- package/dist/web.cjs +154 -52
- package/dist/web.js +155 -54
- package/package.json +5 -5
- package/storage/types/src/client.d.ts +1 -1
- package/storage/types-cjs/src/client.d.cts +1 -1
- package/types/client.d.ts +12 -1
- package/types/core.d.ts +1 -1
- package/types/jsx.d.ts +5 -1
- package/types/server.d.ts +1 -0
- package/types-cjs/client.d.cts +12 -1
- package/types-cjs/core.d.cts +1 -1
- package/types-cjs/jsx.d.cts +5 -1
- package/types-cjs/server.d.cts +1 -0
package/dist/dev.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createRenderEffect, createMemo, sharedConfig, untrack, runWithOwner, flatten, createRoot, merge, createComponent, omit, createEffect, $DEVCOMP, enableHydration, enforceLoadingBoundary, flush } from 'solid-js';
|
|
1
|
+
import { createRenderEffect, createMemo, sharedConfig, untrack, runWithOwner, flatten, createRoot, merge, createComponent, omit, getOwner, createEffect, $DEVCOMP, enableHydration, enforceLoadingBoundary, flush } from 'solid-js';
|
|
2
2
|
export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, Show, Switch, createComponent, getOwner, untrack } from 'solid-js';
|
|
3
3
|
|
|
4
4
|
const DOMWithState = {
|
|
@@ -31,6 +31,7 @@ const DOMWithState = {
|
|
|
31
31
|
};
|
|
32
32
|
const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
|
|
33
33
|
const $$SLOT = /*#__PURE__*/Symbol("slot");
|
|
34
|
+
const $$HOST = /*#__PURE__*/Symbol("host");
|
|
34
35
|
const DelegatedEvents = /*#__PURE__*/new Set(["beforeinput", "click", "dblclick", "contextmenu", "focusin", "focusout", "input", "keydown", "keyup", "mousedown", "mousemove", "mouseout", "mouseover", "mouseup", "pointerdown", "pointermove", "pointerout", "pointerover", "pointerup", "touchend", "touchmove", "touchstart"]);
|
|
35
36
|
const SVGElements = /*#__PURE__*/new Set([
|
|
36
37
|
"altGlyph", "altGlyphDef", "altGlyphItem", "animate", "animateColor", "animateMotion", "animateTransform", "circle", "clipPath", "color-profile", "cursor", "defs", "desc", "ellipse", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence", "filter", "font", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignObject", "g", "glyph", "glyphRef", "hkern", "image", "line", "linearGradient", "marker", "mask", "metadata", "missing-glyph", "mpath", "path", "pattern", "polygon", "polyline", "radialGradient", "rect",
|
|
@@ -58,9 +59,9 @@ const syncOptions = {
|
|
|
58
59
|
sync: true
|
|
59
60
|
};
|
|
60
61
|
const effect = (fn, effectFn, options) => createRenderEffect(fn, effectFn, options ? {
|
|
61
|
-
transparent: true,
|
|
62
62
|
sync: true,
|
|
63
|
-
...options
|
|
63
|
+
...options,
|
|
64
|
+
transparent: !options.scope
|
|
64
65
|
} : transparentOptions);
|
|
65
66
|
const memo = fn => createMemo(() => fn(), syncOptions);
|
|
66
67
|
|
|
@@ -333,20 +334,41 @@ function addEvent(node, name, handler, delegate) {
|
|
|
333
334
|
}
|
|
334
335
|
function style(node, value, prev) {
|
|
335
336
|
if (!value) {
|
|
336
|
-
if (prev
|
|
337
|
+
if (prev || node._$styles) {
|
|
338
|
+
setAttribute(node, "style");
|
|
339
|
+
node._$styles = undefined;
|
|
340
|
+
}
|
|
337
341
|
return;
|
|
338
342
|
}
|
|
339
343
|
const nodeStyle = node.style;
|
|
340
|
-
if (typeof value === "string")
|
|
341
|
-
|
|
342
|
-
|
|
344
|
+
if (typeof value === "string") {
|
|
345
|
+
node._$styles = undefined;
|
|
346
|
+
return nodeStyle.cssText = value;
|
|
347
|
+
}
|
|
348
|
+
if (typeof prev === "string") {
|
|
349
|
+
nodeStyle.cssText = "";
|
|
350
|
+
prev = undefined;
|
|
351
|
+
}
|
|
352
|
+
let applied = node._$styles;
|
|
353
|
+
if (!applied) {
|
|
354
|
+
applied = node._$styles = prev ? {
|
|
355
|
+
...prev
|
|
356
|
+
} : {};
|
|
357
|
+
}
|
|
343
358
|
let v, s;
|
|
359
|
+
for (s in applied) {
|
|
360
|
+
if (value[s] == null) {
|
|
361
|
+
nodeStyle.removeProperty(s);
|
|
362
|
+
delete applied[s];
|
|
363
|
+
}
|
|
364
|
+
}
|
|
344
365
|
for (s in value) {
|
|
345
366
|
v = value[s];
|
|
346
|
-
if (v !==
|
|
347
|
-
|
|
367
|
+
if (v != null && v !== applied[s]) {
|
|
368
|
+
nodeStyle.setProperty(s, v);
|
|
369
|
+
applied[s] = v;
|
|
370
|
+
}
|
|
348
371
|
}
|
|
349
|
-
for (s in prev) value[s] == null && nodeStyle.removeProperty(s);
|
|
350
372
|
}
|
|
351
373
|
function setStyleProperty(node, name, value) {
|
|
352
374
|
value != null ? node.style.setProperty(name, value) : node.style.removeProperty(name);
|
|
@@ -385,22 +407,36 @@ function ref(fn, element) {
|
|
|
385
407
|
const resolved = untrack(fn);
|
|
386
408
|
runWithOwner(null, () => applyRef(resolved, element));
|
|
387
409
|
}
|
|
410
|
+
function scope(fn) {
|
|
411
|
+
fn.$s = true;
|
|
412
|
+
return fn;
|
|
413
|
+
}
|
|
414
|
+
const SCOPE_OPTIONS = {
|
|
415
|
+
scope: true
|
|
416
|
+
};
|
|
417
|
+
function stripTextSeparators(nodes) {
|
|
418
|
+
let j = 0;
|
|
419
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
420
|
+
if (nodes[i].nodeType === 8 && nodes[i].nodeValue === "!$") nodes[i].remove();else nodes[j++] = nodes[i];
|
|
421
|
+
}
|
|
422
|
+
nodes.length = j;
|
|
423
|
+
return nodes;
|
|
424
|
+
}
|
|
388
425
|
function insert(parent, accessor, marker, initial, options) {
|
|
389
426
|
const multi = marker !== undefined;
|
|
427
|
+
const host = options && options.host;
|
|
390
428
|
if (multi && !initial) initial = [];
|
|
391
429
|
if (isHydrating(parent)) {
|
|
392
430
|
if (!multi && initial === undefined && parent) initial = [...parent.childNodes];
|
|
393
|
-
if (Array.isArray(initial))
|
|
394
|
-
let j = 0;
|
|
395
|
-
for (let i = 0; i < initial.length; i++) {
|
|
396
|
-
if (initial[i].nodeType === 8 && initial[i].nodeValue === "!$") initial[i].remove();else initial[j++] = initial[i];
|
|
397
|
-
}
|
|
398
|
-
initial.length = j;
|
|
399
|
-
}
|
|
431
|
+
if (Array.isArray(initial)) stripTextSeparators(initial);
|
|
400
432
|
}
|
|
401
433
|
if (typeof accessor !== "function") {
|
|
402
434
|
accessor = normalize(accessor, initial, multi, true);
|
|
403
|
-
if (typeof accessor !== "function")
|
|
435
|
+
if (typeof accessor !== "function") {
|
|
436
|
+
insertExpression(parent, accessor, initial, marker);
|
|
437
|
+
host && tagHost(accessor, host);
|
|
438
|
+
return;
|
|
439
|
+
}
|
|
404
440
|
}
|
|
405
441
|
if (multi && initial.length === 0) {
|
|
406
442
|
const placeholder = document.createTextNode("");
|
|
@@ -408,12 +444,37 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
408
444
|
initial = [placeholder];
|
|
409
445
|
}
|
|
410
446
|
let current = initial;
|
|
447
|
+
function reclaimSwappedRegion() {
|
|
448
|
+
if (!sharedConfig.hydrating || !current || !parent.isConnected) return;
|
|
449
|
+
const first = Array.isArray(current) ? current[0] : current;
|
|
450
|
+
if (!first || !first.nodeType || first.isConnected) return;
|
|
451
|
+
let nodes;
|
|
452
|
+
if (marker) {
|
|
453
|
+
nodes = [];
|
|
454
|
+
let node = marker.previousSibling,
|
|
455
|
+
depth = 0;
|
|
456
|
+
while (node) {
|
|
457
|
+
if (node.nodeType === 8) {
|
|
458
|
+
const v = node.nodeValue;
|
|
459
|
+
if (v === "/") depth++;else if (v === "$") {
|
|
460
|
+
if (depth === 0) break;
|
|
461
|
+
depth--;
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
nodes.unshift(node);
|
|
465
|
+
node = node.previousSibling;
|
|
466
|
+
}
|
|
467
|
+
} else nodes = [...parent.childNodes];
|
|
468
|
+
current = stripTextSeparators(nodes);
|
|
469
|
+
}
|
|
411
470
|
effect(prev => {
|
|
471
|
+
reclaimSwappedRegion();
|
|
412
472
|
const value = normalize(accessor(), current, multi, true);
|
|
413
473
|
if (typeof value !== "function") return value;
|
|
414
|
-
effect(() => normalize(value, current, multi), inner => {
|
|
474
|
+
effect(() => (reclaimSwappedRegion(), normalize(value, current, multi)), inner => {
|
|
415
475
|
insertExpression(parent, inner, current, marker);
|
|
416
476
|
current = inner;
|
|
477
|
+
host && tagHost(current, host);
|
|
417
478
|
}, prev !== undefined && !(options && options.schedule) ? {
|
|
418
479
|
...options,
|
|
419
480
|
schedule: true
|
|
@@ -423,7 +484,12 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
423
484
|
if (value === INNER_OWNED) return;
|
|
424
485
|
insertExpression(parent, value, current, marker);
|
|
425
486
|
current = value;
|
|
426
|
-
|
|
487
|
+
host && tagHost(current, host);
|
|
488
|
+
},
|
|
489
|
+
accessor.$s ? options ? {
|
|
490
|
+
...options,
|
|
491
|
+
scope: true
|
|
492
|
+
} : SCOPE_OPTIONS : options);
|
|
427
493
|
}
|
|
428
494
|
function assign(node, props, skipChildren, prevProps = {}, skipRef = false) {
|
|
429
495
|
const nodeName = node.nodeName;
|
|
@@ -452,6 +518,9 @@ function loadModuleAssets(mapping) {
|
|
|
452
518
|
if (!hy.loading[moduleUrl]) {
|
|
453
519
|
hy.loading[moduleUrl] = import(entryUrl).then(mod => {
|
|
454
520
|
hy.modules[moduleUrl] = mod;
|
|
521
|
+
}, err => {
|
|
522
|
+
delete hy.loading[moduleUrl];
|
|
523
|
+
throw err;
|
|
455
524
|
});
|
|
456
525
|
}
|
|
457
526
|
pending.push(hy.loading[moduleUrl]);
|
|
@@ -509,8 +578,11 @@ function hydrate$1(code, element, options = {}) {
|
|
|
509
578
|
} finally {
|
|
510
579
|
sharedConfig.hydrating = false;
|
|
511
580
|
}
|
|
512
|
-
},
|
|
581
|
+
}, err => {
|
|
582
|
+
console.error("Hydration module preload failed, falling back to client render:", err);
|
|
513
583
|
sharedConfig.hydrating = false;
|
|
584
|
+
sharedConfig.registry = undefined;
|
|
585
|
+
disposer = render$1(code, element, [...element.childNodes], options);
|
|
514
586
|
});
|
|
515
587
|
return () => disposer && disposer();
|
|
516
588
|
}
|
|
@@ -622,17 +694,32 @@ function runHydrationEvents() {
|
|
|
622
694
|
const [el, e] = events[0];
|
|
623
695
|
if (!completed.has(el)) return;
|
|
624
696
|
events.shift();
|
|
625
|
-
let
|
|
697
|
+
let matchContainer, matchState, matchDistance, matches;
|
|
626
698
|
for (const [container, state] of delegatedContainers) {
|
|
627
699
|
if (!state.handlers.has(e.type)) continue;
|
|
628
700
|
const entry = findOwner(e.target, state);
|
|
629
|
-
if (
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
701
|
+
if (!entry) continue;
|
|
702
|
+
if (matchContainer) {
|
|
703
|
+
if (!matches) matches = [{
|
|
704
|
+
container: matchContainer,
|
|
705
|
+
state: matchState,
|
|
706
|
+
distance: matchDistance
|
|
707
|
+
}];
|
|
708
|
+
matches.push({
|
|
709
|
+
container,
|
|
710
|
+
state,
|
|
711
|
+
distance: entry.distance
|
|
712
|
+
});
|
|
713
|
+
} else {
|
|
714
|
+
matchContainer = container;
|
|
715
|
+
matchState = state;
|
|
716
|
+
matchDistance = entry.distance;
|
|
717
|
+
}
|
|
634
718
|
}
|
|
635
|
-
if (
|
|
719
|
+
if (matches) {
|
|
720
|
+
matches.sort((a, b) => a.distance - b.distance);
|
|
721
|
+
for (let i = 0; i < matches.length; i++) eventHandler(e, matches[i].container, matches[i].state);
|
|
722
|
+
} else if (matchContainer) eventHandler(e, matchContainer, matchState);
|
|
636
723
|
}
|
|
637
724
|
if (sharedConfig.done) {
|
|
638
725
|
sharedConfig.events = _$HY.events = null;
|
|
@@ -703,11 +790,16 @@ function eventHandler(e, container, state) {
|
|
|
703
790
|
if (sharedConfig.registry && sharedConfig.events) {
|
|
704
791
|
if (sharedConfig.events.find(([el, ev]) => ev === e)) return;
|
|
705
792
|
}
|
|
706
|
-
|
|
793
|
+
const prev = e[$$EVENT_OWNER];
|
|
794
|
+
let resumeNode;
|
|
795
|
+
if (prev) {
|
|
796
|
+
if (prev === true || prev === container || !container.contains(prev)) return;
|
|
797
|
+
resumeNode = prev;
|
|
798
|
+
}
|
|
707
799
|
const owner = state && (state.owners.size === 1 && state.owners.has(container) ? container : findOwner(e.target, state)?.owner);
|
|
708
800
|
if (state && !owner) return;
|
|
709
801
|
e[$$EVENT_OWNER] = owner || true;
|
|
710
|
-
let node = e.target;
|
|
802
|
+
let node = resumeNode || e.target;
|
|
711
803
|
const key = `$$${e.type}`;
|
|
712
804
|
const oriTarget = e.target;
|
|
713
805
|
const boundary = owner || container || e.currentTarget;
|
|
@@ -737,7 +829,10 @@ function eventHandler(e, container, state) {
|
|
|
737
829
|
return node || boundary || document;
|
|
738
830
|
}
|
|
739
831
|
});
|
|
740
|
-
if (
|
|
832
|
+
if (resumeNode) {
|
|
833
|
+
if (resumeNode === e.target) node = resumeNode._$host || resumeNode.parentNode || resumeNode.host;
|
|
834
|
+
if (node && node !== boundary) walkUpTree();
|
|
835
|
+
} else if (e.composedPath) {
|
|
741
836
|
const path = e.composedPath();
|
|
742
837
|
if (path.length) {
|
|
743
838
|
retarget(path[0]);
|
|
@@ -812,6 +907,17 @@ function normalize(value, current, multi, doNotUnwrap) {
|
|
|
812
907
|
}
|
|
813
908
|
return value;
|
|
814
909
|
}
|
|
910
|
+
function tagHost(value, host) {
|
|
911
|
+
if (Array.isArray(value)) {
|
|
912
|
+
for (let i = 0, len = value.length; i < len; i++) tagHost(value[i], host);
|
|
913
|
+
} else if (value && value.nodeType && value[$$HOST] !== host) {
|
|
914
|
+
value[$$HOST] = host;
|
|
915
|
+
Object.defineProperty(value, "_$host", {
|
|
916
|
+
get: host,
|
|
917
|
+
configurable: true
|
|
918
|
+
});
|
|
919
|
+
}
|
|
920
|
+
}
|
|
815
921
|
function appendNodes(parent, array, marker = null) {
|
|
816
922
|
for (let i = 0, len = array.length; i < len; i++) {
|
|
817
923
|
const n = array[i];
|
|
@@ -896,21 +1002,33 @@ function Portal(props) {
|
|
|
896
1002
|
const treeMarker = document.createTextNode(""),
|
|
897
1003
|
startMarker = document.createTextNode(""),
|
|
898
1004
|
endMarker = document.createTextNode(""),
|
|
899
|
-
mount = () =>
|
|
1005
|
+
mount = () => props.mount || document.body,
|
|
900
1006
|
content = createMemo(() => [startMarker, props.children]);
|
|
901
|
-
createRenderEffect(
|
|
1007
|
+
createRenderEffect(
|
|
1008
|
+
() => [mount(), content(), getOwner()], ([, c, owner]) => {
|
|
1009
|
+
const m = untrack(mount);
|
|
902
1010
|
m.appendChild(endMarker);
|
|
903
|
-
|
|
1011
|
+
const dispose = runWithOwner(owner, () => createRoot(d => {
|
|
1012
|
+
insert(m, c, endMarker, undefined, {
|
|
1013
|
+
host: () => treeMarker.parentNode
|
|
1014
|
+
});
|
|
1015
|
+
return d;
|
|
1016
|
+
}));
|
|
904
1017
|
return () => {
|
|
1018
|
+
dispose();
|
|
905
1019
|
let c = startMarker;
|
|
906
|
-
while (c
|
|
1020
|
+
while (c) {
|
|
907
1021
|
const n = c.nextSibling;
|
|
908
1022
|
m.removeChild(c);
|
|
1023
|
+
if (c === endMarker) break;
|
|
909
1024
|
c = n;
|
|
910
1025
|
}
|
|
911
1026
|
};
|
|
1027
|
+
}, {
|
|
1028
|
+
schedule: true
|
|
912
1029
|
});
|
|
913
|
-
createEffect(mount,
|
|
1030
|
+
createEffect(mount, () => {
|
|
1031
|
+
const m = untrack(mount);
|
|
914
1032
|
const ownerRoot = getDelegatedRoot(treeMarker);
|
|
915
1033
|
if (!ownerRoot || ownerRoot.contains(m)) return;
|
|
916
1034
|
registerDelegatedContainer(m, ownerRoot);
|
|
@@ -948,22 +1066,5 @@ function createElement(tagName, is = undefined) {
|
|
|
948
1066
|
is
|
|
949
1067
|
});
|
|
950
1068
|
}
|
|
951
|
-
function createElementProxy(el, marker) {
|
|
952
|
-
return new Proxy(el, {
|
|
953
|
-
get(target, prop) {
|
|
954
|
-
if (prop === "appendChild" || prop === "insertBefore") {
|
|
955
|
-
return (...args) => {
|
|
956
|
-
Object.defineProperty(args[0], "_$host", {
|
|
957
|
-
get: () => marker.parentNode,
|
|
958
|
-
configurable: true
|
|
959
|
-
});
|
|
960
|
-
target[prop](...args);
|
|
961
|
-
};
|
|
962
|
-
}
|
|
963
|
-
const value = Reflect.get(target, prop);
|
|
964
|
-
return typeof value === "function" ? value.bind(target) : value;
|
|
965
|
-
}
|
|
966
|
-
});
|
|
967
|
-
}
|
|
968
1069
|
|
|
969
|
-
export { voidFn as Assets, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, voidFn as HydrationScript, MathMLElements, Namespaces, Portal, RawTextElements, RequestContext, SVGElements, VoidElements, addEvent, applyRef, assign, className, delegateEvents, dynamic, dynamicProperty, effect, escape, voidFn as generateHydrationScript, voidFn as getAssets, getDelegatedRoot, getFirstChild, getHydrationKey, getNextElement, getNextMarker, getNextMatch, getNextSibling, voidFn as getRequestEvent, hydrate, insert, isDev, isServer, memo, mergeProps, ref, registerDelegatedContainer, registerDelegatedRoot, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, runHydrationEvents, setAttribute, setAttributeNS, setProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrStyle, style, template, unregisterDelegatedContainer, unregisterDelegatedRoot, voidFn as useAssets };
|
|
1070
|
+
export { voidFn as Assets, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, voidFn as HydrationScript, MathMLElements, Namespaces, Portal, RawTextElements, RequestContext, SVGElements, VoidElements, addEvent, applyRef, assign, className, delegateEvents, dynamic, dynamicProperty, effect, escape, voidFn as generateHydrationScript, voidFn as getAssets, getDelegatedRoot, getFirstChild, getHydrationKey, getNextElement, getNextMarker, getNextMatch, getNextSibling, voidFn as getRequestEvent, hydrate, insert, isDev, isServer, memo, mergeProps, ref, registerDelegatedContainer, registerDelegatedRoot, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, runHydrationEvents, scope, setAttribute, setAttributeNS, setProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrStyle, style, template, unregisterDelegatedContainer, unregisterDelegatedRoot, voidFn as useAssets };
|
package/dist/server.cjs
CHANGED
|
@@ -60,9 +60,9 @@ const syncOptions = {
|
|
|
60
60
|
sync: true
|
|
61
61
|
};
|
|
62
62
|
const effect = (fn, effectFn, options) => solidJs.createRenderEffect(fn, effectFn, options ? {
|
|
63
|
-
transparent: true,
|
|
64
63
|
sync: true,
|
|
65
|
-
...options
|
|
64
|
+
...options,
|
|
65
|
+
transparent: !options.scope
|
|
66
66
|
} : transparentOptions);
|
|
67
67
|
const memo = fn => solidJs.createMemo(() => fn(), syncOptions);
|
|
68
68
|
|
|
@@ -94,9 +94,15 @@ function getLocalHeaderScript(id) {
|
|
|
94
94
|
return seroval.getCrossReferenceHeader(id) + ";";
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
+
function joinAssetPath(base, file) {
|
|
98
|
+
if (/^(?:[a-z][a-z0-9+.-]*:)?\/\//i.test(file)) return file;
|
|
99
|
+
if (typeof base !== "string" || !base) base = "/";
|
|
100
|
+
if (base[base.length - 1] !== "/") base += "/";
|
|
101
|
+
return base + (file[0] === "/" ? file.slice(1) : file);
|
|
102
|
+
}
|
|
97
103
|
function resolveAssets(moduleUrl, manifest) {
|
|
98
104
|
if (!manifest) return null;
|
|
99
|
-
const base = manifest._base
|
|
105
|
+
const base = manifest._base;
|
|
100
106
|
const entry = manifest[moduleUrl];
|
|
101
107
|
if (!entry) return null;
|
|
102
108
|
const css = [];
|
|
@@ -107,8 +113,8 @@ function resolveAssets(moduleUrl, manifest) {
|
|
|
107
113
|
visited.add(key);
|
|
108
114
|
const e = manifest[key];
|
|
109
115
|
if (!e) return;
|
|
110
|
-
js.push(base
|
|
111
|
-
if (e.css) for (let i = 0; i < e.css.length; i++) css.push(base
|
|
116
|
+
js.push(joinAssetPath(base, e.file));
|
|
117
|
+
if (e.css) for (let i = 0; i < e.css.length; i++) css.push(joinAssetPath(base, e.css[i]));
|
|
112
118
|
if (e.imports) for (let i = 0; i < e.imports.length; i++) walk(e.imports[i]);
|
|
113
119
|
};
|
|
114
120
|
walk(moduleUrl);
|
|
@@ -497,38 +503,41 @@ function renderToStream(code, options = {}) {
|
|
|
497
503
|
}, {
|
|
498
504
|
id: renderId
|
|
499
505
|
});
|
|
500
|
-
function
|
|
501
|
-
if (
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
out += `<!--rh${newId}-->` + res.t[j + 1];
|
|
521
|
-
}
|
|
522
|
-
html = html.replace(marker, out);
|
|
523
|
-
for (const p of res.p) blockingPromises.add(p);
|
|
506
|
+
function resolveRootHoles() {
|
|
507
|
+
if (!rootHoles) return true;
|
|
508
|
+
const pending = [];
|
|
509
|
+
for (const {
|
|
510
|
+
id,
|
|
511
|
+
fn
|
|
512
|
+
} of rootHoles) {
|
|
513
|
+
const marker = `<!--rh${id}-->`;
|
|
514
|
+
const res = resolveSSRNode(fn);
|
|
515
|
+
if (!res.h.length) {
|
|
516
|
+
html = html.replace(marker, res.t[0]);
|
|
517
|
+
} else {
|
|
518
|
+
let out = res.t[0];
|
|
519
|
+
for (let j = 0; j < res.h.length; j++) {
|
|
520
|
+
const newId = nextHoleId++;
|
|
521
|
+
pending.push({
|
|
522
|
+
id: newId,
|
|
523
|
+
fn: res.h[j]
|
|
524
|
+
});
|
|
525
|
+
out += `<!--rh${newId}-->` + res.t[j + 1];
|
|
524
526
|
}
|
|
527
|
+
html = html.replace(marker, out);
|
|
528
|
+
for (const p of res.p) blockingPromises.add(p);
|
|
525
529
|
}
|
|
526
|
-
if (pending.length) {
|
|
527
|
-
rootHoles = pending;
|
|
528
|
-
return;
|
|
529
|
-
}
|
|
530
|
-
rootHoles = null;
|
|
531
530
|
}
|
|
531
|
+
if (pending.length) {
|
|
532
|
+
rootHoles = pending;
|
|
533
|
+
return false;
|
|
534
|
+
}
|
|
535
|
+
rootHoles = null;
|
|
536
|
+
return true;
|
|
537
|
+
}
|
|
538
|
+
function doShell() {
|
|
539
|
+
if (shellCompleted) return;
|
|
540
|
+
if (!resolveRootHoles()) return;
|
|
532
541
|
solidJs.sharedConfig.context = context;
|
|
533
542
|
html = injectAssets(context.assets, html);
|
|
534
543
|
headStyles = new Set();
|
|
@@ -560,7 +569,15 @@ function renderToStream(code, options = {}) {
|
|
|
560
569
|
complete();
|
|
561
570
|
};
|
|
562
571
|
} else onCompleteAll = complete;
|
|
563
|
-
|
|
572
|
+
function flush() {
|
|
573
|
+
allSettled(blockingPromises).then(() => {
|
|
574
|
+
setTimeout(() => {
|
|
575
|
+
if (!resolveRootHoles()) return flush();
|
|
576
|
+
queue(flushEnd);
|
|
577
|
+
});
|
|
578
|
+
});
|
|
579
|
+
}
|
|
580
|
+
flush();
|
|
564
581
|
},
|
|
565
582
|
pipe(w) {
|
|
566
583
|
function flush() {
|
|
@@ -941,29 +958,6 @@ function tryJoinPlainSSRArray(nodes) {
|
|
|
941
958
|
}
|
|
942
959
|
return out;
|
|
943
960
|
}
|
|
944
|
-
function mergeProps(...sources) {
|
|
945
|
-
const target = {};
|
|
946
|
-
for (let i = 0; i < sources.length; i++) {
|
|
947
|
-
let source = sources[i];
|
|
948
|
-
if (typeof source === "function") source = source();
|
|
949
|
-
if (source) {
|
|
950
|
-
const descriptors = Object.getOwnPropertyDescriptors(source);
|
|
951
|
-
for (const key in descriptors) {
|
|
952
|
-
if (key in target) continue;
|
|
953
|
-
Object.defineProperty(target, key, {
|
|
954
|
-
enumerable: true,
|
|
955
|
-
get() {
|
|
956
|
-
for (let i = sources.length - 1; i >= 0; i--) {
|
|
957
|
-
const v = (sources[i] || {})[key];
|
|
958
|
-
if (v !== undefined) return v;
|
|
959
|
-
}
|
|
960
|
-
}
|
|
961
|
-
});
|
|
962
|
-
}
|
|
963
|
-
}
|
|
964
|
-
}
|
|
965
|
-
return target;
|
|
966
|
-
}
|
|
967
961
|
function getHydrationKey() {
|
|
968
962
|
const hydrate = solidJs.sharedConfig.context;
|
|
969
963
|
return hydrate && solidJs.sharedConfig.getNextContextId();
|
|
@@ -1112,6 +1106,10 @@ function tryResolveString(node) {
|
|
|
1112
1106
|
if (node.h && node.h.length > 0) return {
|
|
1113
1107
|
merge: node
|
|
1114
1108
|
};
|
|
1109
|
+
if (node.t === undefined) {
|
|
1110
|
+
console.warn(`Unrecognized value. Skipped inserting`, node);
|
|
1111
|
+
return "";
|
|
1112
|
+
}
|
|
1115
1113
|
return Array.isArray(node.t) ? node.t[0] : node.t;
|
|
1116
1114
|
}
|
|
1117
1115
|
if (t === "function") {
|
|
@@ -1150,7 +1148,9 @@ function resolveSSRNode(node, result = {
|
|
|
1150
1148
|
result.h.push(...node.h);
|
|
1151
1149
|
result.p.push(...node.p);
|
|
1152
1150
|
}
|
|
1153
|
-
} else
|
|
1151
|
+
} else if (node.t !== undefined) {
|
|
1152
|
+
result.t[result.t.length - 1] += node.t;
|
|
1153
|
+
} else console.warn(`Unrecognized value. Skipped inserting`, node);
|
|
1154
1154
|
} else if (t === "function") {
|
|
1155
1155
|
try {
|
|
1156
1156
|
resolveSSRNode(node(), result);
|
|
@@ -1187,15 +1187,38 @@ function dynamic(source) {
|
|
|
1187
1187
|
const o = solidJs.getOwner();
|
|
1188
1188
|
if (o?.id != null) solidJs.getNextChildId(o);
|
|
1189
1189
|
return props => {
|
|
1190
|
-
const
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1190
|
+
const comp = source();
|
|
1191
|
+
let p;
|
|
1192
|
+
let settled = false;
|
|
1193
|
+
let value;
|
|
1194
|
+
let error;
|
|
1195
|
+
if (comp && typeof comp.then === "function") {
|
|
1196
|
+
p = comp;
|
|
1197
|
+
p.then(v => {
|
|
1198
|
+
value = v;
|
|
1199
|
+
settled = true;
|
|
1200
|
+
}, err => {
|
|
1201
|
+
error = err;
|
|
1202
|
+
settled = true;
|
|
1203
|
+
});
|
|
1204
|
+
const ctx = solidJs.sharedConfig.context;
|
|
1205
|
+
if (ctx?.async) ctx.block(p.then(() => {}, () => {}));
|
|
1206
|
+
}
|
|
1207
|
+
return solidJs.createMemo(() => {
|
|
1208
|
+
let c = comp;
|
|
1209
|
+
if (p) {
|
|
1210
|
+
if (!settled) throw new solidJs.NotReadyError(p);
|
|
1211
|
+
if (error) throw error;
|
|
1212
|
+
c = value;
|
|
1213
|
+
}
|
|
1214
|
+
if (c) {
|
|
1215
|
+
if (typeof c === "function") return c(props);
|
|
1216
|
+
if (typeof c === "string") {
|
|
1217
|
+
return ssrElement(c, props, undefined, true);
|
|
1197
1218
|
}
|
|
1198
1219
|
}
|
|
1220
|
+
}, {
|
|
1221
|
+
sync: true
|
|
1199
1222
|
});
|
|
1200
1223
|
};
|
|
1201
1224
|
}
|
|
@@ -1255,6 +1278,14 @@ Object.defineProperty(exports, "getOwner", {
|
|
|
1255
1278
|
enumerable: true,
|
|
1256
1279
|
get: function () { return solidJs.getOwner; }
|
|
1257
1280
|
});
|
|
1281
|
+
Object.defineProperty(exports, "mergeProps", {
|
|
1282
|
+
enumerable: true,
|
|
1283
|
+
get: function () { return solidJs.merge; }
|
|
1284
|
+
});
|
|
1285
|
+
Object.defineProperty(exports, "scope", {
|
|
1286
|
+
enumerable: true,
|
|
1287
|
+
get: function () { return solidJs.ssrScope; }
|
|
1288
|
+
});
|
|
1258
1289
|
Object.defineProperty(exports, "untrack", {
|
|
1259
1290
|
enumerable: true,
|
|
1260
1291
|
get: function () { return solidJs.untrack; }
|
|
@@ -1295,7 +1326,6 @@ exports.insert = notSup;
|
|
|
1295
1326
|
exports.isDev = isDev;
|
|
1296
1327
|
exports.isServer = isServer;
|
|
1297
1328
|
exports.memo = memo;
|
|
1298
|
-
exports.mergeProps = mergeProps;
|
|
1299
1329
|
exports.ref = notSup;
|
|
1300
1330
|
exports.registerDelegatedContainer = notSup;
|
|
1301
1331
|
exports.registerDelegatedRoot = notSup;
|