@solidjs/web 2.0.0-rc.14 → 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 +128 -123
- package/dist/server.js +127 -113
- package/dist/server.observe.js +127 -122
- package/dist/web.dev.js +150 -167
- package/dist/web.js +150 -160
- package/dist/web.observe.js +150 -160
- package/frames/dist/client.dev.js +91 -59
- package/frames/dist/client.js +89 -52
- package/frames/dist/client.observe.js +89 -52
- package/frames/dist/server.dev.js +67 -30
- package/frames/dist/server.js +68 -31
- package/frames/dist/server.observe.js +68 -31
- package/frames/dist/trace.js +4 -1
- package/package.json +4 -4
- package/serialization/dist/decode.js +2 -2
- package/serialization/dist/serialization.js +2 -2
- package/server-functions/dist/client.dev.js +2 -1
- package/server-functions/dist/client.js +2 -1
- package/server-functions/dist/client.observe.js +2 -1
- package/server-functions/dist/server.dev.js +91 -17
- package/server-functions/dist/server.js +91 -17
- package/server-functions/dist/server.observe.js +91 -17
- package/types/client.d.ts +100 -8
- package/types/constants.d.ts +2 -1
- package/types/frames/server.d.ts +1 -1
- package/types/head.d.ts +1 -0
- package/types/index.d.ts +56 -49
- package/types/index.server.d.ts +3 -27
- package/types/jsx.d.ts +3 -12
- package/types/response.d.ts +26 -4
- package/types/server-functions/client.d.ts +4 -0
- package/types/server-mock.d.ts +9 -2
- package/types/server.d.ts +85 -9
package/dist/server.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { createRenderEffect, createMemo, getOwner, createRoot, $PROXY, onCleanup, runWithOwner, createComponent, omit, getNextChildId
|
|
2
|
-
export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, Show, Switch, createComponent, getOwner, merge as mergeProps, untrack } from 'solid-js';
|
|
3
|
-
import { sharedConfig, ssrSanitizeError, reportServerError, viewOf, sourceOwners, ssrHandleError, inServerComponentScope, creationStamp, getProjectionTrace, shareAsyncIterable } from 'solid-js/internal';
|
|
1
|
+
import { createRenderEffect, createMemo, getOwner, createRoot, $PROXY, onCleanup, runWithOwner, createComponent, omit, getNextChildId } 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, ssrSanitizeError, reportServerError, viewOf, sourceOwners, ssrHandleError, inServerComponentScope, creationStamp, dynamicCore, getProjectionTrace, shareAsyncIterable } from 'solid-js/internal';
|
|
4
4
|
export { ssrScope as scope, sharedConfig } from 'solid-js/internal';
|
|
5
5
|
import { createStream, Serializer, getCrossReferenceHeader, Feature } from 'seroval';
|
|
6
6
|
import { AbortSignalPlugin, CustomEventPlugin, DOMExceptionPlugin, EventPlugin, FormDataPlugin, HeadersPlugin, ReadableStreamPlugin, RequestPlugin, ResponsePlugin, URLSearchParamsPlugin, URLPlugin } from 'seroval-plugins/web';
|
|
@@ -34,6 +34,7 @@ const DOMWithState = {
|
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
36
|
const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
|
|
37
|
+
const LinkAttributes = /*#__PURE__*/new Set(["href", "target", "rel", "download", "link", "aria-current"]);
|
|
37
38
|
const DelegatedEvents = /*#__PURE__*/new Set(["beforeinput", "click", "dblclick", "contextmenu", "focusin", "focusout", "input", "keydown", "keyup", "mousedown", "mousemove", "mouseout", "mouseover", "mouseup", "pointerdown", "pointermove", "pointerout", "pointerover", "pointerup", "touchend", "touchmove", "touchstart"]);
|
|
38
39
|
const SVGElements = /*#__PURE__*/new Set([
|
|
39
40
|
"altGlyph", "altGlyphDef", "altGlyphItem", "animate", "animateColor", "animateMotion", "animateTransform", "circle", "clipPath", "color-profile", "cursor", "defs", "desc", "ellipse", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence", "filter", "font", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignObject", "g", "glyph", "glyphRef", "hkern", "image", "line", "linearGradient", "marker", "mask", "metadata", "missing-glyph", "mpath", "path", "pattern", "polygon", "polyline", "radialGradient", "rect",
|
|
@@ -373,9 +374,7 @@ function toBorderForm(value, envelopeContainers) {
|
|
|
373
374
|
}
|
|
374
375
|
function isShareableIterable(value) {
|
|
375
376
|
try {
|
|
376
|
-
|
|
377
|
-
if (typeof ReadableStream !== "undefined" && value instanceof ReadableStream) return false;
|
|
378
|
-
return typeof value[Symbol.asyncIterator] === "function";
|
|
377
|
+
return typeof value[Symbol.asyncIterator] === "function" && !(typeof ReadableStream !== "undefined" && value instanceof ReadableStream);
|
|
379
378
|
} catch {
|
|
380
379
|
return false;
|
|
381
380
|
}
|
|
@@ -480,17 +479,24 @@ function getLocalHeaderScript(id) {
|
|
|
480
479
|
}
|
|
481
480
|
|
|
482
481
|
const ENVELOPE = Symbol.for("solid.ResponseEnvelope");
|
|
483
|
-
|
|
484
|
-
const ResponseEnvelope =
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
482
|
+
let EnvelopeClass;
|
|
483
|
+
const ResponseEnvelope = function ResponseEnvelope(response, value) {
|
|
484
|
+
if (!EnvelopeClass) {
|
|
485
|
+
EnvelopeClass = class extends Response {
|
|
486
|
+
constructor(response, value) {
|
|
487
|
+
super(response ? response.body : null, response && {
|
|
488
|
+
status: response.status,
|
|
489
|
+
statusText: response.statusText,
|
|
490
|
+
headers: copyHeaders(response.headers)
|
|
491
|
+
});
|
|
492
|
+
this.response = response ? this : undefined;
|
|
493
|
+
this.value = value;
|
|
494
|
+
}
|
|
495
|
+
};
|
|
496
|
+
EnvelopeClass.prototype[ENVELOPE] = true;
|
|
490
497
|
}
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
})();
|
|
498
|
+
return new EnvelopeClass(response, value);
|
|
499
|
+
};
|
|
494
500
|
function isResponseEnvelope(value) {
|
|
495
501
|
return !!(value && typeof value === "object" && value[ENVELOPE]);
|
|
496
502
|
}
|
|
@@ -515,6 +521,16 @@ function isSafeError(value) {
|
|
|
515
521
|
const REVALIDATE_HEADER = "X-Revalidate";
|
|
516
522
|
const REVALIDATE_ALL = "*";
|
|
517
523
|
const RESPONSE_HEADER_VALUE_LIMIT = 4096;
|
|
524
|
+
function copyHeaders(init) {
|
|
525
|
+
const source = init;
|
|
526
|
+
if (!source || !source.getSetCookie) return new Headers(init);
|
|
527
|
+
const headers = new Headers();
|
|
528
|
+
source.forEach((value, key) => {
|
|
529
|
+
if (key !== "set-cookie") headers.append(key, value);
|
|
530
|
+
});
|
|
531
|
+
for (const cookie of source.getSetCookie()) headers.append("Set-Cookie", cookie);
|
|
532
|
+
return headers;
|
|
533
|
+
}
|
|
518
534
|
function initWithRevalidate(init = {}) {
|
|
519
535
|
const resolved = typeof init === "number" ? {
|
|
520
536
|
status: init
|
|
@@ -523,18 +539,7 @@ function initWithRevalidate(init = {}) {
|
|
|
523
539
|
revalidate,
|
|
524
540
|
...responseInit
|
|
525
541
|
} = resolved;
|
|
526
|
-
|
|
527
|
-
if (responseInit.headers && responseInit.headers.getSetCookie) {
|
|
528
|
-
headers = new Headers();
|
|
529
|
-
responseInit.headers.forEach((value, key) => {
|
|
530
|
-
if (key !== "set-cookie") headers.append(key, value);
|
|
531
|
-
});
|
|
532
|
-
for (const cookie of responseInit.headers.getSetCookie()) {
|
|
533
|
-
headers.append("Set-Cookie", cookie);
|
|
534
|
-
}
|
|
535
|
-
} else {
|
|
536
|
-
headers = new Headers(responseInit.headers);
|
|
537
|
-
}
|
|
542
|
+
const headers = copyHeaders(responseInit.headers);
|
|
538
543
|
if (revalidate !== undefined) {
|
|
539
544
|
const list = Array.isArray(revalidate) ? revalidate : [revalidate];
|
|
540
545
|
if (list.length > 1 && list.includes(REVALIDATE_ALL)) {
|
|
@@ -711,6 +716,10 @@ function qualifierValue(name, value) {
|
|
|
711
716
|
function asciiLowerCase(value) {
|
|
712
717
|
return value.replace(/[A-Z]/g, c => String.fromCharCode(c.charCodeAt(0) + 32));
|
|
713
718
|
}
|
|
719
|
+
const JSON_SCRIPT_TYPE = /^(?:importmap|speculationrules)$|^[\t\n\r ]*(?:application\/json|text\/json|[\w!#$%&'*+.^`|~-]+\/[\w!#$%&'*+.^`|~-]*\+json)[\t\n\r ]*(?:;|$)/i;
|
|
720
|
+
function headBodyText(tag, props, text) {
|
|
721
|
+
return tag === "script" && JSON_SCRIPT_TYPE.test(String(props.type)) ? text.replace(/</g, "\\u003C") : text;
|
|
722
|
+
}
|
|
714
723
|
function resourceIdentity(tag, props) {
|
|
715
724
|
const url = String(props.href || props.src || "");
|
|
716
725
|
let id = "res:" + tag + ":" + (props.rel || "") + ":" + url.length + ":" + url;
|
|
@@ -1295,6 +1304,7 @@ function renderShellHead(registry, nonce, isPendingFragment, noScripts, traceMet
|
|
|
1295
1304
|
noScripts
|
|
1296
1305
|
};
|
|
1297
1306
|
}
|
|
1307
|
+
let headBodyHook;
|
|
1298
1308
|
function flushHeadFragment(registry, boundary, nonce) {
|
|
1299
1309
|
const groups = commitHeadBoundary(registry, boundary);
|
|
1300
1310
|
if (!groups.length) return null;
|
|
@@ -1332,7 +1342,7 @@ function flushHeadFragment(registry, boundary, nonce) {
|
|
|
1332
1342
|
if (value) attrs.nonce = String(value);
|
|
1333
1343
|
}
|
|
1334
1344
|
const children = t.props.children;
|
|
1335
|
-
ops.push(["a", identity, t.tag, attrs, children == null ? null : String(children)]);
|
|
1345
|
+
ops.push(["a", identity, t.tag, attrs, children == null ? null : headBodyHook ? headBodyHook(t.tag, t.props, String(children)) : String(children)]);
|
|
1336
1346
|
}
|
|
1337
1347
|
}
|
|
1338
1348
|
return ops.length ? ops : null;
|
|
@@ -1360,8 +1370,7 @@ function normalizeNonce(nonce) {
|
|
|
1360
1370
|
}
|
|
1361
1371
|
function destinationNonce(nonce, destination) {
|
|
1362
1372
|
if (nonce == null) return undefined;
|
|
1363
|
-
|
|
1364
|
-
const value = nonce[destination];
|
|
1373
|
+
const value = typeof nonce === "string" ? nonce : nonce[destination];
|
|
1365
1374
|
return typeof value === "string" && value ? value : undefined;
|
|
1366
1375
|
}
|
|
1367
1376
|
function scriptNonce(nonce) {
|
|
@@ -1435,6 +1444,7 @@ function renderHeadTagMarkup(tag, props, identity, nonce) {
|
|
|
1435
1444
|
if (nonce && !hasNonceProp(props)) attrs += nonceAttr(nonce, nonceDestination(tag, props));
|
|
1436
1445
|
if (tag === "meta" || tag === "link" || tag === "base") return `<${tag}${attrs}>`;
|
|
1437
1446
|
let body = props.children == null ? "" : String(props.children);
|
|
1447
|
+
if (headBodyHook) body = headBodyHook(tag, props, body);
|
|
1438
1448
|
if (tag === "script") body = body.replace(/<\/(script)/gi, "<\\/$1");else if (tag === "style") body = escapeStyleContent(body);else body = escape(body);
|
|
1439
1449
|
return `<${tag}${attrs}>${body}</${tag}>`;
|
|
1440
1450
|
}
|
|
@@ -1443,6 +1453,7 @@ function useHead(tags) {
|
|
|
1443
1453
|
if (!ctx || !ctx.registerHeadTags) {
|
|
1444
1454
|
return;
|
|
1445
1455
|
}
|
|
1456
|
+
headBodyHook = headBodyText;
|
|
1446
1457
|
ctx.registerHeadTags(tags);
|
|
1447
1458
|
}
|
|
1448
1459
|
const VOID_ELEMENTS = /^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i;
|
|
@@ -1453,12 +1464,27 @@ function tagInfo(tag) {
|
|
|
1453
1464
|
let info = tagInfos.get(tag);
|
|
1454
1465
|
if (info === undefined) {
|
|
1455
1466
|
if (!TAG_START.test(tag) || NOT_NAME.test(tag)) throw new Error(`"${tag}" is not a valid tag name`);
|
|
1467
|
+
let formDefaults, formAttributes;
|
|
1468
|
+
if (tag === "input" || tag === "option") {
|
|
1469
|
+
formDefaults = Object.create(null);
|
|
1470
|
+
formAttributes = Object.create(null);
|
|
1471
|
+
const state = DOMWithState[tag.toUpperCase()];
|
|
1472
|
+
for (const prop in state) {
|
|
1473
|
+
if (state[prop] === 2) {
|
|
1474
|
+
const attr = prop.slice(7).toLowerCase();
|
|
1475
|
+
formDefaults[attr] = prop;
|
|
1476
|
+
formAttributes[prop] = attr;
|
|
1477
|
+
}
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1456
1480
|
info = {
|
|
1457
1481
|
open: "<" + tag,
|
|
1458
1482
|
close: "</" + tag + ">",
|
|
1459
1483
|
isVoid: VOID_ELEMENTS.test(tag),
|
|
1460
1484
|
textarea: tag === "textarea",
|
|
1461
|
-
raw: tag === "script" || tag === "style"
|
|
1485
|
+
raw: tag === "script" || tag === "style",
|
|
1486
|
+
formDefaults,
|
|
1487
|
+
formAttributes
|
|
1462
1488
|
};
|
|
1463
1489
|
if (tagInfos.size < 512) tagInfos.set(tag, info);
|
|
1464
1490
|
}
|
|
@@ -1557,7 +1583,7 @@ function renderToString(code, options = {}) {
|
|
|
1557
1583
|
closed = true;
|
|
1558
1584
|
serializer.close();
|
|
1559
1585
|
const head = renderShellHead(headRegistry, nonce, null, noScripts, traceMetaMarkup(context.trace));
|
|
1560
|
-
const document = assembleDocument(resolveSSRSelectValues(html), tracking.emittedAssets, tracking.preloadLinks, tracking.inlineStyles, scripts.length ? scripts : "", nonce, head, onHead);
|
|
1586
|
+
const document = assembleDocument(resolveSSRSelectValues(html), tracking.emittedAssets, tracking.preloadLinks, tracking.inlineStyles, scripts.length ? scripts : "", nonce, head, onHead) + shellEndMarker(context, renderId, nonce, noScripts);
|
|
1561
1587
|
if (render) render.shell();
|
|
1562
1588
|
if (requestEvent && requestEvent.response) {
|
|
1563
1589
|
commitResponseStub(requestEvent.response, {
|
|
@@ -1798,7 +1824,7 @@ function renderToStream(code, options = {}) {
|
|
|
1798
1824
|
}
|
|
1799
1825
|
},
|
|
1800
1826
|
shell(shellHtml, meta) {
|
|
1801
|
-
buffer.write(assembleDocument(shellHtml, meta.preloads, meta.preloadLinks, meta.inlineStyles, meta.tasks.length ? meta.tasks : "", nonce, meta.head, onHead));
|
|
1827
|
+
buffer.write(assembleDocument(shellHtml, meta.preloads, meta.preloadLinks, meta.inlineStyles, meta.tasks.length ? meta.tasks : "", nonce, meta.head, onHead) + shellEndMarker(context, renderId, nonce, noScripts));
|
|
1802
1828
|
},
|
|
1803
1829
|
...options.sink
|
|
1804
1830
|
};
|
|
@@ -2434,11 +2460,15 @@ function renderToStream(code, options = {}) {
|
|
|
2434
2460
|
};
|
|
2435
2461
|
}
|
|
2436
2462
|
function HydrationScript(props) {
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2463
|
+
if (sharedConfig.context) sharedConfig.context.bootstrap = true;
|
|
2464
|
+
const {
|
|
2465
|
+
eventNames,
|
|
2466
|
+
nonce
|
|
2467
|
+
} = {
|
|
2468
|
+
nonce: sharedConfig.context && sharedConfig.context.nonce,
|
|
2440
2469
|
...props
|
|
2441
|
-
}
|
|
2470
|
+
};
|
|
2471
|
+
return ssr(hydrationBootstrap(eventNames, scriptNonce(nonce), true));
|
|
2442
2472
|
}
|
|
2443
2473
|
function ssrGroup(fn, n) {
|
|
2444
2474
|
fn.$g = n;
|
|
@@ -2594,7 +2624,7 @@ function createLiveHoles(sink, scoped) {
|
|
|
2594
2624
|
let nextId = 0;
|
|
2595
2625
|
const stamp = typeof creationStamp === "function" ? creationStamp : () => 0;
|
|
2596
2626
|
const inScope = scoped && typeof inServerComponentScope === "function" ? inServerComponentScope : null;
|
|
2597
|
-
const stripMarkers = html => html.replace(/<!--lh:\/?\d
|
|
2627
|
+
const stripMarkers = html => html.replace(/<!--lh:\/?\d+-->| data-lha="\d+"/g, "");
|
|
2598
2628
|
const swept = (owner, ctx, fn) => {
|
|
2599
2629
|
const prev = sharedConfig.context;
|
|
2600
2630
|
sharedConfig.context = ctx;
|
|
@@ -3148,6 +3178,7 @@ function ssrElement(tag, props, children, needsId, skip, attrs, claims) {
|
|
|
3148
3178
|
let ownerIndex = null;
|
|
3149
3179
|
const ctx = renderConfig.context;
|
|
3150
3180
|
const slots = ctx !== undefined && ctx.claims !== undefined;
|
|
3181
|
+
const link = tag === "a" && ctx !== undefined && ctx.linkClaim !== undefined ? {} : null;
|
|
3151
3182
|
if (Array.isArray(props)) {
|
|
3152
3183
|
if (slots && props.$slot === true) props = slotSpreadSource();else {
|
|
3153
3184
|
let i = 0;
|
|
@@ -3188,7 +3219,7 @@ function ssrElement(tag, props, children, needsId, skip, attrs, claims) {
|
|
|
3188
3219
|
const keys = owners !== null ? viewKeys : keysOf !== null ? keysOf[s] : proxy ? Reflect.ownKeys(props) : Object.keys(props);
|
|
3189
3220
|
if (sources !== null) props = sources[s];
|
|
3190
3221
|
nextKey: for (let i = 0; i < keys.length; i++) {
|
|
3191
|
-
|
|
3222
|
+
let prop = keys[i];
|
|
3192
3223
|
if (typeof prop !== "string" || skip !== undefined && skip(prop)) continue;
|
|
3193
3224
|
if (owners !== null) props = owners[i];
|
|
3194
3225
|
for (let j = s + 1; j <= last; j++) {
|
|
@@ -3205,7 +3236,12 @@ function ssrElement(tag, props, children, needsId, skip, attrs, claims) {
|
|
|
3205
3236
|
}
|
|
3206
3237
|
continue;
|
|
3207
3238
|
}
|
|
3208
|
-
const
|
|
3239
|
+
const key = prop;
|
|
3240
|
+
if (info.formAttributes !== undefined) {
|
|
3241
|
+
prop = spreadFormAttribute(prop, info, keys, keysOf, skip);
|
|
3242
|
+
if (prop === undefined) continue;
|
|
3243
|
+
}
|
|
3244
|
+
const value = props[key];
|
|
3209
3245
|
if (value == undefined) {
|
|
3210
3246
|
if (slots && claims !== undefined && (prop === "ref" || isEventName(prop))) behaviors = spreadBehaviorPosition(behaviors, prop, value, ctx.claims, ownerIndex !== null ? ownerIndex[i] : s, true);
|
|
3211
3247
|
continue;
|
|
@@ -3217,6 +3253,7 @@ function ssrElement(tag, props, children, needsId, skip, attrs, claims) {
|
|
|
3217
3253
|
if (slots) behaviors = spreadBehaviorPosition(behaviors, prop, value, ctx.claims, ownerIndex !== null ? ownerIndex[i] : s, claims !== undefined);
|
|
3218
3254
|
continue;
|
|
3219
3255
|
}
|
|
3256
|
+
if (link !== null && LinkAttributes.has(prop)) link[prop] = value;
|
|
3220
3257
|
if (slots && typeof value === "object") {
|
|
3221
3258
|
result += spreadObjectAttribute(prop, value);
|
|
3222
3259
|
} else if (prop === "style") {
|
|
@@ -3232,6 +3269,7 @@ function ssrElement(tag, props, children, needsId, skip, attrs, claims) {
|
|
|
3232
3269
|
}
|
|
3233
3270
|
if (slots && (behaviors !== null || claims !== undefined)) result += spreadBehaviorMarkers(behaviors, claims, ctx.claims);
|
|
3234
3271
|
if (attrs !== undefined) result += typeof attrs === "function" ? attrs() : attrs;
|
|
3272
|
+
if (link !== null && link.href !== undefined) result += ssrLinkClaim(link);
|
|
3235
3273
|
if (skipChildren) return {
|
|
3236
3274
|
t: result + " />"
|
|
3237
3275
|
};
|
|
@@ -3249,6 +3287,19 @@ function ssrElement(tag, props, children, needsId, skip, attrs, claims) {
|
|
|
3249
3287
|
};
|
|
3250
3288
|
return ssr([result + ">", info.close], resolveSSRNode(children, undefined, true));
|
|
3251
3289
|
}
|
|
3290
|
+
function spreadFormAttribute(prop, info, keys, keysOf, skip) {
|
|
3291
|
+
const defaultProp = info.formDefaults[prop];
|
|
3292
|
+
if (defaultProp !== undefined && (skip === undefined || !skip(defaultProp))) {
|
|
3293
|
+
if (keysOf !== null) {
|
|
3294
|
+
for (let j = 0; j < keysOf.length; j++) {
|
|
3295
|
+
if (keysOf[j].includes(defaultProp)) return;
|
|
3296
|
+
}
|
|
3297
|
+
} else if (keys.includes(defaultProp)) return;
|
|
3298
|
+
}
|
|
3299
|
+
const attr = info.formAttributes[prop];
|
|
3300
|
+
if (attr !== undefined && skip !== undefined && skip(attr)) return;
|
|
3301
|
+
return attr === undefined ? prop : attr;
|
|
3302
|
+
}
|
|
3252
3303
|
function ssrElementAttribute(key, value) {
|
|
3253
3304
|
if (value == undefined) return "";
|
|
3254
3305
|
if (key === "style" || key === "class") {
|
|
@@ -3497,6 +3548,11 @@ function claimEntries(pos, value, mode) {
|
|
|
3497
3548
|
}
|
|
3498
3549
|
return "";
|
|
3499
3550
|
}
|
|
3551
|
+
function ssrLinkClaim(attrs) {
|
|
3552
|
+
const ctx = renderConfig.context;
|
|
3553
|
+
if (ctx === undefined || ctx.linkClaim === undefined || attrs["aria-current"] != null) return "";
|
|
3554
|
+
return ctx.linkClaim(attrs);
|
|
3555
|
+
}
|
|
3500
3556
|
function decodeSSREntities(s) {
|
|
3501
3557
|
return s.indexOf("&") < 0 ? s : s.replace(/"/g, '"').replace(/</g, "<").replace(/&/g, "&");
|
|
3502
3558
|
}
|
|
@@ -3722,10 +3778,13 @@ function applyRef(r, element) {
|
|
|
3722
3778
|
Array.isArray(r) ? r.flat(Infinity).forEach(f => f && f(element)) : r(element);
|
|
3723
3779
|
}
|
|
3724
3780
|
function generateHydrationScript({
|
|
3725
|
-
eventNames
|
|
3781
|
+
eventNames,
|
|
3726
3782
|
nonce
|
|
3727
3783
|
} = {}) {
|
|
3728
|
-
return
|
|
3784
|
+
return hydrationBootstrap(eventNames, scriptNonce(nonce), false);
|
|
3785
|
+
}
|
|
3786
|
+
function hydrationBootstrap(eventNames = ["click", "input"], nonce, ledger) {
|
|
3787
|
+
return `<script${nonce ? ` nonce="${escape(String(nonce), true)}"` : ""}>window._$HY||(e=>{let t=e=>e&&e.hasAttribute&&(e.hasAttribute("_hk")?e:t(e.host&&e.host.nodeType?e.host:e.parentNode));["${eventNames.join('","')}"].forEach((o=>document.addEventListener(o,(o=>{if(!e.events)return;let s=t(o.composedPath&&o.composedPath()[0]||o.target);s&&!e.completed.has(s)&&e.events.push([s,o])}))))})(_$HY={events:[],completed:new WeakSet,r:new Proxy({},{set:(r,k,v)=>(v instanceof Promise&&v.catch(()=>{}),r[k]=v,!0)}),${ledger ? "s:{}," : ""}fe(){}});</script><!--xs-->`;
|
|
3729
3788
|
}
|
|
3730
3789
|
function queue(fn) {
|
|
3731
3790
|
return Promise.resolve().then(fn);
|
|
@@ -3738,6 +3797,11 @@ function allSettled(promises) {
|
|
|
3738
3797
|
return size;
|
|
3739
3798
|
});
|
|
3740
3799
|
}
|
|
3800
|
+
function shellEndMarker(context, renderId, nonce, noScripts) {
|
|
3801
|
+
if (noScripts || !context || !context.bootstrap) return "";
|
|
3802
|
+
const id = JSON.stringify(renderId).replace(/</g, "\\u003C");
|
|
3803
|
+
return `<script${nonceAttr(nonce, "script")}>_$HY.s[${id}]=1,_$HY.sw&&_$HY.sw(${id})</script>`;
|
|
3804
|
+
}
|
|
3741
3805
|
function assembleDocument(html, emittedAssets, preloadLinks, inlineStyles, scripts, nonce, headTags, onHead) {
|
|
3742
3806
|
const scriptTag = scripts ? `<script${nonceAttr(nonce, "script")}>${scripts}</script>` : "";
|
|
3743
3807
|
const title = headTags ? headTags.title : null;
|
|
@@ -4090,13 +4154,30 @@ function createHydrationWriter(context, isOpen) {
|
|
|
4090
4154
|
};
|
|
4091
4155
|
}
|
|
4092
4156
|
function getHydrationWriter() {
|
|
4157
|
+
const ctx = currentRenderContext();
|
|
4158
|
+
return ctx && ctx.writer;
|
|
4159
|
+
}
|
|
4160
|
+
function currentRenderContext() {
|
|
4093
4161
|
let ctx = renderContextOf(getOwner());
|
|
4094
4162
|
if (!ctx) {
|
|
4095
4163
|
const event = peekRequestEvent();
|
|
4096
4164
|
const renders = event && eventRenders.get(event);
|
|
4097
4165
|
if (renders && renders.size === 1) for (const c of renders) ctx = c;
|
|
4098
4166
|
}
|
|
4099
|
-
return ctx
|
|
4167
|
+
return ctx;
|
|
4168
|
+
}
|
|
4169
|
+
const LINK_STATE_RECORD = "links";
|
|
4170
|
+
function setLinkClaim(handler) {
|
|
4171
|
+
const ctx = currentRenderContext();
|
|
4172
|
+
if (!ctx) {
|
|
4173
|
+
return false;
|
|
4174
|
+
}
|
|
4175
|
+
ctx.linkClaim = handler;
|
|
4176
|
+
if (handler !== undefined) ctx.writer.write(LINK_STATE_RECORD, 1);
|
|
4177
|
+
return true;
|
|
4178
|
+
}
|
|
4179
|
+
function hasServerLinkState() {
|
|
4180
|
+
return false;
|
|
4100
4181
|
}
|
|
4101
4182
|
function takeHydrationValue(_key) {
|
|
4102
4183
|
return undefined;
|
|
@@ -4395,77 +4476,10 @@ setContainerTraceResolver(getProjectionTrace);
|
|
|
4395
4476
|
setAsyncIterableSharer(shareAsyncIterable);
|
|
4396
4477
|
const isServer = true;
|
|
4397
4478
|
const isDev = false;
|
|
4479
|
+
const ssrTag = (tag, props) => ssrElement(tag, props, undefined, true);
|
|
4398
4480
|
function dynamic(source, options) {
|
|
4399
4481
|
return dynamicCore(source, options, ssrTag);
|
|
4400
4482
|
}
|
|
4401
|
-
function dynamicComponent(source, options) {
|
|
4402
|
-
return dynamicCore(source, options);
|
|
4403
|
-
}
|
|
4404
|
-
const ssrTag = (tag, props) => ssrElement(tag, props, undefined, true);
|
|
4405
|
-
function dynamicCore(source, options, tagArm) {
|
|
4406
|
-
if (options?.static) {
|
|
4407
|
-
const component = untrack(source);
|
|
4408
|
-
if (typeof component === "function") return props => component(props);
|
|
4409
|
-
if (typeof component === "string" && tagArm) return props => tagArm(component, props);
|
|
4410
|
-
return () => undefined;
|
|
4411
|
-
}
|
|
4412
|
-
const cached = createMemo(() => {
|
|
4413
|
-
const next = source();
|
|
4414
|
-
if (!next || typeof next.then !== "function") return next;
|
|
4415
|
-
return {
|
|
4416
|
-
[FLIGHT]: next
|
|
4417
|
-
};
|
|
4418
|
-
});
|
|
4419
|
-
const deferStream = !!options?.deferStream;
|
|
4420
|
-
return props => {
|
|
4421
|
-
const ctx = sharedConfig.context;
|
|
4422
|
-
let gated = !deferStream || !ctx?.async;
|
|
4423
|
-
const value = createMemo(() => {
|
|
4424
|
-
let c;
|
|
4425
|
-
try {
|
|
4426
|
-
c = cached();
|
|
4427
|
-
} catch (err) {
|
|
4428
|
-
if (!gated && err instanceof NotReadyError && !err.source?.$clientHole) {
|
|
4429
|
-
gated = true;
|
|
4430
|
-
ctx.block(Promise.resolve(err.source).then(() => {}, () => {}));
|
|
4431
|
-
}
|
|
4432
|
-
throw err;
|
|
4433
|
-
}
|
|
4434
|
-
if (!c || !c[FLIGHT]) return c;
|
|
4435
|
-
const next = c[FLIGHT];
|
|
4436
|
-
return {
|
|
4437
|
-
then: (onFulfilled, onRejected) => next.then(resolved => {
|
|
4438
|
-
let landed;
|
|
4439
|
-
try {
|
|
4440
|
-
landed = classifyLanding(resolved);
|
|
4441
|
-
} catch (err) {
|
|
4442
|
-
if (onRejected) return onRejected(err);
|
|
4443
|
-
throw err;
|
|
4444
|
-
}
|
|
4445
|
-
return onFulfilled ? onFulfilled(landed) : landed;
|
|
4446
|
-
}, onRejected)
|
|
4447
|
-
};
|
|
4448
|
-
}, {
|
|
4449
|
-
deferStream
|
|
4450
|
-
});
|
|
4451
|
-
return createMemo(() => {
|
|
4452
|
-
const c = value();
|
|
4453
|
-
if (c) {
|
|
4454
|
-
if (typeof c === "function") return c(props);
|
|
4455
|
-
if (typeof c === "string" && tagArm) return tagArm(c, props);
|
|
4456
|
-
}
|
|
4457
|
-
}, {
|
|
4458
|
-
sync: true
|
|
4459
|
-
});
|
|
4460
|
-
};
|
|
4461
|
-
}
|
|
4462
|
-
const FLIGHT = Symbol("solid.dynamic-flight");
|
|
4463
|
-
const SERVER_COMPONENT = Symbol.for("solid.server-component");
|
|
4464
|
-
function classifyLanding(resolved) {
|
|
4465
|
-
if (typeof resolved !== "function" || SERVER_COMPONENT in resolved) return resolved;
|
|
4466
|
-
const message = "[DYNAMIC_ASYNC_COMPONENT] An async dynamic() source resolved to a client component function";
|
|
4467
|
-
throw new Error(message);
|
|
4468
|
-
}
|
|
4469
4483
|
function Dynamic(props) {
|
|
4470
4484
|
const Comp = dynamic(() => props.component);
|
|
4471
4485
|
return createComponent(Comp, omit(props, "component"));
|
|
@@ -4594,4 +4608,4 @@ function httpHeader(name, value, options) {
|
|
|
4594
4608
|
}
|
|
4595
4609
|
}
|
|
4596
4610
|
|
|
4597
|
-
export { CLAIMS_DOCUMENT, CLAIMS_STREAM, 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, SLOT_FACE_DATA, SLOT_FACE_MARKUP, SLOT_FACE_STREAM, SLOT_MARKER, SLOT_VALUE, SVGElements, VoidElements, notSup as acquireAsset, notSup as addEvent, applyRef, notSup as assign, claimElement, claimElementTree, notSup as className, clearFlashCookie, clientOnly, commitEventResponse, commitResponseStub, composeMiddleware, configureServerErrors, createLiveHoles, createRequestEvent, createResponseStub, createSSRResponse, notSup as delegateEvents, dispatchAsInteraction, dynamic,
|
|
4611
|
+
export { CLAIMS_DOCUMENT, CLAIMS_STREAM, 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, SLOT_FACE_DATA, SLOT_FACE_MARKUP, SLOT_FACE_STREAM, SLOT_MARKER, SLOT_VALUE, SVGElements, VoidElements, notSup as acquireAsset, notSup as addEvent, applyRef, notSup as assign, claimElement, claimElementTree, notSup as className, clearFlashCookie, clientOnly, commitEventResponse, commitResponseStub, composeMiddleware, configureServerErrors, createLiveHoles, createRequestEvent, createResponseStub, createSSRResponse, notSup as delegateEvents, dispatchAsInteraction, dynamic, notSup as dynamicProperty, effect, escape, generateHydrationScript, notSup as getDelegatedRoot, getExpectedRedirectStatus, getHydrationKey, getHydrationWriter, notSup as getNextElement, notSup as getNextMarker, notSup as getNextMatch, getRequestEvent, getServerFunctionMetadata, getServerFunctionRPC, getTraceContext, hasFlashCookie, hasServerLinkState, httpHeader, httpStatus, notSup as hydrate, notSup as insert, isDev, isHref, isResponseEnvelope, isSafeError, isServer, isServerFunction, isSlotValue, markSafeError, memo, parseCookieHeader, notSup as readShallow, redirect, notSup as ref, notSup as registerDelegatedContainer, notSup as registerDelegatedRoot, registerElementClaim, reload, notSup as render, renderToStream, renderToString, reportRequestFailure, resolveSSRNode, resolveSSRSelectValues, respond, notSup as runHydrationEvents, scriptNonce, serializeCookie, notSup as setAttribute, notSup as setAttributeNS, setLinkClaim, notSup as setProperty, notSup as setStyleProperty, slotValue, notSup as spread, ssr, ssrAttribute, ssrClaim, ssrClassName, ssrElement, ssrElementAttribute, ssrGroup, ssrHydrationKey, ssrLinkClaim, ssrSelectValues, ssrStyle, ssrStyleProperties, ssrStyleProperty, notSup as style, styleNonce, takeHydrationValue, notSup as template, notSup as unregisterDelegatedContainer, notSup as unregisterDelegatedRoot, useHead };
|