@stencil/core 4.18.3 → 4.19.0

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 (47) hide show
  1. package/cli/index.cjs +43 -16
  2. package/cli/index.js +43 -16
  3. package/cli/package.json +1 -1
  4. package/compiler/package.json +1 -1
  5. package/compiler/stencil.js +175 -72
  6. package/dev-server/client/index.js +1 -1
  7. package/dev-server/client/package.json +1 -1
  8. package/dev-server/connector.html +3 -3
  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/dev-server/ws.js +1 -1
  13. package/internal/app-data/package.json +1 -1
  14. package/internal/client/index.js +534 -507
  15. package/internal/client/package.json +3 -1
  16. package/internal/client/patch-browser.js +1 -1
  17. package/internal/hydrate/index.js +108 -50
  18. package/internal/hydrate/package.json +1 -1
  19. package/internal/hydrate/runner.d.ts +29 -11
  20. package/internal/hydrate/runner.js +239 -260
  21. package/internal/package.json +1 -1
  22. package/internal/stencil-private.d.ts +39 -14
  23. package/internal/stencil-public-compiler.d.ts +21 -0
  24. package/internal/stencil-public-runtime.d.ts +0 -2
  25. package/internal/testing/index.js +439 -407
  26. package/internal/testing/package.json +1 -1
  27. package/mock-doc/index.cjs +137 -131
  28. package/mock-doc/index.d.ts +18 -4
  29. package/mock-doc/index.js +137 -131
  30. package/mock-doc/package.json +1 -1
  31. package/package.json +34 -6
  32. package/screenshot/index.js +1 -1
  33. package/screenshot/package.json +1 -1
  34. package/screenshot/pixel-match.js +1 -1
  35. package/sys/node/index.js +10 -10
  36. package/sys/node/package.json +1 -1
  37. package/sys/node/worker.js +1 -1
  38. package/testing/index.js +95 -16
  39. package/testing/jest/jest-27-and-under/matchers/events.d.ts +4 -0
  40. package/testing/jest/jest-27-and-under/matchers/index.d.ts +2 -1
  41. package/testing/jest/jest-28/matchers/events.d.ts +4 -0
  42. package/testing/jest/jest-28/matchers/index.d.ts +2 -1
  43. package/testing/jest/jest-29/matchers/events.d.ts +4 -0
  44. package/testing/jest/jest-29/matchers/index.d.ts +2 -1
  45. package/testing/mocks.d.ts +9 -9
  46. package/testing/package.json +1 -1
  47. package/testing/puppeteer/puppeteer-declarations.d.ts +11 -0
package/mock-doc/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Stencil Mock Doc v4.18.3 | MIT Licensed | https://stenciljs.com
2
+ Stencil Mock Doc v4.19.0 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
 
5
5
  // src/runtime/runtime-constants.ts
@@ -6217,67 +6217,50 @@ function humanReadableList(items) {
6217
6217
  }
6218
6218
 
6219
6219
  // src/mock-doc/serialize-node.ts
