@stencil/core 4.38.3-dev.1764651902.52bdcb8 → 4.38.3-dev.1764738304.c6bb6f1

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 (45) hide show
  1. package/cli/index.cjs +2 -1
  2. package/cli/index.js +2 -1
  3. package/cli/package.json +1 -1
  4. package/compiler/package.json +1 -1
  5. package/compiler/stencil.js +16369 -5558
  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 +6 -5
  12. package/internal/app-data/index.cjs +1 -0
  13. package/internal/app-data/index.js +1 -0
  14. package/internal/app-data/package.json +1 -1
  15. package/internal/app-globals/package.json +1 -1
  16. package/internal/client/index.js +29 -5
  17. package/internal/client/package.json +1 -1
  18. package/internal/client/patch-browser.js +1 -1
  19. package/internal/hydrate/index.js +35 -5
  20. package/internal/hydrate/package.json +1 -1
  21. package/internal/hydrate/runner.d.ts +12 -0
  22. package/internal/hydrate/runner.js +1357 -1330
  23. package/internal/package.json +1 -1
  24. package/internal/stencil-core/index.d.ts +2 -0
  25. package/internal/stencil-private.d.ts +3 -0
  26. package/internal/stencil-public-compiler.d.ts +13 -0
  27. package/internal/stencil-public-runtime.d.ts +22 -0
  28. package/internal/testing/index.js +30 -4
  29. package/internal/testing/package.json +1 -1
  30. package/mock-doc/index.cjs +226 -226
  31. package/mock-doc/index.js +226 -226
  32. package/mock-doc/package.json +1 -1
  33. package/package.json +5 -2
  34. package/screenshot/index.js +2 -1
  35. package/screenshot/package.json +1 -1
  36. package/screenshot/pixel-match.js +3 -3
  37. package/sys/node/autoprefixer.js +2 -2
  38. package/sys/node/glob.js +1 -1
  39. package/sys/node/index.js +18 -18
  40. package/sys/node/node-fetch.js +1 -1
  41. package/sys/node/package.json +1 -1
  42. package/sys/node/worker.js +1 -1
  43. package/testing/index.js +35 -7
  44. package/testing/package.json +1 -1
  45. package/testing/puppeteer/puppeteer-browser.d.ts +1 -1
