@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.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { createRenderEffect, createMemo, enableHydration, $PROXY, untrack, runWithOwner, createRoot, getOwner, ROOT_ERROR_HOOK, flatten, flush, createComponent, omit, createOwner, createSignal,
|
|
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, 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: {
|
|
@@ -224,6 +224,10 @@ function qualifierValue(name, value) {
|
|
|
224
224
|
function asciiLowerCase(value) {
|
|
225
225
|
return value.replace(/[A-Z]/g, c => String.fromCharCode(c.charCodeAt(0) + 32));
|
|
226
226
|
}
|
|
227
|
+
const JSON_SCRIPT_TYPE = /^(?:importmap|speculationrules)$|^[\t\n\r ]*(?:application\/json|text\/json|[\w!#$%&'*+.^`|~-]+\/[\w!#$%&'*+.^`|~-]*\+json)[\t\n\r ]*(?:;|$)/i;
|
|
228
|
+
function headBodyText(tag, props, text) {
|
|
229
|
+
return tag === "script" && JSON_SCRIPT_TYPE.test(String(props.type)) ? text.replace(/</g, "\\u003C") : text;
|
|
230
|
+
}
|
|
227
231
|
function resourceIdentity(tag, props) {
|
|
228
232
|
const url = String(props.href || props.src || "");
|
|
229
233
|
let id = "res:" + tag + ":" + (props.rel || "") + ":" + url.length + ":" + url;
|
|
@@ -317,7 +321,7 @@ function serializeCookie(name, value, options = {}) {
|
|
|
317
321
|
return cookie;
|
|
318
322
|
}
|
|
319
323
|
const FLASH_COOKIE = "flash";
|
|
320
|
-
const FLASH_MATCHER =
|
|
324
|
+
const FLASH_MATCHER = /(?:^|;\s*)flash=([^;]+)/;
|
|
321
325
|
function hasFlashCookie(cookieHeader) {
|
|
322
326
|
return !!cookieHeader && FLASH_MATCHER.test(cookieHeader);
|
|
323
327
|
}
|
|
@@ -394,6 +398,13 @@ function takeHydrationValue(key) {
|
|
|
394
398
|
value: v
|
|
395
399
|
};
|
|
396
400
|
}
|
|
401
|
+
function setLinkClaim(_handler) {
|
|
402
|
+
return false;
|
|
403
|
+
}
|
|
404
|
+
function hasServerLinkState() {
|
|
405
|
+
const registry = globalThis._$HY && globalThis._$HY.r;
|
|
406
|
+
return !!registry && registry.links === 1;
|
|
407
|
+
}
|
|
397
408
|
const getTraceContext = voidFn;
|
|
398
409
|
function render(code, element, init, options = {}) {
|
|
399
410
|
let disposer;
|
|
@@ -482,6 +493,9 @@ function attachDelegatedEvent(name, container, state) {
|
|
|
482
493
|
state.handlers.set(name, handler);
|
|
483
494
|
container.addEventListener(name, handler);
|
|
484
495
|
}
|
|
496
|
+
function dispatchAsInteraction(e, fn) {
|
|
497
|
+
return fn();
|
|
498
|
+
}
|
|
485
499
|
function getDelegatedRoot(node) {
|
|
486
500
|
while (node) {
|
|
487
501
|
if (delegatedContainers.get(node)?.roots) return node;
|
|
@@ -503,17 +517,31 @@ function findOwner(target, state) {
|
|
|
503
517
|
function setProperty(node, name, value) {
|
|
504
518
|
if (isHydrating(node)) return;
|
|
505
519
|
const nodeName = node.nodeName;
|
|
506
|
-
if (name === "value" && nodeName === "SELECT")
|
|
520
|
+
if (name === "value" && nodeName === "SELECT") writeSelectValue(node, value);else if ((name === "value" || name === "defaultValue") && (nodeName === "INPUT" || nodeName === "TEXTAREA")) {
|
|
521
|
+
if (value == null && /^(checkbox|radio)$/.test(node.type)) node.removeAttribute("value");else node[name] = value ?? "";
|
|
522
|
+
} else node[name] = value;
|
|
523
|
+
reclaimAttribute(node, name);
|
|
507
524
|
}
|
|
508
525
|
let claimHandlers = null;
|
|
526
|
+
const claimAttributeSets = [];
|
|
509
527
|
const CLAIM_SEAM = Symbol.for("solid.element-claims");
|
|
510
|
-
function registerElementClaim(handler) {
|
|
528
|
+
function registerElementClaim(handler, options) {
|
|
511
529
|
(claimHandlers || (claimHandlers = globalThis[CLAIM_SEAM] = [])).push(handler);
|
|
530
|
+
claimAttributeSets.push(options?.attributes || ["href", "action"]);
|
|
512
531
|
return () => {
|
|
513
532
|
const index = claimHandlers.indexOf(handler);
|
|
514
|
-
index > -1
|
|
533
|
+
if (index > -1) {
|
|
534
|
+
claimHandlers.splice(index, 1);
|
|
535
|
+
claimAttributeSets.splice(index, 1);
|
|
536
|
+
}
|
|
515
537
|
};
|
|
516
538
|
}
|
|
539
|
+
function runClaimHandlers(handlers, node) {
|
|
540
|
+
for (let i = 0; i < handlers.length; i++) handlers[i](node);
|
|
541
|
+
}
|
|
542
|
+
function reclaimAttribute(node, name) {
|
|
543
|
+
if (claimHandlers !== null && node._$claimed && claimAttributeSets.some(set => set.includes(name.slice(name.indexOf(":") + 1)))) runClaimHandlers(claimHandlers, node);
|
|
544
|
+
}
|
|
517
545
|
const CLAIMED_ELEMENTS = "a[href], form[action]";
|
|
518
546
|
function claimElementTree(root) {
|
|
519
547
|
const handlers = globalThis[CLAIM_SEAM];
|
|
@@ -521,17 +549,20 @@ function claimElementTree(root) {
|
|
|
521
549
|
const isElement = root.nodeType === 1;
|
|
522
550
|
if (!isElement && root.nodeType !== 11) return root;
|
|
523
551
|
if (isElement && root.matches(CLAIMED_ELEMENTS)) {
|
|
524
|
-
|
|
552
|
+
root._$claimed = true;
|
|
553
|
+
runClaimHandlers(handlers, root);
|
|
525
554
|
}
|
|
526
555
|
const found = root.querySelectorAll(CLAIMED_ELEMENTS);
|
|
527
556
|
for (let i = 0; i < found.length; i++) {
|
|
528
|
-
|
|
557
|
+
found[i]._$claimed = true;
|
|
558
|
+
runClaimHandlers(handlers, found[i]);
|
|
529
559
|
}
|
|
530
560
|
return root;
|
|
531
561
|
}
|
|
532
|
-
function claimElement(node) {
|
|
533
|
-
if (claimHandlers !== null) {
|
|
534
|
-
|
|
562
|
+
function claimElement(node, owner) {
|
|
563
|
+
if (claimHandlers !== null && !node._$claimed) {
|
|
564
|
+
node._$claimed = true;
|
|
565
|
+
if (owner === undefined) runClaimHandlers(claimHandlers, node);else runWithOwner(owner, () => runClaimHandlers(claimHandlers, node));
|
|
535
566
|
}
|
|
536
567
|
return node;
|
|
537
568
|
}
|
|
@@ -548,11 +579,12 @@ function setAttribute(node, name, value) {
|
|
|
548
579
|
}
|
|
549
580
|
}
|
|
550
581
|
if (selectMultiple) node._$multiple = true;
|
|
551
|
-
|
|
582
|
+
reclaimAttribute(node, name);
|
|
552
583
|
}
|
|
553
584
|
function setAttributeNS(node, namespace, name, value) {
|
|
554
585
|
if (isHydrating(node)) return;
|
|
555
586
|
if (value == null || value === false) node.removeAttributeNS(namespace, name.indexOf(":") > -1 ? name.split(":").pop() : name);else node.setAttributeNS(namespace, name, value === true ? "" : value);
|
|
587
|
+
reclaimAttribute(node, name);
|
|
556
588
|
}
|
|
557
589
|
function className(node, value, prev) {
|
|
558
590
|
if (typeof value === "number") value = "" + value;
|
|
@@ -660,7 +692,7 @@ function readShallow(value) {
|
|
|
660
692
|
if (value === null || typeof value !== "object") return value;
|
|
661
693
|
if (Array.isArray(value)) return value.map(readShallow);
|
|
662
694
|
if (value[$PROXY] !== value) return value;
|
|
663
|
-
const keys =
|
|
695
|
+
const keys = Reflect.ownKeys(value);
|
|
664
696
|
const out = {};
|
|
665
697
|
for (let i = 0; i < keys.length; i++) {
|
|
666
698
|
const k = keys[i];
|
|
@@ -674,32 +706,23 @@ function setStyleProperty(node, name, value) {
|
|
|
674
706
|
}
|
|
675
707
|
function spread(node, props, skipChildren, skip, name) {
|
|
676
708
|
const prevProps = {};
|
|
709
|
+
const owner = claimHandlers !== null && (node.localName === "a" || node.localName === "form") ? getOwner() : undefined;
|
|
677
710
|
const apply = newProps => {
|
|
678
711
|
const r = newProps.ref;
|
|
679
712
|
if (r !== prevProps.ref && (typeof r === "function" || Array.isArray(r))) ref(() => r, node);
|
|
680
713
|
assign(node, newProps, true, prevProps, true);
|
|
714
|
+
if (owner !== undefined) claimElement(node, owner);
|
|
681
715
|
};
|
|
682
716
|
if (Array.isArray(props)) {
|
|
717
|
+
effect(() => collectSources({}, props, undefined, skip), apply);
|
|
683
718
|
if (!skipChildren && !(skip !== undefined && skip("children"))) insert(node, () => {
|
|
684
719
|
for (let i = props.length - 1; i >= 0; i--) {
|
|
685
720
|
const s = resolveSource(props[i]);
|
|
686
721
|
if (s != null && entryHas(s, "children")) return entryGet(s, "children");
|
|
687
722
|
}
|
|
688
723
|
});
|
|
689
|
-
effect(() => collectSources({}, props, undefined, skip), apply);
|
|
690
724
|
return prevProps;
|
|
691
725
|
}
|
|
692
|
-
if (!skipChildren && !(skip !== undefined && skip("children"))) {
|
|
693
|
-
if (typeof props !== "function" && props != null && hasStaticKeys(props)) {
|
|
694
|
-
const desc = Object.getOwnPropertyDescriptor(props, "children");
|
|
695
|
-
if (desc !== undefined) {
|
|
696
|
-
if (desc.get === undefined) insert(node, desc.value);else insert(node, () => props.children);
|
|
697
|
-
}
|
|
698
|
-
} else insert(node, () => {
|
|
699
|
-
const source = resolveSource(props);
|
|
700
|
-
return source != null && entryHas(source, "children") ? entryGet(source, "children") : undefined;
|
|
701
|
-
});
|
|
702
|
-
}
|
|
703
726
|
effect(() => {
|
|
704
727
|
const source = resolveSource(props);
|
|
705
728
|
const newProps = {};
|
|
@@ -711,6 +734,17 @@ function spread(node, props, skipChildren, skip, name) {
|
|
|
711
734
|
}
|
|
712
735
|
return newProps;
|
|
713
736
|
}, apply);
|
|
737
|
+
if (!skipChildren && !(skip !== undefined && skip("children"))) {
|
|
738
|
+
if (typeof props !== "function" && props != null && hasStaticKeys(props)) {
|
|
739
|
+
const desc = Object.getOwnPropertyDescriptor(props, "children");
|
|
740
|
+
if (desc !== undefined) {
|
|
741
|
+
if (desc.get === undefined) insert(node, desc.value);else insert(node, () => props.children);
|
|
742
|
+
}
|
|
743
|
+
} else insert(node, () => {
|
|
744
|
+
const source = resolveSource(props);
|
|
745
|
+
return source != null && entryHas(source, "children") ? entryGet(source, "children") : undefined;
|
|
746
|
+
});
|
|
747
|
+
}
|
|
714
748
|
return prevProps;
|
|
715
749
|
}
|
|
716
750
|
function collectTable(out, table, skip) {
|
|
@@ -891,13 +925,14 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
891
925
|
if (hydrationRt !== null) current = hydrationRt.reclaimRegion(current, parent, marker);
|
|
892
926
|
const value = normalize(accessor(), current, multi, true);
|
|
893
927
|
if (typeof value !== "function") return value;
|
|
928
|
+
const innerOptions = prev !== undefined && !(options && options.schedule) ? {
|
|
929
|
+
...options,
|
|
930
|
+
schedule: true
|
|
931
|
+
} : options;
|
|
894
932
|
effect(() => (hydrationRt !== null && (current = hydrationRt.reclaimRegion(current, parent, marker)), normalize(value, current, multi)), inner => {
|
|
895
933
|
current = insertExpression(parent, inner, current, marker);
|
|
896
934
|
host && tagHost(current, host);
|
|
897
|
-
},
|
|
898
|
-
...options,
|
|
899
|
-
schedule: true
|
|
900
|
-
} : options);
|
|
935
|
+
}, innerOptions);
|
|
901
936
|
return INNER_OWNED;
|
|
902
937
|
}, value => {
|
|
903
938
|
if (value === INNER_OWNED) return;
|
|
@@ -1206,7 +1241,7 @@ function flushHeadRegistry() {
|
|
|
1206
1241
|
function createHeadElement(tag, props) {
|
|
1207
1242
|
const el = document.createElement(tag);
|
|
1208
1243
|
for (const name in props) {
|
|
1209
|
-
if (name === "children" || name === "ref" || name
|
|
1244
|
+
if (name === "children" || name === "ref" || /^on[A-Z]/.test(name)) continue;
|
|
1210
1245
|
if (!HEAD_ATTR_NAME.test(name)) {
|
|
1211
1246
|
continue;
|
|
1212
1247
|
}
|
|
@@ -1214,7 +1249,7 @@ function createHeadElement(tag, props) {
|
|
|
1214
1249
|
if (v == null || v === false) continue;
|
|
1215
1250
|
el.setAttribute(name, v === true ? "" : String(v));
|
|
1216
1251
|
}
|
|
1217
|
-
if (props.children != null) el.textContent = String(props.children);
|
|
1252
|
+
if (props.children != null) el.textContent = headBodyText(tag, props, String(props.children));
|
|
1218
1253
|
return el;
|
|
1219
1254
|
}
|
|
1220
1255
|
function renderHeadElement(t, identity, existing) {
|
|
@@ -1229,7 +1264,7 @@ function renderHeadElement(t, identity, existing) {
|
|
|
1229
1264
|
function headElementMatches(el, t) {
|
|
1230
1265
|
if (el.tagName.toLowerCase() !== t.tag) return false;
|
|
1231
1266
|
for (const name in t.props) {
|
|
1232
|
-
if (name === "children" || name === "ref" || name
|
|
1267
|
+
if (name === "children" || name === "ref" || /^on[A-Z]/.test(name)) continue;
|
|
1233
1268
|
if (!HEAD_ATTR_NAME.test(name)) continue;
|
|
1234
1269
|
const v = t.props[name];
|
|
1235
1270
|
if (v == null || v === false) {
|
|
@@ -1237,7 +1272,7 @@ function headElementMatches(el, t) {
|
|
|
1237
1272
|
} else if (el.getAttribute(name) !== (v === true ? "" : String(v))) return false;
|
|
1238
1273
|
}
|
|
1239
1274
|
const children = t.props.children;
|
|
1240
|
-
return (children == null ? "" : String(children)) === el.textContent;
|
|
1275
|
+
return (children == null ? "" : headBodyText(t.tag, t.props, String(children))) === el.textContent;
|
|
1241
1276
|
}
|
|
1242
1277
|
function mountHeadResource(tag, props) {
|
|
1243
1278
|
const identity = resourceIdentity(tag, props);
|
|
@@ -1353,7 +1388,22 @@ function loadModuleAssets(mapping) {
|
|
|
1353
1388
|
function hydrate(code, element, options = {}) {
|
|
1354
1389
|
enableHydration();
|
|
1355
1390
|
installHydrationRuntime();
|
|
1356
|
-
|
|
1391
|
+
const hy = globalThis._$HY;
|
|
1392
|
+
const id = options.renderId || "";
|
|
1393
|
+
if (hy.s && !hy.s[id] && !hy.s[""] && !hy.done && document.readyState === "loading") {
|
|
1394
|
+
let started, disposer;
|
|
1395
|
+
const start = () => started || (started = true, disposer = hydrate(code, element, options));
|
|
1396
|
+
(hy.sp || (hy.sp = [])).push([id, start]);
|
|
1397
|
+
hy.sw = key => hy.sp.forEach(([k, f]) => (!key || k === key) && queueMicrotask(f));
|
|
1398
|
+
document.addEventListener("DOMContentLoaded", start, {
|
|
1399
|
+
once: true
|
|
1400
|
+
});
|
|
1401
|
+
return () => {
|
|
1402
|
+
started = true;
|
|
1403
|
+
disposer && disposer();
|
|
1404
|
+
};
|
|
1405
|
+
}
|
|
1406
|
+
if (hy.done) return render(code, element, [...element.childNodes], options);
|
|
1357
1407
|
const head = (element.nodeType === 9 ? element : element.ownerDocument).head;
|
|
1358
1408
|
if (head && element.contains(head)) {
|
|
1359
1409
|
let n = head.firstChild;
|
|
@@ -1532,13 +1582,32 @@ function isHydrating(node) {
|
|
|
1532
1582
|
if (!sharedConfig.hydrating) return false;
|
|
1533
1583
|
if (sharedConfig.isClaiming && !sharedConfig.isClaiming()) return false;
|
|
1534
1584
|
if (!node || node.isConnected) return true;
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1585
|
+
return serverComponentClaims !== null && serverComponentClaims.claimed(node);
|
|
1586
|
+
}
|
|
1587
|
+
let serverComponentClaims = null;
|
|
1588
|
+
function installServerComponentHydration() {
|
|
1589
|
+
enableServerComponentHydration();
|
|
1590
|
+
if (serverComponentClaims !== null) return;
|
|
1591
|
+
serverComponentClaims = {
|
|
1592
|
+
claimed(node) {
|
|
1593
|
+
const roots = sharedConfig.claimRoots;
|
|
1594
|
+
if (roots) {
|
|
1595
|
+
for (let i = 0; i < roots.length; i++) {
|
|
1596
|
+
if (roots[i].contains(node)) return true;
|
|
1597
|
+
}
|
|
1598
|
+
}
|
|
1599
|
+
return false;
|
|
1600
|
+
},
|
|
1601
|
+
inFrame(element) {
|
|
1602
|
+
const frames = element.querySelectorAll("[data-fid]");
|
|
1603
|
+
const frameCount = frames.length;
|
|
1604
|
+
if (frameCount === 0) return undefined;
|
|
1605
|
+
return node => {
|
|
1606
|
+
for (let j = 0; j < frameCount; j++) if (frames[j].contains(node)) return true;
|
|
1607
|
+
return false;
|
|
1608
|
+
};
|
|
1539
1609
|
}
|
|
1540
|
-
}
|
|
1541
|
-
return false;
|
|
1610
|
+
};
|
|
1542
1611
|
}
|
|
1543
1612
|
function classListToObject(classList) {
|
|
1544
1613
|
if (Array.isArray(classList)) {
|
|
@@ -1574,8 +1643,9 @@ function assignProp(node, prop, value, prev, skipRef, nodeName) {
|
|
|
1574
1643
|
if (!skipRef && value) ref(() => value, node);
|
|
1575
1644
|
return value;
|
|
1576
1645
|
}
|
|
1646
|
+
let c;
|
|
1577
1647
|
const hasNamespace = prop.indexOf(":") > -1;
|
|
1578
|
-
if (!hasNamespace && prop.
|
|
1648
|
+
if (!hasNamespace && prop.startsWith("on") && (c = prop.charCodeAt(2)) > 64 && c < 91) {
|
|
1579
1649
|
const name = prop.slice(2).toLowerCase();
|
|
1580
1650
|
const delegate = DelegatedEvents.has(name);
|
|
1581
1651
|
if (!delegate && prev) {
|
|
@@ -1589,8 +1659,10 @@ function assignProp(node, prop, value, prev, skipRef, nodeName) {
|
|
|
1589
1659
|
}
|
|
1590
1660
|
} else if (hasNamespace && prop.slice(0, 5) === "prop:" || ChildProperties.has(prop) || DOMWithState[nodeName]?.[prop]) {
|
|
1591
1661
|
if (hasNamespace) prop = prop.slice(5);else if (isHydrating(node)) return value;
|
|
1592
|
-
if (prop === "value" && nodeName === "SELECT")
|
|
1593
|
-
|
|
1662
|
+
if (prop === "value" && nodeName === "SELECT") writeSelectValue(node, value);else if ((prop === "value" || prop === "defaultValue") && (nodeName === "INPUT" || nodeName === "TEXTAREA")) {
|
|
1663
|
+
if (value == null && /^(checkbox|radio)$/.test(node.type)) node.removeAttribute("value");else node[prop] = value ?? "";
|
|
1664
|
+
} else node[prop] = value;
|
|
1665
|
+
reclaimAttribute(node, prop);
|
|
1594
1666
|
} else {
|
|
1595
1667
|
const ns = hasNamespace && Namespaces[prop.split(":")[0]];
|
|
1596
1668
|
if (ns) setAttributeNS(node, ns, prop, value);else setAttribute(node, prop, value);
|
|
@@ -1678,6 +1750,7 @@ function insertExpression(parent, value, current, marker) {
|
|
|
1678
1750
|
return value;
|
|
1679
1751
|
}
|
|
1680
1752
|
if (value === current) return value;
|
|
1753
|
+
if (hydrationRt !== null && sharedConfig.hydrating && current == null && value && [].concat(value).every(n => n?.parentNode === parent) && value.length !== 0) return value;
|
|
1681
1754
|
const t = typeof value,
|
|
1682
1755
|
multi = marker !== undefined;
|
|
1683
1756
|
if (t === "string" || t === "number") {
|
|
@@ -1727,8 +1800,35 @@ function insertExpression(parent, value, current, marker) {
|
|
|
1727
1800
|
appendNodes(parent, value);
|
|
1728
1801
|
}
|
|
1729
1802
|
} else ;
|
|
1803
|
+
selectInsert && selectInsert(parent);
|
|
1730
1804
|
return value;
|
|
1731
1805
|
}
|
|
1806
|
+
let selectInsert;
|
|
1807
|
+
function selectChange(e) {
|
|
1808
|
+
(e = e.currentTarget || e)._$v = null;
|
|
1809
|
+
e.removeEventListener("change", selectChange, true);
|
|
1810
|
+
}
|
|
1811
|
+
function writeSelectValue(node, value) {
|
|
1812
|
+
const had = node._$v && node._$v.map,
|
|
1813
|
+
has = value != null && value.map;
|
|
1814
|
+
if (has) had || node.addEventListener("change", selectChange, true);else had && node.removeEventListener("change", selectChange, true);
|
|
1815
|
+
if (value == null) {
|
|
1816
|
+
node._$v = null;
|
|
1817
|
+
return queueMicrotask(() => node.value = value) || (node.value = value);
|
|
1818
|
+
}
|
|
1819
|
+
node._$v = value;
|
|
1820
|
+
(selectInsert ||= p => {
|
|
1821
|
+
p && p._$v == null && (p = p.parentNode);
|
|
1822
|
+
const v = p && p._$v;
|
|
1823
|
+
if (v == null) return;
|
|
1824
|
+
if (v.map) {
|
|
1825
|
+
const o = [...p.options];
|
|
1826
|
+
for (let i = 0; i < o.length; i++) o[i].selected = v.some(x => x == o[i].value);
|
|
1827
|
+
v.every(x => o.some(el => el.value == x)) && selectChange(p);
|
|
1828
|
+
} else p.value = v, p.selectedIndex > -1 && p.value == v && (p._$v = null);
|
|
1829
|
+
})(node);
|
|
1830
|
+
queueMicrotask(() => selectInsert(node));
|
|
1831
|
+
}
|
|
1732
1832
|
function normalize(value, current, multi, doNotUnwrap) {
|
|
1733
1833
|
value = flatten(value, {
|
|
1734
1834
|
skipNonRendered: true,
|
|
@@ -1806,25 +1906,13 @@ function cleanChildren(parent, current, marker, replacement) {
|
|
|
1806
1906
|
if (replacement && marker) replacement[$$SLOT] = marker;
|
|
1807
1907
|
}
|
|
1808
1908
|
function gatherHydratable(element, root) {
|
|
1809
|
-
const templates = element.querySelectorAll(`*[_hk]`);
|
|
1810
|
-
const
|
|
1811
|
-
const frameCount = frames ? frames.length : 0;
|
|
1909
|
+
const templates = element.querySelectorAll(root ? `[_hk^="${root.replace(/["\\]/g, "\\$&")}"]` : `*[_hk]`);
|
|
1910
|
+
const inFrame = root || serverComponentClaims === null ? undefined : serverComponentClaims.inFrame(element);
|
|
1812
1911
|
const registry = sharedConfig.registry;
|
|
1813
1912
|
for (let i = 0; i < templates.length; i++) {
|
|
1814
1913
|
const node = templates[i];
|
|
1914
|
+
if (inFrame !== undefined && inFrame(node)) continue;
|
|
1815
1915
|
const key = node.getAttribute("_hk");
|
|
1816
|
-
if (root) {
|
|
1817
|
-
if (!key.startsWith(root)) continue;
|
|
1818
|
-
} else if (frameCount !== 0) {
|
|
1819
|
-
let inFrame = false;
|
|
1820
|
-
for (let j = 0; j < frameCount; j++) {
|
|
1821
|
-
if (frames[j].contains(node)) {
|
|
1822
|
-
inFrame = true;
|
|
1823
|
-
break;
|
|
1824
|
-
}
|
|
1825
|
-
}
|
|
1826
|
-
if (inFrame) continue;
|
|
1827
|
-
}
|
|
1828
1916
|
if (!registry.has(key)) registry.set(key, node);
|
|
1829
1917
|
}
|
|
1830
1918
|
}
|
|
@@ -1834,6 +1922,7 @@ function getHydrationKey() {
|
|
|
1834
1922
|
const RequestContext = Symbol();
|
|
1835
1923
|
|
|
1836
1924
|
function configureServerErrors(_config) {}
|
|
1925
|
+
function reportRequestFailure(_error, _event) {}
|
|
1837
1926
|
function throwInBrowser(func) {
|
|
1838
1927
|
const err = new Error(`${func.name} is not supported in the browser, returning undefined`);
|
|
1839
1928
|
console.error(err);
|
|
@@ -1865,9 +1954,11 @@ function composeMiddleware(middlewares) {
|
|
|
1865
1954
|
function ssr(template, ...nodes) {}
|
|
1866
1955
|
function ssrElement(name, props, children, needsId, skip, attrs) {}
|
|
1867
1956
|
function ssrElementAttribute(key, value) {}
|
|
1957
|
+
function ssrLinkClaim(attrs) {}
|
|
1868
1958
|
function ssrClassName(value) {}
|
|
1869
1959
|
function ssrStyle(value) {}
|
|
1870
1960
|
function ssrStyleProperty(name, value) {}
|
|
1961
|
+
function ssrStyleProperties(...entries) {}
|
|
1871
1962
|
function ssrAttribute(key, value) {}
|
|
1872
1963
|
function ssrGroup(fn, n) {}
|
|
1873
1964
|
function ssrHydrationKey() {}
|
|
@@ -1875,17 +1966,24 @@ function resolveSSRNode(node, result, top, nested) {}
|
|
|
1875
1966
|
function escape(s, attr) {}
|
|
1876
1967
|
|
|
1877
1968
|
const ENVELOPE = Symbol.for("solid.ResponseEnvelope");
|
|
1878
|
-
|
|
1879
|
-
const ResponseEnvelope =
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1969
|
+
let EnvelopeClass;
|
|
1970
|
+
const ResponseEnvelope = function ResponseEnvelope(response, value) {
|
|
1971
|
+
if (!EnvelopeClass) {
|
|
1972
|
+
EnvelopeClass = class extends Response {
|
|
1973
|
+
constructor(response, value) {
|
|
1974
|
+
super(response ? response.body : null, response && {
|
|
1975
|
+
status: response.status,
|
|
1976
|
+
statusText: response.statusText,
|
|
1977
|
+
headers: copyHeaders(response.headers)
|
|
1978
|
+
});
|
|
1979
|
+
this.response = response ? this : undefined;
|
|
1980
|
+
this.value = value;
|
|
1981
|
+
}
|
|
1982
|
+
};
|
|
1983
|
+
EnvelopeClass.prototype[ENVELOPE] = true;
|
|
1885
1984
|
}
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
})();
|
|
1985
|
+
return new EnvelopeClass(response, value);
|
|
1986
|
+
};
|
|
1889
1987
|
function isResponseEnvelope(value) {
|
|
1890
1988
|
return !!(value && typeof value === "object" && value[ENVELOPE]);
|
|
1891
1989
|
}
|
|
@@ -1910,6 +2008,16 @@ function isSafeError(value) {
|
|
|
1910
2008
|
const REVALIDATE_HEADER = "X-Revalidate";
|
|
1911
2009
|
const REVALIDATE_ALL = "*";
|
|
1912
2010
|
const RESPONSE_HEADER_VALUE_LIMIT = 4096;
|
|
2011
|
+
function copyHeaders(init) {
|
|
2012
|
+
const source = init;
|
|
2013
|
+
if (!source || !source.getSetCookie) return new Headers(init);
|
|
2014
|
+
const headers = new Headers();
|
|
2015
|
+
source.forEach((value, key) => {
|
|
2016
|
+
if (key !== "set-cookie") headers.append(key, value);
|
|
2017
|
+
});
|
|
2018
|
+
for (const cookie of source.getSetCookie()) headers.append("Set-Cookie", cookie);
|
|
2019
|
+
return headers;
|
|
2020
|
+
}
|
|
1913
2021
|
function initWithRevalidate(init = {}) {
|
|
1914
2022
|
const resolved = typeof init === "number" ? {
|
|
1915
2023
|
status: init
|
|
@@ -1918,18 +2026,7 @@ function initWithRevalidate(init = {}) {
|
|
|
1918
2026
|
revalidate,
|
|
1919
2027
|
...responseInit
|
|
1920
2028
|
} = resolved;
|
|
1921
|
-
|
|
1922
|
-
if (responseInit.headers && responseInit.headers.getSetCookie) {
|
|
1923
|
-
headers = new Headers();
|
|
1924
|
-
responseInit.headers.forEach((value, key) => {
|
|
1925
|
-
if (key !== "set-cookie") headers.append(key, value);
|
|
1926
|
-
});
|
|
1927
|
-
for (const cookie of responseInit.headers.getSetCookie()) {
|
|
1928
|
-
headers.append("Set-Cookie", cookie);
|
|
1929
|
-
}
|
|
1930
|
-
} else {
|
|
1931
|
-
headers = new Headers(responseInit.headers);
|
|
1932
|
-
}
|
|
2029
|
+
const headers = copyHeaders(responseInit.headers);
|
|
1933
2030
|
if (revalidate !== undefined) {
|
|
1934
2031
|
const list = Array.isArray(revalidate) ? revalidate : [revalidate];
|
|
1935
2032
|
if (list.length > 1 && list.includes(REVALIDATE_ALL)) {
|
|
@@ -2053,103 +2150,8 @@ function portalImpl(props) {
|
|
|
2053
2150
|
});
|
|
2054
2151
|
return treeMarker;
|
|
2055
2152
|
}
|
|
2056
|
-
const COMPONENT_BINDING = Symbol.for("solid.component-binding");
|
|
2057
|
-
const FLIGHT = Symbol("solid.dynamic-flight");
|
|
2058
|
-
function bindingOf(value) {
|
|
2059
|
-
return value !== null && (typeof value === "function" || typeof value === "object") && value[COMPONENT_BINDING] || undefined;
|
|
2060
|
-
}
|
|
2061
2153
|
function dynamic(source, options) {
|
|
2062
|
-
|
|
2063
|
-
const sites = new Set();
|
|
2064
|
-
let deliveredAddress;
|
|
2065
|
-
const resolveBinding = (next, prev) => {
|
|
2066
|
-
const binding = bindingOf(next);
|
|
2067
|
-
if (!binding) return next;
|
|
2068
|
-
deliveredAddress = binding.address;
|
|
2069
|
-
const prevBinding = bindingOf(prev);
|
|
2070
|
-
if (prevBinding && prevBinding.component === binding.component) {
|
|
2071
|
-
for (const deliver of sites) deliver(binding.address);
|
|
2072
|
-
return prev;
|
|
2073
|
-
}
|
|
2074
|
-
return next;
|
|
2075
|
-
};
|
|
2076
|
-
const sameInstance = (prev, next) => {
|
|
2077
|
-
if (prev === next) return true;
|
|
2078
|
-
const held = bindingOf(prev);
|
|
2079
|
-
const incoming = bindingOf(next);
|
|
2080
|
-
if (!held || !incoming || held.component !== incoming.component) return false;
|
|
2081
|
-
if (held.address === incoming.address) return true;
|
|
2082
|
-
if (deliveredAddress === undefined) return false;
|
|
2083
|
-
if (incoming.address !== deliveredAddress) {
|
|
2084
|
-
deliveredAddress = incoming.address;
|
|
2085
|
-
for (const deliver of sites) deliver(incoming.address);
|
|
2086
|
-
}
|
|
2087
|
-
return true;
|
|
2088
|
-
};
|
|
2089
|
-
const cached = createMemo(prev => {
|
|
2090
|
-
const next = source();
|
|
2091
|
-
if (!next || typeof next.then !== "function") return resolveBinding(next, prev);
|
|
2092
|
-
return {
|
|
2093
|
-
[FLIGHT]: next
|
|
2094
|
-
};
|
|
2095
|
-
}, {
|
|
2096
|
-
lazy: true,
|
|
2097
|
-
equals: sameInstance
|
|
2098
|
-
});
|
|
2099
|
-
return props => {
|
|
2100
|
-
if (sharedConfig.hydrating) {
|
|
2101
|
-
try {
|
|
2102
|
-
untrack(cached);
|
|
2103
|
-
} catch {}
|
|
2104
|
-
}
|
|
2105
|
-
let latest = 0;
|
|
2106
|
-
const value = createMemo(prev => {
|
|
2107
|
-
const c = cached();
|
|
2108
|
-
if (!c || !c[FLIGHT]) return resolveBinding(c, prev);
|
|
2109
|
-
const next = c[FLIGHT];
|
|
2110
|
-
const token = ++latest;
|
|
2111
|
-
return {
|
|
2112
|
-
then: (onFulfilled, onRejected) => next.then(resolved => {
|
|
2113
|
-
const landed = token === latest ? resolveBinding(resolved, prev) : resolved;
|
|
2114
|
-
return onFulfilled ? onFulfilled(landed) : landed;
|
|
2115
|
-
}, onRejected)
|
|
2116
|
-
};
|
|
2117
|
-
}, {
|
|
2118
|
-
equals: sameInstance
|
|
2119
|
-
});
|
|
2120
|
-
return createMemo(() => {
|
|
2121
|
-
const component = value();
|
|
2122
|
-
switch (typeof component) {
|
|
2123
|
-
case "function":
|
|
2124
|
-
{
|
|
2125
|
-
const binding = bindingOf(component);
|
|
2126
|
-
if (binding) {
|
|
2127
|
-
const [address, setAddress] = createSignal(deliveredAddress ??= binding.address, {
|
|
2128
|
-
ownedWrite: true
|
|
2129
|
-
});
|
|
2130
|
-
sites.add(setAddress);
|
|
2131
|
-
onCleanup(() => sites.delete(setAddress));
|
|
2132
|
-
return untrack(() => binding.component(props, address));
|
|
2133
|
-
}
|
|
2134
|
-
return untrack(() => component(props));
|
|
2135
|
-
}
|
|
2136
|
-
case "string":
|
|
2137
|
-
return staticElement(component, props);
|
|
2138
|
-
}
|
|
2139
|
-
});
|
|
2140
|
-
};
|
|
2141
|
-
}
|
|
2142
|
-
function staticDynamic(component) {
|
|
2143
|
-
if (typeof component === "function") {
|
|
2144
|
-
const binding = bindingOf(component);
|
|
2145
|
-
if (binding) {
|
|
2146
|
-
const address = () => binding.address;
|
|
2147
|
-
return props => untrack(() => binding.component(props, address));
|
|
2148
|
-
}
|
|
2149
|
-
return props => untrack(() => component(props));
|
|
2150
|
-
}
|
|
2151
|
-
if (typeof component === "string") return props => staticElement(component, props);
|
|
2152
|
-
return () => undefined;
|
|
2154
|
+
return dynamicCore(source, options, staticElement);
|
|
2153
2155
|
}
|
|
2154
2156
|
function staticElement(tag, props) {
|
|
2155
2157
|
const hydrating = sharedConfig.hydrating;
|
|
@@ -2197,4 +2199,4 @@ _moduleUrl) {
|
|
|
2197
2199
|
function httpStatus(_code, _text) {}
|
|
2198
2200
|
function httpHeader(_name, _value, _options) {}
|
|
2199
2201
|
|
|
2200
|
-
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 };
|
|
2202
|
+
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 };
|