@stencil/core 5.0.0-rc.15 → 5.0.0-rc.16
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/app-data/index.d.ts +1 -1
- package/dist/app-data/index.js +0 -1
- package/dist/{client-Cpehp9QL.mjs → client-nVB5tHhh.mjs} +60 -14
- package/dist/compiler/browser.d.ts +0 -2
- package/dist/compiler/browser.js +136 -37
- package/dist/compiler/index.d.mts +1 -1
- package/dist/compiler/index.mjs +2 -2
- package/dist/compiler/utils/index.d.mts +1 -1
- package/dist/{compiler-D92bSZzV.mjs → compiler-D6kG51sR.mjs} +308 -90
- package/dist/declarations/stencil-public-compiler.d.ts +0 -2
- package/dist/{index-BDAZsQzV.d.mts → index-BOBfOxcK.d.mts} +0 -2
- package/dist/{index-BS1JKKvz.d.mts → index-CamUaPx1.d.mts} +1 -1
- package/dist/{index-CWPcrnEJ.d.ts → index-DaYfl65k.d.ts} +0 -1
- package/dist/index.mjs +1 -1
- package/dist/jsx-runtime.mjs +1 -1
- package/dist/{node-C6N23fLr.mjs → node-IRt_dGbC.mjs} +1 -1
- package/dist/runtime/client/lazy.js +87 -18
- package/dist/runtime/client/runtime.js +87 -18
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.js +87 -18
- package/dist/runtime/server/index.mjs +87 -18
- package/dist/runtime/server/runner.mjs +80 -66
- package/dist/signals/index.js +0 -1
- package/dist/sys/node/index.d.mts +1 -1
- package/dist/sys/node/index.mjs +1 -1
- package/dist/sys/node/worker.mjs +2 -2
- package/dist/testing/index.d.mts +0 -2
- package/dist/testing/index.mjs +88 -22
- package/package.json +4 -8
|
@@ -444,19 +444,28 @@ const getSlottedChildNodes = (childNodes) => {
|
|
|
444
444
|
* @returns a reference to the slot node that matches the provided name, `null` otherwise
|
|
445
445
|
*/
|
|
446
446
|
function getHostSlotNodes(childNodes, hostName, slotName) {
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
447
|
+
const slotNodes = [];
|
|
448
|
+
collectHostSlotNodes(childNodes, hostName, slotName, slotNodes);
|
|
449
|
+
return slotNodes;
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* Pre-order walk for {@link getHostSlotNodes}, appending to `out`.
|
|
453
|
+
* @param childNodes the nodes to search
|
|
454
|
+
* @param hostName the host name of the slot to match on
|
|
455
|
+
* @param slotName the name of the slot to match on; stops at the first match when given
|
|
456
|
+
* @param out the matching slot nodes, in document order
|
|
457
|
+
* @returns true once a named slot has been found
|
|
458
|
+
*/
|
|
459
|
+
function collectHostSlotNodes(childNodes, hostName, slotName, out) {
|
|
460
|
+
for (let i = 0; i < childNodes.length; i++) {
|
|
461
|
+
const childNode = childNodes[i];
|
|
452
462
|
if (childNode["s-sr"] && (!hostName || childNode["s-hn"] === hostName) && (slotName === void 0 || getSlotName(childNode) === slotName)) {
|
|
453
|
-
|
|
454
|
-
if (
|
|
463
|
+
out.push(childNode);
|
|
464
|
+
if (slotName !== void 0) return true;
|
|
455
465
|
}
|
|
456
|
-
|
|
457
|
-
if (typeof slotName !== "undefined" && slottedNodes.length) return slottedNodes;
|
|
466
|
+
if (collectHostSlotNodes(internalCall(childNode, "childNodes"), hostName, slotName, out) && slotName !== void 0) return true;
|
|
458
467
|
}
|
|
459
|
-
return
|
|
468
|
+
return false;
|
|
460
469
|
}
|
|
461
470
|
/**
|
|
462
471
|
* Get all 'child' sibling nodes of a slot node
|
|
@@ -575,11 +584,40 @@ function findSlotFromSlottedNode(slottedNode, parentHost) {
|
|
|
575
584
|
slotName: ""
|
|
576
585
|
};
|
|
577
586
|
const slotName = slottedNode["s-sn"] = getSlotName(slottedNode) || "";
|
|
587
|
+
let hostSlots = slotNodeCache.get(parentHost);
|
|
588
|
+
const cached = hostSlots?.get(slotName);
|
|
589
|
+
if (cached && isHostSlot(cached, parentHost, slotName)) return {
|
|
590
|
+
slotNode: cached,
|
|
591
|
+
slotName
|
|
592
|
+
};
|
|
593
|
+
const slotNode = getHostSlotNodes(internalCall(parentHost, "childNodes"), parentHost.tagName, slotName)[0];
|
|
594
|
+
if (slotNode) {
|
|
595
|
+
if (!hostSlots) slotNodeCache.set(parentHost, hostSlots = /* @__PURE__ */ new Map());
|
|
596
|
+
hostSlots.set(slotName, slotNode);
|
|
597
|
+
}
|
|
578
598
|
return {
|
|
579
|
-
slotNode
|
|
599
|
+
slotNode,
|
|
580
600
|
slotName
|
|
581
601
|
};
|
|
582
602
|
}
|
|
603
|
+
/**
|
|
604
|
+
* The slot node last found per host and slot name. Each slotted child of a host looks up its
|
|
605
|
+
* slot, and a full search walks the host's whole internal tree, so a host with many slotted
|
|
606
|
+
* children would otherwise cost O(children × tree).
|
|
607
|
+
*/
|
|
608
|
+
const slotNodeCache = /* @__PURE__ */ new WeakMap();
|
|
609
|
+
/**
|
|
610
|
+
* Whether a cached slot node is still the host's slot of that name.
|
|
611
|
+
* @param slotNode the cached slot node
|
|
612
|
+
* @param host the host element
|
|
613
|
+
* @param slotName the slot name
|
|
614
|
+
* @returns true if `slotNode` is still a slot of `host` named `slotName`, inside its internal tree
|
|
615
|
+
*/
|
|
616
|
+
const isHostSlot = (slotNode, host, slotName) => {
|
|
617
|
+
if (!slotNode["s-sr"] || slotNode["s-hn"] !== host.tagName || getSlotName(slotNode) !== slotName) return false;
|
|
618
|
+
for (let n = internalCall(slotNode, "parentNode"); n; n = internalCall(n, "parentNode")) if (n === host) return true;
|
|
619
|
+
return false;
|
|
620
|
+
};
|
|
583
621
|
//#endregion
|
|
584
622
|
//#region src/runtime/dom-extras.ts
|
|
585
623
|
const applyLightDomPatches = (hostElementPrototype) => {
|
|
@@ -2336,8 +2374,7 @@ const insertBefore = (parent, newNode, reference, isInitialLoad) => {
|
|
|
2336
2374
|
if (parent?.["s-cr"]) checkSlotRelocate = true;
|
|
2337
2375
|
if (BUILD$1.scoped && typeof newNode["s-sn"] === "string" && !!newNode["s-sr"] && !!newNode["s-cr"]) addRemoveSlotScopedClass(newNode["s-cr"], newNode, parent, newNode.parentElement);
|
|
2338
2376
|
else if (typeof newNode["s-sn"] === "string") {
|
|
2339
|
-
|
|
2340
|
-
if ((BUILD$1.lightDomPatches || BUILD$1.slotChildNodes || BUILD$1.patchAll && !!(hostElm && getHostRef(hostElm)?.$cmpMeta$.$flags$ & CMP_FLAGS.patchAll)) && parent.getRootNode().nodeType !== NODE_TYPES.DOCUMENT_FRAGMENT_NODE) patchSlottedNode(newNode);
|
|
2377
|
+
if ((BUILD$1.lightDomPatches || BUILD$1.slotChildNodes || BUILD$1.patchAll && hostPatchesAll(newNode, parent)) && parent.getRootNode().nodeType !== NODE_TYPES.DOCUMENT_FRAGMENT_NODE) patchSlottedNode(newNode);
|
|
2341
2378
|
parent.insertBefore(newNode, reference);
|
|
2342
2379
|
const { slotNode } = findSlotFromSlottedNode(newNode);
|
|
2343
2380
|
if (slotNode) {
|
|
@@ -2351,6 +2388,16 @@ const insertBefore = (parent, newNode, reference, isInitialLoad) => {
|
|
|
2351
2388
|
else return parent?.insertBefore(newNode, reference);
|
|
2352
2389
|
};
|
|
2353
2390
|
/**
|
|
2391
|
+
* Whether the host a slotted node belongs to opted into `patchAll`.
|
|
2392
|
+
* @param newNode the slotted node
|
|
2393
|
+
* @param parent the node it is being inserted into
|
|
2394
|
+
* @returns true if the host component has the `patchAll` flag
|
|
2395
|
+
*/
|
|
2396
|
+
const hostPatchesAll = (newNode, parent) => {
|
|
2397
|
+
const hostElm = newNode["s-hn"] && parent.closest?.(newNode["s-hn"]);
|
|
2398
|
+
return !!(hostElm && getHostRef(hostElm)?.$cmpMeta$.$flags$ & CMP_FLAGS.patchAll);
|
|
2399
|
+
};
|
|
2400
|
+
/**
|
|
2354
2401
|
* Adds or removes a scoped class to the parent element of a slotted node.
|
|
2355
2402
|
* This is used for styling slotted content (e.g. with `::scoped(...) {...}` selectors )
|
|
2356
2403
|
* in `scoped: true` components.
|
|
@@ -3844,7 +3891,7 @@ const insertPolyfillHostInCssText = (cssText) => {
|
|
|
3844
3891
|
const _colonHostContextRe = createSupportsRuleRe(":host-context");
|
|
3845
3892
|
cssText = cssText.replace(_colonHostContextRe, `$1${_polyfillHostContext}`).replace(_colonHostRe, `$1${_polyfillHost}`).replace(_colonSlottedRe, `$1${_polyfillSlotted}`);
|
|
3846
3893
|
supportsBlocks.forEach((originalSelector, index) => {
|
|
3847
|
-
cssText = cssText.replace(`__supports_${index}__`, originalSelector);
|
|
3894
|
+
cssText = cssText.replace(`__supports_${index}__`, () => originalSelector);
|
|
3848
3895
|
});
|
|
3849
3896
|
return cssText;
|
|
3850
3897
|
};
|
|
@@ -4077,11 +4124,11 @@ const scopeCss = (cssText, scopeId, commentOriginalSelector) => {
|
|
|
4077
4124
|
const scoped = scopeCssText(cssText, scopeId, hostScopeId, slotScopeId, commentOriginalSelector);
|
|
4078
4125
|
cssText = [scoped.cssText, ...commentsWithHash].join("\n");
|
|
4079
4126
|
if (commentOriginalSelector) orgSelectors.forEach(({ placeholder, comment }) => {
|
|
4080
|
-
cssText = cssText.replace(placeholder, comment);
|
|
4127
|
+
cssText = cssText.replace(placeholder, () => comment);
|
|
4081
4128
|
});
|
|
4082
4129
|
scoped.slottedSelectors.forEach((slottedSelector) => {
|
|
4083
4130
|
const regex = new RegExp(escapeRegExpSpecialCharacters(slottedSelector.orgSelector) + "(?=\\s*[,{]|$)", "g");
|
|
4084
|
-
cssText = cssText.replace(regex, slottedSelector.updatedSelector);
|
|
4131
|
+
cssText = cssText.replace(regex, () => slottedSelector.updatedSelector);
|
|
4085
4132
|
});
|
|
4086
4133
|
cssText = expandPartSelectors(cssText);
|
|
4087
4134
|
return cssText;
|
|
@@ -4326,6 +4373,28 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
4326
4373
|
};
|
|
4327
4374
|
//#endregion
|
|
4328
4375
|
//#region src/runtime/initialize-component.ts
|
|
4376
|
+
/** Distinct style texts kept; an app has one per component and mode. */
|
|
4377
|
+
const SSR_CSS_CACHE_MAX = 1e3;
|
|
4378
|
+
/**
|
|
4379
|
+
* Memoizes a server-side rewrite of a component's style text. The rewrites are pure, but the
|
|
4380
|
+
* platform (and its `styles` registry) is rebuilt per render, so without this they'd rerun on
|
|
4381
|
+
* every render.
|
|
4382
|
+
* @param style the component's style text
|
|
4383
|
+
* @param key what the rewrite depends on besides the text
|
|
4384
|
+
* @param rewrite computes the result
|
|
4385
|
+
* @returns the rewritten style
|
|
4386
|
+
*/
|
|
4387
|
+
const ssrCachedCss = (style, key, rewrite) => {
|
|
4388
|
+
if (typeof $stencilSsrCssCache === "undefined" || typeof style !== "string") return rewrite();
|
|
4389
|
+
let byKey = $stencilSsrCssCache.get(style);
|
|
4390
|
+
if (!byKey) {
|
|
4391
|
+
if ($stencilSsrCssCache.size >= SSR_CSS_CACHE_MAX) $stencilSsrCssCache.clear();
|
|
4392
|
+
$stencilSsrCssCache.set(style, byKey = /* @__PURE__ */ new Map());
|
|
4393
|
+
}
|
|
4394
|
+
let result = byKey.get(key);
|
|
4395
|
+
if (result === void 0) byKey.set(key, result = rewrite());
|
|
4396
|
+
return result;
|
|
4397
|
+
};
|
|
4329
4398
|
/**
|
|
4330
4399
|
* Initialize a Stencil component given a reference to its host element, its
|
|
4331
4400
|
* runtime bookkeeping data structure, runtime metadata about the component,
|
|
@@ -4426,8 +4495,8 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
4426
4495
|
if (!styles.has(scopeId) || BUILD$1.hotModuleReplacement && hmrVersionId) {
|
|
4427
4496
|
const endRegisterStyles = createTime("registerStyles", cmpMeta.$tagName$);
|
|
4428
4497
|
if (BUILD$1.hydrateServerSide && BUILD$1.shadowDom) {
|
|
4429
|
-
if (cmpMeta.$flags$ & CMP_FLAGS.shadowNeedsScopedCss) style = scopeCss(style, scopeId, true);
|
|
4430
|
-
else if (needsScopedSSR()) style = expandPartSelectors(style);
|
|
4498
|
+
if (cmpMeta.$flags$ & CMP_FLAGS.shadowNeedsScopedCss) style = ssrCachedCss(style, `s:${scopeId}`, () => scopeCss(style, scopeId, true));
|
|
4499
|
+
else if (needsScopedSSR()) style = ssrCachedCss(style, "p", () => expandPartSelectors(style));
|
|
4431
4500
|
}
|
|
4432
4501
|
registerStyle(scopeId, style, !!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation));
|
|
4433
4502
|
endRegisterStyles();
|
|
@@ -6788,8 +6788,9 @@ function getPrefixForNamespace(namespaceURI) {
|
|
|
6788
6788
|
return null;
|
|
6789
6789
|
}
|
|
6790
6790
|
const attrHandler = { get(obj, prop) {
|
|
6791
|
-
|
|
6792
|
-
if (typeof prop
|
|
6791
|
+
const value = obj[prop];
|
|
6792
|
+
if (value !== void 0 || typeof prop === "symbol") return value;
|
|
6793
|
+
if (!isNaN(prop)) return obj.__items[prop];
|
|
6793
6794
|
} };
|
|
6794
6795
|
const createAttributeProxy = (caseInsensitive) => new Proxy(new MockAttributeMap(caseInsensitive), attrHandler);
|
|
6795
6796
|
var MockAttributeMap = class {
|
|
@@ -6810,9 +6811,12 @@ var MockAttributeMap = class {
|
|
|
6810
6811
|
}
|
|
6811
6812
|
setNamedItemNS(attr) {
|
|
6812
6813
|
if (attr != null && attr.value != null) attr.value = String(attr.value);
|
|
6813
|
-
const
|
|
6814
|
-
|
|
6815
|
-
|
|
6814
|
+
const items = this.__items;
|
|
6815
|
+
for (let i = 0; i < items.length; i++) if (items[i].localName === attr.localName && items[i].namespaceURI === attr.namespaceURI) {
|
|
6816
|
+
items[i].value = attr.value;
|
|
6817
|
+
return;
|
|
6818
|
+
}
|
|
6819
|
+
items.push(attr);
|
|
6816
6820
|
}
|
|
6817
6821
|
getNamedItem(attrName) {
|
|
6818
6822
|
if (this.caseInsensitive) attrName = attrName.toLowerCase();
|
|
@@ -6820,14 +6824,20 @@ var MockAttributeMap = class {
|
|
|
6820
6824
|
}
|
|
6821
6825
|
getNamedItemNS(namespaceURI, attrName) {
|
|
6822
6826
|
namespaceURI = getNamespaceURI(namespaceURI);
|
|
6823
|
-
|
|
6827
|
+
const items = this.__items;
|
|
6828
|
+
for (let i = 0; i < items.length; i++) {
|
|
6829
|
+
const attr = items[i];
|
|
6830
|
+
if (attr.localName === attrName && getNamespaceURI(attr.namespaceURI) === namespaceURI) return attr;
|
|
6831
|
+
}
|
|
6832
|
+
return null;
|
|
6824
6833
|
}
|
|
6825
6834
|
removeNamedItem(attr) {
|
|
6826
6835
|
this.removeNamedItemNS(attr);
|
|
6827
6836
|
}
|
|
6828
6837
|
removeNamedItemNS(attr) {
|
|
6829
|
-
|
|
6830
|
-
|
|
6838
|
+
const items = this.__items;
|
|
6839
|
+
for (let i = 0, ii = items.length; i < ii; i++) if (items[i].localName === attr.localName && items[i].namespaceURI === attr.namespaceURI) {
|
|
6840
|
+
items.splice(i, 1);
|
|
6831
6841
|
break;
|
|
6832
6842
|
}
|
|
6833
6843
|
}
|
|
@@ -7640,8 +7650,7 @@ function normalizeSerializationOptions(opts = {}) {
|
|
|
7640
7650
|
* Serialize a node (either a DOM node or a mock-doc node) to an HTML string.
|
|
7641
7651
|
* This operation is similar to `outerHTML` but allows for more control over the
|
|
7642
7652
|
* serialization process. It is fully synchronous meaning that it will not
|
|
7643
|
-
* wait for a component to be fully rendered before serializing it.
|
|
7644
|
-
* for a streaming version of this function.
|
|
7653
|
+
* wait for a component to be fully rendered before serializing it.
|
|
7645
7654
|
*
|
|
7646
7655
|
* @param elm the node to serialize
|
|
7647
7656
|
* @param serializationOptions options to control serialization behavior
|
|
@@ -7655,27 +7664,21 @@ function serializeNodeToHtml(elm, serializationOptions = {}) {
|
|
|
7655
7664
|
isWithinBody: false,
|
|
7656
7665
|
text: []
|
|
7657
7666
|
};
|
|
7658
|
-
|
|
7667
|
+
const out = { html: "" };
|
|
7659
7668
|
const children = !opts.fullDocument && elm.body ? Array.from(elm.body.childNodes) : opts.outerHtml ? [elm] : Array.from(getChildNodes(elm));
|
|
7660
|
-
for (let i = 0, ii = children.length; i < ii; i++)
|
|
7661
|
-
|
|
7662
|
-
const chunks = Array.from(streamToHtml(child, opts, output));
|
|
7663
|
-
renderedNode += chunks.join("");
|
|
7664
|
-
}
|
|
7665
|
-
return renderedNode.trim();
|
|
7669
|
+
for (let i = 0, ii = children.length; i < ii; i++) serializeToBuffer(children[i], opts, output, out);
|
|
7670
|
+
return out.html.trim();
|
|
7666
7671
|
}
|
|
7667
7672
|
const shadowRootTag = "mock:shadow-root";
|
|
7668
7673
|
/**
|
|
7669
|
-
*
|
|
7670
|
-
* HTML in chunks. This is useful for streaming the serialized HTML to the client
|
|
7671
|
-
* as it is being generated.
|
|
7674
|
+
* Serializes a node and its subtree, appending to `out`.
|
|
7672
7675
|
*
|
|
7673
7676
|
* @param node the node to serialize
|
|
7674
7677
|
* @param opts options to control serialization behavior
|
|
7675
7678
|
* @param output keeps track of the current line width and indentation
|
|
7676
|
-
* @
|
|
7679
|
+
* @param out the buffer the HTML is appended to
|
|
7677
7680
|
*/
|
|
7678
|
-
function
|
|
7681
|
+
function serializeToBuffer(node, opts, output, out) {
|
|
7679
7682
|
const isShadowRoot = node.nodeType === 11;
|
|
7680
7683
|
if (node.nodeType === 1 || isShadowRoot) {
|
|
7681
7684
|
const tagName = isShadowRoot ? shadowRootTag : getTagName(node);
|
|
@@ -7684,15 +7687,15 @@ function* streamToHtml(node, opts, output) {
|
|
|
7684
7687
|
if (ignoreTag === false) {
|
|
7685
7688
|
const isWithinWhitespaceSensitiveNode = opts.newLines || (opts.indentSpaces ?? 0) > 0 ? isWithinWhitespaceSensitive(node) : false;
|
|
7686
7689
|
if (opts.newLines && !isWithinWhitespaceSensitiveNode) {
|
|
7687
|
-
|
|
7690
|
+
out.html += "\n";
|
|
7688
7691
|
output.currentLineWidth = 0;
|
|
7689
7692
|
}
|
|
7690
7693
|
if ((opts.indentSpaces ?? 0) > 0 && !isWithinWhitespaceSensitiveNode) {
|
|
7691
|
-
for (let i = 0; i < output.indent; i++)
|
|
7694
|
+
for (let i = 0; i < output.indent; i++) out.html += " ";
|
|
7692
7695
|
output.currentLineWidth += output.indent;
|
|
7693
7696
|
}
|
|
7694
7697
|
const tag = tagName === shadowRootTag ? "template" : tagName;
|
|
7695
|
-
|
|
7698
|
+
out.html += "<" + tag;
|
|
7696
7699
|
output.currentLineWidth += tag.length + 1;
|
|
7697
7700
|
/**
|
|
7698
7701
|
* ToDo(https://github.com/stenciljs/core/issues/4111): the shadow root class is `#document-fragment`
|
|
@@ -7700,23 +7703,23 @@ function* streamToHtml(node, opts, output) {
|
|
|
7700
7703
|
*/
|
|
7701
7704
|
if (tag === "template" && (!node.getAttribute || !node.getAttribute("shadowrootmode")) && ("host" in node || node.nodeName.toLocaleLowerCase() === shadowRootTag)) {
|
|
7702
7705
|
const mode = ` shadowrootmode="open"`;
|
|
7703
|
-
|
|
7706
|
+
out.html += mode;
|
|
7704
7707
|
output.currentLineWidth += mode.length;
|
|
7705
7708
|
if (node.delegatesFocus) {
|
|
7706
|
-
|
|
7709
|
+
out.html += " shadowrootdelegatesfocus";
|
|
7707
7710
|
output.currentLineWidth += 25;
|
|
7708
7711
|
}
|
|
7709
7712
|
if (node.clonable) {
|
|
7710
|
-
|
|
7713
|
+
out.html += " shadowrootclonable";
|
|
7711
7714
|
output.currentLineWidth += 19;
|
|
7712
7715
|
}
|
|
7713
7716
|
if (node.serializable) {
|
|
7714
|
-
|
|
7717
|
+
out.html += " shadowrootserializable";
|
|
7715
7718
|
output.currentLineWidth += 23;
|
|
7716
7719
|
}
|
|
7717
7720
|
if ("referenceTarget" in node && typeof node.referenceTarget === "string" && node.referenceTarget) {
|
|
7718
7721
|
const referenceTargetAttr = ` shadowrootreferencetarget="${escapeString(node.referenceTarget, true)}"`;
|
|
7719
|
-
|
|
7722
|
+
out.html += referenceTargetAttr;
|
|
7720
7723
|
output.currentLineWidth += referenceTargetAttr.length;
|
|
7721
7724
|
}
|
|
7722
7725
|
}
|
|
@@ -7734,25 +7737,25 @@ function* streamToHtml(node, opts, output) {
|
|
|
7734
7737
|
if (attrNamespaceURI == null) {
|
|
7735
7738
|
output.currentLineWidth += attrName.length + 1;
|
|
7736
7739
|
if (opts.approximateLineWidth && opts.approximateLineWidth > 0 && output.currentLineWidth > opts.approximateLineWidth) {
|
|
7737
|
-
|
|
7740
|
+
out.html += "\n" + attrName;
|
|
7738
7741
|
output.currentLineWidth = 0;
|
|
7739
|
-
} else
|
|
7742
|
+
} else out.html += " " + attrName;
|
|
7740
7743
|
} else if (attrNamespaceURI === "http://www.w3.org/XML/1998/namespace") {
|
|
7741
|
-
|
|
7744
|
+
out.html += " xml:" + attrLocalName;
|
|
7742
7745
|
output.currentLineWidth += attrLocalName.length + 5;
|
|
7743
7746
|
} else if (attrNamespaceURI === "http://www.w3.org/2000/xmlns/") {
|
|
7744
7747
|
if (attrLocalName !== "xmlns") {
|
|
7745
|
-
|
|
7748
|
+
out.html += " xmlns:" + attrLocalName;
|
|
7746
7749
|
output.currentLineWidth += attrLocalName.length + 7;
|
|
7747
7750
|
} else {
|
|
7748
|
-
|
|
7751
|
+
out.html += " " + attrLocalName;
|
|
7749
7752
|
output.currentLineWidth += attrLocalName.length + 1;
|
|
7750
7753
|
}
|
|
7751
7754
|
} else if (attrNamespaceURI === "http://www.w3.org/1999/xlink") {
|
|
7752
|
-
|
|
7755
|
+
out.html += " xlink:" + attrLocalName;
|
|
7753
7756
|
output.currentLineWidth += attrLocalName.length + 7;
|
|
7754
7757
|
} else {
|
|
7755
|
-
|
|
7758
|
+
out.html += " " + attrNamespaceURI + ":" + attrLocalName;
|
|
7756
7759
|
output.currentLineWidth += attrNamespaceURI.length + attrLocalName.length + 2;
|
|
7757
7760
|
}
|
|
7758
7761
|
if (opts.prettyHtml && attrName === "class") attrValue = attr.value = attrValue.split(" ").filter((t) => t !== "").sort().join(" ").trim();
|
|
@@ -7762,24 +7765,24 @@ function* streamToHtml(node, opts, output) {
|
|
|
7762
7765
|
if (opts.removeEmptyAttributes && attrName.startsWith("data-")) continue;
|
|
7763
7766
|
}
|
|
7764
7767
|
if (opts.removeAttributeQuotes && CAN_REMOVE_ATTR_QUOTES.test(attrValue)) {
|
|
7765
|
-
|
|
7768
|
+
out.html += "=" + escapeString(attrValue, true);
|
|
7766
7769
|
output.currentLineWidth += attrValue.length + 1;
|
|
7767
7770
|
} else {
|
|
7768
|
-
|
|
7771
|
+
out.html += "=\"" + escapeString(attrValue, true) + "\"";
|
|
7769
7772
|
output.currentLineWidth += attrValue.length + 3;
|
|
7770
7773
|
}
|
|
7771
7774
|
}
|
|
7772
7775
|
if (node.hasAttribute("style")) {
|
|
7773
7776
|
const cssText = node.style.cssText;
|
|
7774
7777
|
if (opts.approximateLineWidth && opts.approximateLineWidth > 0 && output.currentLineWidth + cssText.length + 10 > opts.approximateLineWidth) {
|
|
7775
|
-
|
|
7778
|
+
out.html += `\nstyle="${escapeString(cssText, true)}">`;
|
|
7776
7779
|
output.currentLineWidth = 0;
|
|
7777
7780
|
} else {
|
|
7778
|
-
|
|
7781
|
+
out.html += ` style="${escapeString(cssText, true)}">`;
|
|
7779
7782
|
output.currentLineWidth += cssText.length + 10;
|
|
7780
7783
|
}
|
|
7781
7784
|
} else {
|
|
7782
|
-
|
|
7785
|
+
out.html += ">";
|
|
7783
7786
|
output.currentLineWidth += 1;
|
|
7784
7787
|
}
|
|
7785
7788
|
}
|
|
@@ -7787,13 +7790,13 @@ function* streamToHtml(node, opts, output) {
|
|
|
7787
7790
|
const shadowRoot = node.shadowRoot;
|
|
7788
7791
|
if (shadowRoot != null && opts.serializeShadowRoot !== false) {
|
|
7789
7792
|
output.indent = output.indent + (opts.indentSpaces ?? 0);
|
|
7790
|
-
|
|
7793
|
+
serializeToBuffer(shadowRoot, opts, output, out);
|
|
7791
7794
|
output.indent = output.indent - (opts.indentSpaces ?? 0);
|
|
7792
7795
|
const childNodes = getChildNodes(node);
|
|
7793
7796
|
if (opts.newLines && (childNodes.length === 0 || childNodes.length === 1 && childNodes[0].nodeType === 3 && childNodes[0].nodeValue?.trim() === "" || hasOnlyRemovedComments(childNodes, opts))) {
|
|
7794
|
-
|
|
7797
|
+
out.html += "\n";
|
|
7795
7798
|
output.currentLineWidth = 0;
|
|
7796
|
-
for (let i = 0; i < output.indent; i++)
|
|
7799
|
+
for (let i = 0; i < output.indent; i++) out.html += " ";
|
|
7797
7800
|
output.currentLineWidth += output.indent;
|
|
7798
7801
|
}
|
|
7799
7802
|
}
|
|
@@ -7807,29 +7810,29 @@ function* streamToHtml(node, opts, output) {
|
|
|
7807
7810
|
if (!isWithinWhitespaceSensitiveNode && (opts.indentSpaces ?? 0) > 0 && ignoreTag === false) output.indent = output.indent + (opts.indentSpaces ?? 0);
|
|
7808
7811
|
for (let i = 0; i < childNodeLength; i++) {
|
|
7809
7812
|
if (childNodes[i].nodeName.toLowerCase() === "template" && node.attributes.getNamedItem("s-id")) continue;
|
|
7810
|
-
|
|
7813
|
+
serializeToBuffer(childNodes[i], opts, output, out);
|
|
7811
7814
|
}
|
|
7812
7815
|
if (ignoreTag === false) {
|
|
7813
7816
|
if (opts.newLines && !isWithinWhitespaceSensitiveNode) {
|
|
7814
|
-
|
|
7817
|
+
out.html += "\n";
|
|
7815
7818
|
output.currentLineWidth = 0;
|
|
7816
7819
|
}
|
|
7817
7820
|
if ((opts.indentSpaces ?? 0) > 0 && !isWithinWhitespaceSensitiveNode) {
|
|
7818
7821
|
output.indent = output.indent - (opts.indentSpaces ?? 0);
|
|
7819
|
-
for (let i = 0; i < output.indent; i++)
|
|
7822
|
+
for (let i = 0; i < output.indent; i++) out.html += " ";
|
|
7820
7823
|
output.currentLineWidth += output.indent;
|
|
7821
7824
|
}
|
|
7822
7825
|
}
|
|
7823
7826
|
}
|
|
7824
7827
|
}
|
|
7825
7828
|
if (ignoreTag === false) {
|
|
7826
|
-
|
|
7829
|
+
out.html += "</" + tag + ">";
|
|
7827
7830
|
output.currentLineWidth += tag.length + 3;
|
|
7828
7831
|
}
|
|
7829
7832
|
}
|
|
7830
7833
|
}
|
|
7831
7834
|
if ((opts.approximateLineWidth ?? 0) > 0 && STRUCTURE_ELEMENTS.has(tagName)) {
|
|
7832
|
-
|
|
7835
|
+
out.html += "\n";
|
|
7833
7836
|
output.currentLineWidth = 0;
|
|
7834
7837
|
}
|
|
7835
7838
|
if (tagName === "body") output.isWithinBody = false;
|
|
@@ -7839,37 +7842,37 @@ function* streamToHtml(node, opts, output) {
|
|
|
7839
7842
|
const trimmedTextContent = textContent.trim();
|
|
7840
7843
|
if (trimmedTextContent === "") {
|
|
7841
7844
|
if (isWithinWhitespaceSensitive(node)) {
|
|
7842
|
-
|
|
7845
|
+
out.html += textContent;
|
|
7843
7846
|
output.currentLineWidth += textContent.length;
|
|
7844
7847
|
} else if ((opts.approximateLineWidth ?? 0) > 0 && !output.isWithinBody) {} else if (!opts.prettyHtml) {
|
|
7845
7848
|
output.currentLineWidth += 1;
|
|
7846
7849
|
if (opts.approximateLineWidth && opts.approximateLineWidth > 0 && output.currentLineWidth > opts.approximateLineWidth) {
|
|
7847
|
-
|
|
7850
|
+
out.html += "\n";
|
|
7848
7851
|
output.currentLineWidth = 0;
|
|
7849
|
-
} else
|
|
7852
|
+
} else out.html += " ";
|
|
7850
7853
|
}
|
|
7851
7854
|
} else {
|
|
7852
7855
|
const isWithinWhitespaceSensitiveNode = opts.newLines || (opts.indentSpaces ?? 0) > 0 || opts.prettyHtml ? isWithinWhitespaceSensitive(node) : false;
|
|
7853
7856
|
if (opts.newLines && !isWithinWhitespaceSensitiveNode) {
|
|
7854
|
-
|
|
7857
|
+
out.html += "\n";
|
|
7855
7858
|
output.currentLineWidth = 0;
|
|
7856
7859
|
}
|
|
7857
7860
|
if ((opts.indentSpaces ?? 0) > 0 && !isWithinWhitespaceSensitiveNode) {
|
|
7858
|
-
for (let i = 0; i < output.indent; i++)
|
|
7861
|
+
for (let i = 0; i < output.indent; i++) out.html += " ";
|
|
7859
7862
|
output.currentLineWidth += output.indent;
|
|
7860
7863
|
}
|
|
7861
7864
|
let textContentLength = textContent.length;
|
|
7862
7865
|
if (textContentLength > 0) {
|
|
7863
7866
|
const parentTagName = node.parentNode != null && node.parentNode.nodeType === 1 ? node.parentNode.nodeName : null;
|
|
7864
7867
|
if (typeof parentTagName === "string" && NON_ESCAPABLE_CONTENT.has(parentTagName)) {
|
|
7865
|
-
if (isWithinWhitespaceSensitive(node))
|
|
7868
|
+
if (isWithinWhitespaceSensitive(node)) out.html += textContent;
|
|
7866
7869
|
else {
|
|
7867
|
-
|
|
7870
|
+
out.html += trimmedTextContent;
|
|
7868
7871
|
textContentLength = trimmedTextContent.length;
|
|
7869
7872
|
}
|
|
7870
7873
|
output.currentLineWidth += textContentLength;
|
|
7871
7874
|
} else if (opts.prettyHtml && !isWithinWhitespaceSensitiveNode) {
|
|
7872
|
-
|
|
7875
|
+
out.html += escapeString(textContent.replace(/\s\s+/g, " ").trim(), false);
|
|
7873
7876
|
output.currentLineWidth += textContentLength;
|
|
7874
7877
|
} else {
|
|
7875
7878
|
if (isWithinWhitespaceSensitive(node)) output.currentLineWidth += textContentLength;
|
|
@@ -7886,7 +7889,7 @@ function* streamToHtml(node, opts, output) {
|
|
|
7886
7889
|
}
|
|
7887
7890
|
output.currentLineWidth += textContentLength;
|
|
7888
7891
|
}
|
|
7889
|
-
|
|
7892
|
+
out.html += escapeString(textContent, false);
|
|
7890
7893
|
}
|
|
7891
7894
|
}
|
|
7892
7895
|
}
|
|
@@ -7900,16 +7903,16 @@ function* streamToHtml(node, opts, output) {
|
|
|
7900
7903
|
if (isRemovedComment(node, opts)) return;
|
|
7901
7904
|
const isWithinWhitespaceSensitiveNode = opts.newLines || (opts.indentSpaces ?? 0) > 0 ? isWithinWhitespaceSensitive(node) : false;
|
|
7902
7905
|
if (opts.newLines && !isWithinWhitespaceSensitiveNode) {
|
|
7903
|
-
|
|
7906
|
+
out.html += "\n";
|
|
7904
7907
|
output.currentLineWidth = 0;
|
|
7905
7908
|
}
|
|
7906
7909
|
if ((opts.indentSpaces ?? 0) > 0 && !isWithinWhitespaceSensitiveNode) {
|
|
7907
|
-
for (let i = 0; i < output.indent; i++)
|
|
7910
|
+
for (let i = 0; i < output.indent; i++) out.html += " ";
|
|
7908
7911
|
output.currentLineWidth += output.indent;
|
|
7909
7912
|
}
|
|
7910
|
-
|
|
7913
|
+
out.html += "<!--" + nodeValue + "-->";
|
|
7911
7914
|
if (nodeValue) output.currentLineWidth += nodeValue.length + 7;
|
|
7912
|
-
} else if (node.nodeType === 10)
|
|
7915
|
+
} else if (node.nodeType === 10) out.html += "<!doctype html>";
|
|
7913
7916
|
}
|
|
7914
7917
|
const AMP_REGEX = /&/g;
|
|
7915
7918
|
const NBSP_REGEX = /\u00a0/g;
|
|
@@ -7921,7 +7924,10 @@ function getTagName(element) {
|
|
|
7921
7924
|
if (element.namespaceURI === "http://www.w3.org/1999/xhtml") return element.nodeName.toLowerCase();
|
|
7922
7925
|
else return element.nodeName;
|
|
7923
7926
|
}
|
|
7927
|
+
const ATTR_NEEDS_ESCAPE = /[&\u00a0"]/;
|
|
7928
|
+
const TEXT_NEEDS_ESCAPE = /[&\u00a0<>]/;
|
|
7924
7929
|
function escapeString(str, attrMode) {
|
|
7930
|
+
if (!(attrMode ? ATTR_NEEDS_ESCAPE : TEXT_NEEDS_ESCAPE).test(str)) return str;
|
|
7925
7931
|
str = str.replace(AMP_REGEX, "&").replace(NBSP_REGEX, " ");
|
|
7926
7932
|
if (attrMode) return str.replace(DOUBLE_QUOTE_REGEX, """);
|
|
7927
7933
|
return str.replace(LT_REGEX, "<").replace(GT_REGEX, ">");
|
|
@@ -8438,10 +8444,16 @@ var MockElement = class extends MockNode {
|
|
|
8438
8444
|
this.__attributeMap = attrs;
|
|
8439
8445
|
}
|
|
8440
8446
|
get children() {
|
|
8441
|
-
|
|
8447
|
+
const nodes = this.childNodes;
|
|
8448
|
+
const elements = [];
|
|
8449
|
+
for (let i = 0; i < nodes.length; i++) if (nodes[i].nodeType === 1) elements.push(nodes[i]);
|
|
8450
|
+
return elements;
|
|
8442
8451
|
}
|
|
8443
8452
|
get childElementCount() {
|
|
8444
|
-
|
|
8453
|
+
const nodes = this.childNodes;
|
|
8454
|
+
let count = 0;
|
|
8455
|
+
for (let i = 0; i < nodes.length; i++) if (nodes[i].nodeType === 1) count++;
|
|
8456
|
+
return count;
|
|
8445
8457
|
}
|
|
8446
8458
|
get className() {
|
|
8447
8459
|
return this.getAttributeNS(null, "class") || "";
|
|
@@ -8484,7 +8496,9 @@ var MockElement = class extends MockNode {
|
|
|
8484
8496
|
return dispatchEvent(this, ev);
|
|
8485
8497
|
}
|
|
8486
8498
|
get firstElementChild() {
|
|
8487
|
-
|
|
8499
|
+
const nodes = this.childNodes;
|
|
8500
|
+
for (let i = 0; i < nodes.length; i++) if (nodes[i].nodeType === 1) return nodes[i];
|
|
8501
|
+
return null;
|
|
8488
8502
|
}
|
|
8489
8503
|
focus(_options) {
|
|
8490
8504
|
dispatchEvent(this, new MockFocusEvent("focus", {
|
package/dist/signals/index.js
CHANGED
package/dist/sys/node/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as setupNodeProcess, r as createNodeLogger, t as createNodeSys } from "../../node-
|
|
1
|
+
import { n as setupNodeProcess, r as createNodeLogger, t as createNodeSys } from "../../node-IRt_dGbC.mjs";
|
|
2
2
|
export { createNodeLogger, createNodeSys, setupNodeProcess };
|
package/dist/sys/node/worker.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { l as createWorkerMessageHandler } from "../../compiler-
|
|
2
|
-
import { t as createNodeSys } from "../../node-
|
|
1
|
+
import { l as createWorkerMessageHandler } from "../../compiler-D6kG51sR.mjs";
|
|
2
|
+
import { t as createNodeSys } from "../../node-IRt_dGbC.mjs";
|
|
3
3
|
//#region src/sys/node/node-worker-thread.ts
|
|
4
4
|
/**
|
|
5
5
|
* Initialize a worker thread, setting up various machinery for managing
|
package/dist/testing/index.d.mts
CHANGED
|
@@ -3094,7 +3094,6 @@ interface BuildFeatures {
|
|
|
3094
3094
|
patchInsert: boolean;
|
|
3095
3095
|
slot: boolean;
|
|
3096
3096
|
svg: boolean;
|
|
3097
|
-
element: boolean;
|
|
3098
3097
|
event: boolean;
|
|
3099
3098
|
hostListener: boolean;
|
|
3100
3099
|
hostListenerTargetWindow: boolean;
|
|
@@ -3464,7 +3463,6 @@ interface ComponentCompilerFeatures {
|
|
|
3464
3463
|
hasConnectedCallbackFn: boolean;
|
|
3465
3464
|
hasDeserializer: boolean;
|
|
3466
3465
|
hasDisconnectedCallbackFn: boolean;
|
|
3467
|
-
hasElement: boolean;
|
|
3468
3466
|
hasEvent: boolean;
|
|
3469
3467
|
hasLifecycle: boolean;
|
|
3470
3468
|
hasListener: boolean;
|