@solidjs/web 2.0.0-beta.22 → 2.0.0-beta.23
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/dev.cjs +25 -1
- package/dist/dev.js +25 -2
- package/dist/server.cjs +79 -33
- package/dist/server.js +79 -34
- package/dist/web.cjs +25 -1
- package/dist/web.js +25 -2
- package/frames/dist/client.cjs +1442 -0
- package/frames/dist/client.js +1430 -0
- package/frames/dist/server.cjs +1705 -0
- package/frames/dist/server.js +1694 -0
- package/frames/package.json +30 -0
- package/package.json +78 -5
- package/serialization/dist/serialization.cjs +83 -0
- package/serialization/dist/serialization.js +82 -1
- package/serialization/types/index.d.ts +12 -0
- package/serialization/types-cjs/index.d.cts +12 -0
- package/server-functions/dist/client.cjs +82 -55
- package/server-functions/dist/client.js +83 -56
- package/server-functions/dist/server.cjs +20 -3
- package/server-functions/dist/server.js +20 -3
- package/types/client.d.ts +8 -0
- package/types/core.d.ts +2 -1
- package/types/frames/client.d.ts +53 -0
- package/types/frames/frame-client.d.ts +205 -0
- package/types/frames/frame-sink.d.ts +145 -0
- package/types/frames/frame-transport.d.ts +105 -0
- package/types/frames/serializer.d.ts +151 -0
- package/types/frames/server.d.ts +21 -0
- package/types/serializer.d.ts +12 -0
- package/types/server-functions/client.d.ts +24 -0
- package/types/server.d.ts +2 -0
- package/types-cjs/client.d.cts +8 -0
- package/types-cjs/core.d.cts +2 -1
- package/types-cjs/frames/client.d.cts +53 -0
- package/types-cjs/frames/frame-client.d.cts +205 -0
- package/types-cjs/frames/frame-sink.d.cts +145 -0
- package/types-cjs/frames/frame-transport.d.cts +105 -0
- package/types-cjs/frames/serializer.d.cts +151 -0
- package/types-cjs/frames/server.d.cts +21 -0
- package/types-cjs/serializer.d.cts +12 -0
- package/types-cjs/server-functions/client.d.cts +24 -0
- package/types-cjs/server.d.cts +2 -0
package/dist/dev.cjs
CHANGED
|
@@ -33,6 +33,7 @@ const DOMWithState = {
|
|
|
33
33
|
const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
|
|
34
34
|
const $$SLOT = /*#__PURE__*/Symbol("slot");
|
|
35
35
|
const $$HOST = /*#__PURE__*/Symbol("host");
|
|
36
|
+
const $$FRAME = /*#__PURE__*/Symbol.for("dom-expressions.frame");
|
|
36
37
|
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"]);
|
|
37
38
|
const SVGElements = /*#__PURE__*/new Set([
|
|
38
39
|
"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",
|
|
@@ -283,13 +284,29 @@ function setProperty(node, name, value) {
|
|
|
283
284
|
node[name] = value;
|
|
284
285
|
}
|
|
285
286
|
let claimHandlers = null;
|
|
287
|
+
const CLAIM_SEAM = Symbol.for("dom-expressions.element-claims");
|
|
286
288
|
function registerElementClaim(handler) {
|
|
287
|
-
(claimHandlers || (claimHandlers = [])).push(handler);
|
|
289
|
+
(claimHandlers || (claimHandlers = globalThis[CLAIM_SEAM] = [])).push(handler);
|
|
288
290
|
return () => {
|
|
289
291
|
const index = claimHandlers.indexOf(handler);
|
|
290
292
|
index > -1 && claimHandlers.splice(index, 1);
|
|
291
293
|
};
|
|
292
294
|
}
|
|
295
|
+
const CLAIMED_ELEMENTS = "a[href], form[action]";
|
|
296
|
+
function claimElementTree(root) {
|
|
297
|
+
const handlers = globalThis[CLAIM_SEAM];
|
|
298
|
+
if (handlers === undefined || handlers.length === 0) return root;
|
|
299
|
+
const isElement = root.nodeType === 1;
|
|
300
|
+
if (!isElement && root.nodeType !== 11) return root;
|
|
301
|
+
if (isElement && root.matches(CLAIMED_ELEMENTS)) {
|
|
302
|
+
for (let i = 0; i < handlers.length; i++) handlers[i](root);
|
|
303
|
+
}
|
|
304
|
+
const found = root.querySelectorAll(CLAIMED_ELEMENTS);
|
|
305
|
+
for (let i = 0; i < found.length; i++) {
|
|
306
|
+
for (let j = 0; j < handlers.length; j++) handlers[j](found[i]);
|
|
307
|
+
}
|
|
308
|
+
return root;
|
|
309
|
+
}
|
|
293
310
|
function claimElement(node) {
|
|
294
311
|
if (claimHandlers !== null) {
|
|
295
312
|
for (let i = 0; i < claimHandlers.length; i++) claimHandlers[i](node);
|
|
@@ -1008,6 +1025,11 @@ function insertExpression(parent, value, current, marker) {
|
|
|
1008
1025
|
parent.appendChild(value);
|
|
1009
1026
|
}
|
|
1010
1027
|
if (marker) value[$$SLOT] = marker;
|
|
1028
|
+
} else if (value[$$FRAME]) {
|
|
1029
|
+
if (current) {
|
|
1030
|
+
cleanChildren(parent, Array.isArray(current) ? current : [current], multi ? marker : null);
|
|
1031
|
+
}
|
|
1032
|
+
value[$$FRAME](parent, multi ? marker : null);
|
|
1011
1033
|
} else if (Array.isArray(value)) {
|
|
1012
1034
|
const currentArray = current && Array.isArray(current);
|
|
1013
1035
|
if (value.length === 0) {
|
|
@@ -1028,6 +1050,7 @@ function normalize(value, current, multi, doNotUnwrap) {
|
|
|
1028
1050
|
doNotUnwrap
|
|
1029
1051
|
});
|
|
1030
1052
|
if (doNotUnwrap && typeof value === "function") return value;
|
|
1053
|
+
if (value != null && value[$$FRAME]) return value;
|
|
1031
1054
|
if (multi && !Array.isArray(value)) value = [value != null ? value : ""];
|
|
1032
1055
|
if (Array.isArray(value)) {
|
|
1033
1056
|
for (let i = 0, len = value.length; i < len; i++) {
|
|
@@ -1378,6 +1401,7 @@ exports.addEvent = addEvent;
|
|
|
1378
1401
|
exports.applyRef = applyRef;
|
|
1379
1402
|
exports.assign = assign;
|
|
1380
1403
|
exports.claimElement = claimElement;
|
|
1404
|
+
exports.claimElementTree = claimElementTree;
|
|
1381
1405
|
exports.className = className;
|
|
1382
1406
|
exports.delegateEvents = delegateEvents;
|
|
1383
1407
|
exports.dynamic = dynamic;
|
package/dist/dev.js
CHANGED
|
@@ -32,6 +32,7 @@ const DOMWithState = {
|
|
|
32
32
|
const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
|
|
33
33
|
const $$SLOT = /*#__PURE__*/Symbol("slot");
|
|
34
34
|
const $$HOST = /*#__PURE__*/Symbol("host");
|
|
35
|
+
const $$FRAME = /*#__PURE__*/Symbol.for("dom-expressions.frame");
|
|
35
36
|
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"]);
|
|
36
37
|
const SVGElements = /*#__PURE__*/new Set([
|
|
37
38
|
"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",
|
|
@@ -282,13 +283,29 @@ function setProperty(node, name, value) {
|
|
|
282
283
|
node[name] = value;
|
|
283
284
|
}
|
|
284
285
|
let claimHandlers = null;
|
|
286
|
+
const CLAIM_SEAM = Symbol.for("dom-expressions.element-claims");
|
|
285
287
|
function registerElementClaim(handler) {
|
|
286
|
-
(claimHandlers || (claimHandlers = [])).push(handler);
|
|
288
|
+
(claimHandlers || (claimHandlers = globalThis[CLAIM_SEAM] = [])).push(handler);
|
|
287
289
|
return () => {
|
|
288
290
|
const index = claimHandlers.indexOf(handler);
|
|
289
291
|
index > -1 && claimHandlers.splice(index, 1);
|
|
290
292
|
};
|
|
291
293
|
}
|
|
294
|
+
const CLAIMED_ELEMENTS = "a[href], form[action]";
|
|
295
|
+
function claimElementTree(root) {
|
|
296
|
+
const handlers = globalThis[CLAIM_SEAM];
|
|
297
|
+
if (handlers === undefined || handlers.length === 0) return root;
|
|
298
|
+
const isElement = root.nodeType === 1;
|
|
299
|
+
if (!isElement && root.nodeType !== 11) return root;
|
|
300
|
+
if (isElement && root.matches(CLAIMED_ELEMENTS)) {
|
|
301
|
+
for (let i = 0; i < handlers.length; i++) handlers[i](root);
|
|
302
|
+
}
|
|
303
|
+
const found = root.querySelectorAll(CLAIMED_ELEMENTS);
|
|
304
|
+
for (let i = 0; i < found.length; i++) {
|
|
305
|
+
for (let j = 0; j < handlers.length; j++) handlers[j](found[i]);
|
|
306
|
+
}
|
|
307
|
+
return root;
|
|
308
|
+
}
|
|
292
309
|
function claimElement(node) {
|
|
293
310
|
if (claimHandlers !== null) {
|
|
294
311
|
for (let i = 0; i < claimHandlers.length; i++) claimHandlers[i](node);
|
|
@@ -1007,6 +1024,11 @@ function insertExpression(parent, value, current, marker) {
|
|
|
1007
1024
|
parent.appendChild(value);
|
|
1008
1025
|
}
|
|
1009
1026
|
if (marker) value[$$SLOT] = marker;
|
|
1027
|
+
} else if (value[$$FRAME]) {
|
|
1028
|
+
if (current) {
|
|
1029
|
+
cleanChildren(parent, Array.isArray(current) ? current : [current], multi ? marker : null);
|
|
1030
|
+
}
|
|
1031
|
+
value[$$FRAME](parent, multi ? marker : null);
|
|
1010
1032
|
} else if (Array.isArray(value)) {
|
|
1011
1033
|
const currentArray = current && Array.isArray(current);
|
|
1012
1034
|
if (value.length === 0) {
|
|
@@ -1027,6 +1049,7 @@ function normalize(value, current, multi, doNotUnwrap) {
|
|
|
1027
1049
|
doNotUnwrap
|
|
1028
1050
|
});
|
|
1029
1051
|
if (doNotUnwrap && typeof value === "function") return value;
|
|
1052
|
+
if (value != null && value[$$FRAME]) return value;
|
|
1030
1053
|
if (multi && !Array.isArray(value)) value = [value != null ? value : ""];
|
|
1031
1054
|
if (Array.isArray(value)) {
|
|
1032
1055
|
for (let i = 0, len = value.length; i < len; i++) {
|
|
@@ -1304,4 +1327,4 @@ function createElement(tagName, is = undefined) {
|
|
|
1304
1327
|
});
|
|
1305
1328
|
}
|
|
1306
1329
|
|
|
1307
|
-
export { voidFn as Assets, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, voidFn as HydrationScript, MathMLElements, Namespaces, Portal, RawTextElements, RequestContext, ResponseEnvelope, SVGElements, VoidElements, acquireAsset, addEvent, applyRef, assign, claimElement, className, delegateEvents, dynamic, dynamicProperty, effect, escape, voidFn as generateHydrationScript, voidFn as getAssets, getDelegatedRoot, getFirstChild, getHydrationKey, getNextElement, getNextMarker, getNextMatch, getNextSibling, voidFn as getRequestEvent, hydrate, insert, installHydrationRuntime, isDev, isHref, isResponseEnvelope, isServer, memo, mergeProps, redirect, ref, registerDelegatedContainer, registerDelegatedRoot, registerElementClaim, reload, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, respond, runHydrationEvents, scope, setAttribute, setAttributeNS, setProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrStyle, style, template, unregisterDelegatedContainer, unregisterDelegatedRoot, voidFn as useAssets };
|
|
1330
|
+
export { voidFn as Assets, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, voidFn as HydrationScript, MathMLElements, Namespaces, Portal, RawTextElements, RequestContext, ResponseEnvelope, SVGElements, VoidElements, acquireAsset, addEvent, applyRef, assign, claimElement, claimElementTree, className, delegateEvents, dynamic, dynamicProperty, effect, escape, voidFn as generateHydrationScript, voidFn as getAssets, getDelegatedRoot, getFirstChild, getHydrationKey, getNextElement, getNextMarker, getNextMatch, getNextSibling, voidFn as getRequestEvent, hydrate, insert, installHydrationRuntime, isDev, isHref, isResponseEnvelope, isServer, memo, mergeProps, redirect, ref, registerDelegatedContainer, registerDelegatedRoot, registerElementClaim, reload, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, respond, runHydrationEvents, scope, setAttribute, setAttributeNS, setProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrStyle, style, template, unregisterDelegatedContainer, unregisterDelegatedRoot, voidFn as useAssets };
|
package/dist/server.cjs
CHANGED
|
@@ -328,10 +328,53 @@ function renderToStream(code, options = {}) {
|
|
|
328
328
|
completed = true;
|
|
329
329
|
if (firstFlushed) dispose();
|
|
330
330
|
};
|
|
331
|
-
const
|
|
331
|
+
const sink = {
|
|
332
|
+
data(payload) {
|
|
333
|
+
pushTask(payload);
|
|
334
|
+
},
|
|
335
|
+
fragment(key, value, meta) {
|
|
336
|
+
const deferActivation = !!meta.revealGroup;
|
|
337
|
+
const styles = meta.styles;
|
|
338
|
+
for (let i = 0; i < styles.inline.length; i++) {
|
|
339
|
+
buffer.write(renderInlineStyle(styles.inline[i], nonce));
|
|
340
|
+
}
|
|
341
|
+
if (styles.links.length) {
|
|
342
|
+
emitTask(`$dfs("${key}",${styles.links.length},${deferActivation ? 1 : 0})`);
|
|
343
|
+
writeTasks();
|
|
344
|
+
for (const url of styles.links) {
|
|
345
|
+
buffer.write(`<link rel="stylesheet" href="${url}" onload="$dfc('${key}')" onerror="$dfc('${key}')">`);
|
|
346
|
+
}
|
|
347
|
+
buffer.write(`<template id="${key}">${value}</template>`);
|
|
348
|
+
} else {
|
|
349
|
+
buffer.write(`<template id="${key}">${value}</template>`);
|
|
350
|
+
if (!deferActivation) {
|
|
351
|
+
emitTask(`$df("${key}")`);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
},
|
|
355
|
+
reveal(keys, meta) {
|
|
356
|
+
emitTask(`${meta.fallback ? "$dflj" : "$dfj"}(${JSON.stringify(keys)})`);
|
|
357
|
+
},
|
|
358
|
+
asset(type, value) {
|
|
359
|
+
if (type === "module") {
|
|
360
|
+
buffer.write(`<link rel="modulepreload" href="${value}">`);
|
|
361
|
+
} else if (type === "inline-style") {
|
|
362
|
+
buffer.write(renderInlineStyle(value, nonce));
|
|
363
|
+
}
|
|
364
|
+
},
|
|
365
|
+
shell(shellHtml, meta) {
|
|
366
|
+
shellHtml = injectBeforeHead(shellHtml, meta.assets);
|
|
367
|
+
shellHtml = injectPreloadLinks(meta.preloads, shellHtml);
|
|
368
|
+
shellHtml = injectInlineStyles(meta.inlineStyles, shellHtml, nonce);
|
|
369
|
+
if (meta.tasks.length) shellHtml = injectScripts(shellHtml, meta.tasks, nonce);
|
|
370
|
+
buffer.write(shellHtml);
|
|
371
|
+
},
|
|
372
|
+
...options.sink
|
|
373
|
+
};
|
|
374
|
+
const serializer = (options.serializer || createHydrationSerializer)({
|
|
332
375
|
scopeId: options.renderId,
|
|
333
376
|
plugins: options.plugins,
|
|
334
|
-
onData:
|
|
377
|
+
onData: payload => sink.data(payload),
|
|
335
378
|
onDone,
|
|
336
379
|
onError: options.onError
|
|
337
380
|
});
|
|
@@ -405,7 +448,7 @@ function renderToStream(code, options = {}) {
|
|
|
405
448
|
const entry = tracking.registerInlineStyle(value);
|
|
406
449
|
if (firstFlushed && !tracking.currentBoundaryId && !entry.emitted) {
|
|
407
450
|
entry.emitted = true;
|
|
408
|
-
|
|
451
|
+
sink.asset("inline-style", entry);
|
|
409
452
|
}
|
|
410
453
|
return;
|
|
411
454
|
}
|
|
@@ -419,9 +462,7 @@ function renderToStream(code, options = {}) {
|
|
|
419
462
|
}
|
|
420
463
|
if (!tracking.emittedAssets.has(value)) {
|
|
421
464
|
tracking.emittedAssets.add(value);
|
|
422
|
-
if (firstFlushed
|
|
423
|
-
buffer.write(`<link rel="modulepreload" href="${value}">`);
|
|
424
|
-
}
|
|
465
|
+
if (firstFlushed) sink.asset(type, value);
|
|
425
466
|
}
|
|
426
467
|
},
|
|
427
468
|
block(p) {
|
|
@@ -503,23 +544,11 @@ function renderToStream(code, options = {}) {
|
|
|
503
544
|
} else {
|
|
504
545
|
serializeFragmentAssets(key, tracking.boundaryModules, context);
|
|
505
546
|
const styles = collectStreamStyles(key, tracking, headStyles);
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
emitTask(`$dfs("${key}",${styles.links.length},${deferActivation ? 1 : 0})`);
|
|
512
|
-
writeTasks();
|
|
513
|
-
for (const url of styles.links) {
|
|
514
|
-
buffer.write(`<link rel="stylesheet" href="${url}" onload="$dfc('${key}')" onerror="$dfc('${key}')">`);
|
|
515
|
-
}
|
|
516
|
-
buffer.write(`<template id="${key}">${value !== undefined ? value : " "}</template>`);
|
|
517
|
-
} else {
|
|
518
|
-
buffer.write(`<template id="${key}">${value !== undefined ? value : " "}</template>`);
|
|
519
|
-
if (!deferActivation) {
|
|
520
|
-
emitTask(`$df("${key}")`);
|
|
521
|
-
}
|
|
522
|
-
}
|
|
547
|
+
sink.fragment(key, value !== undefined ? value : " ", {
|
|
548
|
+
styles,
|
|
549
|
+
revealGroup,
|
|
550
|
+
error
|
|
551
|
+
});
|
|
523
552
|
item.resolve(error);
|
|
524
553
|
}
|
|
525
554
|
}
|
|
@@ -530,12 +559,16 @@ function renderToStream(code, options = {}) {
|
|
|
530
559
|
revealFragments(groupOrKeys) {
|
|
531
560
|
const keys = resolveRevealKeys(groupOrKeys, true, true);
|
|
532
561
|
if (!keys) return;
|
|
533
|
-
|
|
562
|
+
sink.reveal(keys, {
|
|
563
|
+
fallback: false
|
|
564
|
+
});
|
|
534
565
|
},
|
|
535
566
|
revealFallbacks(groupOrKeys) {
|
|
536
567
|
const keys = resolveRevealKeys(groupOrKeys, false, false);
|
|
537
568
|
if (!keys) return;
|
|
538
|
-
|
|
569
|
+
sink.reveal(keys, {
|
|
570
|
+
fallback: true
|
|
571
|
+
});
|
|
539
572
|
}
|
|
540
573
|
};
|
|
541
574
|
applyAssetTracking(context, tracking, manifest);
|
|
@@ -595,16 +628,18 @@ function renderToStream(code, options = {}) {
|
|
|
595
628
|
if (shellCompleted) return;
|
|
596
629
|
if (!resolveRootHoles()) return;
|
|
597
630
|
solidJs.sharedConfig.context = context;
|
|
598
|
-
|
|
631
|
+
const assetsHtml = resolveAssetsHtml(context.assets);
|
|
599
632
|
headStyles = new Set();
|
|
600
633
|
for (const url of tracking.emittedAssets) {
|
|
601
634
|
if (url.endsWith(".css")) headStyles.add(url);
|
|
602
635
|
}
|
|
603
|
-
html = injectPreloadLinks(tracking.emittedAssets, html);
|
|
604
|
-
html = injectInlineStyles(tracking.inlineStyles, html, nonce);
|
|
605
636
|
serializeRootAssets();
|
|
606
|
-
|
|
607
|
-
|
|
637
|
+
sink.shell(html, {
|
|
638
|
+
assets: assetsHtml,
|
|
639
|
+
preloads: tracking.emittedAssets,
|
|
640
|
+
inlineStyles: tracking.inlineStyles,
|
|
641
|
+
tasks
|
|
642
|
+
});
|
|
608
643
|
tasks = "";
|
|
609
644
|
onCompleteShell && onCompleteShell({
|
|
610
645
|
write(v) {
|
|
@@ -1054,13 +1089,20 @@ function allSettled(promises) {
|
|
|
1054
1089
|
return;
|
|
1055
1090
|
});
|
|
1056
1091
|
}
|
|
1057
|
-
function
|
|
1058
|
-
if (!assets || !assets.length) return
|
|
1092
|
+
function resolveAssetsHtml(assets) {
|
|
1093
|
+
if (!assets || !assets.length) return "";
|
|
1059
1094
|
let out = "";
|
|
1060
1095
|
for (let i = 0, len = assets.length; i < len; i++) out += assets[i]();
|
|
1096
|
+
return out;
|
|
1097
|
+
}
|
|
1098
|
+
function injectBeforeHead(html, content) {
|
|
1099
|
+
if (!content) return html;
|
|
1061
1100
|
const index = html.indexOf("</head>");
|
|
1062
1101
|
if (index === -1) return html;
|
|
1063
|
-
return html.slice(0, index) +
|
|
1102
|
+
return html.slice(0, index) + content + html.slice(index);
|
|
1103
|
+
}
|
|
1104
|
+
function injectAssets(assets, html) {
|
|
1105
|
+
return injectBeforeHead(html, resolveAssetsHtml(assets));
|
|
1064
1106
|
}
|
|
1065
1107
|
function injectPreloadLinks(emittedAssets, html, nonce) {
|
|
1066
1108
|
if (!emittedAssets.size) return html;
|
|
@@ -1279,6 +1321,9 @@ function noopCleanup() {}
|
|
|
1279
1321
|
function claimElement(node) {
|
|
1280
1322
|
return node;
|
|
1281
1323
|
}
|
|
1324
|
+
function claimElementTree(root) {
|
|
1325
|
+
return root;
|
|
1326
|
+
}
|
|
1282
1327
|
function notSup() {
|
|
1283
1328
|
throw new Error("Client-only API called on the server side. Run client-only code in onMount, or conditionally run client-only component with <Show>.");
|
|
1284
1329
|
}
|
|
@@ -1483,6 +1528,7 @@ exports.addEvent = notSup;
|
|
|
1483
1528
|
exports.applyRef = applyRef;
|
|
1484
1529
|
exports.assign = notSup;
|
|
1485
1530
|
exports.claimElement = claimElement;
|
|
1531
|
+
exports.claimElementTree = claimElementTree;
|
|
1486
1532
|
exports.className = notSup;
|
|
1487
1533
|
exports.delegateEvents = notSup;
|
|
1488
1534
|
exports.dynamic = dynamic;
|
package/dist/server.js
CHANGED
|
@@ -327,10 +327,53 @@ function renderToStream(code, options = {}) {
|
|
|
327
327
|
completed = true;
|
|
328
328
|
if (firstFlushed) dispose();
|
|
329
329
|
};
|
|
330
|
-
const
|
|
330
|
+
const sink = {
|
|
331
|
+
data(payload) {
|
|
332
|
+
pushTask(payload);
|
|
333
|
+
},
|
|
334
|
+
fragment(key, value, meta) {
|
|
335
|
+
const deferActivation = !!meta.revealGroup;
|
|
336
|
+
const styles = meta.styles;
|
|
337
|
+
for (let i = 0; i < styles.inline.length; i++) {
|
|
338
|
+
buffer.write(renderInlineStyle(styles.inline[i], nonce));
|
|
339
|
+
}
|
|
340
|
+
if (styles.links.length) {
|
|
341
|
+
emitTask(`$dfs("${key}",${styles.links.length},${deferActivation ? 1 : 0})`);
|
|
342
|
+
writeTasks();
|
|
343
|
+
for (const url of styles.links) {
|
|
344
|
+
buffer.write(`<link rel="stylesheet" href="${url}" onload="$dfc('${key}')" onerror="$dfc('${key}')">`);
|
|
345
|
+
}
|
|
346
|
+
buffer.write(`<template id="${key}">${value}</template>`);
|
|
347
|
+
} else {
|
|
348
|
+
buffer.write(`<template id="${key}">${value}</template>`);
|
|
349
|
+
if (!deferActivation) {
|
|
350
|
+
emitTask(`$df("${key}")`);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
},
|
|
354
|
+
reveal(keys, meta) {
|
|
355
|
+
emitTask(`${meta.fallback ? "$dflj" : "$dfj"}(${JSON.stringify(keys)})`);
|
|
356
|
+
},
|
|
357
|
+
asset(type, value) {
|
|
358
|
+
if (type === "module") {
|
|
359
|
+
buffer.write(`<link rel="modulepreload" href="${value}">`);
|
|
360
|
+
} else if (type === "inline-style") {
|
|
361
|
+
buffer.write(renderInlineStyle(value, nonce));
|
|
362
|
+
}
|
|
363
|
+
},
|
|
364
|
+
shell(shellHtml, meta) {
|
|
365
|
+
shellHtml = injectBeforeHead(shellHtml, meta.assets);
|
|
366
|
+
shellHtml = injectPreloadLinks(meta.preloads, shellHtml);
|
|
367
|
+
shellHtml = injectInlineStyles(meta.inlineStyles, shellHtml, nonce);
|
|
368
|
+
if (meta.tasks.length) shellHtml = injectScripts(shellHtml, meta.tasks, nonce);
|
|
369
|
+
buffer.write(shellHtml);
|
|
370
|
+
},
|
|
371
|
+
...options.sink
|
|
372
|
+
};
|
|
373
|
+
const serializer = (options.serializer || createHydrationSerializer)({
|
|
331
374
|
scopeId: options.renderId,
|
|
332
375
|
plugins: options.plugins,
|
|
333
|
-
onData:
|
|
376
|
+
onData: payload => sink.data(payload),
|
|
334
377
|
onDone,
|
|
335
378
|
onError: options.onError
|
|
336
379
|
});
|
|
@@ -404,7 +447,7 @@ function renderToStream(code, options = {}) {
|
|
|
404
447
|
const entry = tracking.registerInlineStyle(value);
|
|
405
448
|
if (firstFlushed && !tracking.currentBoundaryId && !entry.emitted) {
|
|
406
449
|
entry.emitted = true;
|
|
407
|
-
|
|
450
|
+
sink.asset("inline-style", entry);
|
|
408
451
|
}
|
|
409
452
|
return;
|
|
410
453
|
}
|
|
@@ -418,9 +461,7 @@ function renderToStream(code, options = {}) {
|
|
|
418
461
|
}
|
|
419
462
|
if (!tracking.emittedAssets.has(value)) {
|
|
420
463
|
tracking.emittedAssets.add(value);
|
|
421
|
-
if (firstFlushed
|
|
422
|
-
buffer.write(`<link rel="modulepreload" href="${value}">`);
|
|
423
|
-
}
|
|
464
|
+
if (firstFlushed) sink.asset(type, value);
|
|
424
465
|
}
|
|
425
466
|
},
|
|
426
467
|
block(p) {
|
|
@@ -502,23 +543,11 @@ function renderToStream(code, options = {}) {
|
|
|
502
543
|
} else {
|
|
503
544
|
serializeFragmentAssets(key, tracking.boundaryModules, context);
|
|
504
545
|
const styles = collectStreamStyles(key, tracking, headStyles);
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
emitTask(`$dfs("${key}",${styles.links.length},${deferActivation ? 1 : 0})`);
|
|
511
|
-
writeTasks();
|
|
512
|
-
for (const url of styles.links) {
|
|
513
|
-
buffer.write(`<link rel="stylesheet" href="${url}" onload="$dfc('${key}')" onerror="$dfc('${key}')">`);
|
|
514
|
-
}
|
|
515
|
-
buffer.write(`<template id="${key}">${value !== undefined ? value : " "}</template>`);
|
|
516
|
-
} else {
|
|
517
|
-
buffer.write(`<template id="${key}">${value !== undefined ? value : " "}</template>`);
|
|
518
|
-
if (!deferActivation) {
|
|
519
|
-
emitTask(`$df("${key}")`);
|
|
520
|
-
}
|
|
521
|
-
}
|
|
546
|
+
sink.fragment(key, value !== undefined ? value : " ", {
|
|
547
|
+
styles,
|
|
548
|
+
revealGroup,
|
|
549
|
+
error
|
|
550
|
+
});
|
|
522
551
|
item.resolve(error);
|
|
523
552
|
}
|
|
524
553
|
}
|
|
@@ -529,12 +558,16 @@ function renderToStream(code, options = {}) {
|
|
|
529
558
|
revealFragments(groupOrKeys) {
|
|
530
559
|
const keys = resolveRevealKeys(groupOrKeys, true, true);
|
|
531
560
|
if (!keys) return;
|
|
532
|
-
|
|
561
|
+
sink.reveal(keys, {
|
|
562
|
+
fallback: false
|
|
563
|
+
});
|
|
533
564
|
},
|
|
534
565
|
revealFallbacks(groupOrKeys) {
|
|
535
566
|
const keys = resolveRevealKeys(groupOrKeys, false, false);
|
|
536
567
|
if (!keys) return;
|
|
537
|
-
|
|
568
|
+
sink.reveal(keys, {
|
|
569
|
+
fallback: true
|
|
570
|
+
});
|
|
538
571
|
}
|
|
539
572
|
};
|
|
540
573
|
applyAssetTracking(context, tracking, manifest);
|
|
@@ -594,16 +627,18 @@ function renderToStream(code, options = {}) {
|
|
|
594
627
|
if (shellCompleted) return;
|
|
595
628
|
if (!resolveRootHoles()) return;
|
|
596
629
|
sharedConfig.context = context;
|
|
597
|
-
|
|
630
|
+
const assetsHtml = resolveAssetsHtml(context.assets);
|
|
598
631
|
headStyles = new Set();
|
|
599
632
|
for (const url of tracking.emittedAssets) {
|
|
600
633
|
if (url.endsWith(".css")) headStyles.add(url);
|
|
601
634
|
}
|
|
602
|
-
html = injectPreloadLinks(tracking.emittedAssets, html);
|
|
603
|
-
html = injectInlineStyles(tracking.inlineStyles, html, nonce);
|
|
604
635
|
serializeRootAssets();
|
|
605
|
-
|
|
606
|
-
|
|
636
|
+
sink.shell(html, {
|
|
637
|
+
assets: assetsHtml,
|
|
638
|
+
preloads: tracking.emittedAssets,
|
|
639
|
+
inlineStyles: tracking.inlineStyles,
|
|
640
|
+
tasks
|
|
641
|
+
});
|
|
607
642
|
tasks = "";
|
|
608
643
|
onCompleteShell && onCompleteShell({
|
|
609
644
|
write(v) {
|
|
@@ -1053,13 +1088,20 @@ function allSettled(promises) {
|
|
|
1053
1088
|
return;
|
|
1054
1089
|
});
|
|
1055
1090
|
}
|
|
1056
|
-
function
|
|
1057
|
-
if (!assets || !assets.length) return
|
|
1091
|
+
function resolveAssetsHtml(assets) {
|
|
1092
|
+
if (!assets || !assets.length) return "";
|
|
1058
1093
|
let out = "";
|
|
1059
1094
|
for (let i = 0, len = assets.length; i < len; i++) out += assets[i]();
|
|
1095
|
+
return out;
|
|
1096
|
+
}
|
|
1097
|
+
function injectBeforeHead(html, content) {
|
|
1098
|
+
if (!content) return html;
|
|
1060
1099
|
const index = html.indexOf("</head>");
|
|
1061
1100
|
if (index === -1) return html;
|
|
1062
|
-
return html.slice(0, index) +
|
|
1101
|
+
return html.slice(0, index) + content + html.slice(index);
|
|
1102
|
+
}
|
|
1103
|
+
function injectAssets(assets, html) {
|
|
1104
|
+
return injectBeforeHead(html, resolveAssetsHtml(assets));
|
|
1063
1105
|
}
|
|
1064
1106
|
function injectPreloadLinks(emittedAssets, html, nonce) {
|
|
1065
1107
|
if (!emittedAssets.size) return html;
|
|
@@ -1278,6 +1320,9 @@ function noopCleanup() {}
|
|
|
1278
1320
|
function claimElement(node) {
|
|
1279
1321
|
return node;
|
|
1280
1322
|
}
|
|
1323
|
+
function claimElementTree(root) {
|
|
1324
|
+
return root;
|
|
1325
|
+
}
|
|
1281
1326
|
function notSup() {
|
|
1282
1327
|
throw new Error("Client-only API called on the server side. Run client-only code in onMount, or conditionally run client-only component with <Show>.");
|
|
1283
1328
|
}
|
|
@@ -1401,4 +1446,4 @@ function Portal(props) {
|
|
|
1401
1446
|
return undefined;
|
|
1402
1447
|
}
|
|
1403
1448
|
|
|
1404
|
-
export { Assets, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, HydrationScript, MathMLElements, Namespaces, Portal, RawTextElements, RequestContext, ResponseEnvelope, SVGElements, VoidElements, notSup as acquireAsset, notSup as addEvent, applyRef, notSup as assign, claimElement, notSup as className, notSup as delegateEvents, dynamic, notSup as dynamicProperty, effect, escape, generateHydrationScript, getAssets, notSup as getDelegatedRoot, getHydrationKey, notSup as getNextElement, notSup as getNextMarker, notSup as getNextMatch, getRequestEvent, notSup as hydrate, notSup as insert, isDev, isHref, isResponseEnvelope, isServer, memo, redirect, notSup as ref, notSup as registerDelegatedContainer, notSup as registerDelegatedRoot, registerElementClaim, reload, notSup as render, renderToStream, renderToString, renderToStringAsync, respond, notSup as runHydrationEvents, notSup as setAttribute, notSup as setAttributeNS, notSup as setProperty, notSup as setStyleProperty, notSup as spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrGroup, ssrHydrationKey, ssrStyle, ssrStyleProperty, notSup as style, notSup as template, notSup as unregisterDelegatedContainer, notSup as unregisterDelegatedRoot, useAssets };
|
|
1449
|
+
export { Assets, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, HydrationScript, MathMLElements, Namespaces, Portal, RawTextElements, RequestContext, ResponseEnvelope, SVGElements, VoidElements, notSup as acquireAsset, notSup as addEvent, applyRef, notSup as assign, claimElement, claimElementTree, notSup as className, notSup as delegateEvents, dynamic, notSup as dynamicProperty, effect, escape, generateHydrationScript, getAssets, notSup as getDelegatedRoot, getHydrationKey, notSup as getNextElement, notSup as getNextMarker, notSup as getNextMatch, getRequestEvent, notSup as hydrate, notSup as insert, isDev, isHref, isResponseEnvelope, isServer, memo, redirect, notSup as ref, notSup as registerDelegatedContainer, notSup as registerDelegatedRoot, registerElementClaim, reload, notSup as render, renderToStream, renderToString, renderToStringAsync, respond, notSup as runHydrationEvents, notSup as setAttribute, notSup as setAttributeNS, notSup as setProperty, notSup as setStyleProperty, notSup as spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrGroup, ssrHydrationKey, ssrStyle, ssrStyleProperty, notSup as style, notSup as template, notSup as unregisterDelegatedContainer, notSup as unregisterDelegatedRoot, useAssets };
|
package/dist/web.cjs
CHANGED
|
@@ -33,6 +33,7 @@ const DOMWithState = {
|
|
|
33
33
|
const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
|
|
34
34
|
const $$SLOT = /*#__PURE__*/Symbol("slot");
|
|
35
35
|
const $$HOST = /*#__PURE__*/Symbol("host");
|
|
36
|
+
const $$FRAME = /*#__PURE__*/Symbol.for("dom-expressions.frame");
|
|
36
37
|
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"]);
|
|
37
38
|
const SVGElements = /*#__PURE__*/new Set([
|
|
38
39
|
"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",
|
|
@@ -278,13 +279,29 @@ function setProperty(node, name, value) {
|
|
|
278
279
|
node[name] = value;
|
|
279
280
|
}
|
|
280
281
|
let claimHandlers = null;
|
|
282
|
+
const CLAIM_SEAM = Symbol.for("dom-expressions.element-claims");
|
|
281
283
|
function registerElementClaim(handler) {
|
|
282
|
-
(claimHandlers || (claimHandlers = [])).push(handler);
|
|
284
|
+
(claimHandlers || (claimHandlers = globalThis[CLAIM_SEAM] = [])).push(handler);
|
|
283
285
|
return () => {
|
|
284
286
|
const index = claimHandlers.indexOf(handler);
|
|
285
287
|
index > -1 && claimHandlers.splice(index, 1);
|
|
286
288
|
};
|
|
287
289
|
}
|
|
290
|
+
const CLAIMED_ELEMENTS = "a[href], form[action]";
|
|
291
|
+
function claimElementTree(root) {
|
|
292
|
+
const handlers = globalThis[CLAIM_SEAM];
|
|
293
|
+
if (handlers === undefined || handlers.length === 0) return root;
|
|
294
|
+
const isElement = root.nodeType === 1;
|
|
295
|
+
if (!isElement && root.nodeType !== 11) return root;
|
|
296
|
+
if (isElement && root.matches(CLAIMED_ELEMENTS)) {
|
|
297
|
+
for (let i = 0; i < handlers.length; i++) handlers[i](root);
|
|
298
|
+
}
|
|
299
|
+
const found = root.querySelectorAll(CLAIMED_ELEMENTS);
|
|
300
|
+
for (let i = 0; i < found.length; i++) {
|
|
301
|
+
for (let j = 0; j < handlers.length; j++) handlers[j](found[i]);
|
|
302
|
+
}
|
|
303
|
+
return root;
|
|
304
|
+
}
|
|
288
305
|
function claimElement(node) {
|
|
289
306
|
if (claimHandlers !== null) {
|
|
290
307
|
for (let i = 0; i < claimHandlers.length; i++) claimHandlers[i](node);
|
|
@@ -951,6 +968,11 @@ function insertExpression(parent, value, current, marker) {
|
|
|
951
968
|
parent.appendChild(value);
|
|
952
969
|
}
|
|
953
970
|
if (marker) value[$$SLOT] = marker;
|
|
971
|
+
} else if (value[$$FRAME]) {
|
|
972
|
+
if (current) {
|
|
973
|
+
cleanChildren(parent, Array.isArray(current) ? current : [current], multi ? marker : null);
|
|
974
|
+
}
|
|
975
|
+
value[$$FRAME](parent, multi ? marker : null);
|
|
954
976
|
} else if (Array.isArray(value)) {
|
|
955
977
|
const currentArray = current && Array.isArray(current);
|
|
956
978
|
if (value.length === 0) {
|
|
@@ -971,6 +993,7 @@ function normalize(value, current, multi, doNotUnwrap) {
|
|
|
971
993
|
doNotUnwrap
|
|
972
994
|
});
|
|
973
995
|
if (doNotUnwrap && typeof value === "function") return value;
|
|
996
|
+
if (value != null && value[$$FRAME]) return value;
|
|
974
997
|
if (multi && !Array.isArray(value)) value = [value != null ? value : ""];
|
|
975
998
|
if (Array.isArray(value)) {
|
|
976
999
|
for (let i = 0, len = value.length; i < len; i++) {
|
|
@@ -1316,6 +1339,7 @@ exports.addEvent = addEvent;
|
|
|
1316
1339
|
exports.applyRef = applyRef;
|
|
1317
1340
|
exports.assign = assign;
|
|
1318
1341
|
exports.claimElement = claimElement;
|
|
1342
|
+
exports.claimElementTree = claimElementTree;
|
|
1319
1343
|
exports.className = className;
|
|
1320
1344
|
exports.delegateEvents = delegateEvents;
|
|
1321
1345
|
exports.dynamic = dynamic;
|
package/dist/web.js
CHANGED
|
@@ -32,6 +32,7 @@ const DOMWithState = {
|
|
|
32
32
|
const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
|
|
33
33
|
const $$SLOT = /*#__PURE__*/Symbol("slot");
|
|
34
34
|
const $$HOST = /*#__PURE__*/Symbol("host");
|
|
35
|
+
const $$FRAME = /*#__PURE__*/Symbol.for("dom-expressions.frame");
|
|
35
36
|
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"]);
|
|
36
37
|
const SVGElements = /*#__PURE__*/new Set([
|
|
37
38
|
"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",
|
|
@@ -277,13 +278,29 @@ function setProperty(node, name, value) {
|
|
|
277
278
|
node[name] = value;
|
|
278
279
|
}
|
|
279
280
|
let claimHandlers = null;
|
|
281
|
+
const CLAIM_SEAM = Symbol.for("dom-expressions.element-claims");
|
|
280
282
|
function registerElementClaim(handler) {
|
|
281
|
-
(claimHandlers || (claimHandlers = [])).push(handler);
|
|
283
|
+
(claimHandlers || (claimHandlers = globalThis[CLAIM_SEAM] = [])).push(handler);
|
|
282
284
|
return () => {
|
|
283
285
|
const index = claimHandlers.indexOf(handler);
|
|
284
286
|
index > -1 && claimHandlers.splice(index, 1);
|
|
285
287
|
};
|
|
286
288
|
}
|
|
289
|
+
const CLAIMED_ELEMENTS = "a[href], form[action]";
|
|
290
|
+
function claimElementTree(root) {
|
|
291
|
+
const handlers = globalThis[CLAIM_SEAM];
|
|
292
|
+
if (handlers === undefined || handlers.length === 0) return root;
|
|
293
|
+
const isElement = root.nodeType === 1;
|
|
294
|
+
if (!isElement && root.nodeType !== 11) return root;
|
|
295
|
+
if (isElement && root.matches(CLAIMED_ELEMENTS)) {
|
|
296
|
+
for (let i = 0; i < handlers.length; i++) handlers[i](root);
|
|
297
|
+
}
|
|
298
|
+
const found = root.querySelectorAll(CLAIMED_ELEMENTS);
|
|
299
|
+
for (let i = 0; i < found.length; i++) {
|
|
300
|
+
for (let j = 0; j < handlers.length; j++) handlers[j](found[i]);
|
|
301
|
+
}
|
|
302
|
+
return root;
|
|
303
|
+
}
|
|
287
304
|
function claimElement(node) {
|
|
288
305
|
if (claimHandlers !== null) {
|
|
289
306
|
for (let i = 0; i < claimHandlers.length; i++) claimHandlers[i](node);
|
|
@@ -950,6 +967,11 @@ function insertExpression(parent, value, current, marker) {
|
|
|
950
967
|
parent.appendChild(value);
|
|
951
968
|
}
|
|
952
969
|
if (marker) value[$$SLOT] = marker;
|
|
970
|
+
} else if (value[$$FRAME]) {
|
|
971
|
+
if (current) {
|
|
972
|
+
cleanChildren(parent, Array.isArray(current) ? current : [current], multi ? marker : null);
|
|
973
|
+
}
|
|
974
|
+
value[$$FRAME](parent, multi ? marker : null);
|
|
953
975
|
} else if (Array.isArray(value)) {
|
|
954
976
|
const currentArray = current && Array.isArray(current);
|
|
955
977
|
if (value.length === 0) {
|
|
@@ -970,6 +992,7 @@ function normalize(value, current, multi, doNotUnwrap) {
|
|
|
970
992
|
doNotUnwrap
|
|
971
993
|
});
|
|
972
994
|
if (doNotUnwrap && typeof value === "function") return value;
|
|
995
|
+
if (value != null && value[$$FRAME]) return value;
|
|
973
996
|
if (multi && !Array.isArray(value)) value = [value != null ? value : ""];
|
|
974
997
|
if (Array.isArray(value)) {
|
|
975
998
|
for (let i = 0, len = value.length; i < len; i++) {
|
|
@@ -1242,4 +1265,4 @@ function createElement(tagName, is = undefined) {
|
|
|
1242
1265
|
});
|
|
1243
1266
|
}
|
|
1244
1267
|
|
|
1245
|
-
export { voidFn as Assets, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, voidFn as HydrationScript, MathMLElements, Namespaces, Portal, RawTextElements, RequestContext, ResponseEnvelope, SVGElements, VoidElements, acquireAsset, addEvent, applyRef, assign, claimElement, className, delegateEvents, dynamic, dynamicProperty, effect, escape, voidFn as generateHydrationScript, voidFn as getAssets, getDelegatedRoot, getFirstChild, getHydrationKey, getNextElement, getNextMarker, getNextMatch, getNextSibling, voidFn as getRequestEvent, hydrate, insert, installHydrationRuntime, isDev, isHref, isResponseEnvelope, isServer, memo, mergeProps, redirect, ref, registerDelegatedContainer, registerDelegatedRoot, registerElementClaim, reload, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, respond, runHydrationEvents, scope, setAttribute, setAttributeNS, setProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrStyle, style, template, unregisterDelegatedContainer, unregisterDelegatedRoot, voidFn as useAssets };
|
|
1268
|
+
export { voidFn as Assets, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, voidFn as HydrationScript, MathMLElements, Namespaces, Portal, RawTextElements, RequestContext, ResponseEnvelope, SVGElements, VoidElements, acquireAsset, addEvent, applyRef, assign, claimElement, claimElementTree, className, delegateEvents, dynamic, dynamicProperty, effect, escape, voidFn as generateHydrationScript, voidFn as getAssets, getDelegatedRoot, getFirstChild, getHydrationKey, getNextElement, getNextMarker, getNextMatch, getNextSibling, voidFn as getRequestEvent, hydrate, insert, installHydrationRuntime, isDev, isHref, isResponseEnvelope, isServer, memo, mergeProps, redirect, ref, registerDelegatedContainer, registerDelegatedRoot, registerElementClaim, reload, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, respond, runHydrationEvents, scope, setAttribute, setAttributeNS, setProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrStyle, style, template, unregisterDelegatedContainer, unregisterDelegatedRoot, voidFn as useAssets };
|