@solidjs/web 2.0.0-rc.13 → 2.0.0-rc.15
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 +317 -185
- package/dist/server.js +298 -161
- package/dist/server.observe.js +299 -171
- package/dist/web.dev.js +207 -189
- package/dist/web.js +180 -178
- package/dist/web.observe.js +180 -180
- package/frames/dist/assets.js +92 -0
- package/frames/dist/bind.dev.js +326 -0
- package/frames/dist/bind.js +295 -0
- package/frames/dist/client.dev.js +665 -1114
- package/frames/dist/client.js +630 -1087
- package/frames/dist/client.observe.js +629 -1087
- package/frames/dist/regions.js +130 -0
- package/frames/dist/server.dev.js +400 -201
- package/frames/dist/server.js +397 -198
- package/frames/dist/server.observe.js +397 -198
- package/frames/dist/trace.js +45 -0
- package/frames/dist/wire.js +133 -0
- package/package.json +30 -4
- package/performance-tracks/dist/performance-tracks.dev.js +2 -1
- package/performance-tracks/dist/performance-tracks.observe.js +2 -1
- package/performance-tracks/types/index.d.ts +8 -6
- package/serialization/dist/decode.js +38 -9
- package/serialization/dist/serialization.js +40 -11
- package/serialization/types/serializer-decode.d.ts +24 -2
- package/server-functions/dist/client.dev.js +101 -62
- package/server-functions/dist/client.js +101 -62
- package/server-functions/dist/client.observe.js +101 -62
- package/server-functions/dist/server.dev.js +178 -67
- package/server-functions/dist/server.js +178 -67
- package/server-functions/dist/server.observe.js +178 -67
- package/skills/server-components/SKILL.md +65 -43
- package/types/client.d.ts +120 -8
- package/types/constants.d.ts +3 -1
- package/types/diagnostics.d.ts +8 -0
- package/types/frames/assets-tier.d.ts +78 -0
- package/types/frames/bind-tier.d.ts +60 -0
- package/types/frames/client.d.ts +37 -3
- package/types/frames/frame-client.d.ts +249 -78
- package/types/frames/frame-container-plugin.d.ts +2 -2
- package/types/frames/frame-sink.d.ts +33 -0
- package/types/frames/frame-transport.d.ts +66 -18
- package/types/frames/regions-tier.d.ts +45 -0
- package/types/frames/serializer-decode.d.ts +24 -2
- package/types/frames/server.d.ts +33 -9
- package/types/frames/trace-tier.d.ts +2 -0
- package/types/frames/wire-tier.d.ts +116 -0
- package/types/head.d.ts +1 -0
- package/types/index.d.ts +61 -16
- package/types/index.server.d.ts +3 -18
- package/types/jsx.d.ts +4 -13
- package/types/observe.d.ts +4 -2
- package/types/response.d.ts +26 -4
- package/types/serializer-decode.d.ts +24 -2
- package/types/server-functions/client.d.ts +30 -0
- package/types/server-functions/registry.d.ts +4 -1
- package/types/server-functions/shared.d.ts +12 -8
- package/types/server-mock.d.ts +22 -3
- package/types/server.d.ts +119 -17
package/dist/web.observe.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { createRenderEffect, createMemo, enableHydration, $PROXY, untrack, runWithOwner, createRoot, getOwner, ROOT_ERROR_HOOK, flatten, flush,
|
|
2
|
-
export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, Show, Switch, createComponent, getOwner, merge as mergeProps, untrack } from 'solid-js';
|
|
3
|
-
import { sharedConfig,
|
|
1
|
+
import { createRenderEffect, createMemo, OBSERVE, enableHydration, $PROXY, untrack, runWithOwner, createRoot, getOwner, ROOT_ERROR_HOOK, flatten, flush, createComponent, omit, createOwner, createSignal, createEffect } from 'solid-js';
|
|
2
|
+
export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, Show, Switch, createComponent, dynamicComponent, getOwner, merge as mergeProps, untrack } from 'solid-js';
|
|
3
|
+
import { sharedConfig, enableServerComponentHydration, resolvedTable, viewOf, OmitView, hasStaticKeys, SOURCE_MEMO, sourceHas, SOURCE_OMIT, sourceGet, sourceKeys, SOURCE_PROXY, SOURCE_PLAIN, dynamicCore } from 'solid-js/internal';
|
|
4
4
|
|
|
5
5
|
const DOMWithState = {
|
|
6
6
|
INPUT: {
|
|
@@ -232,6 +232,10 @@ function qualifierValue(name, value) {
|
|
|
232
232
|
function asciiLowerCase(value) {
|
|
233
233
|
return value.replace(/[A-Z]/g, c => String.fromCharCode(c.charCodeAt(0) + 32));
|
|
234
234
|
}
|
|
235
|
+
const JSON_SCRIPT_TYPE = /^(?:importmap|speculationrules)$|^[\t\n\r ]*(?:application\/json|text\/json|[\w!#$%&'*+.^`|~-]+\/[\w!#$%&'*+.^`|~-]*\+json)[\t\n\r ]*(?:;|$)/i;
|
|
236
|
+
function headBodyText(tag, props, text) {
|
|
237
|
+
return tag === "script" && JSON_SCRIPT_TYPE.test(String(props.type)) ? text.replace(/</g, "\\u003C") : text;
|
|
238
|
+
}
|
|
235
239
|
function resourceIdentity(tag, props) {
|
|
236
240
|
const url = String(props.href || props.src || "");
|
|
237
241
|
let id = "res:" + tag + ":" + (props.rel || "") + ":" + url.length + ":" + url;
|
|
@@ -325,7 +329,7 @@ function serializeCookie(name, value, options = {}) {
|
|
|
325
329
|
return cookie;
|
|
326
330
|
}
|
|
327
331
|
const FLASH_COOKIE = "flash";
|
|
328
|
-
const FLASH_MATCHER =
|
|
332
|
+
const FLASH_MATCHER = /(?:^|;\s*)flash=([^;]+)/;
|
|
329
333
|
function hasFlashCookie(cookieHeader) {
|
|
330
334
|
return !!cookieHeader && FLASH_MATCHER.test(cookieHeader);
|
|
331
335
|
}
|
|
@@ -402,6 +406,13 @@ function takeHydrationValue(key) {
|
|
|
402
406
|
value: v
|
|
403
407
|
};
|
|
404
408
|
}
|
|
409
|
+
function setLinkClaim(_handler) {
|
|
410
|
+
return false;
|
|
411
|
+
}
|
|
412
|
+
function hasServerLinkState() {
|
|
413
|
+
const registry = globalThis._$HY && globalThis._$HY.r;
|
|
414
|
+
return !!registry && registry.links === 1;
|
|
415
|
+
}
|
|
405
416
|
const getTraceContext = voidFn;
|
|
406
417
|
function render(code, element, init, options = {}) {
|
|
407
418
|
let disposer;
|
|
@@ -509,8 +520,9 @@ function dispatchAsInteraction(e, fn) {
|
|
|
509
520
|
return OBSERVE.attribution.withInteraction({
|
|
510
521
|
type: e.type,
|
|
511
522
|
target: describeEventTarget(e.target),
|
|
512
|
-
at: interactionStart(e)
|
|
513
|
-
|
|
523
|
+
at: interactionStart(e),
|
|
524
|
+
event: e
|
|
525
|
+
}, fn) ;
|
|
514
526
|
}
|
|
515
527
|
function getDelegatedRoot(node) {
|
|
516
528
|
while (node) {
|
|
@@ -533,17 +545,31 @@ function findOwner(target, state) {
|
|
|
533
545
|
function setProperty(node, name, value) {
|
|
534
546
|
if (isHydrating(node)) return;
|
|
535
547
|
const nodeName = node.nodeName;
|
|
536
|
-
if (name === "value" && nodeName === "SELECT")
|
|
548
|
+
if (name === "value" && nodeName === "SELECT") writeSelectValue(node, value);else if ((name === "value" || name === "defaultValue") && (nodeName === "INPUT" || nodeName === "TEXTAREA")) {
|
|
549
|
+
if (value == null && /^(checkbox|radio)$/.test(node.type)) node.removeAttribute("value");else node[name] = value ?? "";
|
|
550
|
+
} else node[name] = value;
|
|
551
|
+
reclaimAttribute(node, name);
|
|
537
552
|
}
|
|
538
553
|
let claimHandlers = null;
|
|
554
|
+
const claimAttributeSets = [];
|
|
539
555
|
const CLAIM_SEAM = Symbol.for("solid.element-claims");
|
|
540
|
-
function registerElementClaim(handler) {
|
|
556
|
+
function registerElementClaim(handler, options) {
|
|
541
557
|
(claimHandlers || (claimHandlers = globalThis[CLAIM_SEAM] = [])).push(handler);
|
|
558
|
+
claimAttributeSets.push(options?.attributes || ["href", "action"]);
|
|
542
559
|
return () => {
|
|
543
560
|
const index = claimHandlers.indexOf(handler);
|
|
544
|
-
index > -1
|
|
561
|
+
if (index > -1) {
|
|
562
|
+
claimHandlers.splice(index, 1);
|
|
563
|
+
claimAttributeSets.splice(index, 1);
|
|
564
|
+
}
|
|
545
565
|
};
|
|
546
566
|
}
|
|
567
|
+
function runClaimHandlers(handlers, node) {
|
|
568
|
+
for (let i = 0; i < handlers.length; i++) handlers[i](node);
|
|
569
|
+
}
|
|
570
|
+
function reclaimAttribute(node, name) {
|
|
571
|
+
if (claimHandlers !== null && node._$claimed && claimAttributeSets.some(set => set.includes(name.slice(name.indexOf(":") + 1)))) runClaimHandlers(claimHandlers, node);
|
|
572
|
+
}
|
|
547
573
|
const CLAIMED_ELEMENTS = "a[href], form[action]";
|
|
548
574
|
function claimElementTree(root) {
|
|
549
575
|
const handlers = globalThis[CLAIM_SEAM];
|
|
@@ -551,17 +577,20 @@ function claimElementTree(root) {
|
|
|
551
577
|
const isElement = root.nodeType === 1;
|
|
552
578
|
if (!isElement && root.nodeType !== 11) return root;
|
|
553
579
|
if (isElement && root.matches(CLAIMED_ELEMENTS)) {
|
|
554
|
-
|
|
580
|
+
root._$claimed = true;
|
|
581
|
+
runClaimHandlers(handlers, root);
|
|
555
582
|
}
|
|
556
583
|
const found = root.querySelectorAll(CLAIMED_ELEMENTS);
|
|
557
584
|
for (let i = 0; i < found.length; i++) {
|
|
558
|
-
|
|
585
|
+
found[i]._$claimed = true;
|
|
586
|
+
runClaimHandlers(handlers, found[i]);
|
|
559
587
|
}
|
|
560
588
|
return root;
|
|
561
589
|
}
|
|
562
|
-
function claimElement(node) {
|
|
563
|
-
if (claimHandlers !== null) {
|
|
564
|
-
|
|
590
|
+
function claimElement(node, owner) {
|
|
591
|
+
if (claimHandlers !== null && !node._$claimed) {
|
|
592
|
+
node._$claimed = true;
|
|
593
|
+
if (owner === undefined) runClaimHandlers(claimHandlers, node);else runWithOwner(owner, () => runClaimHandlers(claimHandlers, node));
|
|
565
594
|
}
|
|
566
595
|
return node;
|
|
567
596
|
}
|
|
@@ -578,11 +607,12 @@ function setAttribute(node, name, value) {
|
|
|
578
607
|
}
|
|
579
608
|
}
|
|
580
609
|
if (selectMultiple) node._$multiple = true;
|
|
581
|
-
|
|
610
|
+
reclaimAttribute(node, name);
|
|
582
611
|
}
|
|
583
612
|
function setAttributeNS(node, namespace, name, value) {
|
|
584
613
|
if (isHydrating(node)) return;
|
|
585
614
|
if (value == null || value === false) node.removeAttributeNS(namespace, name.indexOf(":") > -1 ? name.split(":").pop() : name);else node.setAttributeNS(namespace, name, value === true ? "" : value);
|
|
615
|
+
reclaimAttribute(node, name);
|
|
586
616
|
}
|
|
587
617
|
function className(node, value, prev) {
|
|
588
618
|
if (typeof value === "number") value = "" + value;
|
|
@@ -695,7 +725,7 @@ function readShallow(value) {
|
|
|
695
725
|
if (value === null || typeof value !== "object") return value;
|
|
696
726
|
if (Array.isArray(value)) return value.map(readShallow);
|
|
697
727
|
if (value[$PROXY] !== value) return value;
|
|
698
|
-
const keys =
|
|
728
|
+
const keys = Reflect.ownKeys(value);
|
|
699
729
|
const out = {};
|
|
700
730
|
for (let i = 0; i < keys.length; i++) {
|
|
701
731
|
const k = keys[i];
|
|
@@ -718,32 +748,23 @@ function spread(node, props, skipChildren, skip, name) {
|
|
|
718
748
|
}
|
|
719
749
|
}
|
|
720
750
|
const prevProps = {};
|
|
751
|
+
const owner = claimHandlers !== null && (node.localName === "a" || node.localName === "form") ? getOwner() : undefined;
|
|
721
752
|
const apply = newProps => {
|
|
722
753
|
const r = newProps.ref;
|
|
723
754
|
if (r !== prevProps.ref && (typeof r === "function" || Array.isArray(r))) ref(() => r, node);
|
|
724
755
|
assign(node, newProps, true, prevProps, true);
|
|
756
|
+
if (owner !== undefined) claimElement(node, owner);
|
|
725
757
|
};
|
|
726
758
|
if (Array.isArray(props)) {
|
|
759
|
+
effect(() => collectSources({}, props, undefined, skip), apply);
|
|
727
760
|
if (!skipChildren && !(skip !== undefined && skip("children"))) insert(node, () => {
|
|
728
761
|
for (let i = props.length - 1; i >= 0; i--) {
|
|
729
762
|
const s = resolveSource(props[i]);
|
|
730
763
|
if (s != null && entryHas(s, "children")) return entryGet(s, "children");
|
|
731
764
|
}
|
|
732
765
|
});
|
|
733
|
-
effect(() => collectSources({}, props, undefined, skip), apply);
|
|
734
766
|
return prevProps;
|
|
735
767
|
}
|
|
736
|
-
if (!skipChildren && !(skip !== undefined && skip("children"))) {
|
|
737
|
-
if (typeof props !== "function" && props != null && hasStaticKeys(props)) {
|
|
738
|
-
const desc = Object.getOwnPropertyDescriptor(props, "children");
|
|
739
|
-
if (desc !== undefined) {
|
|
740
|
-
if (desc.get === undefined) insert(node, desc.value);else insert(node, () => props.children);
|
|
741
|
-
}
|
|
742
|
-
} else insert(node, () => {
|
|
743
|
-
const source = resolveSource(props);
|
|
744
|
-
return source != null && entryHas(source, "children") ? entryGet(source, "children") : undefined;
|
|
745
|
-
});
|
|
746
|
-
}
|
|
747
768
|
effect(() => {
|
|
748
769
|
const source = resolveSource(props);
|
|
749
770
|
const newProps = {};
|
|
@@ -755,6 +776,17 @@ function spread(node, props, skipChildren, skip, name) {
|
|
|
755
776
|
}
|
|
756
777
|
return newProps;
|
|
757
778
|
}, apply);
|
|
779
|
+
if (!skipChildren && !(skip !== undefined && skip("children"))) {
|
|
780
|
+
if (typeof props !== "function" && props != null && hasStaticKeys(props)) {
|
|
781
|
+
const desc = Object.getOwnPropertyDescriptor(props, "children");
|
|
782
|
+
if (desc !== undefined) {
|
|
783
|
+
if (desc.get === undefined) insert(node, desc.value);else insert(node, () => props.children);
|
|
784
|
+
}
|
|
785
|
+
} else insert(node, () => {
|
|
786
|
+
const source = resolveSource(props);
|
|
787
|
+
return source != null && entryHas(source, "children") ? entryGet(source, "children") : undefined;
|
|
788
|
+
});
|
|
789
|
+
}
|
|
758
790
|
return prevProps;
|
|
759
791
|
}
|
|
760
792
|
function collectTable(out, table, skip) {
|
|
@@ -939,13 +971,14 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
939
971
|
if (hydrationRt !== null) current = hydrationRt.reclaimRegion(current, parent, marker);
|
|
940
972
|
const value = normalize(accessor(), current, multi, true);
|
|
941
973
|
if (typeof value !== "function") return value;
|
|
974
|
+
const innerOptions = prev !== undefined && !(options && options.schedule) ? {
|
|
975
|
+
...options,
|
|
976
|
+
schedule: true
|
|
977
|
+
} : options;
|
|
942
978
|
effect(() => (hydrationRt !== null && (current = hydrationRt.reclaimRegion(current, parent, marker)), normalize(value, current, multi)), inner => {
|
|
943
979
|
current = insertExpression(parent, inner, current, marker);
|
|
944
980
|
host && tagHost(current, host);
|
|
945
|
-
},
|
|
946
|
-
...options,
|
|
947
|
-
schedule: true
|
|
948
|
-
} : options);
|
|
981
|
+
}, innerOptions);
|
|
949
982
|
return INNER_OWNED;
|
|
950
983
|
}, value => {
|
|
951
984
|
if (value === INNER_OWNED) return;
|
|
@@ -1254,7 +1287,7 @@ function flushHeadRegistry() {
|
|
|
1254
1287
|
function createHeadElement(tag, props) {
|
|
1255
1288
|
const el = document.createElement(tag);
|
|
1256
1289
|
for (const name in props) {
|
|
1257
|
-
if (name === "children" || name === "ref" || name
|
|
1290
|
+
if (name === "children" || name === "ref" || /^on[A-Z]/.test(name)) continue;
|
|
1258
1291
|
if (!HEAD_ATTR_NAME.test(name)) {
|
|
1259
1292
|
continue;
|
|
1260
1293
|
}
|
|
@@ -1262,7 +1295,7 @@ function createHeadElement(tag, props) {
|
|
|
1262
1295
|
if (v == null || v === false) continue;
|
|
1263
1296
|
el.setAttribute(name, v === true ? "" : String(v));
|
|
1264
1297
|
}
|
|
1265
|
-
if (props.children != null) el.textContent = String(props.children);
|
|
1298
|
+
if (props.children != null) el.textContent = headBodyText(tag, props, String(props.children));
|
|
1266
1299
|
return el;
|
|
1267
1300
|
}
|
|
1268
1301
|
function renderHeadElement(t, identity, existing) {
|
|
@@ -1277,7 +1310,7 @@ function renderHeadElement(t, identity, existing) {
|
|
|
1277
1310
|
function headElementMatches(el, t) {
|
|
1278
1311
|
if (el.tagName.toLowerCase() !== t.tag) return false;
|
|
1279
1312
|
for (const name in t.props) {
|
|
1280
|
-
if (name === "children" || name === "ref" || name
|
|
1313
|
+
if (name === "children" || name === "ref" || /^on[A-Z]/.test(name)) continue;
|
|
1281
1314
|
if (!HEAD_ATTR_NAME.test(name)) continue;
|
|
1282
1315
|
const v = t.props[name];
|
|
1283
1316
|
if (v == null || v === false) {
|
|
@@ -1285,7 +1318,7 @@ function headElementMatches(el, t) {
|
|
|
1285
1318
|
} else if (el.getAttribute(name) !== (v === true ? "" : String(v))) return false;
|
|
1286
1319
|
}
|
|
1287
1320
|
const children = t.props.children;
|
|
1288
|
-
return (children == null ? "" : String(children)) === el.textContent;
|
|
1321
|
+
return (children == null ? "" : headBodyText(t.tag, t.props, String(children))) === el.textContent;
|
|
1289
1322
|
}
|
|
1290
1323
|
function mountHeadResource(tag, props) {
|
|
1291
1324
|
const identity = resourceIdentity(tag, props);
|
|
@@ -1401,7 +1434,22 @@ function loadModuleAssets(mapping) {
|
|
|
1401
1434
|
function hydrate(code, element, options = {}) {
|
|
1402
1435
|
enableHydration();
|
|
1403
1436
|
installHydrationRuntime();
|
|
1404
|
-
|
|
1437
|
+
const hy = globalThis._$HY;
|
|
1438
|
+
const id = options.renderId || "";
|
|
1439
|
+
if (hy.s && !hy.s[id] && !hy.s[""] && !hy.done && document.readyState === "loading") {
|
|
1440
|
+
let started, disposer;
|
|
1441
|
+
const start = () => started || (started = true, disposer = hydrate(code, element, options));
|
|
1442
|
+
(hy.sp || (hy.sp = [])).push([id, start]);
|
|
1443
|
+
hy.sw = key => hy.sp.forEach(([k, f]) => (!key || k === key) && queueMicrotask(f));
|
|
1444
|
+
document.addEventListener("DOMContentLoaded", start, {
|
|
1445
|
+
once: true
|
|
1446
|
+
});
|
|
1447
|
+
return () => {
|
|
1448
|
+
started = true;
|
|
1449
|
+
disposer && disposer();
|
|
1450
|
+
};
|
|
1451
|
+
}
|
|
1452
|
+
if (hy.done) return render(code, element, [...element.childNodes], options);
|
|
1405
1453
|
const head = (element.nodeType === 9 ? element : element.ownerDocument).head;
|
|
1406
1454
|
if (head && element.contains(head)) {
|
|
1407
1455
|
let n = head.firstChild;
|
|
@@ -1580,13 +1628,32 @@ function isHydrating(node) {
|
|
|
1580
1628
|
if (!sharedConfig.hydrating) return false;
|
|
1581
1629
|
if (sharedConfig.isClaiming && !sharedConfig.isClaiming()) return false;
|
|
1582
1630
|
if (!node || node.isConnected) return true;
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1631
|
+
return serverComponentClaims !== null && serverComponentClaims.claimed(node);
|
|
1632
|
+
}
|
|
1633
|
+
let serverComponentClaims = null;
|
|
1634
|
+
function installServerComponentHydration() {
|
|
1635
|
+
enableServerComponentHydration();
|
|
1636
|
+
if (serverComponentClaims !== null) return;
|
|
1637
|
+
serverComponentClaims = {
|
|
1638
|
+
claimed(node) {
|
|
1639
|
+
const roots = sharedConfig.claimRoots;
|
|
1640
|
+
if (roots) {
|
|
1641
|
+
for (let i = 0; i < roots.length; i++) {
|
|
1642
|
+
if (roots[i].contains(node)) return true;
|
|
1643
|
+
}
|
|
1644
|
+
}
|
|
1645
|
+
return false;
|
|
1646
|
+
},
|
|
1647
|
+
inFrame(element) {
|
|
1648
|
+
const frames = element.querySelectorAll("[data-fid]");
|
|
1649
|
+
const frameCount = frames.length;
|
|
1650
|
+
if (frameCount === 0) return undefined;
|
|
1651
|
+
return node => {
|
|
1652
|
+
for (let j = 0; j < frameCount; j++) if (frames[j].contains(node)) return true;
|
|
1653
|
+
return false;
|
|
1654
|
+
};
|
|
1587
1655
|
}
|
|
1588
|
-
}
|
|
1589
|
-
return false;
|
|
1656
|
+
};
|
|
1590
1657
|
}
|
|
1591
1658
|
function classListToObject(classList) {
|
|
1592
1659
|
if (Array.isArray(classList)) {
|
|
@@ -1622,8 +1689,9 @@ function assignProp(node, prop, value, prev, skipRef, nodeName) {
|
|
|
1622
1689
|
if (!skipRef && value) ref(() => value, node);
|
|
1623
1690
|
return value;
|
|
1624
1691
|
}
|
|
1692
|
+
let c;
|
|
1625
1693
|
const hasNamespace = prop.indexOf(":") > -1;
|
|
1626
|
-
if (!hasNamespace && prop.
|
|
1694
|
+
if (!hasNamespace && prop.startsWith("on") && (c = prop.charCodeAt(2)) > 64 && c < 91) {
|
|
1627
1695
|
const name = prop.slice(2).toLowerCase();
|
|
1628
1696
|
const delegate = DelegatedEvents.has(name);
|
|
1629
1697
|
if (!delegate && prev) {
|
|
@@ -1637,8 +1705,10 @@ function assignProp(node, prop, value, prev, skipRef, nodeName) {
|
|
|
1637
1705
|
}
|
|
1638
1706
|
} else if (hasNamespace && prop.slice(0, 5) === "prop:" || ChildProperties.has(prop) || DOMWithState[nodeName]?.[prop]) {
|
|
1639
1707
|
if (hasNamespace) prop = prop.slice(5);else if (isHydrating(node)) return value;
|
|
1640
|
-
if (prop === "value" && nodeName === "SELECT")
|
|
1641
|
-
|
|
1708
|
+
if (prop === "value" && nodeName === "SELECT") writeSelectValue(node, value);else if ((prop === "value" || prop === "defaultValue") && (nodeName === "INPUT" || nodeName === "TEXTAREA")) {
|
|
1709
|
+
if (value == null && /^(checkbox|radio)$/.test(node.type)) node.removeAttribute("value");else node[prop] = value ?? "";
|
|
1710
|
+
} else node[prop] = value;
|
|
1711
|
+
reclaimAttribute(node, prop);
|
|
1642
1712
|
} else {
|
|
1643
1713
|
const ns = hasNamespace && Namespaces[prop.split(":")[0]];
|
|
1644
1714
|
if (ns) setAttributeNS(node, ns, prop, value);else setAttribute(node, prop, value);
|
|
@@ -1726,6 +1796,7 @@ function insertExpression(parent, value, current, marker) {
|
|
|
1726
1796
|
return value;
|
|
1727
1797
|
}
|
|
1728
1798
|
if (value === current) return value;
|
|
1799
|
+
if (hydrationRt !== null && sharedConfig.hydrating && current == null && value && [].concat(value).every(n => n?.parentNode === parent) && value.length !== 0) return value;
|
|
1729
1800
|
const t = typeof value,
|
|
1730
1801
|
multi = marker !== undefined;
|
|
1731
1802
|
if (t === "string" || t === "number") {
|
|
@@ -1775,8 +1846,35 @@ function insertExpression(parent, value, current, marker) {
|
|
|
1775
1846
|
appendNodes(parent, value);
|
|
1776
1847
|
}
|
|
1777
1848
|
} else ;
|
|
1849
|
+
selectInsert && selectInsert(parent);
|
|
1778
1850
|
return value;
|
|
1779
1851
|
}
|
|
1852
|
+
let selectInsert;
|
|
1853
|
+
function selectChange(e) {
|
|
1854
|
+
(e = e.currentTarget || e)._$v = null;
|
|
1855
|
+
e.removeEventListener("change", selectChange, true);
|
|
1856
|
+
}
|
|
1857
|
+
function writeSelectValue(node, value) {
|
|
1858
|
+
const had = node._$v && node._$v.map,
|
|
1859
|
+
has = value != null && value.map;
|
|
1860
|
+
if (has) had || node.addEventListener("change", selectChange, true);else had && node.removeEventListener("change", selectChange, true);
|
|
1861
|
+
if (value == null) {
|
|
1862
|
+
node._$v = null;
|
|
1863
|
+
return queueMicrotask(() => node.value = value) || (node.value = value);
|
|
1864
|
+
}
|
|
1865
|
+
node._$v = value;
|
|
1866
|
+
(selectInsert ||= p => {
|
|
1867
|
+
p && p._$v == null && (p = p.parentNode);
|
|
1868
|
+
const v = p && p._$v;
|
|
1869
|
+
if (v == null) return;
|
|
1870
|
+
if (v.map) {
|
|
1871
|
+
const o = [...p.options];
|
|
1872
|
+
for (let i = 0; i < o.length; i++) o[i].selected = v.some(x => x == o[i].value);
|
|
1873
|
+
v.every(x => o.some(el => el.value == x)) && selectChange(p);
|
|
1874
|
+
} else p.value = v, p.selectedIndex > -1 && p.value == v && (p._$v = null);
|
|
1875
|
+
})(node);
|
|
1876
|
+
queueMicrotask(() => selectInsert(node));
|
|
1877
|
+
}
|
|
1780
1878
|
function normalize(value, current, multi, doNotUnwrap) {
|
|
1781
1879
|
value = flatten(value, {
|
|
1782
1880
|
skipNonRendered: true,
|
|
@@ -1854,25 +1952,13 @@ function cleanChildren(parent, current, marker, replacement) {
|
|
|
1854
1952
|
if (replacement && marker) replacement[$$SLOT] = marker;
|
|
1855
1953
|
}
|
|
1856
1954
|
function gatherHydratable(element, root) {
|
|
1857
|
-
const templates = element.querySelectorAll(`*[_hk]`);
|
|
1858
|
-
const
|
|
1859
|
-
const frameCount = frames ? frames.length : 0;
|
|
1955
|
+
const templates = element.querySelectorAll(root ? `[_hk^="${root.replace(/["\\]/g, "\\$&")}"]` : `*[_hk]`);
|
|
1956
|
+
const inFrame = root || serverComponentClaims === null ? undefined : serverComponentClaims.inFrame(element);
|
|
1860
1957
|
const registry = sharedConfig.registry;
|
|
1861
1958
|
for (let i = 0; i < templates.length; i++) {
|
|
1862
1959
|
const node = templates[i];
|
|
1960
|
+
if (inFrame !== undefined && inFrame(node)) continue;
|
|
1863
1961
|
const key = node.getAttribute("_hk");
|
|
1864
|
-
if (root) {
|
|
1865
|
-
if (!key.startsWith(root)) continue;
|
|
1866
|
-
} else if (frameCount !== 0) {
|
|
1867
|
-
let inFrame = false;
|
|
1868
|
-
for (let j = 0; j < frameCount; j++) {
|
|
1869
|
-
if (frames[j].contains(node)) {
|
|
1870
|
-
inFrame = true;
|
|
1871
|
-
break;
|
|
1872
|
-
}
|
|
1873
|
-
}
|
|
1874
|
-
if (inFrame) continue;
|
|
1875
|
-
}
|
|
1876
1962
|
if (!registry.has(key)) registry.set(key, node);
|
|
1877
1963
|
}
|
|
1878
1964
|
}
|
|
@@ -1882,6 +1968,7 @@ function getHydrationKey() {
|
|
|
1882
1968
|
const RequestContext = Symbol();
|
|
1883
1969
|
|
|
1884
1970
|
function configureServerErrors(_config) {}
|
|
1971
|
+
function reportRequestFailure(_error, _event) {}
|
|
1885
1972
|
function throwInBrowser(func) {
|
|
1886
1973
|
const err = new Error(`${func.name} is not supported in the browser, returning undefined`);
|
|
1887
1974
|
console.error(err);
|
|
@@ -1913,9 +2000,11 @@ function composeMiddleware(middlewares) {
|
|
|
1913
2000
|
function ssr(template, ...nodes) {}
|
|
1914
2001
|
function ssrElement(name, props, children, needsId, skip, attrs) {}
|
|
1915
2002
|
function ssrElementAttribute(key, value) {}
|
|
2003
|
+
function ssrLinkClaim(attrs) {}
|
|
1916
2004
|
function ssrClassName(value) {}
|
|
1917
2005
|
function ssrStyle(value) {}
|
|
1918
2006
|
function ssrStyleProperty(name, value) {}
|
|
2007
|
+
function ssrStyleProperties(...entries) {}
|
|
1919
2008
|
function ssrAttribute(key, value) {}
|
|
1920
2009
|
function ssrGroup(fn, n) {}
|
|
1921
2010
|
function ssrHydrationKey() {}
|
|
@@ -1923,17 +2012,24 @@ function resolveSSRNode(node, result, top, nested) {}
|
|
|
1923
2012
|
function escape(s, attr) {}
|
|
1924
2013
|
|
|
1925
2014
|
const ENVELOPE = Symbol.for("solid.ResponseEnvelope");
|
|
1926
|
-
|
|
1927
|
-
const ResponseEnvelope =
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
2015
|
+
let EnvelopeClass;
|
|
2016
|
+
const ResponseEnvelope = function ResponseEnvelope(response, value) {
|
|
2017
|
+
if (!EnvelopeClass) {
|
|
2018
|
+
EnvelopeClass = class extends Response {
|
|
2019
|
+
constructor(response, value) {
|
|
2020
|
+
super(response ? response.body : null, response && {
|
|
2021
|
+
status: response.status,
|
|
2022
|
+
statusText: response.statusText,
|
|
2023
|
+
headers: copyHeaders(response.headers)
|
|
2024
|
+
});
|
|
2025
|
+
this.response = response ? this : undefined;
|
|
2026
|
+
this.value = value;
|
|
2027
|
+
}
|
|
2028
|
+
};
|
|
2029
|
+
EnvelopeClass.prototype[ENVELOPE] = true;
|
|
1933
2030
|
}
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
})();
|
|
2031
|
+
return new EnvelopeClass(response, value);
|
|
2032
|
+
};
|
|
1937
2033
|
function isResponseEnvelope(value) {
|
|
1938
2034
|
return !!(value && typeof value === "object" && value[ENVELOPE]);
|
|
1939
2035
|
}
|
|
@@ -1958,6 +2054,16 @@ function isSafeError(value) {
|
|
|
1958
2054
|
const REVALIDATE_HEADER = "X-Revalidate";
|
|
1959
2055
|
const REVALIDATE_ALL = "*";
|
|
1960
2056
|
const RESPONSE_HEADER_VALUE_LIMIT = 4096;
|
|
2057
|
+
function copyHeaders(init) {
|
|
2058
|
+
const source = init;
|
|
2059
|
+
if (!source || !source.getSetCookie) return new Headers(init);
|
|
2060
|
+
const headers = new Headers();
|
|
2061
|
+
source.forEach((value, key) => {
|
|
2062
|
+
if (key !== "set-cookie") headers.append(key, value);
|
|
2063
|
+
});
|
|
2064
|
+
for (const cookie of source.getSetCookie()) headers.append("Set-Cookie", cookie);
|
|
2065
|
+
return headers;
|
|
2066
|
+
}
|
|
1961
2067
|
function initWithRevalidate(init = {}) {
|
|
1962
2068
|
const resolved = typeof init === "number" ? {
|
|
1963
2069
|
status: init
|
|
@@ -1966,18 +2072,7 @@ function initWithRevalidate(init = {}) {
|
|
|
1966
2072
|
revalidate,
|
|
1967
2073
|
...responseInit
|
|
1968
2074
|
} = resolved;
|
|
1969
|
-
|
|
1970
|
-
if (responseInit.headers && responseInit.headers.getSetCookie) {
|
|
1971
|
-
headers = new Headers();
|
|
1972
|
-
responseInit.headers.forEach((value, key) => {
|
|
1973
|
-
if (key !== "set-cookie") headers.append(key, value);
|
|
1974
|
-
});
|
|
1975
|
-
for (const cookie of responseInit.headers.getSetCookie()) {
|
|
1976
|
-
headers.append("Set-Cookie", cookie);
|
|
1977
|
-
}
|
|
1978
|
-
} else {
|
|
1979
|
-
headers = new Headers(responseInit.headers);
|
|
1980
|
-
}
|
|
2075
|
+
const headers = copyHeaders(responseInit.headers);
|
|
1981
2076
|
if (revalidate !== undefined) {
|
|
1982
2077
|
const list = Array.isArray(revalidate) ? revalidate : [revalidate];
|
|
1983
2078
|
if (list.length > 1 && list.includes(REVALIDATE_ALL)) {
|
|
@@ -2101,103 +2196,8 @@ function portalImpl(props) {
|
|
|
2101
2196
|
});
|
|
2102
2197
|
return treeMarker;
|
|
2103
2198
|
}
|
|
2104
|
-
const COMPONENT_BINDING = Symbol.for("solid.component-binding");
|
|
2105
|
-
const FLIGHT = Symbol("solid.dynamic-flight");
|
|
2106
|
-
function bindingOf(value) {
|
|
2107
|
-
return value !== null && (typeof value === "function" || typeof value === "object") && value[COMPONENT_BINDING] || undefined;
|
|
2108
|
-
}
|
|
2109
2199
|
function dynamic(source, options) {
|
|
2110
|
-
|
|
2111
|
-
const sites = new Set();
|
|
2112
|
-
let deliveredAddress;
|
|
2113
|
-
const resolveBinding = (next, prev) => {
|
|
2114
|
-
const binding = bindingOf(next);
|
|
2115
|
-
if (!binding) return next;
|
|
2116
|
-
deliveredAddress = binding.address;
|
|
2117
|
-
const prevBinding = bindingOf(prev);
|
|
2118
|
-
if (prevBinding && prevBinding.component === binding.component) {
|
|
2119
|
-
for (const deliver of sites) deliver(binding.address);
|
|
2120
|
-
return prev;
|
|
2121
|
-
}
|
|
2122
|
-
return next;
|
|
2123
|
-
};
|
|
2124
|
-
const sameInstance = (prev, next) => {
|
|
2125
|
-
if (prev === next) return true;
|
|
2126
|
-
const held = bindingOf(prev);
|
|
2127
|
-
const incoming = bindingOf(next);
|
|
2128
|
-
if (!held || !incoming || held.component !== incoming.component) return false;
|
|
2129
|
-
if (held.address === incoming.address) return true;
|
|
2130
|
-
if (deliveredAddress === undefined) return false;
|
|
2131
|
-
if (incoming.address !== deliveredAddress) {
|
|
2132
|
-
deliveredAddress = incoming.address;
|
|
2133
|
-
for (const deliver of sites) deliver(incoming.address);
|
|
2134
|
-
}
|
|
2135
|
-
return true;
|
|
2136
|
-
};
|
|
2137
|
-
const cached = createMemo(prev => {
|
|
2138
|
-
const next = source();
|
|
2139
|
-
if (!next || typeof next.then !== "function") return resolveBinding(next, prev);
|
|
2140
|
-
return {
|
|
2141
|
-
[FLIGHT]: next
|
|
2142
|
-
};
|
|
2143
|
-
}, {
|
|
2144
|
-
lazy: true,
|
|
2145
|
-
equals: sameInstance
|
|
2146
|
-
});
|
|
2147
|
-
return props => {
|
|
2148
|
-
if (sharedConfig.hydrating) {
|
|
2149
|
-
try {
|
|
2150
|
-
untrack(cached);
|
|
2151
|
-
} catch {}
|
|
2152
|
-
}
|
|
2153
|
-
let latest = 0;
|
|
2154
|
-
const value = createMemo(prev => {
|
|
2155
|
-
const c = cached();
|
|
2156
|
-
if (!c || !c[FLIGHT]) return resolveBinding(c, prev);
|
|
2157
|
-
const next = c[FLIGHT];
|
|
2158
|
-
const token = ++latest;
|
|
2159
|
-
return {
|
|
2160
|
-
then: (onFulfilled, onRejected) => next.then(resolved => {
|
|
2161
|
-
const landed = token === latest ? resolveBinding(resolved, prev) : resolved;
|
|
2162
|
-
return onFulfilled ? onFulfilled(landed) : landed;
|
|
2163
|
-
}, onRejected)
|
|
2164
|
-
};
|
|
2165
|
-
}, {
|
|
2166
|
-
equals: sameInstance
|
|
2167
|
-
});
|
|
2168
|
-
return createMemo(() => {
|
|
2169
|
-
const component = value();
|
|
2170
|
-
switch (typeof component) {
|
|
2171
|
-
case "function":
|
|
2172
|
-
{
|
|
2173
|
-
const binding = bindingOf(component);
|
|
2174
|
-
if (binding) {
|
|
2175
|
-
const [address, setAddress] = createSignal(deliveredAddress ??= binding.address, {
|
|
2176
|
-
ownedWrite: true
|
|
2177
|
-
});
|
|
2178
|
-
sites.add(setAddress);
|
|
2179
|
-
onCleanup(() => sites.delete(setAddress));
|
|
2180
|
-
return untrack(() => binding.component(props, address));
|
|
2181
|
-
}
|
|
2182
|
-
return untrack(() => component(props));
|
|
2183
|
-
}
|
|
2184
|
-
case "string":
|
|
2185
|
-
return staticElement(component, props);
|
|
2186
|
-
}
|
|
2187
|
-
});
|
|
2188
|
-
};
|
|
2189
|
-
}
|
|
2190
|
-
function staticDynamic(component) {
|
|
2191
|
-
if (typeof component === "function") {
|
|
2192
|
-
const binding = bindingOf(component);
|
|
2193
|
-
if (binding) {
|
|
2194
|
-
const address = () => binding.address;
|
|
2195
|
-
return props => untrack(() => binding.component(props, address));
|
|
2196
|
-
}
|
|
2197
|
-
return props => untrack(() => component(props));
|
|
2198
|
-
}
|
|
2199
|
-
if (typeof component === "string") return props => staticElement(component, props);
|
|
2200
|
-
return () => undefined;
|
|
2200
|
+
return dynamicCore(source, options, staticElement);
|
|
2201
2201
|
}
|
|
2202
2202
|
function staticElement(tag, props) {
|
|
2203
2203
|
const hydrating = sharedConfig.hydrating;
|
|
@@ -2245,4 +2245,4 @@ _moduleUrl) {
|
|
|
2245
2245
|
function httpStatus(_code, _text) {}
|
|
2246
2246
|
function httpHeader(_name, _value, _options) {}
|
|
2247
2247
|
|
|
2248
|
-
export { ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, HydrationScript, MathMLElements, NULL_BODY_STATUSES, Namespaces, Portal, RESPONSE_HEADER_VALUE_LIMIT, REVALIDATE_ALL, REVALIDATE_HEADER, RawTextElements, RequestContext, ResponseEnvelope, SAFE_ERROR, SVGElements, VoidElements, acquireAsset, addEvent, applyRef, assign, claimElement, claimElementTree, className, clearFlashCookie, clientOnly, commitEventResponse, composeMiddleware, configureServerErrors, createRequestEvent, createResponseStub, createSSRResponse, delegateEvents, dynamic, dynamicProperty, effect, escape, generateHydrationScript, getDelegatedRoot, getExpectedRedirectStatus, getFirstChild, getHydrationKey, getHydrationWriter, getNextElement, getNextMarker, getNextMatch, getNextSibling, getRequestEvent, getServerFunctionMetadata, getServerFunctionRPC, getTraceContext, 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, ssrElementAttribute, ssrGroup, ssrHydrationKey, ssrStyle, ssrStyleProperty, style, takeHydrationValue, template, unregisterDelegatedContainer, unregisterDelegatedRoot, useHead, waitAsset, warmAsset };
|
|
2248
|
+
export { ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, HydrationScript, MathMLElements, NULL_BODY_STATUSES, Namespaces, Portal, RESPONSE_HEADER_VALUE_LIMIT, REVALIDATE_ALL, REVALIDATE_HEADER, RawTextElements, RequestContext, ResponseEnvelope, SAFE_ERROR, SVGElements, VoidElements, acquireAsset, addEvent, applyRef, assign, claimElement, claimElementTree, className, clearFlashCookie, clientOnly, commitEventResponse, composeMiddleware, configureServerErrors, createRequestEvent, createResponseStub, createSSRResponse, delegateEvents, dispatchAsInteraction, dynamic, dynamicProperty, effect, escape, generateHydrationScript, getDelegatedRoot, getExpectedRedirectStatus, getFirstChild, getHydrationKey, getHydrationWriter, getNextElement, getNextMarker, getNextMatch, getNextSibling, getRequestEvent, getServerFunctionMetadata, getServerFunctionRPC, getTraceContext, hasFlashCookie, hasServerLinkState, httpHeader, httpStatus, hydrate, insert, installHydrationRuntime, installServerComponentHydration, isDev, isHref, isResponseEnvelope, isSafeError, isServer, isServerFunction, markSafeError, memo, parseCookieHeader, readShallow, redirect, ref, registerDelegatedContainer, registerDelegatedRoot, registerElementClaim, reload, render, renderToStream, renderToString, reportRequestFailure, resolveSSRNode, respond, runHydrationEvents, scope, serializeCookie, setAttribute, setAttributeNS, setLinkClaim, setProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrElementAttribute, ssrGroup, ssrHydrationKey, ssrLinkClaim, ssrStyle, ssrStyleProperties, ssrStyleProperty, style, takeHydrationValue, template, unregisterDelegatedContainer, unregisterDelegatedRoot, useHead, waitAsset, warmAsset };
|