@stencil/core 5.0.0-alpha.27 → 5.0.0-alpha.29

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 (44) hide show
  1. package/dist/app-data/index.d.ts +1 -1
  2. package/dist/{client-CvcvHKz4.mjs → client-D1MsT-Rp.mjs} +373 -238
  3. package/dist/compiler/index.d.mts +2 -3
  4. package/dist/compiler/index.mjs +3 -3
  5. package/dist/compiler/utils/index.d.mts +272 -2
  6. package/dist/compiler/utils/index.mjs +4 -3
  7. package/dist/{compiler-D43Ied7R.mjs → compiler-BbS9TDF_.mjs} +1845 -1118
  8. package/dist/declarations/stencil-ext-modules.d.ts +5 -5
  9. package/dist/declarations/stencil-public-compiler.d.ts +108 -40
  10. package/dist/declarations/stencil-public-docs.d.ts +9 -0
  11. package/dist/declarations/stencil-public-runtime.d.ts +81 -6
  12. package/dist/fragment-Di1hWOC8.mjs +4 -0
  13. package/dist/{index-F3IidHM1.d.mts → index-BHj3EBl2.d.mts} +395 -312
  14. package/dist/{index-xAkMgLX_.d.ts → index-D2PAsXxx.d.ts} +133 -9
  15. package/dist/index-VK8okIiF.d.mts +108 -0
  16. package/dist/index.d.mts +4 -0
  17. package/dist/index.mjs +91 -2
  18. package/dist/jsx-runtime.mjs +2 -1
  19. package/dist/{node-DKVq_Ud0.mjs → node-BQR4L-TG.mjs} +60 -58
  20. package/dist/reactive-controller-BdCpSAQP.d.mts +13 -0
  21. package/dist/{regular-expression-CFVJOTUh.mjs → regular-expression-XqU5zmPp.mjs} +20 -3
  22. package/dist/{chunk-z9aeyW2b.mjs → rolldown-runtime-BhDjJH2R.mjs} +1 -1
  23. package/dist/runtime/client/lazy.js +411 -165
  24. package/dist/runtime/client/runtime.d.ts +136 -9
  25. package/dist/runtime/client/runtime.js +411 -165
  26. package/dist/runtime/index.d.ts +5 -3
  27. package/dist/runtime/index.js +410 -163
  28. package/dist/runtime/server/index.d.mts +80 -8
  29. package/dist/runtime/server/index.mjs +333 -158
  30. package/dist/runtime/server/runner.d.mts +3 -0
  31. package/dist/runtime/server/runner.mjs +232 -308
  32. package/dist/signals/index.d.ts +2 -0
  33. package/dist/sys/node/index.d.mts +1 -2
  34. package/dist/sys/node/index.mjs +1 -1
  35. package/dist/sys/node/worker.d.mts +1 -1
  36. package/dist/sys/node/worker.mjs +6 -3
  37. package/dist/testing/index.d.mts +4 -9
  38. package/dist/testing/index.mjs +74 -56
  39. package/dist/util-BIa-iHnt.mjs +724 -0
  40. package/dist/validation-Dd3g77T5.mjs +778 -0
  41. package/package.json +27 -27
  42. package/dist/index-3fu7WQs4.d.mts +0 -205
  43. package/dist/validation-ByxKj8bC.mjs +0 -1458
  44. /package/{LICENSE.md → LICENSE} +0 -0
@@ -1,4 +1,6 @@
1
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
  /**
@@ -2318,6 +2442,9 @@ declare const setPlatformOptions: (opts: SetPlatformOptions) => PlatformRuntime
2318
2442
  */
2319
2443
  declare const proxyComponent: (Cstr: ComponentConstructor, cmpMeta: ComponentRuntimeMeta, flags: number) => ComponentConstructor;
2320
2444
  //#endregion
2445
+ //#region src/runtime/reactive-controller.d.ts
2446
+ declare const ReactiveControllerHost: <B extends MixedInCtor<ComponentInterface & HTMLElement>>(Base: B) => B & MixedInCtor<ReactiveControllerHostInterface>;
2447
+ //#endregion
2321
2448
  //#region src/runtime/render.d.ts
2322
2449
  /**
2323
2450
  * Method to render a virtual DOM tree to a container element.
@@ -2383,4 +2510,4 @@ declare const jsxs: typeof jsx;
2383
2510
  */
2384
2511
  declare const jsxDEV: typeof jsx;
2385
2512
  //#endregion
2386
- 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, 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 };
2513
+ 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 };