@alneas/appkit-react 0.1.0 → 0.2.0
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/CHANGELOG.md +53 -0
- package/README.md +85 -15
- package/consumer-ai/SKILL.md +12 -0
- package/consumer-ai/api-index.json +103754 -0
- package/consumer-ai/package-context.json +409 -0
- package/dist/ai/action/ExecutionHistory.cjs.map +1 -1
- package/dist/ai/action/ExecutionHistory.d.cts +32 -2
- package/dist/ai/action/ExecutionHistory.d.ts +32 -2
- package/dist/ai/action/ExecutionHistory.js.map +1 -1
- package/dist/ai/action/ScreenActionContext.cjs.map +1 -1
- package/dist/ai/action/ScreenActionContext.d.cts +15 -2
- package/dist/ai/action/ScreenActionContext.d.ts +15 -2
- package/dist/ai/action/ScreenActionContext.js.map +1 -1
- package/dist/ai/action/context.cjs.map +1 -1
- package/dist/ai/action/context.d.cts +19 -3
- package/dist/ai/action/context.d.ts +19 -3
- package/dist/ai/action/context.js.map +1 -1
- package/dist/ai/action/types.d.cts +35 -3
- package/dist/ai/action/types.d.ts +35 -3
- package/dist/ai/action/use-execution-session.cjs.map +1 -1
- package/dist/ai/action/use-execution-session.d.cts +17 -1
- package/dist/ai/action/use-execution-session.d.ts +17 -1
- package/dist/ai/action/use-execution-session.js.map +1 -1
- package/dist/ai/action/use-screen-action-registry.cjs.map +1 -1
- package/dist/ai/action/use-screen-action-registry.d.cts +77 -8
- package/dist/ai/action/use-screen-action-registry.d.ts +77 -8
- package/dist/ai/action/use-screen-action-registry.js.map +1 -1
- package/dist/ai/action/use-screen-action.cjs.map +1 -1
- package/dist/ai/action/use-screen-action.d.cts +23 -6
- package/dist/ai/action/use-screen-action.d.ts +23 -6
- package/dist/ai/action/use-screen-action.js.map +1 -1
- package/dist/ai/action/use-screen-context.cjs.map +1 -1
- package/dist/ai/action/use-screen-context.d.cts +42 -5
- package/dist/ai/action/use-screen-context.d.ts +42 -5
- package/dist/ai/action/use-screen-context.js.map +1 -1
- package/dist/ai/ai-chat/transport.cjs.map +1 -1
- package/dist/ai/ai-chat/transport.d.cts +35 -8
- package/dist/ai/ai-chat/transport.d.ts +35 -8
- package/dist/ai/ai-chat/transport.js.map +1 -1
- package/dist/ai/generative-ui/GenerativeUIRenderer.cjs.map +1 -1
- package/dist/ai/generative-ui/GenerativeUIRenderer.d.cts +21 -3
- package/dist/ai/generative-ui/GenerativeUIRenderer.d.ts +21 -3
- package/dist/ai/generative-ui/GenerativeUIRenderer.js.map +1 -1
- package/dist/ai/generative-ui/error-boundary.cjs.map +1 -1
- package/dist/ai/generative-ui/error-boundary.d.cts +98 -2
- package/dist/ai/generative-ui/error-boundary.d.ts +98 -2
- package/dist/ai/generative-ui/error-boundary.js.map +1 -1
- package/dist/ai/generative-ui/registry.cjs.map +1 -1
- package/dist/ai/generative-ui/registry.d.cts +96 -7
- package/dist/ai/generative-ui/registry.d.ts +96 -7
- package/dist/ai/generative-ui/registry.js.map +1 -1
- package/dist/ai/proposal/ProposalFieldReview.cjs.map +1 -1
- package/dist/ai/proposal/ProposalFieldReview.d.cts +170 -8
- package/dist/ai/proposal/ProposalFieldReview.d.ts +170 -8
- package/dist/ai/proposal/ProposalFieldReview.js.map +1 -1
- package/dist/ai/proposal/types.d.cts +97 -26
- package/dist/ai/proposal/types.d.ts +97 -26
- package/dist/ai/proposal/use-proposal-batch-review.cjs.map +1 -1
- package/dist/ai/proposal/use-proposal-batch-review.d.cts +133 -7
- package/dist/ai/proposal/use-proposal-batch-review.d.ts +133 -7
- package/dist/ai/proposal/use-proposal-batch-review.js.map +1 -1
- package/dist/ai/proposal/use-proposal-review.cjs.map +1 -1
- package/dist/ai/proposal/use-proposal-review.d.cts +47 -5
- package/dist/ai/proposal/use-proposal-review.d.ts +47 -5
- package/dist/ai/proposal/use-proposal-review.js.map +1 -1
- package/dist/avatar.svg +1 -0
- package/dist/consumer-ai/SKILL.md +6 -0
- package/dist/consumer-ai/api-index.json +103754 -0
- package/dist/consumer-ai/package-context.json +5 -3
- package/dist/mockServiceWorker.js +361 -0
- package/dist/styles.css +1 -1
- package/dist/tools/components/auth/AuthForms.cjs.map +1 -1
- package/dist/tools/components/auth/AuthForms.d.cts +131 -81
- package/dist/tools/components/auth/AuthForms.d.ts +131 -81
- package/dist/tools/components/auth/AuthForms.js.map +1 -1
- package/dist/tools/components/auth/AuthGuard.cjs.map +1 -1
- package/dist/tools/components/auth/AuthGuard.d.cts +31 -4
- package/dist/tools/components/auth/AuthGuard.d.ts +31 -4
- package/dist/tools/components/auth/AuthGuard.js.map +1 -1
- package/dist/tools/components/auth/AuthProvider.cjs.map +1 -1
- package/dist/tools/components/auth/AuthProvider.d.cts +39 -42
- package/dist/tools/components/auth/AuthProvider.d.ts +39 -42
- package/dist/tools/components/auth/AuthProvider.js.map +1 -1
- package/dist/tools/components/auth/ProtectedRoute.cjs.map +1 -1
- package/dist/tools/components/auth/ProtectedRoute.d.cts +75 -60
- package/dist/tools/components/auth/ProtectedRoute.d.ts +75 -60
- package/dist/tools/components/auth/ProtectedRoute.js.map +1 -1
- package/dist/tools/components/auth/SignInButton.cjs.map +1 -1
- package/dist/tools/components/auth/SignInButton.d.cts +26 -18
- package/dist/tools/components/auth/SignInButton.d.ts +26 -18
- package/dist/tools/components/auth/SignInButton.js.map +1 -1
- package/dist/tools/components/auth/UserProfileProvider.cjs.map +1 -1
- package/dist/tools/components/auth/UserProfileProvider.d.cts +48 -20
- package/dist/tools/components/auth/UserProfileProvider.d.ts +48 -20
- package/dist/tools/components/auth/UserProfileProvider.js.map +1 -1
- package/dist/tools/components/auth/adapters/better-auth-adapter.cjs.map +1 -1
- package/dist/tools/components/auth/adapters/better-auth-adapter.d.cts +371 -51
- package/dist/tools/components/auth/adapters/better-auth-adapter.d.ts +371 -51
- package/dist/tools/components/auth/adapters/better-auth-adapter.js.map +1 -1
- package/dist/tools/components/auth/adapters/mock-adapter.cjs.map +1 -1
- package/dist/tools/components/auth/adapters/mock-adapter.d.cts +149 -28
- package/dist/tools/components/auth/adapters/mock-adapter.d.ts +149 -28
- package/dist/tools/components/auth/adapters/mock-adapter.js.map +1 -1
- package/dist/tools/components/auth/auth-session.cjs.map +1 -1
- package/dist/tools/components/auth/auth-session.d.cts +147 -1
- package/dist/tools/components/auth/auth-session.d.ts +147 -1
- package/dist/tools/components/auth/auth-session.js.map +1 -1
- package/dist/tools/components/auth/session-cache.cjs.map +1 -1
- package/dist/tools/components/auth/session-cache.d.cts +88 -24
- package/dist/tools/components/auth/session-cache.d.ts +88 -24
- package/dist/tools/components/auth/session-cache.js.map +1 -1
- package/dist/tools/components/auth/types.cjs.map +1 -1
- package/dist/tools/components/auth/types.d.cts +329 -106
- package/dist/tools/components/auth/types.d.ts +329 -106
- package/dist/tools/components/auth/types.js.map +1 -1
- package/dist/tools/components/auth/useAuth.cjs.map +1 -1
- package/dist/tools/components/auth/useAuth.d.cts +110 -17
- package/dist/tools/components/auth/useAuth.d.ts +110 -17
- package/dist/tools/components/auth/useAuth.js.map +1 -1
- package/dist/tools/components/auth/useAuthGuard.cjs.map +1 -1
- package/dist/tools/components/auth/useAuthGuard.d.cts +49 -38
- package/dist/tools/components/auth/useAuthGuard.d.ts +49 -38
- package/dist/tools/components/auth/useAuthGuard.js.map +1 -1
- package/dist/tools/components/auth/useRoleCheck.cjs.map +1 -1
- package/dist/tools/components/auth/useRoleCheck.d.cts +48 -1
- package/dist/tools/components/auth/useRoleCheck.d.ts +48 -1
- package/dist/tools/components/auth/useRoleCheck.js.map +1 -1
- package/dist/tools/components/auth/useUserProfile.cjs.map +1 -1
- package/dist/tools/components/auth/useUserProfile.d.cts +66 -1
- package/dist/tools/components/auth/useUserProfile.d.ts +66 -1
- package/dist/tools/components/auth/useUserProfile.js.map +1 -1
- package/dist/tools/components/barcode/BarcodeGenerator.cjs.map +1 -1
- package/dist/tools/components/barcode/BarcodeGenerator.d.cts +32 -18
- package/dist/tools/components/barcode/BarcodeGenerator.d.ts +32 -18
- package/dist/tools/components/barcode/BarcodeGenerator.js.map +1 -1
- package/dist/tools/components/barcode/QRCodeGenerator.cjs +1 -1
- package/dist/tools/components/barcode/QRCodeGenerator.cjs.map +1 -1
- package/dist/tools/components/barcode/QRCodeGenerator.d.cts +20 -13
- package/dist/tools/components/barcode/QRCodeGenerator.d.ts +20 -13
- package/dist/tools/components/barcode/QRCodeGenerator.js +1 -1
- package/dist/tools/components/barcode/QRCodeGenerator.js.map +1 -1
- package/dist/tools/components/barcode/QRCodeScanner.cjs.map +1 -1
- package/dist/tools/components/barcode/QRCodeScanner.d.cts +32 -1
- package/dist/tools/components/barcode/QRCodeScanner.d.ts +32 -1
- package/dist/tools/components/barcode/QRCodeScanner.js.map +1 -1
- package/dist/tools/components/calendar/ResourceCalendar.cjs.map +1 -1
- package/dist/tools/components/calendar/ResourceCalendar.d.cts +17 -42
- package/dist/tools/components/calendar/ResourceCalendar.d.ts +17 -42
- package/dist/tools/components/calendar/ResourceCalendar.js.map +1 -1
- package/dist/tools/components/calendar/views/ResourceView.cjs +1 -1
- package/dist/tools/components/calendar/views/ResourceView.cjs.map +1 -1
- package/dist/tools/components/calendar/views/ResourceView.js +2 -2
- package/dist/tools/components/calendar/views/ResourceView.js.map +1 -1
- package/dist/tools/components/chart/ComposedChart.cjs.map +1 -1
- package/dist/tools/components/chart/ComposedChart.d.cts +54 -1
- package/dist/tools/components/chart/ComposedChart.d.ts +54 -1
- package/dist/tools/components/chart/ComposedChart.js.map +1 -1
- package/dist/tools/components/chart/SimpleAreaChart.cjs.map +1 -1
- package/dist/tools/components/chart/SimpleAreaChart.d.cts +41 -1
- package/dist/tools/components/chart/SimpleAreaChart.d.ts +41 -1
- package/dist/tools/components/chart/SimpleAreaChart.js.map +1 -1
- package/dist/tools/components/chart/SimpleBarChart.cjs.map +1 -1
- package/dist/tools/components/chart/SimpleBarChart.d.cts +34 -24
- package/dist/tools/components/chart/SimpleBarChart.d.ts +34 -24
- package/dist/tools/components/chart/SimpleBarChart.js.map +1 -1
- package/dist/tools/components/chart/SimpleLineChart.cjs.map +1 -1
- package/dist/tools/components/chart/SimpleLineChart.d.cts +31 -28
- package/dist/tools/components/chart/SimpleLineChart.d.ts +31 -28
- package/dist/tools/components/chart/SimpleLineChart.js.map +1 -1
- package/dist/tools/components/chart/SimplePieChart.cjs.map +1 -1
- package/dist/tools/components/chart/SimplePieChart.d.cts +28 -22
- package/dist/tools/components/chart/SimplePieChart.d.ts +28 -22
- package/dist/tools/components/chart/SimplePieChart.js.map +1 -1
- package/dist/tools/components/chart/SimpleRadarChart.cjs.map +1 -1
- package/dist/tools/components/chart/SimpleRadarChart.d.cts +38 -1
- package/dist/tools/components/chart/SimpleRadarChart.d.ts +38 -1
- package/dist/tools/components/chart/SimpleRadarChart.js.map +1 -1
- package/dist/tools/components/chart/SimpleScatterChart.cjs.map +1 -1
- package/dist/tools/components/chart/SimpleScatterChart.d.cts +44 -1
- package/dist/tools/components/chart/SimpleScatterChart.d.ts +44 -1
- package/dist/tools/components/chart/SimpleScatterChart.js.map +1 -1
- package/dist/tools/components/chart/StackedBarChart.cjs.map +1 -1
- package/dist/tools/components/chart/StackedBarChart.d.cts +38 -1
- package/dist/tools/components/chart/StackedBarChart.d.ts +38 -1
- package/dist/tools/components/chart/StackedBarChart.js.map +1 -1
- package/dist/tools/components/data-table/data-table.cjs +1 -1
- package/dist/tools/components/data-table/data-table.cjs.map +1 -1
- package/dist/tools/components/data-table/data-table.js +286 -263
- package/dist/tools/components/data-table/data-table.js.map +1 -1
- package/dist/tools/components/data-table/table-utils.cjs.map +1 -1
- package/dist/tools/components/data-table/table-utils.d.cts +45 -35
- package/dist/tools/components/data-table/table-utils.d.ts +45 -35
- package/dist/tools/components/data-table/table-utils.js.map +1 -1
- package/dist/tools/components/editable-table/editable-table.cjs +1 -1
- package/dist/tools/components/editable-table/editable-table.cjs.map +1 -1
- package/dist/tools/components/editable-table/editable-table.js +15 -2
- package/dist/tools/components/editable-table/editable-table.js.map +1 -1
- package/dist/tools/components/error/ErrorDialog.cjs +1 -1
- package/dist/tools/components/error/ErrorDialog.cjs.map +1 -1
- package/dist/tools/components/error/ErrorDialog.js +1 -1
- package/dist/tools/components/error/ErrorDialog.js.map +1 -1
- package/dist/tools/components/error/ErrorInline.cjs +1 -1
- package/dist/tools/components/error/ErrorInline.cjs.map +1 -1
- package/dist/tools/components/error/ErrorInline.js +1 -1
- package/dist/tools/components/error/ErrorInline.js.map +1 -1
- package/dist/tools/components/error/ErrorNotification.cjs +1 -1
- package/dist/tools/components/error/ErrorNotification.cjs.map +1 -1
- package/dist/tools/components/error/ErrorNotification.js +10 -10
- package/dist/tools/components/error/ErrorNotification.js.map +1 -1
- package/dist/tools/components/file-browser/FilePreview.cjs +1 -1
- package/dist/tools/components/file-browser/FilePreview.cjs.map +1 -1
- package/dist/tools/components/file-browser/FilePreview.js +28 -26
- package/dist/tools/components/file-browser/FilePreview.js.map +1 -1
- package/dist/tools/components/filter/filter.cjs.map +1 -1
- package/dist/tools/components/filter/filter.d.cts +23 -34
- package/dist/tools/components/filter/filter.d.ts +23 -34
- package/dist/tools/components/filter/filter.js.map +1 -1
- package/dist/tools/components/form/EnhancedDetailPage.cjs.map +1 -1
- package/dist/tools/components/form/EnhancedDetailPage.d.cts +47 -42
- package/dist/tools/components/form/EnhancedDetailPage.d.ts +47 -42
- package/dist/tools/components/form/EnhancedDetailPage.js.map +1 -1
- package/dist/tools/components/form/form-grid.cjs.map +1 -1
- package/dist/tools/components/form/form-grid.d.cts +44 -22
- package/dist/tools/components/form/form-grid.d.ts +44 -22
- package/dist/tools/components/form/form-grid.js.map +1 -1
- package/dist/tools/components/gantt/GanttChart.cjs +1 -1
- package/dist/tools/components/gantt/GanttChart.cjs.map +1 -1
- package/dist/tools/components/gantt/GanttChart.d.cts +20 -1
- package/dist/tools/components/gantt/GanttChart.d.ts +20 -1
- package/dist/tools/components/gantt/GanttChart.js +3 -0
- package/dist/tools/components/gantt/GanttChart.js.map +1 -1
- package/dist/tools/components/gantt/components/GanttTaskBar.cjs +1 -1
- package/dist/tools/components/gantt/components/GanttTaskBar.cjs.map +1 -1
- package/dist/tools/components/gantt/components/GanttTaskBar.js +2 -1
- package/dist/tools/components/gantt/components/GanttTaskBar.js.map +1 -1
- package/dist/tools/components/header/header.cjs +1 -1
- package/dist/tools/components/header/header.cjs.map +1 -1
- package/dist/tools/components/header/header.d.cts +103 -40
- package/dist/tools/components/header/header.d.ts +103 -40
- package/dist/tools/components/header/header.js +1 -1
- package/dist/tools/components/header/header.js.map +1 -1
- package/dist/tools/components/i18n/LanguageSwitcher.cjs.map +1 -1
- package/dist/tools/components/i18n/LanguageSwitcher.d.cts +18 -14
- package/dist/tools/components/i18n/LanguageSwitcher.d.ts +18 -14
- package/dist/tools/components/i18n/LanguageSwitcher.js.map +1 -1
- package/dist/tools/components/kanban/KanbanBoard.cjs +1 -1
- package/dist/tools/components/kanban/KanbanBoard.cjs.map +1 -1
- package/dist/tools/components/kanban/KanbanBoard.d.cts +16 -34
- package/dist/tools/components/kanban/KanbanBoard.d.ts +16 -34
- package/dist/tools/components/kanban/KanbanBoard.js +3 -0
- package/dist/tools/components/kanban/KanbanBoard.js.map +1 -1
- package/dist/tools/components/kanban/KanbanColumn.cjs +1 -1
- package/dist/tools/components/kanban/KanbanColumn.cjs.map +1 -1
- package/dist/tools/components/kanban/KanbanColumn.js +1 -1
- package/dist/tools/components/kanban/KanbanColumn.js.map +1 -1
- package/dist/tools/components/kanban/kanban-compound.cjs +1 -1
- package/dist/tools/components/kanban/kanban-compound.cjs.map +1 -1
- package/dist/tools/components/kanban/kanban-compound.js +4 -1
- package/dist/tools/components/kanban/kanban-compound.js.map +1 -1
- package/dist/tools/components/kanban/kanban-primitives.cjs +1 -1
- package/dist/tools/components/kanban/kanban-primitives.cjs.map +1 -1
- package/dist/tools/components/kanban/kanban-primitives.js +0 -1
- package/dist/tools/components/kanban/kanban-primitives.js.map +1 -1
- package/dist/tools/components/priority-queue/PriorityCard.cjs +1 -1
- package/dist/tools/components/priority-queue/PriorityCard.cjs.map +1 -1
- package/dist/tools/components/priority-queue/PriorityCard.js +3 -1
- package/dist/tools/components/priority-queue/PriorityCard.js.map +1 -1
- package/dist/tools/components/sidebar/SmartSidebar.cjs.map +1 -1
- package/dist/tools/components/sidebar/SmartSidebar.d.cts +41 -43
- package/dist/tools/components/sidebar/SmartSidebar.d.ts +41 -43
- package/dist/tools/components/sidebar/SmartSidebar.js.map +1 -1
- package/dist/tools/components/splash/SplashScreen.cjs.map +1 -1
- package/dist/tools/components/splash/SplashScreen.d.cts +43 -68
- package/dist/tools/components/splash/SplashScreen.d.ts +43 -68
- package/dist/tools/components/splash/SplashScreen.js.map +1 -1
- package/dist/tools/components/workflow/WorkflowStatusPanel.cjs +1 -1
- package/dist/tools/components/workflow/WorkflowStatusPanel.cjs.map +1 -1
- package/dist/tools/components/workflow/WorkflowStatusPanel.js +2 -2
- package/dist/tools/components/workflow/WorkflowStatusPanel.js.map +1 -1
- package/dist/tools/lib/data-access/data-access-context.cjs.map +1 -1
- package/dist/tools/lib/data-access/data-access-context.d.cts +15 -6
- package/dist/tools/lib/data-access/data-access-context.d.ts +15 -6
- package/dist/tools/lib/data-access/data-access-context.js.map +1 -1
- package/dist/tools/lib/data-access/react-query-provider.cjs.map +1 -1
- package/dist/tools/lib/data-access/react-query-provider.d.cts +19 -2
- package/dist/tools/lib/data-access/react-query-provider.d.ts +19 -2
- package/dist/tools/lib/data-access/react-query-provider.js.map +1 -1
- package/dist/tools/lib/data-access/react-query.cjs.map +1 -1
- package/dist/tools/lib/data-access/react-query.d.cts +365 -90
- package/dist/tools/lib/data-access/react-query.d.ts +365 -90
- package/dist/tools/lib/data-access/react-query.js.map +1 -1
- package/dist/tools/lib/error/AppError.cjs.map +1 -1
- package/dist/tools/lib/error/AppError.d.cts +157 -63
- package/dist/tools/lib/error/AppError.d.ts +157 -63
- package/dist/tools/lib/error/AppError.js.map +1 -1
- package/dist/tools/lib/hooks/useAsyncWithTimeout.cjs.map +1 -1
- package/dist/tools/lib/hooks/useAsyncWithTimeout.d.cts +79 -26
- package/dist/tools/lib/hooks/useAsyncWithTimeout.d.ts +79 -26
- package/dist/tools/lib/hooks/useAsyncWithTimeout.js.map +1 -1
- package/dist/tools/lib/hooks/useError.cjs.map +1 -1
- package/dist/tools/lib/hooks/useError.d.cts +51 -16
- package/dist/tools/lib/hooks/useError.d.ts +51 -16
- package/dist/tools/lib/hooks/useError.js.map +1 -1
- package/dist/tools/lib/schema/ajv.cjs +1 -1
- package/dist/tools/lib/schema/ajv.cjs.map +1 -1
- package/dist/tools/lib/schema/ajv.d.cts +19 -8
- package/dist/tools/lib/schema/ajv.d.ts +19 -8
- package/dist/tools/lib/schema/ajv.js +2 -1
- package/dist/tools/lib/schema/ajv.js.map +1 -1
- package/dist/tools/lib/state/error-store.cjs.map +1 -1
- package/dist/tools/lib/state/error-store.d.cts +61 -10
- package/dist/tools/lib/state/error-store.d.ts +61 -10
- package/dist/tools/lib/state/error-store.js.map +1 -1
- package/dist/tools/lib/state/store-factory.cjs.map +1 -1
- package/dist/tools/lib/state/store-factory.d.cts +25 -4
- package/dist/tools/lib/state/store-factory.d.ts +25 -4
- package/dist/tools/lib/state/store-factory.js.map +1 -1
- package/dist/tools/lib/state/ui-store.cjs.map +1 -1
- package/dist/tools/lib/state/ui-store.d.cts +39 -0
- package/dist/tools/lib/state/ui-store.d.ts +39 -0
- package/dist/tools/lib/state/ui-store.js.map +1 -1
- package/dist/ui/components/theme/theme-context.cjs.map +1 -1
- package/dist/ui/components/theme/theme-context.d.cts +171 -1
- package/dist/ui/components/theme/theme-context.d.ts +171 -1
- package/dist/ui/components/theme/theme-context.js.map +1 -1
- package/dist/ui/components/theme/theme-provider.cjs.map +1 -1
- package/dist/ui/components/theme/theme-provider.d.cts +31 -19
- package/dist/ui/components/theme/theme-provider.d.ts +31 -19
- package/dist/ui/components/theme/theme-provider.js.map +1 -1
- package/dist/ui/components/theme/theme-script.cjs.map +1 -1
- package/dist/ui/components/theme/theme-script.d.cts +16 -1
- package/dist/ui/components/theme/theme-script.d.ts +16 -1
- package/dist/ui/components/theme/theme-script.js.map +1 -1
- package/dist/ui/components/theme/theme-switcher.cjs +1 -1
- package/dist/ui/components/theme/theme-switcher.cjs.map +1 -1
- package/dist/ui/components/theme/theme-switcher.d.cts +82 -13
- package/dist/ui/components/theme/theme-switcher.d.ts +82 -13
- package/dist/ui/components/theme/theme-switcher.js +8 -0
- package/dist/ui/components/theme/theme-switcher.js.map +1 -1
- package/dist/ui/components/ui/accordion.cjs.map +1 -1
- package/dist/ui/components/ui/accordion.d.cts +60 -0
- package/dist/ui/components/ui/accordion.d.ts +60 -0
- package/dist/ui/components/ui/accordion.js.map +1 -1
- package/dist/ui/components/ui/adjustable-pane.cjs.map +1 -1
- package/dist/ui/components/ui/adjustable-pane.d.cts +44 -26
- package/dist/ui/components/ui/adjustable-pane.d.ts +44 -26
- package/dist/ui/components/ui/adjustable-pane.js.map +1 -1
- package/dist/ui/components/ui/alert-dialog.cjs.map +1 -1
- package/dist/ui/components/ui/alert-dialog.d.cts +179 -2
- package/dist/ui/components/ui/alert-dialog.d.ts +179 -2
- package/dist/ui/components/ui/alert-dialog.js.map +1 -1
- package/dist/ui/components/ui/alert.cjs.map +1 -1
- package/dist/ui/components/ui/alert.d.cts +52 -4
- package/dist/ui/components/ui/alert.d.ts +52 -4
- package/dist/ui/components/ui/alert.js.map +1 -1
- package/dist/ui/components/ui/aspect-ratio.cjs.map +1 -1
- package/dist/ui/components/ui/aspect-ratio.d.cts +16 -1
- package/dist/ui/components/ui/aspect-ratio.d.ts +16 -1
- package/dist/ui/components/ui/aspect-ratio.js.map +1 -1
- package/dist/ui/components/ui/avatar.cjs.map +1 -1
- package/dist/ui/components/ui/avatar.d.cts +87 -3
- package/dist/ui/components/ui/avatar.d.ts +87 -3
- package/dist/ui/components/ui/avatar.js.map +1 -1
- package/dist/ui/components/ui/badge-components.cjs.map +1 -1
- package/dist/ui/components/ui/badge-components.d.cts +13 -1
- package/dist/ui/components/ui/badge-components.d.ts +13 -1
- package/dist/ui/components/ui/badge-components.js.map +1 -1
- package/dist/ui/components/ui/badge-variants.cjs.map +1 -1
- package/dist/ui/components/ui/badge-variants.d.cts +15 -0
- package/dist/ui/components/ui/badge-variants.d.ts +15 -0
- package/dist/ui/components/ui/badge-variants.js.map +1 -1
- package/dist/ui/components/ui/breadcrumb.cjs.map +1 -1
- package/dist/ui/components/ui/breadcrumb.d.cts +91 -7
- package/dist/ui/components/ui/breadcrumb.d.ts +91 -7
- package/dist/ui/components/ui/breadcrumb.js.map +1 -1
- package/dist/ui/components/ui/button-components.cjs.map +1 -1
- package/dist/ui/components/ui/button-components.d.cts +18 -6
- package/dist/ui/components/ui/button-components.d.ts +18 -6
- package/dist/ui/components/ui/button-components.js.map +1 -1
- package/dist/ui/components/ui/button-group-components.cjs.map +1 -1
- package/dist/ui/components/ui/button-group-components.d.cts +39 -3
- package/dist/ui/components/ui/button-group-components.d.ts +39 -3
- package/dist/ui/components/ui/button-group-components.js.map +1 -1
- package/dist/ui/components/ui/button-group-variants.cjs.map +1 -1
- package/dist/ui/components/ui/button-group-variants.d.cts +15 -0
- package/dist/ui/components/ui/button-group-variants.d.ts +15 -0
- package/dist/ui/components/ui/button-group-variants.js.map +1 -1
- package/dist/ui/components/ui/button-variants.cjs.map +1 -1
- package/dist/ui/components/ui/button-variants.d.cts +13 -2
- package/dist/ui/components/ui/button-variants.d.ts +13 -2
- package/dist/ui/components/ui/button-variants.js.map +1 -1
- package/dist/ui/components/ui/card.cjs.map +1 -1
- package/dist/ui/components/ui/card.d.cts +106 -2
- package/dist/ui/components/ui/card.d.ts +106 -2
- package/dist/ui/components/ui/card.js.map +1 -1
- package/dist/ui/components/ui/checkbox-group.cjs.map +1 -1
- package/dist/ui/components/ui/checkbox-group.d.cts +13 -1
- package/dist/ui/components/ui/checkbox-group.d.ts +13 -1
- package/dist/ui/components/ui/checkbox-group.js.map +1 -1
- package/dist/ui/components/ui/checkbox.cjs.map +1 -1
- package/dist/ui/components/ui/checkbox.d.cts +17 -6
- package/dist/ui/components/ui/checkbox.d.ts +17 -6
- package/dist/ui/components/ui/checkbox.js.map +1 -1
- package/dist/ui/components/ui/collapsible.cjs.map +1 -1
- package/dist/ui/components/ui/collapsible.d.cts +39 -3
- package/dist/ui/components/ui/collapsible.d.ts +39 -3
- package/dist/ui/components/ui/collapsible.js.map +1 -1
- package/dist/ui/components/ui/combobox-components.cjs.map +1 -1
- package/dist/ui/components/ui/combobox-components.d.cts +209 -14
- package/dist/ui/components/ui/combobox-components.d.ts +209 -14
- package/dist/ui/components/ui/combobox-components.js.map +1 -1
- package/dist/ui/components/ui/combobox-hooks.cjs.map +1 -1
- package/dist/ui/components/ui/combobox-hooks.d.cts +13 -1
- package/dist/ui/components/ui/combobox-hooks.d.ts +13 -1
- package/dist/ui/components/ui/combobox-hooks.js.map +1 -1
- package/dist/ui/components/ui/command.cjs.map +1 -1
- package/dist/ui/components/ui/command.d.cts +132 -9
- package/dist/ui/components/ui/command.d.ts +132 -9
- package/dist/ui/components/ui/command.js.map +1 -1
- package/dist/ui/components/ui/context-menu.cjs.map +1 -1
- package/dist/ui/components/ui/context-menu.d.cts +233 -2
- package/dist/ui/components/ui/context-menu.d.ts +233 -2
- package/dist/ui/components/ui/context-menu.js.map +1 -1
- package/dist/ui/components/ui/dialog.cjs.map +1 -1
- package/dist/ui/components/ui/dialog.d.cts +157 -5
- package/dist/ui/components/ui/dialog.d.ts +157 -5
- package/dist/ui/components/ui/dialog.js.map +1 -1
- package/dist/ui/components/ui/drawer.cjs.map +1 -1
- package/dist/ui/components/ui/drawer.d.cts +130 -10
- package/dist/ui/components/ui/drawer.d.ts +130 -10
- package/dist/ui/components/ui/drawer.js.map +1 -1
- package/dist/ui/components/ui/dropdown-menu.cjs.map +1 -1
- package/dist/ui/components/ui/dropdown-menu.d.cts +225 -6
- package/dist/ui/components/ui/dropdown-menu.d.ts +225 -6
- package/dist/ui/components/ui/dropdown-menu.js.map +1 -1
- package/dist/ui/components/ui/empty.cjs.map +1 -1
- package/dist/ui/components/ui/empty.d.cts +78 -6
- package/dist/ui/components/ui/empty.d.ts +78 -6
- package/dist/ui/components/ui/empty.js.map +1 -1
- package/dist/ui/components/ui/field.cjs.map +1 -1
- package/dist/ui/components/ui/field.d.cts +180 -6
- package/dist/ui/components/ui/field.d.ts +180 -6
- package/dist/ui/components/ui/field.js.map +1 -1
- package/dist/ui/components/ui/file-icon.cjs.map +1 -1
- package/dist/ui/components/ui/file-icon.d.cts +32 -4
- package/dist/ui/components/ui/file-icon.d.ts +32 -4
- package/dist/ui/components/ui/file-icon.js.map +1 -1
- package/dist/ui/components/ui/hover-card.cjs.map +1 -1
- package/dist/ui/components/ui/hover-card.d.cts +39 -3
- package/dist/ui/components/ui/hover-card.d.ts +39 -3
- package/dist/ui/components/ui/hover-card.js.map +1 -1
- package/dist/ui/components/ui/input-group.cjs.map +1 -1
- package/dist/ui/components/ui/input-group.d.cts +84 -6
- package/dist/ui/components/ui/input-group.d.ts +84 -6
- package/dist/ui/components/ui/input-group.js.map +1 -1
- package/dist/ui/components/ui/input-otp.cjs.map +1 -1
- package/dist/ui/components/ui/input-otp.d.cts +58 -4
- package/dist/ui/components/ui/input-otp.d.ts +58 -4
- package/dist/ui/components/ui/input-otp.js.map +1 -1
- package/dist/ui/components/ui/input.cjs.map +1 -1
- package/dist/ui/components/ui/input.d.cts +18 -10
- package/dist/ui/components/ui/input.d.ts +18 -10
- package/dist/ui/components/ui/input.js.map +1 -1
- package/dist/ui/components/ui/item.cjs.map +1 -1
- package/dist/ui/components/ui/item.d.cts +130 -10
- package/dist/ui/components/ui/item.d.ts +130 -10
- package/dist/ui/components/ui/item.js.map +1 -1
- package/dist/ui/components/ui/kbd.cjs.map +1 -1
- package/dist/ui/components/ui/kbd.d.cts +26 -2
- package/dist/ui/components/ui/kbd.d.ts +26 -2
- package/dist/ui/components/ui/kbd.js.map +1 -1
- package/dist/ui/components/ui/label.cjs.map +1 -1
- package/dist/ui/components/ui/label.d.cts +15 -0
- package/dist/ui/components/ui/label.d.ts +15 -0
- package/dist/ui/components/ui/label.js.map +1 -1
- package/dist/ui/components/ui/layout.cjs +1 -1
- package/dist/ui/components/ui/layout.cjs.map +1 -1
- package/dist/ui/components/ui/layout.d.cts +45 -11
- package/dist/ui/components/ui/layout.d.ts +45 -11
- package/dist/ui/components/ui/layout.js +22 -20
- package/dist/ui/components/ui/layout.js.map +1 -1
- package/dist/ui/components/ui/menubar.cjs.map +1 -1
- package/dist/ui/components/ui/menubar.d.cts +220 -16
- package/dist/ui/components/ui/menubar.d.ts +220 -16
- package/dist/ui/components/ui/menubar.js.map +1 -1
- package/dist/ui/components/ui/meter.cjs.map +1 -1
- package/dist/ui/components/ui/meter.d.cts +52 -4
- package/dist/ui/components/ui/meter.d.ts +52 -4
- package/dist/ui/components/ui/meter.js.map +1 -1
- package/dist/ui/components/ui/mobile-form-variants.cjs.map +1 -1
- package/dist/ui/components/ui/mobile-form-variants.d.cts +30 -0
- package/dist/ui/components/ui/mobile-form-variants.d.ts +30 -0
- package/dist/ui/components/ui/mobile-form-variants.js.map +1 -1
- package/dist/ui/components/ui/mobile-form.cjs.map +1 -1
- package/dist/ui/components/ui/mobile-form.d.cts +186 -9
- package/dist/ui/components/ui/mobile-form.d.ts +186 -9
- package/dist/ui/components/ui/mobile-form.js.map +1 -1
- package/dist/ui/components/ui/navigation-menu-components.cjs.map +1 -1
- package/dist/ui/components/ui/navigation-menu-components.d.cts +104 -8
- package/dist/ui/components/ui/navigation-menu-components.d.ts +104 -8
- package/dist/ui/components/ui/navigation-menu-components.js.map +1 -1
- package/dist/ui/components/ui/navigation-menu-variants.cjs.map +1 -1
- package/dist/ui/components/ui/navigation-menu-variants.d.cts +15 -0
- package/dist/ui/components/ui/navigation-menu-variants.d.ts +15 -0
- package/dist/ui/components/ui/navigation-menu-variants.js.map +1 -1
- package/dist/ui/components/ui/number-field.cjs.map +1 -1
- package/dist/ui/components/ui/number-field.d.cts +78 -6
- package/dist/ui/components/ui/number-field.d.ts +78 -6
- package/dist/ui/components/ui/number-field.js.map +1 -1
- package/dist/ui/components/ui/pagination.cjs.map +1 -1
- package/dist/ui/components/ui/pagination.d.cts +99 -7
- package/dist/ui/components/ui/pagination.d.ts +99 -7
- package/dist/ui/components/ui/pagination.js.map +1 -1
- package/dist/ui/components/ui/password-input.cjs.map +1 -1
- package/dist/ui/components/ui/password-input.d.cts +10 -7
- package/dist/ui/components/ui/password-input.d.ts +10 -7
- package/dist/ui/components/ui/password-input.js.map +1 -1
- package/dist/ui/components/ui/popover.cjs.map +1 -1
- package/dist/ui/components/ui/popover.d.cts +86 -2
- package/dist/ui/components/ui/popover.d.ts +86 -2
- package/dist/ui/components/ui/popover.js.map +1 -1
- package/dist/ui/components/ui/progress.cjs.map +1 -1
- package/dist/ui/components/ui/progress.d.cts +72 -2
- package/dist/ui/components/ui/progress.d.ts +72 -2
- package/dist/ui/components/ui/progress.js.map +1 -1
- package/dist/ui/components/ui/radio-card.cjs.map +1 -1
- package/dist/ui/components/ui/radio-card.d.cts +32 -4
- package/dist/ui/components/ui/radio-card.d.ts +32 -4
- package/dist/ui/components/ui/radio-card.js.map +1 -1
- package/dist/ui/components/ui/radio-group.cjs.map +1 -1
- package/dist/ui/components/ui/radio-group.d.cts +28 -2
- package/dist/ui/components/ui/radio-group.d.ts +28 -2
- package/dist/ui/components/ui/radio-group.js.map +1 -1
- package/dist/ui/components/ui/resizable.cjs.map +1 -1
- package/dist/ui/components/ui/resizable.d.cts +42 -3
- package/dist/ui/components/ui/resizable.d.ts +42 -3
- package/dist/ui/components/ui/resizable.js.map +1 -1
- package/dist/ui/components/ui/responsive-list.cjs.map +1 -1
- package/dist/ui/components/ui/responsive-list.d.cts +176 -13
- package/dist/ui/components/ui/responsive-list.d.ts +176 -13
- package/dist/ui/components/ui/responsive-list.js.map +1 -1
- package/dist/ui/components/ui/scroll-area.cjs.map +1 -1
- package/dist/ui/components/ui/scroll-area.d.cts +28 -1
- package/dist/ui/components/ui/scroll-area.d.ts +28 -1
- package/dist/ui/components/ui/scroll-area.js.map +1 -1
- package/dist/ui/components/ui/searchable-select-input.cjs.map +1 -1
- package/dist/ui/components/ui/searchable-select-input.d.cts +199 -49
- package/dist/ui/components/ui/searchable-select-input.d.ts +199 -49
- package/dist/ui/components/ui/searchable-select-input.js.map +1 -1
- package/dist/ui/components/ui/select.cjs.map +1 -1
- package/dist/ui/components/ui/select.d.cts +205 -40
- package/dist/ui/components/ui/select.d.ts +205 -40
- package/dist/ui/components/ui/select.js.map +1 -1
- package/dist/ui/components/ui/separator.cjs.map +1 -1
- package/dist/ui/components/ui/separator.d.cts +13 -2
- package/dist/ui/components/ui/separator.d.ts +13 -2
- package/dist/ui/components/ui/separator.js.map +1 -1
- package/dist/ui/components/ui/sheet.cjs.map +1 -1
- package/dist/ui/components/ui/sheet.d.cts +128 -3
- package/dist/ui/components/ui/sheet.d.ts +128 -3
- package/dist/ui/components/ui/sheet.js.map +1 -1
- package/dist/ui/components/ui/skeleton.cjs.map +1 -1
- package/dist/ui/components/ui/skeleton.d.cts +13 -1
- package/dist/ui/components/ui/skeleton.d.ts +13 -1
- package/dist/ui/components/ui/skeleton.js.map +1 -1
- package/dist/ui/components/ui/slider.cjs.map +1 -1
- package/dist/ui/components/ui/slider.d.cts +13 -7
- package/dist/ui/components/ui/slider.d.ts +13 -7
- package/dist/ui/components/ui/slider.js.map +1 -1
- package/dist/ui/components/ui/spinner.cjs.map +1 -1
- package/dist/ui/components/ui/spinner.d.cts +13 -1
- package/dist/ui/components/ui/spinner.d.ts +13 -1
- package/dist/ui/components/ui/spinner.js.map +1 -1
- package/dist/ui/components/ui/switch.cjs.map +1 -1
- package/dist/ui/components/ui/switch.d.cts +26 -0
- package/dist/ui/components/ui/switch.d.ts +26 -0
- package/dist/ui/components/ui/switch.js.map +1 -1
- package/dist/ui/components/ui/table.cjs.map +1 -1
- package/dist/ui/components/ui/table.d.cts +118 -2
- package/dist/ui/components/ui/table.d.ts +118 -2
- package/dist/ui/components/ui/table.js.map +1 -1
- package/dist/ui/components/ui/tabs-components.cjs.map +1 -1
- package/dist/ui/components/ui/tabs-components.d.cts +52 -5
- package/dist/ui/components/ui/tabs-components.d.ts +52 -5
- package/dist/ui/components/ui/tabs-components.js.map +1 -1
- package/dist/ui/components/ui/tabs-variants.cjs.map +1 -1
- package/dist/ui/components/ui/tabs-variants.d.cts +15 -0
- package/dist/ui/components/ui/tabs-variants.d.ts +15 -0
- package/dist/ui/components/ui/tabs-variants.js.map +1 -1
- package/dist/ui/components/ui/textarea.cjs.map +1 -1
- package/dist/ui/components/ui/textarea.d.cts +23 -0
- package/dist/ui/components/ui/textarea.d.ts +23 -0
- package/dist/ui/components/ui/textarea.js.map +1 -1
- package/dist/ui/components/ui/toast.cjs.map +1 -1
- package/dist/ui/components/ui/toast.d.cts +136 -0
- package/dist/ui/components/ui/toast.d.ts +136 -0
- package/dist/ui/components/ui/toast.js.map +1 -1
- package/dist/ui/components/ui/toaster.cjs.map +1 -1
- package/dist/ui/components/ui/toaster.d.cts +12 -3
- package/dist/ui/components/ui/toaster.d.ts +12 -3
- package/dist/ui/components/ui/toaster.js.map +1 -1
- package/dist/ui/components/ui/toggle-components.cjs.map +1 -1
- package/dist/ui/components/ui/toggle-components.d.cts +15 -0
- package/dist/ui/components/ui/toggle-components.d.ts +15 -0
- package/dist/ui/components/ui/toggle-components.js.map +1 -1
- package/dist/ui/components/ui/toggle-group.cjs.map +1 -1
- package/dist/ui/components/ui/toggle-group.d.cts +33 -0
- package/dist/ui/components/ui/toggle-group.d.ts +33 -0
- package/dist/ui/components/ui/toggle-group.js.map +1 -1
- package/dist/ui/components/ui/toggle-variants.cjs.map +1 -1
- package/dist/ui/components/ui/toggle-variants.d.cts +15 -0
- package/dist/ui/components/ui/toggle-variants.d.ts +15 -0
- package/dist/ui/components/ui/toggle-variants.js.map +1 -1
- package/dist/ui/components/ui/toolbar.cjs.map +1 -1
- package/dist/ui/components/ui/toolbar.d.cts +94 -7
- package/dist/ui/components/ui/toolbar.d.ts +94 -7
- package/dist/ui/components/ui/toolbar.js.map +1 -1
- package/dist/ui/components/ui/tooltip.cjs.map +1 -1
- package/dist/ui/components/ui/tooltip.d.cts +54 -3
- package/dist/ui/components/ui/tooltip.d.ts +54 -3
- package/dist/ui/components/ui/tooltip.js.map +1 -1
- package/dist/ui/lib/hooks/use-gps.cjs.map +1 -1
- package/dist/ui/lib/hooks/use-gps.d.cts +29 -4
- package/dist/ui/lib/hooks/use-gps.d.ts +29 -4
- package/dist/ui/lib/hooks/use-gps.js.map +1 -1
- package/dist/ui/lib/hooks/use-is-client.cjs.map +1 -1
- package/dist/ui/lib/hooks/use-is-client.d.cts +11 -2
- package/dist/ui/lib/hooks/use-is-client.d.ts +11 -2
- package/dist/ui/lib/hooks/use-is-client.js.map +1 -1
- package/dist/ui/lib/hooks/use-keyboard-shortcut.cjs.map +1 -1
- package/dist/ui/lib/hooks/use-keyboard-shortcut.d.cts +48 -18
- package/dist/ui/lib/hooks/use-keyboard-shortcut.d.ts +48 -18
- package/dist/ui/lib/hooks/use-keyboard-shortcut.js.map +1 -1
- package/dist/ui/lib/hooks/use-mobile.cjs.map +1 -1
- package/dist/ui/lib/hooks/use-mobile.d.cts +11 -3
- package/dist/ui/lib/hooks/use-mobile.d.ts +11 -3
- package/dist/ui/lib/hooks/use-mobile.js.map +1 -1
- package/dist/ui/lib/hooks/use-toast.cjs.map +1 -1
- package/dist/ui/lib/hooks/use-toast.d.cts +184 -15
- package/dist/ui/lib/hooks/use-toast.d.ts +184 -15
- package/dist/ui/lib/hooks/use-toast.js.map +1 -1
- package/dist/ui/lib/ime-utils.cjs.map +1 -1
- package/dist/ui/lib/ime-utils.d.cts +40 -13
- package/dist/ui/lib/ime-utils.d.ts +40 -13
- package/dist/ui/lib/ime-utils.js.map +1 -1
- package/dist/ui/lib/utils.cjs.map +1 -1
- package/dist/ui/lib/utils.d.cts +9 -6
- package/dist/ui/lib/utils.d.ts +9 -6
- package/dist/ui/lib/utils.js.map +1 -1
- package/docs/ai.md +34 -1
- package/docs/exports.md +5 -1
- package/docs/index.md +89 -16
- package/docs/migration.md +268 -0
- package/docs/request-form.md +4 -1
- package/docs/tools.md +4 -1
- package/docs/ui.md +4 -1
- package/llms-full.txt +499 -36
- package/llms.txt +4 -0
- package/package.json +35 -5
|
@@ -1,51 +1,104 @@
|
|
|
1
1
|
import { AppError, ErrorDisplayMode } from '../error/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Host asynchronous operation and timeout/presentation settings.
|
|
4
|
+
* @typeParam T - Operation result shape.
|
|
5
|
+
* @see useAsyncWithTimeout for usage.
|
|
6
|
+
*/
|
|
2
7
|
export interface UseAsyncWithTimeoutOptions<T> {
|
|
3
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* Host operation invoked with no abort signal.
|
|
10
|
+
* @returns Promise resolving the operation result; rejection is normalized by execute.
|
|
11
|
+
*/
|
|
4
12
|
fn: () => Promise<T>;
|
|
5
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* Timeout in milliseconds; defaults to 30000. Does not cancel underlying work.
|
|
15
|
+
*/
|
|
6
16
|
timeout?: number;
|
|
7
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* Display hint for newly wrapped errors; defaults to notification.
|
|
19
|
+
*/
|
|
8
20
|
errorDisplayMode?: ErrorDisplayMode;
|
|
9
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* Add normalized failure to the shared error store; defaults to true.
|
|
23
|
+
*/
|
|
10
24
|
showErrorOnFailure?: boolean;
|
|
11
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* Optional synchronous callback after a mounted success; errors are handled as execution failures.
|
|
27
|
+
* @param data - Resolved operation result.
|
|
28
|
+
* @returns No value.
|
|
29
|
+
*/
|
|
12
30
|
onSuccess?: (data: T) => void;
|
|
13
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* Optional synchronous callback after mounted failure normalization/presentation.
|
|
33
|
+
* @param error - Normalized AppError.
|
|
34
|
+
* @returns No value; thrown callback errors reject execute.
|
|
35
|
+
*/
|
|
14
36
|
onError?: (error: AppError) => void;
|
|
15
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Last result/status with explicit execute/reset controls.
|
|
40
|
+
* @typeParam T - Host operation result shape.
|
|
41
|
+
* @see useAsyncWithTimeout for usage.
|
|
42
|
+
*/
|
|
16
43
|
export interface UseAsyncWithTimeoutReturn<T> {
|
|
17
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
* Race a new host operation against a timeout.
|
|
46
|
+
* @returns Host result on success, or undefined on handled failure/unmounted rejection.
|
|
47
|
+
* @throws Errors from onError/error-presentation callbacks may reject.
|
|
48
|
+
*/
|
|
18
49
|
execute: () => Promise<T | undefined>;
|
|
19
|
-
/**
|
|
50
|
+
/**
|
|
51
|
+
* Whether execute last set pending state; overlapping completions can overwrite this flag.
|
|
52
|
+
*/
|
|
20
53
|
isLoading: boolean;
|
|
21
|
-
/**
|
|
54
|
+
/**
|
|
55
|
+
* Most recent mounted execution failure or null.
|
|
56
|
+
*/
|
|
22
57
|
error: AppError | null;
|
|
23
|
-
/**
|
|
58
|
+
/**
|
|
59
|
+
* Last mounted success, initially undefined; errors do not clear prior data.
|
|
60
|
+
*/
|
|
24
61
|
data: T | undefined;
|
|
25
|
-
/**
|
|
62
|
+
/**
|
|
63
|
+
* Clear displayed loading/error/data state.
|
|
64
|
+
* @returns No value; in-flight host work can still finish and update state on this mount.
|
|
65
|
+
*/
|
|
26
66
|
reset: () => void;
|
|
27
67
|
}
|
|
28
68
|
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
69
|
+
* Runs explicit asynchronous work against a display timeout and tracks the last completion.
|
|
70
|
+
* @typeParam T - Host operation result shape.
|
|
71
|
+
* @param options - Host operation, timeout, presentation settings and synchronous outcome callbacks.
|
|
72
|
+
* @returns Execute/reset controls and displayed loading, result and normalized error state.
|
|
73
|
+
* @remarks Requires React and the shared error store; no context or styles are required by
|
|
74
|
+
* the hook. The internal AbortController is never passed to fn: new executes, reset and
|
|
75
|
+
* unmount do not cancel host work. Unmount suppresses state/callback updates; overlapping
|
|
76
|
+
* operations on one mount can complete out of order. Timeout timers are not cleared on
|
|
77
|
+
* settlement. onSuccess errors enter failure handling; onError errors may reject execute.
|
|
78
|
+
* To display errors, mount a host renderer for useError's shared store.
|
|
31
79
|
* @example
|
|
32
80
|
* ```tsx
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* });
|
|
39
|
-
*
|
|
40
|
-
* // ボタンクリックで実行
|
|
41
|
-
* <button onClick={execute} disabled={isLoading}>
|
|
42
|
-
* {isLoading ? 'Loading...' : 'Fetch Data'}
|
|
43
|
-
* </button>
|
|
81
|
+
* import { useAsyncWithTimeout } from '@alneas/appkit-react/tools/core';
|
|
82
|
+
* export function Load({ load }: { load: () => Promise<string> }) {
|
|
83
|
+
* const task = useAsyncWithTimeout({ fn: load, timeout: 10000 });
|
|
84
|
+
* return <button disabled={task.isLoading} onClick={() => { void task.execute(); }}>{task.data ?? 'Load'}</button>;
|
|
85
|
+
* }
|
|
44
86
|
* ```
|
|
45
87
|
*/
|
|
46
88
|
export declare function useAsyncWithTimeout<T>(options: UseAsyncWithTimeoutOptions<T>): UseAsyncWithTimeoutReturn<T>;
|
|
47
89
|
/**
|
|
48
|
-
*
|
|
49
|
-
*
|
|
90
|
+
* Races an existing promise against a timeout rejection without cancelling either task.
|
|
91
|
+
* @typeParam T - Promise result shape.
|
|
92
|
+
* @param promise - Already-started host operation.
|
|
93
|
+
* @param timeout - Delay in milliseconds before TimeoutError rejection; defaults to 30000.
|
|
94
|
+
* @returns Original result if it wins the race.
|
|
95
|
+
* @throws Rejects with the original rejection or TimeoutError, whichever settles first.
|
|
96
|
+
* @remarks No React context is required. The timer is not cleared when the host promise
|
|
97
|
+
* settles; timeout does not abort the operation or roll back its effects.
|
|
98
|
+
* @example
|
|
99
|
+
* ```ts
|
|
100
|
+
* import { withTimeout } from '@alneas/appkit-react/tools/core';
|
|
101
|
+
* export function limited<T>(operation: Promise<T>) { return withTimeout(operation, 5000); }
|
|
102
|
+
* ```
|
|
50
103
|
*/
|
|
51
104
|
export declare function withTimeout<T>(promise: Promise<T>, timeout?: number): Promise<T>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAsyncWithTimeout.js","names":["DEFAULT_TIMEOUT","useAsyncWithTimeout","options","isLoading","setIsLoading","useState","error","setError","data","setData","useError","abortControllerRef","useRef","isMountedRef","useEffect","useCallback","timeoutPromise","TimeoutError","timeout","result","fn","onSuccess","err","appError","AppError","errorDisplayMode","showErrorOnFailure","showError","onError","withTimeout","promise"],"sources":["../../../../src/tools/lib/hooks/useAsyncWithTimeout.ts"],"sourcesContent":["import { useState, useCallback, useRef, useEffect } from 'react';\nimport { AppError, TimeoutError, ErrorDisplayMode } from \"../error\";\nimport { useError } from './useError';\n\n/**
|
|
1
|
+
{"version":3,"file":"useAsyncWithTimeout.js","names":["DEFAULT_TIMEOUT","useAsyncWithTimeout","options","isLoading","setIsLoading","useState","error","setError","data","setData","useError","abortControllerRef","useRef","isMountedRef","useEffect","useCallback","timeoutPromise","TimeoutError","timeout","result","fn","onSuccess","err","appError","AppError","errorDisplayMode","showErrorOnFailure","showError","onError","withTimeout","promise"],"sources":["../../../../src/tools/lib/hooks/useAsyncWithTimeout.ts"],"sourcesContent":["import { useState, useCallback, useRef, useEffect } from 'react';\nimport { AppError, TimeoutError, ErrorDisplayMode } from \"../error\";\nimport { useError } from './useError';\n\n/** Default timeout delay in milliseconds (30 seconds). */\nconst DEFAULT_TIMEOUT = 30000;\n\n/**\n * Host asynchronous operation and timeout/presentation settings.\n * @typeParam T - Operation result shape.\n * @see useAsyncWithTimeout for usage.\n */\nexport interface UseAsyncWithTimeoutOptions<T> {\n /**\n * Host operation invoked with no abort signal.\n * @returns Promise resolving the operation result; rejection is normalized by execute.\n */\n fn: () => Promise<T>;\n /**\n * Timeout in milliseconds; defaults to 30000. Does not cancel underlying work.\n */\n timeout?: number;\n /**\n * Display hint for newly wrapped errors; defaults to notification.\n */\n errorDisplayMode?: ErrorDisplayMode;\n /**\n * Add normalized failure to the shared error store; defaults to true.\n */\n showErrorOnFailure?: boolean;\n /**\n * Optional synchronous callback after a mounted success; errors are handled as execution failures.\n * @param data - Resolved operation result.\n * @returns No value.\n */\n onSuccess?: (data: T) => void;\n /**\n * Optional synchronous callback after mounted failure normalization/presentation.\n * @param error - Normalized AppError.\n * @returns No value; thrown callback errors reject execute.\n */\n onError?: (error: AppError) => void;\n}\n\n/**\n * Last result/status with explicit execute/reset controls.\n * @typeParam T - Host operation result shape.\n * @see useAsyncWithTimeout for usage.\n */\nexport interface UseAsyncWithTimeoutReturn<T> {\n /**\n * Race a new host operation against a timeout.\n * @returns Host result on success, or undefined on handled failure/unmounted rejection.\n * @throws Errors from onError/error-presentation callbacks may reject.\n */\n execute: () => Promise<T | undefined>;\n /**\n * Whether execute last set pending state; overlapping completions can overwrite this flag.\n */\n isLoading: boolean;\n /**\n * Most recent mounted execution failure or null.\n */\n error: AppError | null;\n /**\n * Last mounted success, initially undefined; errors do not clear prior data.\n */\n data: T | undefined;\n /**\n * Clear displayed loading/error/data state.\n * @returns No value; in-flight host work can still finish and update state on this mount.\n */\n reset: () => void;\n}\n\n/**\n * Runs explicit asynchronous work against a display timeout and tracks the last completion.\n * @typeParam T - Host operation result shape.\n * @param options - Host operation, timeout, presentation settings and synchronous outcome callbacks.\n * @returns Execute/reset controls and displayed loading, result and normalized error state.\n * @remarks Requires React and the shared error store; no context or styles are required by\n * the hook. The internal AbortController is never passed to fn: new executes, reset and\n * unmount do not cancel host work. Unmount suppresses state/callback updates; overlapping\n * operations on one mount can complete out of order. Timeout timers are not cleared on\n * settlement. onSuccess errors enter failure handling; onError errors may reject execute.\n * To display errors, mount a host renderer for useError's shared store.\n * @example\n * ```tsx\n * import { useAsyncWithTimeout } from '@alneas/appkit-react/tools/core';\n * export function Load({ load }: { load: () => Promise<string> }) {\n * const task = useAsyncWithTimeout({ fn: load, timeout: 10000 });\n * return <button disabled={task.isLoading} onClick={() => { void task.execute(); }}>{task.data ?? 'Load'}</button>;\n * }\n * ```\n */\nexport function useAsyncWithTimeout<T>(\n options: UseAsyncWithTimeoutOptions<T>,\n): UseAsyncWithTimeoutReturn<T> {\n const {\n fn,\n timeout = DEFAULT_TIMEOUT,\n errorDisplayMode = 'notification',\n showErrorOnFailure = true,\n onSuccess,\n onError,\n } = options;\n\n const [isLoading, setIsLoading] = useState(false);\n const [error, setError] = useState<AppError | null>(null);\n const [data, setData] = useState<T | undefined>(undefined);\n\n const { showError } = useError();\n const abortControllerRef = useRef<AbortController | null>(null);\n const isMountedRef = useRef(true);\n\n // コンポーネントのアンマウント時にクリーンアップ\n useEffect(() => {\n isMountedRef.current = true;\n return () => {\n isMountedRef.current = false;\n abortControllerRef.current?.abort();\n };\n }, []);\n\n const execute = useCallback(async (): Promise<T | undefined> => {\n // 既存のリクエストをキャンセル\n abortControllerRef.current?.abort();\n abortControllerRef.current = new AbortController();\n\n setIsLoading(true);\n setError(null);\n\n // タイムアウト用のPromise\n const timeoutPromise = new Promise<never>((_, reject) => {\n setTimeout(() => {\n reject(new TimeoutError('The operation timed out', timeout));\n }, timeout);\n });\n\n try {\n // fetchとtimeoutのレース\n const result = await Promise.race([fn(), timeoutPromise]);\n\n if (isMountedRef.current) {\n setData(result);\n setIsLoading(false);\n onSuccess?.(result);\n }\n\n return result;\n } catch (err) {\n if (!isMountedRef.current) return undefined;\n\n const appError = AppError.from(err, errorDisplayMode);\n setError(appError);\n setIsLoading(false);\n\n if (showErrorOnFailure) {\n showError(appError);\n }\n\n onError?.(appError);\n return undefined;\n }\n }, [fn, timeout, errorDisplayMode, showErrorOnFailure, showError, onSuccess, onError]);\n\n const reset = useCallback(() => {\n setIsLoading(false);\n setError(null);\n setData(undefined);\n abortControllerRef.current?.abort();\n }, []);\n\n return {\n execute,\n isLoading,\n error,\n data,\n reset,\n };\n}\n\n/**\n * Races an existing promise against a timeout rejection without cancelling either task.\n * @typeParam T - Promise result shape.\n * @param promise - Already-started host operation.\n * @param timeout - Delay in milliseconds before TimeoutError rejection; defaults to 30000.\n * @returns Original result if it wins the race.\n * @throws Rejects with the original rejection or TimeoutError, whichever settles first.\n * @remarks No React context is required. The timer is not cleared when the host promise\n * settles; timeout does not abort the operation or roll back its effects.\n * @example\n * ```ts\n * import { withTimeout } from '@alneas/appkit-react/tools/core';\n * export function limited<T>(operation: Promise<T>) { return withTimeout(operation, 5000); }\n * ```\n */\nexport async function withTimeout<T>(\n promise: Promise<T>,\n timeout: number = DEFAULT_TIMEOUT,\n): Promise<T> {\n const timeoutPromise = new Promise<never>((_, reject) => {\n setTimeout(() => {\n reject(new TimeoutError('The operation timed out', timeout));\n }, timeout);\n });\n\n return Promise.race([promise, timeoutPromise]);\n}\n"],"mappings":";;;;;AAKA,IAAMA,IAAkB;AA0FxB,SAAgBC,EACd,GAC8B;CAC9B,IAAM,EACJ,OACA,aAAUD,GACV,sBAAmB,gBACnB,wBAAqB,IACrB,cACA,eACEE,GAEE,CAACC,GAAWC,KAAgBC,EAAS,EAAK,GAC1C,CAACC,GAAOC,KAAYF,EAA0B,IAAI,GAClD,CAACG,GAAMC,KAAWJ,EAAwB,KAAA,CAAS,GAEnD,EAAE,iBAAcK,EAAS,GACzBC,IAAqBC,EAA+B,IAAI,GACxDC,IAAeD,EAAO,EAAI;CA4DhC,OAzDAE,SACE,EAAa,UAAU,UACV;EAEX,AADA,EAAa,UAAU,IACvBH,EAAmB,SAAS,MAAM;CACpC,IACC,CAAC,CAAC,GAmDE;EACL,SAlDcI,EAAY,YAAoC;GAM9D,AAJAJ,EAAmB,SAAS,MAAM,GAClC,EAAmB,UAAU,IAAI,gBAAgB,GAEjDP,EAAa,EAAI,GACjBG,EAAS,IAAI;GAGb,IAAMS,IAAiB,IAAI,SAAgB,GAAG,MAAW;IACvD,iBAAiB;KACf,EAAO,IAAIC,EAAa,2BAA2BC,CAAO,CAAC;IAC7D,GAAGA,CAAO;GACZ,CAAC;GAED,IAAI;IAEF,IAAMC,IAAS,MAAM,QAAQ,KAAK,CAACC,EAAG,GAAGJ,CAAc,CAAC;IAQxD,OANIH,EAAa,YACfJ,EAAQU,CAAM,GACdf,EAAa,EAAK,GAClBiB,IAAYF,CAAM,IAGbA;GACT,SAASG,GAAK;IACZ,IAAI,CAACT,EAAa,SAAS;IAE3B,IAAMU,IAAWC,EAAS,KAAKF,GAAKG,CAAgB;IAQpD,AAPAlB,EAASgB,CAAQ,GACjBnB,EAAa,EAAK,GAEdsB,KACFC,EAAUJ,CAAQ,GAGpBK,IAAUL,CAAQ;IAClB;GACF;EACF,GAAG;GAACH;GAAIF;GAASO;GAAkBC;GAAoBC;GAAWN;GAAWO;EAAO,CAUlF;EACA;EACA;EACA;EACA,OAZYb,QAAkB;GAI9B,AAHAX,EAAa,EAAK,GAClBG,EAAS,IAAI,GACbE,EAAQ,KAAA,CAAS,GACjBE,EAAmB,SAAS,MAAM;EACpC,GAAG,CAAC,CAOF;CACF;AACF;AAiBA,eAAsBkB,EACpB,GACA,IAAkB7B,GACN;CACZ,IAAMgB,IAAiB,IAAI,SAAgB,GAAG,MAAW;EACvD,iBAAiB;GACf,EAAO,IAAIC,EAAa,2BAA2BC,CAAO,CAAC;EAC7D,GAAGA,CAAO;CACZ,CAAC;CAED,OAAO,QAAQ,KAAK,CAACY,GAASd,CAAc,CAAC;AAC/C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useError.cjs","names":["useErrorStore","useCallback","AppError","m","require_messages","require_tools_lib_error_AppError","require_tools_lib_state_error_store","react","useError","appError","error","showOptions","options","addError","i18nKey","code","messageFunc","message","removeError","id","clearErrors"],"sources":["../../../../src/tools/lib/hooks/useError.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport * as m from '../../paraglide/messages.js';\nimport { AppError, ErrorDisplayMode } from \"../error\";\nimport { useErrorStore } from \"../state/error-store\";\n\nexport interface UseErrorOptions {\n
|
|
1
|
+
{"version":3,"file":"useError.cjs","names":["useErrorStore","useCallback","AppError","m","require_messages","require_tools_lib_error_AppError","require_tools_lib_state_error_store","react","useError","appError","error","showOptions","options","addError","i18nKey","code","messageFunc","message","removeError","id","clearErrors"],"sources":["../../../../src/tools/lib/hooks/useError.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport * as m from '../../paraglide/messages.js';\nimport { AppError, ErrorDisplayMode } from \"../error\";\nimport { useErrorStore } from \"../state/error-store\";\n\n/**\n * Default normalization and queued-error lifetime settings.\n * @see useError for usage.\n */\nexport interface UseErrorOptions {\n /**\n * Default hint for newly wrapped errors; omission uses notification. Existing AppError values retain their own mode.\n */\n defaultDisplayMode?: ErrorDisplayMode;\n /**\n * Default positive removal delay in milliseconds; omission leaves errors queued.\n */\n defaultAutoDismiss?: number;\n}\n\n/**\n * Per-call display/lifetime overrides for queued errors.\n * @see useError for usage.\n */\nexport interface ShowErrorOptions {\n /**\n * Per-call hint for newly wrapped errors; does not override an existing AppError instance.\n */\n displayMode?: ErrorDisplayMode;\n /**\n * Per-call removal delay in milliseconds, overriding the default when non-nullish; positive values schedule removal.\n */\n autoDismiss?: number;\n}\n\n/**\n * Normalizes unknown errors and manages their entries in the shared error queue.\n * @param options - Optional default display hint and auto-dismiss delay.\n * @returns Queue, display/filter/message helpers and individual/all removal controls.\n * @remarks Requires React; no provider or CSS is needed by the hook. A host renderer must\n * display queued errors. Existing AppError values retain their mode even when a display\n * option is supplied. Code localization replaces slash/dot with underscores; unsupported\n * message keys fall back to the code. State/timers belong to the module, not this hook.\n * @example\n * ```tsx\n * import { useError } from '@alneas/appkit-react/tools/core';\n * export function Report({ failure }: { failure: unknown }) { const { showError } = useError(); return <button onClick={() => showError(failure)}>Report</button>; }\n * ```\n */\nexport function useError(options?: UseErrorOptions) {\n const { addError, removeError, clearErrors, errors, getErrorsByMode } = useErrorStore();\n\n /**\n * Normalize and enqueue an unknown error.\n * @param error - AppError, Error or arbitrary thrown value.\n * @param showOptions - Optional display hint and removal delay.\n * @returns Generated error ID.\n * @example\n * ```tsx\n * import { useError } from '@alneas/appkit-react/tools/core';\n * export function Controls() { const errors = useError(); return <button onClick={() => errors.showError(new Error('Unavailable'))}>Error action</button>; }\n * ```\n */\n const showError = useCallback(\n (error: unknown, showOptions?: ShowErrorOptions): string => {\n const appError = AppError.from(\n error,\n showOptions?.displayMode ?? options?.defaultDisplayMode,\n );\n\n return addError(appError, {\n autoDismiss: showOptions?.autoDismiss ?? options?.defaultAutoDismiss,\n });\n },\n [addError, options?.defaultDisplayMode, options?.defaultAutoDismiss],\n );\n\n /**\n * Enqueue a new AppError using a localized code lookup.\n * @param code - Host error code; unknown codes are displayed unchanged.\n * @param showOptions - Optional display hint and removal delay.\n * @returns Generated error ID.\n * @example\n * ```tsx\n * import { useError } from '@alneas/appkit-react/tools/core';\n * export function Controls() { const errors = useError(); return <button onClick={() => errors.showErrorByCode('error/example')}>Error action</button>; }\n * ```\n */\n const showErrorByCode = useCallback(\n (code: string, showOptions?: ShowErrorOptions & {\n /** Per-call display hint, defaulting to hook settings then notification. */\n displayMode?: ErrorDisplayMode;\n }): string => {\n // i18n からメッセージを取得 (見つからなければコードをそのまま使用)\n // code format example: \"auth/user-not-found\" -> \"errors_auth_user_not_found\"\n const i18nKey = `errors_${code.replace(/[/.]/g, '_')}`;\n const messageFunc = (m as unknown as Record<string, () => string>)[i18nKey];\n const message = typeof messageFunc === 'function' ? messageFunc() : code;\n\n const appError = new AppError(code, message, {\n displayMode: showOptions?.displayMode ?? options?.defaultDisplayMode ?? 'notification',\n });\n\n return addError(appError, {\n autoDismiss: showOptions?.autoDismiss ?? options?.defaultAutoDismiss,\n });\n },\n [addError, options?.defaultDisplayMode, options?.defaultAutoDismiss],\n );\n\n /**\n * Resolve the current localized error message without queuing it.\n * @param code - Error code mapped by replacing slash/dot with underscores.\n * @returns Localized message or the original code when no message function exists.\n * @example\n * ```tsx\n * import { useError } from '@alneas/appkit-react/tools/core';\n * export function Controls() { const errors = useError(); return <button onClick={() => console.log(errors.getErrorMessage('error/example'))}>Error action</button>; }\n * ```\n */\n const getErrorMessage = useCallback((code: string): string => {\n const i18nKey = `errors_${code.replace(/[/.]/g, '_')}`;\n const messageFunc = (m as unknown as Record<string, () => string>)[i18nKey];\n return typeof messageFunc === 'function' ? messageFunc() : code;\n }, []);\n\n /**\n * Remove one error from the queue.\n * @param id - Generated error ID; unknown IDs are ignored.\n * @returns No value after removal.\n * @example\n * ```tsx\n * import { useError } from '@alneas/appkit-react/tools/core';\n * export function Controls() { const errors = useError(); return <button onClick={() => errors.clearError('host-selected-id')}>Error action</button>; }\n * ```\n */\n const clearError = useCallback(\n (id: string) => {\n removeError(id);\n },\n [removeError],\n );\n\n /**\n * Remove all currently queued errors.\n * @returns No value; scheduled timers remain harmlessly pending.\n * @example\n * ```tsx\n * import { useError } from '@alneas/appkit-react/tools/core';\n * export function Controls() { const errors = useError(); return <button onClick={() => errors.clearAll()}>Error action</button>; }\n * ```\n */\n const clearAll = useCallback(() => {\n clearErrors();\n }, [clearErrors]);\n\n return {\n/**\n * Normalize and queue errors; see the local showError declaration for argument/result details.\n */\n showError,\n/**\n * Queue a localized code; see the local showErrorByCode declaration.\n */\n showErrorByCode,\n/**\n * Look up localized text; see the local getErrorMessage declaration.\n */\n getErrorMessage,\n/**\n * Remove an error by ID; see the local clearError declaration.\n */\n clearError,\n/**\n * Clear queued errors; see the local clearAll declaration.\n */\n clearAll,\n/**\n * Current errors in insertion order.\n */\n errors,\n/**\n * Current store filter operation; see ErrorState.getErrorsByMode.\n */\n getErrorsByMode,\n };\n}\n"],"mappings":"A,gOAiDA,SAAgBQ,EAAS,EAA2B,CAClD,GAAM,CAAE,WAAU,cAAa,cAAa,SAAQ,mBAAoBR,EAAAA,cAAc,EA0GtF,MAAO,CAIL,WAAA,EAjGgBC,EAAAA,YAAAA,EACf,EAAgB,IAA2C,CAC1D,IAAMQ,EAAWP,EAAAA,SAAS,KACxBQ,EACAC,GAAa,aAAeC,GAAS,kBACvC,EAEA,OAAOC,EAASJ,EAAU,CACxB,YAAaE,GAAa,aAAeC,GAAS,kBACpD,CAAC,CACH,EACA,CAACC,EAAUD,GAAS,mBAAoBA,GAAS,kBAAkB,CAsFnE,EAIA,iBAAA,EA5EsBX,EAAAA,YAAAA,EACrB,EAAc,IAGD,CAGZ,IAAMa,EAAU,UAAUC,EAAK,QAAQ,QAAS,GAAG,IAC7CC,EAAeb,EAAAA,iBAA8CW,GAC7DG,EAAU,OAAOD,GAAgB,WAAaA,EAAY,EAAID,EAE9DN,EAAW,IAAIP,EAAAA,SAASa,EAAME,EAAS,CAC3C,YAAaN,GAAa,aAAeC,GAAS,oBAAsB,cAC1E,CAAC,EAED,OAAOC,EAASJ,EAAU,CACxB,YAAaE,GAAa,aAAeC,GAAS,kBACpD,CAAC,CACH,EACA,CAACC,EAAUD,GAAS,mBAAoBA,GAAS,kBAAkB,CAyDnE,EAIA,iBAAA,EAhDsBX,EAAAA,YAAAA,CAAa,GAAyB,CAC5D,IAAMa,EAAU,UAAUC,EAAK,QAAQ,QAAS,GAAG,IAC7CC,EAAeb,EAAAA,iBAA8CW,GACnE,OAAO,OAAOE,GAAgB,WAAaA,EAAY,EAAID,CAC7D,EAAG,CAAC,CA4CF,EAIA,YAAA,EApCiBd,EAAAA,YAAAA,CAChB,GAAe,CACdiB,EAAYC,CAAE,CAChB,EACA,CAACD,CAAW,CAgCZ,EAIA,UAAA,EAxBejB,EAAAA,YAAAA,KAAkB,CACjCmB,EAAY,CACd,EAAG,CAACA,CAAW,CAsBb,EAIA,SAIA,iBACF,CACF,C"}
|
|
@@ -1,41 +1,76 @@
|
|
|
1
1
|
import { ErrorDisplayMode } from '../error/index.cjs';
|
|
2
|
+
/**
|
|
3
|
+
* Default normalization and queued-error lifetime settings.
|
|
4
|
+
* @see useError for usage.
|
|
5
|
+
*/
|
|
2
6
|
export interface UseErrorOptions {
|
|
3
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Default hint for newly wrapped errors; omission uses notification. Existing AppError values retain their own mode.
|
|
9
|
+
*/
|
|
4
10
|
defaultDisplayMode?: ErrorDisplayMode;
|
|
5
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Default positive removal delay in milliseconds; omission leaves errors queued.
|
|
13
|
+
*/
|
|
6
14
|
defaultAutoDismiss?: number;
|
|
7
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Per-call display/lifetime overrides for queued errors.
|
|
18
|
+
* @see useError for usage.
|
|
19
|
+
*/
|
|
8
20
|
export interface ShowErrorOptions {
|
|
9
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* Per-call hint for newly wrapped errors; does not override an existing AppError instance.
|
|
23
|
+
*/
|
|
10
24
|
displayMode?: ErrorDisplayMode;
|
|
11
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* Per-call removal delay in milliseconds, overriding the default when non-nullish; positive values schedule removal.
|
|
27
|
+
*/
|
|
12
28
|
autoDismiss?: number;
|
|
13
29
|
}
|
|
14
30
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
31
|
+
* Normalizes unknown errors and manages their entries in the shared error queue.
|
|
32
|
+
* @param options - Optional default display hint and auto-dismiss delay.
|
|
33
|
+
* @returns Queue, display/filter/message helpers and individual/all removal controls.
|
|
34
|
+
* @remarks Requires React; no provider or CSS is needed by the hook. A host renderer must
|
|
35
|
+
* display queued errors. Existing AppError values retain their mode even when a display
|
|
36
|
+
* option is supplied. Code localization replaces slash/dot with underscores; unsupported
|
|
37
|
+
* message keys fall back to the code. State/timers belong to the module, not this hook.
|
|
17
38
|
* @example
|
|
18
39
|
* ```tsx
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* // AppError を表示
|
|
22
|
-
* showError(new AppError('auth/user-not-found', 'Not found'));
|
|
23
|
-
*
|
|
24
|
-
* // エラーコードから表示
|
|
25
|
-
* showErrorByCode('auth/wrong-password');
|
|
26
|
-
*
|
|
27
|
-
* // 任意のエラーを表示 (自動変換)
|
|
28
|
-
* showError(unknownError);
|
|
40
|
+
* import { useError } from '@alneas/appkit-react/tools/core';
|
|
41
|
+
* export function Report({ failure }: { failure: unknown }) { const { showError } = useError(); return <button onClick={() => showError(failure)}>Report</button>; }
|
|
29
42
|
* ```
|
|
30
43
|
*/
|
|
31
44
|
export declare function useError(options?: UseErrorOptions): {
|
|
45
|
+
/**
|
|
46
|
+
* Normalize and queue errors; see the local showError declaration for argument/result details.
|
|
47
|
+
*/
|
|
32
48
|
showError: (error: unknown, showOptions?: ShowErrorOptions) => string;
|
|
49
|
+
/**
|
|
50
|
+
* Queue a localized code; see the local showErrorByCode declaration.
|
|
51
|
+
*/
|
|
33
52
|
showErrorByCode: (code: string, showOptions?: ShowErrorOptions & {
|
|
53
|
+
/** Per-call display hint, defaulting to hook settings then notification. */
|
|
34
54
|
displayMode?: ErrorDisplayMode;
|
|
35
55
|
}) => string;
|
|
56
|
+
/**
|
|
57
|
+
* Look up localized text; see the local getErrorMessage declaration.
|
|
58
|
+
*/
|
|
36
59
|
getErrorMessage: (code: string) => string;
|
|
60
|
+
/**
|
|
61
|
+
* Remove an error by ID; see the local clearError declaration.
|
|
62
|
+
*/
|
|
37
63
|
clearError: (id: string) => void;
|
|
64
|
+
/**
|
|
65
|
+
* Clear queued errors; see the local clearAll declaration.
|
|
66
|
+
*/
|
|
38
67
|
clearAll: () => void;
|
|
68
|
+
/**
|
|
69
|
+
* Current errors in insertion order.
|
|
70
|
+
*/
|
|
39
71
|
errors: import('../state/error-store.cjs').ErrorItem[];
|
|
72
|
+
/**
|
|
73
|
+
* Current store filter operation; see ErrorState.getErrorsByMode.
|
|
74
|
+
*/
|
|
40
75
|
getErrorsByMode: (mode: ErrorDisplayMode) => import('../state/error-store.cjs').ErrorItem[];
|
|
41
76
|
};
|
|
@@ -1,41 +1,76 @@
|
|
|
1
1
|
import { ErrorDisplayMode } from '../error/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Default normalization and queued-error lifetime settings.
|
|
4
|
+
* @see useError for usage.
|
|
5
|
+
*/
|
|
2
6
|
export interface UseErrorOptions {
|
|
3
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Default hint for newly wrapped errors; omission uses notification. Existing AppError values retain their own mode.
|
|
9
|
+
*/
|
|
4
10
|
defaultDisplayMode?: ErrorDisplayMode;
|
|
5
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Default positive removal delay in milliseconds; omission leaves errors queued.
|
|
13
|
+
*/
|
|
6
14
|
defaultAutoDismiss?: number;
|
|
7
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Per-call display/lifetime overrides for queued errors.
|
|
18
|
+
* @see useError for usage.
|
|
19
|
+
*/
|
|
8
20
|
export interface ShowErrorOptions {
|
|
9
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* Per-call hint for newly wrapped errors; does not override an existing AppError instance.
|
|
23
|
+
*/
|
|
10
24
|
displayMode?: ErrorDisplayMode;
|
|
11
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* Per-call removal delay in milliseconds, overriding the default when non-nullish; positive values schedule removal.
|
|
27
|
+
*/
|
|
12
28
|
autoDismiss?: number;
|
|
13
29
|
}
|
|
14
30
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
31
|
+
* Normalizes unknown errors and manages their entries in the shared error queue.
|
|
32
|
+
* @param options - Optional default display hint and auto-dismiss delay.
|
|
33
|
+
* @returns Queue, display/filter/message helpers and individual/all removal controls.
|
|
34
|
+
* @remarks Requires React; no provider or CSS is needed by the hook. A host renderer must
|
|
35
|
+
* display queued errors. Existing AppError values retain their mode even when a display
|
|
36
|
+
* option is supplied. Code localization replaces slash/dot with underscores; unsupported
|
|
37
|
+
* message keys fall back to the code. State/timers belong to the module, not this hook.
|
|
17
38
|
* @example
|
|
18
39
|
* ```tsx
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* // AppError を表示
|
|
22
|
-
* showError(new AppError('auth/user-not-found', 'Not found'));
|
|
23
|
-
*
|
|
24
|
-
* // エラーコードから表示
|
|
25
|
-
* showErrorByCode('auth/wrong-password');
|
|
26
|
-
*
|
|
27
|
-
* // 任意のエラーを表示 (自動変換)
|
|
28
|
-
* showError(unknownError);
|
|
40
|
+
* import { useError } from '@alneas/appkit-react/tools/core';
|
|
41
|
+
* export function Report({ failure }: { failure: unknown }) { const { showError } = useError(); return <button onClick={() => showError(failure)}>Report</button>; }
|
|
29
42
|
* ```
|
|
30
43
|
*/
|
|
31
44
|
export declare function useError(options?: UseErrorOptions): {
|
|
45
|
+
/**
|
|
46
|
+
* Normalize and queue errors; see the local showError declaration for argument/result details.
|
|
47
|
+
*/
|
|
32
48
|
showError: (error: unknown, showOptions?: ShowErrorOptions) => string;
|
|
49
|
+
/**
|
|
50
|
+
* Queue a localized code; see the local showErrorByCode declaration.
|
|
51
|
+
*/
|
|
33
52
|
showErrorByCode: (code: string, showOptions?: ShowErrorOptions & {
|
|
53
|
+
/** Per-call display hint, defaulting to hook settings then notification. */
|
|
34
54
|
displayMode?: ErrorDisplayMode;
|
|
35
55
|
}) => string;
|
|
56
|
+
/**
|
|
57
|
+
* Look up localized text; see the local getErrorMessage declaration.
|
|
58
|
+
*/
|
|
36
59
|
getErrorMessage: (code: string) => string;
|
|
60
|
+
/**
|
|
61
|
+
* Remove an error by ID; see the local clearError declaration.
|
|
62
|
+
*/
|
|
37
63
|
clearError: (id: string) => void;
|
|
64
|
+
/**
|
|
65
|
+
* Clear queued errors; see the local clearAll declaration.
|
|
66
|
+
*/
|
|
38
67
|
clearAll: () => void;
|
|
68
|
+
/**
|
|
69
|
+
* Current errors in insertion order.
|
|
70
|
+
*/
|
|
39
71
|
errors: import('../state/error-store.js').ErrorItem[];
|
|
72
|
+
/**
|
|
73
|
+
* Current store filter operation; see ErrorState.getErrorsByMode.
|
|
74
|
+
*/
|
|
40
75
|
getErrorsByMode: (mode: ErrorDisplayMode) => import('../state/error-store.js').ErrorItem[];
|
|
41
76
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useError.js","names":["m","useError","useErrorStore","useCallback","appError","AppError","error","showOptions","options","addError","i18nKey","code","messageFunc","messages_exports","message","id","removeError","clearErrors"],"sources":["../../../../src/tools/lib/hooks/useError.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport * as m from '../../paraglide/messages.js';\nimport { AppError, ErrorDisplayMode } from \"../error\";\nimport { useErrorStore } from \"../state/error-store\";\n\nexport interface UseErrorOptions {\n
|
|
1
|
+
{"version":3,"file":"useError.js","names":["m","useError","useErrorStore","useCallback","appError","AppError","error","showOptions","options","addError","i18nKey","code","messageFunc","messages_exports","message","id","removeError","clearErrors"],"sources":["../../../../src/tools/lib/hooks/useError.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport * as m from '../../paraglide/messages.js';\nimport { AppError, ErrorDisplayMode } from \"../error\";\nimport { useErrorStore } from \"../state/error-store\";\n\n/**\n * Default normalization and queued-error lifetime settings.\n * @see useError for usage.\n */\nexport interface UseErrorOptions {\n /**\n * Default hint for newly wrapped errors; omission uses notification. Existing AppError values retain their own mode.\n */\n defaultDisplayMode?: ErrorDisplayMode;\n /**\n * Default positive removal delay in milliseconds; omission leaves errors queued.\n */\n defaultAutoDismiss?: number;\n}\n\n/**\n * Per-call display/lifetime overrides for queued errors.\n * @see useError for usage.\n */\nexport interface ShowErrorOptions {\n /**\n * Per-call hint for newly wrapped errors; does not override an existing AppError instance.\n */\n displayMode?: ErrorDisplayMode;\n /**\n * Per-call removal delay in milliseconds, overriding the default when non-nullish; positive values schedule removal.\n */\n autoDismiss?: number;\n}\n\n/**\n * Normalizes unknown errors and manages their entries in the shared error queue.\n * @param options - Optional default display hint and auto-dismiss delay.\n * @returns Queue, display/filter/message helpers and individual/all removal controls.\n * @remarks Requires React; no provider or CSS is needed by the hook. A host renderer must\n * display queued errors. Existing AppError values retain their mode even when a display\n * option is supplied. Code localization replaces slash/dot with underscores; unsupported\n * message keys fall back to the code. State/timers belong to the module, not this hook.\n * @example\n * ```tsx\n * import { useError } from '@alneas/appkit-react/tools/core';\n * export function Report({ failure }: { failure: unknown }) { const { showError } = useError(); return <button onClick={() => showError(failure)}>Report</button>; }\n * ```\n */\nexport function useError(options?: UseErrorOptions) {\n const { addError, removeError, clearErrors, errors, getErrorsByMode } = useErrorStore();\n\n /**\n * Normalize and enqueue an unknown error.\n * @param error - AppError, Error or arbitrary thrown value.\n * @param showOptions - Optional display hint and removal delay.\n * @returns Generated error ID.\n * @example\n * ```tsx\n * import { useError } from '@alneas/appkit-react/tools/core';\n * export function Controls() { const errors = useError(); return <button onClick={() => errors.showError(new Error('Unavailable'))}>Error action</button>; }\n * ```\n */\n const showError = useCallback(\n (error: unknown, showOptions?: ShowErrorOptions): string => {\n const appError = AppError.from(\n error,\n showOptions?.displayMode ?? options?.defaultDisplayMode,\n );\n\n return addError(appError, {\n autoDismiss: showOptions?.autoDismiss ?? options?.defaultAutoDismiss,\n });\n },\n [addError, options?.defaultDisplayMode, options?.defaultAutoDismiss],\n );\n\n /**\n * Enqueue a new AppError using a localized code lookup.\n * @param code - Host error code; unknown codes are displayed unchanged.\n * @param showOptions - Optional display hint and removal delay.\n * @returns Generated error ID.\n * @example\n * ```tsx\n * import { useError } from '@alneas/appkit-react/tools/core';\n * export function Controls() { const errors = useError(); return <button onClick={() => errors.showErrorByCode('error/example')}>Error action</button>; }\n * ```\n */\n const showErrorByCode = useCallback(\n (code: string, showOptions?: ShowErrorOptions & {\n /** Per-call display hint, defaulting to hook settings then notification. */\n displayMode?: ErrorDisplayMode;\n }): string => {\n // i18n からメッセージを取得 (見つからなければコードをそのまま使用)\n // code format example: \"auth/user-not-found\" -> \"errors_auth_user_not_found\"\n const i18nKey = `errors_${code.replace(/[/.]/g, '_')}`;\n const messageFunc = (m as unknown as Record<string, () => string>)[i18nKey];\n const message = typeof messageFunc === 'function' ? messageFunc() : code;\n\n const appError = new AppError(code, message, {\n displayMode: showOptions?.displayMode ?? options?.defaultDisplayMode ?? 'notification',\n });\n\n return addError(appError, {\n autoDismiss: showOptions?.autoDismiss ?? options?.defaultAutoDismiss,\n });\n },\n [addError, options?.defaultDisplayMode, options?.defaultAutoDismiss],\n );\n\n /**\n * Resolve the current localized error message without queuing it.\n * @param code - Error code mapped by replacing slash/dot with underscores.\n * @returns Localized message or the original code when no message function exists.\n * @example\n * ```tsx\n * import { useError } from '@alneas/appkit-react/tools/core';\n * export function Controls() { const errors = useError(); return <button onClick={() => console.log(errors.getErrorMessage('error/example'))}>Error action</button>; }\n * ```\n */\n const getErrorMessage = useCallback((code: string): string => {\n const i18nKey = `errors_${code.replace(/[/.]/g, '_')}`;\n const messageFunc = (m as unknown as Record<string, () => string>)[i18nKey];\n return typeof messageFunc === 'function' ? messageFunc() : code;\n }, []);\n\n /**\n * Remove one error from the queue.\n * @param id - Generated error ID; unknown IDs are ignored.\n * @returns No value after removal.\n * @example\n * ```tsx\n * import { useError } from '@alneas/appkit-react/tools/core';\n * export function Controls() { const errors = useError(); return <button onClick={() => errors.clearError('host-selected-id')}>Error action</button>; }\n * ```\n */\n const clearError = useCallback(\n (id: string) => {\n removeError(id);\n },\n [removeError],\n );\n\n /**\n * Remove all currently queued errors.\n * @returns No value; scheduled timers remain harmlessly pending.\n * @example\n * ```tsx\n * import { useError } from '@alneas/appkit-react/tools/core';\n * export function Controls() { const errors = useError(); return <button onClick={() => errors.clearAll()}>Error action</button>; }\n * ```\n */\n const clearAll = useCallback(() => {\n clearErrors();\n }, [clearErrors]);\n\n return {\n/**\n * Normalize and queue errors; see the local showError declaration for argument/result details.\n */\n showError,\n/**\n * Queue a localized code; see the local showErrorByCode declaration.\n */\n showErrorByCode,\n/**\n * Look up localized text; see the local getErrorMessage declaration.\n */\n getErrorMessage,\n/**\n * Remove an error by ID; see the local clearError declaration.\n */\n clearError,\n/**\n * Clear queued errors; see the local clearAll declaration.\n */\n clearAll,\n/**\n * Current errors in insertion order.\n */\n errors,\n/**\n * Current store filter operation; see ErrorState.getErrorsByMode.\n */\n getErrorsByMode,\n };\n}\n"],"mappings":";;;;;;AAiDA,SAAgBC,EAAS,GAA2B;CAClD,IAAM,EAAE,aAAU,gBAAa,gBAAa,WAAQ,uBAAoBC,EAAc;CA0GtF,OAAO;EAIL,WAjGgBC,GACf,GAAgB,MAA2C;GAC1D,IAAMC,IAAWC,EAAS,KACxBC,GACAC,GAAa,eAAeC,GAAS,kBACvC;GAEA,OAAOC,EAASL,GAAU,EACxB,aAAaG,GAAa,eAAeC,GAAS,mBACpD,CAAC;EACH,GACA;GAACC;GAAUD,GAAS;GAAoBA,GAAS;EAAkB,CAsFnE;EAIA,iBA5EsBL,GACrB,GAAc,MAGD;GAGZ,IAAMO,IAAU,UAAUC,EAAK,QAAQ,SAAS,GAAG,KAC7CC,IAAeZ,EAA8CU,IAC7DI,IAAU,OAAOF,KAAgB,aAAaA,EAAY,IAAID,GAE9DP,IAAW,IAAIC,EAASM,GAAMG,GAAS,EAC3C,aAAaP,GAAa,eAAeC,GAAS,sBAAsB,eAC1E,CAAC;GAED,OAAOC,EAASL,GAAU,EACxB,aAAaG,GAAa,eAAeC,GAAS,mBACpD,CAAC;EACH,GACA;GAACC;GAAUD,GAAS;GAAoBA,GAAS;EAAkB,CAyDnE;EAIA,iBAhDsBL,GAAa,MAAyB;GAC5D,IAAMO,IAAU,UAAUC,EAAK,QAAQ,SAAS,GAAG,KAC7CC,IAAeZ,EAA8CU;GACnE,OAAO,OAAOE,KAAgB,aAAaA,EAAY,IAAID;EAC7D,GAAG,CAAC,CA4CF;EAIA,YApCiBR,GAChB,MAAe;GACd,EAAYY,CAAE;EAChB,GACA,CAACC,CAAW,CAgCZ;EAIA,UAxBeb,QAAkB;GACjC,EAAY;EACd,GAAG,CAACc,CAAW,CAsBb;EAIA;EAIA;CACF;AACF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../paraglide/runtime.cjs");let t=require("@alneas/appkit-core/data");function n(n,r={}){let i=(0,t.createAjvValidator)(r);return async a=>{let o=r.locale||(typeof window<`u`?e.getLocale():`ja`),s=r.cast?(0,t.castValuesBySchema)(a,n,r.cast):a,c=r.emptyStrings===`preserve`?s:Object.fromEntries(Object.entries(s).map(([e,t])=>[e,t===``?void 0:t])),{valid:l,rawErrors:u}=i(n,c,{...r,locale:o});if(l)return{values:c,errors:{}};let d={};return u?.forEach(e=>{let t=(e.instancePath?e.instancePath.substring(1).split(`/`):[]).map(e=>e.replace(/~1/g,`/`).replace(/~0/g,`~`));e.keyword===`required`&&e.params?.missingProperty&&t.push(e.params.missingProperty);let n=t.length?t.flatMap(e=>e.split(`.`)):[`root`];if(n.some(e=>[`__proto__`,`constructor`,`prototype`].includes(e))){d.root={type:e.keyword,message:`Unsupported field path`};return}let r=d;for(let e of n.slice(0,-1))Object.hasOwn(r,e)||Object.defineProperty(r,e,{value:{},enumerable:!0,configurable:!0,writable:!0}),r=r[e];let i=n.at(-1);Object.hasOwn(r,i)||Object.defineProperty(r,i,{value:{message:e.message,type:e.keyword},enumerable:!0,configurable:!0})}),{values:{},errors:d}}}exports.createAjvResolver=n,Object.defineProperty(exports,"createAjvValidator",{enumerable:!0,get:function(){return t.createAjvValidator}});
|
|
1
|
+
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../paraglide/runtime.cjs");let t=require("@alneas/appkit-core/data");function n(n,r={}){let i=(0,t.createAjvValidator)(r);return async a=>{let o=r.locale||(typeof window<`u`?e.getLocale():`ja`),s=r.cast?(0,t.castValuesBySchema)(a,n,r.cast):a,c=r.emptyStrings===`preserve`?s:Object.fromEntries(Object.entries(s).map(([e,t])=>[e,t===``?void 0:t])),{valid:l,rawErrors:u}=i(n,c,{...r,locale:o});if(l)return{values:c,errors:{}};let d={};return u?.forEach(e=>{let t=(e.instancePath?e.instancePath.substring(1).split(`/`):[]).map(e=>e.replace(/~1/g,`/`).replace(/~0/g,`~`));e.keyword===`required`&&e.params?.missingProperty&&t.push(e.params.missingProperty);let n=t.length?t.flatMap(e=>e.split(`.`)):[`root`];if(n.some(e=>[`__proto__`,`constructor`,`prototype`].includes(e))){d.root={type:e.keyword,message:`Unsupported field path`};return}let r=d;for(let e of n.slice(0,-1))Object.hasOwn(r,e)||Object.defineProperty(r,e,{value:{},enumerable:!0,configurable:!0,writable:!0}),r=r[e];let i=n.at(-1);Object.hasOwn(r,i)||Object.defineProperty(r,i,{value:{message:e.message,type:e.keyword},enumerable:!0,configurable:!0,writable:!0})}),{values:{},errors:d}}}exports.createAjvResolver=n,Object.defineProperty(exports,"createAjvValidator",{enumerable:!0,get:function(){return t.createAjvValidator}});
|
|
2
2
|
//# sourceMappingURL=ajv.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ajv.cjs","names":["createAjvValidator","getLocale","castValuesBySchema","require_runtime","_alneas_appkit_core_data","createAjvResolver","validator","options","currentLocale","normalized","values","schema","processedValues","key","value","valid","errors","rawErrors","parts","error","part","keys","target","leaf"],"sources":["../../../../src/tools/lib/schema/ajv.ts"],"sourcesContent":["import { createAjvValidator, type AjvValidatorOptions } from \"@alneas/appkit-core/data\";\nimport type { FieldValues, ResolverResult, FieldErrors } from 'react-hook-form';\nimport { castValuesBySchema, type SchemaCastOptions } from \"@alneas/appkit-core/data\";\nimport { getLocale } from '../../paraglide/runtime.js';\nexport { createAjvValidator, type AjvValidatorOptions };\n\n
|
|
1
|
+
{"version":3,"file":"ajv.cjs","names":["createAjvValidator","getLocale","castValuesBySchema","require_runtime","_alneas_appkit_core_data","createAjvResolver","validator","options","currentLocale","normalized","values","schema","processedValues","key","value","valid","errors","rawErrors","parts","error","part","keys","target","leaf"],"sources":["../../../../src/tools/lib/schema/ajv.ts"],"sourcesContent":["import { createAjvValidator, type AjvValidatorOptions } from \"@alneas/appkit-core/data\";\nimport type { FieldValues, ResolverResult, FieldErrors } from 'react-hook-form';\nimport { castValuesBySchema, type SchemaCastOptions } from \"@alneas/appkit-core/data\";\nimport { getLocale } from '../../paraglide/runtime.js';\nexport { createAjvValidator, type AjvValidatorOptions };\n\n/**\n * JSON Schema validation/casting settings for React Hook Form.\n * @remarks Legacy top-level empty-string omission is default; preserve opts into ordinary schema validation.\n * @see createAjvResolver for usage.\n */\nexport interface SchemaFormValidationOptions extends AjvValidatorOptions {\n /** Preserve empty strings for ordinary JSON Schema validation, or omit top-level empty strings (legacy default). */\n emptyStrings?: 'preserve' | 'omit';\n /** Optional non-mutating numeric normalization before validation; strict rejects partial numbers. */\n cast?: SchemaCastOptions;\n}\n\n/**\n * Creates an asynchronous React Hook Form resolver using Core Ajv validation.\n * @typeParam T - Form values shape; defaults to FieldValues.\n * @param schema - JSON Schema accepted by Core validation.\n * @param options - Ajv options plus optional numeric casting and empty-string handling; defaults to {}.\n * @returns Resolver accepting values and optional ignored context/options, resolving normalized\n * values with no errors on success or empty values plus nested field errors on failure.\n * @throws Resolver rejects if schema compilation, casting or validator execution throws.\n * @remarks Optional cast runs first without mutating input. Unless emptyStrings is preserve,\n * top-level empty strings become undefined; nested empty strings are retained. Locale\n * uses options.locale, otherwise browser Paraglide locale, otherwise ja on the server.\n * Unsafe error-path keys map to a root error. No provider or CSS is required to create it.\n * @example\n * ```ts\n * import { createAjvResolver } from '@alneas/appkit-react/tools/form';\n * const resolver = createAjvResolver<{ hours: number }>({ type: 'object', properties: { hours: { type: 'number' } } }, { emptyStrings: 'preserve', cast: { numericMode: 'strict' } });\n * ```\n */\nexport function createAjvResolver<T extends FieldValues = FieldValues>(schema: object, options: SchemaFormValidationOptions = {}): (values: T, context?: unknown, resolverOptions?: unknown) => Promise<ResolverResult<T>> {\n const validator = createAjvValidator(options);\n\n return async (values) => {\n // Resolve current locale: priority is options.locale > paraglide.getLocale() > 'ja'\n const currentLocale = options.locale || (typeof window !== 'undefined' ? getLocale() : 'ja');\n\n // Pre-process values: convert empty strings to undefined.\n // This is necessary because React Hook Form often defaults to \"\" for text inputs,\n // which can trigger \"invalid format\" errors (e.g. for email) even if the field is not required.\n const normalized = options.cast ? castValuesBySchema(values, schema, options.cast) : values;\n const processedValues = options.emptyStrings === 'preserve' ? normalized : Object.fromEntries(\n Object.entries(normalized).map(([key, value]) => [key, value === '' ? undefined : value]),\n );\n\n const {\n valid,\n rawErrors,\n } = validator(schema, processedValues, {\n ...options,\n locale: currentLocale as any,\n });\n\n if (valid) {\n return { values: processedValues, errors: {} };\n }\n\n const errors: any = {};\n rawErrors?.forEach((error) => {\n // Convert instancePath (/field/subfield) to dot notation (field.subfield)\n const parts = (error.instancePath ? error.instancePath.substring(1).split('/') : []).map((part: string) => part.replace(/~1/g, '/').replace(/~0/g, '~'));\n if (error.keyword === 'required' && error.params?.missingProperty) parts.push(error.params.missingProperty);\n const keys: string[] = parts.length ? parts.flatMap((part: string) => part.split('.')) : ['root'];\n if (keys.some(key => ['__proto__', 'constructor', 'prototype'].includes(key))) {\n errors.root = { type: error.keyword, message: 'Unsupported field path' };\n return;\n }\n let target = errors;\n for (const key of keys.slice(0, -1)) {\n if (!Object.hasOwn(target, key)) Object.defineProperty(target, key, {\n value: {}, enumerable: true, configurable: true, writable: true,\n });\n target = target[key];\n }\n const leaf = keys.at(-1)!;\n if (!Object.hasOwn(target, leaf)) Object.defineProperty(target, leaf, {\n value: { message: error.message, type: error.keyword }, enumerable: true, configurable: true, writable: true,\n });\n });\n\n return {\n values: {},\n errors: errors as FieldErrors<T>,\n };\n };\n}\n"],"mappings":"A,yKAoCA,SAAgBK,EAAuD,EAAgB,EAAuC,CAAC,EAA4F,CACzN,IAAMC,GAAA,EAAYN,EAAAA,mBAAAA,CAAmBO,CAAO,EAE5C,OAAO,KAAO,IAAW,CAEvB,IAAMC,EAAgBD,EAAQ,SAAW,OAAO,OAAW,IAAcN,EAAAA,UAAU,EAAI,MAKjFQ,EAAaF,EAAQ,MAAA,EAAOL,EAAAA,mBAAAA,CAAmBQ,EAAQC,EAAQJ,EAAQ,IAAI,EAAIG,EAC/EE,EAAkBL,EAAQ,eAAiB,WAAaE,EAAa,OAAO,YAChF,OAAO,QAAQA,CAAU,CAAC,CAAC,KAAK,CAACI,EAAKC,KAAW,CAACD,EAAKC,IAAU,GAAK,IAAA,GAAYA,CAAK,CAAC,CAC1F,EAEM,CACJ,QACA,aACER,EAAUK,EAAQC,EAAiB,CACrC,GAAGL,EACH,OAAQC,CACV,CAAC,EAED,GAAIO,EACF,MAAO,CAAE,OAAQH,EAAiB,OAAQ,CAAC,CAAE,EAG/C,IAAMI,EAAc,CAAC,EAuBrB,OAtBAC,GAAW,QAAS,GAAU,CAE5B,IAAMC,GAASC,EAAM,aAAeA,EAAM,aAAa,UAAU,CAAC,CAAC,CAAC,MAAM,GAAG,EAAI,CAAC,EAAA,CAAG,IAAK,GAAiBC,EAAK,QAAQ,MAAO,GAAG,CAAC,CAAC,QAAQ,MAAO,GAAG,CAAC,EACnJD,EAAM,UAAY,YAAcA,EAAM,QAAQ,iBAAiBD,EAAM,KAAKC,EAAM,OAAO,eAAe,EAC1G,IAAME,EAAiBH,EAAM,OAASA,EAAM,QAAS,GAAiBE,EAAK,MAAM,GAAG,CAAC,EAAI,CAAC,MAAM,EAChG,GAAIC,EAAK,KAAK,GAAO,CAAC,YAAa,cAAe,WAAW,CAAC,CAAC,SAASR,CAAG,CAAC,EAAG,CAC7E,EAAO,KAAO,CAAE,KAAMM,EAAM,QAAS,QAAS,wBAAyB,EACvE,MACF,CACA,IAAIG,EAASN,EACb,IAAK,IAAMH,KAAOQ,EAAK,MAAM,EAAG,EAAE,EAC3B,OAAO,OAAOC,EAAQT,CAAG,GAAG,OAAO,eAAeS,EAAQT,EAAK,CAClE,MAAO,CAAC,EAAG,WAAY,GAAM,aAAc,GAAM,SAAU,EAC7D,CAAC,EACD,EAASS,EAAOT,GAElB,IAAMU,EAAOF,EAAK,GAAG,EAAE,EAClB,OAAO,OAAOC,EAAQC,CAAI,GAAG,OAAO,eAAeD,EAAQC,EAAM,CACpE,MAAO,CAAE,QAASJ,EAAM,QAAS,KAAMA,EAAM,OAAQ,EAAG,WAAY,GAAM,aAAc,GAAM,SAAU,EAC1G,CAAC,CACH,CAAC,EAEM,CACL,OAAQ,CAAC,EACD,QACV,CACF,CACF,C"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { createAjvValidator, AjvValidatorOptions, SchemaCastOptions } from '@alneas/appkit-core/data';
|
|
2
2
|
import { FieldValues, ResolverResult } from 'react-hook-form';
|
|
3
3
|
export { createAjvValidator, type AjvValidatorOptions };
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* JSON Schema validation/casting settings for React Hook Form.
|
|
6
|
+
* @remarks Legacy top-level empty-string omission is default; preserve opts into ordinary schema validation.
|
|
7
|
+
* @see createAjvResolver for usage.
|
|
8
|
+
*/
|
|
5
9
|
export interface SchemaFormValidationOptions extends AjvValidatorOptions {
|
|
6
10
|
/** Preserve empty strings for ordinary JSON Schema validation, or omit top-level empty strings (legacy default). */
|
|
7
11
|
emptyStrings?: 'preserve' | 'omit';
|
|
@@ -9,14 +13,21 @@ export interface SchemaFormValidationOptions extends AjvValidatorOptions {
|
|
|
9
13
|
cast?: SchemaCastOptions;
|
|
10
14
|
}
|
|
11
15
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
16
|
+
* Creates an asynchronous React Hook Form resolver using Core Ajv validation.
|
|
17
|
+
* @typeParam T - Form values shape; defaults to FieldValues.
|
|
18
|
+
* @param schema - JSON Schema accepted by Core validation.
|
|
19
|
+
* @param options - Ajv options plus optional numeric casting and empty-string handling; defaults to {}.
|
|
20
|
+
* @returns Resolver accepting values and optional ignored context/options, resolving normalized
|
|
21
|
+
* values with no errors on success or empty values plus nested field errors on failure.
|
|
22
|
+
* @throws Resolver rejects if schema compilation, casting or validator execution throws.
|
|
23
|
+
* @remarks Optional cast runs first without mutating input. Unless emptyStrings is preserve,
|
|
24
|
+
* top-level empty strings become undefined; nested empty strings are retained. Locale
|
|
25
|
+
* uses options.locale, otherwise browser Paraglide locale, otherwise ja on the server.
|
|
26
|
+
* Unsafe error-path keys map to a root error. No provider or CSS is required to create it.
|
|
15
27
|
* @example
|
|
28
|
+
* ```ts
|
|
16
29
|
* import { createAjvResolver } from '@alneas/appkit-react/tools/form';
|
|
17
|
-
* const resolver = createAjvResolver({ type: 'object', properties: { hours: { type: 'number' } } }, { emptyStrings: 'preserve', cast: { numericMode: 'strict' } });
|
|
18
|
-
*
|
|
19
|
-
* @param options - バリデーションオプション。localeを省略すると現在の言語設定が使用されます。
|
|
20
|
-
* @returns React Hook Form の resolver プロパティに渡せる関数。
|
|
30
|
+
* const resolver = createAjvResolver<{ hours: number }>({ type: 'object', properties: { hours: { type: 'number' } } }, { emptyStrings: 'preserve', cast: { numericMode: 'strict' } });
|
|
31
|
+
* ```
|
|
21
32
|
*/
|
|
22
33
|
export declare function createAjvResolver<T extends FieldValues = FieldValues>(schema: object, options?: SchemaFormValidationOptions): (values: T, context?: unknown, resolverOptions?: unknown) => Promise<ResolverResult<T>>;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { createAjvValidator, AjvValidatorOptions, SchemaCastOptions } from '@alneas/appkit-core/data';
|
|
2
2
|
import { FieldValues, ResolverResult } from 'react-hook-form';
|
|
3
3
|
export { createAjvValidator, type AjvValidatorOptions };
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* JSON Schema validation/casting settings for React Hook Form.
|
|
6
|
+
* @remarks Legacy top-level empty-string omission is default; preserve opts into ordinary schema validation.
|
|
7
|
+
* @see createAjvResolver for usage.
|
|
8
|
+
*/
|
|
5
9
|
export interface SchemaFormValidationOptions extends AjvValidatorOptions {
|
|
6
10
|
/** Preserve empty strings for ordinary JSON Schema validation, or omit top-level empty strings (legacy default). */
|
|
7
11
|
emptyStrings?: 'preserve' | 'omit';
|
|
@@ -9,14 +13,21 @@ export interface SchemaFormValidationOptions extends AjvValidatorOptions {
|
|
|
9
13
|
cast?: SchemaCastOptions;
|
|
10
14
|
}
|
|
11
15
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
16
|
+
* Creates an asynchronous React Hook Form resolver using Core Ajv validation.
|
|
17
|
+
* @typeParam T - Form values shape; defaults to FieldValues.
|
|
18
|
+
* @param schema - JSON Schema accepted by Core validation.
|
|
19
|
+
* @param options - Ajv options plus optional numeric casting and empty-string handling; defaults to {}.
|
|
20
|
+
* @returns Resolver accepting values and optional ignored context/options, resolving normalized
|
|
21
|
+
* values with no errors on success or empty values plus nested field errors on failure.
|
|
22
|
+
* @throws Resolver rejects if schema compilation, casting or validator execution throws.
|
|
23
|
+
* @remarks Optional cast runs first without mutating input. Unless emptyStrings is preserve,
|
|
24
|
+
* top-level empty strings become undefined; nested empty strings are retained. Locale
|
|
25
|
+
* uses options.locale, otherwise browser Paraglide locale, otherwise ja on the server.
|
|
26
|
+
* Unsafe error-path keys map to a root error. No provider or CSS is required to create it.
|
|
15
27
|
* @example
|
|
28
|
+
* ```ts
|
|
16
29
|
* import { createAjvResolver } from '@alneas/appkit-react/tools/form';
|
|
17
|
-
* const resolver = createAjvResolver({ type: 'object', properties: { hours: { type: 'number' } } }, { emptyStrings: 'preserve', cast: { numericMode: 'strict' } });
|
|
18
|
-
*
|
|
19
|
-
* @param options - バリデーションオプション。localeを省略すると現在の言語設定が使用されます。
|
|
20
|
-
* @returns React Hook Form の resolver プロパティに渡せる関数。
|
|
30
|
+
* const resolver = createAjvResolver<{ hours: number }>({ type: 'object', properties: { hours: { type: 'number' } } }, { emptyStrings: 'preserve', cast: { numericMode: 'strict' } });
|
|
31
|
+
* ```
|
|
21
32
|
*/
|
|
22
33
|
export declare function createAjvResolver<T extends FieldValues = FieldValues>(schema: object, options?: SchemaFormValidationOptions): (values: T, context?: unknown, resolverOptions?: unknown) => Promise<ResolverResult<T>>;
|