@stencil/core 4.36.3 → 4.37.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 (38) hide show
  1. package/cli/index.cjs +6 -1
  2. package/cli/index.js +6 -1
  3. package/cli/package.json +1 -1
  4. package/compiler/package.json +1 -1
  5. package/compiler/stencil.js +1153 -858
  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 +7 -2
  12. package/internal/app-data/package.json +1 -1
  13. package/internal/app-globals/package.json +1 -1
  14. package/internal/client/index.js +41 -15
  15. package/internal/client/package.json +1 -1
  16. package/internal/client/patch-browser.js +1 -1
  17. package/internal/hydrate/index.js +45 -19
  18. package/internal/hydrate/package.json +1 -1
  19. package/internal/hydrate/runner.js +8 -2
  20. package/internal/package.json +1 -1
  21. package/internal/stencil-core/index.d.ts +1 -0
  22. package/internal/stencil-core/index.js +1 -0
  23. package/internal/stencil-private.d.ts +3 -0
  24. package/internal/stencil-public-runtime.d.ts +21 -0
  25. package/internal/testing/index.js +19 -3
  26. package/internal/testing/package.json +1 -1
  27. package/mock-doc/index.cjs +1 -1
  28. package/mock-doc/index.js +1 -1
  29. package/mock-doc/package.json +1 -1
  30. package/package.json +2 -2
  31. package/screenshot/index.js +6 -1
  32. package/screenshot/package.json +1 -1
  33. package/screenshot/pixel-match.js +1 -1
  34. package/sys/node/index.js +25 -25
  35. package/sys/node/package.json +1 -1
  36. package/sys/node/worker.js +1 -1
  37. package/testing/index.js +3 -1
  38. package/testing/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/internal",
