@stencil/core 4.45.5 → 4.45.6-dev.1796015241.176b027

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.
Files changed (40) hide show
  1. package/cli/index.cjs +1 -1
  2. package/cli/index.js +1 -1
  3. package/cli/package.json +1 -1
  4. package/compiler/package.json +1 -1
  5. package/compiler/stencil.js +109 -73
  6. package/dev-server/client/index.js +1 -1
  7. package/dev-server/client/package.json +1 -1
  8. package/dev-server/connector.html +2 -2
  9. package/dev-server/index.js +1 -1
  10. package/dev-server/package.json +1 -1
  11. package/dev-server/server-process.js +2 -2
  12. package/internal/app-data/package.json +1 -1
  13. package/internal/app-globals/package.json +1 -1
  14. package/internal/client/index.js +6 -3
  15. package/internal/client/package.json +1 -1
  16. package/internal/client/patch-browser.js +1 -1
  17. package/internal/hydrate/index.js +6 -3
  18. package/internal/hydrate/package.json +1 -1
  19. package/internal/hydrate/runner.js +78 -5
  20. package/internal/package.json +1 -1
  21. package/internal/stencil-core/index.js +2 -0
  22. package/internal/stencil-public-compiler.d.ts +8 -0
  23. package/internal/stencil-public-runtime.d.ts +51 -0
  24. package/internal/testing/index.js +5 -2
  25. package/internal/testing/package.json +1 -1
  26. package/mock-doc/index.cjs +78 -5
  27. package/mock-doc/index.d.ts +7 -2
  28. package/mock-doc/index.js +78 -5
  29. package/mock-doc/package.json +1 -1
  30. package/package.json +1 -1
  31. package/screenshot/index.js +1 -1
  32. package/screenshot/package.json +1 -1
  33. package/screenshot/pixel-match.js +1 -1
  34. package/sys/node/index.js +9 -9
  35. package/sys/node/package.json +1 -1
  36. package/sys/node/worker.js +1 -1
  37. package/testing/index.js +6 -1
  38. package/testing/package.json +1 -1
  39. package/testing/puppeteer/puppeteer-element.d.ts +1 -1
  40. package/testing/puppeteer/test/puppeteer-browser.spec.d.ts +1 -0
package/mock-doc/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Stencil Mock Doc v4.45.5 | MIT Licensed | https://stenciljs.com
2
+ Stencil Mock Doc v4.45.6-dev.1796015241.176b027 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  var __defProp = Object.defineProperty;
5
5
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
@@ -210,7 +210,7 @@ var MockCSSStyleDeclaration = class {
210
210
  this._styles.clear();
211
211
  return;
212
212
  }
