@solidjs/web 2.0.0-rc.13 → 2.0.0-rc.14
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 +200 -73
- package/dist/server.js +182 -59
- package/dist/server.observe.js +183 -60
- package/dist/web.dev.js +70 -35
- package/dist/web.js +43 -31
- package/dist/web.observe.js +43 -33
- 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 +605 -1086
- package/frames/dist/client.js +572 -1066
- package/frames/dist/client.observe.js +571 -1066
- package/frames/dist/regions.js +130 -0
- package/frames/dist/server.dev.js +339 -177
- package/frames/dist/server.js +335 -173
- package/frames/dist/server.observe.js +335 -173
- package/frames/dist/trace.js +42 -0
- package/frames/dist/wire.js +133 -0
- package/package.json +28 -2
- 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 +37 -8
- package/serialization/dist/serialization.js +39 -10
- package/serialization/types/serializer-decode.d.ts +24 -2
- package/server-functions/dist/client.dev.js +99 -61
- package/server-functions/dist/client.js +99 -61
- package/server-functions/dist/client.observe.js +99 -61
- package/server-functions/dist/server.dev.js +87 -50
- package/server-functions/dist/server.js +87 -50
- package/server-functions/dist/server.observe.js +87 -50
- package/skills/server-components/SKILL.md +65 -43
- package/types/client.d.ts +20 -0
- package/types/constants.d.ts +2 -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 +32 -8
- package/types/frames/trace-tier.d.ts +2 -0
- package/types/frames/wire-tier.d.ts +116 -0
- package/types/index.d.ts +38 -0
- package/types/index.server.d.ts +9 -0
- package/types/jsx.d.ts +1 -1
- package/types/observe.d.ts +4 -2
- package/types/serializer-decode.d.ts +24 -2
- package/types/server-functions/client.d.ts +26 -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 +13 -1
- package/types/server.d.ts +34 -8
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,
|
|
1
|
+
import { createRenderEffect, getOwner, createMemo, OBSERVE, DEV, enableHydration, $PROXY, untrack, runWithOwner, resetErrorHalt, enforceLoadingBoundary, createRoot, ROOT_ERROR_HOOK, flatten, flush, createComponent, omit, createOwner, createSignal, createEffect, onCleanup } from 'solid-js';
|
|
2
2
|
export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, Show, Switch, createComponent, getOwner, merge as mergeProps, untrack } from 'solid-js';
|
|
3
|
-
import { sharedConfig, sourceKeys, SOURCE_PROXY,
|
|
3
|
+
import { sharedConfig, sourceKeys, SOURCE_PROXY, resolvedTable, viewOf, OmitView, hasStaticKeys, SOURCE_MEMO, sourceHas, SOURCE_OMIT, sourceGet, SOURCE_PLAIN, $DEVCOMP } 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_:.-]*$/;
|
|
@@ -398,7 +416,7 @@ function assertServableCookie(name, options) {
|
|
|
398
416
|
}
|
|
399
417
|
}
|
|
400
418
|
const FLASH_COOKIE = "flash";
|
|
401
|
-
const FLASH_MATCHER =
|
|
419
|
+
const FLASH_MATCHER = /(?:^|;\s*)flash=([^;]+)/;
|
|
402
420
|
function hasFlashCookie(cookieHeader) {
|
|
403
421
|
return !!cookieHeader && FLASH_MATCHER.test(cookieHeader);
|
|
404
422
|
}
|
|
@@ -591,8 +609,9 @@ function dispatchAsInteraction(e, fn) {
|
|
|
591
609
|
return OBSERVE.attribution.withInteraction({
|
|
592
610
|
type: e.type,
|
|
593
611
|
target: describeEventTarget(e.target),
|
|
594
|
-
at: interactionStart(e)
|
|
595
|
-
|
|
612
|
+
at: interactionStart(e),
|
|
613
|
+
event: e
|
|
614
|
+
}, fn) ;
|
|
596
615
|
}
|
|
597
616
|
function getDelegatedRoot(node) {
|
|
598
617
|
while (node) {
|
|
@@ -649,7 +668,10 @@ function claimElement(node) {
|
|
|
649
668
|
return node;
|
|
650
669
|
}
|
|
651
670
|
function setAttribute(node, name, value) {
|
|
652
|
-
|
|
671
|
+
{
|
|
672
|
+
tagElement(node);
|
|
673
|
+
if (typeof value === "function" && name.startsWith("on")) lowercaseEventAttribute(name, node);
|
|
674
|
+
}
|
|
653
675
|
if (isHydrating(node)) return;
|
|
654
676
|
const selectMultiple = name === "multiple" && node.localName === "select";
|
|
655
677
|
if (value == null || value === false) node.removeAttribute(name);else {
|
|
@@ -811,8 +833,9 @@ function spread(node, props, skipChildren, skip, name) {
|
|
|
811
833
|
if (r !== prevProps.ref && (typeof r === "function" || Array.isArray(r))) ref(() => r, node);
|
|
812
834
|
assign(node, newProps, true, prevProps, true);
|
|
813
835
|
};
|
|
814
|
-
unscopedByDesign = node;
|
|
815
836
|
if (Array.isArray(props)) {
|
|
837
|
+
effect(() => collectSources({}, props, undefined, skip), apply);
|
|
838
|
+
unscopedByDesign = node;
|
|
816
839
|
if (!skipChildren && !(skip !== undefined && skip("children"))) insert(node, () => {
|
|
817
840
|
for (let i = props.length - 1; i >= 0; i--) {
|
|
818
841
|
const s = resolveSource(props[i]);
|
|
@@ -820,9 +843,20 @@ function spread(node, props, skipChildren, skip, name) {
|
|
|
820
843
|
}
|
|
821
844
|
});
|
|
822
845
|
unscopedByDesign = null;
|
|
823
|
-
effect(() => collectSources({}, props, undefined, skip), apply);
|
|
824
846
|
return prevProps;
|
|
825
847
|
}
|
|
848
|
+
effect(() => {
|
|
849
|
+
const source = resolveSource(props);
|
|
850
|
+
const newProps = {};
|
|
851
|
+
const table = resolvedTable(source);
|
|
852
|
+
if (table !== undefined) return collectTable(newProps, table, skip);
|
|
853
|
+
if (source != null) {
|
|
854
|
+
const view = viewOf(source);
|
|
855
|
+
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);
|
|
856
|
+
}
|
|
857
|
+
return newProps;
|
|
858
|
+
}, apply);
|
|
859
|
+
unscopedByDesign = node;
|
|
826
860
|
if (!skipChildren && !(skip !== undefined && skip("children"))) {
|
|
827
861
|
if (typeof props !== "function" && props != null && hasStaticKeys(props)) {
|
|
828
862
|
const desc = Object.getOwnPropertyDescriptor(props, "children");
|
|
@@ -835,17 +869,6 @@ function spread(node, props, skipChildren, skip, name) {
|
|
|
835
869
|
});
|
|
836
870
|
}
|
|
837
871
|
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
872
|
return prevProps;
|
|
850
873
|
}
|
|
851
874
|
function collectTable(out, table, skip) {
|
|
@@ -1054,13 +1077,17 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
1054
1077
|
const value = normalize(accessor(), current, multi, true);
|
|
1055
1078
|
checkUnscopedHole(devNext, accessor, parent);
|
|
1056
1079
|
if (typeof value !== "function") return value;
|
|
1080
|
+
const innerOptions = prev !== undefined && !(options && options.schedule) ? {
|
|
1081
|
+
...options,
|
|
1082
|
+
schedule: true
|
|
1083
|
+
} : options;
|
|
1057
1084
|
effect(() => (hydrationRt !== null && (current = hydrationRt.reclaimRegion(current, parent, marker)), normalize(value, current, multi)), inner => {
|
|
1058
1085
|
current = insertExpression(parent, inner, current, marker);
|
|
1059
1086
|
host && tagHost(current, host);
|
|
1060
|
-
},
|
|
1061
|
-
...
|
|
1062
|
-
|
|
1063
|
-
}
|
|
1087
|
+
}, {
|
|
1088
|
+
...innerOptions,
|
|
1089
|
+
_wide: true
|
|
1090
|
+
} );
|
|
1064
1091
|
checkUnscopedHole(devNext, accessor, parent);
|
|
1065
1092
|
return INNER_OWNED;
|
|
1066
1093
|
}, value => {
|
|
@@ -1372,7 +1399,7 @@ function flushHeadRegistry() {
|
|
|
1372
1399
|
function createHeadElement(tag, props) {
|
|
1373
1400
|
const el = document.createElement(tag);
|
|
1374
1401
|
for (const name in props) {
|
|
1375
|
-
if (name === "children" || name === "ref" || name
|
|
1402
|
+
if (name === "children" || name === "ref" || /^on[A-Z]/.test(name)) continue;
|
|
1376
1403
|
if (!HEAD_ATTR_NAME.test(name)) {
|
|
1377
1404
|
console.warn(`useHead: ignoring invalid attribute name "${name}"`);
|
|
1378
1405
|
continue;
|
|
@@ -1396,7 +1423,7 @@ function renderHeadElement(t, identity, existing) {
|
|
|
1396
1423
|
function headElementMatches(el, t) {
|
|
1397
1424
|
if (el.tagName.toLowerCase() !== t.tag) return false;
|
|
1398
1425
|
for (const name in t.props) {
|
|
1399
|
-
if (name === "children" || name === "ref" || name
|
|
1426
|
+
if (name === "children" || name === "ref" || /^on[A-Z]/.test(name)) continue;
|
|
1400
1427
|
if (!HEAD_ATTR_NAME.test(name)) continue;
|
|
1401
1428
|
const v = t.props[name];
|
|
1402
1429
|
if (v == null || v === false) {
|
|
@@ -1799,8 +1826,9 @@ function assignProp(node, prop, value, prev, skipRef, nodeName) {
|
|
|
1799
1826
|
if (!skipRef && value) ref(() => value, node);
|
|
1800
1827
|
return value;
|
|
1801
1828
|
}
|
|
1829
|
+
let c;
|
|
1802
1830
|
const hasNamespace = prop.indexOf(":") > -1;
|
|
1803
|
-
if (!hasNamespace && prop.
|
|
1831
|
+
if (!hasNamespace && prop.startsWith("on") && (c = prop.charCodeAt(2)) > 64 && c < 91) {
|
|
1804
1832
|
const name = prop.slice(2).toLowerCase();
|
|
1805
1833
|
const delegate = DelegatedEvents.has(name);
|
|
1806
1834
|
if (!delegate && prev) {
|
|
@@ -1904,6 +1932,7 @@ function insertExpression(parent, value, current, marker) {
|
|
|
1904
1932
|
return value;
|
|
1905
1933
|
}
|
|
1906
1934
|
if (value === current) return value;
|
|
1935
|
+
if (hydrationRt !== null && sharedConfig.hydrating && current == null && value && [].concat(value).every(n => n?.parentNode === parent) && value.length !== 0) return value;
|
|
1907
1936
|
const t = typeof value,
|
|
1908
1937
|
multi = marker !== undefined;
|
|
1909
1938
|
if (t === "string" || t === "number") {
|
|
@@ -2041,16 +2070,14 @@ function cleanChildren(parent, current, marker, replacement) {
|
|
|
2041
2070
|
if (replacement && marker) replacement[$$SLOT] = marker;
|
|
2042
2071
|
}
|
|
2043
2072
|
function gatherHydratable(element, root) {
|
|
2044
|
-
const templates = element.querySelectorAll(`*[_hk]`);
|
|
2073
|
+
const templates = element.querySelectorAll(root ? `[_hk^="${root.replace(/["\\]/g, "\\$&")}"]` : `*[_hk]`);
|
|
2045
2074
|
const frames = root ? null : element.querySelectorAll("[data-fid]");
|
|
2046
2075
|
const frameCount = frames ? frames.length : 0;
|
|
2047
2076
|
const registry = sharedConfig.registry;
|
|
2048
2077
|
for (let i = 0; i < templates.length; i++) {
|
|
2049
2078
|
const node = templates[i];
|
|
2050
2079
|
const key = node.getAttribute("_hk");
|
|
2051
|
-
if (
|
|
2052
|
-
if (!key.startsWith(root)) continue;
|
|
2053
|
-
} else if (frameCount !== 0) {
|
|
2080
|
+
if (frameCount !== 0) {
|
|
2054
2081
|
let inFrame = false;
|
|
2055
2082
|
for (let j = 0; j < frameCount; j++) {
|
|
2056
2083
|
if (frames[j].contains(node)) {
|
|
@@ -2069,6 +2096,7 @@ function getHydrationKey() {
|
|
|
2069
2096
|
const RequestContext = Symbol();
|
|
2070
2097
|
|
|
2071
2098
|
function configureServerErrors(_config) {}
|
|
2099
|
+
function reportRequestFailure(_error, _event) {}
|
|
2072
2100
|
function throwInBrowser(func) {
|
|
2073
2101
|
const err = new Error(`${func.name} is not supported in the browser, returning undefined`);
|
|
2074
2102
|
console.error(err);
|
|
@@ -2103,6 +2131,7 @@ function ssrElementAttribute(key, value) {}
|
|
|
2103
2131
|
function ssrClassName(value) {}
|
|
2104
2132
|
function ssrStyle(value) {}
|
|
2105
2133
|
function ssrStyleProperty(name, value) {}
|
|
2134
|
+
function ssrStyleProperties(...entries) {}
|
|
2106
2135
|
function ssrAttribute(key, value) {}
|
|
2107
2136
|
function ssrGroup(fn, n) {}
|
|
2108
2137
|
function ssrHydrationKey() {}
|
|
@@ -2294,7 +2323,13 @@ function bindingOf(value) {
|
|
|
2294
2323
|
return value !== null && (typeof value === "function" || typeof value === "object") && value[COMPONENT_BINDING] || undefined;
|
|
2295
2324
|
}
|
|
2296
2325
|
function dynamic(source, options) {
|
|
2297
|
-
|
|
2326
|
+
return dynamicCore(source, options, staticElement);
|
|
2327
|
+
}
|
|
2328
|
+
function dynamicComponent(source, options) {
|
|
2329
|
+
return dynamicCore(source, options);
|
|
2330
|
+
}
|
|
2331
|
+
function dynamicCore(source, options, tagArm) {
|
|
2332
|
+
if (options?.static) return staticDynamic(untrack(source), tagArm);
|
|
2298
2333
|
const sites = new Set();
|
|
2299
2334
|
let deliveredAddress;
|
|
2300
2335
|
const resolveBinding = (next, prev) => {
|
|
@@ -2372,12 +2407,12 @@ function dynamic(source, options) {
|
|
|
2372
2407
|
return untrack(() => component(props));
|
|
2373
2408
|
}
|
|
2374
2409
|
case "string":
|
|
2375
|
-
return
|
|
2410
|
+
return tagArm ? tagArm(component, props) : undefined;
|
|
2376
2411
|
}
|
|
2377
2412
|
});
|
|
2378
2413
|
};
|
|
2379
2414
|
}
|
|
2380
|
-
function staticDynamic(component) {
|
|
2415
|
+
function staticDynamic(component, tagArm) {
|
|
2381
2416
|
if (component && typeof component.then === "function") throw new Error("dynamic(): a static source must resolve synchronously, not to a promise");
|
|
2382
2417
|
if (typeof component === "function") {
|
|
2383
2418
|
Object.assign(component, {
|
|
@@ -2390,7 +2425,7 @@ function staticDynamic(component) {
|
|
|
2390
2425
|
}
|
|
2391
2426
|
return props => untrack(() => component(props));
|
|
2392
2427
|
}
|
|
2393
|
-
if (typeof component === "string") return props =>
|
|
2428
|
+
if (typeof component === "string" && tagArm) return props => tagArm(component, props);
|
|
2394
2429
|
return () => undefined;
|
|
2395
2430
|
}
|
|
2396
2431
|
function staticElement(tag, props) {
|
|
@@ -2439,4 +2474,4 @@ _moduleUrl) {
|
|
|
2439
2474
|
function httpStatus(_code, _text) {}
|
|
2440
2475
|
function httpHeader(_name, _value, _options) {}
|
|
2441
2476
|
|
|
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 };
|
|
2477
|
+
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, dynamicComponent, 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, reportRequestFailure, resolveSSRNode, respond, runHydrationEvents, scope, serializeCookie, setAttribute, setAttributeNS, setProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrElementAttribute, ssrGroup, ssrHydrationKey, ssrStyle, ssrStyleProperties, ssrStyleProperty, style, takeHydrationValue, template, unregisterDelegatedContainer, unregisterDelegatedRoot, useHead, waitAsset, warmAsset };
|
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,
|
|
1
|
+
import { createRenderEffect, createMemo, enableHydration, $PROXY, untrack, runWithOwner, createRoot, getOwner, ROOT_ERROR_HOOK, flatten, flush, createComponent, omit, createOwner, createSignal, createEffect, onCleanup } from 'solid-js';
|
|
2
2
|
export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, Show, Switch, createComponent, getOwner, merge as mergeProps, untrack } from 'solid-js';
|
|
3
|
-
import { sharedConfig, sourceKeys, SOURCE_PROXY,
|
|
3
|
+
import { sharedConfig, sourceKeys, SOURCE_PROXY, resolvedTable, viewOf, OmitView, hasStaticKeys, SOURCE_MEMO, sourceHas, SOURCE_OMIT, sourceGet, SOURCE_PLAIN } from 'solid-js/internal';
|
|
4
4
|
|
|
5
5
|
const DOMWithState = {
|
|
6
6
|
INPUT: {
|
|
@@ -317,7 +317,7 @@ function serializeCookie(name, value, options = {}) {
|
|
|
317
317
|
return cookie;
|
|
318
318
|
}
|
|
319
319
|
const FLASH_COOKIE = "flash";
|
|
320
|
-
const FLASH_MATCHER =
|
|
320
|
+
const FLASH_MATCHER = /(?:^|;\s*)flash=([^;]+)/;
|
|
321
321
|
function hasFlashCookie(cookieHeader) {
|
|
322
322
|
return !!cookieHeader && FLASH_MATCHER.test(cookieHeader);
|
|
323
323
|
}
|
|
@@ -482,6 +482,9 @@ function attachDelegatedEvent(name, container, state) {
|
|
|
482
482
|
state.handlers.set(name, handler);
|
|
483
483
|
container.addEventListener(name, handler);
|
|
484
484
|
}
|
|
485
|
+
function dispatchAsInteraction(e, fn) {
|
|
486
|
+
return fn();
|
|
487
|
+
}
|
|
485
488
|
function getDelegatedRoot(node) {
|
|
486
489
|
while (node) {
|
|
487
490
|
if (delegatedContainers.get(node)?.roots) return node;
|
|
@@ -680,26 +683,15 @@ function spread(node, props, skipChildren, skip, name) {
|
|
|
680
683
|
assign(node, newProps, true, prevProps, true);
|
|
681
684
|
};
|
|
682
685
|
if (Array.isArray(props)) {
|
|
686
|
+
effect(() => collectSources({}, props, undefined, skip), apply);
|
|
683
687
|
if (!skipChildren && !(skip !== undefined && skip("children"))) insert(node, () => {
|
|
684
688
|
for (let i = props.length - 1; i >= 0; i--) {
|
|
685
689
|
const s = resolveSource(props[i]);
|
|
686
690
|
if (s != null && entryHas(s, "children")) return entryGet(s, "children");
|
|
687
691
|
}
|
|
688
692
|
});
|
|
689
|
-
effect(() => collectSources({}, props, undefined, skip), apply);
|
|
690
693
|
return prevProps;
|
|
691
694
|
}
|
|
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
695
|
effect(() => {
|
|
704
696
|
const source = resolveSource(props);
|
|
705
697
|
const newProps = {};
|
|
@@ -711,6 +703,17 @@ function spread(node, props, skipChildren, skip, name) {
|
|
|
711
703
|
}
|
|
712
704
|
return newProps;
|
|
713
705
|
}, apply);
|
|
706
|
+
if (!skipChildren && !(skip !== undefined && skip("children"))) {
|
|
707
|
+
if (typeof props !== "function" && props != null && hasStaticKeys(props)) {
|
|
708
|
+
const desc = Object.getOwnPropertyDescriptor(props, "children");
|
|
709
|
+
if (desc !== undefined) {
|
|
710
|
+
if (desc.get === undefined) insert(node, desc.value);else insert(node, () => props.children);
|
|
711
|
+
}
|
|
712
|
+
} else insert(node, () => {
|
|
713
|
+
const source = resolveSource(props);
|
|
714
|
+
return source != null && entryHas(source, "children") ? entryGet(source, "children") : undefined;
|
|
715
|
+
});
|
|
716
|
+
}
|
|
714
717
|
return prevProps;
|
|
715
718
|
}
|
|
716
719
|
function collectTable(out, table, skip) {
|
|
@@ -891,13 +894,14 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
891
894
|
if (hydrationRt !== null) current = hydrationRt.reclaimRegion(current, parent, marker);
|
|
892
895
|
const value = normalize(accessor(), current, multi, true);
|
|
893
896
|
if (typeof value !== "function") return value;
|
|
897
|
+
const innerOptions = prev !== undefined && !(options && options.schedule) ? {
|
|
898
|
+
...options,
|
|
899
|
+
schedule: true
|
|
900
|
+
} : options;
|
|
894
901
|
effect(() => (hydrationRt !== null && (current = hydrationRt.reclaimRegion(current, parent, marker)), normalize(value, current, multi)), inner => {
|
|
895
902
|
current = insertExpression(parent, inner, current, marker);
|
|
896
903
|
host && tagHost(current, host);
|
|
897
|
-
},
|
|
898
|
-
...options,
|
|
899
|
-
schedule: true
|
|
900
|
-
} : options);
|
|
904
|
+
}, innerOptions);
|
|
901
905
|
return INNER_OWNED;
|
|
902
906
|
}, value => {
|
|
903
907
|
if (value === INNER_OWNED) return;
|
|
@@ -1206,7 +1210,7 @@ function flushHeadRegistry() {
|
|
|
1206
1210
|
function createHeadElement(tag, props) {
|
|
1207
1211
|
const el = document.createElement(tag);
|
|
1208
1212
|
for (const name in props) {
|
|
1209
|
-
if (name === "children" || name === "ref" || name
|
|
1213
|
+
if (name === "children" || name === "ref" || /^on[A-Z]/.test(name)) continue;
|
|
1210
1214
|
if (!HEAD_ATTR_NAME.test(name)) {
|
|
1211
1215
|
continue;
|
|
1212
1216
|
}
|
|
@@ -1229,7 +1233,7 @@ function renderHeadElement(t, identity, existing) {
|
|
|
1229
1233
|
function headElementMatches(el, t) {
|
|
1230
1234
|
if (el.tagName.toLowerCase() !== t.tag) return false;
|
|
1231
1235
|
for (const name in t.props) {
|
|
1232
|
-
if (name === "children" || name === "ref" || name
|
|
1236
|
+
if (name === "children" || name === "ref" || /^on[A-Z]/.test(name)) continue;
|
|
1233
1237
|
if (!HEAD_ATTR_NAME.test(name)) continue;
|
|
1234
1238
|
const v = t.props[name];
|
|
1235
1239
|
if (v == null || v === false) {
|
|
@@ -1574,8 +1578,9 @@ function assignProp(node, prop, value, prev, skipRef, nodeName) {
|
|
|
1574
1578
|
if (!skipRef && value) ref(() => value, node);
|
|
1575
1579
|
return value;
|
|
1576
1580
|
}
|
|
1581
|
+
let c;
|
|
1577
1582
|
const hasNamespace = prop.indexOf(":") > -1;
|
|
1578
|
-
if (!hasNamespace && prop.
|
|
1583
|
+
if (!hasNamespace && prop.startsWith("on") && (c = prop.charCodeAt(2)) > 64 && c < 91) {
|
|
1579
1584
|
const name = prop.slice(2).toLowerCase();
|
|
1580
1585
|
const delegate = DelegatedEvents.has(name);
|
|
1581
1586
|
if (!delegate && prev) {
|
|
@@ -1678,6 +1683,7 @@ function insertExpression(parent, value, current, marker) {
|
|
|
1678
1683
|
return value;
|
|
1679
1684
|
}
|
|
1680
1685
|
if (value === current) return value;
|
|
1686
|
+
if (hydrationRt !== null && sharedConfig.hydrating && current == null && value && [].concat(value).every(n => n?.parentNode === parent) && value.length !== 0) return value;
|
|
1681
1687
|
const t = typeof value,
|
|
1682
1688
|
multi = marker !== undefined;
|
|
1683
1689
|
if (t === "string" || t === "number") {
|
|
@@ -1806,16 +1812,14 @@ function cleanChildren(parent, current, marker, replacement) {
|
|
|
1806
1812
|
if (replacement && marker) replacement[$$SLOT] = marker;
|
|
1807
1813
|
}
|
|
1808
1814
|
function gatherHydratable(element, root) {
|
|
1809
|
-
const templates = element.querySelectorAll(`*[_hk]`);
|
|
1815
|
+
const templates = element.querySelectorAll(root ? `[_hk^="${root.replace(/["\\]/g, "\\$&")}"]` : `*[_hk]`);
|
|
1810
1816
|
const frames = root ? null : element.querySelectorAll("[data-fid]");
|
|
1811
1817
|
const frameCount = frames ? frames.length : 0;
|
|
1812
1818
|
const registry = sharedConfig.registry;
|
|
1813
1819
|
for (let i = 0; i < templates.length; i++) {
|
|
1814
1820
|
const node = templates[i];
|
|
1815
1821
|
const key = node.getAttribute("_hk");
|
|
1816
|
-
if (
|
|
1817
|
-
if (!key.startsWith(root)) continue;
|
|
1818
|
-
} else if (frameCount !== 0) {
|
|
1822
|
+
if (frameCount !== 0) {
|
|
1819
1823
|
let inFrame = false;
|
|
1820
1824
|
for (let j = 0; j < frameCount; j++) {
|
|
1821
1825
|
if (frames[j].contains(node)) {
|
|
@@ -1834,6 +1838,7 @@ function getHydrationKey() {
|
|
|
1834
1838
|
const RequestContext = Symbol();
|
|
1835
1839
|
|
|
1836
1840
|
function configureServerErrors(_config) {}
|
|
1841
|
+
function reportRequestFailure(_error, _event) {}
|
|
1837
1842
|
function throwInBrowser(func) {
|
|
1838
1843
|
const err = new Error(`${func.name} is not supported in the browser, returning undefined`);
|
|
1839
1844
|
console.error(err);
|
|
@@ -1868,6 +1873,7 @@ function ssrElementAttribute(key, value) {}
|
|
|
1868
1873
|
function ssrClassName(value) {}
|
|
1869
1874
|
function ssrStyle(value) {}
|
|
1870
1875
|
function ssrStyleProperty(name, value) {}
|
|
1876
|
+
function ssrStyleProperties(...entries) {}
|
|
1871
1877
|
function ssrAttribute(key, value) {}
|
|
1872
1878
|
function ssrGroup(fn, n) {}
|
|
1873
1879
|
function ssrHydrationKey() {}
|
|
@@ -2059,7 +2065,13 @@ function bindingOf(value) {
|
|
|
2059
2065
|
return value !== null && (typeof value === "function" || typeof value === "object") && value[COMPONENT_BINDING] || undefined;
|
|
2060
2066
|
}
|
|
2061
2067
|
function dynamic(source, options) {
|
|
2062
|
-
|
|
2068
|
+
return dynamicCore(source, options, staticElement);
|
|
2069
|
+
}
|
|
2070
|
+
function dynamicComponent(source, options) {
|
|
2071
|
+
return dynamicCore(source, options);
|
|
2072
|
+
}
|
|
2073
|
+
function dynamicCore(source, options, tagArm) {
|
|
2074
|
+
if (options?.static) return staticDynamic(untrack(source), tagArm);
|
|
2063
2075
|
const sites = new Set();
|
|
2064
2076
|
let deliveredAddress;
|
|
2065
2077
|
const resolveBinding = (next, prev) => {
|
|
@@ -2134,12 +2146,12 @@ function dynamic(source, options) {
|
|
|
2134
2146
|
return untrack(() => component(props));
|
|
2135
2147
|
}
|
|
2136
2148
|
case "string":
|
|
2137
|
-
return
|
|
2149
|
+
return tagArm ? tagArm(component, props) : undefined;
|
|
2138
2150
|
}
|
|
2139
2151
|
});
|
|
2140
2152
|
};
|
|
2141
2153
|
}
|
|
2142
|
-
function staticDynamic(component) {
|
|
2154
|
+
function staticDynamic(component, tagArm) {
|
|
2143
2155
|
if (typeof component === "function") {
|
|
2144
2156
|
const binding = bindingOf(component);
|
|
2145
2157
|
if (binding) {
|
|
@@ -2148,7 +2160,7 @@ function staticDynamic(component) {
|
|
|
2148
2160
|
}
|
|
2149
2161
|
return props => untrack(() => component(props));
|
|
2150
2162
|
}
|
|
2151
|
-
if (typeof component === "string") return props =>
|
|
2163
|
+
if (typeof component === "string" && tagArm) return props => tagArm(component, props);
|
|
2152
2164
|
return () => undefined;
|
|
2153
2165
|
}
|
|
2154
2166
|
function staticElement(tag, props) {
|
|
@@ -2197,4 +2209,4 @@ _moduleUrl) {
|
|
|
2197
2209
|
function httpStatus(_code, _text) {}
|
|
2198
2210
|
function httpHeader(_name, _value, _options) {}
|
|
2199
2211
|
|
|
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 };
|
|
2212
|
+
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, dynamicComponent, 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, reportRequestFailure, resolveSSRNode, respond, runHydrationEvents, scope, serializeCookie, setAttribute, setAttributeNS, setProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrElementAttribute, ssrGroup, ssrHydrationKey, ssrStyle, ssrStyleProperties, ssrStyleProperty, style, takeHydrationValue, template, unregisterDelegatedContainer, unregisterDelegatedRoot, useHead, waitAsset, warmAsset };
|