@stencil/core 5.0.0-alpha.8 → 5.0.0-beta.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 (50) hide show
  1. package/README.md +94 -0
  2. package/dist/app-data/index.d.ts +2 -0
  3. package/dist/{runtime/app-data → app-data}/index.js +5 -2
  4. package/dist/client-BRu0GtRn.mjs +2368 -0
  5. package/dist/compiler/index.d.mts +167 -3
  6. package/dist/compiler/index.mjs +3 -3
  7. package/dist/compiler/utils/index.d.mts +272 -2
  8. package/dist/compiler/utils/index.mjs +4 -3
  9. package/dist/{compiler-B3pUYg_P.mjs → compiler-NrvbUOX1.mjs} +2904 -1269
  10. package/dist/declarations/stencil-ext-modules.d.ts +5 -5
  11. package/dist/declarations/stencil-public-compiler.d.ts +208 -62
  12. package/dist/declarations/stencil-public-docs.d.ts +9 -0
  13. package/dist/declarations/stencil-public-runtime.d.ts +91 -6
  14. package/dist/fragment-Di1hWOC8.mjs +4 -0
  15. package/dist/{regular-expression-CFVJOTUh.mjs → helpers-Cpp3qc3u.mjs} +31 -15
  16. package/dist/index-BOrz3rbJ.d.mts +100 -0
  17. package/dist/{index-BuveMLxy.d.ts → index-DnISpqrd.d.ts} +150 -10
  18. package/dist/{index-CVhWFUM0.d.mts → index-RrQfiPWK.d.mts} +490 -841
  19. package/dist/index.d.mts +4 -0
  20. package/dist/index.mjs +91 -2
  21. package/dist/jsx-runtime.mjs +2 -1
  22. package/dist/{node-10UamZmn.mjs → node-75gQKkFz.mjs} +60 -58
  23. package/dist/{chunk-z9aeyW2b.mjs → rolldown-runtime-BhDjJH2R.mjs} +1 -1
  24. package/dist/runtime/client/lazy.js +483 -347
  25. package/dist/runtime/client/runtime.d.ts +150 -39
  26. package/dist/runtime/client/runtime.js +483 -347
  27. package/dist/runtime/index.d.ts +6 -32
  28. package/dist/runtime/index.js +482 -345
  29. package/dist/runtime/server/index.d.mts +81 -9
  30. package/dist/runtime/server/index.mjs +419 -193
  31. package/dist/runtime/server/runner.d.mts +3 -0
  32. package/dist/runtime/server/runner.mjs +321 -338
  33. package/dist/signals/index.d.ts +2 -0
  34. package/dist/signals/index.js +5 -2
  35. package/dist/sys/node/index.d.mts +1 -2
  36. package/dist/sys/node/index.mjs +1 -1
  37. package/dist/sys/node/worker.d.mts +1 -1
  38. package/dist/sys/node/worker.mjs +6 -3
  39. package/dist/testing/index.d.mts +4716 -105
  40. package/dist/testing/index.mjs +7744 -791
  41. package/dist/util-IKfWWLJo.mjs +724 -0
  42. package/dist/validation-DAdGTrys.mjs +791 -0
  43. package/package.json +33 -33
  44. package/dist/client-Dd-NB5Ei.mjs +0 -4833
  45. package/dist/index-ch-cf-bZ.d.mts +0 -205
  46. package/dist/runtime/app-data/index.d.ts +0 -2
  47. package/dist/validation-ByxKj8bC.mjs +0 -1458
  48. /package/{LICENSE.md → LICENSE} +0 -0
  49. /package/dist/{runtime/app-globals → app-globals}/index.d.ts +0 -0
  50. /package/dist/{runtime/app-globals → app-globals}/index.js +0 -0
@@ -1,4 +1,6 @@
1
- import { BUILD, Env, NAMESPACE } from "@stencil/core/runtime/app-data";
1
+ import { BUILD, Env, NAMESPACE } from "@stencil/core/app-data";
2
+ import "rolldown";
3
+ import "typescript";
2
4
  //#region src/declarations/stencil-public-runtime.d.ts
