@hai3/react 0.2.0-alpha.0 → 0.2.0-alpha.2
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.
- package/CLAUDE.md +2 -20
- package/dist/index.cjs +382 -27384
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -106
- package/dist/index.d.ts +5 -106
- package/dist/index.js +275 -27286
- package/dist/index.js.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +1 -30
- package/dist/types.d.ts +1 -30
- package/llms.txt +0 -1
- package/package.json +13 -4
package/dist/types.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types.ts"],"sourcesContent":["/**\n * @hai3/react - Type Definitions\n *\n * Core types for HAI3 React bindings.\n * Provides type-safe hooks and components.\n *\n * Now using real imports from @hai3/framework since packages are built together.\n */\n\nimport type { ReactNode } from 'react';\nimport type {\n HAI3Config,\n HAI3App,\n RootState,\n Language,\n LanguageMetadata,\n MenuItemConfig,\n ScreensetDefinition,\n ScreensetCategory,\n} from '@hai3/framework';\n\n// Re-export imported types for convenience\nexport type { HAI3Config, HAI3App, MenuItemConfig, ScreensetDefinition, ScreensetCategory };\n\n// ============================================================================\n// Type Aliases\n// ============================================================================\n\n// From @hai3/store\ntype Selector<TResult, TState = RootState> = (state: TState) => TResult;\n\n//
|
|
1
|
+
{"version":3,"sources":["../src/types.ts"],"sourcesContent":["/**\n * @hai3/react - Type Definitions\n *\n * Core types for HAI3 React bindings.\n * Provides type-safe hooks and components.\n *\n * Now using real imports from @hai3/framework since packages are built together.\n */\n\nimport type { ReactNode } from 'react';\nimport type {\n HAI3Config,\n HAI3App,\n RootState,\n Language,\n LanguageMetadata,\n MenuItemConfig,\n ScreensetDefinition,\n ScreensetCategory,\n} from '@hai3/framework';\n\n// Re-export imported types for convenience\nexport type { HAI3Config, HAI3App, MenuItemConfig, ScreensetDefinition, ScreensetCategory };\n\n// ============================================================================\n// Type Aliases\n// ============================================================================\n\n// From @hai3/store\ntype Selector<TResult, TState = RootState> = (state: TState) => TResult;\n\n// Language is imported from @hai3/framework\ntype TranslationParams = Record<string, string | number | boolean>;\n\n// ============================================================================\n// HAI3 Provider Props\n// ============================================================================\n\n/**\n * HAI3 Provider Props\n * Props for the main HAI3Provider component.\n *\n * @example\n * ```tsx\n * <HAI3Provider config={{ devMode: true }}>\n * <App />\n * </HAI3Provider>\n * ```\n */\nexport interface HAI3ProviderProps {\n /** Child components */\n children: ReactNode;\n /** HAI3 configuration */\n config?: HAI3Config;\n /** Pre-built HAI3 app instance (optional) */\n app?: HAI3App;\n}\n\n// ============================================================================\n// Hook Return Types\n// ============================================================================\n\n/**\n * useHAI3 Hook Return Type\n * Returns the HAI3 app instance from context.\n */\nexport type UseHAI3Return = HAI3App;\n\n/**\n * useAppSelector Hook\n * Type-safe selector hook for Redux state.\n *\n * @template TResult - The result type of the selector\n */\nexport type UseAppSelector = <TResult>(selector: Selector<TResult>) => TResult;\n\n/**\n * useAppDispatch Hook Return Type\n * Returns the typed dispatch function.\n */\nexport type UseAppDispatchReturn = (action: unknown) => unknown;\n\n/**\n * useTranslation Hook Return Type\n * Translation utilities.\n */\nexport interface UseTranslationReturn {\n /** Translate a key */\n t: (key: string, params?: TranslationParams) => string;\n /** Current language */\n language: Language | null;\n /** Change language */\n setLanguage: (language: Language) => Promise<void>;\n /** Check if current language is RTL */\n isRTL: boolean;\n}\n\n/**\n * useScreenTranslations Hook Return Type\n * Screen-level translation loading state.\n */\nexport interface UseScreenTranslationsReturn {\n /** Whether translations are loaded */\n isLoaded: boolean;\n /** Loading error (if any) */\n error: Error | null;\n}\n\n/**\n * useLanguage Hook Return Type\n * Language selection utilities.\n */\nexport interface UseLanguageReturn {\n /** Current language */\n current: Language | null;\n /** All supported languages */\n supported: LanguageMetadata[];\n /** Change language */\n setLanguage: (language: Language) => Promise<void>;\n /** Check if current language is RTL */\n isRTL: boolean;\n}\n\n/**\n * useTheme Hook Return Type\n * Theme utilities.\n */\nexport interface UseThemeReturn {\n /** Current theme ID */\n currentTheme: string | undefined;\n /** All available themes */\n themes: Array<{ id: string; name: string }>;\n /** Change theme */\n setTheme: (themeId: string) => void;\n}\n\n/**\n * useMenu Hook Return Type\n * Menu state and actions.\n */\nexport interface UseMenuReturn {\n /** Menu items */\n items: MenuItemConfig[];\n /** Whether menu is collapsed */\n collapsed: boolean;\n /** Whether menu is visible */\n visible: boolean;\n /** Toggle menu collapse */\n toggle: () => void;\n /** Set collapsed state */\n setCollapsed: (collapsed: boolean) => void;\n}\n\n/**\n * useScreen Hook Return Type\n * Current screen state.\n */\nexport interface UseScreenReturn {\n /** Active screen ID */\n activeScreen: string | null;\n /** Whether screen is loading */\n isLoading: boolean;\n}\n\n/**\n * useNavigation Hook Return Type\n * Navigation utilities.\n */\nexport interface UseNavigationReturn {\n /** Navigate to a screen */\n navigateToScreen: (screensetId: string, screenId: string) => void;\n /** Navigate to a screenset (uses default screen) */\n navigateToScreenset: (screensetId: string) => void;\n /** Current screenset ID */\n currentScreenset: string | null;\n /** Current screen ID */\n currentScreen: string | null;\n}\n\n/**\n * useScreenset Hook Return Type\n * Current screenset state.\n */\nexport interface UseScreensetReturn {\n /** Current screenset */\n screenset: ScreensetDefinition | undefined;\n /** Current screenset ID */\n screensetId: string | null;\n /** Current category */\n category: ScreensetCategory | null;\n}\n\n/**\n * usePopup Hook Return Type\n * Popup utilities.\n */\nexport interface UsePopupReturn {\n /** Show a popup */\n show: (config: { id: string; title?: string; content?: () => Promise<{ default: React.ComponentType }> }) => void;\n /** Hide current popup */\n hide: () => void;\n /** Hide all popups */\n hideAll: () => void;\n /** Whether any popup is open */\n isOpen: boolean;\n /** Current popup stack */\n stack: Array<{ id: string; title?: string }>;\n}\n\n/**\n * useOverlay Hook Return Type\n * Overlay utilities.\n */\nexport interface UseOverlayReturn {\n /** Show an overlay */\n show: (config: { id: string; content?: () => Promise<{ default: React.ComponentType }> }) => void;\n /** Hide current overlay */\n hide: () => void;\n /** Whether any overlay is open */\n isOpen: boolean;\n}\n\n// ============================================================================\n// App Router Props\n// ============================================================================\n\n/**\n * App Router Props\n * Props for the AppRouter component.\n */\nexport interface AppRouterProps {\n /** Fallback component while loading */\n fallback?: ReactNode;\n /** Error boundary fallback */\n errorFallback?: ReactNode | ((error: Error) => ReactNode);\n}\n\n// ============================================================================\n// Component Types\n// ============================================================================\n\n/**\n * HAI3Provider Component Type\n */\nexport type HAI3ProviderComponent = React.FC<HAI3ProviderProps>;\n\n/**\n * AppRouter Component Type\n */\nexport type AppRouterComponent = React.FC<AppRouterProps>;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
package/dist/types.d.cts
CHANGED
|
@@ -206,31 +206,6 @@ interface AppRouterProps {
|
|
|
206
206
|
/** Error boundary fallback */
|
|
207
207
|
errorFallback?: ReactNode | ((error: Error) => ReactNode);
|
|
208
208
|
}
|
|
209
|
-
/**
|
|
210
|
-
* Text Loader Props
|
|
211
|
-
* Props for TextLoader component that prevents flash of untranslated content.
|
|
212
|
-
*/
|
|
213
|
-
interface TextLoaderProps {
|
|
214
|
-
/** Child content to render when translations are loaded */
|
|
215
|
-
children: ReactNode;
|
|
216
|
-
/** Fallback while loading (alternative to skeleton) */
|
|
217
|
-
fallback?: ReactNode;
|
|
218
|
-
/**
|
|
219
|
-
* Optional className for the skeleton loader
|
|
220
|
-
* Use this to match the expected size of the text
|
|
221
|
-
* @example "h-8 w-48" for a heading
|
|
222
|
-
* @example "h-4 w-32" for a button label
|
|
223
|
-
*/
|
|
224
|
-
skeletonClassName?: string;
|
|
225
|
-
/** Optional className for the wrapper div */
|
|
226
|
-
className?: string;
|
|
227
|
-
/**
|
|
228
|
-
* If true, skeleton inherits the text color instead of using bg-muted
|
|
229
|
-
* Use this for buttons, menu items, and colored text
|
|
230
|
-
* @default false
|
|
231
|
-
*/
|
|
232
|
-
inheritColor?: boolean;
|
|
233
|
-
}
|
|
234
209
|
/**
|
|
235
210
|
* HAI3Provider Component Type
|
|
236
211
|
*/
|
|
@@ -239,9 +214,5 @@ type HAI3ProviderComponent = React.FC<HAI3ProviderProps>;
|
|
|
239
214
|
* AppRouter Component Type
|
|
240
215
|
*/
|
|
241
216
|
type AppRouterComponent = React.FC<AppRouterProps>;
|
|
242
|
-
/**
|
|
243
|
-
* TextLoader Component Type
|
|
244
|
-
*/
|
|
245
|
-
type TextLoaderComponent = React.FC<TextLoaderProps>;
|
|
246
217
|
|
|
247
|
-
export type { AppRouterComponent, AppRouterProps, HAI3ProviderComponent, HAI3ProviderProps,
|
|
218
|
+
export type { AppRouterComponent, AppRouterProps, HAI3ProviderComponent, HAI3ProviderProps, UseAppDispatchReturn, UseAppSelector, UseHAI3Return, UseLanguageReturn, UseMenuReturn, UseNavigationReturn, UseOverlayReturn, UsePopupReturn, UseScreenReturn, UseScreenTranslationsReturn, UseScreensetReturn, UseThemeReturn, UseTranslationReturn };
|
package/dist/types.d.ts
CHANGED
|
@@ -206,31 +206,6 @@ interface AppRouterProps {
|
|
|
206
206
|
/** Error boundary fallback */
|
|
207
207
|
errorFallback?: ReactNode | ((error: Error) => ReactNode);
|
|
208
208
|
}
|
|
209
|
-
/**
|
|
210
|
-
* Text Loader Props
|
|
211
|
-
* Props for TextLoader component that prevents flash of untranslated content.
|
|
212
|
-
*/
|
|
213
|
-
interface TextLoaderProps {
|
|
214
|
-
/** Child content to render when translations are loaded */
|
|
215
|
-
children: ReactNode;
|
|
216
|
-
/** Fallback while loading (alternative to skeleton) */
|
|
217
|
-
fallback?: ReactNode;
|
|
218
|
-
/**
|
|
219
|
-
* Optional className for the skeleton loader
|
|
220
|
-
* Use this to match the expected size of the text
|
|
221
|
-
* @example "h-8 w-48" for a heading
|
|
222
|
-
* @example "h-4 w-32" for a button label
|
|
223
|
-
*/
|
|
224
|
-
skeletonClassName?: string;
|
|
225
|
-
/** Optional className for the wrapper div */
|
|
226
|
-
className?: string;
|
|
227
|
-
/**
|
|
228
|
-
* If true, skeleton inherits the text color instead of using bg-muted
|
|
229
|
-
* Use this for buttons, menu items, and colored text
|
|
230
|
-
* @default false
|
|
231
|
-
*/
|
|
232
|
-
inheritColor?: boolean;
|
|
233
|
-
}
|
|
234
209
|
/**
|
|
235
210
|
* HAI3Provider Component Type
|
|
236
211
|
*/
|
|
@@ -239,9 +214,5 @@ type HAI3ProviderComponent = React.FC<HAI3ProviderProps>;
|
|
|
239
214
|
* AppRouter Component Type
|
|
240
215
|
*/
|
|
241
216
|
type AppRouterComponent = React.FC<AppRouterProps>;
|
|
242
|
-
/**
|
|
243
|
-
* TextLoader Component Type
|
|
244
|
-
*/
|
|
245
|
-
type TextLoaderComponent = React.FC<TextLoaderProps>;
|
|
246
217
|
|
|
247
|
-
export type { AppRouterComponent, AppRouterProps, HAI3ProviderComponent, HAI3ProviderProps,
|
|
218
|
+
export type { AppRouterComponent, AppRouterProps, HAI3ProviderComponent, HAI3ProviderProps, UseAppDispatchReturn, UseAppSelector, UseHAI3Return, UseLanguageReturn, UseMenuReturn, UseNavigationReturn, UseOverlayReturn, UsePopupReturn, UseScreenReturn, UseScreenTranslationsReturn, UseScreensetReturn, UseThemeReturn, UseTranslationReturn };
|
package/llms.txt
CHANGED
|
@@ -8,7 +8,6 @@ Part of the HAI3 React Layer (L3) - depends on @hai3/framework. Peer dependency
|
|
|
8
8
|
|
|
9
9
|
- [HAI3Provider](https://hai3.dev/docs/react/provider): Root context provider
|
|
10
10
|
- [AppRouter](https://hai3.dev/docs/react/router): Screen rendering with lazy loading
|
|
11
|
-
- [TextLoader](https://hai3.dev/docs/react/textloader): Prevents flash of untranslated content
|
|
12
11
|
|
|
13
12
|
## Hooks
|
|
14
13
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hai3/react",
|
|
3
|
-
"version": "0.2.0-alpha.
|
|
3
|
+
"version": "0.2.0-alpha.2",
|
|
4
4
|
"description": "React bindings and hooks for HAI3 framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -43,9 +43,18 @@
|
|
|
43
43
|
"react-redux": ">=8.0.0"
|
|
44
44
|
},
|
|
45
45
|
"peerDependenciesMeta": {
|
|
46
|
-
"@hai3/framework": {
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
"@hai3/framework": {
|
|
47
|
+
"optional": false
|
|
48
|
+
},
|
|
49
|
+
"react": {
|
|
50
|
+
"optional": false
|
|
51
|
+
},
|
|
52
|
+
"react-redux": {
|
|
53
|
+
"optional": false
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"publishConfig": {
|
|
57
|
+
"access": "public"
|
|
49
58
|
},
|
|
50
59
|
"keywords": [
|
|
51
60
|
"hai3",
|