@hai3/framework 0.2.0-alpha.0 → 0.2.0-alpha.1

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 +1 @@
1
- {"version":3,"sources":["../src/types.ts"],"sourcesContent":["/**\n * @hai3/framework - Type Definitions\n *\n * Core types for HAI3 framework with plugin architecture.\n * Integrates all SDK packages into a cohesive framework.\n */\n\n// ============================================================================\n// Type Imports from SDK Packages\n// ============================================================================\n\n// From @hai3/state\nimport type {\n HAI3Store as StoreType,\n EffectInitializer,\n} from '@hai3/state';\n\nimport type { Reducer } from '@reduxjs/toolkit';\n\n// From @hai3/screensets\nimport type { ScreensetRegistry } from '@hai3/screensets';\n\n// From @hai3/api\nimport type { ApiRegistry } from '@hai3/api';\n\n// From @hai3/i18n\nimport type { I18nRegistry } from '@hai3/i18n';\n\n// Re-export HAI3Store from @hai3/store for framework consumers\nexport type HAI3Store = StoreType;\n\n// ============================================================================\n// HAI3 Configuration\n// ============================================================================\n\n/**\n * HAI3 Application Configuration\n * Configuration options for creating a HAI3 application.\n */\nexport interface HAI3Config {\n /** Application name */\n name?: string;\n /** Enable development mode */\n devMode?: boolean;\n /** Enable strict mode (throws on errors) */\n strictMode?: boolean;\n /**\n * Auto-navigate to first screenset on mount.\n * When false, stays on \"/\" until navigateToScreen/navigateToScreenset is called.\n * @default true\n */\n autoNavigate?: boolean;\n}\n\n// ============================================================================\n// Internal Slice Types\n// ============================================================================\n\n/**\n * Registerable Slice Interface\n * Minimal interface for slices that can be registered with the framework.\n * Used for heterogeneous slice collections where different state types are mixed.\n *\n * This is an internal framework type - plugins provide slices matching this structure.\n * The Reducer type uses RTK's default, avoiding explicit `any` in HAI3 code.\n */\nexport interface RegisterableSlice {\n /** Slice name - becomes the state key */\n readonly name: string;\n /** Slice reducer function */\n readonly reducer: Reducer;\n /** Slice action creators (optional for registration) */\n readonly actions?: Record<string, unknown>;\n}\n\n// ============================================================================\n// Plugin System Types\n// ============================================================================\n\n/**\n * HAI3 Actions Interface\n * Central registry of all actions available in the application.\n *\n * Built-in actions are defined here. Consumers can extend this interface\n * via module augmentation to add custom actions:\n *\n * @example\n * ```typescript\n * declare module '@hai3/framework' {\n * interface HAI3Actions {\n * myCustomAction: (payload: MyPayload) => void;\n * }\n * }\n * ```\n *\n * Design: Interface (not type) enables TypeScript declaration merging.\n */\nexport interface HAI3Actions {\n // ==========================================================================\n // Navigation actions (from navigation plugin)\n // ==========================================================================\n navigateToScreen: (payload: NavigateToScreenPayload) => void;\n navigateToScreenset: (payload: NavigateToScreensetPayload) => void;\n\n // ==========================================================================\n // Theme actions (from themes plugin)\n // ==========================================================================\n changeTheme: (payload: ChangeThemePayload) => void;\n\n // ==========================================================================\n // I18n actions (from i18n plugin)\n // ==========================================================================\n setLanguage: (payload: SetLanguagePayload) => void;\n\n // ==========================================================================\n // Layout actions (from layout plugin)\n // ==========================================================================\n showPopup: (payload: ShowPopupPayload) => void;\n hidePopup: () => void;\n showOverlay: (payload: { id: string }) => void;\n hideOverlay: () => void;\n toggleMenuCollapsed: (payload: { collapsed: boolean }) => void;\n toggleSidebarCollapsed: (payload: { collapsed: boolean }) => void;\n setHeaderVisible: (payload: boolean) => void;\n setFooterVisible: (payload: boolean) => void;\n setMenuCollapsed: (payload: boolean) => void;\n setSidebarCollapsed: (payload: boolean) => void;\n\n // ==========================================================================\n // Screenset actions (from screensets plugin)\n // ==========================================================================\n setActiveScreen: (payload: string) => void;\n setScreenLoading: (payload: boolean) => void;\n}\n\n/**\n * Plugin Provides Interface\n * What a plugin contributes to the application.\n */\nexport interface PluginProvides {\n /** Registry contributions */\n registries?: Record<string, unknown>;\n /** Redux slices to register */\n slices?: RegisterableSlice[];\n /** Effect initializers to register */\n effects?: EffectInitializer[];\n /** Actions provided by the plugin (subset of HAI3Actions) */\n actions?: Partial<HAI3Actions>;\n}\n\n/**\n * Plugin Lifecycle Interface\n * Lifecycle hooks for plugin initialization.\n */\nexport interface PluginLifecycle {\n /**\n * Called when plugin is registered (before app starts).\n *\n * @param app - The app builder instance\n * @param config - Plugin configuration\n */\n onRegister?(app: HAI3AppBuilder, config: unknown): void;\n\n /**\n * Called after all plugins registered, before app starts.\n *\n * @param app - The built app instance\n */\n onInit?(app: HAI3App): void | Promise<void>;\n\n /**\n * Called when app is destroyed.\n *\n * @param app - The app instance\n */\n onDestroy?(app: HAI3App): void;\n}\n\n/**\n * HAI3 Plugin Interface\n * All plugins implement this contract.\n * Follows Liskov Substitution Principle - any plugin can be used interchangeably.\n *\n * @template TConfig - Plugin configuration type\n *\n * @example\n * ```typescript\n * const screensetsPlugin: HAI3Plugin = {\n * name: 'screensets',\n * dependencies: [],\n * provides: {\n * registries: { screensetRegistry: createScreensetRegistry() },\n * slices: [screenSlice],\n * },\n * onInit(app) {\n * discoverScreensets(app.screensetRegistry);\n * },\n * };\n * ```\n */\nexport interface HAI3Plugin<TConfig = unknown> extends PluginLifecycle {\n /** Unique plugin identifier */\n name: string;\n\n /** Other plugins this plugin requires */\n dependencies?: string[];\n\n /** What this plugin provides to the app */\n provides?: PluginProvides;\n\n /** Plugin configuration type marker (used for type inference) */\n _configType?: TConfig;\n}\n\n/**\n * Plugin Factory Function\n * Factory function that creates a plugin with optional configuration.\n *\n * @template TConfig - Plugin configuration type\n */\nexport type PluginFactory<TConfig = unknown> = (config?: TConfig) => HAI3Plugin<TConfig>;\n\n// ============================================================================\n// App Builder Interface\n// ============================================================================\n\n/**\n * HAI3 App Builder Interface\n * Fluent builder for composing HAI3 applications with plugins.\n *\n * @example\n * ```typescript\n * const app = createHAI3()\n * .use(screensets())\n * .use(themes())\n * .use(layout())\n * .build();\n * ```\n */\nexport interface HAI3AppBuilder {\n /**\n * Add a plugin to the application.\n *\n * @param plugin - Plugin instance or factory\n * @returns Builder for chaining\n */\n use(plugin: HAI3Plugin | PluginFactory): HAI3AppBuilder;\n\n /**\n * Add multiple plugins at once.\n *\n * @param plugins - Array of plugins or factories\n * @returns Builder for chaining\n */\n useAll(plugins: Array<HAI3Plugin | PluginFactory>): HAI3AppBuilder;\n\n /**\n * Build the application.\n * Resolves dependencies, initializes plugins, and returns the app.\n *\n * @returns The built HAI3 application\n */\n build(): HAI3App;\n}\n\n// ============================================================================\n// Built App Interface\n// ============================================================================\n\n// Re-export ScreensetRegistry from SDK - do NOT duplicate the interface\nexport type { ScreensetRegistry } from '@hai3/screensets';\n\n/**\n * Theme Configuration\n * Configuration for a theme.\n */\nexport interface ThemeConfig {\n /** Theme ID */\n id: string;\n /** Theme name */\n name: string;\n /** CSS custom properties */\n variables: Record<string, string>;\n /** Whether this is the default theme */\n default?: boolean;\n}\n\n/**\n * Legacy Theme type (from @hai3/uikit)\n * Used for backward compatibility with old register(id, theme) pattern.\n * Using 'unknown' as the base type to accept any theme structure.\n */\nexport type LegacyTheme = unknown;\n\n/**\n * Theme apply function type\n * Generic to accept any theme type from UI kit implementations.\n * @internal - uses generic function signature for compatibility with various theme implementations\n */\nexport interface ThemeApplyFn {\n (theme: unknown, themeName?: string): void;\n}\n\n/**\n * Theme Registry Interface\n * Registry for managing themes.\n */\nexport interface ThemeRegistry {\n /**\n * Register a theme.\n * Supports both new API (config only) and legacy API (id + theme).\n *\n * @param configOrId - ThemeConfig or theme ID (for legacy API)\n * @param legacyTheme - Legacy Theme object (optional, for backward compatibility)\n */\n register(configOrId: ThemeConfig | string, legacyTheme?: LegacyTheme): void;\n\n /**\n * Set the apply function (legacy API).\n * @deprecated Use the built-in apply or provide applyFn at construction.\n */\n setApplyFunction(applyFn: ThemeApplyFn): void;\n\n /** Get theme by ID */\n get(id: string): ThemeConfig | undefined;\n /** Get all themes */\n getAll(): ThemeConfig[];\n /** Apply a theme */\n apply(id: string): void;\n /** Get current theme */\n getCurrent(): ThemeConfig | undefined;\n\n /**\n * Subscribe to theme changes.\n * @param callback - Called when theme changes\n * @returns Unsubscribe function\n */\n subscribe(callback: () => void): () => void;\n\n /**\n * Get current version number.\n * Used by React for re-rendering on theme changes.\n */\n getVersion(): number;\n}\n\n/**\n * Route Registry Interface\n * Registry for managing routes (auto-synced from screensets).\n */\nexport interface RouteRegistry {\n /** Check if a screen exists by screenId only (globally unique) */\n hasScreenById(screenId: string): boolean;\n /** Check if a screen exists (legacy, requires both IDs) */\n hasScreen(screensetId: string, screenId: string): boolean;\n /** Get screenset ID for a given screen ID (reverse lookup) */\n getScreensetForScreen(screenId: string): string | undefined;\n /** Get screen loader by screenId only */\n getScreenById(screenId: string): (() => Promise<{ default: React.ComponentType }>) | undefined;\n /** Get screen loader (legacy, requires both IDs) */\n getScreen(screensetId: string, screenId: string): (() => Promise<{ default: React.ComponentType }>) | undefined;\n /** Get all routes */\n getAll(): Array<{ screensetId: string; screenId: string }>;\n}\n\n/**\n * HAI3 App Interface\n * The built application with all features available.\n *\n * @example\n * ```typescript\n * const app = createHAI3App();\n *\n * // Access registries\n * const screensets = app.screensetRegistry.getAll();\n *\n * // Access store\n * const state = app.store.getState();\n *\n * // Access actions\n * app.actions.navigateToScreen({ screensetId: 'demo', screenId: 'home' });\n * ```\n */\nexport interface HAI3App {\n /** Application configuration */\n config: HAI3Config;\n\n /** Redux store */\n store: HAI3Store;\n\n /** Screenset registry */\n screensetRegistry: ScreensetRegistry;\n\n /** Theme registry */\n themeRegistry: ThemeRegistry;\n\n /** Route registry */\n routeRegistry: RouteRegistry;\n\n /** API registry */\n apiRegistry: ApiRegistry;\n\n /** I18n registry */\n i18nRegistry: I18nRegistry;\n\n /** All registered actions (type-safe via HAI3Actions interface) */\n actions: HAI3Actions;\n\n /** Destroy the application and cleanup resources */\n destroy(): void;\n}\n\n// ============================================================================\n// Create HAI3 App Function Signature\n// ============================================================================\n\n/**\n * Create HAI3 App Function Signature\n * Creates a fully configured HAI3 application using the full preset.\n *\n * @param config - Optional configuration\n * @returns The built HAI3 application\n *\n * @example\n * ```typescript\n * // Default - uses full() preset\n * const app = createHAI3App();\n *\n * // With configuration\n * const app = createHAI3App({ devMode: true });\n * ```\n */\nexport type CreateHAI3App = (config?: HAI3Config) => HAI3App;\n\n/**\n * Create HAI3 Function Signature\n * Creates a HAI3 app builder for custom plugin composition.\n *\n * @returns App builder for plugin composition\n *\n * @example\n * ```typescript\n * const app = createHAI3()\n * .use(screensets())\n * .use(themes())\n * .build();\n * ```\n */\nexport type CreateHAI3 = () => HAI3AppBuilder;\n\n// ============================================================================\n// Preset Types\n// ============================================================================\n\n/**\n * Preset Type\n * A preset is a function that returns an array of plugins.\n *\n * @example\n * ```typescript\n * const minimal: Preset = () => [\n * screensets({ autoDiscover: true }),\n * themes(),\n * ];\n * ```\n */\nexport type Preset = () => HAI3Plugin[];\n\n/**\n * Presets Collection\n * Available presets for different use cases.\n */\nexport interface Presets {\n /** All plugins - default for hai3 create */\n full: Preset;\n /** Screensets + themes only */\n minimal: Preset;\n /** Screensets only - for external platform integration */\n headless: Preset;\n}\n\n// ============================================================================\n// Screensets Plugin Config\n// ============================================================================\n\n/**\n * Screensets Plugin Configuration\n * Configuration options for the screensets plugin.\n */\nexport interface ScreensetsConfig {\n /** Auto-discover screensets via glob */\n autoDiscover?: boolean;\n /** Glob pattern for screenset discovery */\n globPattern?: string;\n}\n\n// ============================================================================\n// Navigation Action Payloads\n// ============================================================================\n\n/**\n * Navigate to Screen Payload\n */\nexport interface NavigateToScreenPayload {\n screensetId: string;\n screenId: string;\n}\n\n/**\n * Navigate to Screenset Payload\n */\nexport interface NavigateToScreensetPayload {\n screensetId: string;\n}\n\n/**\n * Show Popup Payload\n */\nexport interface ShowPopupPayload {\n id: string;\n title?: string;\n content?: () => Promise<{ default: React.ComponentType }>;\n size?: 'sm' | 'md' | 'lg' | 'xl' | 'full';\n}\n\n/**\n * Change Theme Payload\n */\nexport interface ChangeThemePayload {\n themeId: string;\n}\n\n/**\n * Set Language Payload\n */\nexport interface SetLanguagePayload {\n language: string;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
1
+ {"version":3,"sources":["../src/types.ts"],"sourcesContent":["/**\n * @hai3/framework - Type Definitions\n *\n * Core types for HAI3 framework with plugin architecture.\n * Integrates all SDK packages into a cohesive framework.\n */\n\n// ============================================================================\n// Type Imports from SDK Packages\n// ============================================================================\n\n// From @hai3/state\nimport type {\n HAI3Store as StoreType,\n EffectInitializer,\n} from '@hai3/state';\n\nimport type { Reducer } from '@reduxjs/toolkit';\n\n// From @hai3/screensets\nimport type { ScreensetRegistry } from '@hai3/screensets';\n\n// From @hai3/api\nimport type { ApiRegistry } from '@hai3/api';\n\n// From @hai3/i18n\nimport type { I18nRegistry } from '@hai3/i18n';\n\n// Re-export HAI3Store from @hai3/store for framework consumers\nexport type HAI3Store = StoreType;\n\n// ============================================================================\n// HAI3 Configuration\n// ============================================================================\n\n/**\n * HAI3 Application Configuration\n * Configuration options for creating a HAI3 application.\n */\nexport interface HAI3Config {\n /** Application name */\n name?: string;\n /** Enable development mode */\n devMode?: boolean;\n /** Enable strict mode (throws on errors) */\n strictMode?: boolean;\n /**\n * Auto-navigate to first screenset on mount.\n * When false, stays on \"/\" until navigateToScreen/navigateToScreenset is called.\n * @default true\n */\n autoNavigate?: boolean;\n /**\n * Base path for navigation. Example: '/console' makes routes /console/*.\n * @default '/'\n */\n base?: string;\n}\n\n// ============================================================================\n// Internal Slice Types\n// ============================================================================\n\n/**\n * Registerable Slice Interface\n * Minimal interface for slices that can be registered with the framework.\n * Used for heterogeneous slice collections where different state types are mixed.\n *\n * This is an internal framework type - plugins provide slices matching this structure.\n * The Reducer type uses RTK's default, avoiding explicit `any` in HAI3 code.\n */\nexport interface RegisterableSlice {\n /** Slice name - becomes the state key */\n readonly name: string;\n /** Slice reducer function */\n readonly reducer: Reducer;\n /** Slice action creators (optional for registration) */\n readonly actions?: Record<string, unknown>;\n}\n\n// ============================================================================\n// Plugin System Types\n// ============================================================================\n\n/**\n * HAI3 Actions Interface\n * Central registry of all actions available in the application.\n *\n * Built-in actions are defined here. Consumers can extend this interface\n * via module augmentation to add custom actions:\n *\n * @example\n * ```typescript\n * declare module '@hai3/framework' {\n * interface HAI3Actions {\n * myCustomAction: (payload: MyPayload) => void;\n * }\n * }\n * ```\n *\n * Design: Interface (not type) enables TypeScript declaration merging.\n */\nexport interface HAI3Actions {\n // ==========================================================================\n // Navigation actions (from navigation plugin)\n // ==========================================================================\n navigateToScreen: (payload: NavigateToScreenPayload) => void;\n navigateToScreenset: (payload: NavigateToScreensetPayload) => void;\n\n // ==========================================================================\n // Theme actions (from themes plugin)\n // ==========================================================================\n changeTheme: (payload: ChangeThemePayload) => void;\n\n // ==========================================================================\n // I18n actions (from i18n plugin)\n // ==========================================================================\n setLanguage: (payload: SetLanguagePayload) => void;\n\n // ==========================================================================\n // Layout actions (from layout plugin)\n // ==========================================================================\n showPopup: (payload: ShowPopupPayload) => void;\n hidePopup: () => void;\n showOverlay: (payload: { id: string }) => void;\n hideOverlay: () => void;\n toggleMenuCollapsed: (payload: { collapsed: boolean }) => void;\n toggleSidebarCollapsed: (payload: { collapsed: boolean }) => void;\n setHeaderVisible: (payload: boolean) => void;\n setFooterVisible: (payload: boolean) => void;\n setMenuCollapsed: (payload: boolean) => void;\n setSidebarCollapsed: (payload: boolean) => void;\n\n // ==========================================================================\n // Screenset actions (from screensets plugin)\n // ==========================================================================\n setActiveScreen: (payload: string) => void;\n setScreenLoading: (payload: boolean) => void;\n}\n\n/**\n * Plugin Provides Interface\n * What a plugin contributes to the application.\n */\nexport interface PluginProvides {\n /** Registry contributions */\n registries?: Record<string, unknown>;\n /** Redux slices to register */\n slices?: RegisterableSlice[];\n /** Effect initializers to register */\n effects?: EffectInitializer[];\n /** Actions provided by the plugin (subset of HAI3Actions) */\n actions?: Partial<HAI3Actions>;\n}\n\n/**\n * Plugin Lifecycle Interface\n * Lifecycle hooks for plugin initialization.\n */\nexport interface PluginLifecycle {\n /**\n * Called when plugin is registered (before app starts).\n *\n * @param app - The app builder instance\n * @param config - Plugin configuration\n */\n onRegister?(app: HAI3AppBuilder, config: unknown): void;\n\n /**\n * Called after all plugins registered, before app starts.\n *\n * @param app - The built app instance\n */\n onInit?(app: HAI3App): void | Promise<void>;\n\n /**\n * Called when app is destroyed.\n *\n * @param app - The app instance\n */\n onDestroy?(app: HAI3App): void;\n}\n\n/**\n * HAI3 Plugin Interface\n * All plugins implement this contract.\n * Follows Liskov Substitution Principle - any plugin can be used interchangeably.\n *\n * @template TConfig - Plugin configuration type\n *\n * @example\n * ```typescript\n * const screensetsPlugin: HAI3Plugin = {\n * name: 'screensets',\n * dependencies: [],\n * provides: {\n * registries: { screensetRegistry: createScreensetRegistry() },\n * slices: [screenSlice],\n * },\n * onInit(app) {\n * discoverScreensets(app.screensetRegistry);\n * },\n * };\n * ```\n */\nexport interface HAI3Plugin<TConfig = unknown> extends PluginLifecycle {\n /** Unique plugin identifier */\n name: string;\n\n /** Other plugins this plugin requires */\n dependencies?: string[];\n\n /** What this plugin provides to the app */\n provides?: PluginProvides;\n\n /** Plugin configuration type marker (used for type inference) */\n _configType?: TConfig;\n}\n\n/**\n * Plugin Factory Function\n * Factory function that creates a plugin with optional configuration.\n *\n * @template TConfig - Plugin configuration type\n */\nexport type PluginFactory<TConfig = unknown> = (config?: TConfig) => HAI3Plugin<TConfig>;\n\n// ============================================================================\n// App Builder Interface\n// ============================================================================\n\n/**\n * HAI3 App Builder Interface\n * Fluent builder for composing HAI3 applications with plugins.\n *\n * @example\n * ```typescript\n * const app = createHAI3()\n * .use(screensets())\n * .use(themes())\n * .use(layout())\n * .build();\n * ```\n */\nexport interface HAI3AppBuilder {\n /**\n * Add a plugin to the application.\n *\n * @param plugin - Plugin instance or factory\n * @returns Builder for chaining\n */\n use(plugin: HAI3Plugin | PluginFactory): HAI3AppBuilder;\n\n /**\n * Add multiple plugins at once.\n *\n * @param plugins - Array of plugins or factories\n * @returns Builder for chaining\n */\n useAll(plugins: Array<HAI3Plugin | PluginFactory>): HAI3AppBuilder;\n\n /**\n * Build the application.\n * Resolves dependencies, initializes plugins, and returns the app.\n *\n * @returns The built HAI3 application\n */\n build(): HAI3App;\n}\n\n// ============================================================================\n// Built App Interface\n// ============================================================================\n\n// Re-export ScreensetRegistry from SDK - do NOT duplicate the interface\nexport type { ScreensetRegistry } from '@hai3/screensets';\n\n/**\n * Theme Configuration\n * Configuration for a theme.\n */\nexport interface ThemeConfig {\n /** Theme ID */\n id: string;\n /** Theme name */\n name: string;\n /** CSS custom properties */\n variables: Record<string, string>;\n /** Whether this is the default theme */\n default?: boolean;\n}\n\n/**\n * Legacy Theme type (from @hai3/uikit)\n * Used for backward compatibility with old register(id, theme) pattern.\n * Using 'unknown' as the base type to accept any theme structure.\n */\nexport type LegacyTheme = unknown;\n\n/**\n * Theme apply function type\n * Generic to accept any theme type from UI kit implementations.\n * @internal - uses generic function signature for compatibility with various theme implementations\n */\nexport interface ThemeApplyFn {\n (theme: unknown, themeName?: string): void;\n}\n\n/**\n * Theme Registry Interface\n * Registry for managing themes.\n */\nexport interface ThemeRegistry {\n /**\n * Register a theme.\n * Supports both new API (config only) and legacy API (id + theme).\n *\n * @param configOrId - ThemeConfig or theme ID (for legacy API)\n * @param legacyTheme - Legacy Theme object (optional, for backward compatibility)\n */\n register(configOrId: ThemeConfig | string, legacyTheme?: LegacyTheme): void;\n\n /**\n * Set the apply function (legacy API).\n * @deprecated Use the built-in apply or provide applyFn at construction.\n */\n setApplyFunction(applyFn: ThemeApplyFn): void;\n\n /** Get theme by ID */\n get(id: string): ThemeConfig | undefined;\n /** Get all themes */\n getAll(): ThemeConfig[];\n /** Apply a theme */\n apply(id: string): void;\n /** Get current theme */\n getCurrent(): ThemeConfig | undefined;\n\n /**\n * Subscribe to theme changes.\n * @param callback - Called when theme changes\n * @returns Unsubscribe function\n */\n subscribe(callback: () => void): () => void;\n\n /**\n * Get current version number.\n * Used by React for re-rendering on theme changes.\n */\n getVersion(): number;\n}\n\n/**\n * Route Registry Interface\n * Registry for managing routes (auto-synced from screensets).\n */\nexport interface RouteRegistry {\n /** Check if a screen exists by screenId only (globally unique) */\n hasScreenById(screenId: string): boolean;\n /** Check if a screen exists (legacy, requires both IDs) */\n hasScreen(screensetId: string, screenId: string): boolean;\n /** Get screenset ID for a given screen ID (reverse lookup) */\n getScreensetForScreen(screenId: string): string | undefined;\n /** Get screen loader by screenId only */\n getScreenById(screenId: string): (() => Promise<{ default: React.ComponentType }>) | undefined;\n /** Get screen loader (legacy, requires both IDs) */\n getScreen(screensetId: string, screenId: string): (() => Promise<{ default: React.ComponentType }>) | undefined;\n /** Get all routes */\n getAll(): Array<{ screensetId: string; screenId: string }>;\n}\n\n/**\n * HAI3 App Interface\n * The built application with all features available.\n *\n * @example\n * ```typescript\n * const app = createHAI3App();\n *\n * // Access registries\n * const screensets = app.screensetRegistry.getAll();\n *\n * // Access store\n * const state = app.store.getState();\n *\n * // Access actions\n * app.actions.navigateToScreen({ screensetId: 'demo', screenId: 'home' });\n * ```\n */\nexport interface HAI3App {\n /** Application configuration */\n config: HAI3Config;\n\n /** Redux store */\n store: HAI3Store;\n\n /** Screenset registry */\n screensetRegistry: ScreensetRegistry;\n\n /** Theme registry */\n themeRegistry: ThemeRegistry;\n\n /** Route registry */\n routeRegistry: RouteRegistry;\n\n /** API registry */\n apiRegistry: ApiRegistry;\n\n /** I18n registry */\n i18nRegistry: I18nRegistry;\n\n /** All registered actions (type-safe via HAI3Actions interface) */\n actions: HAI3Actions;\n\n /** Destroy the application and cleanup resources */\n destroy(): void;\n}\n\n// ============================================================================\n// Create HAI3 App Function Signature\n// ============================================================================\n\n/**\n * Create HAI3 App Function Signature\n * Creates a fully configured HAI3 application using the full preset.\n *\n * @param config - Optional configuration\n * @returns The built HAI3 application\n *\n * @example\n * ```typescript\n * // Default - uses full() preset\n * const app = createHAI3App();\n *\n * // With configuration\n * const app = createHAI3App({ devMode: true });\n * ```\n */\nexport type CreateHAI3App = (config?: HAI3Config) => HAI3App;\n\n/**\n * Create HAI3 Function Signature\n * Creates a HAI3 app builder for custom plugin composition.\n *\n * @returns App builder for plugin composition\n *\n * @example\n * ```typescript\n * const app = createHAI3()\n * .use(screensets())\n * .use(themes())\n * .build();\n * ```\n */\nexport type CreateHAI3 = () => HAI3AppBuilder;\n\n// ============================================================================\n// Preset Types\n// ============================================================================\n\n/**\n * Preset Type\n * A preset is a function that returns an array of plugins.\n *\n * @example\n * ```typescript\n * const minimal: Preset = () => [\n * screensets({ autoDiscover: true }),\n * themes(),\n * ];\n * ```\n */\nexport type Preset = () => HAI3Plugin[];\n\n/**\n * Presets Collection\n * Available presets for different use cases.\n */\nexport interface Presets {\n /** All plugins - default for hai3 create */\n full: Preset;\n /** Screensets + themes only */\n minimal: Preset;\n /** Screensets only - for external platform integration */\n headless: Preset;\n}\n\n// ============================================================================\n// Plugin Configurations\n// ============================================================================\n\n/**\n * Navigation Plugin Configuration\n * Configuration options for the navigation plugin.\n */\nexport interface NavigationConfig {\n /**\n * Base path for navigation. Overrides app.config.base if set.\n */\n base?: string;\n}\n\n/**\n * Screensets Plugin Configuration\n * Configuration options for the screensets plugin.\n */\nexport interface ScreensetsConfig {\n /** Auto-discover screensets via glob */\n autoDiscover?: boolean;\n /** Glob pattern for screenset discovery */\n globPattern?: string;\n}\n\n// ============================================================================\n// Navigation Action Payloads\n// ============================================================================\n\n/**\n * Navigate to Screen Payload\n */\nexport interface NavigateToScreenPayload {\n screensetId: string;\n screenId: string;\n}\n\n/**\n * Navigate to Screenset Payload\n */\nexport interface NavigateToScreensetPayload {\n screensetId: string;\n}\n\n/**\n * Show Popup Payload\n */\nexport interface ShowPopupPayload {\n id: string;\n title?: string;\n content?: () => Promise<{ default: React.ComponentType }>;\n size?: 'sm' | 'md' | 'lg' | 'xl' | 'full';\n}\n\n/**\n * Change Theme Payload\n */\nexport interface ChangeThemePayload {\n themeId: string;\n}\n\n/**\n * Set Language Payload\n */\nexport interface SetLanguagePayload {\n language: string;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
package/dist/types.d.cts CHANGED
@@ -30,6 +30,11 @@ interface HAI3Config {
30
30
  * @default true
31
31
  */
32
32
  autoNavigate?: boolean;
33
+ /**
34
+ * Base path for navigation. Example: '/console' makes routes /console/*.
35
+ * @default '/'
36
+ */
37
+ base?: string;
33
38
  }
34
39
  /**
35
40
  * Registerable Slice Interface
@@ -390,6 +395,16 @@ interface Presets {
390
395
  /** Screensets only - for external platform integration */
391
396
  headless: Preset;
392
397
  }
398
+ /**
399
+ * Navigation Plugin Configuration
400
+ * Configuration options for the navigation plugin.
401
+ */
402
+ interface NavigationConfig {
403
+ /**
404
+ * Base path for navigation. Overrides app.config.base if set.
405
+ */
406
+ base?: string;
407
+ }
393
408
  /**
394
409
  * Screensets Plugin Configuration
395
410
  * Configuration options for the screensets plugin.
@@ -437,4 +452,4 @@ interface SetLanguagePayload {
437
452
  language: string;
438
453
  }
439
454
 
440
- export type { ChangeThemePayload, CreateHAI3, CreateHAI3App, HAI3Actions, HAI3App, HAI3AppBuilder, HAI3Config, HAI3Plugin, HAI3Store, LegacyTheme, NavigateToScreenPayload, NavigateToScreensetPayload, PluginFactory, PluginLifecycle, PluginProvides, Preset, Presets, RegisterableSlice, RouteRegistry, ScreensetsConfig, SetLanguagePayload, ShowPopupPayload, ThemeApplyFn, ThemeConfig, ThemeRegistry };
455
+ export type { ChangeThemePayload, CreateHAI3, CreateHAI3App, HAI3Actions, HAI3App, HAI3AppBuilder, HAI3Config, HAI3Plugin, HAI3Store, LegacyTheme, NavigateToScreenPayload, NavigateToScreensetPayload, NavigationConfig, PluginFactory, PluginLifecycle, PluginProvides, Preset, Presets, RegisterableSlice, RouteRegistry, ScreensetsConfig, SetLanguagePayload, ShowPopupPayload, ThemeApplyFn, ThemeConfig, ThemeRegistry };
package/dist/types.d.ts CHANGED
@@ -30,6 +30,11 @@ interface HAI3Config {
30
30
  * @default true
31
31
  */
32
32
  autoNavigate?: boolean;
33
+ /**
34
+ * Base path for navigation. Example: '/console' makes routes /console/*.
35
+ * @default '/'
36
+ */
37
+ base?: string;
33
38
  }
34
39
  /**
35
40
  * Registerable Slice Interface
@@ -390,6 +395,16 @@ interface Presets {
390
395
  /** Screensets only - for external platform integration */
391
396
  headless: Preset;
392
397
  }
398
+ /**
399
+ * Navigation Plugin Configuration
400
+ * Configuration options for the navigation plugin.
401
+ */
402
+ interface NavigationConfig {
403
+ /**
404
+ * Base path for navigation. Overrides app.config.base if set.
405
+ */
406
+ base?: string;
407
+ }
393
408
  /**
394
409
  * Screensets Plugin Configuration
395
410
  * Configuration options for the screensets plugin.
@@ -437,4 +452,4 @@ interface SetLanguagePayload {
437
452
  language: string;
438
453
  }
439
454
 
440
- export type { ChangeThemePayload, CreateHAI3, CreateHAI3App, HAI3Actions, HAI3App, HAI3AppBuilder, HAI3Config, HAI3Plugin, HAI3Store, LegacyTheme, NavigateToScreenPayload, NavigateToScreensetPayload, PluginFactory, PluginLifecycle, PluginProvides, Preset, Presets, RegisterableSlice, RouteRegistry, ScreensetsConfig, SetLanguagePayload, ShowPopupPayload, ThemeApplyFn, ThemeConfig, ThemeRegistry };
455
+ export type { ChangeThemePayload, CreateHAI3, CreateHAI3App, HAI3Actions, HAI3App, HAI3AppBuilder, HAI3Config, HAI3Plugin, HAI3Store, LegacyTheme, NavigateToScreenPayload, NavigateToScreensetPayload, NavigationConfig, PluginFactory, PluginLifecycle, PluginProvides, Preset, Presets, RegisterableSlice, RouteRegistry, ScreensetsConfig, SetLanguagePayload, ShowPopupPayload, ThemeApplyFn, ThemeConfig, ThemeRegistry };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hai3/framework",
3
- "version": "0.2.0-alpha.0",
3
+ "version": "0.2.0-alpha.1",
4
4
  "description": "HAI3 framework integrating all SDK packages with plugin architecture",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -40,10 +40,18 @@
40
40
  "@hai3/i18n": "*"
41
41
  },
42
42
  "peerDependenciesMeta": {
43
- "@hai3/state": { "optional": false },
44
- "@hai3/screensets": { "optional": false },
45
- "@hai3/api": { "optional": false },
46
- "@hai3/i18n": { "optional": false }
43
+ "@hai3/state": {
44
+ "optional": false
45
+ },
46
+ "@hai3/screensets": {
47
+ "optional": false
48
+ },
49
+ "@hai3/api": {
50
+ "optional": false
51
+ },
52
+ "@hai3/i18n": {
53
+ "optional": false
54
+ }
47
55
  },
48
56
  "keywords": [
49
57
  "hai3",