@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.dev.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { createRenderEffect, getOwner, createMemo, OBSERVE, DEV, enableHydration, $PROXY, untrack, runWithOwner, resetErrorHalt, enforceLoadingBoundary, createRoot, 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, getOwner, createMemo, OBSERVE, DEV, enableHydration, $PROXY, untrack, runWithOwner, resetErrorHalt, enforceLoadingBoundary, createRoot, 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: {
|
|
@@ -231,6 +231,24 @@ function unscopedHoleAllocatedIds(before, after, site, subject) {
|
|
|
231
231
|
}
|
|
232
232
|
}, subject);
|
|
233
233
|
}
|
|
234
|
+
const lowercaseEventAttributesReported = /*#__PURE__*/new Set();
|
|
235
|
+
function lowercaseEventAttribute(name, node) {
|
|
236
|
+
if (lowercaseEventAttributesReported.has(name)) return;
|
|
237
|
+
lowercaseEventAttributesReported.add(name);
|
|
238
|
+
const event = name.slice(name.charAt(2) === ":" ? 3 : 2);
|
|
239
|
+
const handler = "on" + event.charAt(0).toUpperCase() + event.slice(1);
|
|
240
|
+
devCheck({
|
|
241
|
+
code: "LOWERCASE_EVENT_ATTRIBUTE",
|
|
242
|
+
kind: "render",
|
|
243
|
+
severity: "warn",
|
|
244
|
+
message: `[LOWERCASE_EVENT_ATTRIBUTE] \`${name}\` received a function, but \`${name}\` is an attribute ` + `in Solid 2.0, not an event handler: the function was set as the attribute's text. ` + `Use \`${handler}\` for event handlers.`,
|
|
245
|
+
data: {
|
|
246
|
+
name,
|
|
247
|
+
handler,
|
|
248
|
+
tag: node.localName
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
}
|
|
234
252
|
|
|
235
253
|
const HEAD_ELIGIBLE_TAGS = new Set(["title", "meta", "link", "style", "script", "base"]);
|
|
236
254
|
const HEAD_ATTR_NAME = /^[a-zA-Z_][a-zA-Z0-9_:.-]*$/;
|
|
@@ -275,6 +293,10 @@ function qualifierValue(name, value) {
|
|
|
275
293
|
function asciiLowerCase(value) {
|
|
276
294
|
return value.replace(/[A-Z]/g, c => String.fromCharCode(c.charCodeAt(0) + 32));
|
|
277
295
|
}
|
|
296
|
+
const JSON_SCRIPT_TYPE = /^(?:importmap|speculationrules)$|^[\t\n\r ]*(?:application\/json|text\/json|[\w!#$%&'*+.^`|~-]+\/[\w!#$%&'*+.^`|~-]*\+json)[\t\n\r ]*(?:;|$)/i;
|
|
297
|
+
function headBodyText(tag, props, text) {
|
|
298
|
+
return tag === "script" && JSON_SCRIPT_TYPE.test(String(props.type)) ? text.replace(/</g, "\\u003C") : text;
|
|
299
|
+
}
|
|
278
300
|
function resourceIdentity(tag, props) {
|
|
279
301
|
const url = String(props.href || props.src || "");
|
|
280
302
|
let id = "res:" + tag + ":" + (props.rel || "") + ":" + url.length + ":" + url;
|
|
@@ -398,7 +420,7 @@ function assertServableCookie(name, options) {
|
|
|
398
420
|
}
|
|
399
421
|
}
|
|
400
422
|
const FLASH_COOKIE = "flash";
|
|
401
|
-
const FLASH_MATCHER =
|
|
423
|
+
const FLASH_MATCHER = /(?:^|;\s*)flash=([^;]+)/;
|
|
402
424
|
function hasFlashCookie(cookieHeader) {
|
|
403
425
|
return !!cookieHeader && FLASH_MATCHER.test(cookieHeader);
|
|
404
426
|
}
|
|
@@ -475,6 +497,13 @@ function takeHydrationValue(key) {
|
|
|
475
497
|
value: v
|
|
476
498
|
};
|
|
477
499
|
}
|
|
500
|
+
function setLinkClaim(_handler) {
|
|
501
|
+
return false;
|
|
502
|
+
}
|
|
503
|
+
function hasServerLinkState() {
|
|
504
|
+
const registry = globalThis._$HY && globalThis._$HY.r;
|
|
505
|
+
return !!registry && registry.links === 1;
|
|
506
|
+
}
|
|
478
507
|
const getTraceContext = voidFn;
|
|
479
508
|
function render(code, element, init, options = {}) {
|
|
480
509
|
if (!element) {
|
|
@@ -591,8 +620,9 @@ function dispatchAsInteraction(e, fn) {
|
|
|
591
620
|
return OBSERVE.attribution.withInteraction({
|
|
592
621
|
type: e.type,
|
|
593
622
|
target: describeEventTarget(e.target),
|
|
594
|
-
at: interactionStart(e)
|
|
595
|
-
|
|
623
|
+
at: interactionStart(e),
|
|
624
|
+
event: e
|
|
625
|
+
}, fn) ;
|
|
596
626
|
}
|
|
597
627
|
function getDelegatedRoot(node) {
|
|
598
628
|
while (node) {
|
|
@@ -616,17 +646,31 @@ function setProperty(node, name, value) {
|
|
|
616
646
|
tagElement(node);
|
|
617
647
|
if (isHydrating(node)) return;
|
|
618
648
|
const nodeName = node.nodeName;
|
|
619
|
-
if (name === "value" && nodeName === "SELECT")
|
|
649
|
+
if (name === "value" && nodeName === "SELECT") writeSelectValue(node, value);else if ((name === "value" || name === "defaultValue") && (nodeName === "INPUT" || nodeName === "TEXTAREA")) {
|
|
650
|
+
if (value == null && /^(checkbox|radio)$/.test(node.type)) node.removeAttribute("value");else node[name] = value ?? "";
|
|
651
|
+
} else node[name] = value;
|
|
652
|
+
reclaimAttribute(node, name);
|
|
620
653
|
}
|
|
621
654
|
let claimHandlers = null;
|
|
655
|
+
const claimAttributeSets = [];
|
|
622
656
|
const CLAIM_SEAM = Symbol.for("solid.element-claims");
|
|
623
|
-
function registerElementClaim(handler) {
|
|
657
|
+
function registerElementClaim(handler, options) {
|
|
624
658
|
(claimHandlers || (claimHandlers = globalThis[CLAIM_SEAM] = [])).push(handler);
|
|
659
|
+
claimAttributeSets.push(options?.attributes || ["href", "action"]);
|
|
625
660
|
return () => {
|
|
626
661
|
const index = claimHandlers.indexOf(handler);
|
|
627
|
-
index > -1
|
|
662
|
+
if (index > -1) {
|
|
663
|
+
claimHandlers.splice(index, 1);
|
|
664
|
+
claimAttributeSets.splice(index, 1);
|
|
665
|
+
}
|
|
628
666
|
};
|
|
629
667
|
}
|
|
668
|
+
function runClaimHandlers(handlers, node) {
|
|
669
|
+
for (let i = 0; i < handlers.length; i++) handlers[i](node);
|
|
670
|
+
}
|
|
671
|
+
function reclaimAttribute(node, name) {
|
|
672
|
+
if (claimHandlers !== null && node._$claimed && claimAttributeSets.some(set => set.includes(name.slice(name.indexOf(":") + 1)))) runClaimHandlers(claimHandlers, node);
|
|
673
|
+
}
|
|
630
674
|
const CLAIMED_ELEMENTS = "a[href], form[action]";
|
|
631
675
|
function claimElementTree(root) {
|
|
632
676
|
const handlers = globalThis[CLAIM_SEAM];
|
|
@@ -634,22 +678,28 @@ function claimElementTree(root) {
|
|
|
634
678
|
const isElement = root.nodeType === 1;
|
|
635
679
|
if (!isElement && root.nodeType !== 11) return root;
|
|
636
680
|
if (isElement && root.matches(CLAIMED_ELEMENTS)) {
|
|
637
|
-
|
|
681
|
+
root._$claimed = true;
|
|
682
|
+
runClaimHandlers(handlers, root);
|
|
638
683
|
}
|
|
639
684
|
const found = root.querySelectorAll(CLAIMED_ELEMENTS);
|
|
640
685
|
for (let i = 0; i < found.length; i++) {
|
|
641
|
-
|
|
686
|
+
found[i]._$claimed = true;
|
|
687
|
+
runClaimHandlers(handlers, found[i]);
|
|
642
688
|
}
|
|
643
689
|
return root;
|
|
644
690
|
}
|
|
645
|
-
function claimElement(node) {
|
|
646
|
-
if (claimHandlers !== null) {
|
|
647
|
-
|
|
691
|
+
function claimElement(node, owner) {
|
|
692
|
+
if (claimHandlers !== null && !node._$claimed) {
|
|
693
|
+
node._$claimed = true;
|
|
694
|
+
if (owner === undefined) runClaimHandlers(claimHandlers, node);else runWithOwner(owner, () => runClaimHandlers(claimHandlers, node));
|
|
648
695
|
}
|
|
649
696
|
return node;
|
|
650
697
|
}
|
|
651
698
|
function setAttribute(node, name, value) {
|
|
652
|
-
|
|
699
|
+
{
|
|
700
|
+
tagElement(node);
|
|
701
|
+
if (typeof value === "function" && name.startsWith("on")) lowercaseEventAttribute(name, node);
|
|
702
|
+
}
|
|
653
703
|
if (isHydrating(node)) return;
|
|
654
704
|
const selectMultiple = name === "multiple" && node.localName === "select";
|
|
655
705
|
if (value == null || value === false) node.removeAttribute(name);else {
|
|
@@ -662,12 +712,13 @@ function setAttribute(node, name, value) {
|
|
|
662
712
|
}
|
|
663
713
|
}
|
|
664
714
|
if (selectMultiple) node._$multiple = true;
|
|
665
|
-
|
|
715
|
+
reclaimAttribute(node, name);
|
|
666
716
|
}
|
|
667
717
|
function setAttributeNS(node, namespace, name, value) {
|
|
668
718
|
tagElement(node);
|
|
669
719
|
if (isHydrating(node)) return;
|
|
670
720
|
if (value == null || value === false) node.removeAttributeNS(namespace, name.indexOf(":") > -1 ? name.split(":").pop() : name);else node.setAttributeNS(namespace, name, value === true ? "" : value);
|
|
721
|
+
reclaimAttribute(node, name);
|
|
671
722
|
}
|
|
672
723
|
function className(node, value, prev) {
|
|
673
724
|
tagElement(node);
|
|
@@ -782,7 +833,7 @@ function readShallow(value) {
|
|
|
782
833
|
if (value === null || typeof value !== "object") return value;
|
|
783
834
|
if (Array.isArray(value)) return value.map(readShallow);
|
|
784
835
|
if (value[$PROXY] !== value) return value;
|
|
785
|
-
const keys =
|
|
836
|
+
const keys = Reflect.ownKeys(value);
|
|
786
837
|
const out = {};
|
|
787
838
|
for (let i = 0; i < keys.length; i++) {
|
|
788
839
|
const k = keys[i];
|
|
@@ -806,13 +857,16 @@ function spread(node, props, skipChildren, skip, name) {
|
|
|
806
857
|
}
|
|
807
858
|
}
|
|
808
859
|
const prevProps = {};
|
|
860
|
+
const owner = claimHandlers !== null && (node.localName === "a" || node.localName === "form") ? getOwner() : undefined;
|
|
809
861
|
const apply = newProps => {
|
|
810
862
|
const r = newProps.ref;
|
|
811
863
|
if (r !== prevProps.ref && (typeof r === "function" || Array.isArray(r))) ref(() => r, node);
|
|
812
864
|
assign(node, newProps, true, prevProps, true);
|
|
865
|
+
if (owner !== undefined) claimElement(node, owner);
|
|
813
866
|
};
|
|
814
|
-
unscopedByDesign = node;
|
|
815
867
|
if (Array.isArray(props)) {
|
|
868
|
+
effect(() => collectSources({}, props, undefined, skip), apply);
|
|
869
|
+
unscopedByDesign = node;
|
|
816
870
|
if (!skipChildren && !(skip !== undefined && skip("children"))) insert(node, () => {
|
|
817
871
|
for (let i = props.length - 1; i >= 0; i--) {
|
|
818
872
|
const s = resolveSource(props[i]);
|
|
@@ -820,9 +874,20 @@ function spread(node, props, skipChildren, skip, name) {
|
|
|
820
874
|
}
|
|
821
875
|
});
|
|
822
876
|
unscopedByDesign = null;
|
|
823
|
-
effect(() => collectSources({}, props, undefined, skip), apply);
|
|
824
877
|
return prevProps;
|
|
825
878
|
}
|
|
879
|
+
effect(() => {
|
|
880
|
+
const source = resolveSource(props);
|
|
881
|
+
const newProps = {};
|
|
882
|
+
const table = resolvedTable(source);
|
|
883
|
+
if (table !== undefined) return collectTable(newProps, table, skip);
|
|
884
|
+
if (source != null) {
|
|
885
|
+
const view = viewOf(source);
|
|
886
|
+
if (view instanceof OmitView) collectProps(newProps, view, SOURCE_OMIT, skip);else if (view !== undefined) collectSources(newProps, view.sources, view.kinds, skip);else collectProps(newProps, source, $PROXY in source ? SOURCE_PROXY : SOURCE_PLAIN, skip);
|
|
887
|
+
}
|
|
888
|
+
return newProps;
|
|
889
|
+
}, apply);
|
|
890
|
+
unscopedByDesign = node;
|
|
826
891
|
if (!skipChildren && !(skip !== undefined && skip("children"))) {
|
|
827
892
|
if (typeof props !== "function" && props != null && hasStaticKeys(props)) {
|
|
828
893
|
const desc = Object.getOwnPropertyDescriptor(props, "children");
|
|
@@ -835,17 +900,6 @@ function spread(node, props, skipChildren, skip, name) {
|
|
|
835
900
|
});
|
|
836
901
|
}
|
|
837
902
|
unscopedByDesign = null;
|
|
838
|
-
effect(() => {
|
|
839
|
-
const source = resolveSource(props);
|
|
840
|
-
const newProps = {};
|
|
841
|
-
const table = resolvedTable(source);
|
|
842
|
-
if (table !== undefined) return collectTable(newProps, table, skip);
|
|
843
|
-
if (source != null) {
|
|
844
|
-
const view = viewOf(source);
|
|
845
|
-
if (view instanceof OmitView) collectProps(newProps, view, SOURCE_OMIT, skip);else if (view !== undefined) collectSources(newProps, view.sources, view.kinds, skip);else collectProps(newProps, source, $PROXY in source ? SOURCE_PROXY : SOURCE_PLAIN, skip);
|
|
846
|
-
}
|
|
847
|
-
return newProps;
|
|
848
|
-
}, apply);
|
|
849
903
|
return prevProps;
|
|
850
904
|
}
|
|
851
905
|
function collectTable(out, table, skip) {
|
|
@@ -1054,13 +1108,17 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
1054
1108
|
const value = normalize(accessor(), current, multi, true);
|
|
1055
1109
|
checkUnscopedHole(devNext, accessor, parent);
|
|
1056
1110
|
if (typeof value !== "function") return value;
|
|
1111
|
+
const innerOptions = prev !== undefined && !(options && options.schedule) ? {
|
|
1112
|
+
...options,
|
|
1113
|
+
schedule: true
|
|
1114
|
+
} : options;
|
|
1057
1115
|
effect(() => (hydrationRt !== null && (current = hydrationRt.reclaimRegion(current, parent, marker)), normalize(value, current, multi)), inner => {
|
|
1058
1116
|
current = insertExpression(parent, inner, current, marker);
|
|
1059
1117
|
host && tagHost(current, host);
|
|
1060
|
-
},
|
|
1061
|
-
...
|
|
1062
|
-
|
|
1063
|
-
}
|
|
1118
|
+
}, {
|
|
1119
|
+
...innerOptions,
|
|
1120
|
+
_wide: true
|
|
1121
|
+
} );
|
|
1064
1122
|
checkUnscopedHole(devNext, accessor, parent);
|
|
1065
1123
|
return INNER_OWNED;
|
|
1066
1124
|
}, value => {
|
|
@@ -1372,7 +1430,7 @@ function flushHeadRegistry() {
|
|
|
1372
1430
|
function createHeadElement(tag, props) {
|
|
1373
1431
|
const el = document.createElement(tag);
|
|
1374
1432
|
for (const name in props) {
|
|
1375
|
-
if (name === "children" || name === "ref" || name
|
|
1433
|
+
if (name === "children" || name === "ref" || /^on[A-Z]/.test(name)) continue;
|
|
1376
1434
|
if (!HEAD_ATTR_NAME.test(name)) {
|
|
1377
1435
|
console.warn(`useHead: ignoring invalid attribute name "${name}"`);
|
|
1378
1436
|
continue;
|
|
@@ -1381,7 +1439,7 @@ function createHeadElement(tag, props) {
|
|
|
1381
1439
|
if (v == null || v === false) continue;
|
|
1382
1440
|
el.setAttribute(name, v === true ? "" : String(v));
|
|
1383
1441
|
}
|
|
1384
|
-
if (props.children != null) el.textContent = String(props.children);
|
|
1442
|
+
if (props.children != null) el.textContent = headBodyText(tag, props, String(props.children));
|
|
1385
1443
|
return el;
|
|
1386
1444
|
}
|
|
1387
1445
|
function renderHeadElement(t, identity, existing) {
|
|
@@ -1396,7 +1454,7 @@ function renderHeadElement(t, identity, existing) {
|
|
|
1396
1454
|
function headElementMatches(el, t) {
|
|
1397
1455
|
if (el.tagName.toLowerCase() !== t.tag) return false;
|
|
1398
1456
|
for (const name in t.props) {
|
|
1399
|
-
if (name === "children" || name === "ref" || name
|
|
1457
|
+
if (name === "children" || name === "ref" || /^on[A-Z]/.test(name)) continue;
|
|
1400
1458
|
if (!HEAD_ATTR_NAME.test(name)) continue;
|
|
1401
1459
|
const v = t.props[name];
|
|
1402
1460
|
if (v == null || v === false) {
|
|
@@ -1404,7 +1462,7 @@ function headElementMatches(el, t) {
|
|
|
1404
1462
|
} else if (el.getAttribute(name) !== (v === true ? "" : String(v))) return false;
|
|
1405
1463
|
}
|
|
1406
1464
|
const children = t.props.children;
|
|
1407
|
-
return (children == null ? "" : String(children)) === el.textContent;
|
|
1465
|
+
return (children == null ? "" : headBodyText(t.tag, t.props, String(children))) === el.textContent;
|
|
1408
1466
|
}
|
|
1409
1467
|
function mountHeadResource(tag, props) {
|
|
1410
1468
|
const identity = resourceIdentity(tag, props);
|
|
@@ -1521,7 +1579,22 @@ function loadModuleAssets(mapping) {
|
|
|
1521
1579
|
function hydrate(code, element, options = {}) {
|
|
1522
1580
|
enableHydration();
|
|
1523
1581
|
installHydrationRuntime();
|
|
1524
|
-
|
|
1582
|
+
const hy = globalThis._$HY;
|
|
1583
|
+
const id = options.renderId || "";
|
|
1584
|
+
if (hy.s && !hy.s[id] && !hy.s[""] && !hy.done && document.readyState === "loading") {
|
|
1585
|
+
let started, disposer;
|
|
1586
|
+
const start = () => started || (started = true, disposer = hydrate(code, element, options));
|
|
1587
|
+
(hy.sp || (hy.sp = [])).push([id, start]);
|
|
1588
|
+
hy.sw = key => hy.sp.forEach(([k, f]) => (!key || k === key) && queueMicrotask(f));
|
|
1589
|
+
document.addEventListener("DOMContentLoaded", start, {
|
|
1590
|
+
once: true
|
|
1591
|
+
});
|
|
1592
|
+
return () => {
|
|
1593
|
+
started = true;
|
|
1594
|
+
disposer && disposer();
|
|
1595
|
+
};
|
|
1596
|
+
}
|
|
1597
|
+
if (hy.done) return render(code, element, [...element.childNodes], options);
|
|
1525
1598
|
const head = (element.nodeType === 9 ? element : element.ownerDocument).head;
|
|
1526
1599
|
if (head && element.contains(head)) {
|
|
1527
1600
|
let n = head.firstChild;
|
|
@@ -1757,13 +1830,32 @@ function isHydrating(node) {
|
|
|
1757
1830
|
if (!sharedConfig.hydrating) return false;
|
|
1758
1831
|
if (sharedConfig.isClaiming && !sharedConfig.isClaiming()) return false;
|
|
1759
1832
|
if (!node || node.isConnected) return true;
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1833
|
+
return serverComponentClaims !== null && serverComponentClaims.claimed(node);
|
|
1834
|
+
}
|
|
1835
|
+
let serverComponentClaims = null;
|
|
1836
|
+
function installServerComponentHydration() {
|
|
1837
|
+
enableServerComponentHydration();
|
|
1838
|
+
if (serverComponentClaims !== null) return;
|
|
1839
|
+
serverComponentClaims = {
|
|
1840
|
+
claimed(node) {
|
|
1841
|
+
const roots = sharedConfig.claimRoots;
|
|
1842
|
+
if (roots) {
|
|
1843
|
+
for (let i = 0; i < roots.length; i++) {
|
|
1844
|
+
if (roots[i].contains(node)) return true;
|
|
1845
|
+
}
|
|
1846
|
+
}
|
|
1847
|
+
return false;
|
|
1848
|
+
},
|
|
1849
|
+
inFrame(element) {
|
|
1850
|
+
const frames = element.querySelectorAll("[data-fid]");
|
|
1851
|
+
const frameCount = frames.length;
|
|
1852
|
+
if (frameCount === 0) return undefined;
|
|
1853
|
+
return node => {
|
|
1854
|
+
for (let j = 0; j < frameCount; j++) if (frames[j].contains(node)) return true;
|
|
1855
|
+
return false;
|
|
1856
|
+
};
|
|
1764
1857
|
}
|
|
1765
|
-
}
|
|
1766
|
-
return false;
|
|
1858
|
+
};
|
|
1767
1859
|
}
|
|
1768
1860
|
function classListToObject(classList) {
|
|
1769
1861
|
if (Array.isArray(classList)) {
|
|
@@ -1799,8 +1891,9 @@ function assignProp(node, prop, value, prev, skipRef, nodeName) {
|
|
|
1799
1891
|
if (!skipRef && value) ref(() => value, node);
|
|
1800
1892
|
return value;
|
|
1801
1893
|
}
|
|
1894
|
+
let c;
|
|
1802
1895
|
const hasNamespace = prop.indexOf(":") > -1;
|
|
1803
|
-
if (!hasNamespace && prop.
|
|
1896
|
+
if (!hasNamespace && prop.startsWith("on") && (c = prop.charCodeAt(2)) > 64 && c < 91) {
|
|
1804
1897
|
const name = prop.slice(2).toLowerCase();
|
|
1805
1898
|
const delegate = DelegatedEvents.has(name);
|
|
1806
1899
|
if (!delegate && prev) {
|
|
@@ -1814,8 +1907,10 @@ function assignProp(node, prop, value, prev, skipRef, nodeName) {
|
|
|
1814
1907
|
}
|
|
1815
1908
|
} else if (hasNamespace && prop.slice(0, 5) === "prop:" || ChildProperties.has(prop) || DOMWithState[nodeName]?.[prop]) {
|
|
1816
1909
|
if (hasNamespace) prop = prop.slice(5);else if (isHydrating(node)) return value;
|
|
1817
|
-
if (prop === "value" && nodeName === "SELECT")
|
|
1818
|
-
|
|
1910
|
+
if (prop === "value" && nodeName === "SELECT") writeSelectValue(node, value);else if ((prop === "value" || prop === "defaultValue") && (nodeName === "INPUT" || nodeName === "TEXTAREA")) {
|
|
1911
|
+
if (value == null && /^(checkbox|radio)$/.test(node.type)) node.removeAttribute("value");else node[prop] = value ?? "";
|
|
1912
|
+
} else node[prop] = value;
|
|
1913
|
+
reclaimAttribute(node, prop);
|
|
1819
1914
|
} else {
|
|
1820
1915
|
const ns = hasNamespace && Namespaces[prop.split(":")[0]];
|
|
1821
1916
|
if (ns) setAttributeNS(node, ns, prop, value);else setAttribute(node, prop, value);
|
|
@@ -1904,6 +1999,7 @@ function insertExpression(parent, value, current, marker) {
|
|
|
1904
1999
|
return value;
|
|
1905
2000
|
}
|
|
1906
2001
|
if (value === current) return value;
|
|
2002
|
+
if (hydrationRt !== null && sharedConfig.hydrating && current == null && value && [].concat(value).every(n => n?.parentNode === parent) && value.length !== 0) return value;
|
|
1907
2003
|
const t = typeof value,
|
|
1908
2004
|
multi = marker !== undefined;
|
|
1909
2005
|
if (t === "string" || t === "number") {
|
|
@@ -1962,8 +2058,35 @@ function insertExpression(parent, value, current, marker) {
|
|
|
1962
2058
|
value
|
|
1963
2059
|
}
|
|
1964
2060
|
});
|
|
2061
|
+
selectInsert && selectInsert(parent);
|
|
1965
2062
|
return value;
|
|
1966
2063
|
}
|
|
2064
|
+
let selectInsert;
|
|
2065
|
+
function selectChange(e) {
|
|
2066
|
+
(e = e.currentTarget || e)._$v = null;
|
|
2067
|
+
e.removeEventListener("change", selectChange, true);
|
|
2068
|
+
}
|
|
2069
|
+
function writeSelectValue(node, value) {
|
|
2070
|
+
const had = node._$v && node._$v.map,
|
|
2071
|
+
has = value != null && value.map;
|
|
2072
|
+
if (has) had || node.addEventListener("change", selectChange, true);else had && node.removeEventListener("change", selectChange, true);
|
|
2073
|
+
if (value == null) {
|
|
2074
|
+
node._$v = null;
|
|
2075
|
+
return queueMicrotask(() => node.value = value) || (node.value = value);
|
|
2076
|
+
}
|
|
2077
|
+
node._$v = value;
|
|
2078
|
+
(selectInsert ||= p => {
|
|
2079
|
+
p && p._$v == null && (p = p.parentNode);
|
|
2080
|
+
const v = p && p._$v;
|
|
2081
|
+
if (v == null) return;
|
|
2082
|
+
if (v.map) {
|
|
2083
|
+
const o = [...p.options];
|
|
2084
|
+
for (let i = 0; i < o.length; i++) o[i].selected = v.some(x => x == o[i].value);
|
|
2085
|
+
v.every(x => o.some(el => el.value == x)) && selectChange(p);
|
|
2086
|
+
} else p.value = v, p.selectedIndex > -1 && p.value == v && (p._$v = null);
|
|
2087
|
+
})(node);
|
|
2088
|
+
queueMicrotask(() => selectInsert(node));
|
|
2089
|
+
}
|
|
1967
2090
|
function normalize(value, current, multi, doNotUnwrap) {
|
|
1968
2091
|
value = flatten(value, {
|
|
1969
2092
|
skipNonRendered: true,
|
|
@@ -2041,25 +2164,13 @@ function cleanChildren(parent, current, marker, replacement) {
|
|
|
2041
2164
|
if (replacement && marker) replacement[$$SLOT] = marker;
|
|
2042
2165
|
}
|
|
2043
2166
|
function gatherHydratable(element, root) {
|
|
2044
|
-
const templates = element.querySelectorAll(`*[_hk]`);
|
|
2045
|
-
const
|
|
2046
|
-
const frameCount = frames ? frames.length : 0;
|
|
2167
|
+
const templates = element.querySelectorAll(root ? `[_hk^="${root.replace(/["\\]/g, "\\$&")}"]` : `*[_hk]`);
|
|
2168
|
+
const inFrame = root || serverComponentClaims === null ? undefined : serverComponentClaims.inFrame(element);
|
|
2047
2169
|
const registry = sharedConfig.registry;
|
|
2048
2170
|
for (let i = 0; i < templates.length; i++) {
|
|
2049
2171
|
const node = templates[i];
|
|
2172
|
+
if (inFrame !== undefined && inFrame(node)) continue;
|
|
2050
2173
|
const key = node.getAttribute("_hk");
|
|
2051
|
-
if (root) {
|
|
2052
|
-
if (!key.startsWith(root)) continue;
|
|
2053
|
-
} else if (frameCount !== 0) {
|
|
2054
|
-
let inFrame = false;
|
|
2055
|
-
for (let j = 0; j < frameCount; j++) {
|
|
2056
|
-
if (frames[j].contains(node)) {
|
|
2057
|
-
inFrame = true;
|
|
2058
|
-
break;
|
|
2059
|
-
}
|
|
2060
|
-
}
|
|
2061
|
-
if (inFrame) continue;
|
|
2062
|
-
}
|
|
2063
2174
|
if (!registry.has(key)) registry.set(key, node);
|
|
2064
2175
|
}
|
|
2065
2176
|
}
|
|
@@ -2069,6 +2180,7 @@ function getHydrationKey() {
|
|
|
2069
2180
|
const RequestContext = Symbol();
|
|
2070
2181
|
|
|
2071
2182
|
function configureServerErrors(_config) {}
|
|
2183
|
+
function reportRequestFailure(_error, _event) {}
|
|
2072
2184
|
function throwInBrowser(func) {
|
|
2073
2185
|
const err = new Error(`${func.name} is not supported in the browser, returning undefined`);
|
|
2074
2186
|
console.error(err);
|
|
@@ -2100,9 +2212,11 @@ function composeMiddleware(middlewares) {
|
|
|
2100
2212
|
function ssr(template, ...nodes) {}
|
|
2101
2213
|
function ssrElement(name, props, children, needsId, skip, attrs) {}
|
|
2102
2214
|
function ssrElementAttribute(key, value) {}
|
|
2215
|
+
function ssrLinkClaim(attrs) {}
|
|
2103
2216
|
function ssrClassName(value) {}
|
|
2104
2217
|
function ssrStyle(value) {}
|
|
2105
2218
|
function ssrStyleProperty(name, value) {}
|
|
2219
|
+
function ssrStyleProperties(...entries) {}
|
|
2106
2220
|
function ssrAttribute(key, value) {}
|
|
2107
2221
|
function ssrGroup(fn, n) {}
|
|
2108
2222
|
function ssrHydrationKey() {}
|
|
@@ -2110,17 +2224,24 @@ function resolveSSRNode(node, result, top, nested) {}
|
|
|
2110
2224
|
function escape(s, attr) {}
|
|
2111
2225
|
|
|
2112
2226
|
const ENVELOPE = Symbol.for("solid.ResponseEnvelope");
|
|
2113
|
-
|
|
2114
|
-
const ResponseEnvelope =
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2227
|
+
let EnvelopeClass;
|
|
2228
|
+
const ResponseEnvelope = function ResponseEnvelope(response, value) {
|
|
2229
|
+
if (!EnvelopeClass) {
|
|
2230
|
+
EnvelopeClass = class extends Response {
|
|
2231
|
+
constructor(response, value) {
|
|
2232
|
+
super(response ? response.body : null, response && {
|
|
2233
|
+
status: response.status,
|
|
2234
|
+
statusText: response.statusText,
|
|
2235
|
+
headers: copyHeaders(response.headers)
|
|
2236
|
+
});
|
|
2237
|
+
this.response = response ? this : undefined;
|
|
2238
|
+
this.value = value;
|
|
2239
|
+
}
|
|
2240
|
+
};
|
|
2241
|
+
EnvelopeClass.prototype[ENVELOPE] = true;
|
|
2120
2242
|
}
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
})();
|
|
2243
|
+
return new EnvelopeClass(response, value);
|
|
2244
|
+
};
|
|
2124
2245
|
function isResponseEnvelope(value) {
|
|
2125
2246
|
return !!(value && typeof value === "object" && value[ENVELOPE]);
|
|
2126
2247
|
}
|
|
@@ -2145,6 +2266,16 @@ function isSafeError(value) {
|
|
|
2145
2266
|
const REVALIDATE_HEADER = "X-Revalidate";
|
|
2146
2267
|
const REVALIDATE_ALL = "*";
|
|
2147
2268
|
const RESPONSE_HEADER_VALUE_LIMIT = 4096;
|
|
2269
|
+
function copyHeaders(init) {
|
|
2270
|
+
const source = init;
|
|
2271
|
+
if (!source || !source.getSetCookie) return new Headers(init);
|
|
2272
|
+
const headers = new Headers();
|
|
2273
|
+
source.forEach((value, key) => {
|
|
2274
|
+
if (key !== "set-cookie") headers.append(key, value);
|
|
2275
|
+
});
|
|
2276
|
+
for (const cookie of source.getSetCookie()) headers.append("Set-Cookie", cookie);
|
|
2277
|
+
return headers;
|
|
2278
|
+
}
|
|
2148
2279
|
function initWithRevalidate(init = {}) {
|
|
2149
2280
|
const resolved = typeof init === "number" ? {
|
|
2150
2281
|
status: init
|
|
@@ -2153,18 +2284,7 @@ function initWithRevalidate(init = {}) {
|
|
|
2153
2284
|
revalidate,
|
|
2154
2285
|
...responseInit
|
|
2155
2286
|
} = resolved;
|
|
2156
|
-
|
|
2157
|
-
if (responseInit.headers && responseInit.headers.getSetCookie) {
|
|
2158
|
-
headers = new Headers();
|
|
2159
|
-
responseInit.headers.forEach((value, key) => {
|
|
2160
|
-
if (key !== "set-cookie") headers.append(key, value);
|
|
2161
|
-
});
|
|
2162
|
-
for (const cookie of responseInit.headers.getSetCookie()) {
|
|
2163
|
-
headers.append("Set-Cookie", cookie);
|
|
2164
|
-
}
|
|
2165
|
-
} else {
|
|
2166
|
-
headers = new Headers(responseInit.headers);
|
|
2167
|
-
}
|
|
2287
|
+
const headers = copyHeaders(responseInit.headers);
|
|
2168
2288
|
if (revalidate !== undefined) {
|
|
2169
2289
|
const list = Array.isArray(revalidate) ? revalidate : [revalidate];
|
|
2170
2290
|
if (list.length > 1 && list.includes(REVALIDATE_ALL)) {
|
|
@@ -2288,110 +2408,8 @@ function portalImpl(props) {
|
|
|
2288
2408
|
});
|
|
2289
2409
|
return treeMarker;
|
|
2290
2410
|
}
|
|
2291
|
-
const COMPONENT_BINDING = Symbol.for("solid.component-binding");
|
|
2292
|
-
const FLIGHT = Symbol("solid.dynamic-flight");
|
|
2293
|
-
function bindingOf(value) {
|
|
2294
|
-
return value !== null && (typeof value === "function" || typeof value === "object") && value[COMPONENT_BINDING] || undefined;
|
|
2295
|
-
}
|
|
2296
2411
|
function dynamic(source, options) {
|
|
2297
|
-
|
|
2298
|
-
const sites = new Set();
|
|
2299
|
-
let deliveredAddress;
|
|
2300
|
-
const resolveBinding = (next, prev) => {
|
|
2301
|
-
const binding = bindingOf(next);
|
|
2302
|
-
if (!binding) return next;
|
|
2303
|
-
deliveredAddress = binding.address;
|
|
2304
|
-
const prevBinding = bindingOf(prev);
|
|
2305
|
-
if (prevBinding && prevBinding.component === binding.component) {
|
|
2306
|
-
for (const deliver of sites) deliver(binding.address);
|
|
2307
|
-
return prev;
|
|
2308
|
-
}
|
|
2309
|
-
return next;
|
|
2310
|
-
};
|
|
2311
|
-
const sameInstance = (prev, next) => {
|
|
2312
|
-
if (prev === next) return true;
|
|
2313
|
-
const held = bindingOf(prev);
|
|
2314
|
-
const incoming = bindingOf(next);
|
|
2315
|
-
if (!held || !incoming || held.component !== incoming.component) return false;
|
|
2316
|
-
if (held.address === incoming.address) return true;
|
|
2317
|
-
if (deliveredAddress === undefined) return false;
|
|
2318
|
-
if (incoming.address !== deliveredAddress) {
|
|
2319
|
-
deliveredAddress = incoming.address;
|
|
2320
|
-
for (const deliver of sites) deliver(incoming.address);
|
|
2321
|
-
}
|
|
2322
|
-
return true;
|
|
2323
|
-
};
|
|
2324
|
-
const cached = createMemo(prev => {
|
|
2325
|
-
const next = source();
|
|
2326
|
-
if (!next || typeof next.then !== "function") return resolveBinding(next, prev);
|
|
2327
|
-
return {
|
|
2328
|
-
[FLIGHT]: next
|
|
2329
|
-
};
|
|
2330
|
-
}, {
|
|
2331
|
-
lazy: true,
|
|
2332
|
-
equals: sameInstance
|
|
2333
|
-
});
|
|
2334
|
-
return props => {
|
|
2335
|
-
if (sharedConfig.hydrating) {
|
|
2336
|
-
try {
|
|
2337
|
-
untrack(cached);
|
|
2338
|
-
} catch {}
|
|
2339
|
-
}
|
|
2340
|
-
let latest = 0;
|
|
2341
|
-
const value = createMemo(prev => {
|
|
2342
|
-
const c = cached();
|
|
2343
|
-
if (!c || !c[FLIGHT]) return resolveBinding(c, prev);
|
|
2344
|
-
const next = c[FLIGHT];
|
|
2345
|
-
const token = ++latest;
|
|
2346
|
-
return {
|
|
2347
|
-
then: (onFulfilled, onRejected) => next.then(resolved => {
|
|
2348
|
-
const landed = token === latest ? resolveBinding(resolved, prev) : resolved;
|
|
2349
|
-
return onFulfilled ? onFulfilled(landed) : landed;
|
|
2350
|
-
}, onRejected)
|
|
2351
|
-
};
|
|
2352
|
-
}, {
|
|
2353
|
-
equals: sameInstance
|
|
2354
|
-
});
|
|
2355
|
-
return createMemo(() => {
|
|
2356
|
-
const component = value();
|
|
2357
|
-
switch (typeof component) {
|
|
2358
|
-
case "function":
|
|
2359
|
-
{
|
|
2360
|
-
Object.assign(component, {
|
|
2361
|
-
[$DEVCOMP]: true
|
|
2362
|
-
});
|
|
2363
|
-
const binding = bindingOf(component);
|
|
2364
|
-
if (binding) {
|
|
2365
|
-
const [address, setAddress] = createSignal(deliveredAddress ??= binding.address, {
|
|
2366
|
-
ownedWrite: true
|
|
2367
|
-
});
|
|
2368
|
-
sites.add(setAddress);
|
|
2369
|
-
onCleanup(() => sites.delete(setAddress));
|
|
2370
|
-
return untrack(() => binding.component(props, address));
|
|
2371
|
-
}
|
|
2372
|
-
return untrack(() => component(props));
|
|
2373
|
-
}
|
|
2374
|
-
case "string":
|
|
2375
|
-
return staticElement(component, props);
|
|
2376
|
-
}
|
|
2377
|
-
});
|
|
2378
|
-
};
|
|
2379
|
-
}
|
|
2380
|
-
function staticDynamic(component) {
|
|
2381
|
-
if (component && typeof component.then === "function") throw new Error("dynamic(): a static source must resolve synchronously, not to a promise");
|
|
2382
|
-
if (typeof component === "function") {
|
|
2383
|
-
Object.assign(component, {
|
|
2384
|
-
[$DEVCOMP]: true
|
|
2385
|
-
});
|
|
2386
|
-
const binding = bindingOf(component);
|
|
2387
|
-
if (binding) {
|
|
2388
|
-
const address = () => binding.address;
|
|
2389
|
-
return props => untrack(() => binding.component(props, address));
|
|
2390
|
-
}
|
|
2391
|
-
return props => untrack(() => component(props));
|
|
2392
|
-
}
|
|
2393
|
-
if (typeof component === "string") return props => staticElement(component, props);
|
|
2394
|
-
return () => undefined;
|
|
2412
|
+
return dynamicCore(source, options, staticElement);
|
|
2395
2413
|
}
|
|
2396
2414
|
function staticElement(tag, props) {
|
|
2397
2415
|
const hydrating = sharedConfig.hydrating;
|
|
@@ -2439,4 +2457,4 @@ _moduleUrl) {
|
|
|
2439
2457
|
function httpStatus(_code, _text) {}
|
|
2440
2458
|
function httpHeader(_name, _value, _options) {}
|
|
2441
2459
|
|
|
2442
|
-
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 };
|
|
2460
|
+
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 };
|