@stencil/core 4.25.3 → 4.26.0-dev.1739336513.3b47de6

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 (41) hide show
  1. package/cli/index.cjs +4 -4
  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 +87 -16
  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 +4 -4
  10. package/dev-server/package.json +1 -1
  11. package/dev-server/server-process.js +2 -2
  12. package/internal/app-data/index.cjs +3 -3
  13. package/internal/app-data/package.json +1 -1
  14. package/internal/client/index.js +405 -14
  15. package/internal/client/package.json +1 -1
  16. package/internal/client/patch-browser.js +1 -1
  17. package/internal/client/shadow-css.js +30 -6
  18. package/internal/hydrate/index.js +434 -15
  19. package/internal/hydrate/package.json +1 -1
  20. package/internal/hydrate/runner.d.ts +22 -5
  21. package/internal/hydrate/runner.js +32 -4
  22. package/internal/package.json +1 -1
  23. package/internal/stencil-public-compiler.d.ts +23 -6
  24. package/internal/testing/index.js +407 -26
  25. package/internal/testing/package.json +1 -1
  26. package/mock-doc/index.cjs +6 -6
  27. package/mock-doc/index.d.ts +5 -1
  28. package/mock-doc/index.js +3 -3
  29. package/mock-doc/package.json +1 -1
  30. package/package.json +2 -2
  31. package/screenshot/index.js +4 -4
  32. package/screenshot/package.json +1 -1
  33. package/screenshot/pixel-match.js +1 -1
  34. package/sys/node/index.js +1 -1
  35. package/sys/node/package.json +1 -1
  36. package/sys/node/worker.js +1 -1
  37. package/testing/index.js +8 -4
  38. package/testing/jest/jest-27-and-under/matchers/html.d.ts +2 -1
  39. package/testing/jest/jest-28/matchers/html.d.ts +2 -1
  40. package/testing/jest/jest-29/matchers/html.d.ts +2 -1
  41. package/testing/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  /*
2
- Stencil Hydrate Runner v4.25.3 | MIT Licensed | https://stenciljs.com
2
+ Stencil Hydrate Runner v4.26.0-dev.1739336513.3b47de6 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  var __defProp = Object.defineProperty;
5
5
  var __export = (target, all) => {
@@ -1447,6 +1447,7 @@ var EntityDecoder = class {
1447
1447
  case EntityDecoderState.NamedEntity: {
1448
1448
  return this.result !== 0 && (this.decodeMode !== DecodingMode.Attribute || this.result === this.treeIndex) ? this.emitNotTerminatedNamedEntity() : 0;
1449
1449
  }
1450
+ // Otherwise, emit a numeric entity if we have one.
1450
1451
  case EntityDecoderState.NumericDecimal: {
1451
1452
  return this.emitNumericEntity(0, 2);
1452
1453
  }
@@ -8494,6 +8495,7 @@ function endTagInSelectInTable(p, token) {
8494
8495
  }
8495
8496
  function startTagInTemplate(p, token) {
8496
8497
  switch (token.tagID) {
8498
+ // First, handle tags that can start without a mode change
8497
8499
  case TAG_ID.BASE:
8498
8500
  case TAG_ID.BASEFONT:
8499
8501
  case TAG_ID.BGSOUND:
@@ -8507,6 +8509,7 @@ function startTagInTemplate(p, token) {
8507
8509
  startTagInHead(p, token);
8508
8510
  break;
8509
8511
  }
8512
+ // Re-process the token in the appropriate mode
8510
8513
  case TAG_ID.CAPTION:
8511
8514
  case TAG_ID.COLGROUP:
8512
8515
  case TAG_ID.TBODY:
@@ -10416,7 +10419,7 @@ function normalizeSerializationOptions(opts = {}) {
10416
10419
  removeAttributeQuotes: typeof opts.removeAttributeQuotes !== "boolean" ? false : opts.removeAttributeQuotes,
10417
10420
  removeBooleanAttributeQuotes: typeof opts.removeBooleanAttributeQuotes !== "boolean" ? false : opts.removeBooleanAttributeQuotes,
10418
10421
  removeHtmlComments: typeof opts.removeHtmlComments !== "boolean" ? false : opts.removeHtmlComments,
10419
- serializeShadowRoot: typeof opts.serializeShadowRoot !== "boolean" ? true : opts.serializeShadowRoot,
10422
+ serializeShadowRoot: typeof opts.serializeShadowRoot === "undefined" ? "declarative-shadow-dom" : opts.serializeShadowRoot,
10420
10423
  fullDocument: typeof opts.fullDocument !== "boolean" ? true : opts.fullDocument
10421
10424
  };
10422
10425
  }
@@ -10545,7 +10548,7 @@ style="${cssText}">`;
10545
10548
  }
10546
10549
  if (EMPTY_ELEMENTS.has(tagName) === false) {
10547
10550
  const shadowRoot = node.shadowRoot;
10548
- if (shadowRoot != null && opts.serializeShadowRoot) {
10551
+ if (shadowRoot != null && opts.serializeShadowRoot !== false) {
10549
10552
  output.indent = output.indent + ((_c = opts.indentSpaces) != null ? _c : 0);
10550
10553
  yield* streamToHtml(shadowRoot, opts, output);
10551
10554
  output.indent = output.indent - ((_d = opts.indentSpaces) != null ? _d : 0);
@@ -14342,6 +14345,31 @@ import { BUILD as BUILD11 } from "@stencil/core/internal/app-data";
14342
14345
  // src/runtime/initialize-component.ts
14343
14346
  import { BUILD as BUILD23 } from "@stencil/core/internal/app-data";
14344
14347
 
14348
+ // src/utils/shadow-css.ts
14349
+ /**
14350
+ * @license
14351
+ * Copyright Google Inc. All Rights Reserved.
14352
+ *
14353
+ * Use of this source code is governed by an MIT-style license that can be
14354
+ * found in the LICENSE file at https://angular.io/license
14355
+ *
14356
+ * This file is a port of shadowCSS from `webcomponents.js` to TypeScript.
14357
+ * https://github.com/webcomponents/webcomponentsjs/blob/4efecd7e0e/src/ShadowCSS/ShadowCSS.js
14358
+ * https://github.com/angular/angular/blob/master/packages/compiler/src/shadow_css.ts
14359
+ */
14360
+ var _polyfillHost = "-shadowcsshost";
14361
+ var _polyfillSlotted = "-shadowcssslotted";
14362
+ var _polyfillHostContext = "-shadowcsscontext";
14363
+ var _parenSuffix = ")(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))?([^,{]*)";
14364
+ var _cssColonHostRe = new RegExp("(" + _polyfillHost + _parenSuffix, "gim");
14365
+ var _cssColonHostContextRe = new RegExp("(" + _polyfillHostContext + _parenSuffix, "gim");
14366
+ var _cssColonSlottedRe = new RegExp("(" + _polyfillSlotted + _parenSuffix, "gim");
14367
+ var _polyfillHostNoCombinator = _polyfillHost + "-no-combinator";
14368
+ var createSupportsRuleRe = (selector) => new RegExp(`((?<!(^@supports(.*)))|(?<={.*))(${selector}\\b)`, "gim");
14369
+ var _colonSlottedRe = createSupportsRuleRe("::slotted");
14370
+ var _colonHostRe = createSupportsRuleRe(":host");
14371
+ var _colonHostContextRe = createSupportsRuleRe(":host-context");
14372
+
14345
14373
  // src/runtime/mode.ts
