@stencil/core 4.18.3-dev.1718220868.532557e → 4.18.3-dev.1718341300.87e5b33

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/internal",
3
- "version": "4.18.3-dev.1718220868.532557e",
3
+ "version": "4.18.3-dev.1718341300.87e5b33",
4
4
  "description": "Stencil internals only to be imported by the Stencil Compiler. Breaking changes can and will happen at any time.",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
@@ -1610,6 +1610,12 @@ export interface ScreenshotOptions {
1610
1610
  * more sensitive. Defaults to the testing config `pixelmatchThreshold` value;
1611
1611
  */
1612
1612
  pixelmatchThreshold?: number;
1613
+ /**
1614
+ * Capture the screenshot beyond the viewport.
1615
+ *
1616
+ * @defaultValue `false` if there is no `clip`. `true` otherwise.
1617
+ */
1618
+ captureBeyondViewport?: boolean;
1613
1619
  }
1614
1620
  export interface ScreenshotBoundingBox {
1615
1621
  /**
@@ -1707,11 +1713,6 @@ export interface PackageJsonData {
1707
1713
  name?: string;
1708
1714
  version?: string;
1709
1715
  main?: string;
1710
- exports?: {
1711
- [key: string]: string | {
1712
- [key: string]: string;
1713
- };
1714
- };
1715
1716
  description?: string;
1716
1717
  bin?: {
1717
1718
  [key: string]: string;
@@ -79,6 +79,13 @@ export interface StencilConfig {
79
79
  * Below is an example folder structure containing a webapp's global sass file, named app.css.
80
80
  */
81
81
  globalStyle?: string;
82
+ /**
83
+ * Will generate {@link https://nodejs.org/api/packages.html#packages_exports export map} entry points
84
+ * for each component in the build when `true`.
85
+ *
86
+ * @default false
87
+ */
88
+ generateExportMaps?: boolean;
82
89
  /**
83
90
  * When the hashFileNames config is set to true, and it is a production build,
84
91
  * the hashedFileNameLength config is used to determine how many characters the file name's hash should be.
@@ -838,19 +845,6 @@ export interface SerializeDocumentOptions extends HydrateDocumentOptions {
838
845
  * Remove HTML comments. Defaults to `true`.
839
846
  */
840
847
  removeHtmlComments?: boolean;
841
- /**
842
- * If set to `false` Stencil will ignore the fact that a component has a `shadow: true`
843
- * flag and serializes it as a scoped component. If set to `true` the component will
844
- * be rendered within a Declarative Shadow DOM.
845
- * @default false
846
- */
847
- serializeShadowRoot?: boolean;
848
- /**
849
- * The `fullDocument` flag determines the format of the rendered output. Set it to true to
850
- * generate a complete HTML document, or false to render only the component.
851
- * @default true
852
- */
853
- fullDocument?: boolean;
854
848
  }
855
849
  export interface HydrateFactoryOptions extends SerializeDocumentOptions {
856
850
  serializeToHtml: boolean;
@@ -966,9 +966,9 @@ var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
966
966
  }
967
967
  elm = newVNode2.$elm$ = import_app_data10.BUILD.svg ? doc.createElementNS(
968
968
  isSvgMode ? SVG_NS : HTML_NS,
969
- !useNativeShadowDom && import_app_data10.BUILD.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
969
+ import_app_data10.BUILD.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
970
970
  ) : doc.createElement(
971
- !useNativeShadowDom && import_app_data10.BUILD.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
971
+ import_app_data10.BUILD.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
972
972
  );
