@solidjs/web 2.0.0-beta.31 → 2.0.0-beta.33
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/README.md +1 -6
- package/dist/dev.cjs +285 -60
- package/dist/dev.js +267 -57
- package/dist/server.cjs +1148 -176
- package/dist/server.js +1133 -175
- package/dist/web.cjs +285 -60
- package/dist/web.js +267 -57
- package/frames/dist/client.cjs +397 -175
- package/frames/dist/client.dev.cjs +401 -175
- package/frames/dist/client.dev.js +399 -173
- package/frames/dist/client.js +395 -173
- package/frames/dist/server.cjs +1424 -277
- package/frames/dist/server.js +1426 -280
- package/package.json +69 -7
- package/serialization/decode/package.json +20 -0
- package/serialization/dist/decode.cjs +110 -0
- package/serialization/dist/decode.js +104 -0
- package/serialization/dist/serialization.cjs +106 -43
- package/serialization/dist/serialization.js +100 -44
- package/serialization/types/index.d.ts +85 -60
- package/serialization/types/serializer-decode.d.ts +182 -0
- package/serialization/types-cjs/index.d.cts +85 -60
- package/serialization/types-cjs/serializer-decode.d.cts +182 -0
- package/server-functions/dist/client.cjs +131 -98
- package/server-functions/dist/client.js +131 -99
- package/server-functions/dist/rich-args.cjs +11 -0
- package/server-functions/dist/rich-args.js +9 -0
- package/server-functions/dist/server.cjs +367 -194
- package/server-functions/dist/server.dev.cjs +1077 -0
- package/server-functions/dist/server.dev.js +1045 -0
- package/server-functions/dist/server.js +365 -195
- package/server-functions/package.json +10 -0
- package/server-functions/rich-args/package.json +20 -0
- package/storage/types/index.d.ts +1 -1
- package/storage/types-cjs/index.d.cts +1 -1
- package/types/client.d.ts +149 -6
- package/types/cookies.d.ts +93 -0
- package/types/core.d.ts +4 -2
- package/types/frames/client.d.ts +15 -1
- package/types/frames/frame-client.d.ts +63 -7
- package/types/frames/frame-sink.d.ts +26 -3
- package/types/frames/frame-transport.d.ts +40 -8
- package/types/frames/serializer.d.ts +85 -60
- package/types/frames/server.d.ts +22 -0
- package/types/index.d.ts +2 -3
- package/types/response.d.ts +45 -0
- package/types/serializer-decode.d.ts +182 -0
- package/types/serializer.d.ts +85 -60
- package/types/server-functions/client.d.ts +2 -1
- package/types/server-functions/rich-args.d.ts +10 -0
- package/types/server-functions/server.d.ts +99 -1
- package/types/server-functions/shared.d.ts +79 -1
- package/types/server-mock.d.ts +171 -59
- package/types/server.d.ts +209 -37
- package/types-cjs/client.d.cts +149 -6
- package/types-cjs/cookies.d.cts +93 -0
- package/types-cjs/core.d.cts +4 -2
- package/types-cjs/frames/client.d.cts +15 -1
- package/types-cjs/frames/frame-client.d.cts +63 -7
- package/types-cjs/frames/frame-sink.d.cts +26 -3
- package/types-cjs/frames/frame-transport.d.cts +40 -8
- package/types-cjs/frames/serializer.d.cts +85 -60
- package/types-cjs/frames/server.d.cts +22 -0
- package/types-cjs/index.d.cts +2 -3
- package/types-cjs/response.d.cts +45 -0
- package/types-cjs/serializer-decode.d.cts +182 -0
- package/types-cjs/serializer.d.cts +85 -60
- package/types-cjs/server-functions/client.d.cts +2 -1
- package/types-cjs/server-functions/rich-args.d.cts +10 -0
- package/types-cjs/server-functions/server.d.cts +99 -1
- package/types-cjs/server-functions/shared.d.cts +79 -1
- package/types-cjs/server-mock.d.cts +171 -59
- package/types-cjs/server.d.cts +209 -37
package/dist/web.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createRenderEffect, createMemo, sharedConfig, untrack,
|
|
1
|
+
import { createRenderEffect, createMemo, runWithOwner, sharedConfig, untrack, flatten, createRoot, merge, createComponent, omit, createOwner, createSignal, onCleanup, enableHydration, flush, getOwner, createEffect } 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 = {
|
|
@@ -62,6 +62,17 @@ const effect = (fn, effectFn, options) => createRenderEffect(fn, effectFn, optio
|
|
|
62
62
|
transparent: !options.scope
|
|
63
63
|
} : transparentOptions);
|
|
64
64
|
const memo = fn => createMemo(() => fn(), syncOptions);
|
|
65
|
+
const assetGates = new WeakMap();
|
|
66
|
+
const waitAsset = promise => {
|
|
67
|
+
let gate = assetGates.get(promise);
|
|
68
|
+
if (!gate) {
|
|
69
|
+
runWithOwner(null, () => {
|
|
70
|
+
gate = createMemo(() => promise);
|
|
71
|
+
});
|
|
72
|
+
assetGates.set(promise, gate);
|
|
73
|
+
}
|
|
74
|
+
gate();
|
|
75
|
+
};
|
|
65
76
|
|
|
66
77
|
function reconcileArrays(parentNode, a, b, marker) {
|
|
67
78
|
let bLength = b.length,
|
|
@@ -173,6 +184,7 @@ const HEAD_ELIGIBLE_TAGS = new Set(["title", "meta", "link", "style", "script",
|
|
|
173
184
|
const HEAD_ATTR_NAME = /^[a-zA-Z_][a-zA-Z0-9_:.-]*$/;
|
|
174
185
|
const RESOURCE_LINK_RELS = new Set(["preload", "modulepreload", "prefetch", "preconnect", "dns-prefetch", "stylesheet"]);
|
|
175
186
|
const RESOURCE_QUALIFIERS = ["as", "crossorigin", "type", "media", "imagesrcset", "imagesizes"];
|
|
187
|
+
const STYLESHEET_FETCH_META = new Set(["crossorigin", "integrity", "referrerpolicy", "fetchpriority"]);
|
|
176
188
|
function evalHeadValue(v) {
|
|
177
189
|
return typeof v === "function" ? v() : v;
|
|
178
190
|
}
|
|
@@ -253,6 +265,64 @@ function resolveHead(groups) {
|
|
|
253
265
|
return winners;
|
|
254
266
|
}
|
|
255
267
|
|
|
268
|
+
function parseCookieHeader(header) {
|
|
269
|
+
const cookies = {};
|
|
270
|
+
if (!header) return cookies;
|
|
271
|
+
for (const part of header.split(";")) {
|
|
272
|
+
const eq = part.indexOf("=");
|
|
273
|
+
if (eq < 0) continue;
|
|
274
|
+
const name = decodeSafe(part.slice(0, eq).trim());
|
|
275
|
+
let value = part.slice(eq + 1).trim();
|
|
276
|
+
if (value.length > 1 && value[0] === '"' && value[value.length - 1] === '"') {
|
|
277
|
+
value = value.slice(1, -1);
|
|
278
|
+
}
|
|
279
|
+
cookies[name] = decodeSafe(value);
|
|
280
|
+
}
|
|
281
|
+
return cookies;
|
|
282
|
+
}
|
|
283
|
+
function decodeSafe(text) {
|
|
284
|
+
try {
|
|
285
|
+
return decodeURIComponent(text);
|
|
286
|
+
} catch {
|
|
287
|
+
return text;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
function serializeCookie(name, value, options = {}) {
|
|
291
|
+
let cookie = `${encodeURIComponent(name)}=${encodeURIComponent(value)}`;
|
|
292
|
+
cookie += `; Path=${options.path === undefined ? "/" : options.path}`;
|
|
293
|
+
if (options.domain) cookie += `; Domain=${options.domain}`;
|
|
294
|
+
if (options.maxAge !== undefined) cookie += `; Max-Age=${Math.trunc(options.maxAge)}`;
|
|
295
|
+
if (options.expires) cookie += `; Expires=${options.expires.toUTCString()}`;
|
|
296
|
+
if (options.httpOnly) cookie += "; HttpOnly";
|
|
297
|
+
if (options.secure) cookie += "; Secure";
|
|
298
|
+
if (options.sameSite) {
|
|
299
|
+
const sameSite = options.sameSite.toLowerCase();
|
|
300
|
+
cookie += `; SameSite=${sameSite === "none" ? "None" : sameSite === "strict" ? "Strict" : "Lax"}`;
|
|
301
|
+
}
|
|
302
|
+
return cookie;
|
|
303
|
+
}
|
|
304
|
+
const FLASH_COOKIE = "flash";
|
|
305
|
+
const FLASH_MATCHER = new RegExp(`(?:^|;\\s*)${FLASH_COOKIE}=([^;]+)`);
|
|
306
|
+
function hasFlashCookie(cookieHeader) {
|
|
307
|
+
return !!cookieHeader && FLASH_MATCHER.test(cookieHeader);
|
|
308
|
+
}
|
|
309
|
+
function clearFlashCookie() {
|
|
310
|
+
return `${FLASH_COOKIE}=; Max-Age=0; Path=/`;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
const SERVER_FUNCTION_METADATA = Symbol.for("solid.ServerFunctionMetadata");
|
|
314
|
+
function getServerFunctionMetadata(fn) {
|
|
315
|
+
if (typeof fn !== "function") return undefined;
|
|
316
|
+
return fn[SERVER_FUNCTION_METADATA] || undefined;
|
|
317
|
+
}
|
|
318
|
+
function isServerFunction(fn) {
|
|
319
|
+
return typeof fn === "function" && !!fn[SERVER_FUNCTION_METADATA];
|
|
320
|
+
}
|
|
321
|
+
const SERVER_FUNCTION_RPC = Symbol.for("solid.ServerFunctionRPC");
|
|
322
|
+
function getServerFunctionRPC() {
|
|
323
|
+
return globalThis[SERVER_FUNCTION_RPC];
|
|
324
|
+
}
|
|
325
|
+
|
|
256
326
|
const $$EVENT_OWNER = "_$DX_EVENT_OWNER";
|
|
257
327
|
const INNER_OWNED = {};
|
|
258
328
|
const delegatedEvents = new Set();
|
|
@@ -602,8 +672,7 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
602
672
|
const value = normalize(accessor(), current, multi, true);
|
|
603
673
|
if (typeof value !== "function") return value;
|
|
604
674
|
effect(() => (hydrationRt !== null && (current = hydrationRt.reclaimRegion(current, parent, marker)), normalize(value, current, multi)), inner => {
|
|
605
|
-
insertExpression(parent, inner, current, marker);
|
|
606
|
-
current = inner;
|
|
675
|
+
current = insertExpression(parent, inner, current, marker);
|
|
607
676
|
host && tagHost(current, host);
|
|
608
677
|
}, prev !== undefined && !(options && options.schedule) ? {
|
|
609
678
|
...options,
|
|
@@ -612,8 +681,7 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
612
681
|
return INNER_OWNED;
|
|
613
682
|
}, value => {
|
|
614
683
|
if (value === INNER_OWNED) return;
|
|
615
|
-
insertExpression(parent, value, current, marker);
|
|
616
|
-
current = value;
|
|
684
|
+
current = insertExpression(parent, value, current, marker);
|
|
617
685
|
host && tagHost(current, host);
|
|
618
686
|
},
|
|
619
687
|
accessor.$s ? options ? {
|
|
@@ -651,6 +719,9 @@ function findAssetElement(selector, attr, value) {
|
|
|
651
719
|
}
|
|
652
720
|
return null;
|
|
653
721
|
}
|
|
722
|
+
function setAssetAttrs(el, attrs) {
|
|
723
|
+
for (const name in attrs) el.setAttribute(name, attrs[name]);
|
|
724
|
+
}
|
|
654
725
|
function mountAssetElement(descriptor) {
|
|
655
726
|
let el;
|
|
656
727
|
if (descriptor.type === "inline-style") {
|
|
@@ -669,12 +740,77 @@ function mountAssetElement(descriptor) {
|
|
|
669
740
|
el.href = descriptor.href;
|
|
670
741
|
}
|
|
671
742
|
}
|
|
672
|
-
if (descriptor.attrs)
|
|
673
|
-
for (const name in descriptor.attrs) el.setAttribute(name, descriptor.attrs[name]);
|
|
674
|
-
}
|
|
743
|
+
if (descriptor.attrs) setAssetAttrs(el, descriptor.attrs);
|
|
675
744
|
if (!el.isConnected) document.head.appendChild(el);
|
|
676
745
|
return el;
|
|
677
746
|
}
|
|
747
|
+
const assetLoadSettled = /*#__PURE__*/Promise.resolve();
|
|
748
|
+
function trackAssetLoad(entry, adopted) {
|
|
749
|
+
if (entry.loadPromise) return;
|
|
750
|
+
const el = entry.element;
|
|
751
|
+
let settled = el.sheet != null;
|
|
752
|
+
if (!settled && adopted && typeof performance !== "undefined" && performance.getEntriesByName) {
|
|
753
|
+
settled = performance.getEntriesByName(el.href).length > 0;
|
|
754
|
+
}
|
|
755
|
+
if (settled) {
|
|
756
|
+
entry.loadState = "loaded";
|
|
757
|
+
entry.loadPromise = assetLoadSettled;
|
|
758
|
+
return;
|
|
759
|
+
}
|
|
760
|
+
entry.loadState = "pending";
|
|
761
|
+
entry.loadPromise = new Promise(resolve => {
|
|
762
|
+
const settle = state => {
|
|
763
|
+
entry.loadState = state;
|
|
764
|
+
resolve();
|
|
765
|
+
};
|
|
766
|
+
el.addEventListener("load", () => settle("loaded"), {
|
|
767
|
+
once: true
|
|
768
|
+
});
|
|
769
|
+
el.addEventListener("error", () => settle("errored"), {
|
|
770
|
+
once: true
|
|
771
|
+
});
|
|
772
|
+
});
|
|
773
|
+
}
|
|
774
|
+
function warmAsset(descriptor) {
|
|
775
|
+
if (descriptor.policy === "exclusive" || descriptor.type === "inline-style") return;
|
|
776
|
+
const key = assetEntryKey(descriptor);
|
|
777
|
+
let entry = assetRegistry.get(key);
|
|
778
|
+
if (!entry) {
|
|
779
|
+
entry = {
|
|
780
|
+
count: 0,
|
|
781
|
+
element: null,
|
|
782
|
+
timer: null
|
|
783
|
+
};
|
|
784
|
+
assetRegistry.set(key, entry);
|
|
785
|
+
}
|
|
786
|
+
let adopted = true;
|
|
787
|
+
if (!entry.element || !entry.element.isConnected) {
|
|
788
|
+
const rel = descriptor.type === "module" ? "modulepreload" : "stylesheet";
|
|
789
|
+
let el = findAssetElement(`link[rel="${rel}"]`, "href", descriptor.href);
|
|
790
|
+
if (!el && descriptor.type === "style") {
|
|
791
|
+
el = findAssetElement('link[rel="preload"][as="style"]', "href", descriptor.href);
|
|
792
|
+
}
|
|
793
|
+
if (!el) {
|
|
794
|
+
adopted = false;
|
|
795
|
+
el = document.createElement("link");
|
|
796
|
+
if (descriptor.type === "style") {
|
|
797
|
+
el.setAttribute("rel", "preload");
|
|
798
|
+
el.setAttribute("as", "style");
|
|
799
|
+
} else {
|
|
800
|
+
el.setAttribute("rel", "modulepreload");
|
|
801
|
+
}
|
|
802
|
+
el.setAttribute("href", descriptor.href);
|
|
803
|
+
if (!document.body) el.setAttribute("blocking", "render");
|
|
804
|
+
}
|
|
805
|
+
if (descriptor.attrs) setAssetAttrs(el, descriptor.attrs);
|
|
806
|
+
if (!el.isConnected) document.head.appendChild(el);
|
|
807
|
+
entry.element = el;
|
|
808
|
+
entry.loadState = undefined;
|
|
809
|
+
entry.loadPromise = undefined;
|
|
810
|
+
}
|
|
811
|
+
if (descriptor.type === "style") trackAssetLoad(entry, adopted);
|
|
812
|
+
return entry;
|
|
813
|
+
}
|
|
678
814
|
function acquireAsset(descriptor) {
|
|
679
815
|
const key = assetEntryKey(descriptor);
|
|
680
816
|
let entry = assetRegistry.get(key);
|
|
@@ -721,7 +857,12 @@ function acquireAsset(descriptor) {
|
|
|
721
857
|
entry.timer = null;
|
|
722
858
|
}
|
|
723
859
|
entry.count++;
|
|
724
|
-
if (!entry.element || !entry.element.isConnected)
|
|
860
|
+
if (!entry.element || !entry.element.isConnected) {
|
|
861
|
+
entry.element = mountAssetElement(descriptor);
|
|
862
|
+
} else if (descriptor.type === "style" && entry.element.getAttribute("rel") === "preload") {
|
|
863
|
+
entry.element.removeAttribute("as");
|
|
864
|
+
entry.element.setAttribute("rel", "stylesheet");
|
|
865
|
+
}
|
|
725
866
|
let released = false;
|
|
726
867
|
return () => {
|
|
727
868
|
if (released) return;
|
|
@@ -868,25 +1009,9 @@ function headElementMatches(el, t) {
|
|
|
868
1009
|
const children = t.props.children;
|
|
869
1010
|
return (children == null ? "" : String(children)) === el.textContent;
|
|
870
1011
|
}
|
|
871
|
-
function
|
|
872
|
-
if (tag === "link" && (props.rel === "stylesheet" || props.rel === "modulepreload")) {
|
|
873
|
-
const descriptor = {
|
|
874
|
-
type: props.rel === "stylesheet" ? "style" : "module",
|
|
875
|
-
href: props.href
|
|
876
|
-
};
|
|
877
|
-
let attrs = null;
|
|
878
|
-
for (const name in props) {
|
|
879
|
-
if (name === "rel" || name === "href") continue;
|
|
880
|
-
if (!HEAD_ATTR_NAME.test(name)) continue;
|
|
881
|
-
const v = props[name];
|
|
882
|
-
if (v == null || v === false) continue;
|
|
883
|
-
(attrs || (attrs = {}))[name] = v === true ? "" : String(v);
|
|
884
|
-
}
|
|
885
|
-
if (attrs) descriptor.attrs = attrs;
|
|
886
|
-
return acquireAsset(descriptor);
|
|
887
|
-
}
|
|
1012
|
+
function mountHeadResource(tag, props) {
|
|
888
1013
|
const identity = resourceIdentity(tag, props);
|
|
889
|
-
if (headMountedResources.has(identity)) return
|
|
1014
|
+
if (headMountedResources.has(identity)) return;
|
|
890
1015
|
headMountedResources.add(identity);
|
|
891
1016
|
const url = props.href || props.src;
|
|
892
1017
|
let el = null;
|
|
@@ -894,9 +1019,28 @@ function acquireHeadResource(tag, props) {
|
|
|
894
1019
|
if (tag === "link") el = findAssetElement(`link[rel="${props.rel}"]`, "href", url);else if (tag === "script") el = findAssetElement("script[src]", "src", url);else el = findAssetElement("style[href]", "href", url);
|
|
895
1020
|
}
|
|
896
1021
|
if (!el) document.head.appendChild(createHeadElement(tag, props));
|
|
897
|
-
return noopFn;
|
|
898
1022
|
}
|
|
899
|
-
function
|
|
1023
|
+
function gateHeadResource(props) {
|
|
1024
|
+
const descriptor = {
|
|
1025
|
+
type: props.rel === "stylesheet" ? "style" : "module",
|
|
1026
|
+
href: props.href
|
|
1027
|
+
};
|
|
1028
|
+
let gateable = props.rel === "stylesheet" && props.href != null;
|
|
1029
|
+
let attrs = null;
|
|
1030
|
+
for (const name in props) {
|
|
1031
|
+
if (name === "rel" || name === "href") continue;
|
|
1032
|
+
if (!STYLESHEET_FETCH_META.has(name)) gateable = false;
|
|
1033
|
+
if (!HEAD_ATTR_NAME.test(name)) continue;
|
|
1034
|
+
const v = props[name];
|
|
1035
|
+
if (v == null || v === false) continue;
|
|
1036
|
+
(attrs || (attrs = {}))[name] = v === true ? "" : String(v);
|
|
1037
|
+
}
|
|
1038
|
+
if (attrs) descriptor.attrs = attrs;
|
|
1039
|
+
effect(() => {
|
|
1040
|
+
const entry = warmAsset(descriptor);
|
|
1041
|
+
if (gateable && entry.loadState === "pending" && typeof waitAsset === "function") waitAsset(entry.loadPromise);
|
|
1042
|
+
}, () => acquireAsset(descriptor));
|
|
1043
|
+
}
|
|
900
1044
|
function useHead(tags) {
|
|
901
1045
|
initHeadRegistry();
|
|
902
1046
|
const reg = {
|
|
@@ -919,10 +1063,16 @@ function useHead(tags) {
|
|
|
919
1063
|
rel: cls.rel
|
|
920
1064
|
} : undefined);
|
|
921
1065
|
if (cls.resource) {
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
1066
|
+
if (desc.tag === "link" && (props.rel === "stylesheet" || props.rel === "modulepreload")) {
|
|
1067
|
+
gateHeadResource(props);
|
|
1068
|
+
} else if (desc.tag === "link") {
|
|
1069
|
+
mountHeadResource(desc.tag, props);
|
|
1070
|
+
} else {
|
|
1071
|
+
resources.push({
|
|
1072
|
+
tag: desc.tag,
|
|
1073
|
+
props
|
|
1074
|
+
});
|
|
1075
|
+
}
|
|
926
1076
|
} else {
|
|
927
1077
|
const key = evalHeadValue(desc.key);
|
|
928
1078
|
replaceable.push({
|
|
@@ -937,9 +1087,8 @@ function useHead(tags) {
|
|
|
937
1087
|
resources
|
|
938
1088
|
};
|
|
939
1089
|
}, evaluated => {
|
|
940
|
-
const releases = [];
|
|
941
1090
|
for (let i = 0; i < evaluated.resources.length; i++) {
|
|
942
|
-
|
|
1091
|
+
mountHeadResource(evaluated.resources[i].tag, evaluated.resources[i].props);
|
|
943
1092
|
}
|
|
944
1093
|
reg.tags = evaluated.replaceable;
|
|
945
1094
|
if (reg.seq < 0) reg.seq = ++headSeq;
|
|
@@ -948,7 +1097,6 @@ function useHead(tags) {
|
|
|
948
1097
|
return () => {
|
|
949
1098
|
const idx = headRegistrations.indexOf(reg);
|
|
950
1099
|
if (idx > -1) headRegistrations.splice(idx, 1);
|
|
951
|
-
for (let i = 0; i < releases.length; i++) releases[i]();
|
|
952
1100
|
scheduleHeadApply();
|
|
953
1101
|
};
|
|
954
1102
|
});
|
|
@@ -1262,8 +1410,11 @@ function eventHandler(e, container, state) {
|
|
|
1262
1410
|
retarget(oriTarget);
|
|
1263
1411
|
}
|
|
1264
1412
|
function insertExpression(parent, value, current, marker) {
|
|
1265
|
-
if (hydrationRt !== null && isHydrating(parent))
|
|
1266
|
-
|
|
1413
|
+
if (hydrationRt !== null && isHydrating(parent)) {
|
|
1414
|
+
if (value && value !== current) for (const n of Array.isArray(value) ? value : [value]) if (n && n.nodeType && !isHydrating(n)) return current;
|
|
1415
|
+
return value;
|
|
1416
|
+
}
|
|
1417
|
+
if (value === current) return value;
|
|
1267
1418
|
const t = typeof value,
|
|
1268
1419
|
multi = marker !== undefined;
|
|
1269
1420
|
if (t === "string" || t === "number") {
|
|
@@ -1302,6 +1453,7 @@ function insertExpression(parent, value, current, marker) {
|
|
|
1302
1453
|
appendNodes(parent, value);
|
|
1303
1454
|
}
|
|
1304
1455
|
} else ;
|
|
1456
|
+
return value;
|
|
1305
1457
|
}
|
|
1306
1458
|
function normalize(value, current, multi, doNotUnwrap) {
|
|
1307
1459
|
value = flatten(value, {
|
|
@@ -1384,7 +1536,13 @@ function gatherHydratable(element, root) {
|
|
|
1384
1536
|
for (let i = 0; i < templates.length; i++) {
|
|
1385
1537
|
const node = templates[i];
|
|
1386
1538
|
const key = node.getAttribute("_hk");
|
|
1387
|
-
if (
|
|
1539
|
+
if (root) {
|
|
1540
|
+
if (!key.startsWith(root)) continue;
|
|
1541
|
+
} else {
|
|
1542
|
+
const frame = node.closest("[data-fid]");
|
|
1543
|
+
if (frame && frame !== element && element.contains(frame)) continue;
|
|
1544
|
+
}
|
|
1545
|
+
if (!sharedConfig.registry.has(key)) sharedConfig.registry.set(key, node);
|
|
1388
1546
|
}
|
|
1389
1547
|
}
|
|
1390
1548
|
function getHydrationKey() {
|
|
@@ -1400,29 +1558,50 @@ function throwInBrowser(func) {
|
|
|
1400
1558
|
function renderToString(fn, options) {
|
|
1401
1559
|
throwInBrowser(renderToString);
|
|
1402
1560
|
}
|
|
1403
|
-
function renderToStringAsync(fn, options) {
|
|
1404
|
-
throwInBrowser(renderToStringAsync);
|
|
1405
|
-
}
|
|
1406
1561
|
function renderToStream(fn, options) {
|
|
1407
1562
|
throwInBrowser(renderToStream);
|
|
1408
1563
|
}
|
|
1564
|
+
function createResponseStub() {
|
|
1565
|
+
throwInBrowser(createResponseStub);
|
|
1566
|
+
}
|
|
1567
|
+
function createRequestEvent(request, init) {
|
|
1568
|
+
throwInBrowser(createRequestEvent);
|
|
1569
|
+
}
|
|
1570
|
+
function getExpectedRedirectStatus(response) {
|
|
1571
|
+
throwInBrowser(getExpectedRedirectStatus);
|
|
1572
|
+
}
|
|
1573
|
+
function createSSRResponse() {
|
|
1574
|
+
throwInBrowser(createSSRResponse);
|
|
1575
|
+
}
|
|
1576
|
+
function commitEventResponse(response, event) {
|
|
1577
|
+
throwInBrowser(commitEventResponse);
|
|
1578
|
+
}
|
|
1579
|
+
function composeMiddleware(middlewares) {
|
|
1580
|
+
throwInBrowser(composeMiddleware);
|
|
1581
|
+
}
|
|
1409
1582
|
function ssr(template, ...nodes) {}
|
|
1410
1583
|
function ssrElement(name, props, children, needsId) {}
|
|
1411
|
-
function
|
|
1584
|
+
function ssrClassName(value) {}
|
|
1412
1585
|
function ssrStyle(value) {}
|
|
1586
|
+
function ssrStyleProperty(name, value) {}
|
|
1413
1587
|
function ssrAttribute(key, value) {}
|
|
1588
|
+
function ssrGroup(fn, n) {}
|
|
1414
1589
|
function ssrHydrationKey() {}
|
|
1415
|
-
function resolveSSRNode(node) {}
|
|
1416
|
-
function escape(
|
|
1590
|
+
function resolveSSRNode(node, result, top) {}
|
|
1591
|
+
function escape(s, attr) {}
|
|
1417
1592
|
|
|
1418
1593
|
const ENVELOPE = Symbol.for("solid.ResponseEnvelope");
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1594
|
+
// PURE-annotated factory (same convention as solid's MockPromise): the brand
|
|
1595
|
+
const ResponseEnvelope = /* @__PURE__ */(() => {
|
|
1596
|
+
class ResponseEnvelope {
|
|
1597
|
+
constructor(response, value) {
|
|
1598
|
+
this.response = response;
|
|
1599
|
+
this.value = value;
|
|
1600
|
+
}
|
|
1423
1601
|
}
|
|
1424
|
-
|
|
1425
|
-
ResponseEnvelope
|
|
1602
|
+
ResponseEnvelope.prototype[ENVELOPE] = true;
|
|
1603
|
+
return ResponseEnvelope;
|
|
1604
|
+
})();
|
|
1426
1605
|
function isResponseEnvelope(value) {
|
|
1427
1606
|
return !!(value && typeof value === "object" && value[ENVELOPE]);
|
|
1428
1607
|
}
|
|
@@ -1430,13 +1609,38 @@ const HREF = Symbol.for("solid.Href");
|
|
|
1430
1609
|
function isHref(value) {
|
|
1431
1610
|
return !!(value && (typeof value === "object" || typeof value === "function") && value[HREF]);
|
|
1432
1611
|
}
|
|
1612
|
+
const SAFE_ERROR = Symbol.for("solid.SafeError");
|
|
1613
|
+
function markSafeError(error) {
|
|
1614
|
+
if (error && (typeof error === "object" || typeof error === "function")) {
|
|
1615
|
+
Object.defineProperty(error, SAFE_ERROR, {
|
|
1616
|
+
value: true,
|
|
1617
|
+
enumerable: false,
|
|
1618
|
+
configurable: true
|
|
1619
|
+
});
|
|
1620
|
+
}
|
|
1621
|
+
return error;
|
|
1622
|
+
}
|
|
1623
|
+
function isSafeError(value) {
|
|
1624
|
+
return !!(value && (typeof value === "object" || typeof value === "function") && value[SAFE_ERROR]);
|
|
1625
|
+
}
|
|
1433
1626
|
const REVALIDATE_HEADER = "X-Revalidate";
|
|
1434
1627
|
function initWithRevalidate(init) {
|
|
1435
1628
|
const {
|
|
1436
1629
|
revalidate,
|
|
1437
1630
|
...responseInit
|
|
1438
1631
|
} = init;
|
|
1439
|
-
|
|
1632
|
+
let headers;
|
|
1633
|
+
if (responseInit.headers && responseInit.headers.getSetCookie) {
|
|
1634
|
+
headers = new Headers();
|
|
1635
|
+
responseInit.headers.forEach((value, key) => {
|
|
1636
|
+
if (key !== "set-cookie") headers.append(key, value);
|
|
1637
|
+
});
|
|
1638
|
+
for (const cookie of responseInit.headers.getSetCookie()) {
|
|
1639
|
+
headers.append("Set-Cookie", cookie);
|
|
1640
|
+
}
|
|
1641
|
+
} else {
|
|
1642
|
+
headers = new Headers(responseInit.headers);
|
|
1643
|
+
}
|
|
1440
1644
|
revalidate !== undefined && headers.set(REVALIDATE_HEADER, revalidate.toString());
|
|
1441
1645
|
return {
|
|
1442
1646
|
responseInit,
|
|
@@ -1513,7 +1717,8 @@ function portalImpl(props) {
|
|
|
1513
1717
|
endMarker = document.createTextNode(""),
|
|
1514
1718
|
mount = () => props.mount || document.body,
|
|
1515
1719
|
content = createMemo(() => [startMarker, props.children], {
|
|
1516
|
-
ssrSource: "client"
|
|
1720
|
+
ssrSource: "client",
|
|
1721
|
+
loadingValue: undefined
|
|
1517
1722
|
});
|
|
1518
1723
|
createRenderEffect(
|
|
1519
1724
|
() => [mount(), content(), getOwner()], ([, c, owner]) => {
|
|
@@ -1550,7 +1755,8 @@ function portalImpl(props) {
|
|
|
1550
1755
|
ssrSource: "client"
|
|
1551
1756
|
});
|
|
1552
1757
|
if (sharedConfig.hydrating) return createMemo(() => treeMarker, {
|
|
1553
|
-
ssrSource: "client"
|
|
1758
|
+
ssrSource: "client",
|
|
1759
|
+
loadingValue: undefined
|
|
1554
1760
|
});
|
|
1555
1761
|
return treeMarker;
|
|
1556
1762
|
}
|
|
@@ -1561,9 +1767,11 @@ function bindingOf(value) {
|
|
|
1561
1767
|
function dynamic(source) {
|
|
1562
1768
|
let latest = 0;
|
|
1563
1769
|
const sites = new Set();
|
|
1770
|
+
let deliveredAddress;
|
|
1564
1771
|
const resolveBinding = (next, prev) => {
|
|
1565
1772
|
const binding = bindingOf(next);
|
|
1566
1773
|
if (!binding) return next;
|
|
1774
|
+
deliveredAddress = binding.address;
|
|
1567
1775
|
const prevBinding = bindingOf(prev);
|
|
1568
1776
|
if (prevBinding && prevBinding.component === binding.component) {
|
|
1569
1777
|
for (const deliver of sites) deliver(binding.address);
|
|
@@ -1589,7 +1797,7 @@ function dynamic(source) {
|
|
|
1589
1797
|
{
|
|
1590
1798
|
const binding = bindingOf(component);
|
|
1591
1799
|
if (binding) {
|
|
1592
|
-
const [address, setAddress] = createSignal(binding.address);
|
|
1800
|
+
const [address, setAddress] = createSignal(deliveredAddress ?? binding.address);
|
|
1593
1801
|
sites.add(setAddress);
|
|
1594
1802
|
onCleanup(() => sites.delete(setAddress));
|
|
1595
1803
|
return untrack(() => binding.component(props, address));
|
|
@@ -1632,11 +1840,13 @@ _moduleUrl) {
|
|
|
1632
1840
|
if ((Comp = untrack(comp)) && !sharedConfig.hydrating) return Comp(rest);
|
|
1633
1841
|
const [mounted, setMounted] = createSignal(!sharedConfig.hydrating);
|
|
1634
1842
|
const gate = createMemo(() => (Comp = comp(), m = mounted(), untrack(() => Comp && m ? Comp(rest) : props.fallback)));
|
|
1635
|
-
sharedConfig.onHydrationEnd
|
|
1843
|
+
const onHydrationEnd = sharedConfig.onHydrationEnd;
|
|
1844
|
+
const release = () => setMounted(true);
|
|
1845
|
+
onHydrationEnd ? onHydrationEnd(release) : queueMicrotask(release);
|
|
1636
1846
|
return gate;
|
|
1637
1847
|
};
|
|
1638
1848
|
}
|
|
1639
1849
|
function httpStatus(_code, _text) {}
|
|
1640
1850
|
function httpHeader(_name, _value, _options) {}
|
|
1641
1851
|
|
|
1642
|
-
export {
|
|
1852
|
+
export { ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, voidFn as 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, voidFn as generateHydrationScript, getDelegatedRoot, getExpectedRedirectStatus, getFirstChild, getHydrationKey, getNextElement, getNextMarker, getNextMatch, getNextSibling, voidFn as getRequestEvent, getServerFunctionMetadata, getServerFunctionRPC, hasFlashCookie, httpHeader, httpStatus, hydrate, insert, installHydrationRuntime, isDev, isHref, isResponseEnvelope, isSafeError, isServer, isServerFunction, markSafeError, memo, mergeProps, parseCookieHeader, 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, warmAsset };
|