213
- cssText.split(";").forEach((rule) => {
213
+ splitDeclarations(cssText).forEach((rule) => {
214
214
  rule = rule.trim();
215
215
  if (rule.length > 0) {
216
216
  const splt = rule.split(":");
@@ -225,6 +225,39 @@ var MockCSSStyleDeclaration = class {
225
225
  });
226
226
  }
227
227
  };
228
+ function splitDeclarations(cssText) {
229
+ const declarations = [];
230
+ let current = "";
231
+ let depth = 0;
232
+ let quote = "";
233
+ for (let i = 0; i < cssText.length; i++) {
234
+ const char = cssText[i];
235
+ if (char === "\\" && i + 1 < cssText.length) {
236
+ current += char + cssText[++i];
237
+ continue;
238
+ }
239
+ if (quote) {
240
+ if (char === quote) {
241
+ quote = "";
242
+ }
243
+ } else if (char === '"' || char === "'") {
244
+ quote = char;
245
+ } else if (char === "(") {
246
+ depth++;
247
+ } else if (char === ")") {
248
+ if (depth > 0) {
249
+ depth--;
250
+ }
251
+ } else if (char === ";" && depth === 0) {
252
+ declarations.push(current);
253
+ current = "";
254
+ continue;
255
+ }
256
+ current += char;
257
+ }
258
+ declarations.push(current);
259
+ return declarations;
260
+ }
228
261
  function createCSSStyleDeclaration() {
229
262
  return new Proxy(new MockCSSStyleDeclaration(), cssProxyHandler);
230
263
  }
@@ -6236,7 +6269,7 @@ style="${escapeString(cssText, true)}">`;
6236
6269
  yield* streamToHtml(shadowRoot, opts, output);
6237
6270
  output.indent = output.indent - ((_d = opts.indentSpaces) != null ? _d : 0);
6238
6271
  const childNodes = getChildNodes(node);
6239
- if (opts.newLines && (childNodes.length === 0 || childNodes.length === 1 && childNodes[0].nodeType === 3 /* TEXT_NODE */ && ((_e = childNodes[0].nodeValue) == null ? void 0 : _e.trim()) === "")) {
6272
+ if (opts.newLines && (childNodes.length === 0 || childNodes.length === 1 && childNodes[0].nodeType === 3 /* TEXT_NODE */ && ((_e = childNodes[0].nodeValue) == null ? void 0 : _e.trim()) === "" || hasOnlyRemovedComments(childNodes, opts))) {
6240
6273
  yield "\n";
6241
6274
  output.currentLineWidth = 0;
6242
6275
  for (let i = 0; i < output.indent; i++) {
@@ -6251,6 +6284,7 @@ style="${escapeString(cssText, true)}">`;
6251
6284
  const childNodeLength = childNodes.length;
6252
6285
  if (childNodeLength > 0) {
6253
6286
  if (childNodeLength === 1 && childNodes[0].nodeType === 3 /* TEXT_NODE */ && (typeof childNodes[0].nodeValue !== "string" || childNodes[0].nodeValue.trim() === "")) {
6287
+ } else if (hasOnlyRemovedComments(childNodes, opts)) {
6254
6288
  } else {
6255
6289
  const isWithinWhitespaceSensitiveNode = opts.newLines || ((_f = opts.indentSpaces) != null ? _f : 0) > 0 ? isWithinWhitespaceSensitive(node) : false;
6256
6290
  if (!isWithinWhitespaceSensitiveNode && ((_g = opts.indentSpaces) != null ? _g : 0) > 0 && ignoreTag === false) {
@@ -6367,8 +6401,7 @@ ${" ".repeat(output.indent)}<!--r.${sId.value}-->`;
6367
6401
  }
6368
6402
  } else if (node.nodeType === 8 /* COMMENT_NODE */) {
6369
6403
  const nodeValue = node.nodeValue;
6370
- const isHydrateAnnotation = (nodeValue == null ? void 0 : nodeValue.startsWith(CONTENT_REF_ID + ".")) || (nodeValue == null ? void 0 : nodeValue.startsWith(ORG_LOCATION_ID + ".")) || (nodeValue == null ? void 0 : nodeValue.startsWith(SLOT_NODE_ID + ".")) || (nodeValue == null ? void 0 : nodeValue.startsWith(TEXT_NODE_ID + "."));
6371
- if (opts.removeHtmlComments && !isHydrateAnnotation) {
6404
+ if (isRemovedComment(node, opts)) {
6372
6405
  return;
6373
6406
  }
6374
6407
  const isWithinWhitespaceSensitiveNode = opts.newLines || ((_o = opts.indentSpaces) != null ? _o : 0) > 0 ? isWithinWhitespaceSensitive(node) : false;
@@ -6420,6 +6453,26 @@ function isWithinWhitespaceSensitive(node) {
6420
6453
  }
6421
6454
  return false;
6422
6455
  }
6456
+ function isRemovedComment(node, opts) {
6457
+ if (node.nodeType !== 8 /* COMMENT_NODE */ || !opts.removeHtmlComments) {
6458
+ return false;
6459
+ }
6460
+ const nodeValue = node.nodeValue;
6461
+ const isHydrateAnnotation = (nodeValue == null ? void 0 : nodeValue.startsWith(CONTENT_REF_ID + ".")) || (nodeValue == null ? void 0 : nodeValue.startsWith(ORG_LOCATION_ID + ".")) || (nodeValue == null ? void 0 : nodeValue.startsWith(SLOT_NODE_ID + ".")) || (nodeValue == null ? void 0 : nodeValue.startsWith(TEXT_NODE_ID + "."));
6462
+ return !isHydrateAnnotation;
6463
+ }
6464
+ function hasOnlyRemovedComments(childNodes, opts) {
6465
+ let hasRemovedComment = false;
6466
+ for (let i = 0; i < childNodes.length; i++) {
6467
+ const childNode = childNodes[i];
6468
+ if (isRemovedComment(childNode, opts)) {
6469
+ hasRemovedComment = true;
6470
+ } else if (childNode.nodeType !== 3 /* TEXT_NODE */ || typeof childNode.nodeValue === "string" && childNode.nodeValue.trim() !== "") {
6471
+ return false;
6472
+ }
6473
+ }
6474
+ return hasRemovedComment;
6475
+ }
6423
6476
  function getChildNodes(node) {
6424
6477
  return node.__childNodes || node.childNodes;
6425
6478
  }
@@ -7262,6 +7315,19 @@ var MockElement = class extends MockNode2 {
7262
7315
  set title(value) {
7263
7316
  this.setAttributeNS(null, "title", value);
7264
7317
  }
7318
+ toggleAttribute(attrName, force) {
7319
+ const has = this.hasAttribute(attrName);
7320
+ if (force != null ? force : !has) {
7321
+ if (!has) {
7322
+ this.setAttribute(attrName, "");
7323
+ }
7324
+ return true;
7325
+ }
7326
+ if (has) {
7327
+ this.removeAttribute(attrName);
7328
+ }
7329
+ return false;
7330
+ }
7265
7331
  animate() {
7266
7332
  }
7267
7333
  onanimationstart() {
@@ -8406,6 +8472,13 @@ function getLabelsForElement(elm) {
8406
8472
  parent = parent.parentNode;
8407
8473
  }
8408
8474
  }
8475
+ Object.defineProperty(labels, "item", {
8476
+ value: (index) => {
8477
+ var _a;
8478
+ return (_a = labels[index]) != null ? _a : null;
8479
+ },
8480
+ enumerable: false
8481
+ });
8409
8482
  return labels;
8410
8483
  }
8411
8484
  function patchPropAttributes(prototype, attrs, defaults = {}) {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/mock-doc",
3
- "version": "4.45.5",
3
+ "version": "4.45.6-dev.1796015241.176b027",
4
4
  "description": "Mock window, document and DOM outside of a browser environment.",
5
5
  "main": "./index.cjs",
6
6
  "module": "./index.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core",
3
- "version": "4.45.5",
3
+ "version": "4.45.6-dev.1796015241.176b027",
4
4
  "license": "MIT",
5
5
  "main": "./internal/stencil-core/index.cjs",
6
6
  "module": "./internal/stencil-core/index.js",
@@ -1,5 +1,5 @@
1
1
  /*
2
- Stencil Screenshot v4.45.5 | MIT Licensed | https://stenciljs.com
2
+ Stencil Screenshot v4.45.6-dev.1796015241.176b027 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  "use strict";
5
5
  var __create = Object.create;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/screenshot",
3
- "version": "4.45.5",
3
+ "version": "4.45.6-dev.1796015241.176b027",
4
4
  "description": "Stencil Screenshot.",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
@@ -1,5 +1,5 @@
1
1
  /*
2
- Stencil Screenshot Pixel Match v4.45.5 | MIT Licensed | https://stenciljs.com
2
+ Stencil Screenshot Pixel Match v4.45.6-dev.1796015241.176b027 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  "use strict";
5
5
  var __create = Object.create;