3
- "version": "4.36.3",
3
+ "version": "4.37.0",
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",
@@ -39,6 +39,7 @@ export {
39
39
  Host,
40
40
  Listen,
41
41
  Method,
42
+ Mixin,
42
43
  Prop,
43
44
  readTask,
44
45
  render,
@@ -7,6 +7,7 @@ export {
7
7
  getRenderingRef,
8
8
  h,
9
9
  Host,
10
+ Mixin,
10
11
  readTask,
11
12
  render,
12
13
  setAssetPath,
@@ -532,6 +532,7 @@ export interface ComponentCompilerMeta extends ComponentCompilerFeatures {
532
532
  */
533
533
  directDependents: string[];
534
534
  docs: CompilerJsDoc;
535
+ doesExtend: boolean;
535
536
  elementRef: string;
536
537
  encapsulation: Encapsulation;
537
538
  events: ComponentCompilerEvent[];
@@ -1075,6 +1076,8 @@ export type ModuleMap = Map<string, Module>;
1075
1076
  */
1076
1077
  export interface Module {
1077
1078
  cmps: ComponentCompilerMeta[];
1079
+ isMixin: boolean;
1080
+ isExtended: boolean;
1078
1081
  /**
1079
1082
  * A collection of modules that a component will need. The modules in this list must have import statements generated
1080
1083
  * in order for the component to function.
@@ -1,4 +1,6 @@
1
1
  declare type CustomMethodDecorator<T> = (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T> | void;
2
+ type UnionToIntersection<U> = (U extends any ? (x: U) => void : never) extends (x: infer I) => void ? I : never;
3
+ type MixinFactory = <TBase extends abstract new (...args: any[]) => any>(base: TBase) => abstract new (...args: ConstructorParameters<TBase>) => any;
2
4
  export interface ComponentDecorator {
3
5
  (opts?: ComponentOptions): ClassDecorator;
4
6
  }
@@ -349,6 +351,25 @@ export declare function readTask(task: RafCallback): void;
349
351
  * Unhandled exception raised while rendering, during event handling, or lifecycles will trigger the custom event handler.
350
352
  */
351
353
  export declare const setErrorHandler: (handler: ErrorHandler) => void;
354
+ /**
355
+ * Compose multiple mixin classes into a single constructor.
356
+ * The resulting class has the combined instance types of all mixed-in classes.
357
+ *
358
+ * Example:
359
+ * ```
360
+ * const AWrap = (Base) => {class A extends Base { propA = A }; return A;}
361
+ * const BWrap = (Base) => {class B extends Base { propB = B }; return B;}
362
+ * const CWrap = (Base) => {class C extends Base { propC = C }; return C;}
363
+ *
364
+ * class X extends Mixin(AWrap, BWrap, CWrap) {
365
+ * render() { return <div>{this.propA} {this.propB} {this.propC}</div>; }
366
+ * }
367
+ * ```
368
+ *
369
+ * @param mixinFactories mixin factory functions that return a class which extends from the provided class.
370
+ * @returns a class that that is composed from extending each of the provided classes in the order they were provided.
371
+ */
372
+ export declare function Mixin<TMixins extends readonly MixinFactory[]>(...mixinFactories: TMixins): abstract new (...args: any[]) => UnionToIntersection<InstanceType<ReturnType<TMixins[number]>>>;
352
373
  /**
353
374
  * This file gets copied to all distributions of stencil component collections.
354
375
  * - no imports
@@ -21,10 +21,11 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
23
  Build: () => Build,
24
- Env: () => import_app_data23.Env,
24
+ Env: () => import_app_data24.Env,
25
25
  Fragment: () => Fragment,
26
26
  HYDRATED_STYLE_ID: () => HYDRATED_STYLE_ID,
27
27
  Host: () => Host,
28
+ Mixin: () => Mixin,
28
29
  addHostEventListeners: () => addHostEventListeners,
29
30
  bootstrapLazy: () => bootstrapLazy,
30
31
  connectedCallback: () => connectedCallback,
@@ -375,7 +376,7 @@ var isMemberInElement = (elm, memberName) => {
375
376
  };
376
377
 
377
378
  // src/testing/platform/index.ts
378
- var import_app_data23 = require("@stencil/core/internal/app-data");
379
+ var import_app_data24 = require("@stencil/core/internal/app-data");
379
380
 
380
381
  // src/runtime/asset-path.ts
381
382
  var getAssetPath = (path) => {
@@ -3826,7 +3827,12 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
3826
3827
  } else {
3827
3828
  Cstr = elm.constructor;
3828
3829
  const cmpTag = elm.localName;
3829
- customElements.whenDefined(cmpTag).then(() => hostRef.$flags$ |= 128 /* isWatchReady */);
3830
+ const setWatchIsReady = () => hostRef.$flags$ |= 128 /* isWatchReady */;
3831
+ if (!!customElements.get(cmpTag)) {
3832
+ setWatchIsReady();
3833
+ } else {
3834
+ customElements.whenDefined(cmpTag).then(setWatchIsReady);
3835
+ }
3830
3836
  }
3831
3837
  if (import_app_data17.BUILD.style && Cstr && Cstr.style) {
3832
3838
  let style;
@@ -4359,6 +4365,15 @@ var hostListenerOpts = (flags) => supportsListenerOptions ? {
4359
4365
  capture: (flags & 2 /* Capture */) !== 0
4360
4366
  } : (flags & 2 /* Capture */) !== 0;
4361
4367
 
4368
+ // src/runtime/mixin.ts
4369
+ var import_app_data23 = require("@stencil/core/internal/app-data");
4370
+ var baseClass = import_app_data23.BUILD.lazyLoad ? class {
4371
+ } : globalThis.HTMLElement || class {
4372
+ };
4373
+ function Mixin(...mixins) {
4374
+ return mixins.reduceRight((acc, mixin) => mixin(acc), baseClass);
4375
+ }
4376
+
4362
4377
  // src/runtime/nonce.ts
4363
4378
  var setNonce = (nonce) => plt.$nonce$ = nonce;
4364
4379
 
@@ -4537,6 +4552,7 @@ var scopedSSR = false;
4537
4552
  Fragment,
4538
4553
  HYDRATED_STYLE_ID,
4539
4554
  Host,
4555
+ Mixin,
4540
4556
  addHostEventListeners,
4541
4557
  bootstrapLazy,
4542
4558
  connectedCallback,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/internal/testing",
3
- "version": "4.36.3",
3
+ "version": "4.37.0",
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.36.3 | MIT Licensed | https://stenciljs.com
2
+ Stencil Mock Doc (CommonJS) v4.37.0 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  "use strict";
5
5
  var __defProp = Object.defineProperty;
package/mock-doc/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Stencil Mock Doc v4.36.3 | MIT Licensed | https://stenciljs.com
2
+ Stencil Mock Doc v4.37.0 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
 
5
5
  // src/runtime/runtime-constants.ts
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/mock-doc",
3
- "version": "4.36.3",
3
+ "version": "4.37.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.36.3",
3
+ "version": "4.37.0",
4
4
  "license": "MIT",
5
5
  "main": "./internal/stencil-core/index.cjs",
6
6
  "module": "./internal/stencil-core/index.js",
@@ -121,7 +121,7 @@
121
121
  "test.dist": "npm run ts scripts/index.ts -- --validate-build",
122
122
  "test.end-to-end": "cd test/end-to-end && npm ci && npm test && npm run test.dist",
123
123
  "test.jest": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js",
124
- "test.type-tests": "cd ./test/wdio && npm install && npm run build.main && cd ../../ && tsc -p test/type-tests/tsconfig.json",
124
+ "test.type-tests": "cd ./test/wdio && npm install && npm run build.test-sibling && npm run build.main && cd ../../ && tsc -p test/type-tests/tsconfig.json",
125
125
  "test.wdio": "cd test/wdio && npm ci && npm run test",
126
126
  "test.wdio.testOnly": "cd test/wdio && npm ci && npm run wdio",
127
127
  "test.prod": "npm run test.dist && npm run test.end-to-end && npm run test.jest && npm run test.wdio && npm run test.testing && npm run test.analysis",
@@ -1,5 +1,5 @@
1
1
  /*
2
- Stencil Screenshot v4.36.3 | MIT Licensed | https://stenciljs.com
2
+ Stencil Screenshot v4.37.0 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  "use strict";
5
5
  var __create = Object.create;
@@ -733,6 +733,11 @@ var _colonHostContextRe = createSupportsRuleRe(":host-context");
733
733
  var CAPTURE_EVENT_SUFFIX = "Capture";
734
734
  var CAPTURE_EVENT_REGEX = new RegExp(CAPTURE_EVENT_SUFFIX + "$");
735
735
 
736
+ // src/runtime/mixin.ts
737
+ var baseClass = BUILD.lazyLoad ? class {
738
+ } : globalThis.HTMLElement || class {
739
+ };
740
+
736
741
  // src/utils/util.ts
737
742
  var lowerPathParam = (fn) => (p) => fn(p.toLowerCase());
738
743
  var isDtsFile = lowerPathParam((p) => p.endsWith(".d.ts") || p.endsWith(".d.mts") || p.endsWith(".d.cts"));
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/screenshot",
3
- "version": "4.36.3",
3
+ "version": "4.37.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.36.3 | MIT Licensed | https://stenciljs.com
2
+ Stencil Screenshot Pixel Match v4.37.0 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  "use strict";
5
5
  var __create = Object.create;