973
973
  if (import_app_data10.BUILD.svg && isSvgMode && newVNode2.$tag$ === "foreignObject") {
974
974
  isSvgMode = false;
@@ -1555,7 +1555,10 @@ var dispatchHooks = (hostRef, isInitialLoad) => {
1555
1555
  endSchedule();
1556
1556
  return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
1557
1557
  };
1558
- var enqueue = (maybePromise, fn) => isPromisey(maybePromise) ? maybePromise.then(fn) : fn();
1558
+ var enqueue = (maybePromise, fn) => isPromisey(maybePromise) ? maybePromise.then(fn).catch((err2) => {
1559
+ console.error(err2);
1560
+ fn();
1561
+ }) : fn();
1559
1562
  var isPromisey = (maybePromise) => maybePromise instanceof Promise || maybePromise && maybePromise.then && typeof maybePromise.then === "function";
1560
1563
  var updateComponent = async (hostRef, instance, isInitialLoad) => {
1561
1564
  var _a;
@@ -2520,21 +2523,13 @@ var proxyCustomElement = (Cstr, compactMeta) => {
2520
2523
  },
2521
2524
  __attachShadow() {
2522
2525
  if (supportsShadow) {
2523
- if (!this.shadowRoot) {
2524
- if (import_app_data18.BUILD.shadowDelegatesFocus) {
2525
- this.attachShadow({
2526
- mode: "open",
2527
- delegatesFocus: !!(cmpMeta.$flags$ & 16 /* shadowDelegatesFocus */)
2528
- });
2529
- } else {
2530
- this.attachShadow({ mode: "open" });
2531
- }
2526
+ if (import_app_data18.BUILD.shadowDelegatesFocus) {
2527
+ this.attachShadow({
2528
+ mode: "open",
2529
+ delegatesFocus: !!(cmpMeta.$flags$ & 16 /* shadowDelegatesFocus */)
2530
+ });
2532
2531
  } else {
2533
- if (this.shadowRoot.mode !== "open") {
2534
- throw new Error(
2535
- `Unable to re-use existing shadow root for ${cmpMeta.$tagName$}! Mode is set to ${this.shadowRoot.mode} but Stencil only supports open shadow roots.`
2536
- );
2537
- }
2532
+ this.attachShadow({ mode: "open" });
2538
2533
  }
2539
2534
  } else {
2540
2535
  this.shadowRoot = this;
@@ -2648,21 +2643,13 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
2648
2643
  registerHost(self, cmpMeta);
2649
2644
  if (import_app_data19.BUILD.shadowDom && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
2650
2645
  if (supportsShadow) {
2651
- if (!self.shadowRoot) {
2652
- if (import_app_data19.BUILD.shadowDelegatesFocus) {
2653
- self.attachShadow({
2654
- mode: "open",
2655
- delegatesFocus: !!(cmpMeta.$flags$ & 16 /* shadowDelegatesFocus */)
2656
- });
2657
- } else {
2658
- self.attachShadow({ mode: "open" });
2659
- }
2646
+ if (import_app_data19.BUILD.shadowDelegatesFocus) {
2647
+ self.attachShadow({
2648
+ mode: "open",
2649
+ delegatesFocus: !!(cmpMeta.$flags$ & 16 /* shadowDelegatesFocus */)
2650
+ });
2660
2651
  } else {
2661
- if (self.shadowRoot.mode !== "open") {
2662
- throw new Error(
2663
- `Unable to re-use existing shadow root for ${cmpMeta.$tagName$}! Mode is set to ${self.shadowRoot.mode} but Stencil only supports open shadow roots.`
2664
- );
2665
- }
2652
+ self.attachShadow({ mode: "open" });
2666
2653
  }
2667
2654
  } else if (!import_app_data19.BUILD.hydrateServerSide && !("shadowRoot" in self)) {
2668
2655
  self.shadowRoot = self;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/internal/testing",
3
- "version": "4.18.3-dev.1718220868.532557e",
3
+ "version": "4.18.3-dev.1718341300.87e5b33",
4
4
  "description": "Stencil internal testing platform to be imported by the Stencil Compiler. Breaking changes can and will happen at any time.",
5
5
  "main": "./index.js",
6
6
  "private": true
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Stencil Mock Doc (CommonJS) v4.18.3-dev.1718220868.532557e | MIT Licensed | https://stenciljs.com
2
+ Stencil Mock Doc (CommonJS) v4.18.3-dev.1718341300.87e5b33 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  "use strict";
5
5
  var __defProp = Object.defineProperty;
@@ -6270,50 +6270,67 @@ function humanReadableList(items) {
6270
6270
  }
6271
6271
 
6272
6272
  // src/mock-doc/serialize-node.ts
6273
- function normalizeSerializationOptions(opts = {}) {
6274
- return {
6275
- ...opts,
6276
- outerHtml: typeof opts.outerHtml !== "boolean" ? false : opts.outerHtml,
6277
- ...opts.prettyHtml ? {
6278
- indentSpaces: typeof opts.indentSpaces !== "number" ? 2 : opts.indentSpaces,
6279
- newLines: typeof opts.newLines !== "boolean" ? true : opts.newLines
6280
- } : {
6281
- prettyHtml: false,
6282
- indentSpaces: typeof opts.indentSpaces !== "number" ? 0 : opts.indentSpaces,
6283
- newLines: typeof opts.newLines !== "boolean" ? false : opts.newLines
6284
- },
6285
- approximateLineWidth: typeof opts.approximateLineWidth !== "number" ? -1 : opts.approximateLineWidth,
6286
- removeEmptyAttributes: typeof opts.removeEmptyAttributes !== "boolean" ? true : opts.removeEmptyAttributes,
6287
- removeAttributeQuotes: typeof opts.removeAttributeQuotes !== "boolean" ? false : opts.removeAttributeQuotes,
6288
- removeBooleanAttributeQuotes: typeof opts.removeBooleanAttributeQuotes !== "boolean" ? false : opts.removeBooleanAttributeQuotes,
6289
- removeHtmlComments: typeof opts.removeHtmlComments !== "boolean" ? false : opts.removeHtmlComments,
6290
- serializeShadowRoot: typeof opts.serializeShadowRoot !== "boolean" ? false : opts.serializeShadowRoot,
6291
- fullDocument: typeof opts.fullDocument !== "boolean" ? true : opts.fullDocument
6292
- };
6293
- }
6294
- function serializeNodeToHtml(elm, serializationOptions = {}) {
6295
- const opts = normalizeSerializationOptions(serializationOptions);
6273
+ function serializeNodeToHtml(elm, opts = {}) {
6296
6274
  const output = {
6297
6275
  currentLineWidth: 0,
6298
6276
  indent: 0,
6299
6277
  isWithinBody: false,
6300
6278
  text: []
6301
6279
  };
6302
- let renderedNode = "";
6303
- const children = !opts.fullDocument && elm.body ? Array.from(elm.body.childNodes) : opts.outerHtml ? [elm] : Array.from(elm.childNodes);
6304
- for (let i = 0, ii = children.length; i < ii; i++) {
6305
- const child = children[i];
6306
- const chunks = Array.from(streamToHtml(child, opts, output));
6307
- renderedNode += chunks.join("");
6280
+ if (opts.prettyHtml) {
6281
+ if (typeof opts.indentSpaces !== "number") {
6282
+ opts.indentSpaces = 2;
6283
+ }
6284
+ if (typeof opts.newLines !== "boolean") {
6285
+ opts.newLines = true;
6286
+ }
6287
+ opts.approximateLineWidth = -1;
6288
+ } else {
6289
+ opts.prettyHtml = false;
6290
+ if (typeof opts.newLines !== "boolean") {
6291
+ opts.newLines = false;
6292
+ }
6293
+ if (typeof opts.indentSpaces !== "number") {
6294
+ opts.indentSpaces = 0;
6295
+ }
6296
+ }
6297
+ if (typeof opts.approximateLineWidth !== "number") {
6298
+ opts.approximateLineWidth = -1;
6299
+ }
6300
+ if (typeof opts.removeEmptyAttributes !== "boolean") {
6301
+ opts.removeEmptyAttributes = true;
6302
+ }
6303
+ if (typeof opts.removeAttributeQuotes !== "boolean") {
6304
+ opts.removeAttributeQuotes = false;
6305
+ }
6306
+ if (typeof opts.removeBooleanAttributeQuotes !== "boolean") {
6307
+ opts.removeBooleanAttributeQuotes = false;
6308
+ }
6309
+ if (typeof opts.removeHtmlComments !== "boolean") {
6310
+ opts.removeHtmlComments = false;
6311
+ }
6312
+ if (typeof opts.serializeShadowRoot !== "boolean") {
6313
+ opts.serializeShadowRoot = false;
6308
6314
  }
6309
- return renderedNode.trim();
6315
+ if (opts.outerHtml) {
6316
+ serializeToHtml(elm, opts, output, false);
6317
+ } else {
6318
+ for (let i = 0, ii = elm.childNodes.length; i < ii; i++) {
6319
+ serializeToHtml(elm.childNodes[i], opts, output, false);
6320
+ }
6321
+ }
6322
+ if (output.text[0] === "\n") {
6323
+ output.text.shift();
6324
+ }
6325
+ if (output.text[output.text.length - 1] === "\n") {
6326
+ output.text.pop();
6327
+ }
6328
+ return output.text.join("");
6310
6329
  }
6311
- var shadowRootTag = "mock:shadow-root";
6312
- function* streamToHtml(node, opts, output) {
6330
+ function serializeToHtml(node, opts, output, isShadowRoot) {
6313
6331
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
6314
- const isShadowRoot = node.nodeType === 11 /* DOCUMENT_FRAGMENT_NODE */;
6315
6332
  if (node.nodeType === 1 /* ELEMENT_NODE */ || isShadowRoot) {
6316
- const tagName = isShadowRoot ? shadowRootTag : getTagName(node);
6333
+ const tagName = isShadowRoot ? "mock:shadow-root" : getTagName(node);
6317
6334
  if (tagName === "body") {
6318
6335
  output.isWithinBody = true;
6319
6336
  }
@@ -6321,23 +6338,17 @@ function* streamToHtml(node, opts, output) {
6321
6338
  if (ignoreTag === false) {
6322
6339
  const isWithinWhitespaceSensitiveNode = opts.newLines || ((_a = opts.indentSpaces) != null ? _a : 0) > 0 ? isWithinWhitespaceSensitive(node) : false;
6323
6340
  if (opts.newLines && !isWithinWhitespaceSensitiveNode) {
6324
- yield "\n";
6341
+ output.text.push("\n");
6325
6342
  output.currentLineWidth = 0;
6326
6343
  }
6327
6344
  if (((_b = opts.indentSpaces) != null ? _b : 0) > 0 && !isWithinWhitespaceSensitiveNode) {
6328
6345
  for (let i = 0; i < output.indent; i++) {
6329
- yield " ";
6346
+ output.text.push(" ");
6330
6347
  }
6331
6348
  output.currentLineWidth += output.indent;
6332
6349
  }
6333
- const tag = tagName === shadowRootTag ? "template" : tagName;
6334
- yield "<" + tag;
6335
- output.currentLineWidth += tag.length + 1;
6336
- if (tag === "template") {
6337
- const mode = ` shadowrootmode="open"`;
6338
- yield mode;
6339
- output.currentLineWidth += mode.length;
6340
- }
6350
+ output.text.push("<" + tagName);
6351
+ output.currentLineWidth += tagName.length + 1;
6341
6352
  const attrsLength = node.attributes.length;
6342
6353
  const attributes = opts.prettyHtml && attrsLength > 1 ? cloneAttributes(node.attributes, true) : node.attributes;
6343
6354
  for (let i = 0; i < attrsLength; i++) {
@@ -6354,27 +6365,27 @@ function* streamToHtml(node, opts, output) {
6354
6365
  if (attrNamespaceURI == null) {
6355
6366
  output.currentLineWidth += attrName.length + 1;
6356
6367
  if (opts.approximateLineWidth && opts.approximateLineWidth > 0 && output.currentLineWidth > opts.approximateLineWidth) {
6357
- yield "\n" + attrName;
6368
+ output.text.push("\n" + attrName);
6358
6369
  output.currentLineWidth = 0;
6359
6370
  } else {
6360
- yield " " + attrName;
6371
+ output.text.push(" " + attrName);
6361
6372
  }
6362
6373
  } else if (attrNamespaceURI === "http://www.w3.org/XML/1998/namespace") {
6363
- yield " xml:" + attrName;
6374
+ output.text.push(" xml:" + attrName);
6364
6375
  output.currentLineWidth += attrName.length + 5;
6365
6376
  } else if (attrNamespaceURI === "http://www.w3.org/2000/xmlns/") {
6366
6377
  if (attrName !== "xmlns") {
6367
- yield " xmlns:" + attrName;
6378
+ output.text.push(" xmlns:" + attrName);
6368
6379
  output.currentLineWidth += attrName.length + 7;
6369
6380
  } else {
6370
- yield " " + attrName;
6381
+ output.text.push(" " + attrName);
6371
6382
  output.currentLineWidth += attrName.length + 1;
6372
6383
  }
6373
6384
  } else if (attrNamespaceURI === XLINK_NS) {
6374
- yield " xlink:" + attrName;
6385
+ output.text.push(" xlink:" + attrName);
6375
6386
  output.currentLineWidth += attrName.length + 7;
6376
6387
  } else {
6377
- yield " " + attrNamespaceURI + ":" + attrName;
6388
+ output.text.push(" " + attrNamespaceURI + ":" + attrName);
6378
6389
  output.currentLineWidth += attrNamespaceURI.length + attrName.length + 2;
6379
6390
  }
6380
6391
  if (opts.prettyHtml && attrName === "class") {
@@ -6389,45 +6400,43 @@ function* streamToHtml(node, opts, output) {
6389
6400
  }
6390
6401
  }
6391
6402
  if (opts.removeAttributeQuotes && CAN_REMOVE_ATTR_QUOTES.test(attrValue)) {
6392
- yield "=" + escapeString(attrValue, true);
6403
+ output.text.push("=" + escapeString(attrValue, true));
6393
6404
  output.currentLineWidth += attrValue.length + 1;
6394
6405
  } else {
6395
- yield '="' + escapeString(attrValue, true) + '"';
6406
+ output.text.push('="' + escapeString(attrValue, true) + '"');
6396
6407
  output.currentLineWidth += attrValue.length + 3;
6397
6408
  }
6398
6409
  }
6399
6410
  if (node.hasAttribute("style")) {
6400
6411
  const cssText = node.style.cssText;
6401
6412
  if (opts.approximateLineWidth && opts.approximateLineWidth > 0 && output.currentLineWidth + cssText.length + 10 > opts.approximateLineWidth) {
6402
- yield `
6403
- style="${cssText}">`;
6413
+ output.text.push(`
6414
+ style="${cssText}">`);
6404
6415
  output.currentLineWidth = 0;
6405
6416
  } else {
6406
- yield ` style="${cssText}">`;
6417
+ output.text.push(` style="${cssText}">`);
6407
6418
  output.currentLineWidth += cssText.length + 10;
6408
6419
  }
6409
6420
  } else {
6410
- yield ">";
6421
+ output.text.push(">");
6411
6422
  output.currentLineWidth += 1;
6412
6423
  }
6413
6424
  }
6414
6425
  if (EMPTY_ELEMENTS.has(tagName) === false) {
6415
- const shadowRoot = node.shadowRoot;
6416
- if (opts.serializeShadowRoot && shadowRoot != null) {
6426
+ if (opts.serializeShadowRoot && node.shadowRoot != null) {
6417
6427
  output.indent = output.indent + ((_c = opts.indentSpaces) != null ? _c : 0);
6418
- yield* streamToHtml(shadowRoot, opts, output);
6428
+ serializeToHtml(node.shadowRoot, opts, output, true);
6419
6429
  output.indent = output.indent - ((_d = opts.indentSpaces) != null ? _d : 0);
6420
6430
  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()) === "")) {
6421
- yield "\n";
6431
+ output.text.push("\n");
6422
6432
  output.currentLineWidth = 0;
6423
6433
  for (let i = 0; i < output.indent; i++) {
6424
- yield " ";
6434
+ output.text.push(" ");
6425
6435
  }
6426
6436
  output.currentLineWidth += output.indent;
6427
6437
  }
6428
6438
  }
6429
6439
  if (opts.excludeTagContent == null || opts.excludeTagContent.includes(tagName) === false) {
6430
- const tag = tagName === shadowRootTag ? "template" : tagName;
6431
6440
  const childNodes = tagName === "template" ? node.content.childNodes : node.childNodes;
6432
6441
  const childNodeLength = childNodes.length;
6433
6442
  if (childNodeLength > 0) {
@@ -6438,17 +6447,17 @@ style="${cssText}">`;
6438
6447
  output.indent = output.indent + ((_h = opts.indentSpaces) != null ? _h : 0);
6439
6448
  }
6440
6449
  for (let i = 0; i < childNodeLength; i++) {
6441
- yield* streamToHtml(childNodes[i], opts, output);
6450
+ serializeToHtml(childNodes[i], opts, output, false);
6442
6451
  }
6443
6452
  if (ignoreTag === false) {
6444
6453
  if (opts.newLines && !isWithinWhitespaceSensitiveNode) {
6445
- yield "\n";
6454
+ output.text.push("\n");
6446
6455
  output.currentLineWidth = 0;
6447
6456
  }
6448
6457
  if (((_i = opts.indentSpaces) != null ? _i : 0) > 0 && !isWithinWhitespaceSensitiveNode) {
6449
6458
  output.indent = output.indent - ((_j = opts.indentSpaces) != null ? _j : 0);
6450
6459
  for (let i = 0; i < output.indent; i++) {
6451
- yield " ";
6460
+ output.text.push(" ");
6452
6461
  }
6453
6462
  output.currentLineWidth += output.indent;
6454
6463
  }
@@ -6456,13 +6465,13 @@ style="${cssText}">`;
6456
6465
  }
6457
6466
  }
6458
6467
  if (ignoreTag === false) {
6459
- yield "</" + tag + ">";
6460
- output.currentLineWidth += tag.length + 3;
6468
+ output.text.push("</" + tagName + ">");
6469
+ output.currentLineWidth += tagName.length + 3;
6461
6470
  }
6462
6471
  }
6463
6472
  }
6464
6473
  if (((_k = opts.approximateLineWidth) != null ? _k : 0) > 0 && STRUCTURE_ELEMENTS.has(tagName)) {
6465
- yield "\n";
6474
+ output.text.push("\n");
6466
6475
  output.currentLineWidth = 0;
6467
6476
  }
6468
6477
  if (tagName === "body") {
@@ -6474,27 +6483,27 @@ style="${cssText}">`;
6474
6483
  const trimmedTextContent = textContent.trim();
6475
6484
  if (trimmedTextContent === "") {
6476
6485
  if (isWithinWhitespaceSensitive(node)) {
6477
- yield textContent;
6486
+ output.text.push(textContent);
6478
6487
  output.currentLineWidth += textContent.length;
6479
6488
  } else if (((_l = opts.approximateLineWidth) != null ? _l : 0) > 0 && !output.isWithinBody) {
6480
6489
  } else if (!opts.prettyHtml) {
6481
6490
  output.currentLineWidth += 1;
6482
6491
  if (opts.approximateLineWidth && opts.approximateLineWidth > 0 && output.currentLineWidth > opts.approximateLineWidth) {
6483
- yield "\n";
6492
+ output.text.push("\n");
6484
6493
  output.currentLineWidth = 0;
6485
6494
  } else {
6486
- yield " ";
6495
+ output.text.push(" ");
6487
6496
  }
6488
6497
  }
6489
6498
  } else {
6490
6499
  const isWithinWhitespaceSensitiveNode = opts.newLines || ((_m = opts.indentSpaces) != null ? _m : 0) > 0 || opts.prettyHtml ? isWithinWhitespaceSensitive(node) : false;
6491
6500
  if (opts.newLines && !isWithinWhitespaceSensitiveNode) {
6492
- yield "\n";
6501
+ output.text.push("\n");
6493
6502
  output.currentLineWidth = 0;
6494
6503
  }
6495
6504
  if (((_n = opts.indentSpaces) != null ? _n : 0) > 0 && !isWithinWhitespaceSensitiveNode) {
6496
6505
  for (let i = 0; i < output.indent; i++) {
6497
- yield " ";
6506
+ output.text.push(" ");
6498
6507
  }
6499
6508
  output.currentLineWidth += output.indent;
6500
6509
  }
@@ -6503,15 +6512,15 @@ style="${cssText}">`;
6503
6512
  const parentTagName = node.parentNode != null && node.parentNode.nodeType === 1 /* ELEMENT_NODE */ ? node.parentNode.nodeName : null;
6504
6513
  if (typeof parentTagName === "string" && NON_ESCAPABLE_CONTENT.has(parentTagName)) {
6505
6514
  if (isWithinWhitespaceSensitive(node)) {
6506
- yield textContent;
6515
+ output.text.push(textContent);
6507
6516
  } else {
6508
- yield trimmedTextContent;
6517
+ output.text.push(trimmedTextContent);
6509
6518
  textContentLength = trimmedTextContent.length;
6510
6519
  }
6511
6520
  output.currentLineWidth += textContentLength;
6512
6521
  } else {
6513
6522
  if (opts.prettyHtml && !isWithinWhitespaceSensitiveNode) {
6514
- yield escapeString(textContent.replace(/\s\s+/g, " ").trim(), false);
6523
+ output.text.push(escapeString(textContent.replace(/\s\s+/g, " ").trim(), false));
6515
6524
  output.currentLineWidth += textContentLength;
6516
6525
  } else {
6517
6526
  if (isWithinWhitespaceSensitive(node)) {
@@ -6533,7 +6542,7 @@ style="${cssText}">`;
6533
6542
  }
6534
6543
  output.currentLineWidth += textContentLength;
6535
6544
  }
6536
- yield escapeString(textContent, false);
6545
+ output.text.push(escapeString(textContent, false));
6537
6546
  }
6538
6547
  }
6539
6548
  }
@@ -6541,25 +6550,27 @@ style="${cssText}">`;
6541
6550
  }
6542
6551
  } else if (node.nodeType === 8 /* COMMENT_NODE */) {
6543
6552
  const nodeValue = node.nodeValue;
6544
- 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 + "."));
6545
- if (opts.removeHtmlComments && !isHydrateAnnotation) {
6546
- return;
6553
+ if (opts.removeHtmlComments) {
6554
+ 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 + "."));
6555
+ if (!isHydrateAnnotation) {
6556
+ return;
6557
+ }
6547
6558
  }
6548
6559
  const isWithinWhitespaceSensitiveNode = opts.newLines || ((_o = opts.indentSpaces) != null ? _o : 0) > 0 ? isWithinWhitespaceSensitive(node) : false;
6549
6560
  if (opts.newLines && !isWithinWhitespaceSensitiveNode) {
6550
- yield "\n";
6561
+ output.text.push("\n");
6551
6562
  output.currentLineWidth = 0;
6552
6563
  }
6553
6564
  if (((_p = opts.indentSpaces) != null ? _p : 0) > 0 && !isWithinWhitespaceSensitiveNode) {
6554
6565
  for (let i = 0; i < output.indent; i++) {
6555
- yield " ";
6566
+ output.text.push(" ");
6556
6567
  }
6557
6568
  output.currentLineWidth += output.indent;
6558
6569
  }
6559
- yield "<!--" + nodeValue + "-->";
6570
+ output.text.push("<!--" + nodeValue + "-->");
6560
6571
  output.currentLineWidth += nodeValue.length + 7;
6561
6572
  } else if (node.nodeType === 10 /* DOCUMENT_TYPE_NODE */) {
6562
- yield "<!doctype html>";
6573
+ output.text.push("<!doctype html>");
6563
6574
  }
6564
6575
  }
6565
6576
  var AMP_REGEX = /&/g;
@@ -6900,10 +6911,6 @@ Testing components with ElementInternals is fully supported in e2e tests.`
6900
6911
  get shadowRoot() {
6901
6912
  return this.__shadowRoot || null;
6902
6913
  }
6903
- /**
6904
- * Set shadow root for element
6905
- * @param shadowRoot - ShadowRoot to set
6906
- */
6907
6914
  set shadowRoot(shadowRoot) {
6908
6915
  if (shadowRoot != null) {
6909
6916
  shadowRoot.host = this;
@@ -8733,14 +8740,16 @@ var WINDOW_PROPS = [
8733
8740
  ];
8734
8741
  var GLOBAL_CONSTRUCTORS = [
8735
8742
  ["CustomEvent", MockCustomEvent],
8743
+ ["DocumentFragment", MockDocumentFragment],
8744
+ ["DOMParser", MockDOMParser],
8736
8745
  ["Event", MockEvent],
8737
- ["Headers", MockHeaders],
8738
8746
  ["FocusEvent", MockFocusEvent],
8747
+ ["Headers", MockHeaders],
8739
8748
  ["KeyboardEvent", MockKeyboardEvent],
8740
8749
  ["MouseEvent", MockMouseEvent],
8741
8750
  ["Request", MockRequest],
8742
8751
  ["Response", MockResponse],
8743
- ["DOMParser", MockDOMParser],
8752
+ ["ShadowRoot", MockDocumentFragment],
8744
8753
  ["HTMLAnchorElement", MockAnchorElement],
8745
8754
  ["HTMLBaseElement", MockBaseElement],
8746
8755
  ["HTMLButtonElement", MockButtonElement],
@@ -8951,7 +8960,6 @@ var nativeClearTimeout = clearTimeout;
8951
8960
  var nativeSetInterval = setInterval;
8952
8961
  var nativeSetTimeout = setTimeout;
8953
8962
  var nativeURL = URL;
8954
- var nativeWindow = globalThis.window;
8955
8963
  var MockWindow = class {
8956
8964
  constructor(html = null) {
8957
8965
  if (html !== false) {
@@ -8978,10 +8986,10 @@ var MockWindow = class {
8978
8986
  blur() {
8979
8987
  }
8980
8988
  cancelAnimationFrame(id) {
8981
- this.__clearTimeout.call(nativeWindow || this, id);
8989
+ this.__clearTimeout(id);
8982
8990
  }
8983
8991
  cancelIdleCallback(id) {
8984
- this.__clearTimeout.call(nativeWindow || this, id);
8992
+ this.__clearTimeout(id);
8985
8993
  }
8986
8994
  get CharacterData() {
8987
8995
  if (this.__charDataCstr == null) {
@@ -8999,10 +9007,10 @@ var MockWindow = class {
8999
9007
  this.__charDataCstr = charDataCstr;
9000
9008
  }
9001
9009
  clearInterval(id) {
9002
- this.__clearInterval.call(nativeWindow || this, id);
9010
+ this.__clearInterval(id);
9003
9011
  }
9004
9012
  clearTimeout(id) {
9005
- this.__clearTimeout.call(nativeWindow || this, id);
9013
+ this.__clearTimeout(id);
9006
9014
  }
9007
9015
  close() {
9008
9016
  resetWindow(this);
@@ -9302,24 +9310,20 @@ var MockWindow = class {
9302
9310
  }
9303
9311
  return intervalId;
9304
9312
  }
9305
- const timeoutId = this.__setTimeout.call(
9306
- nativeWindow || this,
9307
- () => {
9308
- if (this.__timeouts) {
9309
- this.__timeouts.delete(timeoutId);
9310
- try {
9311
- callback(...args);
9312
- } catch (e2) {
9313
- if (this.console) {
9314
- this.console.error(e2);
9315
- } else {
9316
- console.error(e2);
9317
- }
9313
+ const timeoutId = this.__setTimeout(() => {
9314
+ if (this.__timeouts) {
9315
+ this.__timeouts.delete(timeoutId);
9316
+ try {
9317
+ callback(...args);
9318
+ } catch (e2) {
9319
+ if (this.console) {
9320
+ this.console.error(e2);
9321
+ } else {
9322
+ console.error(e2);
9318
9323
  }
9319
9324
  }
9320
- },
9321
- ms
9322
- );
9325
+ }
9326
+ }, ms);
9323
9327
  if (this.__timeouts) {
9324
9328
  this.__timeouts.add(timeoutId);
9325
9329
  }
@@ -9330,24 +9334,20 @@ var MockWindow = class {
9330
9334
  this.__timeouts = /* @__PURE__ */ new Set();
9331
9335
  }
9332
9336
  ms = Math.min(ms, this.__maxTimeout);
9333
- const timeoutId = this.__setTimeout.call(
9334
- nativeWindow || this,
9335
- () => {
9336
- if (this.__timeouts) {
9337
- this.__timeouts.delete(timeoutId);
9338
- try {
9339
- callback(...args);
9340
- } catch (e2) {
9341
- if (this.console) {
9342
- this.console.error(e2);
9343
- } else {
9344
- console.error(e2);
9345
- }
9337
+ const timeoutId = this.__setTimeout(() => {
9338
+ if (this.__timeouts) {
9339
+ this.__timeouts.delete(timeoutId);
9340
+ try {
9341
+ callback(...args);
9342
+ } catch (e2) {
9343
+ if (this.console) {
9344
+ this.console.error(e2);
9345
+ } else {
9346
+ console.error(e2);
9346
9347
  }
9347
9348
  }
9348
- },
9349
- ms
9350
- );
9349
+ }
9350
+ }, ms);
9351
9351
  if (this.__timeouts) {
9352
9352
  this.__timeouts.add(timeoutId);
9353
9353
  }