6220
- function serializeNodeToHtml(elm, opts = {}) {
6220
+ function normalizeSerializationOptions(opts = {}) {
6221
+ return {
6222
+ ...opts,
6223
+ outerHtml: typeof opts.outerHtml !== "boolean" ? false : opts.outerHtml,
6224
+ ...opts.prettyHtml ? {
6225
+ indentSpaces: typeof opts.indentSpaces !== "number" ? 2 : opts.indentSpaces,
6226
+ newLines: typeof opts.newLines !== "boolean" ? true : opts.newLines
6227
+ } : {
6228
+ prettyHtml: false,
6229
+ indentSpaces: typeof opts.indentSpaces !== "number" ? 0 : opts.indentSpaces,
6230
+ newLines: typeof opts.newLines !== "boolean" ? false : opts.newLines
6231
+ },
6232
+ approximateLineWidth: typeof opts.approximateLineWidth !== "number" ? -1 : opts.approximateLineWidth,
6233
+ removeEmptyAttributes: typeof opts.removeEmptyAttributes !== "boolean" ? true : opts.removeEmptyAttributes,
6234
+ removeAttributeQuotes: typeof opts.removeAttributeQuotes !== "boolean" ? false : opts.removeAttributeQuotes,
6235
+ removeBooleanAttributeQuotes: typeof opts.removeBooleanAttributeQuotes !== "boolean" ? false : opts.removeBooleanAttributeQuotes,
6236
+ removeHtmlComments: typeof opts.removeHtmlComments !== "boolean" ? false : opts.removeHtmlComments,
6237
+ serializeShadowRoot: typeof opts.serializeShadowRoot !== "boolean" ? false : opts.serializeShadowRoot,
6238
+ fullDocument: typeof opts.fullDocument !== "boolean" ? true : opts.fullDocument
6239
+ };
6240
+ }
6241
+ function serializeNodeToHtml(elm, serializationOptions = {}) {
6242
+ const opts = normalizeSerializationOptions(serializationOptions);
6221
6243
  const output = {
6222
6244
  currentLineWidth: 0,
6223
6245
  indent: 0,
6224
6246
  isWithinBody: false,
6225
6247
  text: []
6226
6248
  };
6227
- if (opts.prettyHtml) {
6228
- if (typeof opts.indentSpaces !== "number") {
6229
- opts.indentSpaces = 2;
6230
- }
6231
- if (typeof opts.newLines !== "boolean") {
6232
- opts.newLines = true;
6233
- }
6234
- opts.approximateLineWidth = -1;
6235
- } else {
6236
- opts.prettyHtml = false;
6237
- if (typeof opts.newLines !== "boolean") {
6238
- opts.newLines = false;
6239
- }
6240
- if (typeof opts.indentSpaces !== "number") {
6241
- opts.indentSpaces = 0;
6242
- }
6243
- }
6244
- if (typeof opts.approximateLineWidth !== "number") {
6245
- opts.approximateLineWidth = -1;
6246
- }
6247
- if (typeof opts.removeEmptyAttributes !== "boolean") {
6248
- opts.removeEmptyAttributes = true;
6249
- }
6250
- if (typeof opts.removeAttributeQuotes !== "boolean") {
6251
- opts.removeAttributeQuotes = false;
6252
- }
6253
- if (typeof opts.removeBooleanAttributeQuotes !== "boolean") {
6254
- opts.removeBooleanAttributeQuotes = false;
6255
- }
6256
- if (typeof opts.removeHtmlComments !== "boolean") {
6257
- opts.removeHtmlComments = false;
6258
- }
6259
- if (typeof opts.serializeShadowRoot !== "boolean") {
6260
- opts.serializeShadowRoot = false;
6261
- }
6262
- if (opts.outerHtml) {
6263
- serializeToHtml(elm, opts, output, false);
6264
- } else {
6265
- for (let i = 0, ii = elm.childNodes.length; i < ii; i++) {
6266
- serializeToHtml(elm.childNodes[i], opts, output, false);
6267
- }
6268
- }
6269
- if (output.text[0] === "\n") {
6270
- output.text.shift();
6271
- }
6272
- if (output.text[output.text.length - 1] === "\n") {
6273
- output.text.pop();
6249
+ let renderedNode = "";
6250
+ const children = !opts.fullDocument && elm.body ? Array.from(elm.body.childNodes) : opts.outerHtml ? [elm] : Array.from(elm.childNodes);
6251
+ for (let i = 0, ii = children.length; i < ii; i++) {
6252
+ const child = children[i];
6253
+ const chunks = Array.from(streamToHtml(child, opts, output));
6254
+ renderedNode += chunks.join("");
6274
6255
  }
6275
- return output.text.join("");
6256
+ return renderedNode.trim();
6276
6257
  }
6277
- function serializeToHtml(node, opts, output, isShadowRoot) {
6258
+ var shadowRootTag = "mock:shadow-root";
6259
+ function* streamToHtml(node, opts, output) {
6278
6260
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
6261
+ const isShadowRoot = node.nodeType === 11 /* DOCUMENT_FRAGMENT_NODE */;
6279
6262
  if (node.nodeType === 1 /* ELEMENT_NODE */ || isShadowRoot) {
6280
- const tagName = isShadowRoot ? "mock:shadow-root" : getTagName(node);
6263
+ const tagName = isShadowRoot ? shadowRootTag : getTagName(node);
6281
6264
  if (tagName === "body") {
6282
6265
  output.isWithinBody = true;
6283
6266
  }
@@ -6285,17 +6268,23 @@ function serializeToHtml(node, opts, output, isShadowRoot) {
6285
6268
  if (ignoreTag === false) {
6286
6269
  const isWithinWhitespaceSensitiveNode = opts.newLines || ((_a = opts.indentSpaces) != null ? _a : 0) > 0 ? isWithinWhitespaceSensitive(node) : false;
6287
6270
  if (opts.newLines && !isWithinWhitespaceSensitiveNode) {
6288
- output.text.push("\n");
6271
+ yield "\n";
6289
6272
  output.currentLineWidth = 0;
6290
6273
  }
6291
6274
  if (((_b = opts.indentSpaces) != null ? _b : 0) > 0 && !isWithinWhitespaceSensitiveNode) {
6292
6275
  for (let i = 0; i < output.indent; i++) {
6293
- output.text.push(" ");
6276
+ yield " ";
6294
6277
  }
6295
6278
  output.currentLineWidth += output.indent;
6296
6279
  }
6297
- output.text.push("<" + tagName);
6298
- output.currentLineWidth += tagName.length + 1;
6280
+ const tag = tagName === shadowRootTag ? "template" : tagName;
6281
+ yield "<" + tag;
6282
+ output.currentLineWidth += tag.length + 1;
6283
+ if (tag === "template") {
6284
+ const mode = ` shadowrootmode="open"`;
6285
+ yield mode;
6286
+ output.currentLineWidth += mode.length;
6287
+ }
6299
6288
  const attrsLength = node.attributes.length;
6300
6289
  const attributes = opts.prettyHtml && attrsLength > 1 ? cloneAttributes(node.attributes, true) : node.attributes;
6301
6290
  for (let i = 0; i < attrsLength; i++) {
@@ -6312,27 +6301,27 @@ function serializeToHtml(node, opts, output, isShadowRoot) {
6312
6301
  if (attrNamespaceURI == null) {
6313
6302
  output.currentLineWidth += attrName.length + 1;
6314
6303
  if (opts.approximateLineWidth && opts.approximateLineWidth > 0 && output.currentLineWidth > opts.approximateLineWidth) {
6315
- output.text.push("\n" + attrName);
6304
+ yield "\n" + attrName;
6316
6305
  output.currentLineWidth = 0;
6317
6306
  } else {
6318
- output.text.push(" " + attrName);
6307
+ yield " " + attrName;
6319
6308
  }
6320
6309
  } else if (attrNamespaceURI === "http://www.w3.org/XML/1998/namespace") {
6321
- output.text.push(" xml:" + attrName);
6310
+ yield " xml:" + attrName;
6322
6311
  output.currentLineWidth += attrName.length + 5;
6323
6312
  } else if (attrNamespaceURI === "http://www.w3.org/2000/xmlns/") {
6324
6313
  if (attrName !== "xmlns") {
6325
- output.text.push(" xmlns:" + attrName);
6314
+ yield " xmlns:" + attrName;
6326
6315
  output.currentLineWidth += attrName.length + 7;
6327
6316
  } else {
6328
- output.text.push(" " + attrName);
6317
+ yield " " + attrName;
6329
6318
  output.currentLineWidth += attrName.length + 1;
6330
6319
  }
6331
6320
  } else if (attrNamespaceURI === XLINK_NS) {
6332
- output.text.push(" xlink:" + attrName);
6321
+ yield " xlink:" + attrName;
6333
6322
  output.currentLineWidth += attrName.length + 7;
6334
6323
  } else {
6335
- output.text.push(" " + attrNamespaceURI + ":" + attrName);
6324
+ yield " " + attrNamespaceURI + ":" + attrName;
6336
6325
  output.currentLineWidth += attrNamespaceURI.length + attrName.length + 2;
6337
6326
  }
6338
6327
  if (opts.prettyHtml && attrName === "class") {
@@ -6347,43 +6336,45 @@ function serializeToHtml(node, opts, output, isShadowRoot) {
6347
6336
  }
6348
6337
  }
6349
6338
  if (opts.removeAttributeQuotes && CAN_REMOVE_ATTR_QUOTES.test(attrValue)) {
6350
- output.text.push("=" + escapeString(attrValue, true));
6339
+ yield "=" + escapeString(attrValue, true);
6351
6340
  output.currentLineWidth += attrValue.length + 1;
6352
6341
  } else {
6353
- output.text.push('="' + escapeString(attrValue, true) + '"');
6342
+ yield '="' + escapeString(attrValue, true) + '"';
6354
6343
  output.currentLineWidth += attrValue.length + 3;
6355
6344
  }
6356
6345
  }
6357
6346
  if (node.hasAttribute("style")) {
6358
6347
  const cssText = node.style.cssText;
6359
6348
  if (opts.approximateLineWidth && opts.approximateLineWidth > 0 && output.currentLineWidth + cssText.length + 10 > opts.approximateLineWidth) {
6360
- output.text.push(`
6361
- style="${cssText}">`);
6349
+ yield `
6350
+ style="${cssText}">`;
6362
6351
  output.currentLineWidth = 0;
6363
6352
  } else {
6364
- output.text.push(` style="${cssText}">`);
6353
+ yield ` style="${cssText}">`;
6365
6354
  output.currentLineWidth += cssText.length + 10;
6366
6355
  }
6367
6356
  } else {
6368
- output.text.push(">");
6357
+ yield ">";
6369
6358
  output.currentLineWidth += 1;
6370
6359
  }
6371
6360
  }
6372
6361
  if (EMPTY_ELEMENTS.has(tagName) === false) {
6373
- if (opts.serializeShadowRoot && node.shadowRoot != null) {
6362
+ const shadowRoot = node.shadowRoot;
6363
+ if (opts.serializeShadowRoot && shadowRoot != null) {
6374
6364
  output.indent = output.indent + ((_c = opts.indentSpaces) != null ? _c : 0);
6375
- serializeToHtml(node.shadowRoot, opts, output, true);
6365
+ yield* streamToHtml(shadowRoot, opts, output);
6376
6366
  output.indent = output.indent - ((_d = opts.indentSpaces) != null ? _d : 0);
6377
6367
  if (opts.newLines && (node.childNodes.length === 0 || node.childNodes.length === 1 && node.childNodes[0].nodeType === 3 /* TEXT_NODE */ && ((_e = node.childNodes[0].nodeValue) == null ? void 0 : _e.trim()) === "")) {
6378
- output.text.push("\n");
6368
+ yield "\n";
6379
6369
  output.currentLineWidth = 0;
6380
6370
  for (let i = 0; i < output.indent; i++) {
6381
- output.text.push(" ");
6371
+ yield " ";
6382
6372
  }
6383
6373
  output.currentLineWidth += output.indent;
6384
6374
  }
6385
6375
  }
6386
6376
  if (opts.excludeTagContent == null || opts.excludeTagContent.includes(tagName) === false) {
6377
+ const tag = tagName === shadowRootTag ? "template" : tagName;
6387
6378
  const childNodes = tagName === "template" ? node.content.childNodes : node.childNodes;
6388
6379
  const childNodeLength = childNodes.length;
6389
6380
  if (childNodeLength > 0) {
@@ -6394,17 +6385,17 @@ style="${cssText}">`);
6394
6385
  output.indent = output.indent + ((_h = opts.indentSpaces) != null ? _h : 0);
6395
6386
  }
6396
6387
  for (let i = 0; i < childNodeLength; i++) {
6397
- serializeToHtml(childNodes[i], opts, output, false);
6388
+ yield* streamToHtml(childNodes[i], opts, output);
6398
6389
  }
6399
6390
  if (ignoreTag === false) {
6400
6391
  if (opts.newLines && !isWithinWhitespaceSensitiveNode) {
6401
- output.text.push("\n");
6392
+ yield "\n";
6402
6393
  output.currentLineWidth = 0;
6403
6394
  }
6404
6395
  if (((_i = opts.indentSpaces) != null ? _i : 0) > 0 && !isWithinWhitespaceSensitiveNode) {
6405
6396
  output.indent = output.indent - ((_j = opts.indentSpaces) != null ? _j : 0);
6406
6397
  for (let i = 0; i < output.indent; i++) {
6407
- output.text.push(" ");
6398
+ yield " ";
6408
6399
  }
6409
6400
  output.currentLineWidth += output.indent;
6410
6401
  }
@@ -6412,13 +6403,13 @@ style="${cssText}">`);
6412
6403
  }
6413
6404
  }
6414
6405
  if (ignoreTag === false) {
6415
- output.text.push("</" + tagName + ">");
6416
- output.currentLineWidth += tagName.length + 3;
6406
+ yield "</" + tag + ">";
6407
+ output.currentLineWidth += tag.length + 3;
6417
6408
  }
6418
6409
  }
6419
6410
  }
6420
6411
  if (((_k = opts.approximateLineWidth) != null ? _k : 0) > 0 && STRUCTURE_ELEMENTS.has(tagName)) {
6421
- output.text.push("\n");
6412
+ yield "\n";
6422
6413
  output.currentLineWidth = 0;
6423
6414
  }
6424
6415
  if (tagName === "body") {
@@ -6430,27 +6421,27 @@ style="${cssText}">`);
6430
6421
  const trimmedTextContent = textContent.trim();
6431
6422
  if (trimmedTextContent === "") {
6432
6423
  if (isWithinWhitespaceSensitive(node)) {
6433
- output.text.push(textContent);
6424
+ yield textContent;
6434
6425
  output.currentLineWidth += textContent.length;
6435
6426
  } else if (((_l = opts.approximateLineWidth) != null ? _l : 0) > 0 && !output.isWithinBody) {
6436
6427
  } else if (!opts.prettyHtml) {
6437
6428
  output.currentLineWidth += 1;
6438
6429
  if (opts.approximateLineWidth && opts.approximateLineWidth > 0 && output.currentLineWidth > opts.approximateLineWidth) {
6439
- output.text.push("\n");
6430
+ yield "\n";
6440
6431
  output.currentLineWidth = 0;
6441
6432
  } else {
6442
- output.text.push(" ");
6433
+ yield " ";
6443
6434
  }
6444
6435
  }
6445
6436
  } else {
6446
6437
  const isWithinWhitespaceSensitiveNode = opts.newLines || ((_m = opts.indentSpaces) != null ? _m : 0) > 0 || opts.prettyHtml ? isWithinWhitespaceSensitive(node) : false;
6447
6438
  if (opts.newLines && !isWithinWhitespaceSensitiveNode) {
6448
- output.text.push("\n");
6439
+ yield "\n";
6449
6440
  output.currentLineWidth = 0;
6450
6441
  }
6451
6442
  if (((_n = opts.indentSpaces) != null ? _n : 0) > 0 && !isWithinWhitespaceSensitiveNode) {
6452
6443
  for (let i = 0; i < output.indent; i++) {
6453
- output.text.push(" ");
6444
+ yield " ";
6454
6445
  }
6455
6446
  output.currentLineWidth += output.indent;
6456
6447
  }
@@ -6459,15 +6450,15 @@ style="${cssText}">`);
6459
6450
  const parentTagName = node.parentNode != null && node.parentNode.nodeType === 1 /* ELEMENT_NODE */ ? node.parentNode.nodeName : null;
6460
6451
  if (typeof parentTagName === "string" && NON_ESCAPABLE_CONTENT.has(parentTagName)) {
6461
6452
  if (isWithinWhitespaceSensitive(node)) {
6462
- output.text.push(textContent);
6453
+ yield textContent;
6463
6454
  } else {
6464
- output.text.push(trimmedTextContent);
6455
+ yield trimmedTextContent;
6465
6456
  textContentLength = trimmedTextContent.length;
6466
6457
  }
6467
6458
  output.currentLineWidth += textContentLength;
6468
6459
  } else {
6469
6460
  if (opts.prettyHtml && !isWithinWhitespaceSensitiveNode) {
6470
- output.text.push(escapeString(textContent.replace(/\s\s+/g, " ").trim(), false));
6461
+ yield escapeString(textContent.replace(/\s\s+/g, " ").trim(), false);
6471
6462
  output.currentLineWidth += textContentLength;
6472
6463
  } else {
6473
6464
  if (isWithinWhitespaceSensitive(node)) {
@@ -6489,7 +6480,7 @@ style="${cssText}">`);
6489
6480
  }
6490
6481
  output.currentLineWidth += textContentLength;
6491
6482
  }
6492
- output.text.push(escapeString(textContent, false));
6483
+ yield escapeString(textContent, false);
6493
6484
  }
6494
6485
  }
6495
6486
  }
@@ -6497,27 +6488,27 @@ style="${cssText}">`);
6497
6488
  }
6498
6489
  } else if (node.nodeType === 8 /* COMMENT_NODE */) {
6499
6490
  const nodeValue = node.nodeValue;
6500
- if (opts.removeHtmlComments) {
6501
- 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 + "."));
6502
- if (!isHydrateAnnotation) {
6503
- return;
6504
- }
6491
+ 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 + "."));
6492
+ if (opts.removeHtmlComments && !isHydrateAnnotation) {
6493
+ return;
6505
6494
  }
6506
6495
  const isWithinWhitespaceSensitiveNode = opts.newLines || ((_o = opts.indentSpaces) != null ? _o : 0) > 0 ? isWithinWhitespaceSensitive(node) : false;
6507
6496
  if (opts.newLines && !isWithinWhitespaceSensitiveNode) {
6508
- output.text.push("\n");
6497
+ yield "\n";
6509
6498
  output.currentLineWidth = 0;
6510
6499
  }
6511
6500
  if (((_p = opts.indentSpaces) != null ? _p : 0) > 0 && !isWithinWhitespaceSensitiveNode) {
6512
6501
  for (let i = 0; i < output.indent; i++) {
6513
- output.text.push(" ");
6502
+ yield " ";
6514
6503
  }
6515
6504
  output.currentLineWidth += output.indent;
6516
6505
  }
6517
- output.text.push("<!--" + nodeValue + "-->");
6518
- output.currentLineWidth += nodeValue.length + 7;
6506
+ yield "<!--" + nodeValue + "-->";
6507
+ if (nodeValue) {
6508
+ output.currentLineWidth += nodeValue.length + 7;
6509
+ }
6519
6510
  } else if (node.nodeType === 10 /* DOCUMENT_TYPE_NODE */) {
6520
- output.text.push("<!doctype html>");
6511
+ yield "<!doctype html>";
6521
6512
  }
6522
6513
  }
6523
6514
  var AMP_REGEX = /&/g;
@@ -6542,7 +6533,7 @@ function escapeString(str, attrMode) {
6542
6533
  }
6543
6534
  function isWithinWhitespaceSensitive(node) {
6544
6535
  let _node = node;
6545
- while (_node != null) {
6536
+ while (_node == null ? void 0 : _node.nodeName) {
6546
6537
  if (WHITESPACE_SENSITIVE.has(_node.nodeName)) {
6547
6538
  return true;
6548
6539
  }
@@ -6858,6 +6849,10 @@ Testing components with ElementInternals is fully supported in e2e tests.`
6858
6849
  get shadowRoot() {
6859
6850
  return this.__shadowRoot || null;
6860
6851
  }
6852
+ /**
6853
+ * Set shadow root for element
6854
+ * @param shadowRoot - ShadowRoot to set
6855
+ */
6861
6856
  set shadowRoot(shadowRoot) {
6862
6857
  if (shadowRoot != null) {
6863
6858
  shadowRoot.host = this;
@@ -8687,14 +8682,16 @@ var WINDOW_PROPS = [
8687
8682
  ];
8688
8683
  var GLOBAL_CONSTRUCTORS = [
8689
8684
  ["CustomEvent", MockCustomEvent],
8685
+ ["DocumentFragment", MockDocumentFragment],
8686
+ ["DOMParser", MockDOMParser],
8690
8687
  ["Event", MockEvent],
8691
- ["Headers", MockHeaders],
8692
8688
  ["FocusEvent", MockFocusEvent],
8689
+ ["Headers", MockHeaders],
8693
8690
  ["KeyboardEvent", MockKeyboardEvent],
8694
8691
  ["MouseEvent", MockMouseEvent],
8695
8692
  ["Request", MockRequest],
8696
8693
  ["Response", MockResponse],
8697
- ["DOMParser", MockDOMParser],
8694
+ ["ShadowRoot", MockDocumentFragment],
8698
8695
  ["HTMLAnchorElement", MockAnchorElement],
8699
8696
  ["HTMLBaseElement", MockBaseElement],
8700
8697
  ["HTMLButtonElement", MockButtonElement],
@@ -8905,6 +8902,7 @@ var nativeClearTimeout = clearTimeout;
8905
8902
  var nativeSetInterval = setInterval;
8906
8903
  var nativeSetTimeout = setTimeout;
8907
8904
  var nativeURL = URL;
8905
+ var nativeWindow = globalThis.window;
8908
8906
  var MockWindow = class {
8909
8907
  constructor(html = null) {
8910
8908
  if (html !== false) {
@@ -8931,10 +8929,10 @@ var MockWindow = class {
8931
8929
  blur() {
8932
8930
  }
8933
8931
  cancelAnimationFrame(id) {
8934
- this.__clearTimeout(id);
8932
+ this.__clearTimeout.call(nativeWindow || this, id);
8935
8933
  }
8936
8934
  cancelIdleCallback(id) {
8937
- this.__clearTimeout(id);
8935
+ this.__clearTimeout.call(nativeWindow || this, id);
8938
8936
  }
8939
8937
  get CharacterData() {
8940
8938
  if (this.__charDataCstr == null) {
@@ -8952,10 +8950,10 @@ var MockWindow = class {
8952
8950
  this.__charDataCstr = charDataCstr;
8953
8951
  }
8954
8952
  clearInterval(id) {
8955
- this.__clearInterval(id);
8953
+ this.__clearInterval.call(nativeWindow || this, id);
8956
8954
  }
8957
8955
  clearTimeout(id) {
8958
- this.__clearTimeout(id);
8956
+ this.__clearTimeout.call(nativeWindow || this, id);
8959
8957
  }
8960
8958
  close() {
8961
8959
  resetWindow(this);
@@ -9255,20 +9253,24 @@ var MockWindow = class {
9255
9253
  }
9256
9254
  return intervalId;
9257
9255
  }
9258
- const timeoutId = this.__setTimeout(() => {
9259
- if (this.__timeouts) {
9260
- this.__timeouts.delete(timeoutId);
9261
- try {
9262
- callback(...args);
9263
- } catch (e2) {
9264
- if (this.console) {
9265
- this.console.error(e2);
9266
- } else {
9267
- console.error(e2);
9256
+ const timeoutId = this.__setTimeout.call(
9257
+ nativeWindow || this,
9258
+ () => {
9259
+ if (this.__timeouts) {
9260
+ this.__timeouts.delete(timeoutId);
9261
+ try {
9262
+ callback(...args);
9263
+ } catch (e2) {
9264
+ if (this.console) {
9265
+ this.console.error(e2);
9266
+ } else {
9267
+ console.error(e2);
9268
+ }
9268
9269
  }
9269
9270
  }
9270
- }
9271
- }, ms);
9271
+ },
9272
+ ms
9273
+ );
9272
9274
  if (this.__timeouts) {
9273
9275
  this.__timeouts.add(timeoutId);
9274
9276
  }
@@ -9279,20 +9281,24 @@ var MockWindow = class {
9279
9281
  this.__timeouts = /* @__PURE__ */ new Set();
9280
9282
  }
9281
9283
  ms = Math.min(ms, this.__maxTimeout);
9282
- const timeoutId = this.__setTimeout(() => {
9283
- if (this.__timeouts) {
9284
- this.__timeouts.delete(timeoutId);
9285
- try {
9286
- callback(...args);
9287
- } catch (e2) {
9288
- if (this.console) {
9289
- this.console.error(e2);
9290
- } else {
9291
- console.error(e2);
9284
+ const timeoutId = this.__setTimeout.call(
9285
+ nativeWindow || this,
9286
+ () => {
9287
+ if (this.__timeouts) {
9288
+ this.__timeouts.delete(timeoutId);
9289
+ try {
9290
+ callback(...args);
9291
+ } catch (e2) {
9292
+ if (this.console) {
9293
+ this.console.error(e2);
9294
+ } else {
9295
+ console.error(e2);
9296
+ }
9292
9297
  }
9293
9298
  }
9294
- }
9295
- }, ms);
9299
+ },
9300
+ ms
9301
+ );
9296
9302
  if (this.__timeouts) {
9297
9303
  this.__timeouts.add(timeoutId);
9298
9304
  }
@@ -9509,11 +9515,11 @@ function cloneWindow(srcWin, opts = {}) {
9509
9515
  return clonedWin;
9510
9516
  }
9511
9517
  function cloneDocument(srcDoc) {
9512
- if (srcDoc == null) {
9518
+ if (srcDoc == null || !srcDoc.defaultView) {
9513
9519
  return null;
9514
9520
  }
9515
9521
  const dstWin = cloneWindow(srcDoc.defaultView);
9516
- return dstWin.document;
9522
+ return (dstWin == null ? void 0 : dstWin.document) || null;
9517
9523
  }
9518
9524
  function constrainTimeouts(win) {
9519
9525
  win.__allowInterval = false;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/mock-doc",
3
- "version": "4.18.3",
3
+ "version": "4.19.0",
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.18.3",
3
+ "version": "4.19.0",
4
4
  "license": "MIT",
5
5
  "main": "./internal/stencil-core/index.cjs",
6
6
  "module": "./internal/stencil-core/index.js",
@@ -22,6 +22,34 @@
22
22
  "sys/",
23
23
  "testing/"
24
24
  ],
25
+ "exports": {
26
+ ".": {
27
+ "import": "./internal/stencil-core/index.js",
28
+ "require": "./internal/stencil-core/index.cjs"
29
+ },
30
+ "./internal": {
31
+ "import": "./internal/index.js"
32
+ },
33
+ "./internal/client": {
34
+ "import": "./internal/client/index.js"
35
+ },
36
+ "./internal/testing": {
37
+ "import": "./internal/testing/index.js"
38
+ },
39
+ "./internal/testing/*": {
40
+ "import": "./internal/testing/*"
41
+ },
42
+ "./internal/app-data": {
43
+ "import": "./internal/app-data/index.js",
44
+ "require": "./internal/app-data/index.cjs"
45
+ },
46
+ "./compiler": {
47
+ "import": "./compiler/stencil.js"
48
+ },
49
+ "./compiler/*": {
50
+ "import": "./compiler/*"
51
+ }
52
+ },
25
53
  "scripts": {
26
54
  "build": "npm run clean && npm run tsc.prod && npm run ts scripts/index.ts -- --prod --ci",
27
55
  "build.watch": "npm run build -- --watch",
@@ -60,7 +88,7 @@
60
88
  "@rollup/plugin-commonjs": "21.1.0",
61
89
  "@rollup/plugin-json": "6.1.0",
62
90
  "@rollup/plugin-node-resolve": "9.0.0",
63
- "@rollup/plugin-replace": "5.0.5",
91
+ "@rollup/plugin-replace": "5.0.7",
64
92
  "@rollup/pluginutils": "5.1.0",
65
93
  "@types/eslint": "^8.4.6",
66
94
  "@types/exit": "^0.1.31",
@@ -111,16 +139,16 @@
111
139
  "parse5": "7.1.2",
112
140
  "pixelmatch": "5.3.0",
113
141
  "postcss": "^8.2.8",
114
- "prettier": "3.2.4",
142
+ "prettier": "3.3.1",
115
143
  "prompts": "2.4.2",
116
144
  "puppeteer": "^21.0.0",
117
145
  "rollup": "2.56.3",
118
146
  "semver": "^7.3.7",
119
- "terser": "5.31.0",
147
+ "terser": "5.31.1",
120
148
  "tsx": "^4.10.3",
121
149
  "typescript": "~5.4.0",
122
150
  "webpack": "^5.75.0",
123
- "ws": "8.17.0"
151
+ "ws": "8.17.1"
124
152
  },
125
153
  "engines": {
126
154
  "node": ">=16.0.0",
@@ -146,6 +174,6 @@
146
174
  "prettier": "@ionic/prettier-config",
147
175
  "volta": {
148
176
  "node": "22.2.0",
149
- "npm": "10.8.0"
177
+ "npm": "10.8.1"
150
178
  }
151
179
  }
@@ -1,5 +1,5 @@
1
1
  /*
2
- Stencil Screenshot v4.18.3 | MIT Licensed | https://stenciljs.com
2
+ Stencil Screenshot v4.19.0 | 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.18.3",
3
+ "version": "4.19.0",
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.18.3 | MIT Licensed | https://stenciljs.com
2
+ Stencil Screenshot Pixel Match v4.19.0 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  "use strict";
5
5
  var __create = Object.create;