@solidjs/web 2.0.0-rc.11 → 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 +705 -151
- package/dist/server.js +604 -123
- package/dist/server.observe.js +617 -124
- package/dist/web.dev.js +102 -41
- package/dist/web.js +75 -37
- package/dist/web.observe.js +75 -39
- 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 +693 -919
- package/frames/dist/client.js +636 -917
- package/frames/dist/client.observe.js +637 -917
- package/frames/dist/regions.js +130 -0
- package/frames/dist/server.dev.js +607 -212
- package/frames/dist/server.js +554 -212
- package/frames/dist/server.observe.js +554 -212
- package/frames/dist/trace.js +42 -0
- package/frames/dist/wire.js +133 -0
- package/package.json +30 -3
- 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 +178 -72
- package/server-functions/dist/client.js +99 -61
- package/server-functions/dist/client.observe.js +178 -72
- package/server-functions/dist/server.dev.js +117 -56
- package/server-functions/dist/server.js +117 -56
- package/server-functions/dist/server.observe.js +117 -56
- package/skills/server-components/SKILL.md +228 -0
- package/types/client.d.ts +37 -2
- 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 -96
- package/types/frames/frame-container-plugin.d.ts +2 -10
- 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 +53 -1
- package/types/frames/trace-tier.d.ts +2 -0
- package/types/frames/tree-rewrite.d.ts +39 -0
- package/types/frames/wire-tier.d.ts +116 -0
- package/types/index.d.ts +38 -0
- package/types/index.server.d.ts +10 -1
- package/types/jsx.d.ts +11 -1
- package/types/observe.d.ts +182 -12
- package/types/request-error-hook.d.ts +5 -0
- 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-observe.d.ts +8 -0
- package/types/server.d.ts +125 -12
package/dist/web.observe.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { createRenderEffect, createMemo,
|
|
1
|
+
import { createRenderEffect, createMemo, OBSERVE, 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 { 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: {
|
|
@@ -325,7 +325,7 @@ function serializeCookie(name, value, options = {}) {
|
|
|
325
325
|
return cookie;
|
|
326
326
|
}
|
|
327
327
|
const FLASH_COOKIE = "flash";
|
|
328
|
-
const FLASH_MATCHER =
|
|
328
|
+
const FLASH_MATCHER = /(?:^|;\s*)flash=([^;]+)/;
|
|
329
329
|
function hasFlashCookie(cookieHeader) {
|
|
330
330
|
return !!cookieHeader && FLASH_MATCHER.test(cookieHeader);
|
|
331
331
|
}
|
|
@@ -374,6 +374,34 @@ function HydrationScript(_props) {
|
|
|
374
374
|
return null;
|
|
375
375
|
}
|
|
376
376
|
const getRequestEvent = voidFn;
|
|
377
|
+
const getHydrationWriter = voidFn;
|
|
378
|
+
function takeHydrationValue(key) {
|
|
379
|
+
const registry = globalThis._$HY && globalThis._$HY.r;
|
|
380
|
+
if (!registry || !(key in registry)) return;
|
|
381
|
+
const v = registry[key];
|
|
382
|
+
delete registry[key];
|
|
383
|
+
if (v !== null && typeof v === "object" && typeof v.then === "function") {
|
|
384
|
+
if (v.s === 1) return {
|
|
385
|
+
status: "resolved",
|
|
386
|
+
value: v.v
|
|
387
|
+
};
|
|
388
|
+
if (v.s === 2) {
|
|
389
|
+
v.then(undefined, voidFn);
|
|
390
|
+
return {
|
|
391
|
+
status: "rejected",
|
|
392
|
+
error: v.v
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
return {
|
|
396
|
+
status: "pending",
|
|
397
|
+
promise: v
|
|
398
|
+
};
|
|
399
|
+
}
|
|
400
|
+
return {
|
|
401
|
+
status: "resolved",
|
|
402
|
+
value: v
|
|
403
|
+
};
|
|
404
|
+
}
|
|
377
405
|
const getTraceContext = voidFn;
|
|
378
406
|
function render(code, element, init, options = {}) {
|
|
379
407
|
let disposer;
|
|
@@ -481,8 +509,9 @@ function dispatchAsInteraction(e, fn) {
|
|
|
481
509
|
return OBSERVE.attribution.withInteraction({
|
|
482
510
|
type: e.type,
|
|
483
511
|
target: describeEventTarget(e.target),
|
|
484
|
-
at: interactionStart(e)
|
|
485
|
-
|
|
512
|
+
at: interactionStart(e),
|
|
513
|
+
event: e
|
|
514
|
+
}, fn) ;
|
|
486
515
|
}
|
|
487
516
|
function getDelegatedRoot(node) {
|
|
488
517
|
while (node) {
|
|
@@ -696,26 +725,15 @@ function spread(node, props, skipChildren, skip, name) {
|
|
|
696
725
|
assign(node, newProps, true, prevProps, true);
|
|
697
726
|
};
|
|
698
727
|
if (Array.isArray(props)) {
|
|
728
|
+
effect(() => collectSources({}, props, undefined, skip), apply);
|
|
699
729
|
if (!skipChildren && !(skip !== undefined && skip("children"))) insert(node, () => {
|
|
700
730
|
for (let i = props.length - 1; i >= 0; i--) {
|
|
701
731
|
const s = resolveSource(props[i]);
|
|
702
732
|
if (s != null && entryHas(s, "children")) return entryGet(s, "children");
|
|
703
733
|
}
|
|
704
734
|
});
|
|
705
|
-
effect(() => collectSources({}, props, undefined, skip), apply);
|
|
706
735
|
return prevProps;
|
|
707
736
|
}
|
|
708
|
-
if (!skipChildren && !(skip !== undefined && skip("children"))) {
|
|
709
|
-
if (typeof props !== "function" && props != null && hasStaticKeys(props)) {
|
|
710
|
-
const desc = Object.getOwnPropertyDescriptor(props, "children");
|
|
711
|
-
if (desc !== undefined) {
|
|
712
|
-
if (desc.get === undefined) insert(node, desc.value);else insert(node, () => props.children);
|
|
713
|
-
}
|
|
714
|
-
} else insert(node, () => {
|
|
715
|
-
const source = resolveSource(props);
|
|
716
|
-
return source != null && entryHas(source, "children") ? entryGet(source, "children") : undefined;
|
|
717
|
-
});
|
|
718
|
-
}
|
|
719
737
|
effect(() => {
|
|
720
738
|
const source = resolveSource(props);
|
|
721
739
|
const newProps = {};
|
|
@@ -727,6 +745,17 @@ function spread(node, props, skipChildren, skip, name) {
|
|
|
727
745
|
}
|
|
728
746
|
return newProps;
|
|
729
747
|
}, apply);
|
|
748
|
+
if (!skipChildren && !(skip !== undefined && skip("children"))) {
|
|
749
|
+
if (typeof props !== "function" && props != null && hasStaticKeys(props)) {
|
|
750
|
+
const desc = Object.getOwnPropertyDescriptor(props, "children");
|
|
751
|
+
if (desc !== undefined) {
|
|
752
|
+
if (desc.get === undefined) insert(node, desc.value);else insert(node, () => props.children);
|
|
753
|
+
}
|
|
754
|
+
} else insert(node, () => {
|
|
755
|
+
const source = resolveSource(props);
|
|
756
|
+
return source != null && entryHas(source, "children") ? entryGet(source, "children") : undefined;
|
|
757
|
+
});
|
|
758
|
+
}
|
|
730
759
|
return prevProps;
|
|
731
760
|
}
|
|
732
761
|
function collectTable(out, table, skip) {
|
|
@@ -911,13 +940,14 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
911
940
|
if (hydrationRt !== null) current = hydrationRt.reclaimRegion(current, parent, marker);
|
|
912
941
|
const value = normalize(accessor(), current, multi, true);
|
|
913
942
|
if (typeof value !== "function") return value;
|
|
943
|
+
const innerOptions = prev !== undefined && !(options && options.schedule) ? {
|
|
944
|
+
...options,
|
|
945
|
+
schedule: true
|
|
946
|
+
} : options;
|
|
914
947
|
effect(() => (hydrationRt !== null && (current = hydrationRt.reclaimRegion(current, parent, marker)), normalize(value, current, multi)), inner => {
|
|
915
948
|
current = insertExpression(parent, inner, current, marker);
|
|
916
949
|
host && tagHost(current, host);
|
|
917
|
-
},
|
|
918
|
-
...options,
|
|
919
|
-
schedule: true
|
|
920
|
-
} : options);
|
|
950
|
+
}, innerOptions);
|
|
921
951
|
return INNER_OWNED;
|
|
922
952
|
}, value => {
|
|
923
953
|
if (value === INNER_OWNED) return;
|
|
@@ -1226,7 +1256,7 @@ function flushHeadRegistry() {
|
|
|
1226
1256
|
function createHeadElement(tag, props) {
|
|
1227
1257
|
const el = document.createElement(tag);
|
|
1228
1258
|
for (const name in props) {
|
|
1229
|
-
if (name === "children" || name === "ref" || name
|
|
1259
|
+
if (name === "children" || name === "ref" || /^on[A-Z]/.test(name)) continue;
|
|
1230
1260
|
if (!HEAD_ATTR_NAME.test(name)) {
|
|
1231
1261
|
continue;
|
|
1232
1262
|
}
|
|
@@ -1249,7 +1279,7 @@ function renderHeadElement(t, identity, existing) {
|
|
|
1249
1279
|
function headElementMatches(el, t) {
|
|
1250
1280
|
if (el.tagName.toLowerCase() !== t.tag) return false;
|
|
1251
1281
|
for (const name in t.props) {
|
|
1252
|
-
if (name === "children" || name === "ref" || name
|
|
1282
|
+
if (name === "children" || name === "ref" || /^on[A-Z]/.test(name)) continue;
|
|
1253
1283
|
if (!HEAD_ATTR_NAME.test(name)) continue;
|
|
1254
1284
|
const v = t.props[name];
|
|
1255
1285
|
if (v == null || v === false) {
|
|
@@ -1594,8 +1624,9 @@ function assignProp(node, prop, value, prev, skipRef, nodeName) {
|
|
|
1594
1624
|
if (!skipRef && value) ref(() => value, node);
|
|
1595
1625
|
return value;
|
|
1596
1626
|
}
|
|
1627
|
+
let c;
|
|
1597
1628
|
const hasNamespace = prop.indexOf(":") > -1;
|
|
1598
|
-
if (!hasNamespace && prop.
|
|
1629
|
+
if (!hasNamespace && prop.startsWith("on") && (c = prop.charCodeAt(2)) > 64 && c < 91) {
|
|
1599
1630
|
const name = prop.slice(2).toLowerCase();
|
|
1600
1631
|
const delegate = DelegatedEvents.has(name);
|
|
1601
1632
|
if (!delegate && prev) {
|
|
@@ -1638,11 +1669,7 @@ function eventHandler(e, container, state) {
|
|
|
1638
1669
|
value
|
|
1639
1670
|
});
|
|
1640
1671
|
const handleNode = () => {
|
|
1641
|
-
|
|
1642
|
-
if (handler === undefined && node.hasAttribute && node.hasAttribute("_bnd")) {
|
|
1643
|
-
const seam = globalThis[Symbol.for("solid.bnd")];
|
|
1644
|
-
if (seam) handler = seam.resolve(node, e.type);
|
|
1645
|
-
}
|
|
1672
|
+
const handler = node[key];
|
|
1646
1673
|
if (handler && !node.disabled) {
|
|
1647
1674
|
const data = node[`${key}Data`];
|
|
1648
1675
|
data !== undefined ? handler.call(node, data, e) : typeof handler === "function" ? handler.call(node, e) : handler.handleEvent(e);
|
|
@@ -1702,6 +1729,7 @@ function insertExpression(parent, value, current, marker) {
|
|
|
1702
1729
|
return value;
|
|
1703
1730
|
}
|
|
1704
1731
|
if (value === current) return value;
|
|
1732
|
+
if (hydrationRt !== null && sharedConfig.hydrating && current == null && value && [].concat(value).every(n => n?.parentNode === parent) && value.length !== 0) return value;
|
|
1705
1733
|
const t = typeof value,
|
|
1706
1734
|
multi = marker !== undefined;
|
|
1707
1735
|
if (t === "string" || t === "number") {
|
|
@@ -1830,16 +1858,14 @@ function cleanChildren(parent, current, marker, replacement) {
|
|
|
1830
1858
|
if (replacement && marker) replacement[$$SLOT] = marker;
|
|
1831
1859
|
}
|
|
1832
1860
|
function gatherHydratable(element, root) {
|
|
1833
|
-
const templates = element.querySelectorAll(`*[_hk]`);
|
|
1861
|
+
const templates = element.querySelectorAll(root ? `[_hk^="${root.replace(/["\\]/g, "\\$&")}"]` : `*[_hk]`);
|
|
1834
1862
|
const frames = root ? null : element.querySelectorAll("[data-fid]");
|
|
1835
1863
|
const frameCount = frames ? frames.length : 0;
|
|
1836
1864
|
const registry = sharedConfig.registry;
|
|
1837
1865
|
for (let i = 0; i < templates.length; i++) {
|
|
1838
1866
|
const node = templates[i];
|
|
1839
1867
|
const key = node.getAttribute("_hk");
|
|
1840
|
-
if (
|
|
1841
|
-
if (!key.startsWith(root)) continue;
|
|
1842
|
-
} else if (frameCount !== 0) {
|
|
1868
|
+
if (frameCount !== 0) {
|
|
1843
1869
|
let inFrame = false;
|
|
1844
1870
|
for (let j = 0; j < frameCount; j++) {
|
|
1845
1871
|
if (frames[j].contains(node)) {
|
|
@@ -1858,6 +1884,7 @@ function getHydrationKey() {
|
|
|
1858
1884
|
const RequestContext = Symbol();
|
|
1859
1885
|
|
|
1860
1886
|
function configureServerErrors(_config) {}
|
|
1887
|
+
function reportRequestFailure(_error, _event) {}
|
|
1861
1888
|
function throwInBrowser(func) {
|
|
1862
1889
|
const err = new Error(`${func.name} is not supported in the browser, returning undefined`);
|
|
1863
1890
|
console.error(err);
|
|
@@ -1892,6 +1919,7 @@ function ssrElementAttribute(key, value) {}
|
|
|
1892
1919
|
function ssrClassName(value) {}
|
|
1893
1920
|
function ssrStyle(value) {}
|
|
1894
1921
|
function ssrStyleProperty(name, value) {}
|
|
1922
|
+
function ssrStyleProperties(...entries) {}
|
|
1895
1923
|
function ssrAttribute(key, value) {}
|
|
1896
1924
|
function ssrGroup(fn, n) {}
|
|
1897
1925
|
function ssrHydrationKey() {}
|
|
@@ -2083,7 +2111,13 @@ function bindingOf(value) {
|
|
|
2083
2111
|
return value !== null && (typeof value === "function" || typeof value === "object") && value[COMPONENT_BINDING] || undefined;
|
|
2084
2112
|
}
|
|
2085
2113
|
function dynamic(source, options) {
|
|
2086
|
-
|
|
2114
|
+
return dynamicCore(source, options, staticElement);
|
|
2115
|
+
}
|
|
2116
|
+
function dynamicComponent(source, options) {
|
|
2117
|
+
return dynamicCore(source, options);
|
|
2118
|
+
}
|
|
2119
|
+
function dynamicCore(source, options, tagArm) {
|
|
2120
|
+
if (options?.static) return staticDynamic(untrack(source), tagArm);
|
|
2087
2121
|
const sites = new Set();
|
|
2088
2122
|
let deliveredAddress;
|
|
2089
2123
|
const resolveBinding = (next, prev) => {
|
|
@@ -2148,7 +2182,9 @@ function dynamic(source, options) {
|
|
|
2148
2182
|
{
|
|
2149
2183
|
const binding = bindingOf(component);
|
|
2150
2184
|
if (binding) {
|
|
2151
|
-
const [address, setAddress] = createSignal(deliveredAddress ??= binding.address
|
|
2185
|
+
const [address, setAddress] = createSignal(deliveredAddress ??= binding.address, {
|
|
2186
|
+
ownedWrite: true
|
|
2187
|
+
});
|
|
2152
2188
|
sites.add(setAddress);
|
|
2153
2189
|
onCleanup(() => sites.delete(setAddress));
|
|
2154
2190
|
return untrack(() => binding.component(props, address));
|
|
@@ -2156,12 +2192,12 @@ function dynamic(source, options) {
|
|
|
2156
2192
|
return untrack(() => component(props));
|
|
2157
2193
|
}
|
|
2158
2194
|
case "string":
|
|
2159
|
-
return
|
|
2195
|
+
return tagArm ? tagArm(component, props) : undefined;
|
|
2160
2196
|
}
|
|
2161
2197
|
});
|
|
2162
2198
|
};
|
|
2163
2199
|
}
|
|
2164
|
-
function staticDynamic(component) {
|
|
2200
|
+
function staticDynamic(component, tagArm) {
|
|
2165
2201
|
if (typeof component === "function") {
|
|
2166
2202
|
const binding = bindingOf(component);
|
|
2167
2203
|
if (binding) {
|
|
@@ -2170,7 +2206,7 @@ function staticDynamic(component) {
|
|
|
2170
2206
|
}
|
|
2171
2207
|
return props => untrack(() => component(props));
|
|
2172
2208
|
}
|
|
2173
|
-
if (typeof component === "string") return props =>
|
|
2209
|
+
if (typeof component === "string" && tagArm) return props => tagArm(component, props);
|
|
2174
2210
|
return () => undefined;
|
|
2175
2211
|
}
|
|
2176
2212
|
function staticElement(tag, props) {
|
|
@@ -2219,4 +2255,4 @@ _moduleUrl) {
|
|
|
2219
2255
|
function httpStatus(_code, _text) {}
|
|
2220
2256
|
function httpHeader(_name, _value, _options) {}
|
|
2221
2257
|
|
|
2222
|
-
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, 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, template, unregisterDelegatedContainer, unregisterDelegatedRoot, useHead, waitAsset, warmAsset };
|
|
2258
|
+
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 };
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
const PRELOAD_QUALIFIERS = ["as", "crossorigin", "type", "media", "imagesrcset", "imagesizes"];
|
|
2
|
+
function qualifierValue(name, value) {
|
|
3
|
+
if (value == null) return null;
|
|
4
|
+
if (name === "imagesrcset" || name === "imagesizes") return value === "" ? null : value;
|
|
5
|
+
if (name === "as") return value.replace(/[A-Z]/g, c => String.fromCharCode(c.charCodeAt(0) + 32));
|
|
6
|
+
if (name !== "crossorigin") return value;
|
|
7
|
+
return value.length === 15 && value.toLowerCase() === "use-credentials" ? "use-credentials" : "anonymous";
|
|
8
|
+
}
|
|
9
|
+
function findHeadElement(selector, attr, value, qualifiers) {
|
|
10
|
+
candidate: for (const node of document.head.querySelectorAll(selector)) {
|
|
11
|
+
if (node.getAttribute(attr) !== value) continue;
|
|
12
|
+
if (!qualifiers) return node;
|
|
13
|
+
for (let i = 0; i < PRELOAD_QUALIFIERS.length; i++) {
|
|
14
|
+
const name = PRELOAD_QUALIFIERS[i];
|
|
15
|
+
if (qualifierValue(name, node.getAttribute(name)) !== qualifierValue(name, qualifiers[name] ?? null)) continue candidate;
|
|
16
|
+
}
|
|
17
|
+
return node;
|
|
18
|
+
}
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
function ensurePreload(entry) {
|
|
22
|
+
const attrs = entry.attrs;
|
|
23
|
+
const href = entry.href;
|
|
24
|
+
if (findHeadElement('link[rel="preload"]', "href", href || null, attrs)) return;
|
|
25
|
+
const link = document.createElement("link");
|
|
26
|
+
link.rel = "preload";
|
|
27
|
+
for (const name in attrs) link.setAttribute(name, attrs[name]);
|
|
28
|
+
if (href) link.setAttribute("href", href);
|
|
29
|
+
document.head.appendChild(link);
|
|
30
|
+
}
|
|
31
|
+
function ensureStylesheet(entry, onSettle) {
|
|
32
|
+
const href = typeof entry === "string" ? entry : entry.href;
|
|
33
|
+
let link = findHeadElement('link[rel="stylesheet"]', "href", href);
|
|
34
|
+
if (!link) {
|
|
35
|
+
link = document.createElement("link");
|
|
36
|
+
link.rel = "stylesheet";
|
|
37
|
+
if (typeof entry !== "string" && entry.attrs) {
|
|
38
|
+
for (const name in entry.attrs) link.setAttribute(name, entry.attrs[name]);
|
|
39
|
+
}
|
|
40
|
+
link.href = href;
|
|
41
|
+
const waiters = new Set();
|
|
42
|
+
link._$frWaiters = waiters;
|
|
43
|
+
const settle = () => {
|
|
44
|
+
link._$frWaiters = null;
|
|
45
|
+
for (const fn of waiters) fn();
|
|
46
|
+
};
|
|
47
|
+
link.addEventListener("load", settle);
|
|
48
|
+
link.addEventListener("error", settle);
|
|
49
|
+
document.head.appendChild(link);
|
|
50
|
+
}
|
|
51
|
+
const waiters = link._$frWaiters;
|
|
52
|
+
if (waiters == null) return true;
|
|
53
|
+
waiters.add(onSettle);
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
function ensureModulePreload(href) {
|
|
57
|
+
if (findHeadElement('link[rel="modulepreload"]', "href", href)) return;
|
|
58
|
+
const link = document.createElement("link");
|
|
59
|
+
link.rel = "modulepreload";
|
|
60
|
+
link.href = href;
|
|
61
|
+
document.head.appendChild(link);
|
|
62
|
+
}
|
|
63
|
+
function applyInlineStyles(inlineStyles) {
|
|
64
|
+
for (const entry of inlineStyles) {
|
|
65
|
+
if (findHeadElement("style[data-asset]", "data-asset", entry.id)) continue;
|
|
66
|
+
const el = document.createElement("style");
|
|
67
|
+
el.setAttribute("data-asset", entry.id);
|
|
68
|
+
if (entry.attrs) {
|
|
69
|
+
for (const name in entry.attrs) el.setAttribute(name, entry.attrs[name]);
|
|
70
|
+
}
|
|
71
|
+
el.textContent = entry.content || "";
|
|
72
|
+
document.head.appendChild(el);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
const flushers = new WeakMap();
|
|
76
|
+
function gate(entries, frame) {
|
|
77
|
+
let flush = flushers.get(frame);
|
|
78
|
+
if (!flush) flushers.set(frame, flush = () => frame.apply({
|
|
79
|
+
version: frame.version,
|
|
80
|
+
r: {}
|
|
81
|
+
}));
|
|
82
|
+
let ready = true;
|
|
83
|
+
for (const entry of entries) ready = ensureStylesheet(entry, flush) && ready;
|
|
84
|
+
return ready;
|
|
85
|
+
}
|
|
86
|
+
function apply(record) {
|
|
87
|
+
if (record.modules) for (const href of record.modules) ensureModulePreload(href);
|
|
88
|
+
if (record.preloads) for (const entry of record.preloads) ensurePreload(entry);
|
|
89
|
+
if (record.inlineStyles) applyInlineStyles(record.inlineStyles);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export { apply, gate };
|
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
import { DEV, OBSERVE, createSignal, untrack, createRenderEffect, onCleanup } from 'solid-js';
|
|
2
|
+
import { assign, runHydrationEvents } from '@solidjs/web';
|
|
3
|
+
import { sharedConfig } from 'solid-js/internal';
|
|
4
|
+
import { isAsyncValue as isAsyncValue$1 } from '@solidjs/web/frames';
|
|
5
|
+
|
|
6
|
+
const SLOT_MARKER = "_s:";
|
|
7
|
+
const SLOT_TEXT = SLOT_MARKER + "t=";
|
|
8
|
+
function isAsyncValue(v) {
|
|
9
|
+
return v !== null && typeof v === "object" && (typeof v.then === "function" || typeof v[Symbol.asyncIterator] === "function");
|
|
10
|
+
}
|
|
11
|
+
function shapeOf(v) {
|
|
12
|
+
return v === null ? "null" : typeof Node === "function" && v instanceof Node ? "a DOM node" : Array.isArray(v) ? "an array" : isAsyncValue(v) ? "an async value" : typeof v;
|
|
13
|
+
}
|
|
14
|
+
function slotShapeFinding(data, message) {
|
|
15
|
+
DEV.report(OBSERVE.diagnostics.emit({
|
|
16
|
+
code: "BINDING_SLOT_POSITION",
|
|
17
|
+
kind: "render",
|
|
18
|
+
severity: "warn",
|
|
19
|
+
message,
|
|
20
|
+
data
|
|
21
|
+
}, null));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function slotEntry(entry, pos) {
|
|
25
|
+
const colon = entry.indexOf(":");
|
|
26
|
+
if (colon < 1) return null;
|
|
27
|
+
const eq = entry.indexOf("=", colon);
|
|
28
|
+
return [entry.slice(0, colon), {
|
|
29
|
+
pos,
|
|
30
|
+
key: decodeURIComponent(eq === -1 ? entry.slice(colon + 1) : entry.slice(colon + 1, eq)),
|
|
31
|
+
name: eq === -1 ? undefined : decodeURIComponent(entry.slice(eq + 1))
|
|
32
|
+
}];
|
|
33
|
+
}
|
|
34
|
+
function consumersOf(elements, occurrence) {
|
|
35
|
+
let consumers = elements.get(occurrence);
|
|
36
|
+
if (consumers === undefined) elements.set(occurrence, consumers = []);
|
|
37
|
+
return Array.isArray(consumers) ? consumers : null;
|
|
38
|
+
}
|
|
39
|
+
function text(start, elements) {
|
|
40
|
+
const parsed = slotEntry(start.data.slice(SLOT_TEXT.length), "text");
|
|
41
|
+
const consumers = parsed && consumersOf(elements, parsed[0]);
|
|
42
|
+
if (!consumers) return;
|
|
43
|
+
const element = start.parentNode;
|
|
44
|
+
let consumer;
|
|
45
|
+
for (let i = consumers.length; i-- && !consumer;) if (consumers[i].element === element) consumer = consumers[i];
|
|
46
|
+
consumer || consumers.push(consumer = {
|
|
47
|
+
element,
|
|
48
|
+
positions: []
|
|
49
|
+
});
|
|
50
|
+
parsed[1].start = start;
|
|
51
|
+
consumer.positions.push(parsed[1]);
|
|
52
|
+
}
|
|
53
|
+
function slotPositions(el) {
|
|
54
|
+
const attrs = el.attributes;
|
|
55
|
+
let out = null;
|
|
56
|
+
for (let i = 0; i < attrs.length; i++) {
|
|
57
|
+
const attr = attrs[i];
|
|
58
|
+
if (!attr.name.startsWith(SLOT_MARKER)) continue;
|
|
59
|
+
const pos = attr.name.slice(SLOT_MARKER.length);
|
|
60
|
+
for (const entry of attr.value.split(",")) {
|
|
61
|
+
const parsed = slotEntry(entry, pos);
|
|
62
|
+
if (!parsed) continue;
|
|
63
|
+
out || (out = Object.create(null));
|
|
64
|
+
(out[parsed[0]] || (out[parsed[0]] = [])).push(parsed[1]);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return out;
|
|
68
|
+
}
|
|
69
|
+
function positions(el, elements) {
|
|
70
|
+
const byOccurrence = slotPositions(el);
|
|
71
|
+
if (byOccurrence !== null) {
|
|
72
|
+
for (const occurrence in byOccurrence) {
|
|
73
|
+
const consumers = consumersOf(elements, occurrence);
|
|
74
|
+
if (consumers) consumers.push({
|
|
75
|
+
element: el,
|
|
76
|
+
positions: byOccurrence[occurrence]
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function consumersEqual(a, b) {
|
|
82
|
+
if (a.length !== b.length) return false;
|
|
83
|
+
for (let i = 0; i < a.length; i++) {
|
|
84
|
+
const x = a[i];
|
|
85
|
+
const y = b[i];
|
|
86
|
+
if (x.element !== y.element || x.positions.length !== y.positions.length) return false;
|
|
87
|
+
for (let j = 0; j < x.positions.length; j++) {
|
|
88
|
+
const p = x.positions[j];
|
|
89
|
+
const q = y.positions[j];
|
|
90
|
+
if (p.pos !== q.pos || p.key !== q.key || p.name !== q.name || p.start !== q.start) return false;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
const byFrame = new WeakMap();
|
|
96
|
+
function occurrencesOf(frame) {
|
|
97
|
+
let slots = byFrame.get(frame);
|
|
98
|
+
if (!slots) byFrame.set(frame, slots = new Map());
|
|
99
|
+
return slots;
|
|
100
|
+
}
|
|
101
|
+
function sync(frame, occurrence, consumers) {
|
|
102
|
+
const slots = occurrencesOf(frame);
|
|
103
|
+
const entry = slots.get(occurrence);
|
|
104
|
+
if (!entry) slots.set(occurrence, {
|
|
105
|
+
consumers,
|
|
106
|
+
rebind: undefined
|
|
107
|
+
});else if (!entry.consumers) entry.consumers = consumers;else if (!consumersEqual(entry.consumers, consumers)) {
|
|
108
|
+
entry.consumers = consumers;
|
|
109
|
+
entry.rebind && entry.rebind(consumers);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
function rebinder(frame, occurrence, fn) {
|
|
113
|
+
const slots = occurrencesOf(frame);
|
|
114
|
+
const entry = slots.get(occurrence);
|
|
115
|
+
if (entry) entry.rebind = fn;else slots.set(occurrence, {
|
|
116
|
+
consumers: undefined,
|
|
117
|
+
rebind: fn
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
function unmount(frame, occurrence) {
|
|
121
|
+
byFrame.get(frame)?.delete(occurrence);
|
|
122
|
+
}
|
|
123
|
+
function owned(el) {
|
|
124
|
+
const attrs = el.attributes;
|
|
125
|
+
let out = null;
|
|
126
|
+
for (let i = 0; i < attrs.length; i++) {
|
|
127
|
+
const name = attrs[i].name;
|
|
128
|
+
if (!name.startsWith(SLOT_MARKER)) continue;
|
|
129
|
+
const pos = name.slice(SLOT_MARKER.length);
|
|
130
|
+
if (pos === "ref" || pos.startsWith("on:")) continue;
|
|
131
|
+
out || (out = {
|
|
132
|
+
attrs: new Set(),
|
|
133
|
+
class: null,
|
|
134
|
+
style: null
|
|
135
|
+
});
|
|
136
|
+
if (pos !== "class" && pos !== "style") {
|
|
137
|
+
out.attrs.add(pos);
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
for (const entry of attrs[i].value.split(",")) {
|
|
141
|
+
const eq = entry.indexOf("=");
|
|
142
|
+
if (eq === -1) {
|
|
143
|
+
out.attrs.add(pos);
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
(out[pos] || (out[pos] = [])).push(decodeURIComponent(entry.slice(eq + 1)));
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return out;
|
|
150
|
+
}
|
|
151
|
+
function morphOwnedClass(oldEl, value, names) {
|
|
152
|
+
const list = oldEl.classList;
|
|
153
|
+
const set = new Set(value ? value.split(/\s+/) : []);
|
|
154
|
+
set.delete("");
|
|
155
|
+
for (const name of names) list.contains(name) ? set.add(name) : set.delete(name);
|
|
156
|
+
const next = [...set].join(" ");
|
|
157
|
+
if (next === (oldEl.getAttribute("class") || "")) return false;
|
|
158
|
+
next ? oldEl.setAttribute("class", next) : oldEl.removeAttribute("class");
|
|
159
|
+
return true;
|
|
160
|
+
}
|
|
161
|
+
function morphOwnedStyle(oldEl, value, names) {
|
|
162
|
+
const style = oldEl.style;
|
|
163
|
+
const saved = names.map(name => [name, style.getPropertyValue(name), style.getPropertyPriority(name)]);
|
|
164
|
+
const before = oldEl.getAttribute("style");
|
|
165
|
+
value ? oldEl.setAttribute("style", value) : oldEl.removeAttribute("style");
|
|
166
|
+
for (const [name, v, priority] of saved) {
|
|
167
|
+
v ? style.setProperty(name, v, priority) : style.removeProperty(name);
|
|
168
|
+
}
|
|
169
|
+
return oldEl.getAttribute("style") !== before;
|
|
170
|
+
}
|
|
171
|
+
function apply(oldEl, name, value, owned) {
|
|
172
|
+
if (owned.attrs.has(name)) return false;
|
|
173
|
+
if ((name === "class" || name === "style") && owned[name] !== null) {
|
|
174
|
+
return name === "class" ? morphOwnedClass(oldEl, value, owned.class) : morphOwnedStyle(oldEl, value, owned.style);
|
|
175
|
+
}
|
|
176
|
+
return undefined;
|
|
177
|
+
}
|
|
178
|
+
const handlerOwners = new WeakMap();
|
|
179
|
+
function bind(fill, args, ctx, label) {
|
|
180
|
+
const [consumers, setConsumers] = createSignal(ctx.positions);
|
|
181
|
+
ctx.onRebind(setConsumers);
|
|
182
|
+
const raw = untrack(() => fill(args), label);
|
|
183
|
+
const node = typeof Node === "function" && raw instanceof Node;
|
|
184
|
+
const pending = isAsyncValue$1(raw);
|
|
185
|
+
if ((raw == null || typeof raw !== "object" || Array.isArray(raw) || node || pending)) {
|
|
186
|
+
const shape = shapeOf(raw);
|
|
187
|
+
slotShapeFinding({
|
|
188
|
+
reason: "fill-shape",
|
|
189
|
+
occurrence: ctx.key,
|
|
190
|
+
shape
|
|
191
|
+
}, `[BINDING_SLOT_POSITION] The fill for \`${ctx.key}\` returned ${shape}; server markup reads ` + `its properties at bound positions, so it must return an object (\`{ done, onToggle, … }\`). ` + `Nothing binds.`);
|
|
192
|
+
}
|
|
193
|
+
const out = raw == null || typeof raw !== "object" || node || pending ? {} : raw;
|
|
194
|
+
const token = {};
|
|
195
|
+
const state = new WeakMap();
|
|
196
|
+
let bound = new Set();
|
|
197
|
+
createRenderEffect(() => consumers().map(valuesFor), writes => {
|
|
198
|
+
const next = new Set();
|
|
199
|
+
for (const {
|
|
200
|
+
element,
|
|
201
|
+
positions,
|
|
202
|
+
values,
|
|
203
|
+
texts
|
|
204
|
+
} of writes) {
|
|
205
|
+
next.add(element);
|
|
206
|
+
write(element, positions, values);
|
|
207
|
+
for (const [start, v, key] of texts) writeText(start, v, key);
|
|
208
|
+
}
|
|
209
|
+
for (const element of bound) if (!next.has(element)) release(element);
|
|
210
|
+
bound = next;
|
|
211
|
+
});
|
|
212
|
+
onCleanup(() => {
|
|
213
|
+
for (const element of bound) release(element);
|
|
214
|
+
});
|
|
215
|
+
function valuesFor({
|
|
216
|
+
element,
|
|
217
|
+
positions
|
|
218
|
+
}) {
|
|
219
|
+
const props = {};
|
|
220
|
+
const texts = [];
|
|
221
|
+
let classNames = null;
|
|
222
|
+
let styleProps = null;
|
|
223
|
+
for (const {
|
|
224
|
+
pos,
|
|
225
|
+
key,
|
|
226
|
+
name,
|
|
227
|
+
start
|
|
228
|
+
} of positions) {
|
|
229
|
+
if (pos === "ref" || pos.startsWith("on:")) continue;
|
|
230
|
+
if (pos === "text") texts.push([start, out[key], key]);else if (pos === "class" || pos === "style") {
|
|
231
|
+
if (name === undefined) props[pos] = out[key];else if (pos === "class") (classNames || (classNames = {}))[name] = !!out[key];else (styleProps || (styleProps = {}))[name] = out[key];
|
|
232
|
+
} else props[pos] = out[key];
|
|
233
|
+
}
|
|
234
|
+
if (classNames !== null && !("class" in props)) props.class = classNames;
|
|
235
|
+
if (styleProps !== null && !("style" in props)) props.style = styleProps;
|
|
236
|
+
return {
|
|
237
|
+
element,
|
|
238
|
+
positions,
|
|
239
|
+
values: props,
|
|
240
|
+
texts
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
function write(element, positions, props) {
|
|
244
|
+
let st = state.get(element);
|
|
245
|
+
if (!st) state.set(element, st = {
|
|
246
|
+
prev: {},
|
|
247
|
+
handlers: {},
|
|
248
|
+
ref: undefined,
|
|
249
|
+
refId: ""
|
|
250
|
+
});
|
|
251
|
+
const handlers = {};
|
|
252
|
+
const refKeys = [];
|
|
253
|
+
for (const {
|
|
254
|
+
pos,
|
|
255
|
+
key
|
|
256
|
+
} of positions) {
|
|
257
|
+
if (pos === "ref") refKeys.push(key);else if (pos.startsWith("on:")) handlers["on" + pos[3].toUpperCase() + pos.slice(4)] = key;
|
|
258
|
+
}
|
|
259
|
+
let owners = handlerOwners.get(element);
|
|
260
|
+
if (!owners) handlerOwners.set(element, owners = {});
|
|
261
|
+
let events = false;
|
|
262
|
+
for (const prop in handlers) {
|
|
263
|
+
events = true;
|
|
264
|
+
const key = handlers[prop];
|
|
265
|
+
let h = st.handlers[prop];
|
|
266
|
+
if (h === undefined || h.key !== key) st.handlers[prop] = h = {
|
|
267
|
+
key,
|
|
268
|
+
value: untrack(() => out[key])
|
|
269
|
+
};
|
|
270
|
+
props[prop] = h.value;
|
|
271
|
+
owners[prop] = token;
|
|
272
|
+
}
|
|
273
|
+
const clearing = {};
|
|
274
|
+
for (const prop in st.handlers) {
|
|
275
|
+
if (prop in handlers) continue;
|
|
276
|
+
delete st.handlers[prop];
|
|
277
|
+
if (owners[prop] === token) {
|
|
278
|
+
delete owners[prop];
|
|
279
|
+
clearing[prop] = true;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
if (refKeys.length) {
|
|
283
|
+
const id = refKeys.join(",");
|
|
284
|
+
if (st.refId !== id) {
|
|
285
|
+
const refs = refKeys.map(k => untrack(() => out[k]));
|
|
286
|
+
st.refId = id;
|
|
287
|
+
st.ref = el => {
|
|
288
|
+
for (const r of refs) typeof r === "function" && r(el);
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
props.ref = st.ref;
|
|
292
|
+
}
|
|
293
|
+
for (const k in st.prev) {
|
|
294
|
+
if (k in props || k === "ref" || k in clearing) continue;
|
|
295
|
+
delete st.prev[k];
|
|
296
|
+
}
|
|
297
|
+
assign(element, props, true, st.prev);
|
|
298
|
+
if (events && sharedConfig.completed && !sharedConfig.completed.has(element)) {
|
|
299
|
+
sharedConfig.completed.add(element);
|
|
300
|
+
runHydrationEvents();
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
function release(element) {
|
|
304
|
+
if (!state.has(element)) return;
|
|
305
|
+
write(element, [], {});
|
|
306
|
+
state.delete(element);
|
|
307
|
+
}
|
|
308
|
+
function writeText(start, v, key) {
|
|
309
|
+
let s = "";
|
|
310
|
+
if (typeof v === "string" || typeof v === "number") s = "" + v;else if (v != null && typeof v !== "boolean") {
|
|
311
|
+
const shape = shapeOf(v);
|
|
312
|
+
slotShapeFinding({
|
|
313
|
+
reason: "text-shape",
|
|
314
|
+
occurrence: ctx.key,
|
|
315
|
+
key,
|
|
316
|
+
shape
|
|
317
|
+
}, `[BINDING_SLOT_POSITION] \`${key}\` of \`${ctx.key}\` is placed as text, but the fill ` + `returned ${shape} for it. A text position renders a string or number; markup belongs ` + `in a template slot. The text is cleared.`);
|
|
318
|
+
}
|
|
319
|
+
const n = start.nextSibling;
|
|
320
|
+
if (n && n.nodeType === 3) {
|
|
321
|
+
if (n.data !== s) n.data = s;
|
|
322
|
+
} else if (s) start.after(s);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
export { apply, bind, owned, positions, rebinder, sync, text, unmount };
|