/** * Application instance and plugin system for sigx. * * This module provides a renderer-agnostic way to configure and bootstrap * sigx applications with plugins, dependency injection, and lifecycle hooks. */ export type { ComponentInstance, AppConfig, AppLifecycleHooks, AppContext, Plugin, PluginInstallFn, MountFn, UnmountFn, RunWithContextOptions, App } from './app-types.js'; import type { ComponentInstance, AppContext, MountFn, App } from './app-types.js'; import type { JSXElement } from './jsx-runtime.js'; /** * Set the default mount function for the platform. * Called by platform packages on import. * * @example * ```typescript * // In @sigx/runtime-dom * import { setDefaultMount } from '@sigx/runtime-core'; * setDefaultMount(domMount); * ``` */ export declare function setDefaultMount(mountFn: MountFn): void; /** * Get the current default mount function. * @internal */ export declare function getDefaultMount(): MountFn | null; /** * Create an application instance. * * @example * ```tsx * import { defineApp, defineInjectable } from '@sigx/runtime-core'; * * // Define an injectable service * const useApiConfig = defineInjectable(() => ({ baseUrl: 'https://api.example.com' })); * * const app = defineApp(); * * app.use(myPlugin, { option: 'value' }); * * // Provide custom instance at app level * const config = app.defineProvide(useApiConfig); * config.baseUrl = 'https://custom.api.com'; * * app.mount(document.getElementById('app')!); * ``` */ export declare function defineApp(rootComponent: JSXElement): App; /** * Notify all app hooks that a component was created. * Called by the renderer after setup() returns. */ export declare function notifyComponentCreated(context: AppContext | null, instance: ComponentInstance): void; /** * Notify all app hooks that a component was mounted. * Called by the renderer after mount hooks run. */ export declare function notifyComponentMounted(context: AppContext | null, instance: ComponentInstance): void; /** * Notify all app hooks that a component was unmounted. * Called by the renderer before cleanup. */ export declare function notifyComponentUnmounted(context: AppContext | null, instance: ComponentInstance): void; /** * Notify all app hooks that a component updated. * Called by the renderer after re-render. */ export declare function notifyComponentUpdated(context: AppContext | null, instance: ComponentInstance): void; /** * Handle an error in a component. Returns true if the error was handled. * Called by the renderer when an error occurs in setup or render (and by * the DOM event path and the async bubble). * * Order: nearest errorScope (walking the instance parent chain) → plugin * hooks → app `onError`. Scoped recovery is local handling, like DOM event * bubbling — the app layer sees only what escapes every scope. */ export declare function handleComponentError(context: AppContext | null, err: Error, instance: ComponentInstance | null, info: string): boolean; /** * Bubble hook for the async layer: a cell is `'errored'`, `match()` was * given no `error` arm, so the error escalates — nearest `errorScope`, then * the app `onError` handler (both via {@link handleComponentError}). Never * throws: `match()` runs during render, and an unhandled data error must * not take the component down with it. * * `ctx` is the setup-time instance captured by the cell (matching where the * `useData`/`useAction` call lives, regardless of which render reads it). * * @internal */ export declare function reportUnhandledAsyncError(err: Error, ctx: { provides?: Map; parent?: unknown; } | null): boolean; //# sourceMappingURL=app.d.ts.map