14346
14374
  var setMode = (handler) => modeResolutionChain.push(handler);
14347
14375
 
@@ -15569,7 +15597,7 @@ function renderToString(html, options, asStream) {
15569
15597
  const opts = normalizeHydrateOptions(options);
15570
15598
  opts.serializeToHtml = true;
15571
15599
  opts.fullDocument = typeof opts.fullDocument === "boolean" ? opts.fullDocument : true;
15572
- opts.serializeShadowRoot = typeof opts.serializeShadowRoot === "boolean" ? opts.serializeShadowRoot : true;
15600
+ opts.serializeShadowRoot = typeof opts.serializeShadowRoot === "undefined" ? "declarative-shadow-dom" : opts.serializeShadowRoot;
15573
15601
  opts.constrainTimeouts = false;
15574
15602
  return hydrateDocument(html, opts, asStream);
15575
15603
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/internal",
3
- "version": "4.25.3",
3
+ "version": "4.26.0-dev.1739336513.3b47de6",
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",
@@ -849,12 +849,29 @@ export interface SerializeDocumentOptions extends HydrateDocumentOptions {
849
849
  */
850
850
  removeHtmlComments?: boolean;
851
851
  /**
852
- * If set to `true` the component will be rendered within a Declarative Shadow DOM.
853
- * If set to `false` Stencil will ignore the contents of the shadow root and render the
854
- * element as given in provided template.
855
- * @default true
856
- */
857
- serializeShadowRoot?: boolean;
852
+ * Configure how Stencil serializes the components shadow root.
853
+ * - If set to `declarative-shadow-dom` the component will be rendered within a Declarative Shadow DOM.
854
+ * - If set to `scoped` Stencil will render the contents of the shadow root as a `scoped: true` component
855
+ * and the shadow DOM will be created during client-side hydration.
856
+ * - Alternatively you can mix and match the two by providing an object with `declarative-shadow-dom` and `scoped` keys,
857
+ * the value arrays containing the tag names of the components that should be rendered in that mode.
858
+ *
859
+ * Examples:
860
+ * - `{ 'declarative-shadow-dom': ['my-component-1', 'another-component'], default: 'scoped' }`
861
+ * Render all components as `scoped` apart from `my-component-1` and `another-component`
862
+ * - `{ 'scoped': ['an-option-component'], default: 'declarative-shadow-dom' }`
863
+ * Render all components within `declarative-shadow-dom` apart from `an-option-component`
864
+ * - `'scoped'` Render all components as `scoped`
865
+ * - `false` disables shadow root serialization
866
+ *
867
+ * *NOTE* `true` has been deprecated in favor of `declarative-shadow-dom` and `scoped`
868
+ * @default 'declarative-shadow-dom'
869
+ */
870
+ serializeShadowRoot?: 'declarative-shadow-dom' | 'scoped' | {
871
+ 'declarative-shadow-dom'?: string[];
872
+ scoped?: string[];
873
+ default: 'declarative-shadow-dom' | 'scoped';
874
+ } | boolean;
858
875
  /**
859
876
  * The `fullDocument` flag determines the format of the rendered output. Set it to true to
860
877
  * generate a complete HTML document, or false to render only the component.