@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/dev.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, $DEVCOMP, onCleanup, enableHydration, enforceLoadingBoundary, 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
|
}
|
|
@@ -254,6 +266,64 @@ function resolveHead(groups) {
|
|
|
254
266
|
return winners;
|
|
255
267
|
}
|
|
256
268
|
|
|
269
|
+
function parseCookieHeader(header) {
|
|
270
|
+
const cookies = {};
|
|
271
|
+
if (!header) return cookies;
|
|
272
|
+
for (const part of header.split(";")) {
|
|
273
|
+
const eq = part.indexOf("=");
|
|
274
|
+
if (eq < 0) continue;
|
|
275
|
+
const name = decodeSafe(part.slice(0, eq).trim());
|
|
276
|
+
let value = part.slice(eq + 1).trim();
|
|
277
|
+
if (value.length > 1 && value[0] === '"' && value[value.length - 1] === '"') {
|
|
278
|
+
value = value.slice(1, -1);
|
|
279
|
+
}
|
|
280
|
+
cookies[name] = decodeSafe(value);
|
|
281
|
+
}
|
|
282
|
+
return cookies;
|
|
283
|
+
}
|
|
284
|
+
function decodeSafe(text) {
|
|
285
|
+
try {
|
|
286
|
+
return decodeURIComponent(text);
|
|
287
|
+
} catch {
|
|
288
|
+
return text;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
function serializeCookie(name, value, options = {}) {
|
|
292
|
+
let cookie = `${encodeURIComponent(name)}=${encodeURIComponent(value)}`;
|
|
293
|
+
cookie += `; Path=${options.path === undefined ? "/" : options.path}`;
|
|
294
|
+
if (options.domain) cookie += `; Domain=${options.domain}`;
|
|
295
|
+
if (options.maxAge !== undefined) cookie += `; Max-Age=${Math.trunc(options.maxAge)}`;
|
|
296
|
+
if (options.expires) cookie += `; Expires=${options.expires.toUTCString()}`;
|
|
297
|
+
if (options.httpOnly) cookie += "; HttpOnly";
|
|
298
|
+
if (options.secure) cookie += "; Secure";
|
|
299
|
+
if (options.sameSite) {
|
|
300
|
+
const sameSite = options.sameSite.toLowerCase();
|
|
301
|
+
cookie += `; SameSite=${sameSite === "none" ? "None" : sameSite === "strict" ? "Strict" : "Lax"}`;
|
|
302
|
+
}
|
|
303
|
+
return cookie;
|
|
304
|
+
}
|
|
305
|
+
const FLASH_COOKIE = "flash";
|
|
306
|
+
const FLASH_MATCHER = new RegExp(`(?:^|;\\s*)${FLASH_COOKIE}=([^;]+)`);
|
|
307
|
+
function hasFlashCookie(cookieHeader) {
|
|
308
|
+
return !!cookieHeader && FLASH_MATCHER.test(cookieHeader);
|
|
309
|
+
}
|
|
310
|
+
function clearFlashCookie() {
|
|
311
|
+
return `${FLASH_COOKIE}=; Max-Age=0; Path=/`;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
const SERVER_FUNCTION_METADATA = Symbol.for("solid.ServerFunctionMetadata");
|
|
315
|
+
function getServerFunctionMetadata(fn) {
|
|
316
|
+
if (typeof fn !== "function") return undefined;
|
|
317
|
+
return fn[SERVER_FUNCTION_METADATA] || undefined;
|
|
318
|
+
}
|
|
319
|
+
function isServerFunction(fn) {
|
|
320
|
+
return typeof fn === "function" && !!fn[SERVER_FUNCTION_METADATA];
|
|
321
|
+
}
|
|
322
|
+
const SERVER_FUNCTION_RPC = Symbol.for("solid.ServerFunctionRPC");
|
|
323
|
+
function getServerFunctionRPC() {
|
|
324
|
+
return globalThis[SERVER_FUNCTION_RPC];
|
|
325
|
+
}
|
|
326
|
+
|
|
257
327
|
const $$EVENT_OWNER = "_$DX_EVENT_OWNER";
|
|
258
328
|
const INNER_OWNED = {};
|
|
259
329
|
const delegatedEvents = new Set();
|
|
@@ -608,8 +678,7 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
608
678
|
const value = normalize(accessor(), current, multi, true);
|
|
609
679
|
if (typeof value !== "function") return value;
|
|
610
680
|
effect(() => (hydrationRt !== null && (current = hydrationRt.reclaimRegion(current, parent, marker)), normalize(value, current, multi)), inner => {
|
|
611
|
-
insertExpression(parent, inner, current, marker);
|
|
612
|
-
current = inner;
|
|
681
|
+
current = insertExpression(parent, inner, current, marker);
|
|
613
682
|
host && tagHost(current, host);
|
|
614
683
|
}, prev !== undefined && !(options && options.schedule) ? {
|
|
615
684
|
...options,
|
|
@@ -618,8 +687,7 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
618
687
|
return INNER_OWNED;
|
|
619
688
|
}, value => {
|
|
620
689
|
if (value === INNER_OWNED) return;
|
|
621
|
-
insertExpression(parent, value, current, marker);
|
|
622
|
-
current = value;
|
|
690
|
+
current = insertExpression(parent, value, current, marker);
|
|
623
691
|
host && tagHost(current, host);
|
|
624
692
|
},
|
|
625
693
|
accessor.$s ? options ? {
|
|
@@ -657,6 +725,9 @@ function findAssetElement(selector, attr, value) {
|
|
|
657
725
|
}
|
|
658
726
|
return null;
|
|
659
727
|
}
|
|
728
|
+
function setAssetAttrs(el, attrs) {
|
|
729
|
+
for (const name in attrs) el.setAttribute(name, attrs[name]);
|
|
730
|
+
}
|
|
660
731
|
function mountAssetElement(descriptor) {
|
|
661
732
|
let el;
|
|
662
733
|
if (descriptor.type === "inline-style") {
|
|
@@ -675,12 +746,77 @@ function mountAssetElement(descriptor) {
|
|
|
675
746
|
el.href = descriptor.href;
|
|
676
747
|
}
|
|
677
748
|
}
|
|
678
|
-
if (descriptor.attrs)
|
|
679
|
-
for (const name in descriptor.attrs) el.setAttribute(name, descriptor.attrs[name]);
|
|
680
|
-
}
|
|
749
|
+
if (descriptor.attrs) setAssetAttrs(el, descriptor.attrs);
|
|
681
750
|
if (!el.isConnected) document.head.appendChild(el);
|
|
682
751
|
return el;
|
|
683
752
|
}
|
|
753
|
+
const assetLoadSettled = /*#__PURE__*/Promise.resolve();
|
|
754
|
+
function trackAssetLoad(entry, adopted) {
|
|
755
|
+
if (entry.loadPromise) return;
|
|
756
|
+
const el = entry.element;
|
|
757
|
+
let settled = el.sheet != null;
|
|
758
|
+
if (!settled && adopted && typeof performance !== "undefined" && performance.getEntriesByName) {
|
|
759
|
+
settled = performance.getEntriesByName(el.href).length > 0;
|
|
760
|
+
}
|
|
761
|
+
if (settled) {
|
|
762
|
+
entry.loadState = "loaded";
|
|
763
|
+
entry.loadPromise = assetLoadSettled;
|
|
764
|
+
return;
|
|
765
|
+
}
|
|
766
|
+
entry.loadState = "pending";
|
|
767
|
+
entry.loadPromise = new Promise(resolve => {
|
|
768
|
+
const settle = state => {
|
|
769
|
+
entry.loadState = state;
|
|
770
|
+
resolve();
|
|
771
|
+
};
|
|
772
|
+
el.addEventListener("load", () => settle("loaded"), {
|
|
773
|
+
once: true
|
|
774
|
+
});
|
|
775
|
+
el.addEventListener("error", () => settle("errored"), {
|
|
776
|
+
once: true
|
|
777
|
+
});
|
|
778
|
+
});
|
|
779
|
+
}
|
|
780
|
+
function warmAsset(descriptor) {
|
|
781
|
+
if (descriptor.policy === "exclusive" || descriptor.type === "inline-style") return;
|
|
782
|
+
const key = assetEntryKey(descriptor);
|
|
783
|
+
let entry = assetRegistry.get(key);
|
|
784
|
+
if (!entry) {
|
|
785
|
+
entry = {
|
|
786
|
+
count: 0,
|
|
787
|
+
element: null,
|
|
788
|
+
timer: null
|
|
789
|
+
};
|
|
790
|
+
assetRegistry.set(key, entry);
|
|
791
|
+
}
|
|
792
|
+
let adopted = true;
|
|
793
|
+
if (!entry.element || !entry.element.isConnected) {
|
|
794
|
+
const rel = descriptor.type === "module" ? "modulepreload" : "stylesheet";
|
|
795
|
+
let el = findAssetElement(`link[rel="${rel}"]`, "href", descriptor.href);
|
|
796
|
+
if (!el && descriptor.type === "style") {
|
|
797
|
+
el = findAssetElement('link[rel="preload"][as="style"]', "href", descriptor.href);
|
|
798
|
+
}
|
|
799
|
+
if (!el) {
|
|
800
|
+
adopted = false;
|
|
801
|
+
el = document.createElement("link");
|
|
802
|
+
if (descriptor.type === "style") {
|
|
803
|
+
el.setAttribute("rel", "preload");
|
|
804
|
+
el.setAttribute("as", "style");
|
|
805
|
+
} else {
|
|
806
|
+
el.setAttribute("rel", "modulepreload");
|
|
807
|
+
}
|
|
808
|
+
el.setAttribute("href", descriptor.href);
|
|
809
|
+
if (!document.body) el.setAttribute("blocking", "render");
|
|
810
|
+
}
|
|
811
|
+
if (descriptor.attrs) setAssetAttrs(el, descriptor.attrs);
|
|
812
|
+
if (!el.isConnected) document.head.appendChild(el);
|
|
813
|
+
entry.element = el;
|
|
814
|
+
entry.loadState = undefined;
|
|
815
|
+
entry.loadPromise = undefined;
|
|
816
|
+
}
|
|
817
|
+
if (descriptor.type === "style") trackAssetLoad(entry, adopted);
|
|
818
|
+
return entry;
|
|
819
|
+
}
|
|
684
820
|
function acquireAsset(descriptor) {
|
|
685
821
|
const key = assetEntryKey(descriptor);
|
|
686
822
|
let entry = assetRegistry.get(key);
|
|
@@ -727,7 +863,12 @@ function acquireAsset(descriptor) {
|
|
|
727
863
|
entry.timer = null;
|
|
728
864
|
}
|
|
729
865
|
entry.count++;
|
|
730
|
-
if (!entry.element || !entry.element.isConnected)
|
|
866
|
+
if (!entry.element || !entry.element.isConnected) {
|
|
867
|
+
entry.element = mountAssetElement(descriptor);
|
|
868
|
+
} else if (descriptor.type === "style" && entry.element.getAttribute("rel") === "preload") {
|
|
869
|
+
entry.element.removeAttribute("as");
|
|
870
|
+
entry.element.setAttribute("rel", "stylesheet");
|
|
871
|
+
}
|
|
731
872
|
let released = false;
|
|
732
873
|
return () => {
|
|
733
874
|
if (released) return;
|
|
@@ -876,25 +1017,9 @@ function headElementMatches(el, t) {
|
|
|
876
1017
|
const children = t.props.children;
|
|
877
1018
|
return (children == null ? "" : String(children)) === el.textContent;
|
|
878
1019
|
}
|
|
879
|
-
function
|
|
880
|
-
if (tag === "link" && (props.rel === "stylesheet" || props.rel === "modulepreload")) {
|
|
881
|
-
const descriptor = {
|
|
882
|
-
type: props.rel === "stylesheet" ? "style" : "module",
|
|
883
|
-
href: props.href
|
|
884
|
-
};
|
|
885
|
-
let attrs = null;
|
|
886
|
-
for (const name in props) {
|
|
887
|
-
if (name === "rel" || name === "href") continue;
|
|
888
|
-
if (!HEAD_ATTR_NAME.test(name)) continue;
|
|
889
|
-
const v = props[name];
|
|
890
|
-
if (v == null || v === false) continue;
|
|
891
|
-
(attrs || (attrs = {}))[name] = v === true ? "" : String(v);
|
|
892
|
-
}
|
|
893
|
-
if (attrs) descriptor.attrs = attrs;
|
|
894
|
-
return acquireAsset(descriptor);
|
|
895
|
-
}
|
|
1020
|
+
function mountHeadResource(tag, props) {
|
|
896
1021
|
const identity = resourceIdentity(tag, props);
|
|
897
|
-
if (headMountedResources.has(identity)) return
|
|
1022
|
+
if (headMountedResources.has(identity)) return;
|
|
898
1023
|
headMountedResources.add(identity);
|
|
899
1024
|
const url = props.href || props.src;
|
|
900
1025
|
let el = null;
|
|
@@ -902,9 +1027,28 @@ function acquireHeadResource(tag, props) {
|
|
|
902
1027
|
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);
|
|
903
1028
|
}
|
|
904
1029
|
if (!el) document.head.appendChild(createHeadElement(tag, props));
|
|
905
|
-
return noopFn;
|
|
906
1030
|
}
|
|
907
|
-
function
|
|
1031
|
+
function gateHeadResource(props) {
|
|
1032
|
+
const descriptor = {
|
|
1033
|
+
type: props.rel === "stylesheet" ? "style" : "module",
|
|
1034
|
+
href: props.href
|
|
1035
|
+
};
|
|
1036
|
+
let gateable = props.rel === "stylesheet" && props.href != null;
|
|
1037
|
+
let attrs = null;
|
|
1038
|
+
for (const name in props) {
|
|
1039
|
+
if (name === "rel" || name === "href") continue;
|
|
1040
|
+
if (!STYLESHEET_FETCH_META.has(name)) gateable = false;
|
|
1041
|
+
if (!HEAD_ATTR_NAME.test(name)) continue;
|
|
1042
|
+
const v = props[name];
|
|
1043
|
+
if (v == null || v === false) continue;
|
|
1044
|
+
(attrs || (attrs = {}))[name] = v === true ? "" : String(v);
|
|
1045
|
+
}
|
|
1046
|
+
if (attrs) descriptor.attrs = attrs;
|
|
1047
|
+
effect(() => {
|
|
1048
|
+
const entry = warmAsset(descriptor);
|
|
1049
|
+
if (gateable && entry.loadState === "pending" && typeof waitAsset === "function") waitAsset(entry.loadPromise);
|
|
1050
|
+
}, () => acquireAsset(descriptor));
|
|
1051
|
+
}
|
|
908
1052
|
function useHead(tags) {
|
|
909
1053
|
initHeadRegistry();
|
|
910
1054
|
const reg = {
|
|
@@ -928,10 +1072,16 @@ function useHead(tags) {
|
|
|
928
1072
|
rel: cls.rel
|
|
929
1073
|
} : undefined);
|
|
930
1074
|
if (cls.resource) {
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
1075
|
+
if (desc.tag === "link" && (props.rel === "stylesheet" || props.rel === "modulepreload")) {
|
|
1076
|
+
gateHeadResource(props);
|
|
1077
|
+
} else if (desc.tag === "link") {
|
|
1078
|
+
mountHeadResource(desc.tag, props);
|
|
1079
|
+
} else {
|
|
1080
|
+
resources.push({
|
|
1081
|
+
tag: desc.tag,
|
|
1082
|
+
props
|
|
1083
|
+
});
|
|
1084
|
+
}
|
|
935
1085
|
} else {
|
|
936
1086
|
const key = evalHeadValue(desc.key);
|
|
937
1087
|
replaceable.push({
|
|
@@ -946,9 +1096,8 @@ function useHead(tags) {
|
|
|
946
1096
|
resources
|
|
947
1097
|
};
|
|
948
1098
|
}, evaluated => {
|
|
949
|
-
const releases = [];
|
|
950
1099
|
for (let i = 0; i < evaluated.resources.length; i++) {
|
|
951
|
-
|
|
1100
|
+
mountHeadResource(evaluated.resources[i].tag, evaluated.resources[i].props);
|
|
952
1101
|
}
|
|
953
1102
|
reg.tags = evaluated.replaceable;
|
|
954
1103
|
if (reg.seq < 0) reg.seq = ++headSeq;
|
|
@@ -957,7 +1106,6 @@ function useHead(tags) {
|
|
|
957
1106
|
return () => {
|
|
958
1107
|
const idx = headRegistrations.indexOf(reg);
|
|
959
1108
|
if (idx > -1) headRegistrations.splice(idx, 1);
|
|
960
|
-
for (let i = 0; i < releases.length; i++) releases[i]();
|
|
961
1109
|
scheduleHeadApply();
|
|
962
1110
|
};
|
|
963
1111
|
});
|
|
@@ -1323,8 +1471,11 @@ function eventHandler(e, container, state) {
|
|
|
1323
1471
|
retarget(oriTarget);
|
|
1324
1472
|
}
|
|
1325
1473
|
function insertExpression(parent, value, current, marker) {
|
|
1326
|
-
if (hydrationRt !== null && isHydrating(parent))
|
|
1327
|
-
|
|
1474
|
+
if (hydrationRt !== null && isHydrating(parent)) {
|
|
1475
|
+
if (value && value !== current) for (const n of Array.isArray(value) ? value : [value]) if (n && n.nodeType && !isHydrating(n)) return current;
|
|
1476
|
+
return value;
|
|
1477
|
+
}
|
|
1478
|
+
if (value === current) return value;
|
|
1328
1479
|
const t = typeof value,
|
|
1329
1480
|
multi = marker !== undefined;
|
|
1330
1481
|
if (t === "string" || t === "number") {
|
|
@@ -1363,6 +1514,7 @@ function insertExpression(parent, value, current, marker) {
|
|
|
1363
1514
|
appendNodes(parent, value);
|
|
1364
1515
|
}
|
|
1365
1516
|
} else console.warn(`Unrecognized value. Skipped inserting`, value);
|
|
1517
|
+
return value;
|
|
1366
1518
|
}
|
|
1367
1519
|
function normalize(value, current, multi, doNotUnwrap) {
|
|
1368
1520
|
value = flatten(value, {
|
|
@@ -1445,7 +1597,13 @@ function gatherHydratable(element, root) {
|
|
|
1445
1597
|
for (let i = 0; i < templates.length; i++) {
|
|
1446
1598
|
const node = templates[i];
|
|
1447
1599
|
const key = node.getAttribute("_hk");
|
|
1448
|
-
if (
|
|
1600
|
+
if (root) {
|
|
1601
|
+
if (!key.startsWith(root)) continue;
|
|
1602
|
+
} else {
|
|
1603
|
+
const frame = node.closest("[data-fid]");
|
|
1604
|
+
if (frame && frame !== element && element.contains(frame)) continue;
|
|
1605
|
+
}
|
|
1606
|
+
if (!sharedConfig.registry.has(key)) sharedConfig.registry.set(key, node);
|
|
1449
1607
|
}
|
|
1450
1608
|
}
|
|
1451
1609
|
function getHydrationKey() {
|
|
@@ -1461,29 +1619,50 @@ function throwInBrowser(func) {
|
|
|
1461
1619
|
function renderToString(fn, options) {
|
|
1462
1620
|
throwInBrowser(renderToString);
|
|
1463
1621
|
}
|
|
1464
|
-
function renderToStringAsync(fn, options) {
|
|
1465
|
-
throwInBrowser(renderToStringAsync);
|
|
1466
|
-
}
|
|
1467
1622
|
function renderToStream(fn, options) {
|
|
1468
1623
|
throwInBrowser(renderToStream);
|
|
1469
1624
|
}
|
|
1625
|
+
function createResponseStub() {
|
|
1626
|
+
throwInBrowser(createResponseStub);
|
|
1627
|
+
}
|
|
1628
|
+
function createRequestEvent(request, init) {
|
|
1629
|
+
throwInBrowser(createRequestEvent);
|
|
1630
|
+
}
|
|
1631
|
+
function getExpectedRedirectStatus(response) {
|
|
1632
|
+
throwInBrowser(getExpectedRedirectStatus);
|
|
1633
|
+
}
|
|
1634
|
+
function createSSRResponse() {
|
|
1635
|
+
throwInBrowser(createSSRResponse);
|
|
1636
|
+
}
|
|
1637
|
+
function commitEventResponse(response, event) {
|
|
1638
|
+
throwInBrowser(commitEventResponse);
|
|
1639
|
+
}
|
|
1640
|
+
function composeMiddleware(middlewares) {
|
|
1641
|
+
throwInBrowser(composeMiddleware);
|
|
1642
|
+
}
|
|
1470
1643
|
function ssr(template, ...nodes) {}
|
|
1471
1644
|
function ssrElement(name, props, children, needsId) {}
|
|
1472
|
-
function
|
|
1645
|
+
function ssrClassName(value) {}
|
|
1473
1646
|
function ssrStyle(value) {}
|
|
1647
|
+
function ssrStyleProperty(name, value) {}
|
|
1474
1648
|
function ssrAttribute(key, value) {}
|
|
1649
|
+
function ssrGroup(fn, n) {}
|
|
1475
1650
|
function ssrHydrationKey() {}
|
|
1476
|
-
function resolveSSRNode(node) {}
|
|
1477
|
-
function escape(
|
|
1651
|
+
function resolveSSRNode(node, result, top) {}
|
|
1652
|
+
function escape(s, attr) {}
|
|
1478
1653
|
|
|
1479
1654
|
const ENVELOPE = Symbol.for("solid.ResponseEnvelope");
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1655
|
+
// PURE-annotated factory (same convention as solid's MockPromise): the brand
|
|
1656
|
+
const ResponseEnvelope = /* @__PURE__ */(() => {
|
|
1657
|
+
class ResponseEnvelope {
|
|
1658
|
+
constructor(response, value) {
|
|
1659
|
+
this.response = response;
|
|
1660
|
+
this.value = value;
|
|
1661
|
+
}
|
|
1484
1662
|
}
|
|
1485
|
-
|
|
1486
|
-
ResponseEnvelope
|
|
1663
|
+
ResponseEnvelope.prototype[ENVELOPE] = true;
|
|
1664
|
+
return ResponseEnvelope;
|
|
1665
|
+
})();
|
|
1487
1666
|
function isResponseEnvelope(value) {
|
|
1488
1667
|
return !!(value && typeof value === "object" && value[ENVELOPE]);
|
|
1489
1668
|
}
|
|
@@ -1491,13 +1670,38 @@ const HREF = Symbol.for("solid.Href");
|
|
|
1491
1670
|
function isHref(value) {
|
|
1492
1671
|
return !!(value && (typeof value === "object" || typeof value === "function") && value[HREF]);
|
|
1493
1672
|
}
|
|
1673
|
+
const SAFE_ERROR = Symbol.for("solid.SafeError");
|
|
1674
|
+
function markSafeError(error) {
|
|
1675
|
+
if (error && (typeof error === "object" || typeof error === "function")) {
|
|
1676
|
+
Object.defineProperty(error, SAFE_ERROR, {
|
|
1677
|
+
value: true,
|
|
1678
|
+
enumerable: false,
|
|
1679
|
+
configurable: true
|
|
1680
|
+
});
|
|
1681
|
+
}
|
|
1682
|
+
return error;
|
|
1683
|
+
}
|
|
1684
|
+
function isSafeError(value) {
|
|
1685
|
+
return !!(value && (typeof value === "object" || typeof value === "function") && value[SAFE_ERROR]);
|
|
1686
|
+
}
|
|
1494
1687
|
const REVALIDATE_HEADER = "X-Revalidate";
|
|
1495
1688
|
function initWithRevalidate(init) {
|
|
1496
1689
|
const {
|
|
1497
1690
|
revalidate,
|
|
1498
1691
|
...responseInit
|
|
1499
1692
|
} = init;
|
|
1500
|
-
|
|
1693
|
+
let headers;
|
|
1694
|
+
if (responseInit.headers && responseInit.headers.getSetCookie) {
|
|
1695
|
+
headers = new Headers();
|
|
1696
|
+
responseInit.headers.forEach((value, key) => {
|
|
1697
|
+
if (key !== "set-cookie") headers.append(key, value);
|
|
1698
|
+
});
|
|
1699
|
+
for (const cookie of responseInit.headers.getSetCookie()) {
|
|
1700
|
+
headers.append("Set-Cookie", cookie);
|
|
1701
|
+
}
|
|
1702
|
+
} else {
|
|
1703
|
+
headers = new Headers(responseInit.headers);
|
|
1704
|
+
}
|
|
1501
1705
|
revalidate !== undefined && headers.set(REVALIDATE_HEADER, revalidate.toString());
|
|
1502
1706
|
return {
|
|
1503
1707
|
responseInit,
|
|
@@ -1576,7 +1780,8 @@ function portalImpl(props) {
|
|
|
1576
1780
|
endMarker = document.createTextNode(""),
|
|
1577
1781
|
mount = () => props.mount || document.body,
|
|
1578
1782
|
content = createMemo(() => [startMarker, props.children], {
|
|
1579
|
-
ssrSource: "client"
|
|
1783
|
+
ssrSource: "client",
|
|
1784
|
+
loadingValue: undefined
|
|
1580
1785
|
});
|
|
1581
1786
|
createRenderEffect(
|
|
1582
1787
|
() => [mount(), content(), getOwner()], ([, c, owner]) => {
|
|
@@ -1613,7 +1818,8 @@ function portalImpl(props) {
|
|
|
1613
1818
|
ssrSource: "client"
|
|
1614
1819
|
});
|
|
1615
1820
|
if (sharedConfig.hydrating) return createMemo(() => treeMarker, {
|
|
1616
|
-
ssrSource: "client"
|
|
1821
|
+
ssrSource: "client",
|
|
1822
|
+
loadingValue: undefined
|
|
1617
1823
|
});
|
|
1618
1824
|
return treeMarker;
|
|
1619
1825
|
}
|
|
@@ -1624,9 +1830,11 @@ function bindingOf(value) {
|
|
|
1624
1830
|
function dynamic(source) {
|
|
1625
1831
|
let latest = 0;
|
|
1626
1832
|
const sites = new Set();
|
|
1833
|
+
let deliveredAddress;
|
|
1627
1834
|
const resolveBinding = (next, prev) => {
|
|
1628
1835
|
const binding = bindingOf(next);
|
|
1629
1836
|
if (!binding) return next;
|
|
1837
|
+
deliveredAddress = binding.address;
|
|
1630
1838
|
const prevBinding = bindingOf(prev);
|
|
1631
1839
|
if (prevBinding && prevBinding.component === binding.component) {
|
|
1632
1840
|
for (const deliver of sites) deliver(binding.address);
|
|
@@ -1655,7 +1863,7 @@ function dynamic(source) {
|
|
|
1655
1863
|
});
|
|
1656
1864
|
const binding = bindingOf(component);
|
|
1657
1865
|
if (binding) {
|
|
1658
|
-
const [address, setAddress] = createSignal(binding.address);
|
|
1866
|
+
const [address, setAddress] = createSignal(deliveredAddress ?? binding.address);
|
|
1659
1867
|
sites.add(setAddress);
|
|
1660
1868
|
onCleanup(() => sites.delete(setAddress));
|
|
1661
1869
|
return untrack(() => binding.component(props, address));
|
|
@@ -1698,11 +1906,13 @@ _moduleUrl) {
|
|
|
1698
1906
|
if ((Comp = untrack(comp)) && !sharedConfig.hydrating) return Comp(rest);
|
|
1699
1907
|
const [mounted, setMounted] = createSignal(!sharedConfig.hydrating);
|
|
1700
1908
|
const gate = createMemo(() => (Comp = comp(), m = mounted(), untrack(() => Comp && m ? Comp(rest) : props.fallback)));
|
|
1701
|
-
sharedConfig.onHydrationEnd
|
|
1909
|
+
const onHydrationEnd = sharedConfig.onHydrationEnd;
|
|
1910
|
+
const release = () => setMounted(true);
|
|
1911
|
+
onHydrationEnd ? onHydrationEnd(release) : queueMicrotask(release);
|
|
1702
1912
|
return gate;
|
|
1703
1913
|
};
|
|
1704
1914
|
}
|
|
1705
1915
|
function httpStatus(_code, _text) {}
|
|
1706
1916
|
function httpHeader(_name, _value, _options) {}
|
|
1707
1917
|
|
|
1708
|
-
export {
|
|
1918
|
+
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 };
|