@stencil/core 5.0.0-alpha.4 → 5.0.0-alpha.5

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 (36) hide show
  1. package/dist/{client-Dti6fFpE.mjs → client-Dnio47yQ.mjs} +81 -10
  2. package/dist/compiler/index.d.mts +2 -2
  3. package/dist/compiler/index.mjs +2 -2
  4. package/dist/compiler/utils/index.d.mts +2 -2
  5. package/dist/compiler/utils/index.mjs +3 -3
  6. package/dist/{compiler-BYRrEeD-.mjs → compiler-Dxri2g8Z.mjs} +15313 -14822
  7. package/dist/declarations/stencil-public-compiler.d.ts +288 -132
  8. package/dist/declarations/stencil-public-compiler.js +2 -3
  9. package/dist/declarations/stencil-public-runtime.d.ts +2 -0
  10. package/dist/{index-hS-KBdAP.d.ts → index-D-XN9HW_.d.ts} +1 -1
  11. package/dist/{index-BwTaN1Nq.d.mts → index-D5zaocDq.d.mts} +357 -189
  12. package/dist/{index-CyrGY82h.d.ts → index-D61XZw0f.d.ts} +2 -2
  13. package/dist/{index-9LTuoSiw.d.mts → index-Dat4djoo.d.mts} +1 -1
  14. package/dist/index.mjs +1 -1
  15. package/dist/{jsx-runtime-DlDkTqps.d.ts → jsx-runtime-B3vQbWIW.d.ts} +1 -1
  16. package/dist/jsx-runtime.d.ts +1 -1
  17. package/dist/jsx-runtime.js +1 -1
  18. package/dist/{node-BF2jSfWg.mjs → node-pj6rF4Wt.mjs} +66 -69
  19. package/dist/{regular-expression-D5pGVpCu.mjs → regular-expression-D0_N0PGa.mjs} +44 -26
  20. package/dist/runtime/app-data/index.d.ts +1 -1
  21. package/dist/runtime/client/index.d.ts +41 -8
  22. package/dist/runtime/client/index.js +105 -31
  23. package/dist/runtime/index.d.ts +29 -5
  24. package/dist/runtime/index.js +2 -2
  25. package/dist/runtime/server/index.d.mts +56 -25
  26. package/dist/runtime/server/index.mjs +122 -37
  27. package/dist/runtime/server/runner.d.mts +40 -26
  28. package/dist/runtime/server/runner.mjs +28 -22
  29. package/dist/{runtime-COEYYPyw.js → runtime-CKyUrF4i.js} +104 -30
  30. package/dist/sys/node/index.d.mts +1 -1
  31. package/dist/sys/node/index.mjs +1 -1
  32. package/dist/sys/node/worker.mjs +2 -2
  33. package/dist/testing/index.d.mts +2 -2
  34. package/dist/testing/index.mjs +15 -15
  35. package/dist/{validation-Byxie0Uk.mjs → validation-BA8nzXu_.mjs} +82 -58
  36. package/package.json +11 -12
@@ -379,7 +379,7 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
379
379
  //#region src/client/client-style.ts
380
380
  const styles = /* @__PURE__ */ new Map();
381
381
  const modeResolutionChain = [];
382
- const setScopedSSR = (_opts) => {};
382
+ const setScopedSsr = (_opts) => {};
383
383
  const needsScopedSSR = () => false;
384
384
  //#endregion
385
385
  //#region src/runtime/runtime-constants.ts
