@stencil/core 5.0.0-rc.1 → 5.0.0-rc.11
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/{client-BMtGBEQV.mjs → client-QadqfKfL.mjs} +32 -17
- package/dist/compiler/browser.d.ts +28 -5
- package/dist/compiler/browser.js +102 -19
- package/dist/compiler/index.d.mts +2 -2
- package/dist/compiler/index.mjs +2 -2
- package/dist/compiler/utils/index.d.mts +1 -1
- package/dist/compiler/utils/index.mjs +3 -3
- package/dist/{compiler-C_Y38j4m.mjs → compiler-DlA2VsX7.mjs} +335 -130
- package/dist/declarations/stencil-public-compiler.d.ts +30 -7
- package/dist/{helpers-pTCZhNi0.mjs → helpers-k8xQHE77.mjs} +5 -1
- package/dist/{index-CFiy6MZ3.d.mts → index-BDAZsQzV.d.mts} +34 -7
- package/dist/{index-CViiWNQ9.d.mts → index-BS1JKKvz.d.mts} +1 -1
- package/dist/index.mjs +1 -1
- package/dist/jsx-runtime.mjs +1 -1
- package/dist/{node-Bkq8vRnu.mjs → node-BR2GYgzY.mjs} +3 -3
- package/dist/runtime/client/lazy.js +231 -178
- package/dist/runtime/client/runtime.js +231 -178
- package/dist/runtime/index.js +231 -178
- package/dist/runtime/server/index.mjs +231 -178
- package/dist/runtime/server/runner.mjs +82 -7
- 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 +5 -0
- package/dist/testing/index.mjs +228 -177
- package/dist/{util-CP6-333M.mjs → util-Cj2D3x_h.mjs} +1 -1
- package/dist/{validation-C1mr0klL.mjs → validation-GfBzquhJ.mjs} +2 -2
- package/package.json +4 -4
|
@@ -6972,7 +6972,7 @@ var MockCSSStyleDeclaration = class {
|
|
|
6972
6972
|
this._styles.clear();
|
|
6973
6973
|
return;
|
|
6974
6974
|
}
|
|
6975
|
-
cssText
|
|
6975
|
+
splitDeclarations(cssText).forEach((rule) => {
|
|
6976
6976
|
rule = rule.trim();
|
|
6977
6977
|
if (rule.length > 0) {
|
|
6978
6978
|
const splt = rule.split(":");
|
|
@@ -6985,6 +6985,41 @@ var MockCSSStyleDeclaration = class {
|
|
|
6985
6985
|
});
|
|
6986
6986
|
}
|
|
6987
6987
|
};
|
|
6988
|
+
/**
|
|
6989
|
+
* Splits a CSS declaration list at its top-level semicolons. A semicolon inside
|
|
6990
|
+
* parentheses (e.g. the `;base64,` in `url(data:image/png;base64,...)`) or inside
|
|
6991
|
+
* a quoted string does not end a declaration.
|
|
6992
|
+
*
|
|
6993
|
+
* @param cssText the declaration list, such as the value of a `style` attribute
|
|
6994
|
+
* @returns the individual declarations, without their separating semicolons
|
|
6995
|
+
*/
|
|
6996
|
+
function splitDeclarations(cssText) {
|
|
6997
|
+
const declarations = [];
|
|
6998
|
+
let current = "";
|
|
6999
|
+
let depth = 0;
|
|
7000
|
+
let quote = "";
|
|
7001
|
+
for (let i = 0; i < cssText.length; i++) {
|
|
7002
|
+
const char = cssText[i];
|
|
7003
|
+
if (char === "\\" && i + 1 < cssText.length) {
|
|
7004
|
+
current += char + cssText[++i];
|
|
7005
|
+
continue;
|
|
7006
|
+
}
|
|
7007
|
+
if (quote) {
|
|
7008
|
+
if (char === quote) quote = "";
|
|
7009
|
+
} else if (char === "\"" || char === "'") quote = char;
|
|
7010
|
+
else if (char === "(") depth++;
|
|
7011
|
+
else if (char === ")") {
|
|
7012
|
+
if (depth > 0) depth--;
|
|
7013
|
+
} else if (char === ";" && depth === 0) {
|
|
7014
|
+
declarations.push(current);
|
|
7015
|
+
current = "";
|
|
7016
|
+
continue;
|
|
7017
|
+
}
|
|
7018
|
+
current += char;
|
|
7019
|
+
}
|
|
7020
|
+
declarations.push(current);
|
|
7021
|
+
return declarations;
|
|
7022
|
+
}
|
|
6988
7023
|
function createCSSStyleDeclaration() {
|
|
6989
7024
|
return new Proxy(new MockCSSStyleDeclaration(), cssProxyHandler);
|
|
6990
7025
|
}
|
|
@@ -7737,10 +7772,10 @@ function* streamToHtml(node, opts, output) {
|
|
|
7737
7772
|
if (node.hasAttribute("style")) {
|
|
7738
7773
|
const cssText = node.style.cssText;
|
|
7739
7774
|
if (opts.approximateLineWidth && opts.approximateLineWidth > 0 && output.currentLineWidth + cssText.length + 10 > opts.approximateLineWidth) {
|
|
7740
|
-
yield `\nstyle="${cssText}">`;
|
|
7775
|
+
yield `\nstyle="${escapeString(cssText, true)}">`;
|
|
7741
7776
|
output.currentLineWidth = 0;
|
|
7742
7777
|
} else {
|
|
7743
|
-
yield ` style="${cssText}">`;
|
|
7778
|
+
yield ` style="${escapeString(cssText, true)}">`;
|
|
7744
7779
|
output.currentLineWidth += cssText.length + 10;
|
|
7745
7780
|
}
|
|
7746
7781
|
} else {
|
|
@@ -7755,7 +7790,7 @@ function* streamToHtml(node, opts, output) {
|
|
|
7755
7790
|
yield* streamToHtml(shadowRoot, opts, output);
|
|
7756
7791
|
output.indent = output.indent - (opts.indentSpaces ?? 0);
|
|
7757
7792
|
const childNodes = getChildNodes(node);
|
|
7758
|
-
if (opts.newLines && (childNodes.length === 0 || childNodes.length === 1 && childNodes[0].nodeType === 3 && childNodes[0].nodeValue?.trim() === "")) {
|
|
7793
|
+
if (opts.newLines && (childNodes.length === 0 || childNodes.length === 1 && childNodes[0].nodeType === 3 && childNodes[0].nodeValue?.trim() === "" || hasOnlyRemovedComments(childNodes, opts))) {
|
|
7759
7794
|
yield "\n";
|
|
7760
7795
|
output.currentLineWidth = 0;
|
|
7761
7796
|
for (let i = 0; i < output.indent; i++) yield " ";
|
|
@@ -7767,7 +7802,7 @@ function* streamToHtml(node, opts, output) {
|
|
|
7767
7802
|
const childNodes = tagName === "template" ? node.content.childNodes : getChildNodes(node);
|
|
7768
7803
|
const childNodeLength = childNodes.length;
|
|
7769
7804
|
if (childNodeLength > 0) {
|
|
7770
|
-
if (childNodeLength === 1 && childNodes[0].nodeType === 3 && (typeof childNodes[0].nodeValue !== "string" || childNodes[0].nodeValue.trim() === "")) {} else {
|
|
7805
|
+
if (childNodeLength === 1 && childNodes[0].nodeType === 3 && (typeof childNodes[0].nodeValue !== "string" || childNodes[0].nodeValue.trim() === "")) {} else if (hasOnlyRemovedComments(childNodes, opts)) {} else {
|
|
7771
7806
|
const isWithinWhitespaceSensitiveNode = opts.newLines || (opts.indentSpaces ?? 0) > 0 ? isWithinWhitespaceSensitive(node) : false;
|
|
7772
7807
|
if (!isWithinWhitespaceSensitiveNode && (opts.indentSpaces ?? 0) > 0 && ignoreTag === false) output.indent = output.indent + (opts.indentSpaces ?? 0);
|
|
7773
7808
|
for (let i = 0; i < childNodeLength; i++) {
|
|
@@ -7858,12 +7893,11 @@ function* streamToHtml(node, opts, output) {
|
|
|
7858
7893
|
}
|
|
7859
7894
|
} else if (node.nodeType === 8) {
|
|
7860
7895
|
const nodeValue = node.nodeValue;
|
|
7861
|
-
const isHydrateAnnotation = nodeValue?.startsWith("r.") || nodeValue?.startsWith("o.") || nodeValue?.startsWith("s.") || nodeValue?.startsWith("t.");
|
|
7862
7896
|
/**
|
|
7863
7897
|
* remove comments from stringified output if user set the `removeHtmlComments` e.g.
|
|
7864
7898
|
* in the `renderToString` function and we are no dealing with a hydrate annotation
|
|
7865
7899
|
*/
|
|
7866
|
-
if (opts
|
|
7900
|
+
if (isRemovedComment(node, opts)) return;
|
|
7867
7901
|
const isWithinWhitespaceSensitiveNode = opts.newLines || (opts.indentSpaces ?? 0) > 0 ? isWithinWhitespaceSensitive(node) : false;
|
|
7868
7902
|
if (opts.newLines && !isWithinWhitespaceSensitiveNode) {
|
|
7869
7903
|
yield "\n";
|
|
@@ -7909,6 +7943,38 @@ function isWithinWhitespaceSensitive(node) {
|
|
|
7909
7943
|
return false;
|
|
7910
7944
|
}
|
|
7911
7945
|
/**
|
|
7946
|
+
* Determine whether a comment node is left out of the serialized output, which
|
|
7947
|
+
* happens when `removeHtmlComments` is set and the comment is not a hydrate
|
|
7948
|
+
* annotation.
|
|
7949
|
+
*
|
|
7950
|
+
* @param node a node to check
|
|
7951
|
+
* @param opts serialization options
|
|
7952
|
+
* @returns whether or not the node is a comment that will not be serialized
|
|
7953
|
+
*/
|
|
7954
|
+
function isRemovedComment(node, opts) {
|
|
7955
|
+
if (node.nodeType !== 8 || !opts.removeHtmlComments) return false;
|
|
7956
|
+
const nodeValue = node.nodeValue;
|
|
7957
|
+
return !(nodeValue?.startsWith("r.") || nodeValue?.startsWith("o.") || nodeValue?.startsWith("s.") || nodeValue?.startsWith("t."));
|
|
7958
|
+
}
|
|
7959
|
+
/**
|
|
7960
|
+
* Determine whether a list of child nodes contains at least one comment that is
|
|
7961
|
+
* removed from the output and otherwise only whitespace text, so that serializing
|
|
7962
|
+
* it produces no content.
|
|
7963
|
+
*
|
|
7964
|
+
* @param childNodes the child nodes to check
|
|
7965
|
+
* @param opts serialization options
|
|
7966
|
+
* @returns whether or not the child nodes serialize to nothing
|
|
7967
|
+
*/
|
|
7968
|
+
function hasOnlyRemovedComments(childNodes, opts) {
|
|
7969
|
+
let hasRemovedComment = false;
|
|
7970
|
+
for (let i = 0; i < childNodes.length; i++) {
|
|
7971
|
+
const childNode = childNodes[i];
|
|
7972
|
+
if (isRemovedComment(childNode, opts)) hasRemovedComment = true;
|
|
7973
|
+
else if (childNode.nodeType !== 3 || typeof childNode.nodeValue === "string" && childNode.nodeValue.trim() !== "") return false;
|
|
7974
|
+
}
|
|
7975
|
+
return hasRemovedComment;
|
|
7976
|
+
}
|
|
7977
|
+
/**
|
|
7912
7978
|
* Normalizes the `childNodes` of a node due to if `experimentalSlotFixes` is enabled, `
|
|
7913
7979
|
* childNodes` will only return 'slotted' / lightDOM nodes
|
|
7914
7980
|
*
|
|
@@ -8711,6 +8777,15 @@ var MockElement = class extends MockNode {
|
|
|
8711
8777
|
set title(value) {
|
|
8712
8778
|
this.setAttributeNS(null, "title", value);
|
|
8713
8779
|
}
|
|
8780
|
+
toggleAttribute(attrName, force) {
|
|
8781
|
+
const has = this.hasAttribute(attrName);
|
|
8782
|
+
if (force ?? !has) {
|
|
8783
|
+
if (!has) this.setAttribute(attrName, "");
|
|
8784
|
+
return true;
|
|
8785
|
+
}
|
|
8786
|
+
if (has) this.removeAttribute(attrName);
|
|
8787
|
+
return false;
|
|
8788
|
+
}
|
|
8714
8789
|
animate() {}
|
|
8715
8790
|
onanimationstart() {}
|
|
8716
8791
|
onanimationend() {}
|
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-BR2GYgzY.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-DlA2VsX7.mjs";
|
|
2
|
+
import { t as createNodeSys } from "../../node-BR2GYgzY.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
|
@@ -3518,6 +3518,11 @@ interface ComponentCompilerFeatures {
|
|
|
3518
3518
|
* - any lifecycle methods, including `render()`
|
|
3519
3519
|
*/
|
|
3520
3520
|
isPlain: boolean;
|
|
3521
|
+
/**
|
|
3522
|
+
* `true` for a CSS-only component: a `@component`-marked stylesheet with no backing JS
|
|
3523
|
+
* class. The element is never defined/upgraded, so it only has the attributes its CSS reads.
|
|
3524
|
+
*/
|
|
3525
|
+
isCssOnly: boolean;
|
|
3521
3526
|
/**
|
|
3522
3527
|
* A collection of tag names of web components that a component references in its JSX/h() function
|
|
3523
3528
|
*/
|