3
5
  interface ElementDecorator {
4
6
  (): PropertyDecorator;
@@ -49,6 +51,27 @@ interface HTMLStencilElement extends HTMLElement {
49
51
  componentOnReady(): Promise<this>;
50
52
  }
51
53
  type TagTransformer = (tag: string) => string;
54
+ /**
55
+ * A constructor type that can be used as the base for mixin factories.
56
+ *
57
+ * ```ts
58
+ * import { MixedInCtor } from '@stencil/core';
59
+ *
60
+ * const AFactoryFn = <B extends MixedInCtor>(Base: B) => {class A extends Base { propA = A }; return A;}
61
+ * ```
62
+ */
63
+ type MixedInCtor<T = {}> = new (...args: any[]) => T;
64
+ /**
65
+ * A map of `@Prop`/`@State` property names to their new and previous
66
+ * values, passed to `componentShouldUpdate` once per render cycle.
67
+ *
68
+ * Pass `this` as `T` to type `changes` against your component's own
69
+ * members, e.g. `componentShouldUpdate(changes: ComponentShouldUpdateChanges<this>)`.
70
+ */
71
+ type ComponentShouldUpdateChanges<T = any> = { [K in Extract<keyof T, string>]?: {
72
+ newVal: T[K];
73
+ oldVal: T[K];
74
+ }; };
52
75
  interface ComponentInterface {
53
76
  connectedCallback?(): void;
54
77
  disconnectedCallback?(): void;
@@ -74,14 +97,18 @@ interface ComponentInterface {
74
97
  */
75
98
  componentDidLoad?(): void;
76
99
  /**
77
- * A `@Prop` or `@State` property changed and a rerender is about to be requested.
100
+ * One or more `@Prop` or `@State` properties changed and a rerender is
101
+ * about to be requested. `changes` contains every property that changed
102
+ * since the last render, keyed by property name.
78
103
  *
79
- * Called multiple times throughout the life of
80
- * the component as its properties change.
104
+ * Called once per render cycle, batching all properties that changed
105
+ * synchronously since the last render.
106
+ *
107
+ * Return `false` to prevent the pending render.
81
108
  *
82
109
  * componentShouldUpdate is not called on the first render.
83
110
  */
84
- componentShouldUpdate?(newVal: any, oldVal: any, propName: string): boolean | void;
111
+ componentShouldUpdate?(changes: ComponentShouldUpdateChanges<this>): boolean | void;
85
112
  /**
86
113
  * The component is about to update and re-render.
87
114
  *
@@ -104,6 +131,36 @@ interface ComponentInterface {
104
131
  render?(): any;
105
132
  [memberName: string]: any;
106
133
  }
134
+ /**
135
+ * A reusable behavior that hooks into a `ReactiveControllerHost`'s lifecycle. Modeled after Lit's
136
+ * `ReactiveController` pattern: implement the hooks you need, then register an instance with a host
137
+ * via `host.addController(this)`.
138
+ */
139
+ interface ReactiveController {
140
+ hostConnected?(): void;
141
+ hostDisconnected?(): void;
142
+ hostWillLoad?(): Promise<void> | void;
143
+ hostDidLoad?(): void;
144
+ hostWillRender?(): Promise<void> | void;
145
+ hostDidRender?(): void;
146
+ hostWillUpdate?(): Promise<void> | void;
147
+ hostDidUpdate?(): void;
148
+ }
149
+ /**
150
+ * The shape added to a component by mixing in `ReactiveControllerHost` (see below).
151
+ */
152
+ interface ReactiveControllerHostInterface extends ComponentInterface, HTMLElement {
153
+ readonly controllers: ReadonlySet<ReactiveController>;
154
+ addController(controller: ReactiveController): void;
155
+ removeController(controller: ReactiveController): void;
156
+ requestUpdate(): void;
157
+ /**
158
+ * Resolves once the next pending render commits. Matches the shape of Lit's
159
+ * `ReactiveControllerHost.updateComplete`, for interop with controllers written against Lit's API
160
+ * (e.g. `@lit/context`).
161
+ */
162
+ readonly updateComplete: Promise<boolean>;
163
+ }
107
164
  interface RafCallback {
108
165
  (timeStamp: number): void;
109
166
  }
@@ -445,6 +502,7 @@ declare namespace JSXBase {
445
502
  onClose?: (event: Event$1) => void;
446
503
  open?: boolean;
447
504
  returnValue?: string;
505
+ closedby?: 'any' | 'closerequest' | 'none';
448
506
  }
449
507
  interface EmbedHTMLAttributes<T> extends HTMLAttributes<T> {
450
508
  height?: number | string;
@@ -482,6 +540,8 @@ declare namespace JSXBase {
482
540
  allowtransparency?: string | boolean;
483
541
  frameBorder?: number | string;
484
542
  frameborder?: number | string;
543
+ fetchPriority?: 'high' | 'low' | 'auto';
544
+ fetchpriority?: 'high' | 'low' | 'auto';
485
545
  importance?: 'low' | 'auto' | 'high';
486
546
  height?: number | string;
487
547
  loading?: 'lazy' | 'auto' | 'eager';
@@ -504,6 +564,8 @@ declare namespace JSXBase {
504
564
  crossOrigin?: string;
505
565
  crossorigin?: string;
506
566
  decoding?: 'async' | 'auto' | 'sync';
567
+ fetchPriority?: 'high' | 'low' | 'auto';
568
+ fetchpriority?: 'high' | 'low' | 'auto';
507
569
  importance?: 'low' | 'auto' | 'high';
508
570
  height?: number | string;
509
571
  loading?: 'lazy' | 'auto' | 'eager';
@@ -603,6 +665,8 @@ declare namespace JSXBase {
603
665
  }
604
666
  interface LinkHTMLAttributes<T> extends HTMLAttributes<T> {
605
667
  as?: string;
668
+ fetchPriority?: 'high' | 'low' | 'auto';
669
+ fetchpriority?: 'high' | 'low' | 'auto';
606
670
  href?: string;
607
671
  hrefLang?: string;
608
672
  hreflang?: string;
@@ -726,6 +790,8 @@ declare namespace JSXBase {
726
790
  crossOrigin?: string;
727
791
  crossorigin?: string;
728
792
  defer?: boolean;
793
+ fetchPriority?: 'high' | 'low' | 'auto';
794
+ fetchpriority?: 'high' | 'low' | 'auto';
729
795
  importance?: 'low' | 'auto' | 'high';
730
796
  integrity?: string;
731
797
  nonce?: string;
@@ -841,7 +907,10 @@ declare namespace JSXBase {
841
907
  tabIndex?: number;
842
908
  tabindex?: number | string;
843
909
  title?: string;
910
+ translate?: 'yes' | 'no' | (string & {});
844
911
  popover?: string | null;
912
+ focusgroup?: string;
913
+ focusgroupstart?: boolean;
845
914
  inputMode?: string;
846
915
  inputmode?: string;
847
916
  enterKeyHint?: string;
@@ -1599,6 +1668,15 @@ interface HostElement extends HTMLElement {
1599
1668
  * must be resolved for the top, ancestor component to be fully hydrated
1600
1669
  */
1601
1670
  ['s-p']?: Promise<void>[];
1671
+ /**
1672
+ * Pending Connects:
1673
+ * A list of {@link HostRef.$onFirstConnectPromise$} promises for descendants that
1674
+ * were already registered with this component (their nearest Stencil ancestor) by
1675
+ * the time this component's own initial `componentWillLoad` was scheduled. Awaited
1676
+ * so this component's `componentWillLoad` can't fire before those descendants'
1677
+ * real `connectedCallback`s have.
1678
+ */
1679
+ ['s-pc']?: Promise<void>[];
1602
1680
  componentOnReady?: () => Promise<this>;
1603
1681
  }
1604
1682
  /**
@@ -1638,6 +1716,11 @@ interface RenderNode extends HostElement {
1638
1716
  * Slot name of either the slot itself or the slotted node
1639
1717
  */
1640
1718
  ['s-sn']?: string;
1719
+ /**
1720
+ * `slot` attribute of a `<slot>` reference rendered as a text node (no fallback content),
1721
+ * since text nodes can't carry real DOM attributes.
1722
+ */
1723
+ ['s-sa']?: string;
1641
1724
  /**
1642
1725
  * Host element tag name:
1643
1726
  * The tag name of the host element that this
@@ -1690,7 +1773,7 @@ interface RenderNode extends HostElement {
1690
1773
  * Used to know the components encapsulation.
1691
1774
  * empty "" for shadow, "c" from scoped
1692
1775
  */
1693
- ['s-en']?: '' | /*shadow*/'c';
1776
+ ['s-en']?: '' | /*shadow*/ 'c';
1694
1777
  /**
1695
1778
  * On a `scoped: true` component
1696
1779
  * with `lightDomPatches` flag enabled,
@@ -1815,10 +1898,26 @@ interface PatchedSlotNode extends Node {
1815
1898
  __previousElementSibling?: RenderNode;
1816
1899
  }
1817
1900
  type LazyBundlesRuntimeData = LazyBundleRuntimeData[];
1818
- type LazyBundleRuntimeData = [/** bundleIds */string, ComponentRuntimeMetaCompact[]];
1819
- type ComponentRuntimeMetaCompact = [/** flags */number, /** tagname */string, /** members */{
1901
+ type LazyBundleRuntimeData = [
1902
+ /** bundleIds */
1903
+ string, ComponentRuntimeMetaCompact[]];
1904
+ type ComponentRuntimeMetaCompact = [
1905
+ /** flags */
1906
+ number,
1907
+ /** tagname */
1908
+ string,
1909
+ /** members */
1910
+ {
1820
1911
  [memberName: string]: ComponentRuntimeMember;
1821
- }?, /** listeners */ComponentRuntimeHostListener[]?, /** watchers */ComponentConstructorChangeHandlers?, /** serializers */ComponentConstructorChangeHandlers?, /** deserializers */ComponentConstructorChangeHandlers?];
1912
+ }?,
1913
+ /** listeners */
1914
+ ComponentRuntimeHostListener[]?,
1915
+ /** watchers */
1916
+ ComponentConstructorChangeHandlers?,
1917
+ /** serializers */
1918
+ ComponentConstructorChangeHandlers?,
1919
+ /** deserializers */
1920
+ ComponentConstructorChangeHandlers?];
1822
1921
  /**
1823
1922
  * Runtime metadata for a Stencil component
1824
1923
  */
@@ -1921,6 +2020,11 @@ interface HostRef {
1921
2020
  $cmpMeta$: ComponentRuntimeMeta;
1922
2021
  $hostElement$: HostElement;
1923
2022
  $instanceValues$?: Map<string, any>;
2023
+ /**
2024
+ * Prop/state changes accumulated since the last render, flushed to
2025
+ * `componentShouldUpdate` once per render cycle.
2026
+ */
2027
+ $queuedPropChanges$?: ComponentShouldUpdateChanges;
1924
2028
  $signalValues$?: Map<string, import('@preact/signals-core').Signal<any>>;
1925
2029
  /** Dispose function that tears down all signal effects for this component. */
1926
2030
  $signalCleanup$?: () => void;
@@ -1956,6 +2060,21 @@ interface HostRef {
1956
2060
  * It is called after {@link HostRef.$onInstancePromise$} resolves.
1957
2061
  */
1958
2062
  $onRenderResolve$?: () => void;
2063
+ /**
2064
+ * A promise that resolves once this component's real `connectedCallback` has fired
2065
+ * for the first time. Created lazily - either by a descendant that needs to wait for
2066
+ * this component's connection before firing its own real `connectedCallback`
2067
+ * ({@link HOST_FLAGS.hasFiredConnected}), or by this component registering itself
2068
+ * with its nearest Stencil ancestor's `s-pc` list. This is what lets a component's
2069
+ * real `connectedCallback` (and, transitively, a pending ancestor's initial
2070
+ * `componentWillLoad`) stay ordered correctly regardless of which of an
2071
+ * ancestor/descendant pair's lazy module happens to resolve first.
2072
+ */
2073
+ $onFirstConnectPromise$?: Promise<void>;
2074
+ /**
2075
+ * A callback which resolves {@link HostRef.$onFirstConnectPromise$}
2076
+ */
2077
+ $onFirstConnectResolve$?: () => void;
1959
2078
  $vnode$?: VNode;
1960
2079
  $queuedListeners$?: [string, any][];
1961
2080
  $rmListeners$?: (() => void)[];
@@ -1965,6 +2084,11 @@ interface HostRef {
1965
2084
  * Defer connectedCallback until after first render for components with slot relocation.
1966
2085
  */
1967
2086
  $deferredConnectedCallback$?: boolean;
2087
+ /**
2088
+ * The number of times this host's lazy component load has failed and been retried.
2089
+ * Used to give up retrying after {@link MAX_LAZY_LOAD_RETRIES} failed attempts.
2090
+ */
2091
+ $loadRetryCount$?: number;
1968
2092
  }
1969
2093
  interface PlatformRuntime {
1970
2094
  /**
@@ -2010,6 +2134,18 @@ interface PlatformRuntime {
2010
2134
  }
2011
2135
  type StyleMap = Map<string, CSSStyleSheet | string>;
2012
2136
  type ChildType = VNode | number | string;
2137
+ type PropsType = VNodeProdData | number | string | null;
2138
+ interface VNodeProdData {
2139
+ key?: string | number;
2140
+ class?: {
2141
+ [className: string]: boolean;
2142
+ } | string;
2143
+ className?: {
2144
+ [className: string]: boolean;
2145
+ } | string;
2146
+ style?: any;
2147
+ [key: string]: any;
2148
+ }
2013
2149
  //#endregion
2014
2150
  //#region src/client/client-build.d.ts
2015
2151
  declare const Build: UserBuildConditionals;
@@ -2318,6 +2454,9 @@ declare const setPlatformOptions: (opts: SetPlatformOptions) => PlatformRuntime
2318
2454
  */
2319
2455
  declare const proxyComponent: (Cstr: ComponentConstructor, cmpMeta: ComponentRuntimeMeta, flags: number) => ComponentConstructor;
2320
2456
  //#endregion
2457
+ //#region src/runtime/reactive-controller.d.ts
2458
+ declare const ReactiveControllerHost: <B extends MixedInCtor<ComponentInterface & HTMLElement>>(Base: B) => B & MixedInCtor<ReactiveControllerHostInterface>;
2459
+ //#endregion
2321
2460
  //#region src/runtime/render.d.ts
2322
2461
  /**
2323
2462
  * Method to render a virtual DOM tree to a container element.
@@ -2369,7 +2508,7 @@ declare const postUpdateComponent: (hostRef: HostRef) => void;
2369
2508
  declare const forceUpdate: (ref: any) => boolean;
2370
2509
  //#endregion
2371
2510
  //#region src/runtime/vdom/h.d.ts
2372
- declare const h: (nodeName: any, vnodeData: any, ...children: ChildType[]) => VNode;
2511
+ declare const h: (nodeName: any, vnodeData: PropsType, ...children: ChildType[]) => VNode;
2373
2512
  declare const Host: {};
2374
2513
  //#endregion
2375
2514
  //#region src/runtime/vdom/jsx-runtime.d.ts
@@ -2383,32 +2522,4 @@ declare const jsxs: typeof jsx;
2383
2522
  */
2384
2523
  declare const jsxDEV: typeof jsx;
2385
2524
  //#endregion
2386
- //#region src/runtime/vdom/vdom-annotations.d.ts
2387
- /**
2388
- * Updates the DOM generated on the server with annotations such as node attributes and
2389
- * comment nodes to facilitate future client-side hydration. These annotations are used for things
2390
- * like moving elements back to their original hosts if using Shadow DOM on the client, and for quickly
2391
- * reconstructing the vNode representations of the DOM.
2392
- *
2393
- * @param doc The DOM generated by the server.
2394
- * @param staticComponents Any components that should be considered static and do not need client-side hydration.
2395
- */
2396
- declare const insertVdomAnnotations: (doc: Document, staticComponents: string[]) => void;
2397
- //#endregion
2398
- //#region src/runtime/vdom/vdom-render.d.ts
2399
- /**
2400
- * The main entry point for Stencil's virtual DOM-based rendering engine
2401
- *
2402
- * Given a {@link d.HostRef} container and some virtual DOM nodes, this
2403
- * function will handle creating a virtual DOM tree with a single root, patching
2404
- * the current virtual DOM tree onto an old one (if any), dealing with slot
2405
- * relocation, and reflecting attributes.
2406
- *
2407
- * @param hostRef data needed to root and render the virtual DOM tree, such as
2408
- * the DOM node into which it should be rendered.
2409
- * @param renderFnResults the virtual DOM nodes to be rendered
2410
- * @param isInitialLoad whether or not this is the first call after page load
2411
- */
2412
- declare const renderVdom: (hostRef: HostRef, renderFnResults: VNode | VNode[], isInitialLoad?: boolean) => void;
2413
- //#endregion
2414
- export { AttachInternals, AttrDeserialize, BUILD, Build, Component, Element$1 as Element, Env, Event, Fragment, H, H as HTMLElement, type HTMLStencilElement, HYDRATED_STYLE_ID, Host, type JSXBase, Listen, Method, Mixin, NAMESPACE, Prop, PropSerialize, STENCIL_DEV_MODE, State, Watch, addHostEventListeners, bootstrapLazy, cmpModules, connectedCallback, consoleDevError, consoleDevInfo, consoleDevWarn, consoleError, createEvent, defineCustomElement, disconnectedCallback, forceModeUpdate, forceUpdate, getAssetPath, getElement, getHostRef, getMode, getRegistry, getRenderingRef, getShadowRoot, getValue, h, insertVdomAnnotations, isMemberInElement, jsx, jsxDEV, jsxs, loadModule, modeResolutionChain, needsScopedSSR, nextTick, normalizeWatchers, parsePropertyValue, plt, postUpdateComponent, promiseResolve, proxyComponent, proxyCustomElement, readTask, registerHost, registerInstance, render, renderVdom, resolveVar, setAssetPath, setErrorHandler, setLazyLoadBasePath, setMode, setNonce, setPlatformHelpers, setPlatformOptions, setRegistry, setScopedSsr, setTagTransformer, setValue, styles, supportsConstructableStylesheets, supportsListenerOptions, supportsMutableAdoptedStyleSheets, transformTag, win, writeTask };
2525
+ export { AttachInternals, AttrDeserialize, BUILD, Build, Component, Element$1 as Element, Env, Event, Fragment, H, H as HTMLElement, type HTMLStencilElement, HYDRATED_STYLE_ID, Host, type JSXBase, Listen, Method, Mixin, NAMESPACE, Prop, PropSerialize, ReactiveControllerHost, STENCIL_DEV_MODE, State, Watch, addHostEventListeners, bootstrapLazy, cmpModules, connectedCallback, consoleDevError, consoleDevInfo, consoleDevWarn, consoleError, createEvent, defineCustomElement, disconnectedCallback, forceModeUpdate, forceUpdate, getAssetPath, getElement, getHostRef, getMode, getRegistry, getRenderingRef, getShadowRoot, getValue, h, isMemberInElement, jsx, jsxDEV, jsxs, loadModule, modeResolutionChain, needsScopedSSR, nextTick, normalizeWatchers, parsePropertyValue, plt, postUpdateComponent, promiseResolve, proxyComponent, proxyCustomElement, readTask, registerHost, registerInstance, render, resolveVar, setAssetPath, setErrorHandler, setLazyLoadBasePath, setMode, setNonce, setPlatformHelpers, setPlatformOptions, setRegistry, setScopedSsr, setTagTransformer, setValue, styles, supportsConstructableStylesheets, supportsListenerOptions, supportsMutableAdoptedStyleSheets, transformTag, win, writeTask };