@@ -1427,7 +1427,8 @@ const addStyle = (styleContainerNode, cmpMeta, mode) => {
1427
1427
  styleElm.textContent = style;
1428
1428
  const nonce = plt.$nonce$ ?? queryNonceMetaTagContent(win.document);
1429
1429
  if (nonce != null) styleElm.setAttribute("nonce", nonce);
1430
- if ((BUILD$1.hydrateServerSide || BUILD$1.hotModuleReplacement) && (cmpMeta.$flags$ & CMP_FLAGS.scopedCssEncapsulation || cmpMeta.$flags$ & CMP_FLAGS.shadowNeedsScopedCss || cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation)) styleElm.setAttribute(HYDRATED_STYLE_ID, scopeId);
1430
+ if (BUILD$1.hydrateServerSide && (cmpMeta.$flags$ & CMP_FLAGS.scopedCssEncapsulation || cmpMeta.$flags$ & CMP_FLAGS.shadowNeedsScopedCss || cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) || BUILD$1.hotModuleReplacement) styleElm.setAttribute(HYDRATED_STYLE_ID, scopeId);
1431
+ if (BUILD$1.hotModuleReplacement && cmpMeta.$flags$ & CMP_FLAGS.hasSlotRelocation) styleElm.setAttribute("data-slot-fb", "");
1431
1432
  /**
1432
1433
  * attach styles at the end of the head tag if we render scoped components
1433
1434
  */
@@ -2538,6 +2539,46 @@ const computeMode = (elm) => modeResolutionChain.map((h) => h(elm)).find((m) =>
2538
2539
  const setMode = (handler) => modeResolutionChain.push(handler);
2539
2540
  const getMode = (ref) => getHostRef(ref)?.$modeName$;
2540
2541
  //#endregion
2542
+ //#region src/runtime/normalize-watchers.ts
2543
+ /**
2544
+ * Normalizes watcher metadata to the current `{ [methodName]: flags }[]` format.
2545
+ *
2546
+ * Prior to Stencil 4.39.x (PR #6484), the `@Watch()` compiler emitted watcher
2547
+ * handlers as a plain string array: `{ "min": ["minChanged"] }`. The new format
2548
+ * wraps each entry in an object that carries option flags (e.g. `immediate`):
2549
+ * `{ "min": [{ "minChanged": 0 }] }`.
2550
+ *
2551
+ * When a library (e.g. Ionic Framework) was compiled with an older Stencil compiler
2552
+ * but consumed by an app using a newer Stencil runtime, the runtime's
2553
+ * `Object.entries(watcher)` call receives a string and misinterprets its character
2554
+ * indices as method names, causing:
2555
+ * `TypeError: instance[watchMethodName] is not a function`
2556
+ *
2557
+ * This helper should be used at `$watchers$` assignment sites that need to
2558
+ * accept both legacy and current compiler metadata so downstream code on those
2559
+ * paths can safely assume the new object format.
2560
+ *
2561
+ * @param raw The raw watcher map from compiled metadata (new or legacy format).
2562
+ * @returns A normalized watcher map in the `{ [methodName]: flags }[]` format, or `undefined` if `raw` is `undefined` or empty.
2563
+ */
2564
+ const normalizeWatchers = (raw) => {
2565
+ if (!raw) return void 0;
2566
+ const keys = Object.keys(raw);
2567
+ if (keys.length === 0) return void 0;
2568
+ let hasLegacy = false;
2569
+ for (const propName of keys) {
2570
+ if (hasLegacy) break;
2571
+ for (const h of raw[propName]) if (typeof h === "string") {
2572
+ hasLegacy = true;
2573
+ break;
2574
+ }
2575
+ }
2576
+ if (!hasLegacy) return raw;
2577
+ const out = {};
2578
+ for (const propName of keys) out[propName] = raw[propName].map((h) => typeof h === "string" ? { [h]: 0 } : h);
2579
+ return out;
2580
+ };
2581
+ //#endregion
2541
2582
  //#region src/runtime/parse-property-value.ts
2542
2583
  /**
2543
2584
  * Parse a new property value for a given property type.
@@ -3888,7 +3929,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
3888
3929
  });
3889
3930
  if (BUILD$1.member && cmpMeta.$members$ || BUILD$1.propChangeCallback) {
3890
3931
  if (BUILD$1.propChangeCallback) {
3891
- if (Cstr.watchers && !cmpMeta.$watchers$) cmpMeta.$watchers$ = Cstr.watchers;
3932
+ if (Cstr.watchers && !cmpMeta.$watchers$) cmpMeta.$watchers$ = normalizeWatchers(Cstr.watchers);
3892
3933
  if (Cstr.deserializers && !cmpMeta.$deserializers$) cmpMeta.$deserializers$ = Cstr.deserializers;
3893
3934
  if (Cstr.serializers && !cmpMeta.$serializers$) cmpMeta.$serializers$ = Cstr.serializers;
3894
3935
  }
@@ -4038,7 +4079,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
4038
4079
  if (!Cstr) throw new Error(`Constructor for "${cmpMeta.$tagName$}#${hostRef.$modeName$}" was not found`);
4039
4080
  if (BUILD$1.member && !Cstr.isProxied) {
4040
4081
  if (BUILD$1.propChangeCallback) {
4041
- cmpMeta.$watchers$ = Cstr.watchers;
4082
+ cmpMeta.$watchers$ = normalizeWatchers(Cstr.watchers);
4042
4083
  cmpMeta.$serializers$ = Cstr.serializers;
4043
4084
  cmpMeta.$deserializers$ = Cstr.deserializers;
4044
4085
  }
@@ -4214,7 +4255,59 @@ const disconnectedCallback = async (elm) => {
4214
4255
  if (elm.shadowRoot && rootAppliedStyles.has(elm.shadowRoot)) rootAppliedStyles.delete(elm.shadowRoot);
4215
4256
  };
4216
4257
  //#endregion
4217
- //#region src/runtime/bootstrap-custom-element.ts
4258
+ //#region src/runtime/hmr-component.ts
4259
+ /**
4260
+ * Kick off hot-module-replacement for a component. In order to replace the
4261
+ * component in-place we:
4262
+ *
4263
+ * 1. get a reference to the {@link d.HostRef} for the element
4264
+ * 2. reset the element's runtime flags
4265
+ * 3. re-run the initialization logic for the element (via
4266
+ * {@link initializeComponent})
4267
+ *
4268
+ * For standalone (non-lazy) builds, we instead re-import the component module
4269
+ * and patch the prototype of the registered constructor in-place, then
4270
+ * force a re-render of all existing instances in the DOM.
4271
+ *
4272
+ * @param hostElement the host element for the component which we want to start
4273
+ * doing HMR
4274
+ * @param cmpMeta runtime metadata for the component
4275
+ * @param hmrVersionId the current HMR version ID
4276
+ */
4277
+ const hmrStart = (hostElement, cmpMeta, hmrVersionId) => {
4278
+ if (BUILD$1.lazyLoad) {
4279
+ const hostRef = getHostRef(hostElement);
4280
+ if (!hostRef) return;
4281
+ hostRef.$flags$ = HOST_FLAGS.hasConnected;
4282
+ initializeComponent(hostElement, hostRef, cmpMeta, hmrVersionId);
4283
+ } else hmrStandalone(hostElement, cmpMeta, hmrVersionId);
4284
+ };
4285
+ const hmrStandalone = async (hostElement, cmpMeta, hmrVersionId) => {
4286
+ const modulePath = hostElement.constructor.__stencil_module__;
4287
+ console.log(`[Stencil HMR] hmrStandalone <${cmpMeta.$tagName$}> modulePath:`, modulePath);
4288
+ if (!modulePath) {
4289
+ console.warn(`[Stencil HMR] No __stencil_module__ on <${cmpMeta.$tagName$}> constructor — was this built with devMode?`);
4290
+ return;
4291
+ }
4292
+ try {
4293
+ const newModule = await import(
4294
+ /* @vite-ignore */
4295
+ `${modulePath}?s-hmr=${hmrVersionId}`
4296
+ );
4297
+ const NewClass = Object.values(newModule).find((v) => typeof v === "function" && v.is === cmpMeta.$tagName$) ?? newModule.default;
4298
+ if (!NewClass) return;
4299
+ const ctor = customElements.get(cmpMeta.$tagName$);
4300
+ if (ctor) for (const key of Object.getOwnPropertyNames(NewClass.prototype)) {
4301
+ if (key === "constructor") continue;
4302
+ Object.defineProperty(ctor.prototype, key, Object.getOwnPropertyDescriptor(NewClass.prototype, key));
4303
+ }
4304
+ document.querySelectorAll(cmpMeta.$tagName$).forEach((el) => forceUpdate(el));
4305
+ } catch (e) {
4306
+ console.error(`[Stencil HMR] Failed to reload <${cmpMeta.$tagName$}>`, e);
4307
+ }
4308
+ };
4309
+ //#endregion
4310
+ //#region src/runtime/bootstrap-standalone.ts
4218
4311
  const defineCustomElement = (Cstr, compactMeta) => {
4219
4312
  customElements.define(transformTag(compactMeta[1]), proxyCustomElement(Cstr, compactMeta));
4220
4313
  };
@@ -4228,12 +4321,15 @@ const proxyCustomElement = (Cstr, compactMeta) => {
4228
4321
  if (BUILD$1.member) cmpMeta.$members$ = compactMeta[2];
4229
4322
  if (BUILD$1.hostListener) cmpMeta.$listeners$ = compactMeta[3];
4230
4323
  if (BUILD$1.propChangeCallback) {
4231
- cmpMeta.$watchers$ = Cstr.$watchers$;
4324
+ cmpMeta.$watchers$ = normalizeWatchers(Cstr.$watchers$);
4232
4325
  cmpMeta.$deserializers$ = Cstr.$deserializers$;
4233
4326
  cmpMeta.$serializers$ = Cstr.$serializers$;
4234
4327
  }
4235
4328
  if (BUILD$1.reflect) cmpMeta.$attrsToReflect$ = [];
4236
4329
  if (BUILD$1.shadowDom && !supportsShadow && cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) cmpMeta.$flags$ |= CMP_FLAGS.needsShadowDomShim;
4330
+ if (BUILD$1.hotModuleReplacement) Cstr.prototype["s-hmr"] = function(hmrVersionId) {
4331
+ hmrStart(this, cmpMeta, hmrVersionId);
4332
+ };
4237
4333
  if (!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) && cmpMeta.$flags$ & CMP_FLAGS.hasSlot) if (BUILD$1.experimentalSlotFixes || BUILD$1.patchAll && cmpMeta.$flags$ & CMP_FLAGS.patchAll) patchPseudoShadowDom(Cstr.prototype);
4238
4334
  else {
4239
4335
  if (BUILD$1.slotChildNodesFix || BUILD$1.patchChildren && cmpMeta.$flags$ & CMP_FLAGS.patchChildren) patchChildSlotNodes(Cstr.prototype);
@@ -4314,29 +4410,7 @@ const forceModeUpdate = (elm) => {
4314
4410
  }
4315
4411
  };
4316
4412
  //#endregion
4317
- //#region src/runtime/hmr-component.ts
4318
- /**
4319
- * Kick off hot-module-replacement for a component. In order to replace the
4320
- * component in-place we:
4321
- *
4322
- * 1. get a reference to the {@link d.HostRef} for the element
4323
- * 2. reset the element's runtime flags
4324
- * 3. re-run the initialization logic for the element (via
4325
- * {@link initializeComponent})
4326
- *
4327
- * @param hostElement the host element for the component which we want to start
4328
- * doing HMR
4329
- * @param cmpMeta runtime metadata for the component
4330
- * @param hmrVersionId the current HMR version ID
4331
- */
4332
- const hmrStart = (hostElement, cmpMeta, hmrVersionId) => {
4333
- const hostRef = getHostRef(hostElement);
4334
- if (!hostRef) return;
4335
- hostRef.$flags$ = HOST_FLAGS.hasConnected;
4336
- initializeComponent(hostElement, hostRef, cmpMeta, hmrVersionId);
4337
- };
4338
- //#endregion
4339
- //#region src/runtime/bootstrap-lazy.ts
4413
+ //#region src/runtime/bootstrap-loader.ts
4340
4414
  const bootstrapLazy = (lazyBundles, options = {}) => {
4341
4415
  if (BUILD$1.profile && performance.mark) performance.mark("st:app:start");
4342
4416
  installDevTools();
@@ -4370,7 +4444,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
4370
4444
  if (BUILD$1.hostListener) cmpMeta.$listeners$ = compactMeta[3];
4371
4445
  if (BUILD$1.reflect) cmpMeta.$attrsToReflect$ = [];
4372
4446
  if (BUILD$1.propChangeCallback) {
4373
- cmpMeta.$watchers$ = compactMeta[4] ?? {};
4447
+ cmpMeta.$watchers$ = normalizeWatchers(compactMeta[4]);
4374
4448
  cmpMeta.$serializers$ = compactMeta[5] ?? {};
4375
4449
  cmpMeta.$deserializers$ = compactMeta[6] ?? {};
4376
4450
  }
@@ -4792,4 +4866,4 @@ const insertChildVNodeAnnotations = (doc, vnodeChild, cmpData, hostId, depth, in
4792
4866
  }
4793
4867
  };
4794
4868
  //#endregion
4795
- export { AttachInternals, AttrDeserialize, BUILD, Build, Component, Element$1 as Element, Env, Event, Fragment, H, H as HTMLElement, HYDRATED_STYLE_ID, Host, 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, getRenderingRef, getShadowRoot, getValue, h, insertVdomAnnotations, isMemberInElement, jsx, jsxs, loadModule, modeResolutionChain, needsScopedSSR, nextTick, parsePropertyValue, plt, postUpdateComponent, promiseResolve, proxyComponent, proxyCustomElement, readTask, registerHost, registerInstance, render, renderVdom, resolveVar, setAssetPath, setErrorHandler, setMode, setNonce, setPlatformHelpers, setPlatformOptions, setScopedSSR, setTagTransformer, setValue, styles, supportsConstructableStylesheets, supportsListenerOptions, supportsMutableAdoptedStyleSheets, supportsShadow, transformTag, win, writeTask };
4869
+ export { AttachInternals, AttrDeserialize, BUILD, Build, Component, Element$1 as Element, Env, Event, Fragment, H, H as HTMLElement, HYDRATED_STYLE_ID, Host, 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, getRenderingRef, getShadowRoot, getValue, h, insertVdomAnnotations, isMemberInElement, jsx, jsxs, loadModule, modeResolutionChain, needsScopedSSR, nextTick, normalizeWatchers, parsePropertyValue, plt, postUpdateComponent, promiseResolve, proxyComponent, proxyCustomElement, readTask, registerHost, registerInstance, render, renderVdom, resolveVar, setAssetPath, setErrorHandler, setMode, setNonce, setPlatformHelpers, setPlatformOptions, setScopedSsr, setTagTransformer, setValue, styles, supportsConstructableStylesheets, supportsListenerOptions, supportsMutableAdoptedStyleSheets, supportsShadow, transformTag, win, writeTask };
@@ -1,16 +1,16 @@
1
- import { _ as ResolutionHandler, a as ComponentRuntimeMeta, c as HostRef, d as RenderNode, f as RuntimeRef, g as JSXBase, h as HTMLStencilElement, i as ComponentRuntimeHostListener, l as LazyBundlesRuntimeData, n as ChildType, o as ComponentRuntimeMetaCompact, p as CustomElementsDefineOptions, r as ComponentConstructor, s as HostElement, u as PlatformRuntime, v as TagTransformer, y as VNode } from "../index-CyrGY82h.js";
2
- import { n as jsxs, r as Fragment, t as jsx } from "../jsx-runtime-DlDkTqps.js";
1
+ import { _ as JSXBase, a as ComponentRuntimeHostListener, b as VNode, c as HostElement, d as PlatformRuntime, f as RenderNode, g as HTMLStencilElement, i as ComponentConstructorChangeHandlers, l as HostRef, m as CustomElementsDefineOptions, n as ChildType, o as ComponentRuntimeMeta, p as RuntimeRef, r as ComponentConstructor, s as ComponentRuntimeMetaCompact, u as LazyBundlesRuntimeData, v as ResolutionHandler, y as TagTransformer } from "../index-D61XZw0f.js";
2
+ import { n as jsxs, r as Fragment, t as jsx } from "../jsx-runtime-B3vQbWIW.js";
3
3
 
4
4
  //#region src/runtime/asset-path.d.ts
5
5
  declare const getAssetPath: (path: string) => string;
6
6
  declare const setAssetPath: (path: string) => string;
7
7
  //#endregion
8
- //#region src/runtime/bootstrap-custom-element.d.ts
8
+ //#region src/runtime/bootstrap-standalone.d.ts
9
9
  declare const defineCustomElement: (Cstr: any, compactMeta: ComponentRuntimeMetaCompact) => void;
10
10
  declare const proxyCustomElement: (Cstr: any, compactMeta: ComponentRuntimeMetaCompact) => any;
11
11
  declare const forceModeUpdate: (elm: RenderNode) => void;
12
12
  //#endregion
13
- //#region src/runtime/bootstrap-lazy.d.ts
13
+ //#region src/runtime/bootstrap-loader.d.ts
14
14
  declare const bootstrapLazy: (lazyBundles: LazyBundlesRuntimeData, options?: CustomElementsDefineOptions) => void;
15
15
  //#endregion
16
16
  //#region src/runtime/connected-callback.d.ts
@@ -59,6 +59,30 @@ declare const getMode: (ref: RuntimeRef) => string;
59
59
  */
60
60
  declare const setNonce: (nonce: string) => string;
61
61
  //#endregion
62
+ //#region src/runtime/normalize-watchers.d.ts
63
+ /**
64
+ * Normalizes watcher metadata to the current `{ [methodName]: flags }[]` format.
65
+ *
66
+ * Prior to Stencil 4.39.x (PR #6484), the `@Watch()` compiler emitted watcher
67
+ * handlers as a plain string array: `{ "min": ["minChanged"] }`. The new format
68
+ * wraps each entry in an object that carries option flags (e.g. `immediate`):
69
+ * `{ "min": [{ "minChanged": 0 }] }`.
70
+ *
71
+ * When a library (e.g. Ionic Framework) was compiled with an older Stencil compiler
72
+ * but consumed by an app using a newer Stencil runtime, the runtime's
73
+ * `Object.entries(watcher)` call receives a string and misinterprets its character
74
+ * indices as method names, causing:
75
+ * `TypeError: instance[watchMethodName] is not a function`
76
+ *
77
+ * This helper should be used at `$watchers$` assignment sites that need to
78
+ * accept both legacy and current compiler metadata so downstream code on those
79
+ * paths can safely assume the new object format.
80
+ *
81
+ * @param raw The raw watcher map from compiled metadata (new or legacy format).
82
+ * @returns A normalized watcher map in the `{ [methodName]: flags }[]` format, or `undefined` if `raw` is `undefined` or empty.
83
+ */
84
+ declare const normalizeWatchers: (raw: ComponentConstructorChangeHandlers | undefined) => ComponentConstructorChangeHandlers | undefined;
85
+ //#endregion
62
86
  //#region src/runtime/parse-property-value.d.ts
63
87
  /**
64
88
  * Parse a new property value for a given property type.
@@ -195,4 +219,4 @@ declare const insertVdomAnnotations: (doc: Document, staticComponents: string[])
195
219
  */
196
220
  declare const renderVdom: (hostRef: HostRef, renderFnResults: VNode | VNode[], isInitialLoad?: boolean) => void;
197
221
  //#endregion
198
- export { Fragment, type HTMLStencilElement, HYDRATED_STYLE_ID, Host, type JSXBase, Mixin, addHostEventListeners, bootstrapLazy, connectedCallback, createEvent, defineCustomElement, disconnectedCallback, forceModeUpdate, forceUpdate, getAssetPath, getElement, getMode, getRenderingRef, getShadowRoot, getValue, h, insertVdomAnnotations, jsx, jsxs, parsePropertyValue, postUpdateComponent, proxyComponent, proxyCustomElement, render, renderVdom, setAssetPath, setMode, setNonce, setPlatformOptions, setTagTransformer, setValue, transformTag };
222
+ export { Fragment, type HTMLStencilElement, HYDRATED_STYLE_ID, Host, type JSXBase, Mixin, addHostEventListeners, bootstrapLazy, connectedCallback, createEvent, defineCustomElement, disconnectedCallback, forceModeUpdate, forceUpdate, getAssetPath, getElement, getMode, getRenderingRef, getShadowRoot, getValue, h, insertVdomAnnotations, jsx, jsxs, normalizeWatchers, parsePropertyValue, postUpdateComponent, proxyComponent, proxyCustomElement, render, renderVdom, setAssetPath, setMode, setNonce, setPlatformOptions, setTagTransformer, setValue, transformTag };
@@ -1,2 +1,2 @@
1
- import { A as h, C as postUpdateComponent, D as getMode, E as parsePropertyValue, F as HYDRATED_STYLE_ID, M as getShadowRoot, N as getAssetPath, O as setMode, P as setAssetPath, S as getRenderingRef, T as createEvent, _ as connectedCallback, a as transformTag, b as setValue, c as setNonce, d as Fragment, f as bootstrapLazy, g as disconnectedCallback, h as proxyCustomElement, i as setTagTransformer, j as getElement, k as Host, l as Mixin, m as forceModeUpdate, n as jsx, o as render, p as defineCustomElement, r as jsxs, s as setPlatformOptions, t as insertVdomAnnotations, u as addHostEventListeners, v as proxyComponent, w as renderVdom, x as forceUpdate, y as getValue } from "../runtime-COEYYPyw.js";
2
- export { Fragment, HYDRATED_STYLE_ID, Host, Mixin, addHostEventListeners, bootstrapLazy, connectedCallback, createEvent, defineCustomElement, disconnectedCallback, forceModeUpdate, forceUpdate, getAssetPath, getElement, getMode, getRenderingRef, getShadowRoot, getValue, h, insertVdomAnnotations, jsx, jsxs, parsePropertyValue, postUpdateComponent, proxyComponent, proxyCustomElement, render, renderVdom, setAssetPath, setMode, setNonce, setPlatformOptions, setTagTransformer, setValue, transformTag };
1
+ import { A as Host, C as postUpdateComponent, D as normalizeWatchers, E as parsePropertyValue, F as setAssetPath, I as HYDRATED_STYLE_ID, M as getElement, N as getShadowRoot, O as getMode, P as getAssetPath, S as getRenderingRef, T as createEvent, _ as connectedCallback, a as transformTag, b as setValue, c as setNonce, d as Fragment, f as bootstrapLazy, g as disconnectedCallback, h as proxyCustomElement, i as setTagTransformer, j as h, k as setMode, l as Mixin, m as forceModeUpdate, n as jsx, o as render, p as defineCustomElement, r as jsxs, s as setPlatformOptions, t as insertVdomAnnotations, u as addHostEventListeners, v as proxyComponent, w as renderVdom, x as forceUpdate, y as getValue } from "../runtime-CKyUrF4i.js";
2
+ export { Fragment, HYDRATED_STYLE_ID, Host, Mixin, addHostEventListeners, bootstrapLazy, connectedCallback, createEvent, defineCustomElement, disconnectedCallback, forceModeUpdate, forceUpdate, getAssetPath, getElement, getMode, getRenderingRef, getShadowRoot, getValue, h, insertVdomAnnotations, jsx, jsxs, normalizeWatchers, parsePropertyValue, postUpdateComponent, proxyComponent, proxyCustomElement, render, renderVdom, setAssetPath, setMode, setNonce, setPlatformOptions, setTagTransformer, setValue, transformTag };
@@ -147,7 +147,7 @@ interface CustomElementsDefineOptions {
147
147
  }
148
148
  //#endregion
149
149
  //#region src/declarations/stencil-public-compiler.d.ts
150
- interface HydrateDocumentOptions {
150
+ interface SsrDocumentOptions {
151
151
  /**
152
152
  * Build ID that will be added to `<html data-stencil-build="BUILD_ID">`. By default
153
153
  * a random ID will be generated
@@ -164,7 +164,7 @@ interface HydrateDocumentOptions {
164
164
  * JavaScript to read the structure of the HTML and rebuild each
165
165
  * component. Defaults to `true`.
166
166
  */
167
- clientHydrateAnnotations?: boolean;
167
+ clientSsrAnnotations?: boolean;
168
168
  /**
169
169
  * Constrain `setTimeout()` to 1ms, but still async. Also
170
170
  * only allows `setInterval()` to fire once, also constrained to 1ms.
@@ -263,10 +263,14 @@ interface HydrateDocumentOptions {
263
263
  default: 'declarative-shadow-dom' | 'scoped';
264
264
  } | boolean;
265
265
  }
266
- interface SerializeDocumentOptions extends HydrateDocumentOptions {
266
+ interface SerializeDocumentOptions extends SsrDocumentOptions {
267
267
  /**
268
268
  * Runs after the `document` has been hydrated.
269
269
  */
270
+ afterSsr?(document: any): any | Promise<any>;
271
+ /**
272
+ * @deprecated Use `afterSsr` instead.
273
+ */
270
274
  afterHydrate?(document: any): any | Promise<any>;
271
275
  /**
272
276
  * Sets an approximate line width the HTML should attempt to stay within.
@@ -279,6 +283,10 @@ interface SerializeDocumentOptions extends HydrateDocumentOptions {
279
283
  /**
280
284
  * Runs before the `document` has been hydrated.
281
285
  */
286
+ beforeSsr?(document: any): any | Promise<any>;
287
+ /**
288
+ * @deprecated Use `beforeSsr` instead.
289
+ */
282
290
  beforeHydrate?(document: any): any | Promise<any>;
283
291
  /**
284
292
  * Format the HTML in a nicely indented format.
@@ -316,7 +324,7 @@ interface SerializeDocumentOptions extends HydrateDocumentOptions {
316
324
  */
317
325
  modes?: ResolutionHandler[];
318
326
  }
319
- interface HydrateFactoryOptions extends SerializeDocumentOptions {
327
+ interface SsrFactoryOptions extends SerializeDocumentOptions {
320
328
  serializeToHtml: boolean;
321
329
  destroyWindow: boolean;
322
330
  destroyDocument: boolean;
@@ -466,7 +474,7 @@ interface HostElement extends HTMLElement {
466
474
  ['s-p']?: Promise<void>[];
467
475
  componentOnReady?: () => Promise<this>;
468
476
  }
469
- interface HydrateResults {
477
+ interface SsrResults {
470
478
  buildId: string;
471
479
  diagnostics: Diagnostic[];
472
480
  url: string;
@@ -478,42 +486,42 @@ interface HydrateResults {
478
486
  search: string | null;
479
487
  hash: string | null;
480
488
  html: string | null;
481
- components: HydrateComponent[];
482
- anchors: HydrateAnchorElement[];
483
- imgs: HydrateImgElement[];
484
- scripts: HydrateScriptElement[];
485
- styles: HydrateStyleElement[];
486
- staticData: HydrateStaticData[];
489
+ components: SsrComponent[];
490
+ anchors: SsrAnchorElement[];
491
+ imgs: SsrImgElement[];
492
+ scripts: SsrScriptElement[];
493
+ styles: SsrStyleElement[];
494
+ staticData: SsrStaticData[];
487
495
  title: string | null;
488
496
  hydratedCount: number;
489
497
  httpStatus: number | null;
490
498
  }
491
- interface HydrateComponent {
499
+ interface SsrComponent {
492
500
  tag: string;
493
501
  mode: string;
494
502
  count: number;
495
503
  depth: number;
496
504
  }
497
- interface HydrateElement {
505
+ interface SsrElement {
498
506
  [attrName: string]: string | undefined;
499
507
  }
500
- interface HydrateAnchorElement extends HydrateElement {
508
+ interface SsrAnchorElement extends SsrElement {
501
509
  href?: string;
502
510
  target?: string;
503
511
  }
504
- interface HydrateImgElement extends HydrateElement {
512
+ interface SsrImgElement extends SsrElement {
505
513
  src?: string;
506
514
  }
507
- interface HydrateScriptElement extends HydrateElement {
515
+ interface SsrScriptElement extends SsrElement {
508
516
  src?: string;
509
517
  type?: string;
510
518
  }
511
- interface HydrateStyleElement extends HydrateElement {
519
+ interface SsrStyleElement extends SsrElement {
512
520
  id?: string;
513
521
  href?: string;
514
522
  content?: string;
515
523
  }
516
- interface HydrateStaticData {
524
+ interface SsrStaticData {
517
525
  id: string;
518
526
  type: string;
519
527
  content: string;
@@ -928,15 +936,26 @@ type ChildType = VNode | number | string;
928
936
  //#region src/server/platform/h-async.d.ts
929
937
  declare const hAsync: (nodeName: any, vnodeData: any, ...children: ChildType[]) => VNode | Promise<VNode>;
930
938
  //#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;
939
+ //#region src/server/platform/ssr-app.d.ts
940
+ /**
941
+ * SSR a Document by patching the DOM APIs to wait for components to be connected and hydrated
942
+ * before allowing them to be added to the document.
943
+ * Once all components are hydrated, the `afterSsr` callback is called so that the caller can serialize
944
+ * the document to HTML and send it back to the client.
945
+ * @param win The window to use for SSR. This should be a patched window created by `patchDomImplementation`.
946
+ * @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.
947
+ * @param results The results object to store the hydration results.
948
+ * @param afterSsr The callback to be called after SSR is complete.
949
+ * @param resolve The resolve function to be called when SSR is complete.
950
+ */
951
+ 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;
933
952
  //#endregion
934
- //#region src/runtime/bootstrap-custom-element.d.ts
953
+ //#region src/runtime/bootstrap-standalone.d.ts
935
954
  declare const defineCustomElement: (Cstr: any, compactMeta: ComponentRuntimeMetaCompact) => void;
936
955
  declare const proxyCustomElement: (Cstr: any, compactMeta: ComponentRuntimeMetaCompact) => any;
937
956
  declare const forceModeUpdate: (elm: RenderNode) => void;
938
957
  //#endregion
939
- //#region src/runtime/bootstrap-lazy.d.ts
958
+ //#region src/runtime/bootstrap-loader.d.ts
940
959
  declare const bootstrapLazy: (lazyBundles: LazyBundlesRuntimeData, options?: CustomElementsDefineOptions) => void;
941
960
  //#endregion
942
961
  //#region src/runtime/connected-callback.d.ts
@@ -947,6 +966,18 @@ declare const disconnectedCallback: (elm: HostElement) => Promise<void>;
947
966
  //#endregion
948
967
  //#region src/runtime/element.d.ts
949
968
  declare const getElement: (ref: any) => HostElement;
969
+ /**
970
+ * Get the shadow root for a Stencil component's host element.
971
+ * This works for both open and closed shadow DOM modes.
972
+ *
973
+ * For closed shadow DOM, `element.shadowRoot` returns `null` by design,
974
+ * but Stencil stores the reference internally so components can still
975
+ * access their own shadow root.
976
+ *
977
+ * @param element The host element (from @Element() decorator)
978
+ * @returns The shadow root, or null if no shadow root exists
979
+ */
980
+ declare const getShadowRoot: (element: HTMLElement) => ShadowRoot | null;
950
981
  //#endregion
951
982
  //#region src/runtime/event-emitter.d.ts
952
983
  declare const createEvent: (ref: RuntimeRef, name: string, flags: number) => {
@@ -1142,7 +1173,7 @@ declare const modeResolutionChain: ResolutionHandler[];
1142
1173
  declare const getAssetPath: (path: string) => string;
1143
1174
  /**
1144
1175
  * Sets the base URL for resolving asset paths in the server/hydrate context.
1145
- * @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 `hydrateDocument` to ensure that asset paths are resolved correctly in the server/hydrate context.
1176
+ * @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.
1146
1177
  * If not set, it defaults to './', which is a reasonable default for server-side rendering.
1147
1178
  * @returns void
1148
1179
  */
@@ -1151,7 +1182,7 @@ declare const setAssetPath: (path: string) => string;
1151
1182
  * Checks to see any components are rendered with `scoped`
1152
1183
  * @param opts - SSR options
1153
1184
  */
1154
- declare const setScopedSSR: (opts: HydrateFactoryOptions) => void;
1185
+ declare const setScopedSsr: (opts: SsrFactoryOptions) => void;
1155
1186
  declare const needsScopedSSR: () => boolean;
1156
1187
  //#endregion
1157
- 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 };
1188
+ 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, supportsShadow, transformTag, win, writeTask };