@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,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/internal",
3
- "version": "4.38.3-dev.1764651902.52bdcb8",
3
+ "version": "4.38.3-dev.1764738304.c6bb6f1",
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",
@@ -52,7 +52,9 @@ export {
52
52
  setMode,
53
53
  setNonce,
54
54
  setPlatformHelpers,
55
+ setTagTransformer,
55
56
  State,
57
+ transformTag,
56
58
  Watch,
57
59
  writeTask,
58
60
  } from '../stencil-public-runtime';
@@ -132,6 +132,7 @@ export interface BuildConditionals extends Partial<BuildFeatures> {
132
132
  shadowDomShim?: boolean;
133
133
  asyncQueue?: boolean;
134
134
  transformTagName?: boolean;
135
+ additionalTagTransformers?: boolean | 'prod';
135
136
  attachStyles?: boolean;
136
137
  experimentalSlotFixes?: boolean;
137
138
  experimentalScopedSlotChanges?: boolean;
@@ -1843,6 +1844,8 @@ export interface TransformCssToEsmInput {
1843
1844
  module?: 'cjs' | 'esm' | string;
1844
1845
  file?: string;
1845
1846
  tag?: string;
1847
+ tags?: string[];
1848
+ addTagTransformers: boolean;
1846
1849
  encapsulation?: string;
1847
1850
  /**
1848
1851
  * The mode under which the CSS will be applied.
@@ -338,8 +338,13 @@ interface ConfigExtrasBase {
338
338
  /**
339
339
  * Enables the tagNameTransform option of `defineCustomElements()`, so the component tagName
340
340
  * can be customized at runtime. Defaults to `false`.
341
+ * @deprecated This option has been deprecated in favour of `setTagTransformer` and `transformTag`. It will be removed in a future major version of Stencil.
341
342
  */
342
343
  tagNameTransform?: boolean;
344
+ /**
345
+ * Adds `transformTag` calls to css strings and querySelector(All) calls
346
+ */
347
+ additionalTagTransformers?: boolean | 'prod';
343
348
  /**
344
349
  * Experimental flag.
345
350
  * Updates the behavior of scoped components to align more closely with the behavior of the native
@@ -2711,6 +2716,14 @@ export interface TranspileOptions {
2711
2716
  * `tsconfig.json` to relative paths.
2712
2717
  */
2713
2718
  transformAliasedImportPaths?: boolean;
2719
+ /**
2720
+ * List of tags to transform, by default only the incoming component tag is transformed
2721
+ */
2722
+ tagsToTransform?: string[];
2723
+ /**
2724
+ * Adds `transformTag` calls to css strings and querySelector(All) calls
2725
+ */
2726
+ additionalTagTransformers?: boolean;
2714
2727
  }
2715
2728
  export type CompileTarget = 'latest' | 'esnext' | 'es2020' | 'es2019' | 'es2018' | 'es2017' | 'es2015' | 'es5' | string | undefined;
2716
2729
  export interface TranspileResults {
@@ -386,6 +386,27 @@ export declare function readTask(task: RafCallback): void;
386
386
  * Unhandled exception raised while rendering, during event handling, or lifecycles will trigger the custom event handler.
387
387
  */
388
388
  export declare const setErrorHandler: (handler: ErrorHandler) => void;
389
+ export type TagTransformer = (tag: string) => string;
390
+ /**
391
+ * Sets a tag transformer to be used when rendering your custom elements.
392
+ * ```ts
393
+ * setTagTransformer((tag) => {
394
+ * if (tag.startsWith('my-')) return `new-${tag}`
395
+ * return tag;
396
+ * });
397
+ * ```
398
+ * Will mean all your components that start with `my-` are defined instead with `new-my-` prefix.
399
+ *
400
+ * @param transformer the transformer function to use which must return a string.
401
+ */
402
+ export declare function setTagTransformer(transformer: TagTransformer): void;
403
+ /**
404
+ * Transforms a tag name using a transformer set via `setTagTransformer`
405
+ *
406
+ * @param tag - the tag to transform e.g. `my-tag`
407
+ * @returns the transformed tag e.g. `new-my-tag`
408
+ */
409
+ export declare function transformTag(tag: string): string;
389
410
  /**
390
411
  * @deprecated - Use `MixedInCtor` instead:
391
412
  * ```ts
@@ -1768,6 +1789,7 @@ export interface CustomElementsDefineOptions {
1768
1789
  exclude?: string[];
1769
1790
  resourcesUrl?: string;
1770
1791
  syncQueue?: boolean;
1792
+ /** @deprecated in-favour of `setTagTransformer` and `transformTag` */
1771
1793
  transformTagName?: (tagName: string) => string;
1772
1794
  jmp?: (c: Function) => any;
1773
1795
  raf?: (c: FrameRequestCallback) => number;
@@ -75,6 +75,7 @@ __export(index_exports, {
75
75
  setPlatformOptions: () => setPlatformOptions,
76
76
  setScopedSSR: () => setScopedSSR,
77
77
  setSupportsShadowDom: () => setSupportsShadowDom,
78
+ setTagTransformer: () => setTagTransformer,
78
79
  setValue: () => setValue,
79
80
  startAutoApplyChanges: () => startAutoApplyChanges,
80
81
  stopAutoApplyChanges: () => stopAutoApplyChanges,
@@ -83,6 +84,7 @@ __export(index_exports, {
83
84
  supportsListenerOptions: () => supportsListenerOptions,
84
85
  supportsMutableAdoptedStyleSheets: () => supportsMutableAdoptedStyleSheets,
85
86
  supportsShadow: () => supportsShadow,
87
+ transformTag: () => transformTag,
86
88
  win: () => win,
87
89
  writeTask: () => writeTask
88
90
  });
@@ -1408,6 +1410,9 @@ var hydrateScopedToShadow = () => {
1408
1410
  // src/runtime/vdom/h.ts
1409
1411
  var import_app_data6 = require("@stencil/core/internal/app-data");
1410
1412
  var h = (nodeName, vnodeData, ...children) => {
1413
+ if (typeof nodeName === "string") {
1414
+ nodeName = transformTag(nodeName);
1415
+ }
1411
1416
  let child = null;
1412
1417
  let key = null;
1413
1418
  let slotName = null;
@@ -1590,7 +1595,7 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1590
1595
  const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId);
1591
1596
  const node = childRenderNode.$elm$;
1592
1597
  if (!shadowRoot) {
1593
- node["s-hn"] = tagName.toUpperCase();
1598
+ node["s-hn"] = transformTag(tagName).toUpperCase();
1594
1599
  if (childRenderNode.$tag$ === "slot") {
1595
1600
  node["s-cr"] = hostElm["s-cr"];
1596
1601
  }
@@ -3184,7 +3189,7 @@ render() {
3184
3189
  if (import_app_data13.BUILD.experimentalScopedSlotChanges && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
3185
3190
  const children = rootVnode.$elm$.__childNodes || rootVnode.$elm$.childNodes;
3186
3191
  for (const childNode of children) {
3187
- if (childNode["s-hn"] !== hostTagName && !childNode["s-sh"]) {
3192
+ if (childNode["s-hn"] !== hostTagName && !childNode["s-sh"] && childNode.nodeType === 1 /* ElementNode */) {
3188
3193
  if (isInitialLoad && childNode["s-ih"] == null) {
3189
3194
  childNode["s-ih"] = (_e = childNode.hidden) != null ? _e : false;
3190
3195
  }
@@ -4024,7 +4029,10 @@ var disconnectedCallback = async (elm) => {
4024
4029
 
4025
4030
  // src/runtime/bootstrap-custom-element.ts
4026
4031
  var defineCustomElement = (Cstr, compactMeta) => {
4027
- customElements.define(compactMeta[1], proxyCustomElement(Cstr, compactMeta));
4032
+ customElements.define(
4033
+ transformTag(compactMeta[1]),
4034
+ proxyCustomElement(Cstr, compactMeta)
4035
+ );
4028
4036
  };
4029
4037
  var proxyCustomElement = (Cstr, compactMeta) => {
4030
4038
  const cmpMeta = {
@@ -4215,7 +4223,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
4215
4223
  if (import_app_data21.BUILD.shadowDom && !supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
4216
4224
  cmpMeta.$flags$ |= 8 /* needsShadowDomShim */;
4217
4225
  }
4218
- const tagName = import_app_data21.BUILD.transformTagName && options.transformTagName ? options.transformTagName(cmpMeta.$tagName$) : cmpMeta.$tagName$;
4226
+ const tagName = import_app_data21.BUILD.transformTagName && options.transformTagName ? options.transformTagName(cmpMeta.$tagName$) : transformTag(cmpMeta.$tagName$);
4219
4227
  const HostElement = class extends HTMLElement {
4220
4228
  // StencilLazyHost
4221
4229
  constructor(self) {
@@ -4433,6 +4441,22 @@ function render(vnode, container) {
4433
4441
  renderVdom(ref, vnode);
4434
4442
  }
4435
4443
 
4444
+ // src/runtime/tag-transform.ts
4445
+ var tagTransformer = void 0;
4446
+ function transformTag(tag) {
4447
+ if (!tagTransformer) return tag;
4448
+ return tagTransformer(tag);
4449
+ }
4450
+ function setTagTransformer(transformer) {
4451
+ if (tagTransformer) {
4452
+ console.warn(`
4453
+ A tagTransformer has already been set.
4454
+ Overwriting it may lead to error and unexpected results if your components have already been defined.
4455
+ `);
4456
+ }
4457
+ tagTransformer = transformer;
4458
+ }
4459
+
4436
4460
  // src/runtime/vdom/vdom-annotations.ts
4437
4461
  var insertVdomAnnotations = (doc, staticComponents) => {
4438
4462
  if (doc != null) {
@@ -4641,6 +4665,7 @@ var scopedSSR = false;
4641
4665
  setPlatformOptions,
4642
4666
  setScopedSSR,
4643
4667
  setSupportsShadowDom,
4668
+ setTagTransformer,
4644
4669
  setValue,
4645
4670
  startAutoApplyChanges,
4646
4671
  stopAutoApplyChanges,
@@ -4649,6 +4674,7 @@ var scopedSSR = false;
4649
4674
  supportsListenerOptions,
4650
4675
  supportsMutableAdoptedStyleSheets,
4651
4676
  supportsShadow,
4677
+ transformTag,
4652
4678
  win,
4653
4679
  writeTask
4654
4680
  });
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/internal/testing",
3
- "version": "4.38.3-dev.1764651902.52bdcb8",
3
+ "version": "4.38.3-dev.1764738304.c6bb6f1",
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