You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(runtime): expose ReactiveController and ReactiveControllerHost
Moves ReactiveController interface and ReactiveControllerHost class from
test utilities to @stencil/core runtime, making them publicly available
for component composition patterns.
This enables developers to:
- Create reusable reactive controllers that hook into component lifecycle
- Compose multiple controllers in a single component
- Share stateful logic across components without inheritance
Components extending ReactiveControllerHost can use addController() to
register controllers that automatically receive lifecycle callbacks
(hostConnected, hostDisconnected, hostWillLoad, etc.) and can trigger
updates via requestUpdate().
Known Limitation: Components extending ReactiveControllerHost cannot use
<Host> as their root element since ReactiveControllerHost does not extend
HTMLElement. Components must return regular elements (e.g., <div>) as root.
Changes:
- Add ReactiveController interface to src/runtime/reactive-controller.ts
- Add ReactiveControllerHost class to src/runtime/reactive-controller.ts
- Export from src/runtime/index.ts and src/hydrate/platform/index.ts
- Export from src/internal/stencil-core/index.d.ts for public API
- Add type declarations to src/declarations/stencil-public-runtime.ts
- Update transformer to preserve ReactiveControllerHost in imports
- Update test components to import from @stencil/core
0 commit comments