@stencil/core 5.0.0-alpha.3 → 5.0.0-alpha.31

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 (56) 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 +17 -11
  4. package/dist/{client-CSm3x5ke.mjs → client-D1MsT-Rp.mjs} +2717 -2424
  5. package/dist/compiler/index.d.mts +170 -6
  6. package/dist/compiler/index.mjs +4 -3
  7. package/dist/compiler/utils/index.d.mts +272 -2
  8. package/dist/compiler/utils/index.mjs +4 -3
  9. package/dist/{compiler-D6iP7Bzb.mjs → compiler-Cddp97Pg.mjs} +14953 -12327
  10. package/dist/declarations/stencil-ext-modules.d.ts +5 -5
  11. package/dist/declarations/stencil-public-compiler.d.ts +728 -287
  12. package/dist/declarations/stencil-public-compiler.js +2 -3
  13. package/dist/declarations/stencil-public-docs.d.ts +19 -0
  14. package/dist/declarations/stencil-public-runtime.d.ts +131 -17
  15. package/dist/fragment-Di1hWOC8.mjs +4 -0
  16. package/dist/{index-tUR6pD3J.d.mts → index-BHj3EBl2.d.mts} +1052 -668
  17. package/dist/{index-CyrGY82h.d.ts → index-D2PAsXxx.d.ts} +215 -40
  18. package/dist/index-VK8okIiF.d.mts +108 -0
  19. package/dist/index.d.mts +4 -1
  20. package/dist/index.mjs +91 -2
  21. package/dist/jsx-runtime.d.mts +18 -0
  22. package/dist/jsx-runtime.mjs +3 -0
  23. package/dist/{node-Bg-mO5dw.mjs → node-BQR4L-TG.mjs} +76 -73
  24. package/dist/reactive-controller-BdCpSAQP.d.mts +13 -0
  25. package/dist/{regular-expression-D5pGVpCu.mjs → regular-expression-XqU5zmPp.mjs} +141 -31
  26. package/dist/{chunk-CjcI7cDX.mjs → rolldown-runtime-BhDjJH2R.mjs} +1 -1
  27. package/dist/{runtime-BBCnuprF.js → runtime/client/lazy.js} +2987 -2443
  28. package/dist/runtime/client/{index.d.ts → runtime.d.ts} +228 -83
  29. package/dist/runtime/client/{index.js → runtime.js} +2852 -2432
  30. package/dist/runtime/index.d.ts +48 -29
  31. package/dist/runtime/index.js +5069 -2
  32. package/dist/runtime/server/index.d.mts +182 -75
  33. package/dist/runtime/server/index.mjs +2769 -2283
  34. package/dist/runtime/server/runner.d.mts +47 -32
  35. package/dist/runtime/server/runner.mjs +563 -687
  36. package/dist/signals/index.d.ts +49 -0
  37. package/dist/signals/index.js +199 -0
  38. package/dist/sys/node/index.d.mts +1 -2
  39. package/dist/sys/node/index.mjs +1 -1
  40. package/dist/sys/node/worker.d.mts +1 -1
  41. package/dist/sys/node/worker.mjs +6 -3
  42. package/dist/testing/index.d.mts +98 -9
  43. package/dist/testing/index.mjs +395 -70
  44. package/dist/util-BIa-iHnt.mjs +724 -0
  45. package/dist/validation-Dd3g77T5.mjs +778 -0
  46. package/package.json +49 -36
  47. package/dist/index-CXHCTQNt.d.mts +0 -190
  48. package/dist/index-hS-KBdAP.d.ts +0 -30
  49. package/dist/jsx-runtime-DlDkTqps.d.ts +0 -28
  50. package/dist/jsx-runtime.d.ts +0 -2
  51. package/dist/jsx-runtime.js +0 -2
  52. package/dist/runtime/app-data/index.d.ts +0 -2
  53. package/dist/validation-Byxie0Uk.mjs +0 -1445
  54. /package/{LICENSE.md → LICENSE} +0 -0
  55. /package/dist/{runtime/app-globals → app-globals}/index.d.ts +0 -0
  56. /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 UserBuildConditionals {
4
6
  isDev: boolean;
@@ -9,6 +11,17 @@ interface UserBuildConditionals {
9
11
  type ResolutionHandler = (elm: HTMLElement) => string | undefined | null;
10
12
  type ErrorHandler = (err: any, element?: HTMLElement) => void;
11
13
  type TagTransformer = (tag: string) => string;
14
+ /**
15
+ * A map of `@Prop`/`@State` property names to their new and previous
16
+ * values, passed to `componentShouldUpdate` once per render cycle.
17
+ *
18
+ * Pass `this` as `T` to type `changes` against your component's own
19
+ * members, e.g. `componentShouldUpdate(changes: ComponentShouldUpdateChanges<this>)`.
20
+ */
21
+ type ComponentShouldUpdateChanges<T = any> = { [K in Extract<keyof T, string>]?: {
22
+ newVal: T[K];
23
+ oldVal: T[K];
24
+ }; };
12
25
  interface ComponentInterface {
13
26
  connectedCallback?(): void;
14
27
  disconnectedCallback?(): void;
@@ -34,14 +47,18 @@ interface ComponentInterface {
34
47
  */
35
48
  componentDidLoad?(): void;
36
49
  /**
37
- * A `@Prop` or `@State` property changed and a rerender is about to be requested.
50
+ * One or more `@Prop` or `@State` properties changed and a rerender is
51
+ * about to be requested. `changes` contains every property that changed
52
+ * since the last render, keyed by property name.
38
53
  *
39
- * Called multiple times throughout the life of
40
- * the component as its properties change.
54
+ * Called once per render cycle, batching all properties that changed
55
+ * synchronously since the last render.
56
+ *
57
+ * Return `false` to prevent the pending render.
41
58
  *
42
59
  * componentShouldUpdate is not called on the first render.
43
60
  */
44
- componentShouldUpdate?(newVal: any, oldVal: any, propName: string): boolean | void;
61
+ componentShouldUpdate?(changes: ComponentShouldUpdateChanges<this>): boolean | void;
45
62
  /**
46
63
  * The component is about to update and re-render.
47
64
  *
@@ -105,7 +122,7 @@ interface FunctionalUtilities {
105
122
  map: (children: VNode[], cb: (vnode: ChildNode$1, index: number, array: ChildNode$1[]) => ChildNode$1) => VNode[];
106
123
  }
107
124
  interface FunctionalComponent<T = {}> {
108
- (props: T, children: VNode[], utils: FunctionalUtilities): VNode | VNode[] | null;
125
+ (props: T, children: VNode[], utils: FunctionalUtilities): VNode | null;
109
126
  }
110
127
  /**
111
128
  * A Child VDOM node
@@ -116,7 +133,7 @@ interface FunctionalComponent<T = {}> {
116
133
  * {@link FunctionalUtilities}).
117
134
  */
118
135
  interface ChildNode$1 {
119
- vtag?: string | number | Function;
136
+ vtag?: string | number | Function | symbol | null;
120
137
  vkey?: string | number;
121
138
  vtext?: string;
122
139
  vchildren?: VNode[];
@@ -128,17 +145,21 @@ interface ChildNode$1 {
128
145
  */
129
146
  interface VNode {
130
147
  $flags$: number;
131
- $tag$: string | number | Function;
148
+ $tag$: string | number | Function | symbol | null;
132
149
  $elm$: any;
133
150
  $text$: string;
134
151
  $children$: VNode[];
135
152
  $attrs$?: any;
136
153
  $name$?: string;
137
154
  $key$?: string | number;
155
+ /** Signal reference for vdom bypass: signal text nodes store the signal here. */
156
+ $signal$?: any;
138
157
  }
139
158
  interface CustomElementsDefineOptions {
140
159
  exclude?: string[];
141
160
  syncQueue?: boolean;
161
+ /** Scoped custom element registry to define components in. Defaults to the global registry. */
162
+ registry?: CustomElementRegistry;
142
163
  jmp?: (c: Function) => any;
143
164
  raf?: (c: FrameRequestCallback) => number;
144
165
  ael?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
@@ -147,7 +168,7 @@ interface CustomElementsDefineOptions {
147
168
  }
148
169
  //#endregion
149
170
  //#region src/declarations/stencil-public-compiler.d.ts
150
- interface HydrateDocumentOptions {
171
+ interface SsrDocumentOptions {
151
172
  /**
152
173
  * Build ID that will be added to `<html data-stencil-build="BUILD_ID">`. By default
153
174
  * a random ID will be generated
@@ -164,7 +185,7 @@ interface HydrateDocumentOptions {
164
185
  * JavaScript to read the structure of the HTML and rebuild each
165
186
  * component. Defaults to `true`.
166
187
  */
167
- clientHydrateAnnotations?: boolean;
188
+ clientSsrAnnotations?: boolean;
168
189
  /**
169
190
  * Constrain `setTimeout()` to 1ms, but still async. Also
170
191
  * only allows `setInterval()` to fire once, also constrained to 1ms.
@@ -263,10 +284,14 @@ interface HydrateDocumentOptions {
263
284
  default: 'declarative-shadow-dom' | 'scoped';
264
285
  } | boolean;
265
286
  }
266
- interface SerializeDocumentOptions extends HydrateDocumentOptions {
287
+ interface SerializeDocumentOptions extends SsrDocumentOptions {
267
288
  /**
268
289
  * Runs after the `document` has been hydrated.
269
290
  */
291
+ afterSsr?(document: any): any | Promise<any>;
292
+ /**
293
+ * @deprecated Use `afterSsr` instead.
294
+ */
270
295
  afterHydrate?(document: any): any | Promise<any>;
271
296
  /**
272
297
  * Sets an approximate line width the HTML should attempt to stay within.
@@ -279,6 +304,10 @@ interface SerializeDocumentOptions extends HydrateDocumentOptions {
279
304
  /**
280
305
  * Runs before the `document` has been hydrated.
281
306
  */
307
+ beforeSsr?(document: any): any | Promise<any>;
308
+ /**
309
+ * @deprecated Use `beforeSsr` instead.
310
+ */
282
311
  beforeHydrate?(document: any): any | Promise<any>;
283
312
  /**
284
313
  * Format the HTML in a nicely indented format.
@@ -316,7 +345,7 @@ interface SerializeDocumentOptions extends HydrateDocumentOptions {
316
345
  */
317
346
  modes?: ResolutionHandler[];
318
347
  }
319
- interface HydrateFactoryOptions extends SerializeDocumentOptions {
348
+ interface SsrFactoryOptions extends SerializeDocumentOptions {
320
349
  serializeToHtml: boolean;
321
350
  destroyWindow: boolean;
322
351
  destroyDocument: boolean;
@@ -410,7 +439,7 @@ interface HostElement extends HTMLElement {
410
439
  disconnectedCallback?: () => void;
411
440
  host?: Element;
412
441
  forceUpdate?: () => void;
413
- __stencil__getHostRef?: () => HostRef;
442
+ __s_ghr?: () => HostRef;
414
443
  /**
415
444
  * Unique stencil id for this element
416
445
  */
@@ -464,9 +493,18 @@ interface HostElement extends HTMLElement {
464
493
  * must be resolved for the top, ancestor component to be fully hydrated
465
494
  */
466
495
  ['s-p']?: Promise<void>[];
496
+ /**
497
+ * Pending Connects:
498
+ * A list of {@link HostRef.$onFirstConnectPromise$} promises for descendants that
499
+ * were already registered with this component (their nearest Stencil ancestor) by
500
+ * the time this component's own initial `componentWillLoad` was scheduled. Awaited
501
+ * so this component's `componentWillLoad` can't fire before those descendants'
502
+ * real `connectedCallback`s have.
503
+ */
504
+ ['s-pc']?: Promise<void>[];
467
505
  componentOnReady?: () => Promise<this>;
468
506
  }
469
- interface HydrateResults {
507
+ interface SsrResults {
470
508
  buildId: string;
471
509
  diagnostics: Diagnostic[];
472
510
  url: string;
@@ -478,42 +516,42 @@ interface HydrateResults {
478
516
  search: string | null;
479
517
  hash: string | null;
480
518
  html: string | null;
481
- components: HydrateComponent[];
482
- anchors: HydrateAnchorElement[];
483
- imgs: HydrateImgElement[];
484
- scripts: HydrateScriptElement[];
485
- styles: HydrateStyleElement[];
486
- staticData: HydrateStaticData[];
519
+ components: SsrComponent[];
520
+ anchors: SsrAnchorElement[];
521
+ imgs: SsrImgElement[];
522
+ scripts: SsrScriptElement[];
523
+ styles: SsrStyleElement[];
524
+ staticData: SsrStaticData[];
487
525
  title: string | null;
488
526
  hydratedCount: number;
489
527
  httpStatus: number | null;
490
528
  }
491
- interface HydrateComponent {
529
+ interface SsrComponent {
492
530
  tag: string;
493
531
  mode: string;
494
532
  count: number;
495
533
  depth: number;
496
534
  }
497
- interface HydrateElement {
535
+ interface SsrElement {
498
536
  [attrName: string]: string | undefined;
499
537
  }
500
- interface HydrateAnchorElement extends HydrateElement {
538
+ interface SsrAnchorElement extends SsrElement {
501
539
  href?: string;
502
540
  target?: string;
503
541
  }
504
- interface HydrateImgElement extends HydrateElement {
542
+ interface SsrImgElement extends SsrElement {
505
543
  src?: string;
506
544
  }
507
- interface HydrateScriptElement extends HydrateElement {
545
+ interface SsrScriptElement extends SsrElement {
508
546
  src?: string;
509
547
  type?: string;
510
548
  }
511
- interface HydrateStyleElement extends HydrateElement {
549
+ interface SsrStyleElement extends SsrElement {
512
550
  id?: string;
513
551
  href?: string;
514
552
  content?: string;
515
553
  }
516
- interface HydrateStaticData {
554
+ interface SsrStaticData {
517
555
  id: string;
518
556
  type: string;
519
557
  content: string;
@@ -555,6 +593,11 @@ interface RenderNode extends HostElement {
555
593
  * Slot name of either the slot itself or the slotted node
556
594
  */
557
595
  ['s-sn']?: string;
596
+ /**
597
+ * `slot` attribute of a `<slot>` reference rendered as a text node (no fallback content),
598
+ * since text nodes can't carry real DOM attributes.
599
+ */
600
+ ['s-sa']?: string;
558
601
  /**
559
602
  * Host element tag name:
560
603
  * The tag name of the host element that this
@@ -607,64 +650,64 @@ interface RenderNode extends HostElement {
607
650
  * Used to know the components encapsulation.
608
651
  * empty "" for shadow, "c" from scoped
609
652
  */
610
- ['s-en']?: '' | /*shadow*/'c';
653
+ ['s-en']?: '' | /*shadow*/ 'c';
611
654
  /**
612
655
  * On a `scoped: true` component
613
- * with `experimentalSlotFixes` flag enabled,
656
+ * with `lightDomPatches` flag enabled,
614
657
  * returns the internal `childNodes` of the component
615
658
  */
616
659
  readonly __childNodes?: NodeListOf<ChildNode>;
617
660
  /**
618
661
  * On a `scoped: true` component
619
- * with `experimentalSlotFixes` flag enabled,
662
+ * with `lightDomPatches` flag enabled,
620
663
  * returns the internal `children` of the component
621
664
  */
622
665
  readonly __children?: HTMLCollectionOf<Element>;
623
666
  /**
624
667
  * On a `scoped: true` component
625
- * with `experimentalSlotFixes` flag enabled,
668
+ * with `lightDomPatches` flag enabled,
626
669
  * returns the internal `firstChild` of the component
627
670
  */
628
671
  readonly __firstChild?: ChildNode;
629
672
  /**
630
673
  * On a `scoped: true` component
631
- * with `experimentalSlotFixes` flag enabled,
674
+ * with `lightDomPatches` flag enabled,
632
675
  * returns the internal `lastChild` of the component
633
676
  */
634
677
  readonly __lastChild?: ChildNode;
635
678
  /**
636
679
  * On a `scoped: true` component
637
- * with `experimentalSlotFixes` flag enabled,
680
+ * with `lightDomPatches` flag enabled,
638
681
  * returns the internal `textContent` of the component
639
682
  */
640
683
  __textContent?: string;
641
684
  /**
642
685
  * On a `scoped: true` component
643
- * with `experimentalSlotFixes` flag enabled,
686
+ * with `lightDomPatches` flag enabled,
644
687
  * gives access to the original `append` method
645
688
  */
646
689
  __append?: (...nodes: (Node | string)[]) => void;
647
690
  /**
648
691
  * On a `scoped: true` component
649
- * with `experimentalSlotFixes` flag enabled,
692
+ * with `lightDomPatches` flag enabled,
650
693
  * gives access to the original `prepend` method
651
694
  */
652
695
  __prepend?: (...nodes: (Node | string)[]) => void;
653
696
  /**
654
697
  * On a `scoped: true` component
655
- * with `experimentalSlotFixes` flag enabled,
698
+ * with `lightDomPatches` flag enabled,
656
699
  * gives access to the original `appendChild` method
657
700
  */
658
701
  __appendChild?: <T extends Node>(newChild: T) => T;
659
702
  /**
660
703
  * On a `scoped: true` component
661
- * with `experimentalSlotFixes` flag enabled,
704
+ * with `lightDomPatches` flag enabled,
662
705
  * gives access to the original `insertBefore` method
663
706
  */
664
707
  __insertBefore?: <T extends Node>(node: T, child: Node | null) => T;
665
708
  /**
666
709
  * On a `scoped: true` component
667
- * with `experimentalSlotFixes` flag enabled,
710
+ * with `lightDomPatches` flag enabled,
668
711
  * gives access to the original `removeChild` method
669
712
  */
670
713
  __removeChild?: <T extends Node>(child: T) => T;
@@ -702,40 +745,56 @@ interface PatchedSlotNode extends Node {
702
745
  ['s-sr']?: boolean;
703
746
  /**
704
747
  * On a `scoped: true` component
705
- * with `experimentalSlotFixes` flag enabled,
748
+ * with `lightDomPatches` flag enabled,
706
749
  * returns the actual `parentNode` of the component
707
750
  */
708
751
  __parentNode?: RenderNode;
709
752
  /**
710
753
  * On a `scoped: true` component
711
- * with `experimentalSlotFixes` flag enabled,
754
+ * with `lightDomPatches` flag enabled,
712
755
  * returns the actual `nextSibling` of the component
713
756
  */
714
757
  __nextSibling?: RenderNode;
715
758
  /**
716
759
  * On a `scoped: true` component
717
- * with `experimentalSlotFixes` flag enabled,
760
+ * with `lightDomPatches` flag enabled,
718
761
  * returns the actual `previousSibling` of the component
719
762
  */
720
763
  __previousSibling?: RenderNode;
721
764
  /**
722
765
  * On a `scoped: true` component
723
- * with `experimentalSlotFixes` flag enabled,
766
+ * with `lightDomPatches` flag enabled,
724
767
  * returns the actual `nextElementSibling` of the component
725
768
  */
726
769
  __nextElementSibling?: RenderNode;
727
770
  /**
728
771
  * On a `scoped: true` component
729
- * with `experimentalSlotFixes` flag enabled,
772
+ * with `lightDomPatches` flag enabled,
730
773
  * returns the actual `nextElementSibling` of the component
731
774
  */
732
775
  __previousElementSibling?: RenderNode;
733
776
  }
734
777
  type LazyBundlesRuntimeData = LazyBundleRuntimeData[];
735
- type LazyBundleRuntimeData = [/** bundleIds */string, ComponentRuntimeMetaCompact[]];
736
- type ComponentRuntimeMetaCompact = [/** flags */number, /** tagname */string, /** members */{
778
+ type LazyBundleRuntimeData = [
779
+ /** bundleIds */
780
+ string, ComponentRuntimeMetaCompact[]];
781
+ type ComponentRuntimeMetaCompact = [
782
+ /** flags */
783
+ number,
784
+ /** tagname */
785
+ string,
786
+ /** members */
787
+ {
737
788
  [memberName: string]: ComponentRuntimeMember;
738
- }?, /** listeners */ComponentRuntimeHostListener[]?, /** watchers */ComponentConstructorChangeHandlers?, /** serializers */ComponentConstructorChangeHandlers?, /** deserializers */ComponentConstructorChangeHandlers?];
789
+ }?,
790
+ /** listeners */
791
+ ComponentRuntimeHostListener[]?,
792
+ /** watchers */
793
+ ComponentConstructorChangeHandlers?,
794
+ /** serializers */
795
+ ComponentConstructorChangeHandlers?,
796
+ /** deserializers */
797
+ ComponentConstructorChangeHandlers?];
739
798
  /**
740
799
  * Runtime metadata for a Stencil component
741
800
  */
@@ -827,7 +886,7 @@ type ComponentRuntimeReflectingAttr = [string, string | undefined];
827
886
  * associated {@link HostRef} instance.
828
887
  */
829
888
  type RuntimeRef = HostElement | {
830
- __stencil__getHostRef?: () => HostRef;
889
+ __s_ghr?: () => HostRef;
831
890
  };
832
891
  /**
833
892
  * Interface used to track an Element, it's virtual Node (`VNode`), and other data
@@ -838,6 +897,14 @@ interface HostRef {
838
897
  $cmpMeta$: ComponentRuntimeMeta;
839
898
  $hostElement$: HostElement;
840
899
  $instanceValues$?: Map<string, any>;
900
+ /**
901
+ * Prop/state changes accumulated since the last render, flushed to
902
+ * `componentShouldUpdate` once per render cycle.
903
+ */
904
+ $queuedPropChanges$?: ComponentShouldUpdateChanges;
905
+ $signalValues$?: Map<string, import('@preact/signals-core').Signal<any>>;
906
+ /** Dispose function that tears down all signal effects for this component. */
907
+ $signalCleanup$?: () => void;
841
908
  $serializerValues$?: Map<string, string>;
842
909
  $lazyInstance$?: ComponentInterface;
843
910
  /**
@@ -870,6 +937,21 @@ interface HostRef {
870
937
  * It is called after {@link HostRef.$onInstancePromise$} resolves.
871
938
  */
872
939
  $onRenderResolve$?: () => void;
940
+ /**
941
+ * A promise that resolves once this component's real `connectedCallback` has fired
942
+ * for the first time. Created lazily - either by a descendant that needs to wait for
943
+ * this component's connection before firing its own real `connectedCallback`
944
+ * ({@link HOST_FLAGS.hasFiredConnected}), or by this component registering itself
945
+ * with its nearest Stencil ancestor's `s-pc` list. This is what lets a component's
946
+ * real `connectedCallback` (and, transitively, a pending ancestor's initial
947
+ * `componentWillLoad`) stay ordered correctly regardless of which of an
948
+ * ancestor/descendant pair's lazy module happens to resolve first.
949
+ */
950
+ $onFirstConnectPromise$?: Promise<void>;
951
+ /**
952
+ * A callback which resolves {@link HostRef.$onFirstConnectPromise$}
953
+ */
954
+ $onFirstConnectResolve$?: () => void;
873
955
  $vnode$?: VNode;
874
956
  $queuedListeners$?: [string, any][];
875
957
  $rmListeners$?: (() => void)[];
@@ -879,6 +961,11 @@ interface HostRef {
879
961
  * Defer connectedCallback until after first render for components with slot relocation.
880
962
  */
881
963
  $deferredConnectedCallback$?: boolean;
964
+ /**
965
+ * The number of times this host's lazy component load has failed and been retried.
966
+ * Used to give up retrying after {@link MAX_LAZY_LOAD_RETRIES} failed attempts.
967
+ */
968
+ $loadRetryCount$?: number;
882
969
  }
883
970
  interface PlatformRuntime {
884
971
  /**
@@ -928,19 +1015,26 @@ type ChildType = VNode | number | string;
928
1015
  //#region src/server/platform/h-async.d.ts
929
1016
  declare const hAsync: (nodeName: any, vnodeData: any, ...children: ChildType[]) => VNode | Promise<VNode>;
930
1017
  //#endregion
931
- //#region src/server/platform/hydrate-app.d.ts
932
- declare function hydrateApp(win: Window & typeof globalThis, opts: HydrateFactoryOptions, results: HydrateResults, afterHydrate: (win: Window, opts: HydrateFactoryOptions, results: HydrateResults, resolve: (results: HydrateResults) => void) => void, resolve: (results: HydrateResults) => void): void;
933
- //#endregion
934
- //#region src/runtime/asset-path.d.ts
935
- declare const getAssetPath: (path: string) => string;
936
- declare const setAssetPath: (path: string) => string;
1018
+ //#region src/server/platform/ssr-app.d.ts
1019
+ /**
1020
+ * SSR a Document by patching the DOM APIs to wait for components to be connected and hydrated
1021
+ * before allowing them to be added to the document.
1022
+ * Once all components are hydrated, the `afterSsr` callback is called so that the caller can serialize
1023
+ * the document to HTML and send it back to the client.
1024
+ * @param win The window to use for SSR. This should be a patched window created by `patchDomImplementation`.
1025
+ * @param opts The options to use for SSR. This is used to configure which components should be hydrated, how long to wait for hydration, etc.
1026
+ * @param results The results object to store the hydration results.
1027
+ * @param afterSsr The callback to be called after SSR is complete.
1028
+ * @param resolve The resolve function to be called when SSR is complete.
1029
+ */
1030
+ declare function ssrApp(win: Window & typeof globalThis, opts: SsrFactoryOptions, results: SsrResults, afterSsr: (win: Window, opts: SsrFactoryOptions, results: SsrResults, resolve: (results: SsrResults) => void) => void, resolve: (results: SsrResults) => void): void;
937
1031
  //#endregion
938
- //#region src/runtime/bootstrap-custom-element.d.ts
1032
+ //#region src/runtime/bootstrap-standalone.d.ts
939
1033
  declare const defineCustomElement: (Cstr: any, compactMeta: ComponentRuntimeMetaCompact) => void;
940
1034
  declare const proxyCustomElement: (Cstr: any, compactMeta: ComponentRuntimeMetaCompact) => any;
941
1035
  declare const forceModeUpdate: (elm: RenderNode) => void;
942
1036
  //#endregion
943
- //#region src/runtime/bootstrap-lazy.d.ts
1037
+ //#region src/runtime/bootstrap-loader.d.ts
944
1038
  declare const bootstrapLazy: (lazyBundles: LazyBundlesRuntimeData, options?: CustomElementsDefineOptions) => void;
945
1039
  //#endregion
946
1040
  //#region src/runtime/connected-callback.d.ts
@@ -951,6 +1045,18 @@ declare const disconnectedCallback: (elm: HostElement) => Promise<void>;
951
1045
  //#endregion
952
1046
  //#region src/runtime/element.d.ts
953
1047
  declare const getElement: (ref: any) => HostElement;
1048
+ /**
1049
+ * Get the shadow root for a Stencil component's host element.
1050
+ * This works for both open and closed shadow DOM modes.
1051
+ *
1052
+ * For closed shadow DOM, `element.shadowRoot` returns `null` by design,
1053
+ * but Stencil stores the reference internally so components can still
1054
+ * access their own shadow root.
1055
+ *
1056
+ * @param element The host element (from @Element() decorator)
1057
+ * @returns The shadow root, or null if no shadow root exists
1058
+ */
1059
+ declare const getShadowRoot: (element: HTMLElement) => ShadowRoot | null;
954
1060
  //#endregion
955
1061
  //#region src/runtime/event-emitter.d.ts
956
1062
  declare const createEvent: (ref: RuntimeRef, name: string, flags: number) => {
@@ -1051,26 +1157,11 @@ declare const forceUpdate: (ref: any) => boolean;
1051
1157
  declare const Host: {};
1052
1158
  //#endregion
1053
1159
  //#region src/runtime/vdom/jsx-runtime.d.ts
1054
- /**
1055
- * JSX runtime function for creating elements in production mode.
1056
- * Called by TypeScript's jsx transform for elements without static children.
1057
- *
1058
- * @param type - The element type (string tag name or functional component)
1059
- * @param props - The element props (includes children)
1060
- * @param key - Optional key for the element
1061
- * @returns A virtual DOM node
1062
- */
1063
1160
  declare function jsx(type: any, props: any, key?: string): VNode;
1064
1161
  /**
1065
- * JSX runtime function for creating elements with static children.
1066
- * Called by TypeScript's jsx transform as an optimization when children are static.
1067
- *
1068
- * @param type - The element type (string tag name or functional component)
1069
- * @param props - The element props (includes children)
1070
- * @param key - Optional key for the element
1071
- * @returns A virtual DOM node
1162
+ * @alias
1072
1163
  */
1073
- declare function jsxs(type: any, props: any, key?: string): VNode;
1164
+ declare const jsxs: typeof jsx;
1074
1165
  //#endregion
1075
1166
  //#region src/runtime/vdom/vdom-annotations.d.ts
1076
1167
  /**
@@ -1124,7 +1215,6 @@ declare const setPlatformHelpers: (helpers: {
1124
1215
  rel?: (el: any, eventName: string, listener: any, options: any) => void;
1125
1216
  ce?: (eventName: string, opts?: any) => any;
1126
1217
  }) => void;
1127
- declare const supportsShadow: boolean;
1128
1218
  declare const supportsListenerOptions = false;
1129
1219
  declare const supportsConstructableStylesheets = false;
1130
1220
  declare const supportsMutableAdoptedStyleSheets = false;
@@ -1134,11 +1224,28 @@ declare const registerHost: (elm: HostElement, cmpMeta: ComponentRuntimeMeta) =>
1134
1224
  declare const Build: UserBuildConditionals;
1135
1225
  declare const styles: StyleMap;
1136
1226
  declare const modeResolutionChain: ResolutionHandler[];
1227
+ /**
1228
+ * Server-side implementation of getAssetPath.
1229
+ *
1230
+ * Unlike the client-side version, this doesn't use import.meta.url as a fallback
1231
+ * because it doesn't make sense in the bundled hydrate factory context.
1232
+ * The base URL must come from plt.$resourcesUrl$ (set via hydration options).
1233
+ * @param path - The relative path to the asset
1234
+ * @returns The resolved asset path, which may be an absolute URL if resourcesUrl is set to an external URL, or a relative path if resourcesUrl is a relative path or not set at all
1235
+ */
1236
+ declare const getAssetPath: (path: string) => string;
1237
+ /**
1238
+ * Sets the base URL for resolving asset paths in the server/hydrate context.
1239
+ * @param path - The base URL to use for resolving asset paths. This should typically be set to the same value as the `resourcesUrl` option passed to `ssrDocument` to ensure that asset paths are resolved correctly in the server/hydrate context.
1240
+ * If not set, it defaults to './', which is a reasonable default for server-side rendering.
1241
+ * @returns void
1242
+ */
1243
+ declare const setAssetPath: (path: string) => string;
1137
1244
  /**
1138
1245
  * Checks to see any components are rendered with `scoped`
1139
1246
  * @param opts - SSR options
1140
1247
  */
1141
- declare const setScopedSSR: (opts: HydrateFactoryOptions) => void;
1248
+ declare const setScopedSsr: (opts: SsrFactoryOptions) => void;
1142
1249
  declare const needsScopedSSR: () => boolean;
1143
1250
  //#endregion
1144
- export { BUILD, Build, Env, Fragment, Host, Mixin, NAMESPACE, addHostEventListeners, bootstrapLazy, cmpModules, connectedCallback, consoleDevError, consoleDevInfo, consoleDevWarn, consoleError, createEvent, defineCustomElement, disconnectedCallback, forceModeUpdate, forceUpdate, getAssetPath, getElement, getHostRef, getMode, getRenderingRef, getValue, hAsync as h, hydrateApp, insertVdomAnnotations, isMemberInElement, jsx, jsxs, loadModule, modeResolutionChain, needsScopedSSR, nextTick, parsePropertyValue, plt, postUpdateComponent, proxyComponent, proxyCustomElement, readTask, registerComponents, registerHost, registerInstance, renderVdom, setAssetPath, setErrorHandler, setMode, setNonce, setPlatformHelpers, setScopedSSR, setTagTransformer, setValue, styles, supportsConstructableStylesheets, supportsListenerOptions, supportsMutableAdoptedStyleSheets, supportsShadow, transformTag, win, writeTask };
1251
+ export { BUILD, Build, Env, Fragment, Host, Mixin, NAMESPACE, addHostEventListeners, bootstrapLazy, cmpModules, connectedCallback, consoleDevError, consoleDevInfo, consoleDevWarn, consoleError, createEvent, defineCustomElement, disconnectedCallback, forceModeUpdate, forceUpdate, getAssetPath, getElement, getHostRef, getMode, getRenderingRef, getShadowRoot, getValue, hAsync as h, insertVdomAnnotations, isMemberInElement, jsx, jsxs, loadModule, modeResolutionChain, needsScopedSSR, nextTick, parsePropertyValue, plt, postUpdateComponent, proxyComponent, proxyCustomElement, readTask, registerComponents, registerHost, registerInstance, renderVdom, setAssetPath, setErrorHandler, setMode, setNonce, setPlatformHelpers, setScopedSsr, setTagTransformer, setValue, ssrApp, styles, supportsConstructableStylesheets, supportsListenerOptions, supportsMutableAdoptedStyleSheets, transformTag, win, writeTask };