@stencil/core 5.0.0-beta.30 → 5.0.0-beta.32

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.
@@ -1,2 +1,2 @@
1
- import { n as Env, r as NAMESPACE, t as BUILD } from "../index-BHciXst1.js";
1
+ import { n as Env, r as NAMESPACE, t as BUILD } from "../index-CicD4Pgn.js";
2
2
  export { BUILD, Env, NAMESPACE };
@@ -459,6 +459,50 @@ function findSlotFromSlottedNode(slottedNode, parentHost) {
459
459
  //#endregion
460
460
  //#region src/runtime/dom-extras.ts
461
461
  /**
462
+ * Patches a node slotted into a non-shadow component so it behaves as it would in a native slot:
463
+ * - `parentNode` returns the host element
464
+ * - `remove()` fires `slotchange` on the node's slot
465
+ *
466
+ * @param node the slotted node to be patched
467
+ */
468
+ const patchSlottedNode = (node) => {
469
+ patchParentNode(node);
470
+ patchSlottedRemove(node);
471
+ };
472
+ /**
473
+ * Detaches a slotted node from where it physically sits in the component's rendered DOM, through
474
+ * the unpatched accessors. Not via `remove()`: mock-doc's `remove()` calls
475
+ * `parentNode.removeChild()`, and a slotted node's patched `parentNode` is the host, whose patched
476
+ * `removeChild()` would come straight back here.
477
+ *
478
+ * @param node the slotted node to detach
479
+ */
480
+ const removeSlottedNode = (node) => {
481
+ const parent = internalCall(node, "parentNode");
482
+ if (parent) internalCall(parent, "removeChild")(node);
483
+ };
484
+ /**
485
+ * Patches `remove()` on a node slotted into a non-shadow component, so that removing it fires
486
+ * `slotchange` on its slot (and updates fallback content), as removing a node from a native slot
487
+ * does. Stencil's own node moves, while `isTmpDisconnected` is set, don't fire it.
488
+ *
489
+ * @param node the slotted node to patch
490
+ */
491
+ const patchSlottedRemove = (node) => {
492
+ const child = node;
493
+ if (!child || child.__remove || typeof child.remove !== "function") return;
494
+ child.__remove = child.remove;
495
+ child.remove = function() {
496
+ const host = this["s-ol"]?.parentElement;
497
+ const { slotNode } = findSlotFromSlottedNode(this);
498
+ removeSlottedNode(this);
499
+ if (slotNode && !(plt.$flags$ & PLATFORM_FLAGS.isTmpDisconnected)) {
500
+ dispatchSlotChangeEvent(slotNode);
501
+ updateFallbackSlotVisibility(host);
502
+ }
503
+ };
504
+ };
505
+ /**
462
506
  * Patches the `parentNode` accessor of a non-shadow slotted node
463
507
  *
464
508
  * @param node the slotted node to be patched
@@ -1020,6 +1064,7 @@ let isSvgMode = false;
1020
1064
  * These ensure that ref callbacks are called in the correct order:
1021
1065
  * first all removal callbacks (with null), then all attachment callbacks (with elements).
1022
1066
  */
1067
+ const initialSlotChanges = /* @__PURE__ */ new Set();
1023
1068
  const refCallbacksToRemove = [];
1024
1069
  const refCallbacksToAttach = [];
1025
1070
  /** Disposers for signal subscriptions on individual DOM nodes (text nodes, <s-show> wrappers). */
@@ -1574,10 +1619,13 @@ const insertBefore = (parent, newNode, reference, isInitialLoad) => {
1574
1619
  if (BUILD.scoped && typeof newNode["s-sn"] === "string" && !!newNode["s-sr"] && !!newNode["s-cr"]) addRemoveSlotScopedClass(newNode["s-cr"], newNode, parent, newNode.parentElement);
1575
1620
  else if (typeof newNode["s-sn"] === "string") {
1576
1621
  const hostElm = newNode["s-hn"] && parent.closest?.(newNode["s-hn"]);
1577
- if ((BUILD.lightDomPatches || BUILD.slotChildNodes || BUILD.patchAll && !!(hostElm && getHostRef(hostElm)?.$cmpMeta$.$flags$ & CMP_FLAGS.patchAll)) && parent.getRootNode().nodeType !== NODE_TYPES.DOCUMENT_FRAGMENT_NODE) patchParentNode(newNode);
1622
+ if ((BUILD.lightDomPatches || BUILD.slotChildNodes || BUILD.patchAll && !!(hostElm && getHostRef(hostElm)?.$cmpMeta$.$flags$ & CMP_FLAGS.patchAll)) && parent.getRootNode().nodeType !== NODE_TYPES.DOCUMENT_FRAGMENT_NODE) patchSlottedNode(newNode);
1578
1623
  parent.insertBefore(newNode, reference);
1579
1624
  const { slotNode } = findSlotFromSlottedNode(newNode);
1580
- if (slotNode && !isInitialLoad) dispatchSlotChangeEvent(slotNode);
1625
+ if (slotNode) {
1626
+ if (isInitialLoad) initialSlotChanges.add(slotNode);
1627
+ else dispatchSlotChangeEvent(slotNode);
1628
+ }
1581
1629
  return newNode;
1582
1630
  }
1583
1631
  }
@@ -1733,6 +1781,11 @@ render() {
1733
1781
  if (checkSlotFallbackVisibility) updateFallbackSlotVisibility(rootVnode.$elm$);
1734
1782
  plt.$flags$ &= ~PLATFORM_FLAGS.isTmpDisconnected;
1735
1783
  relocateNodes.length = 0;
1784
+ if (initialSlotChanges.size) {
1785
+ const slotNodes = [...initialSlotChanges];
1786
+ initialSlotChanges.clear();
1787
+ nextTick(() => slotNodes.forEach(dispatchSlotChangeEvent));
1788
+ }
1736
1789
  }
1737
1790
  if (BUILD.slotRelocation && !useNativeShadowDom && !(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) && hostElm["s-cr"]) {
1738
1791
  const children = rootVnode.$elm$.__childNodes || rootVnode.$elm$.childNodes;
@@ -1843,7 +1843,7 @@ const validateComponentTag = (tag) => {
1843
1843
  };
1844
1844
  //#endregion
1845
1845
  //#region src/version.ts
1846
- const version = "5.0.0-beta.30";
1846
+ const version = "5.0.0-beta.32";
1847
1847
  //#endregion
1848
1848
  //#region src/compiler/events.ts
1849
1849
  const buildEvents = () => {
@@ -12829,7 +12829,8 @@ const parseMethodDecorator = (config, diagnostics, tsSourceFile, typeChecker, pr
12829
12829
  const returnTypeNode = typeChecker.typeToTypeNode(returnType, method, ts$1.NodeBuilderFlags.NoTruncation | ts$1.NodeBuilderFlags.NoTypeReduction);
12830
12830
  let returnString = typeToString(typeChecker, returnType);
12831
12831
  let signatureString = typeChecker.signatureToString(signature, method, flags, ts$1.SignatureKind.Call);
12832
- if (!config._isTesting) {
12832
+ const isAsync = !!method.modifiers?.some((m) => m.kind === ts$1.SyntaxKind.AsyncKeyword);
12833
+ if (!config._isTesting && !isAsync) {
12833
12834
  if (returnString === "void") {
12834
12835
  const warn = buildWarn(diagnostics);
12835
12836
  warn.header = "@Method requires async";
@@ -15044,6 +15045,8 @@ function extractAncestorMeta(ancestor, cmpSourceFile, resolveImport, config) {
15044
15045
  "events",
15045
15046
  "listeners",
15046
15047
  "watchers",
15048
+ "serializers",
15049
+ "deserializers",
15047
15050
  "methods"
15048
15051
  ].includes(m.name.text));
15049
15052
  if (!hasUsableStaticMembers && className) {
@@ -15063,6 +15066,8 @@ function extractAncestorMeta(ancestor, cmpSourceFile, resolveImport, config) {
15063
15066
  events: reanchorInheritedTypeReferences(reclassifyGlobalTypeReferences(parseStaticEvents(resolvedStaticMembers) ?? [], parentSf, resolvedPath, resolveImport), resolvedPath, cmpSourceFile.fileName),
15064
15067
  listeners: parseStaticListeners(resolvedStaticMembers) ?? [],
15065
15068
  watchers: parseStaticWatchers(resolvedStaticMembers) ?? [],
15069
+ serializers: parseStaticSerializers(resolvedStaticMembers, "serializers") ?? [],
15070
+ deserializers: parseStaticSerializers(resolvedStaticMembers, "deserializers") ?? [],
15066
15071
  methodNames: resolvedClassNode.members.filter(ts$1.isMethodDeclaration).map((m) => ts$1.isIdentifier(m.name) ? m.name.text : "").filter(Boolean)
15067
15072
  };
15068
15073
  }
@@ -15092,8 +15097,8 @@ function mergeExtendedClassMetaWithResolveImport(cmpNode, staticMembers, sourceF
15092
15097
  let events = parseStaticEvents(staticMembers);
15093
15098
  let watchers = parseStaticWatchers(staticMembers);
15094
15099
  let classMethods = cmpNode.members.filter(ts$1.isMethodDeclaration).map((m) => ts$1.isIdentifier(m.name) ? m.name.text : "").filter(Boolean);
15095
- const serializers = [];
15096
- const deserializers = [];
15100
+ let serializers = parseStaticSerializers(staticMembers, "serializers");
15101
+ let deserializers = parseStaticSerializers(staticMembers, "deserializers");
15097
15102
  const ancestors = [];
15098
15103
  resolveAncestors(cmpNode, sourceFile, sourceFile.fileName, resolveImport, /* @__PURE__ */ new Set(), ancestors, cmpNode, buildCtx);
15099
15104
  ancestors.forEach((ancestor) => {
@@ -15107,6 +15112,8 @@ function mergeExtendedClassMetaWithResolveImport(cmpNode, staticMembers, sourceF
15107
15112
  events = [...deDupeMembers(parentMeta.events, events), ...events];
15108
15113
  listeners = [...deDupeMembers(parentMeta.listeners, listeners), ...listeners];
15109
15114
  watchers = [...deDupeMembers(parentMeta.watchers, watchers), ...watchers];
15115
+ serializers = [...deDupeMembers(parentMeta.serializers ?? [], serializers), ...serializers];
15116
+ deserializers = [...deDupeMembers(parentMeta.deserializers ?? [], deserializers), ...deserializers];
15110
15117
  classMethods = [...classMethods, ...parentMeta.methodNames];
15111
15118
  });
15112
15119
  return {
@@ -1,4 +1,4 @@
1
- import { $ as CompilerFsStats, $n as WorkerMainController, $t as OutputTargetBuild, A as BuildOverrides, An as ResolveModuleIdResults, At as HotModuleReplacement, B as CompilerEventBuildLog, Bn as SsrFactoryOptions, Bt as Logger, C as BuildEmitEvents, Cn as PluginTransformResults, Cr as JsonDocsStyle, Ct as DevServerEditor, D as BuildOnEventRemove, Dn as PrerenderResults, Dr as JsonDocsValue, Dt as HistoryApiFallback, E as BuildNoChangeResults, En as PrerenderOptions, Er as JsonDocsUsage, Et as FsWatchResults, F as Compiler, Fn as SerializeDocumentOptions, Ft as LazyRequire, G as CompilerEventFileAdd, Gn as TransformOptions, Gt as OptimizeCssInput, H as CompilerEventBuildStart, Hn as StencilDevServerConfig, Ht as LoggerTimeSpan, I as CompilerBuildResults, In as ServiceWorkerConfig, It as LightDomPatches, J as CompilerEventFsChange, Jn as TranspileResults, Jt as OptimizeJsOutput, K as CompilerEventFileDelete, Kn as TranspileOnlyResults, Kt as OptimizeCssOutput, L as CompilerBuildStart, Ln as SitemapXmpOpts, Lt as LoadConfigInit, M as CliInitOptions, Mn as RobotsTxtOpts, Mt as HydrateFactoryOptions, N as CompileScriptMinifyOptions, Nn as RobotsTxtResults, Nt as HydratedFlag, O as BuildOnEvents, On as PrerenderStartOptions, Or as StyleDoc, Ot as HmrGlobalStyleUpdate, P as CompileTarget, Pn as RolldownConfig, Pt as LOG_LEVELS, Q as CompilerFileWatcherEvent, Qn as WatcherCloseResults, Qt as OutputTargetBaseNext, R as CompilerDependency, Rn as SitemapXmpResults, Rt as LoadConfigResults, S as AutoprefixerOptions, Sn as PluginCtx, Sr as JsonDocsSlot, St as DevServerConfig, T as BuildLog, Tn as PrerenderHydrateOptions, Tr as JsonDocsTypeLibrary, Tt as DocsReadmeCustomColumn, U as CompilerEventDirAdd, Un as StencilDocsConfig, Ut as ModeConfig, V as CompilerEventBuildNoChange, Vn as StencilConfig, Vt as LoggerLineUpdater, W as CompilerEventDirDelete, Wn as SystemDetails, Wt as NodeResolveConfig, X as CompilerFileWatcher, Xn as ValidatedConfig, Xt as OutputTargetAssets, Y as CompilerEventName, Yn as UnvalidatedConfig, Yt as OutputTarget, Z as CompilerFileWatcherCallback, Zn as ValidatedOutputTargetWww, Zt as OutputTargetBase, _ as PrintLine, _n as OutputTargetWww, _r as JsonDocsListener, _t as CopyTask, a as ComponentCompilerEvent, an as OutputTargetDocsCustom, at as CompilerSystemRealpathResults, b as SsrResults, bn as PlatformPath, br as JsonDocsPart, bt as CustomElementsExportBehaviorOptions, c as ComponentCompilerMethod, cn as OutputTargetDocsReadme, ct as CompilerSystemRemoveFileResults, d as ComponentCompilerTypeReferences, dn as OutputTargetLoaderBundle, dr as JsonDocMethodParameter, dt as CompilerSystemWriteFileResults, en as OutputTargetCollection, er as WorkerOptions, et as CompilerRequest, f as ComponentGlobalStyle, fn as OutputTargetSsr, fr as JsonDocs, ft as CompilerWatcher, g as PrerenderUrlResults, gn as OutputTargetTypes, gr as JsonDocsEvent, gt as CopyResults, h as PackageJsonData, hn as OutputTargetStats, hr as JsonDocsDependencyGraph, ht as ConfigCompat, i as CompilerWorkerContext, in as OutputTargetDocsAgentSkill, it as CompilerSystemCreateDirectoryResults, j as BuildResultsComponentGraph, jn as ResolveModuleOptions, jt as HydrateDocumentOptions, k as BuildOutput, kn as ResolveModuleIdOptions, kr as FsWriteResults, kt as HmrStyleUpdate, l as ComponentCompilerProperty, ln as OutputTargetDocsVscode, lr as UserBuildConditionals, lt as CompilerSystemRenameResults, m as LazyBundlesRuntimeData, mn as OutputTargetStandalone, mr as JsonDocsCustomState, mt as ConfigBundle, nn as OutputTargetCustom, nt as CompilerSystem, o as ComponentCompilerListener, on as OutputTargetDocsCustomElementsManifest, ot as CompilerSystemRemoveDirectoryOptions, pn as OutputTargetSsrWasm, pr as JsonDocsComponent, pt as Config, q as CompilerEventFileUpdate, qn as TranspileOptions, qt as OptimizeJsInput, r as CompilerCtx, rn as OutputTargetDistLazy, rt as CompilerSystemCreateDirectoryOptions, s as ComponentCompilerMeta, sn as OutputTargetDocsJson, st as CompilerSystemRemoveDirectoryResults, t as BuildCtx, tn as OutputTargetCopy, tt as CompilerRequestResponse, u as ComponentCompilerState, un as OutputTargetGlobalStyle, ut as CompilerSystemRenamedPath, vn as PageReloadStrategy, vr as JsonDocsMethod, vt as Credentials, w as BuildEvents, wn as PrerenderConfig, wr as JsonDocsTag, wt as Diagnostic, x as WorkerMsgHandler, xn as Plugin, xr as JsonDocsProp, xt as DevServer, yn as ParsedPath, yr as JsonDocsMethodReturn, yt as CustomElementsExportBehavior, z as CompilerEventBuildFinish, zn as SsrDocumentOptions, zt as LogLevel } from "../index-BogZpjP2.mjs";
1
+ import { $ as CompilerFsStats, $n as WorkerMainController, $t as OutputTargetBuild, A as BuildOverrides, An as ResolveModuleIdResults, At as HotModuleReplacement, B as CompilerEventBuildLog, Bn as SsrFactoryOptions, Bt as Logger, C as BuildEmitEvents, Cn as PluginTransformResults, Cr as JsonDocsStyle, Ct as DevServerEditor, D as BuildOnEventRemove, Dn as PrerenderResults, Dr as JsonDocsValue, Dt as HistoryApiFallback, E as BuildNoChangeResults, En as PrerenderOptions, Er as JsonDocsUsage, Et as FsWatchResults, F as Compiler, Fn as SerializeDocumentOptions, Ft as LazyRequire, G as CompilerEventFileAdd, Gn as TransformOptions, Gt as OptimizeCssInput, H as CompilerEventBuildStart, Hn as StencilDevServerConfig, Ht as LoggerTimeSpan, I as CompilerBuildResults, In as ServiceWorkerConfig, It as LightDomPatches, J as CompilerEventFsChange, Jn as TranspileResults, Jt as OptimizeJsOutput, K as CompilerEventFileDelete, Kn as TranspileOnlyResults, Kt as OptimizeCssOutput, L as CompilerBuildStart, Ln as SitemapXmpOpts, Lt as LoadConfigInit, M as CliInitOptions, Mn as RobotsTxtOpts, Mt as HydrateFactoryOptions, N as CompileScriptMinifyOptions, Nn as RobotsTxtResults, Nt as HydratedFlag, O as BuildOnEvents, On as PrerenderStartOptions, Or as StyleDoc, Ot as HmrGlobalStyleUpdate, P as CompileTarget, Pn as RolldownConfig, Pt as LOG_LEVELS, Q as CompilerFileWatcherEvent, Qn as WatcherCloseResults, Qt as OutputTargetBaseNext, R as CompilerDependency, Rn as SitemapXmpResults, Rt as LoadConfigResults, S as AutoprefixerOptions, Sn as PluginCtx, Sr as JsonDocsSlot, St as DevServerConfig, T as BuildLog, Tn as PrerenderHydrateOptions, Tr as JsonDocsTypeLibrary, Tt as DocsReadmeCustomColumn, U as CompilerEventDirAdd, Un as StencilDocsConfig, Ut as ModeConfig, V as CompilerEventBuildNoChange, Vn as StencilConfig, Vt as LoggerLineUpdater, W as CompilerEventDirDelete, Wn as SystemDetails, Wt as NodeResolveConfig, X as CompilerFileWatcher, Xn as ValidatedConfig, Xt as OutputTargetAssets, Y as CompilerEventName, Yn as UnvalidatedConfig, Yt as OutputTarget, Z as CompilerFileWatcherCallback, Zn as ValidatedOutputTargetWww, Zt as OutputTargetBase, _ as PrintLine, _n as OutputTargetWww, _r as JsonDocsListener, _t as CopyTask, a as ComponentCompilerEvent, an as OutputTargetDocsCustom, at as CompilerSystemRealpathResults, b as SsrResults, bn as PlatformPath, br as JsonDocsPart, bt as CustomElementsExportBehaviorOptions, c as ComponentCompilerMethod, cn as OutputTargetDocsReadme, ct as CompilerSystemRemoveFileResults, d as ComponentCompilerTypeReferences, dn as OutputTargetLoaderBundle, dr as JsonDocMethodParameter, dt as CompilerSystemWriteFileResults, en as OutputTargetCollection, er as WorkerOptions, et as CompilerRequest, f as ComponentGlobalStyle, fn as OutputTargetSsr, fr as JsonDocs, ft as CompilerWatcher, g as PrerenderUrlResults, gn as OutputTargetTypes, gr as JsonDocsEvent, gt as CopyResults, h as PackageJsonData, hn as OutputTargetStats, hr as JsonDocsDependencyGraph, ht as ConfigCompat, i as CompilerWorkerContext, in as OutputTargetDocsAgentSkill, it as CompilerSystemCreateDirectoryResults, j as BuildResultsComponentGraph, jn as ResolveModuleOptions, jt as HydrateDocumentOptions, k as BuildOutput, kn as ResolveModuleIdOptions, kr as FsWriteResults, kt as HmrStyleUpdate, l as ComponentCompilerProperty, ln as OutputTargetDocsVscode, lr as UserBuildConditionals, lt as CompilerSystemRenameResults, m as LazyBundlesRuntimeData, mn as OutputTargetStandalone, mr as JsonDocsCustomState, mt as ConfigBundle, nn as OutputTargetCustom, nt as CompilerSystem, o as ComponentCompilerListener, on as OutputTargetDocsCustomElementsManifest, ot as CompilerSystemRemoveDirectoryOptions, pn as OutputTargetSsrWasm, pr as JsonDocsComponent, pt as Config, q as CompilerEventFileUpdate, qn as TranspileOptions, qt as OptimizeJsInput, r as CompilerCtx, rn as OutputTargetDistLazy, rt as CompilerSystemCreateDirectoryOptions, s as ComponentCompilerMeta, sn as OutputTargetDocsJson, st as CompilerSystemRemoveDirectoryResults, t as BuildCtx, tn as OutputTargetCopy, tt as CompilerRequestResponse, u as ComponentCompilerState, un as OutputTargetGlobalStyle, ut as CompilerSystemRenamedPath, vn as PageReloadStrategy, vr as JsonDocsMethod, vt as Credentials, w as BuildEvents, wn as PrerenderConfig, wr as JsonDocsTag, wt as Diagnostic, x as WorkerMsgHandler, xn as Plugin, xr as JsonDocsProp, xt as DevServer, yn as ParsedPath, yr as JsonDocsMethodReturn, yt as CustomElementsExportBehavior, z as CompilerEventBuildFinish, zn as SsrDocumentOptions, zt as LogLevel } from "../index-m_QF4nMv.mjs";
2
2
  import ts from "typescript";
3
3
  import { Plugin as Plugin$1 } from "rolldown";
4
4
  //#region src/version.d.ts
@@ -1,3 +1,3 @@
1
- import { A as version, C as hasStencilHydrateImport, D as parseCssOnlyComponents, E as replaceStencilHydrateImport, M as scopeCss, O as buildId, S as hasStencilGlobalsImport, T as replaceStencilGlobalsImport, _ as cmpMetaToDocsComponent, a as createPrerenderer, b as buildHydrateCss, c as createWorkerContext, d as nodeRequire, f as optimizeCss, g as generateManifest, h as generateComponentTypesFile, i as createSystem, j as versions, k as vermoji, l as createWorkerMessageHandler, m as validateHydrated, n as transpile, o as loadConfig, p as validateConfig, r as transpileSync, s as createCompiler, t as ts, u as optimizeJs, v as getScopeId, w as replaceStencilCssComponentsImport, x as hasStencilCssComponentsImport, y as foldBuildFlags } from "../compiler-6RhuOkQ0.mjs";
2
- import { a as LOG_LEVELS, i as CustomElementsExportBehaviorOptions } from "../node-CvPPhnWO.mjs";
1
+ import { A as version, C as hasStencilHydrateImport, D as parseCssOnlyComponents, E as replaceStencilHydrateImport, M as scopeCss, O as buildId, S as hasStencilGlobalsImport, T as replaceStencilGlobalsImport, _ as cmpMetaToDocsComponent, a as createPrerenderer, b as buildHydrateCss, c as createWorkerContext, d as nodeRequire, f as optimizeCss, g as generateManifest, h as generateComponentTypesFile, i as createSystem, j as versions, k as vermoji, l as createWorkerMessageHandler, m as validateHydrated, n as transpile, o as loadConfig, p as validateConfig, r as transpileSync, s as createCompiler, t as ts, u as optimizeJs, v as getScopeId, w as replaceStencilCssComponentsImport, x as hasStencilCssComponentsImport, y as foldBuildFlags } from "../compiler-BZEeAANv.mjs";
2
+ import { a as LOG_LEVELS, i as CustomElementsExportBehaviorOptions } from "../node-D-21Ykxi.mjs";
3
3
  export { CustomElementsExportBehaviorOptions, LOG_LEVELS, buildHydrateCss, buildId, cmpMetaToDocsComponent, createCompiler, createPrerenderer, createSystem, createWorkerContext, createWorkerMessageHandler, foldBuildFlags, generateComponentTypesFile, generateManifest, getScopeId, hasStencilCssComponentsImport, hasStencilGlobalsImport, hasStencilHydrateImport, loadConfig, nodeRequire, optimizeCss, optimizeJs, parseCssOnlyComponents, replaceStencilCssComponentsImport, replaceStencilGlobalsImport, replaceStencilHydrateImport, scopeCss, transpile, transpileSync, ts, validateConfig, validateHydrated, vermoji, version, versions };
@@ -1,4 +1,4 @@
1
- import { $i as CUSTOM, $r as filterActiveTargets, Ai as buildWarn, Ar as ModeValidationError, Bi as loadTypeScriptDiagnostics, Br as isJsFile, Ca as TYPES, Ci as isOutputTargetWww, Da as XLINK_NS, Di as TASK_CANCELED_MSG, Ea as WWW, Ei as shouldExcludeComponent, Fi as escapeHtml, Fr as createJsVarName, Gi as formatLazyBundleRuntimeMeta, Gr as readOnlyArrayHasStringMember, Hi as isRolldownError, Hr as isTsFile, Ii as normalizeDiagnostics, Ir as generatePreamble, Ji as CMP_FLAGS, Jr as getSourceMappingUrlForEndOfFile, Ki as stringifyRuntimeData, Kr as readPackageJson, Li as splitLineBreaks, Lr as getTextDocs, Mi as hasError, Mr as validateComponentTag, Ni as hasWarning, Nr as ParsePackageJsonResult, Oi as buildError, Pi as shouldIgnoreError, Pr as addDocBlock, Qi as COPY, Qr as FilterComponentsResult, Ri as augmentDiagnosticWithNode, Rr as hasDependency, Sa as SVG_NS, Si as isOutputTargetTypes, Ta as WATCH_FLAGS, Ti as relativeImport, Ui as loadRolldownDiagnostics, Ur as isTsxFile, Vi as createOnWarnFn, Vr as isJsxFile, Wi as formatComponentRuntimeMeta, Wr as parsePackageJson, Xi as COLLECTION_APP_DATA_FILE_NAME, Xr as rolldownToStencilSourceMap, Yi as COLLECTION, Yr as getSourceMappingUrlLinker, Zi as COLLECTION_MANIFEST_FILE_NAME, Zr as result_d_exports, _a as SSR, _i as isOutputTargetLoaderBundle, aa as DOCS_JSON, ai as isOutputTargetCollection, ba as STATS, bi as isOutputTargetStandalone, ca as EVENT_FLAGS, ci as isOutputTargetDistLazy, da as HOST_FLAGS, di as isOutputTargetDocsCustom, ea as DEFAULT_STYLE_MODE, ei as filterExcludedComponents, fa as HTML_NS, fi as isOutputTargetDocsCustomElementsManifest, ga as NODE_TYPES, gi as isOutputTargetGlobalStyle, ha as MEMBER_FLAGS, hi as isOutputTargetDocsVscode, ia as DOCS_CUSTOM_ELEMENTS_MANIFEST, ii as isOutputTargetAssets, ji as catchError, jr as validateComponentModes, ki as buildJsonFileError, la as GENERATED_DTS, li as isOutputTargetDocs, ma as LOADER_BUNDLE, mi as isOutputTargetDocsReadme, na as DOCS_AGENT_SKILL, ni as getComponentsDtsTypesFilePath, oa as DOCS_README, oi as isOutputTargetCopy, pa as LISTENER_FLAGS, pi as isOutputTargetDocsJson, qi as ASSETS, qr as getInlineSourceMappingUrlLinker, ra as DOCS_CUSTOM, ri as getComponentsFromModules, sa as DOCS_VSCODE, si as isOutputTargetCustom, ta as DIST_LAZY, ti as getComponentsDtsSrcFilePath, ua as GLOBAL_STYLE, ui as isOutputTargetDocsAgentSkill, va as SSR_WASM, vi as isOutputTargetSsr, wa as VALID_CONFIG_OUTPUT_TARGETS, wi as isValidConfigOutputTarget, xa as STYLE_EXT, xi as isOutputTargetStats, ya as STANDALONE, yi as isOutputTargetSsrWasm, zi as loadTypeScriptDiagnostic, zr as isDtsFile } from "../../index-BogZpjP2.mjs";
1
+ import { $i as CUSTOM, $r as filterActiveTargets, Ai as buildWarn, Ar as ModeValidationError, Bi as loadTypeScriptDiagnostics, Br as isJsFile, Ca as TYPES, Ci as isOutputTargetWww, Da as XLINK_NS, Di as TASK_CANCELED_MSG, Ea as WWW, Ei as shouldExcludeComponent, Fi as escapeHtml, Fr as createJsVarName, Gi as formatLazyBundleRuntimeMeta, Gr as readOnlyArrayHasStringMember, Hi as isRolldownError, Hr as isTsFile, Ii as normalizeDiagnostics, Ir as generatePreamble, Ji as CMP_FLAGS, Jr as getSourceMappingUrlForEndOfFile, Ki as stringifyRuntimeData, Kr as readPackageJson, Li as splitLineBreaks, Lr as getTextDocs, Mi as hasError, Mr as validateComponentTag, Ni as hasWarning, Nr as ParsePackageJsonResult, Oi as buildError, Pi as shouldIgnoreError, Pr as addDocBlock, Qi as COPY, Qr as FilterComponentsResult, Ri as augmentDiagnosticWithNode, Rr as hasDependency, Sa as SVG_NS, Si as isOutputTargetTypes, Ta as WATCH_FLAGS, Ti as relativeImport, Ui as loadRolldownDiagnostics, Ur as isTsxFile, Vi as createOnWarnFn, Vr as isJsxFile, Wi as formatComponentRuntimeMeta, Wr as parsePackageJson, Xi as COLLECTION_APP_DATA_FILE_NAME, Xr as rolldownToStencilSourceMap, Yi as COLLECTION, Yr as getSourceMappingUrlLinker, Zi as COLLECTION_MANIFEST_FILE_NAME, Zr as result_d_exports, _a as SSR, _i as isOutputTargetLoaderBundle, aa as DOCS_JSON, ai as isOutputTargetCollection, ba as STATS, bi as isOutputTargetStandalone, ca as EVENT_FLAGS, ci as isOutputTargetDistLazy, da as HOST_FLAGS, di as isOutputTargetDocsCustom, ea as DEFAULT_STYLE_MODE, ei as filterExcludedComponents, fa as HTML_NS, fi as isOutputTargetDocsCustomElementsManifest, ga as NODE_TYPES, gi as isOutputTargetGlobalStyle, ha as MEMBER_FLAGS, hi as isOutputTargetDocsVscode, ia as DOCS_CUSTOM_ELEMENTS_MANIFEST, ii as isOutputTargetAssets, ji as catchError, jr as validateComponentModes, ki as buildJsonFileError, la as GENERATED_DTS, li as isOutputTargetDocs, ma as LOADER_BUNDLE, mi as isOutputTargetDocsReadme, na as DOCS_AGENT_SKILL, ni as getComponentsDtsTypesFilePath, oa as DOCS_README, oi as isOutputTargetCopy, pa as LISTENER_FLAGS, pi as isOutputTargetDocsJson, qi as ASSETS, qr as getInlineSourceMappingUrlLinker, ra as DOCS_CUSTOM, ri as getComponentsFromModules, sa as DOCS_VSCODE, si as isOutputTargetCustom, ta as DIST_LAZY, ti as getComponentsDtsSrcFilePath, ua as GLOBAL_STYLE, ui as isOutputTargetDocsAgentSkill, va as SSR_WASM, vi as isOutputTargetSsr, wa as VALID_CONFIG_OUTPUT_TARGETS, wi as isValidConfigOutputTarget, xa as STYLE_EXT, xi as isOutputTargetStats, ya as STANDALONE, yi as isOutputTargetSsrWasm, zi as loadTypeScriptDiagnostic, zr as isDtsFile } from "../../index-m_QF4nMv.mjs";
2
2
  //#region src/utils/byte-size.d.ts
3
3
  /**
4
4
  * Used to learn the size of a string in bytes.
@@ -1,9 +1,9 @@
1
1
  import { n as __require } from "./rolldown-runtime-BhDjJH2R.mjs";
2
- import { E as SERVER_BUILD_FLAGS, T as HYDRATED_CSS, w as CLIENT_BUILD_FLAGS } from "./client-BYvfR_Hx.mjs";
2
+ import { E as SERVER_BUILD_FLAGS, T as HYDRATED_CSS, w as CLIENT_BUILD_FLAGS } from "./client-DIvBaMnB.mjs";
3
3
  import { $ as VALID_CONFIG_OUTPUT_TARGETS, A as DIST_LAZY, D as COPY, E as COLLECTION_MANIFEST_FILE_NAME, J as STANDALONE, L as EVENT_FLAGS, P as DOCS_JSON, Q as TYPES, R as GENERATED_DTS, S as ASSETS, T as COLLECTION_APP_DATA_FILE_NAME, U as LOADER_BUNDLE, X as STYLE_EXT, Y as STATS, a as isBoolean$1, b as unique, c as isFunction, d as isObject, et as WATCH_FLAGS, f as isString$1, g as sortBy, i as fromEntries, l as isIterable, m as noop, p as mergeIntoWith, r as flatOne, t as dashToPascalCase, u as isNumber$1, v as toDashCase, w as COLLECTION, y as toTitleCase, z as GLOBAL_STYLE } from "./helpers-Cpp3qc3u.mjs";
4
4
  import { E as escapeRegExpSpecialCharacters, S as formatComponentRuntimeMeta, T as byteSize, _ as loadRolldownDiagnostics, a as getSourceMappingUrlForEndOfFile, b as splitLineBreaks, c as err, f as augmentDiagnosticWithNode, g as isRolldownError, h as createOnWarnFn, i as getInlineSourceMappingUrlLinker, l as map, m as loadTypeScriptDiagnostics, n as validateComponentTag, p as loadTypeScriptDiagnostic, r as isRemoteUrl, s as rolldownToStencilSourceMap, t as validateComponentModes, u as ok, w as stringifyRuntimeData, x as isRootPath, y as normalizeDiagnostics } from "./validation-DAdGTrys.mjs";
5
5
  import { $ as catchError, A as isOutputTargetDocsVscode, B as relativeImport, C as isOutputTargetDistLazy, D as isOutputTargetDocsCustomElementsManifest, E as isOutputTargetDocsCustom, F as isOutputTargetStandalone, G as normalizeFsPathQuery, H as join$2, I as isOutputTargetStats, J as resolve$2, K as normalizePath, L as isOutputTargetTypes, M as isOutputTargetLoaderBundle, N as isOutputTargetSsr, O as isOutputTargetDocsJson, P as isOutputTargetSsrWasm, Q as buildWarn, R as isOutputTargetWww, S as isOutputTargetCustom, T as isOutputTargetDocsAgentSkill, V as shouldExcludeComponent, W as normalizeFsPath, X as buildError, Z as buildJsonFileError, a as hasDependency, b as isOutputTargetCollection, d as parsePackageJson, et as hasError, f as readOnlyArrayHasStringMember, g as getComponentsDtsSrcFilePath, h as filterExcludedComponents, i as getTextDocs, j as isOutputTargetGlobalStyle, k as isOutputTargetDocsReadme, l as isTsFile, m as filterActiveTargets, n as createJsVarName, o as isDtsFile, p as readPackageJson, q as relative$1, r as generatePreamble, rt as isGlob, t as addDocBlock, tt as hasWarning, u as isTsxFile, v as getComponentsFromModules, w as isOutputTargetDocs, x as isOutputTargetCopy, y as isOutputTargetAssets, z as isValidConfigOutputTarget } from "./util-IKfWWLJo.mjs";
6
- import { i as CustomElementsExportBehaviorOptions, o as buildEvents, r as createNodeLogger, t as createNodeSys } from "./node-CvPPhnWO.mjs";
6
+ import { i as CustomElementsExportBehaviorOptions, o as buildEvents, r as createNodeLogger, t as createNodeSys } from "./node-D-21Ykxi.mjs";
7
7
  import ts, { default as ts$1 } from "typescript";
8
8
  import { readFileSync } from "node:fs";
9
9
  import { basename, dirname, isAbsolute, join, resolve } from "node:path";
@@ -461,9 +461,9 @@ const scopeCss = (cssText, scopeId, commentOriginalSelector) => {
461
461
  };
462
462
  //#endregion
463
463
  //#region src/version.ts
464
- const version = "5.0.0-beta.30";
465
- const buildId = "1793793116";
466
- const vermoji = "🏎";
464
+ const version = "5.0.0-beta.32";
465
+ const buildId = "1793824061";
466
+ const vermoji = "🚀";
467
467
  /**
468
468
  * Get the installed version of a tool/dependency.
469
469
  * Handles packages with exports maps that point to subdirectories.
@@ -13817,6 +13817,9 @@ const generateLoaderModule = (components, outputTarget, relativeAssetPath) => {
13817
13817
  const assetPathInit = relativeAssetPath ? `setAssetPath(new URL('${relativeAssetPath}', String(import.meta.url)).href);\n` : "";
13818
13818
  return `
13819
13819
  import { transformTag, getRegistry } from '${STENCIL_INTERNAL_STANDALONE_CLIENT_PLATFORM_ID}';
13820
+ // The same platform setters as the output's index.js. With \`autoStart: false\`, call them before
13821
+ // start() - e.g. setRegistry() for a scoped registry - without importing every component.
13822
+ export { setNonce, setRegistry, setTagTransformer, setPlatformOptions } from '${STENCIL_INTERNAL_STANDALONE_CLIENT_PLATFORM_ID}';
13820
13823
  ${assetPathImport}${assetPathInit}
13821
13824
 
13822
13825
  /**
@@ -13826,9 +13829,9 @@ const tags = [${tagsList}];
13826
13829
 
13827
13830
  /**
13828
13831
  * Maps transformed tag names to original tag names.
13829
- * Built at runtime to account for any tag transformers set via setTagTransformer().
13832
+ * Built in start(), so it accounts for a tag transformer set via setTagTransformer() before then.
13830
13833
  */
13831
- const lookup = Object.fromEntries(tags.map(t => [transformTag(t), t]));
13834
+ let lookup = {};
13832
13835
 
13833
13836
  /**
13834
13837
  * Set of tags that have already been loaded/registered.
@@ -13977,6 +13980,7 @@ ${switchCases}
13977
13980
  export function start(root = document.body) {
13978
13981
  // Capture registry once so all lazy loads in this session use the same one
13979
13982
  reg = getRegistry();
13983
+ lookup = Object.fromEntries(tags.map(t => [transformTag(t), t]));
13980
13984
 
13981
13985
  // Disconnect any existing observer
13982
13986
  if (observer) {
@@ -16107,7 +16111,8 @@ const parseMethodDecorator = (config, diagnostics, tsSourceFile, typeChecker, pr
16107
16111
  const returnTypeNode = typeChecker.typeToTypeNode(returnType, method, ts.NodeBuilderFlags.NoTruncation | ts.NodeBuilderFlags.NoTypeReduction);
16108
16112
  let returnString = typeToString(typeChecker, returnType);
16109
16113
  let signatureString = typeChecker.signatureToString(signature, method, flags, ts.SignatureKind.Call);
16110
- if (!config._isTesting) {
16114
+ const isAsync = !!method.modifiers?.some((m) => m.kind === ts.SyntaxKind.AsyncKeyword);
16115
+ if (!config._isTesting && !isAsync) {
16111
16116
  if (returnString === "void") {
16112
16117
  const warn = buildWarn(diagnostics);
16113
16118
  warn.header = "@Method requires async";
@@ -17893,6 +17898,8 @@ function extractAncestorMeta(ancestor, cmpSourceFile, resolveImport, config) {
17893
17898
  "events",
17894
17899
  "listeners",
17895
17900
  "watchers",
17901
+ "serializers",
17902
+ "deserializers",
17896
17903
  "methods"
17897
17904
  ].includes(m.name.text));
17898
17905
  if (!hasUsableStaticMembers && className) {
@@ -17912,6 +17919,8 @@ function extractAncestorMeta(ancestor, cmpSourceFile, resolveImport, config) {
17912
17919
  events: reanchorInheritedTypeReferences(reclassifyGlobalTypeReferences(parseStaticEvents(resolvedStaticMembers) ?? [], parentSf, resolvedPath, resolveImport), resolvedPath, cmpSourceFile.fileName),
17913
17920
  listeners: parseStaticListeners(resolvedStaticMembers) ?? [],
17914
17921
  watchers: parseStaticWatchers(resolvedStaticMembers) ?? [],
17922
+ serializers: parseStaticSerializers(resolvedStaticMembers, "serializers") ?? [],
17923
+ deserializers: parseStaticSerializers(resolvedStaticMembers, "deserializers") ?? [],
17915
17924
  methodNames: resolvedClassNode.members.filter(ts.isMethodDeclaration).map((m) => ts.isIdentifier(m.name) ? m.name.text : "").filter(Boolean)
17916
17925
  };
17917
17926
  }
@@ -17941,8 +17950,8 @@ function mergeExtendedClassMetaWithResolveImport(cmpNode, staticMembers, sourceF
17941
17950
  let events = parseStaticEvents(staticMembers);
17942
17951
  let watchers = parseStaticWatchers(staticMembers);
17943
17952
  let classMethods = cmpNode.members.filter(ts.isMethodDeclaration).map((m) => ts.isIdentifier(m.name) ? m.name.text : "").filter(Boolean);
17944
- const serializers = [];
17945
- const deserializers = [];
17953
+ let serializers = parseStaticSerializers(staticMembers, "serializers");
17954
+ let deserializers = parseStaticSerializers(staticMembers, "deserializers");
17946
17955
  const ancestors = [];
17947
17956
  resolveAncestors(cmpNode, sourceFile, sourceFile.fileName, resolveImport, /* @__PURE__ */ new Set(), ancestors, cmpNode, buildCtx);
17948
17957
  ancestors.forEach((ancestor) => {
@@ -17956,6 +17965,8 @@ function mergeExtendedClassMetaWithResolveImport(cmpNode, staticMembers, sourceF
17956
17965
  events = [...deDupeMembers(parentMeta.events, events), ...events];
17957
17966
  listeners = [...deDupeMembers(parentMeta.listeners, listeners), ...listeners];
17958
17967
  watchers = [...deDupeMembers(parentMeta.watchers, watchers), ...watchers];
17968
+ serializers = [...deDupeMembers(parentMeta.serializers ?? [], serializers), ...serializers];
17969
+ deserializers = [...deDupeMembers(parentMeta.deserializers ?? [], deserializers), ...deserializers];
17959
17970
  classMethods = [...classMethods, ...parentMeta.methodNames];
17960
17971
  });
17961
17972
  return {
@@ -19172,11 +19183,19 @@ const validateTypesAfterGeneration = async (config, compilerCtx, buildCtx, tsBui
19172
19183
  const fileName = normalizePath(sf.fileName);
19173
19184
  return !fileName.includes("node_modules") && !fileName.endsWith(".d.ts") && fileName.startsWith(normalizePath(config.srcDir));
19174
19185
  });
19186
+ const semanticDiagnostics = [];
19175
19187
  for (const sourceFile of sourceFiles) {
19176
19188
  const tsSemantic = loadTypeScriptDiagnostics(tsProgram.getSemanticDiagnostics(sourceFile));
19177
19189
  applyDevModeRelaxation(config, tsSemantic);
19178
- buildCtx.diagnostics.push(...tsSemantic);
19190
+ semanticDiagnostics.push(...tsSemantic);
19191
+ }
19192
+ if (semanticDiagnostics.some((diagnostic) => diagnostic.level === "error")) {
19193
+ if (await generateAppTypes(config, compilerCtx, buildCtx, "src")) return {
19194
+ hasTypesChanged: true,
19195
+ needsRebuild: true
19196
+ };
19179
19197
  }
19198
+ buildCtx.diagnostics.push(...semanticDiagnostics);
19180
19199
  }
19181
19200
  const hasTypesChanged = await generateAppTypes(config, compilerCtx, buildCtx, "src");
19182
19201
  if (typesOutputTarget.length > 0) {
@@ -2351,7 +2351,8 @@ interface DevServerConfig extends StencilDevServerConfig {
2351
2351
  * reloading updates.
2352
2352
  */
2353
2353
  excludeHmr?: string[];
2354
- historyApiFallback?: HistoryApiFallback;
2354
+ /** Serve `index` for page requests that match no file (single-page app routes). `null` turns it off. */
2355
+ historyApiFallback?: HistoryApiFallback | null;
2355
2356
  openBrowser?: boolean;
2356
2357
  prerenderConfig?: string;
2357
2358
  protocol?: 'http' | 'https';
@@ -2069,6 +2069,8 @@ interface JSXAttributes<T = globalThis.Element> {
2069
2069
  key?: string | number;
2070
2070
  ref?: (elm?: T) => void;
2071
2071
  children?: any;
2072
+ [key: `attr:${string}`]: any;
2073
+ [key: `prop:${string}`]: any;
2072
2074
  }
2073
2075
  interface CustomElementsDefineOptions {
2074
2076
  exclude?: string[];
@@ -1336,6 +1336,8 @@ interface JSXAttributes<T = globalThis.Element> {
1336
1336
  key?: string | number;
1337
1337
  ref?: (elm?: T) => void;
1338
1338
  children?: any;
1339
+ [key: `attr:${string}`]: any;
1340
+ [key: `prop:${string}`]: any;
1339
1341
  }
1340
1342
  interface CustomElementsDefineOptions {
1341
1343
  exclude?: string[];
@@ -1,4 +1,4 @@
1
- import { ar as RafCallback, cr as TagTransformer, lr as UserBuildConditionals, n as ChildType, nr as ErrorHandler, p as HostElement, rr as FunctionalComponent, sr as ResolutionHandler, ur as VNode, v as PropsType, y as RuntimeRef } from "./index-BogZpjP2.mjs";
1
+ import { ar as RafCallback, cr as TagTransformer, lr as UserBuildConditionals, n as ChildType, nr as ErrorHandler, p as HostElement, rr as FunctionalComponent, sr as ResolutionHandler, ur as VNode, v as PropsType, y as RuntimeRef } from "./index-m_QF4nMv.mjs";
2
2
  //#region src/client/client-build.d.ts
3
3
  /**
4
4
  * `isDev` / `isTesting` are getters, not copies: the transpile path (e.g. `@stencil/unplugin`)
@@ -2391,7 +2391,8 @@ interface DevServerConfig extends StencilDevServerConfig {
2391
2391
  * reloading updates.
2392
2392
  */
2393
2393
  excludeHmr?: string[];
2394
- historyApiFallback?: HistoryApiFallback;
2394
+ /** Serve `index` for page requests that match no file (single-page app routes). `null` turns it off. */
2395
+ historyApiFallback?: HistoryApiFallback | null;
2395
2396
  openBrowser?: boolean;
2396
2397
  prerenderConfig?: string;
2397
2398
  protocol?: 'http' | 'https';
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { C as Build, S as setErrorHandler, _ as getAssetPath, a as transformTag, b as writeTask, c as Mixin, d as Host, f as h, g as getShadowRoot, h as getElement, i as setTagTransformer, l as getMode, m as getRenderingRef, o as render, p as forceUpdate, s as ReactiveControllerHost, u as setMode, v as setAssetPath, x as setPlatformHelpers, y as readTask } from "./client-BYvfR_Hx.mjs";
1
+ import { C as Build, S as setErrorHandler, _ as getAssetPath, a as transformTag, b as writeTask, c as Mixin, d as Host, f as h, g as getShadowRoot, h as getElement, i as setTagTransformer, l as getMode, m as getRenderingRef, o as render, p as forceUpdate, s as ReactiveControllerHost, u as setMode, v as setAssetPath, x as setPlatformHelpers, y as readTask } from "./client-DIvBaMnB.mjs";
2
2
  import { t as Fragment } from "./fragment-Di1hWOC8.mjs";
3
3
  //#region src/client/client-decorators.ts
4
4
  /**
@@ -1,3 +1,3 @@
1
- import { n as jsxDEV, r as jsxs, t as jsx } from "./client-BYvfR_Hx.mjs";
1
+ import { n as jsxDEV, r as jsxs, t as jsx } from "./client-DIvBaMnB.mjs";
2
2
  import { t as Fragment } from "./fragment-Di1hWOC8.mjs";
3
3
  export { Fragment, jsx, jsxDEV, jsxs };
@@ -1,5 +1,5 @@
1
1
  import { n as __require } from "./rolldown-runtime-BhDjJH2R.mjs";
2
- import "./client-BYvfR_Hx.mjs";
2
+ import "./client-DIvBaMnB.mjs";
3
3
  import { c as isFunction, f as isString, m as noop, r as flatOne } from "./helpers-Cpp3qc3u.mjs";
4
4
  import { $ as catchError, K as normalizePath, X as buildError, Y as TASK_CANCELED_MSG, nt as shouldIgnoreError, rt as isGlob } from "./util-IKfWWLJo.mjs";
5
5
  import fs from "node:fs";
@@ -978,6 +978,7 @@ const patchSlotAppendChild = (HostElementPrototype) => {
978
978
  const { slotName, slotNode } = findSlotFromSlottedNode(newChild, this);
979
979
  if (slotNode) {
980
980
  addSlotRelocateNode(newChild, slotNode);
981
+ patchSlottedNode(newChild);
981
982
  const slotChildNodes = getSlotChildSiblings(slotNode, slotName);
982
983
  const appendAfter = slotChildNodes[slotChildNodes.length - 1];
983
984
  const insertedNode = internalCall(internalCall(appendAfter, "parentNode"), "insertBefore")(newChild, appendAfter.nextSibling);
@@ -1000,8 +1001,10 @@ const patchSlotRemoveChild = (ElementPrototype) => {
1000
1001
  ElementPrototype.__removeChild = ElementPrototype.removeChild;
1001
1002
  ElementPrototype.removeChild = function(toRemove) {
1002
1003
  if (toRemove && typeof toRemove["s-sn"] !== "undefined") {
1003
- if (getHostSlotNodes(this.__childNodes || this.childNodes, this.tagName, toRemove["s-sn"]) && toRemove.isConnected) {
1004
- toRemove.remove();
1004
+ const slotNode = getHostSlotNodes(this.__childNodes || this.childNodes, this.tagName, toRemove["s-sn"]);
1005
+ if (slotNode && toRemove.isConnected) {
1006
+ removeSlottedNode(toRemove);
1007
+ if (slotNode[0]) dispatchSlotChangeEvent(slotNode[0]);
1005
1008
  updateFallbackSlotVisibility(this);
1006
1009
  return;
1007
1010
  }
@@ -1024,6 +1027,7 @@ const patchSlotPrepend = (HostElementPrototype) => {
1024
1027
  const slotNode = getHostSlotNodes(internalCall(this, "childNodes"), this.tagName, slotName)[0];
1025
1028
  if (slotNode) {
1026
1029
  addSlotRelocateNode(newChild, slotNode, true);
1030
+ patchSlottedNode(newChild);
1027
1031
  const appendAfter = getSlotChildSiblings(slotNode, slotName)[0];
1028
1032
  const toReturn = internalCall(internalCall(appendAfter, "parentNode"), "insertBefore")(newChild, internalCall(appendAfter, "nextSibling"));
1029
1033
  dispatchSlotChangeEvent(slotNode);
@@ -1099,6 +1103,7 @@ const patchInsertBefore = (HostElementPrototype) => {
1099
1103
  }
1100
1104
  if (slotName === currentChild["s-sn"]) {
1101
1105
  addSlotRelocateNode(newChild, slotNode);
1106
+ patchSlottedNode(newChild);
1102
1107
  internalCall(internalCall(currentChild, "parentNode"), "insertBefore")(newChild, currentChild);
1103
1108
  dispatchSlotChangeEvent(slotNode);
1104
1109
  }
@@ -1177,10 +1182,21 @@ const patchChildSlotNodes = (elm) => {
1177
1182
  } });
1178
1183
  };
1179
1184
  /**
1180
- * Patches sibling accessors of a 'slotted' node within a non-shadow component.
1181
- * Meaning whilst stepping through a non-shadow element's nodes, only the mock 'lightDOM' nodes are returned.
1182
- * Especially relevant when rendering components via SSR... Frameworks will often try to reconcile their
1183
- * VDOM with the real DOM by stepping through nodes with 'nextSibling' et al.
1185
+ * Patches a node slotted into a non-shadow component so it behaves as it would in a native slot:
1186
+ * - `parentNode` returns the host element
1187
+ * - `remove()` fires `slotchange` on the node's slot
1188
+ *
1189
+ * @param node the slotted node to be patched
1190
+ */
1191
+ const patchSlottedNode = (node) => {
1192
+ patchParentNode(node);
1193
+ patchSlottedRemove(node);
1194
+ };
1195
+ /**
1196
+ * Patches a slotted node from SSR markup: everything {@link patchSlottedNode} does, plus its
1197
+ * sibling accessors, so whilst stepping through a non-shadow element's nodes only the mock
1198
+ * 'lightDOM' nodes are returned. Frameworks hydrating SSR output often reconcile their VDOM with
1199
+ * the real DOM by stepping through nodes with 'nextSibling' et al.
1184
1200
  * - `nextSibling`
1185
1201
  * - `nextElementSibling`
1186
1202
  * - `previousSibling`
@@ -1188,11 +1204,11 @@ const patchChildSlotNodes = (elm) => {
1188
1204
  *
1189
1205
  * @param node the slotted node to be patched
1190
1206
  */
1191
- const patchSlottedNode = (node) => {
1207
+ const patchSsrSlottedNode = (node) => {
1192
1208
  if (!node || node.__nextSibling !== void 0 || !globalThis.Node) return;
1193
1209
  patchNextSibling(node);
1194
1210
  patchPreviousSibling(node);
1195
- patchParentNode(node);
1211
+ patchSlottedNode(node);
1196
1212
  if (node.nodeType === Node.ELEMENT_NODE) {
1197
1213
  patchNextElementSibling(node);
1198
1214
  patchPreviousElementSibling(node);
@@ -1259,6 +1275,39 @@ const patchPreviousElementSibling = (element) => {
1259
1275
  } });
1260
1276
  };
1261
1277
  /**
1278
+ * Detaches a slotted node from where it physically sits in the component's rendered DOM, through
1279
+ * the unpatched accessors. Not via `remove()`: mock-doc's `remove()` calls
1280
+ * `parentNode.removeChild()`, and a slotted node's patched `parentNode` is the host, whose patched
1281
+ * `removeChild()` would come straight back here.
1282
+ *
1283
+ * @param node the slotted node to detach
1284
+ */
1285
+ const removeSlottedNode = (node) => {
1286
+ const parent = internalCall(node, "parentNode");
1287
+ if (parent) internalCall(parent, "removeChild")(node);
1288
+ };
1289
+ /**
1290
+ * Patches `remove()` on a node slotted into a non-shadow component, so that removing it fires
1291
+ * `slotchange` on its slot (and updates fallback content), as removing a node from a native slot
1292
+ * does. Stencil's own node moves, while `isTmpDisconnected` is set, don't fire it.
1293
+ *
1294
+ * @param node the slotted node to patch
1295
+ */
1296
+ const patchSlottedRemove = (node) => {
1297
+ const child = node;
1298
+ if (!child || child.__remove || typeof child.remove !== "function") return;
1299
+ child.__remove = child.remove;
1300
+ child.remove = function() {
1301
+ const host = this["s-ol"]?.parentElement;
1302
+ const { slotNode } = findSlotFromSlottedNode(this);
1303
+ removeSlottedNode(this);
1304
+ if (slotNode && !(plt.$flags$ & PLATFORM_FLAGS.isTmpDisconnected)) {
1305
+ dispatchSlotChangeEvent(slotNode);
1306
+ updateFallbackSlotVisibility(host);
1307
+ }
1308
+ };
1309
+ };
1310
+ /**
1262
1311
  * Patches the `parentNode` accessor of a non-shadow slotted node
1263
1312
  *
1264
1313
  * @param node the slotted node to be patched
@@ -1997,6 +2046,7 @@ let isSvgMode = false;
1997
2046
  * These ensure that ref callbacks are called in the correct order:
1998
2047
  * first all removal callbacks (with null), then all attachment callbacks (with elements).
1999
2048
  */
2049
+ const initialSlotChanges = /* @__PURE__ */ new Set();
2000
2050
  const refCallbacksToRemove = [];
2001
2051
  const refCallbacksToAttach = [];
2002
2052
  /** Disposers for signal subscriptions on individual DOM nodes (text nodes, <s-show> wrappers). */
@@ -2551,10 +2601,13 @@ const insertBefore = (parent, newNode, reference, isInitialLoad) => {
2551
2601
  if (BUILD.scoped && typeof newNode["s-sn"] === "string" && !!newNode["s-sr"] && !!newNode["s-cr"]) addRemoveSlotScopedClass(newNode["s-cr"], newNode, parent, newNode.parentElement);
2552
2602
  else if (typeof newNode["s-sn"] === "string") {
2553
2603
  const hostElm = newNode["s-hn"] && parent.closest?.(newNode["s-hn"]);
2554
- if ((BUILD.lightDomPatches || BUILD.slotChildNodes || BUILD.patchAll && !!(hostElm && getHostRef(hostElm)?.$cmpMeta$.$flags$ & CMP_FLAGS.patchAll)) && parent.getRootNode().nodeType !== NODE_TYPES.DOCUMENT_FRAGMENT_NODE) patchParentNode(newNode);
2604
+ if ((BUILD.lightDomPatches || BUILD.slotChildNodes || BUILD.patchAll && !!(hostElm && getHostRef(hostElm)?.$cmpMeta$.$flags$ & CMP_FLAGS.patchAll)) && parent.getRootNode().nodeType !== NODE_TYPES.DOCUMENT_FRAGMENT_NODE) patchSlottedNode(newNode);
2555
2605
  parent.insertBefore(newNode, reference);
2556
2606
  const { slotNode } = findSlotFromSlottedNode(newNode);
2557
- if (slotNode && !isInitialLoad) dispatchSlotChangeEvent(slotNode);
2607
+ if (slotNode) {
2608
+ if (isInitialLoad) initialSlotChanges.add(slotNode);
2609
+ else dispatchSlotChangeEvent(slotNode);
2610
+ }
2558
2611
  return newNode;
2559
2612
  }
2560
2613
  }
@@ -2710,6 +2763,11 @@ render() {
2710
2763
  if (checkSlotFallbackVisibility) updateFallbackSlotVisibility(rootVnode.$elm$);
2711
2764
  plt.$flags$ &= ~PLATFORM_FLAGS.isTmpDisconnected;
2712
2765
  relocateNodes.length = 0;
2766
+ if (initialSlotChanges.size) {
2767
+ const slotNodes = [...initialSlotChanges];
2768
+ initialSlotChanges.clear();
2769
+ nextTick(() => slotNodes.forEach(dispatchSlotChangeEvent));
2770
+ }
2713
2771
  }
2714
2772
  if (BUILD.slotRelocation && !useNativeShadowDom && !(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) && hostElm["s-cr"]) {
2715
2773
  const children = rootVnode.$elm$.__childNodes || rootVnode.$elm$.childNodes;
@@ -3462,7 +3520,7 @@ const initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
3462
3520
  }
3463
3521
  addSlotRelocateNode(siNode, siSlot, false, siNode["s-oo"] || currentPos);
3464
3522
  if (siNode.parentElement?.shadowRoot && siNode["getAttribute"] && siNode.getAttribute("slot")) siNode.removeAttribute("slot");
3465
- if (BUILD.lightDomPatches || BUILD.slotChildNodes || BUILD.patchAll && hostRef.$cmpMeta$.$flags$ & CMP_FLAGS.patchAll) patchSlottedNode(siNode);
3523
+ if (BUILD.lightDomPatches || BUILD.slotChildNodes || BUILD.patchAll && hostRef.$cmpMeta$.$flags$ & CMP_FLAGS.patchAll) patchSsrSlottedNode(siNode);
3466
3524
  }
3467
3525
  currentPos = (siNode["s-oo"] || currentPos) + 1;
3468
3526
  }
@@ -1347,6 +1347,8 @@ interface JSXAttributes<T = globalThis.Element> {
1347
1347
  key?: string | number;
1348
1348
  ref?: (elm?: T) => void;
1349
1349
  children?: any;
1350
+ [key: `attr:${string}`]: any;
1351
+ [key: `prop:${string}`]: any;
1350
1352
  }
1351
1353
  interface CustomElementsDefineOptions {
1352
1354
  exclude?: string[];