@@ -1,5 +1,5 @@
1
1
  /*
2
- Stencil Client Platform v4.38.3-dev.1764651902.52bdcb8 | MIT Licensed | https://stenciljs.com
2
+ Stencil Client Platform v4.38.3-dev.1764738304.c6bb6f1 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  var __defProp = Object.defineProperty;
5
5
  var __export = (target, all) => {
@@ -1307,6 +1307,9 @@ var hydrateScopedToShadow = () => {
1307
1307
  // src/runtime/vdom/h.ts
1308
1308
  import { BUILD as BUILD13 } from "@stencil/core/internal/app-data";
1309
1309
  var h = (nodeName, vnodeData, ...children) => {
1310
+ if (typeof nodeName === "string") {
1311
+ nodeName = transformTag(nodeName);
1312
+ }
1310
1313
  let child = null;
1311
1314
  let key = null;
1312
1315
  let slotName = null;
@@ -1489,7 +1492,7 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1489
1492
  const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId);
1490
1493
  const node = childRenderNode.$elm$;
1491
1494
  if (!shadowRoot) {
1492
- node["s-hn"] = tagName.toUpperCase();
1495
+ node["s-hn"] = transformTag(tagName).toUpperCase();
1493
1496
  if (childRenderNode.$tag$ === "slot") {
1494
1497
  node["s-cr"] = hostElm["s-cr"];
1495
1498
  }
@@ -3083,7 +3086,7 @@ render() {
3083
3086
  if (BUILD20.experimentalScopedSlotChanges && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
3084
3087
  const children = rootVnode.$elm$.__childNodes || rootVnode.$elm$.childNodes;
3085
3088
  for (const childNode of children) {
3086
- if (childNode["s-hn"] !== hostTagName && !childNode["s-sh"]) {
3089
+ if (childNode["s-hn"] !== hostTagName && !childNode["s-sh"] && childNode.nodeType === 1 /* ElementNode */) {
3087
3090
  if (isInitialLoad && childNode["s-ih"] == null) {
3088
3091
  childNode["s-ih"] = (_e = childNode.hidden) != null ? _e : false;
3089
3092
  }
@@ -3923,7 +3926,10 @@ var disconnectedCallback = async (elm) => {
3923
3926
 
3924
3927
  // src/runtime/bootstrap-custom-element.ts
3925
3928
  var defineCustomElement = (Cstr, compactMeta) => {
3926
- customElements.define(compactMeta[1], proxyCustomElement(Cstr, compactMeta));
3929
+ customElements.define(
3930
+ transformTag(compactMeta[1]),
3931
+ proxyCustomElement(Cstr, compactMeta)
3932
+ );
3927
3933
  };
3928
3934
  var proxyCustomElement = (Cstr, compactMeta) => {
3929
3935
  const cmpMeta = {
@@ -4114,7 +4120,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
4114
4120
  if (BUILD28.shadowDom && !supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
4115
4121
  cmpMeta.$flags$ |= 8 /* needsShadowDomShim */;
4116
4122
  }
4117
- const tagName = BUILD28.transformTagName && options.transformTagName ? options.transformTagName(cmpMeta.$tagName$) : cmpMeta.$tagName$;
4123
+ const tagName = BUILD28.transformTagName && options.transformTagName ? options.transformTagName(cmpMeta.$tagName$) : transformTag(cmpMeta.$tagName$);
4118
4124
  const HostElement = class extends HTMLElement {
4119
4125
  // StencilLazyHost
4120
4126
  constructor(self) {
@@ -4332,6 +4338,22 @@ function render(vnode, container) {
4332
4338
  renderVdom(ref, vnode);
4333
4339
  }
4334
4340
 
4341
+ // src/runtime/tag-transform.ts
4342
+ var tagTransformer = void 0;
4343
+ function transformTag(tag) {
4344
+ if (!tagTransformer) return tag;
4345
+ return tagTransformer(tag);
4346
+ }
4347
+ function setTagTransformer(transformer) {
4348
+ if (tagTransformer) {
4349
+ console.warn(`
4350
+ A tagTransformer has already been set.
4351
+ Overwriting it may lead to error and unexpected results if your components have already been defined.
4352
+ `);
4353
+ }
4354
+ tagTransformer = transformer;
4355
+ }
4356
+
4335
4357
  // src/runtime/vdom/vdom-annotations.ts
4336
4358
  var insertVdomAnnotations = (doc, staticComponents) => {
4337
4359
  if (doc != null) {
@@ -4532,12 +4554,14 @@ export {
4532
4554
  setPlatformHelpers,
4533
4555
  setPlatformOptions,
4534
4556
  setScopedSSR,
4557
+ setTagTransformer,
4535
4558
  setValue,
4536
4559
  styles,
4537
4560
  supportsConstructableStylesheets,
4538
4561
  supportsListenerOptions,
4539
4562
  supportsMutableAdoptedStyleSheets,
4540
4563
  supportsShadow,
4564
+ transformTag,
4541
4565
  win,
4542
4566
  writeTask
4543
4567
  };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/internal/client",
3
- "version": "4.38.3-dev.1764651902.52bdcb8",
3
+ "version": "4.38.3-dev.1764738304.c6bb6f1",
4
4
  "description": "Stencil internal client platform to be imported by the Stencil Compiler and internal runtime. Breaking changes can and will happen at any time.",
5
5
  "main": "./index.js",
6
6
  "exports": "./index.js",
@@ -1,5 +1,5 @@
1
1
  /*
2
- Stencil Client Patch Browser v4.38.3-dev.1764651902.52bdcb8 | MIT Licensed | https://stenciljs.com
2
+ Stencil Client Patch Browser v4.38.3-dev.1764738304.c6bb6f1 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
 
5
5
  // src/client/client-patch-browser.ts
@@ -1,5 +1,5 @@
1
1
  /*
2
- Stencil Hydrate Platform v4.38.3-dev.1764651902.52bdcb8 | MIT Licensed | https://stenciljs.com
2
+ Stencil Hydrate Platform v4.38.3-dev.1764738304.c6bb6f1 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  var __defProp = Object.defineProperty;
5
5
  var __export = (target, all) => {
@@ -1070,6 +1070,9 @@ var hydrateScopedToShadow = () => {
1070
1070
  // src/runtime/vdom/h.ts
1071
1071
  import { BUILD as BUILD7 } from "@stencil/core/internal/app-data";
1072
1072
  var h = (nodeName, vnodeData, ...children) => {
1073
+ if (typeof nodeName === "string") {
1074
+ nodeName = transformTag(nodeName);
1075
+ }
1073
1076
  let child = null;
1074
1077
  let key = null;
1075
1078
  let slotName = null;
@@ -1252,7 +1255,7 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1252
1255
  const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId);
1253
1256
  const node = childRenderNode.$elm$;
1254
1257
  if (!shadowRoot) {
1255
- node["s-hn"] = tagName.toUpperCase();
1258
+ node["s-hn"] = transformTag(tagName).toUpperCase();
1256
1259
  if (childRenderNode.$tag$ === "slot") {
1257
1260
  node["s-cr"] = hostElm["s-cr"];
1258
1261
  }
@@ -2846,7 +2849,7 @@ render() {
2846
2849
  if (BUILD14.experimentalScopedSlotChanges && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
2847
2850
  const children = rootVnode.$elm$.__childNodes || rootVnode.$elm$.childNodes;
2848
2851
  for (const childNode of children) {
2849
- if (childNode["s-hn"] !== hostTagName && !childNode["s-sh"]) {
2852
+ if (childNode["s-hn"] !== hostTagName && !childNode["s-sh"] && childNode.nodeType === 1 /* ElementNode */) {
2850
2853
  if (isInitialLoad && childNode["s-ih"] == null) {
2851
2854
  childNode["s-ih"] = (_e = childNode.hidden) != null ? _e : false;
2852
2855
  }
@@ -3686,7 +3689,10 @@ var disconnectedCallback = async (elm) => {
3686
3689
 
3687
3690
  // src/runtime/bootstrap-custom-element.ts
3688
3691
  var defineCustomElement = (Cstr, compactMeta) => {
3689
- customElements.define(compactMeta[1], proxyCustomElement(Cstr, compactMeta));
3692
+ customElements.define(
3693
+ transformTag(compactMeta[1]),
3694
+ proxyCustomElement(Cstr, compactMeta)
3695
+ );
3690
3696
  };
3691
3697
  var proxyCustomElement = (Cstr, compactMeta) => {
3692
3698
  const cmpMeta = {
@@ -3877,7 +3883,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
3877
3883
  if (BUILD22.shadowDom && !supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
3878
3884
  cmpMeta.$flags$ |= 8 /* needsShadowDomShim */;
3879
3885
  }
3880
- const tagName = BUILD22.transformTagName && options.transformTagName ? options.transformTagName(cmpMeta.$tagName$) : cmpMeta.$tagName$;
3886
+ const tagName = BUILD22.transformTagName && options.transformTagName ? options.transformTagName(cmpMeta.$tagName$) : transformTag(cmpMeta.$tagName$);
3881
3887
  const HostElement = class extends HTMLElement {
3882
3888
  // StencilLazyHost
3883
3889
  constructor(self) {
@@ -4078,6 +4084,22 @@ function Mixin(...mixins) {
4078
4084
  // src/runtime/nonce.ts
4079
4085
  var setNonce = (nonce) => plt.$nonce$ = nonce;
4080
4086
 
4087
+ // src/runtime/tag-transform.ts
4088
+ var tagTransformer = void 0;
4089
+ function transformTag(tag) {
4090
+ if (!tagTransformer) return tag;
4091
+ return tagTransformer(tag);
4092
+ }
4093
+ function setTagTransformer(transformer) {
4094
+ if (tagTransformer) {
4095
+ console.warn(`
4096
+ A tagTransformer has already been set.
4097
+ Overwriting it may lead to error and unexpected results if your components have already been defined.
4098
+ `);
4099
+ }
4100
+ tagTransformer = transformer;
4101
+ }
4102
+
4081
4103
  // src/runtime/vdom/vdom-annotations.ts
4082
4104
  var insertVdomAnnotations = (doc, staticComponents) => {
4083
4105
  if (doc != null) {
@@ -4652,9 +4674,15 @@ var isMemberInElement = (elm, memberName) => {
4652
4674
  var registerComponents = (Cstrs) => {
4653
4675
  for (const Cstr of Cstrs) {
4654
4676
  const exportName = Cstr.cmpMeta.$tagName$;
4677
+ const transformedTagName = everywhere.tagTransform(exportName);
4655
4678
  cmpModules.set(exportName, {
4656
4679
  [exportName]: Cstr
4657
4680
  });
4681
+ if (transformedTagName !== exportName) {
4682
+ cmpModules.set(transformedTagName, {
4683
+ [transformedTagName]: Cstr
4684
+ });
4685
+ }
4658
4686
  }
4659
4687
  };
4660
4688
  var win = window;
@@ -4803,12 +4831,14 @@ export {
4803
4831
  setNonce,
4804
4832
  setPlatformHelpers,
4805
4833
  setScopedSSR,
4834
+ setTagTransformer,
4806
4835
  setValue,
4807
4836
  styles,
4808
4837
  supportsConstructableStylesheets,
4809
4838
  supportsListenerOptions,
4810
4839
  supportsMutableAdoptedStyleSheets,
4811
4840
  supportsShadow,
4841
+ transformTag,
4812
4842
  win,
4813
4843
  writeTask
4814
4844
  };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/internal/hydrate",
3
- "version": "4.38.3-dev.1764651902.52bdcb8",
3
+ "version": "4.38.3-dev.1764738304.c6bb6f1",
4
4
  "description": "Stencil internal hydrate 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
@@ -3,6 +3,7 @@
3
3
  import { Readable } from 'node:stream';
4
4
 
5
5
  export declare function createWindowFromHtml(templateHtml: string, uniqueId: string): any;
6
+ export type TagTransformer = (tag: string) => string;
6
7
  /**
7
8
  * Serialize a value to a string that can be deserialized later.
8
9
  * @param {unknown} value - The value to serialize.
@@ -271,5 +272,16 @@ export declare function renderToString(html: string | any, options: SerializeDoc
271
272
  export declare function hydrateDocument(doc: any | string, options?: HydrateDocumentOptions): Promise<HydrateResults>;
272
273
  export declare function hydrateDocument(doc: any | string, options: HydrateDocumentOptions | undefined, asStream?: boolean): Readable;
273
274
  export declare function serializeDocumentToString(doc: Document, opts: HydrateFactoryOptions): string;
275
+ /**
276
+ * Transforms a tag name using the current tag transformer
277
+ * @param tag - the tag to transform e.g. `my-tag`
278
+ * @returns the transformed tag e.g. `new-my-tag`
279
+ */
280
+ export declare function transformTag<T extends string>(tag: T): T;
281
+ /**
282
+ * Sets the tag transformer to be used when rendering custom elements
283
+ * @param transformer the transformer function to use. Must return a string
284
+ */
285
+ export declare function setTagTransformer(transformer: TagTransformer): void;
274
286
 
275
287
  export {};