@jini-ai/admin 0.4.1 → 0.4.3
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 +20 -0
- package/README.md +7 -0
- package/dist/agent-plugins/react/components/AgentPluginFileTree.js +1 -1
- package/dist/agent-plugins/react/components/AgentPluginListPanel.d.ts +1 -1
- package/dist/agent-plugins/react/hooks/AgentPluginInspector.hooks.d.ts +0 -1
- package/dist/agent-plugins/react/hooks/AgentPluginInspector.hooks.js +7 -6
- package/dist/agent-plugins/react/hooks/AgentPluginPanel.hooks.d.ts +1 -1
- package/dist/agent-plugins/react/hooks/AgentPluginPanel.hooks.js +3 -2
- package/dist/agent-plugins/react/hooks/AgentPluginsPage.hooks.d.ts +1 -1
- package/dist/agent-plugins/react/hooks/AgentPluginsPage.hooks.js +1 -1
- package/dist/agent-plugins/react/hooks/MarketplaceTab.hooks.d.ts +1 -1
- package/dist/agent-plugins/react/index.js +1 -1
- package/dist/agent-plugins/react/pages/AgentPluginsPage.d.ts +1 -1
- package/dist/agent-plugins/react/tabs/DownloadedTab.d.ts +1 -1
- package/dist/agent-plugins/react/tabs/InstalledTab.d.ts +1 -1
- package/dist/agent-plugins/react/tabs/MarketplaceTab.d.ts +1 -1
- package/dist/comments/adapters/http.d.ts +29 -0
- package/dist/comments/adapters/http.js +50 -0
- package/dist/comments/adapters/memory.d.ts +17 -0
- package/dist/comments/adapters/memory.js +61 -0
- package/dist/comments/comments.module.d.ts +73 -0
- package/dist/comments/comments.module.js +16 -0
- package/dist/comments/conformance/comments-api.conformance.d.ts +9 -0
- package/dist/comments/conformance/comments-api.conformance.js +63 -0
- package/dist/comments/controllers/comment-queue.controller.d.ts +48 -0
- package/dist/comments/controllers/comment-queue.controller.js +164 -0
- package/dist/comments/controllers/comment-settings.controller.d.ts +32 -0
- package/dist/comments/controllers/comment-settings.controller.js +77 -0
- package/dist/comments/controllers/comments.controller.d.ts +16 -0
- package/dist/comments/controllers/comments.controller.js +16 -0
- package/dist/comments/index.d.ts +13 -0
- package/dist/comments/index.js +8 -0
- package/dist/comments/messages.en.d.ts +54 -0
- package/dist/comments/messages.en.js +56 -0
- package/dist/comments/models.d.ts +22 -0
- package/dist/comments/models.js +2 -0
- package/dist/comments/ports.d.ts +14 -0
- package/dist/comments/ports.js +5 -0
- package/dist/comments/react/components/QueueSection.d.ts +30 -0
- package/dist/comments/react/components/QueueSection.js +57 -0
- package/dist/comments/react/components/SettingsSection.d.ts +14 -0
- package/dist/comments/react/components/SettingsSection.js +23 -0
- package/dist/comments/react/hooks/CommentsPage.hooks.d.ts +9 -0
- package/dist/comments/react/hooks/CommentsPage.hooks.js +10 -0
- package/dist/comments/react/hooks/CommentsPorts.hooks.d.ts +13 -0
- package/dist/comments/react/hooks/CommentsPorts.hooks.js +15 -0
- package/dist/comments/react/hooks/QueueSection.hooks.d.ts +62 -0
- package/dist/comments/react/hooks/QueueSection.hooks.js +57 -0
- package/dist/comments/react/hooks/SettingsSection.hooks.d.ts +12 -0
- package/dist/comments/react/hooks/SettingsSection.hooks.js +21 -0
- package/dist/comments/react/hooks/use-comment-queue.hooks.d.ts +34 -0
- package/dist/comments/react/hooks/use-comment-queue.hooks.js +47 -0
- package/dist/comments/react/hooks/use-comment-settings.hooks.d.ts +22 -0
- package/dist/comments/react/hooks/use-comment-settings.hooks.js +30 -0
- package/dist/comments/react/hooks/use-comments.hooks.d.ts +15 -0
- package/dist/comments/react/hooks/use-comments.hooks.js +20 -0
- package/dist/comments/react/index.d.ts +316 -0
- package/dist/comments/react/index.js +35 -0
- package/dist/comments/react/pages/CommentsPage.d.ts +12 -0
- package/dist/comments/react/pages/CommentsPage.js +15 -0
- package/dist/comments/rules.d.ts +140 -0
- package/dist/comments/rules.js +199 -0
- package/dist/core/index.d.ts +3 -1
- package/dist/core/index.js +1 -0
- package/dist/core/ledger-slice.d.ts +90 -0
- package/dist/core/ledger-slice.js +81 -0
- package/dist/core/ports/comments.d.ts +2 -0
- package/dist/core/ports/forms.d.ts +19 -7
- package/dist/core/ports/forms.js +4 -4
- package/dist/core/ports/index.d.ts +1 -1
- package/dist/core/ports/seo.d.ts +33 -6
- package/dist/core/react/bind-react.d.ts +46 -0
- package/dist/core/react/bind-react.js +28 -0
- package/dist/core/react/index.d.ts +3 -0
- package/dist/core/react/index.js +3 -0
- package/dist/core/react/use-controller.d.ts +16 -0
- package/dist/core/react/use-controller.js +18 -0
- package/dist/forms/adapters/http.d.ts +26 -0
- package/dist/forms/adapters/http.js +43 -0
- package/dist/forms/adapters/memory.d.ts +14 -0
- package/dist/forms/adapters/memory.js +77 -0
- package/dist/forms/conformance/forms-api.conformance.d.ts +17 -0
- package/dist/forms/conformance/forms-api.conformance.js +71 -0
- package/dist/forms/controllers/draft-store.d.ts +18 -0
- package/dist/forms/controllers/draft-store.js +17 -0
- package/dist/forms/controllers/field-attributes-dialog.controller.d.ts +37 -0
- package/dist/forms/controllers/field-attributes-dialog.controller.js +27 -0
- package/dist/forms/controllers/form-editor.controller.d.ts +36 -0
- package/dist/forms/controllers/form-editor.controller.js +22 -0
- package/dist/forms/controllers/form-fields-editor.controller.d.ts +20 -0
- package/dist/forms/controllers/form-fields-editor.controller.js +10 -0
- package/dist/forms/controllers/form-submission-detail.controller.d.ts +20 -0
- package/dist/forms/controllers/form-submission-detail.controller.js +10 -0
- package/dist/forms/controllers/form-submissions.controller.d.ts +25 -0
- package/dist/forms/controllers/form-submissions.controller.js +10 -0
- package/dist/forms/controllers/forms-list.controller.d.ts +22 -0
- package/dist/forms/controllers/forms-list.controller.js +10 -0
- package/dist/forms/forms.module.d.ts +137 -0
- package/dist/forms/forms.module.js +17 -0
- package/dist/forms/html-rules.d.ts +20 -0
- package/dist/forms/html-rules.js +24 -0
- package/dist/forms/index.d.ts +14 -0
- package/dist/forms/index.js +12 -0
- package/dist/forms/messages.en.d.ts +100 -0
- package/dist/forms/messages.en.js +104 -0
- package/dist/forms/models.d.ts +29 -0
- package/dist/forms/models.js +8 -0
- package/dist/forms/ports.d.ts +26 -0
- package/dist/forms/ports.js +6 -0
- package/dist/forms/react/components/FieldAttributesDialog.d.ts +14 -0
- package/dist/forms/react/components/FieldAttributesDialog.js +47 -0
- package/dist/forms/react/components/FormEditorFieldsBody.d.ts +28 -0
- package/dist/forms/react/components/FormEditorFieldsBody.js +24 -0
- package/dist/forms/react/components/FormEditorHeaderText.d.ts +7 -0
- package/dist/forms/react/components/FormEditorHeaderText.js +8 -0
- package/dist/forms/react/components/FormEditorMainPanel.d.ts +12 -0
- package/dist/forms/react/components/FormEditorMainPanel.js +13 -0
- package/dist/forms/react/components/FormEditorTabStrip.d.ts +13 -0
- package/dist/forms/react/components/FormEditorTabStrip.js +14 -0
- package/dist/forms/react/components/FormFieldsEditor.d.ts +13 -0
- package/dist/forms/react/components/FormFieldsEditor.js +39 -0
- package/dist/forms/react/components/FormSubmissionDate.d.ts +8 -0
- package/dist/forms/react/components/FormSubmissionDate.js +5 -0
- package/dist/forms/react/components/FormSubmissionDetail.d.ts +13 -0
- package/dist/forms/react/components/FormSubmissionDetail.js +29 -0
- package/dist/forms/react/components/FormSubmissions.d.ts +12 -0
- package/dist/forms/react/components/FormSubmissions.js +46 -0
- package/dist/forms/react/hooks/FormsPorts.hooks.d.ts +41 -0
- package/dist/forms/react/hooks/FormsPorts.hooks.js +16 -0
- package/dist/forms/react/hooks/forms-view.hooks.d.ts +122 -0
- package/dist/forms/react/hooks/forms-view.hooks.js +79 -0
- package/dist/forms/react/hooks/use-field-attributes-dialog.hooks.d.ts +31 -0
- package/dist/forms/react/hooks/use-field-attributes-dialog.hooks.js +22 -0
- package/dist/forms/react/hooks/use-form-editor.hooks.d.ts +118 -0
- package/dist/forms/react/hooks/use-form-editor.hooks.js +208 -0
- package/dist/forms/react/hooks/use-form-fields-editor.hooks.d.ts +34 -0
- package/dist/forms/react/hooks/use-form-fields-editor.hooks.js +36 -0
- package/dist/forms/react/hooks/use-form-submission-date.hooks.d.ts +12 -0
- package/dist/forms/react/hooks/use-form-submission-date.hooks.js +9 -0
- package/dist/forms/react/hooks/use-form-submission-detail.hooks.d.ts +68 -0
- package/dist/forms/react/hooks/use-form-submission-detail.hooks.js +81 -0
- package/dist/forms/react/hooks/use-form-submissions.hooks.d.ts +67 -0
- package/dist/forms/react/hooks/use-form-submissions.hooks.js +110 -0
- package/dist/forms/react/hooks/use-forms-list.hooks.d.ts +78 -0
- package/dist/forms/react/hooks/use-forms-list.hooks.js +103 -0
- package/dist/forms/react/index.d.ts +449 -0
- package/dist/forms/react/index.js +35 -0
- package/dist/forms/react/pages/FormEditor.d.ts +19 -0
- package/dist/forms/react/pages/FormEditor.js +40 -0
- package/dist/forms/react/pages/FormsList.d.ts +39 -0
- package/dist/forms/react/pages/FormsList.js +55 -0
- package/dist/forms/rules.d.ts +291 -0
- package/dist/forms/rules.js +338 -0
- package/dist/media/react/hooks/EditMediaPanel.hooks.js +1 -1
- package/dist/media/react/hooks/LibraryTab.hooks.d.ts +1 -3
- package/dist/media/react/hooks/LibraryTab.hooks.js +8 -17
- package/dist/media/react/hooks/MediaCard.hooks.js +6 -20
- package/dist/media/react/hooks/MediaGrid.hooks.d.ts +2 -2
- package/dist/media/react/hooks/MediaPage.hooks.d.ts +1 -1
- package/dist/media/react/hooks/MediaPage.hooks.js +1 -1
- package/dist/media/react/hooks/MediaPicker.hooks.js +1 -1
- package/dist/media/react/hooks/ProvidersTab.hooks.js +5 -1
- package/dist/media/react/hooks/UploadButton.hooks.d.ts +9 -2
- package/dist/media/react/hooks/UploadButton.hooks.js +12 -10
- package/dist/media/react/index.js +1 -1
- package/dist/media/react/tabs/LibraryTab.d.ts +1 -1
- package/dist/media/react/tabs/ProvidersTab.d.ts +1 -1
- package/dist/playground/react/components/Canvas.d.ts +1 -1
- package/dist/playground/react/hooks/Canvas.hooks.d.ts +1 -1
- package/dist/playground/react/hooks/Canvas.hooks.js +1 -1
- package/dist/playground/react/hooks/PlaygroundPage.hooks.d.ts +1 -1
- package/dist/playground/react/index.js +1 -1
- package/dist/playground/react/pages/PlaygroundPage.d.ts +1 -1
- package/dist/playground/react/tabs/CanvasTab.d.ts +1 -1
- package/dist/react/bind-react.d.ts +1 -45
- package/dist/react/bind-react.js +2 -27
- package/dist/react/components/ConfirmDialog/ConfirmDialog.d.ts +22 -5
- package/dist/react/components/ConfirmDialog/ConfirmDialog.hooks.d.ts +2 -2
- package/dist/react/components/ConfirmDialog/ConfirmDialog.hooks.js +17 -55
- package/dist/react/components/ConfirmDialog/ConfirmDialog.js +33 -70
- package/dist/react/components/RowMenu/RowMenu.hooks.d.ts +23 -16
- package/dist/react/components/RowMenu/RowMenu.hooks.js +74 -54
- package/dist/react/entities/EntityField.d.ts +1 -1
- package/dist/react/entities/EntityField.js +4 -2
- package/dist/react/entities/types.d.ts +9 -0
- package/dist/react/entities/types.js +9 -0
- package/dist/react/use-controller.d.ts +1 -15
- package/dist/react/use-controller.js +2 -17
- package/dist/redirects/adapters/http.d.ts +20 -0
- package/dist/redirects/adapters/http.js +31 -0
- package/dist/redirects/adapters/memory.d.ts +13 -0
- package/dist/redirects/adapters/memory.js +83 -0
- package/dist/redirects/conformance/redirects-api.conformance.d.ts +12 -0
- package/dist/redirects/conformance/redirects-api.conformance.js +66 -0
- package/dist/redirects/controllers/hit-count.controller.d.ts +14 -0
- package/dist/redirects/controllers/hit-count.controller.js +10 -0
- package/dist/redirects/controllers/import-redirects.controller.d.ts +28 -0
- package/dist/redirects/controllers/import-redirects.controller.js +29 -0
- package/dist/redirects/controllers/redirects.controller.d.ts +37 -0
- package/dist/redirects/controllers/redirects.controller.js +38 -0
- package/dist/redirects/index.d.ts +11 -0
- package/dist/redirects/index.js +10 -0
- package/dist/redirects/messages.en.d.ts +56 -0
- package/dist/redirects/messages.en.js +55 -0
- package/dist/redirects/models.d.ts +14 -0
- package/dist/redirects/models.js +2 -0
- package/dist/redirects/ports.d.ts +9 -0
- package/dist/redirects/ports.js +4 -0
- package/dist/redirects/react/components/HitCountCell.d.ts +19 -0
- package/dist/redirects/react/components/HitCountCell.js +19 -0
- package/dist/redirects/react/components/ImportRedirectsForm.d.ts +17 -0
- package/dist/redirects/react/components/ImportRedirectsForm.js +12 -0
- package/dist/redirects/react/hooks/RedirectsOptions.hooks.d.ts +27 -0
- package/dist/redirects/react/hooks/RedirectsOptions.hooks.js +15 -0
- package/dist/redirects/react/hooks/RedirectsPage.hooks.d.ts +50 -0
- package/dist/redirects/react/hooks/RedirectsPage.hooks.js +30 -0
- package/dist/redirects/react/hooks/RedirectsPorts.hooks.d.ts +10 -0
- package/dist/redirects/react/hooks/RedirectsPorts.hooks.js +11 -0
- package/dist/redirects/react/hooks/use-hit-count-cell.hooks.d.ts +19 -0
- package/dist/redirects/react/hooks/use-hit-count-cell.hooks.js +15 -0
- package/dist/redirects/react/hooks/use-import-redirects-form.hooks.d.ts +21 -0
- package/dist/redirects/react/hooks/use-import-redirects-form.hooks.js +25 -0
- package/dist/redirects/react/hooks/use-redirects.hooks.d.ts +34 -0
- package/dist/redirects/react/hooks/use-redirects.hooks.js +63 -0
- package/dist/redirects/react/hooks/wired.hooks.d.ts +55 -0
- package/dist/redirects/react/hooks/wired.hooks.js +31 -0
- package/dist/redirects/react/index.d.ts +316 -0
- package/dist/redirects/react/index.js +28 -0
- package/dist/redirects/react/pages/RedirectsPage.d.ts +15 -0
- package/dist/redirects/react/pages/RedirectsPage.js +20 -0
- package/dist/redirects/redirects.module.d.ts +75 -0
- package/dist/redirects/redirects.module.js +13 -0
- package/dist/redirects/rules.d.ts +131 -0
- package/dist/redirects/rules.js +134 -0
- package/dist/security/react/hooks/AccessTokensTab.hooks.d.ts +1 -1
- package/dist/security/react/hooks/AccessTokensTab.hooks.js +3 -3
- package/dist/security/react/hooks/RootKeyTab.hooks.d.ts +1 -1
- package/dist/security/react/hooks/RootKeyTab.hooks.js +3 -4
- package/dist/security/react/hooks/SecurityPage.hooks.d.ts +1 -1
- package/dist/security/react/hooks/SecurityPorts.hooks.d.ts +4 -0
- package/dist/security/react/hooks/SecurityPorts.hooks.js +5 -0
- package/dist/security/react/index.js +1 -1
- package/dist/security/react/pages/SecurityPage.d.ts +1 -1
- package/dist/security/react/tabs/AccessTokensTab.d.ts +1 -1
- package/dist/security/react/tabs/RootKeyTab.d.ts +1 -1
- package/dist/seo/adapters/http.d.ts +31 -0
- package/dist/seo/adapters/http.js +37 -0
- package/dist/seo/adapters/memory.d.ts +28 -0
- package/dist/seo/adapters/memory.js +129 -0
- package/dist/seo/conformance/seo-api.conformance.d.ts +8 -0
- package/dist/seo/conformance/seo-api.conformance.js +44 -0
- package/dist/seo/controllers/entry-picker.controller.d.ts +21 -0
- package/dist/seo/controllers/entry-picker.controller.js +17 -0
- package/dist/seo/controllers/entry-section.controller.d.ts +20 -0
- package/dist/seo/controllers/entry-section.controller.js +7 -0
- package/dist/seo/controllers/media-ref.controller.d.ts +26 -0
- package/dist/seo/controllers/media-ref.controller.js +14 -0
- package/dist/seo/controllers/seo-entry.controller.d.ts +31 -0
- package/dist/seo/controllers/seo-entry.controller.js +52 -0
- package/dist/seo/controllers/seo.controller.d.ts +29 -0
- package/dist/seo/controllers/seo.controller.js +50 -0
- package/dist/seo/controllers/sitemap.controller.d.ts +25 -0
- package/dist/seo/controllers/sitemap.controller.js +27 -0
- package/dist/seo/index.d.ts +14 -0
- package/dist/seo/index.js +12 -0
- package/dist/seo/messages.en.d.ts +78 -0
- package/dist/seo/messages.en.js +78 -0
- package/dist/seo/models.d.ts +179 -0
- package/dist/seo/models.js +8 -0
- package/dist/seo/ports.d.ts +11 -0
- package/dist/seo/ports.js +4 -0
- package/dist/seo/react/components/MediaPickerBridge.d.ts +4 -0
- package/dist/seo/react/components/MediaPickerBridge.js +8 -0
- package/dist/seo/react/components/MediaRefField.d.ts +36 -0
- package/dist/seo/react/components/MediaRefField.js +12 -0
- package/dist/seo/react/components/SeoIcons.d.ts +13 -0
- package/dist/seo/react/components/SeoIcons.js +32 -0
- package/dist/seo/react/components/SitemapModal.d.ts +48 -0
- package/dist/seo/react/components/SitemapModal.js +70 -0
- package/dist/seo/react/hooks/MediaPickerBridge.hooks.d.ts +6 -0
- package/dist/seo/react/hooks/MediaPickerBridge.hooks.js +27 -0
- package/dist/seo/react/hooks/MediaRefField.hooks.d.ts +22 -0
- package/dist/seo/react/hooks/MediaRefField.hooks.js +30 -0
- package/dist/seo/react/hooks/SeoModuleTabs.d.ts +14 -0
- package/dist/seo/react/hooks/SeoModuleTabs.js +18 -0
- package/dist/seo/react/hooks/SeoPage.hooks.d.ts +69 -0
- package/dist/seo/react/hooks/SeoPage.hooks.js +37 -0
- package/dist/seo/react/hooks/SeoPorts.hooks.d.ts +19 -0
- package/dist/seo/react/hooks/SeoPorts.hooks.js +22 -0
- package/dist/seo/react/hooks/SitemapModal.hooks.d.ts +26 -0
- package/dist/seo/react/hooks/SitemapModal.hooks.js +20 -0
- package/dist/seo/react/hooks/use-entry-picker.hooks.d.ts +11 -0
- package/dist/seo/react/hooks/use-entry-picker.hooks.js +20 -0
- package/dist/seo/react/hooks/use-seo-entry-panel.hooks.d.ts +14 -0
- package/dist/seo/react/hooks/use-seo-entry-panel.hooks.js +26 -0
- package/dist/seo/react/hooks/use-seo-entry-section.hooks.d.ts +4 -0
- package/dist/seo/react/hooks/use-seo-entry-section.hooks.js +7 -0
- package/dist/seo/react/hooks/use-seo.hooks.d.ts +11 -0
- package/dist/seo/react/hooks/use-seo.hooks.js +29 -0
- package/dist/seo/react/hooks/use-sitemap-modal.hooks.d.ts +10 -0
- package/dist/seo/react/hooks/use-sitemap-modal.hooks.js +18 -0
- package/dist/seo/react/index.d.ts +366 -0
- package/dist/seo/react/index.js +30 -0
- package/dist/seo/react/options.d.ts +19 -0
- package/dist/seo/react/options.js +2 -0
- package/dist/seo/react/pages/SeoPage.d.ts +161 -0
- package/dist/seo/react/pages/SeoPage.js +215 -0
- package/dist/seo/rules.d.ts +136 -0
- package/dist/seo/rules.js +212 -0
- package/dist/seo/seo.module.d.ts +114 -0
- package/dist/seo/seo.module.js +14 -0
- package/dist/source-control/react/hooks/ProvidersTab.hooks.d.ts +1 -1
- package/dist/source-control/react/hooks/ProvidersTab.hooks.js +4 -4
- package/dist/source-control/react/hooks/SourceControlPage.hooks.d.ts +1 -1
- package/dist/source-control/react/index.js +1 -1
- package/dist/source-control/react/pages/SourceControlPage.d.ts +1 -1
- package/dist/source-control/react/tabs/ProvidersTab.d.ts +1 -1
- package/dist/widgets/adapters/http.d.ts +19 -0
- package/dist/widgets/adapters/http.js +33 -0
- package/dist/widgets/adapters/memory.d.ts +22 -0
- package/dist/widgets/adapters/memory.js +93 -0
- package/dist/widgets/conformance/widgets-api.conformance.d.ts +6 -0
- package/dist/widgets/conformance/widgets-api.conformance.js +55 -0
- package/dist/widgets/controllers/instance-editor.controller.d.ts +49 -0
- package/dist/widgets/controllers/instance-editor.controller.js +87 -0
- package/dist/widgets/controllers/library.controller.d.ts +33 -0
- package/dist/widgets/controllers/library.controller.js +53 -0
- package/dist/widgets/controllers/region-editor.controller.d.ts +42 -0
- package/dist/widgets/controllers/region-editor.controller.js +69 -0
- package/dist/widgets/controllers/regions.controller.d.ts +27 -0
- package/dist/widgets/controllers/regions.controller.js +44 -0
- package/dist/widgets/index.d.ts +11 -0
- package/dist/widgets/index.js +9 -0
- package/dist/widgets/messages.en.d.ts +78 -0
- package/dist/widgets/messages.en.js +83 -0
- package/dist/widgets/models.d.ts +62 -0
- package/dist/widgets/models.js +2 -0
- package/dist/widgets/ports.d.ts +79 -0
- package/dist/widgets/ports.js +5 -0
- package/dist/widgets/react/components/WidgetInstanceNotices.d.ts +14 -0
- package/dist/widgets/react/components/WidgetInstanceNotices.js +25 -0
- package/dist/widgets/react/components/WidgetRegionEditorHeaderActions.d.ts +22 -0
- package/dist/widgets/react/components/WidgetRegionEditorHeaderActions.js +18 -0
- package/dist/widgets/react/components/WidgetsLibraryNotices.d.ts +13 -0
- package/dist/widgets/react/components/WidgetsLibraryNotices.js +10 -0
- package/dist/widgets/react/hooks/WidgetsPorts.hooks.d.ts +270 -0
- package/dist/widgets/react/hooks/WidgetsPorts.hooks.js +17 -0
- package/dist/widgets/react/hooks/navigation.hooks.d.ts +9 -0
- package/dist/widgets/react/hooks/navigation.hooks.js +6 -0
- package/dist/widgets/react/hooks/page-views.hooks.d.ts +87 -0
- package/dist/widgets/react/hooks/page-views.hooks.js +30 -0
- package/dist/widgets/react/hooks/use-widget-instance-editor.hooks.d.ts +56 -0
- package/dist/widgets/react/hooks/use-widget-instance-editor.hooks.js +38 -0
- package/dist/widgets/react/hooks/use-widget-region-editor.hooks.d.ts +32 -0
- package/dist/widgets/react/hooks/use-widget-region-editor.hooks.js +22 -0
- package/dist/widgets/react/hooks/use-widget-regions.hooks.d.ts +23 -0
- package/dist/widgets/react/hooks/use-widget-regions.hooks.js +22 -0
- package/dist/widgets/react/hooks/use-widgets-library.hooks.d.ts +37 -0
- package/dist/widgets/react/hooks/use-widgets-library.hooks.js +23 -0
- package/dist/widgets/react/index.d.ts +391 -0
- package/dist/widgets/react/index.js +31 -0
- package/dist/widgets/react/pages/WidgetInstanceEditor.d.ts +23 -0
- package/dist/widgets/react/pages/WidgetInstanceEditor.js +37 -0
- package/dist/widgets/react/pages/WidgetRegionEditor.d.ts +22 -0
- package/dist/widgets/react/pages/WidgetRegionEditor.js +25 -0
- package/dist/widgets/react/pages/WidgetRegions.d.ts +21 -0
- package/dist/widgets/react/pages/WidgetRegions.js +31 -0
- package/dist/widgets/react/pages/WidgetsLibrary.d.ts +24 -0
- package/dist/widgets/react/pages/WidgetsLibrary.js +61 -0
- package/dist/widgets/rules.d.ts +94 -0
- package/dist/widgets/rules.js +83 -0
- package/dist/widgets/widgets.module.d.ts +122 -0
- package/dist/widgets/widgets.module.js +21 -0
- package/package.json +206 -9
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TabViewProps } from '../../../react/bind-react.js';
|
|
1
|
+
import type { TabViewProps } from '../../../core/react/bind-react.js';
|
|
2
2
|
export declare function useCanvas({ permissions }: TabViewProps, _optional?: {}): {
|
|
3
3
|
denied: boolean;
|
|
4
4
|
registerCanvas: (node: HTMLDivElement | null) => void | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useCallback } from 'react';
|
|
2
|
-
import { useController } from '../../../react/use-controller.js';
|
|
2
|
+
import { useController } from '../../../core/react/use-controller.js';
|
|
3
3
|
import { createPlaygroundController } from '../../controllers/playground.controller.js';
|
|
4
4
|
import { canMountPlayground } from '../../rules.js';
|
|
5
5
|
import { usePlaygroundPorts } from './PlaygroundPorts.hooks.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ModulePageProps } from '../../../react/bind-react.js';
|
|
1
|
+
import type { ModulePageProps } from '../../../core/react/bind-react.js';
|
|
2
2
|
export declare function usePlaygroundPage(props: ModulePageProps, _optional?: {}): {
|
|
3
3
|
denied: boolean;
|
|
4
4
|
ActiveTab: import("react").LazyExoticComponent<import("react").ComponentType<import("../../../react/bind-react.js").TabViewProps>> | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { bindReact } from '../../react/bind-react.js';
|
|
1
|
+
import { bindReact } from '../../core/react/bind-react.js';
|
|
2
2
|
import { playgroundModule } from '../playground.module.js';
|
|
3
3
|
import { PlaygroundPortsContext } from './hooks/PlaygroundPorts.hooks.js';
|
|
4
4
|
export { usePlaygroundPorts } from './hooks/PlaygroundPorts.hooks.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ModulePageProps } from '../../../react/bind-react.js';
|
|
1
|
+
import type { ModulePageProps } from '../../../core/react/bind-react.js';
|
|
2
2
|
export declare function PlaygroundPage(props: ModulePageProps, _optional?: {}): import("react").JSX.Element;
|
|
3
3
|
export default PlaygroundPage;
|
|
4
4
|
//# sourceMappingURL=PlaygroundPage.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TabViewProps } from '../../../react/bind-react.js';
|
|
1
|
+
import type { TabViewProps } from '../../../core/react/bind-react.js';
|
|
2
2
|
export declare function CanvasTab(props: TabViewProps, _optional?: {}): import("react").JSX.Element;
|
|
3
3
|
export default CanvasTab;
|
|
4
4
|
//# sourceMappingURL=CanvasTab.d.ts.map
|
|
@@ -1,46 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import type { AdminInstance, AdminModule, ScopedPorts } from '../core/module/types.js';
|
|
3
|
-
export interface TabViewProps {
|
|
4
|
-
readonly params: Readonly<Record<string, unknown>>;
|
|
5
|
-
readonly permissions?: readonly string[];
|
|
6
|
-
}
|
|
7
|
-
export interface ModulePageProps {
|
|
8
|
-
readonly tabs: Readonly<Record<string, LazyExoticComponent<ComponentType<TabViewProps>>>>;
|
|
9
|
-
readonly description: ReturnType<AdminInstance['describe']>['pages'][number];
|
|
10
|
-
readonly requestedTab?: string;
|
|
11
|
-
readonly onTabChange?: (required: {
|
|
12
|
-
tab: string;
|
|
13
|
-
}, optional?: Record<string, never>) => void;
|
|
14
|
-
}
|
|
15
|
-
type Loader<P> = () => Promise<{
|
|
16
|
-
default: ComponentType<P>;
|
|
17
|
-
}>;
|
|
18
|
-
export type ReactViews<M extends AdminModule> = {
|
|
19
|
-
readonly [P in keyof M['pages']]: {
|
|
20
|
-
readonly page: Loader<ModulePageProps>;
|
|
21
|
-
readonly tabs: {
|
|
22
|
-
readonly [T in keyof M['pages'][P]['tabs']]: Loader<TabViewProps>;
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
/** Every page and tab is lazy. The only port context is private to this binding;
|
|
27
|
-
* a sibling module can never read another module's dependencies through a global locator. */
|
|
28
|
-
export declare function bindReact<const M extends AdminModule>({ module, views }: {
|
|
29
|
-
module: M;
|
|
30
|
-
views: ReactViews<M>;
|
|
31
|
-
}, { context }?: {
|
|
32
|
-
context?: ReactContext<ScopedPorts<M> | null>;
|
|
33
|
-
}): {
|
|
34
|
-
module: M;
|
|
35
|
-
pages: { [P in keyof M["pages"]]: {
|
|
36
|
-
Page: LazyExoticComponent<ComponentType<ModulePageProps>>;
|
|
37
|
-
tabs: { [T in keyof M["pages"][P]["tabs"]]: LazyExoticComponent<ComponentType<TabViewProps>>; };
|
|
38
|
-
}; };
|
|
39
|
-
Provider: ({ admin, children }: {
|
|
40
|
-
admin: AdminInstance;
|
|
41
|
-
children: ReactNode;
|
|
42
|
-
}, _optional?: Record<string, never>) => import("react").FunctionComponentElement<import("react").ProviderProps<ScopedPorts<M> | null>>;
|
|
43
|
-
usePorts: (_required?: Record<string, never>, _optional?: Record<string, never>) => ScopedPorts<M>;
|
|
44
|
-
};
|
|
45
|
-
export {};
|
|
1
|
+
export * from '../core/react/bind-react.js';
|
|
46
2
|
//# sourceMappingURL=bind-react.d.ts.map
|
package/dist/react/bind-react.js
CHANGED
|
@@ -1,28 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/** Every page and tab is lazy. The only port context is private to this binding;
|
|
4
|
-
* a sibling module can never read another module's dependencies through a global locator. */
|
|
5
|
-
export function bindReact({ module, views }, { context } = {}) {
|
|
6
|
-
const Context = context ?? createContext(null);
|
|
7
|
-
const pages = Object.fromEntries(Object.entries(views).map(([id, raw]) => {
|
|
8
|
-
const view = raw;
|
|
9
|
-
return [
|
|
10
|
-
id,
|
|
11
|
-
{
|
|
12
|
-
Page: lazy(view.page),
|
|
13
|
-
tabs: Object.fromEntries(Object.entries(view.tabs).map(([tab, load]) => [tab, lazy(load)])),
|
|
14
|
-
},
|
|
15
|
-
];
|
|
16
|
-
}));
|
|
17
|
-
function usePorts(_required = {}, _optional = {}) {
|
|
18
|
-
const ports = useContext(Context);
|
|
19
|
-
if (!ports)
|
|
20
|
-
throw new AdminConfigError({ issues: [`React scope unavailable: ${module.id}`] });
|
|
21
|
-
return ports;
|
|
22
|
-
}
|
|
23
|
-
function Provider({ admin, children }, _optional = {}) {
|
|
24
|
-
return createElement(Context.Provider, { value: admin.scope({ module }) }, children);
|
|
25
|
-
}
|
|
26
|
-
return { module, pages, Provider, usePorts };
|
|
27
|
-
}
|
|
1
|
+
// Compatibility path; the shared implementation lives in core.
|
|
2
|
+
export * from '../core/react/bind-react.js';
|
|
28
3
|
//# sourceMappingURL=bind-react.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
2
|
import { type ConfirmTone } from '../../types.js';
|
|
3
3
|
import { type UseConfirmDialog } from './ConfirmDialog.hooks.js';
|
|
4
4
|
/**
|
|
@@ -10,8 +10,8 @@ import { type UseConfirmDialog } from './ConfirmDialog.hooks.js';
|
|
|
10
10
|
* overlay + backdrop idiom: that shape hand-rolls focus trapping, Escape handling, and a backdrop
|
|
11
11
|
* element, all of which the browser's own top layer gives a real `<dialog>` for free, including
|
|
12
12
|
* correct stacking above everything else on the page without a chosen `z-index`. The `showModal`/
|
|
13
|
-
* `close` calls themselves, and the jsdom fallback they need,
|
|
14
|
-
* see that
|
|
13
|
+
* `close` calls themselves, and the jsdom fallback they need, are delegated by
|
|
14
|
+
* `ConfirmDialog.hooks.tsx` to UI-kit's native hook — see that adapter's doc comment.
|
|
15
15
|
*
|
|
16
16
|
* Unstyled, like everything in this layer: the `.confirm-dialog` / `.btn-secondary` /
|
|
17
17
|
* `.btn-danger` / `.btn-warning` class names are emitted for the host stylesheet to define.
|
|
@@ -51,7 +51,7 @@ import { type UseConfirmDialog } from './ConfirmDialog.hooks.js';
|
|
|
51
51
|
* Labels state both the action and its consequence tier, derived from this component's own
|
|
52
52
|
* three-tier `ConfirmTone` vocabulary rather than reparsed from `title`/`body`: `body` is arbitrary
|
|
53
53
|
* `ReactNode` (a caller can pass JSX), not guaranteed to be a string at all, so it cannot be safely
|
|
54
|
-
* folded into agent-facing text —
|
|
54
|
+
* folded into agent-facing text — the shared UI-kit confirmation planner owns those phrases.
|
|
55
55
|
*/
|
|
56
56
|
export interface ConfirmDialogProps {
|
|
57
57
|
open: boolean;
|
|
@@ -90,6 +90,23 @@ export interface ConfirmDialogProps {
|
|
|
90
90
|
* effect without `agentHandle`. @default true */
|
|
91
91
|
agentMayConfirm?: boolean;
|
|
92
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* UI-kit's confirmation planner owns the sub-handle segments appended to the caller's base:
|
|
95
|
+
* literals chosen by the mechanism, never host data. Neither needs sanitizing, unlike
|
|
96
|
+
* `RowMenu`'s per-item keys (see this file's "Agent handles" contract).
|
|
97
|
+
*
|
|
98
|
+
* Its plain-language consequence phrase is keyed off the dialog's three-tier `ConfirmTone`
|
|
99
|
+
* vocabulary (`"default"` / `"warning"` / `"danger"`, documented in `../../types.js`), rather
|
|
100
|
+
* than reparsed from `title` or `body`, which cannot safely supply agent-facing consequence text.
|
|
101
|
+
* The confirm label names the action (`confirmLabel`), target (`title`) and declared consequence;
|
|
102
|
+
* the planner does not parse `body` to decide whether an action is safe.
|
|
103
|
+
*
|
|
104
|
+
* The cancel label's consequence is a guarantee of the contract (cancelling never calls
|
|
105
|
+
* `onConfirm`), rather than something read off `tone`, so it needs no tone input at all.
|
|
106
|
+
* Agent attributes retain the shape used by `RowMenu`'s local `rowMenuAgentProps`; injecting
|
|
107
|
+
* admin's attribute port into the shared owner preserves that shape and handle validation
|
|
108
|
+
* without keeping a second local implementation. No base handle means no agent attributes.
|
|
109
|
+
*/
|
|
93
110
|
/**
|
|
94
111
|
* Controlled modal confirm — renders the `<dialog>` markup and delegates its open/close and focus
|
|
95
112
|
* lifecycle to {@link useConfirmDialog} (injectable via the `useDialog` prop, defaulted to the real
|
|
@@ -99,5 +116,5 @@ export interface ConfirmDialogProps {
|
|
|
99
116
|
* is no browser-assigned "default button" for Enter to reach for at all; confirm can only ever fire
|
|
100
117
|
* from an explicit click or explicit Tab-then-Enter onto it.
|
|
101
118
|
*/
|
|
102
|
-
export declare function ConfirmDialog({ useDialog, agentHandle: baseHandle, agentMayConfirm, ...props }: ConfirmDialogProps): import("react").JSX.Element;
|
|
119
|
+
export declare function ConfirmDialog({ useDialog, agentHandle: baseHandle, agentMayConfirm, ...props }: ConfirmDialogProps, _optional?: Record<string, never>): import("react").JSX.Element;
|
|
103
120
|
//# sourceMappingURL=ConfirmDialog.d.ts.map
|
|
@@ -78,10 +78,10 @@ export declare function useConfirmDialogCancelLabel(_requiredArgs: Record<string
|
|
|
78
78
|
readonly explicit?: string | undefined;
|
|
79
79
|
}): string;
|
|
80
80
|
/**
|
|
81
|
-
*
|
|
81
|
+
* Adapts UI-kit's `<dialog>` element open/close lifecycle and focus management for `ConfirmDialog`.
|
|
82
82
|
*
|
|
83
83
|
* The caller keeps `ConfirmDialog` mounted and toggles `open` — it is never conditionally rendered
|
|
84
|
-
* by its parent — so the
|
|
84
|
+
* by its parent — so the shared native hook has a stable `<dialog>` element to call `showModal()`/
|
|
85
85
|
* `close()` on and to restore focus through when it closes.
|
|
86
86
|
*
|
|
87
87
|
* Focus moves to the *cancel* action on open, not confirm — an operator whose first keystroke after
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { createContext, useContext,
|
|
2
|
+
import { createContext, useContext, useMemo, useRef, } from 'react';
|
|
3
|
+
import { useNativeDialog } from '@jini-ai/ui-kit/react/native';
|
|
3
4
|
/** Empty object, not `undefined` — {@link useConfirmDialogCancelLabel} can always read `cancelLabel`
|
|
4
5
|
* off it without an extra null check, whether or not a provider is mounted. */
|
|
5
6
|
const ConfirmDialogDefaultsContext = createContext({});
|
|
@@ -41,10 +42,10 @@ export function useConfirmDialogCancelLabel(_requiredArgs, { explicit } = {}) {
|
|
|
41
42
|
return explicit ?? cancelLabel ?? DEFAULT_CANCEL_LABEL;
|
|
42
43
|
}
|
|
43
44
|
/**
|
|
44
|
-
*
|
|
45
|
+
* Adapts UI-kit's `<dialog>` element open/close lifecycle and focus management for `ConfirmDialog`.
|
|
45
46
|
*
|
|
46
47
|
* The caller keeps `ConfirmDialog` mounted and toggles `open` — it is never conditionally rendered
|
|
47
|
-
* by its parent — so the
|
|
48
|
+
* by its parent — so the shared native hook has a stable `<dialog>` element to call `showModal()`/
|
|
48
49
|
* `close()` on and to restore focus through when it closes.
|
|
49
50
|
*
|
|
50
51
|
* Focus moves to the *cancel* action on open, not confirm — an operator whose first keystroke after
|
|
@@ -60,63 +61,24 @@ export function useConfirmDialog({ open, onCancel, document }, { pending } = {})
|
|
|
60
61
|
// in document order regardless of which dialog is actually open — a screen reader announcing
|
|
61
62
|
// "Delete role?" while the operator is about to confirm "Delete policy?", on a destructive
|
|
62
63
|
// action. `useId()` gives every mounted instance its own id for free.
|
|
63
|
-
const titleId = useId();
|
|
64
|
-
const dialogRef = useRef(null);
|
|
65
|
-
const cancelRef = useRef(null);
|
|
66
64
|
// Captured at the moment `open` flips true, before focus moves into the dialog — the element that
|
|
67
65
|
// had focus then is, by construction, whatever triggered this dialog (a `RowMenu` item's
|
|
68
66
|
// "Delete", a plain trigger button, …). Restored on close rather than left wherever the browser's
|
|
69
67
|
// own modal-focus algorithm happened to land (its default without this is `<body>`, which drops a
|
|
70
68
|
// keyboard user back to the top of the page).
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
cancelRef.current?.focus();
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
if (typeof dialog.close === 'function') {
|
|
89
|
-
if (dialog.open)
|
|
90
|
-
dialog.close();
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
93
|
-
dialog.removeAttribute('open');
|
|
94
|
-
}
|
|
95
|
-
if (triggerRef.current instanceof HTMLElement)
|
|
96
|
-
triggerRef.current.focus();
|
|
97
|
-
}
|
|
98
|
-
}, [open, document]);
|
|
99
|
-
function handleNativeCancel(e) {
|
|
100
|
-
// Fires on Escape while a real `showModal()`-opened dialog has focus. Always prevented: the
|
|
101
|
-
// effect above is the single source of truth for open/closed (driven by `open`), so
|
|
102
|
-
// letting the browser close the element on its own would desync DOM state from React state.
|
|
103
|
-
// Escape still closes the dialog — it just does so by routing through `onCancel`, same as a
|
|
104
|
-
// Cancel-button click, so the caller's `open` state (and therefore this same effect) is what
|
|
105
|
-
// actually calls `dialog.close()`.
|
|
106
|
-
e.preventDefault();
|
|
107
|
-
if (pending)
|
|
108
|
-
return;
|
|
109
|
-
onCancel();
|
|
110
|
-
}
|
|
111
|
-
function handleBackdropClick(e) {
|
|
112
|
-
// A `<dialog>` element's own box is sized to its content, not the viewport — a click that lands
|
|
113
|
-
// on the `<dialog>` element itself (as opposed to one of its children) is therefore a click on
|
|
114
|
-
// the backdrop area outside that content box.
|
|
115
|
-
if (pending)
|
|
116
|
-
return;
|
|
117
|
-
if (e.target === dialogRef.current)
|
|
118
|
-
onCancel();
|
|
119
|
-
}
|
|
69
|
+
// Fires on Escape while a real `showModal()`-opened dialog has focus. Always prevented: the
|
|
70
|
+
// shared native hook is the single source of truth for open/closed (driven by `open`), so
|
|
71
|
+
// letting the browser close the element on its own would desync DOM state from React state.
|
|
72
|
+
// Escape still closes the dialog — it just does so by routing through `onCancel`, same as a
|
|
73
|
+
// Cancel-button click, so the caller's `open` state (and therefore this same effect) is what
|
|
74
|
+
// actually calls `dialog.close()`.
|
|
75
|
+
// A `<dialog>` element's own box is sized to its content, not the viewport — a click that lands
|
|
76
|
+
// on the `<dialog>` element itself (as opposed to one of its children) is therefore a click on
|
|
77
|
+
// the backdrop area outside that content box.
|
|
78
|
+
const cancelRef = useRef(null);
|
|
79
|
+
const vm = useNativeDialog({ open, title: '', onClose: () => onCancel(), ...(pending === undefined ? {} : { pending }) }, { document, initialFocus: () => cancelRef.current?.focus() });
|
|
80
|
+
const titleId = vm.titleId, dialogRef = vm.props.ref;
|
|
81
|
+
const handleNativeCancel = vm.props.onCancel, handleBackdropClick = vm.props.onClick;
|
|
120
82
|
return { titleId, dialogRef, cancelRef, handleNativeCancel, handleBackdropClick };
|
|
121
83
|
}
|
|
122
84
|
//# sourceMappingURL=ConfirmDialog.hooks.js.map
|
|
@@ -1,72 +1,25 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {} from 'react';
|
|
3
2
|
import { agentHandle } from '@jini-ai/agentic';
|
|
3
|
+
import { useConfirmController } from '@jini-ai/ui-kit/react';
|
|
4
4
|
import { resolveTone, toneClassName } from '../../types.js';
|
|
5
5
|
import { useConfirmDialog, useConfirmDialogCancelLabel } from './ConfirmDialog.hooks.js';
|
|
6
|
-
/** Sub-handle segments appended to the caller's base — literals this component chooses itself,
|
|
7
|
-
* never host data (see this file's "Agent handles" doc comment for why that means neither needs
|
|
8
|
-
* sanitizing, unlike `RowMenu`'s per-item keys). */
|
|
9
|
-
const CONFIRM_HANDLE_ACTION = 'confirm';
|
|
10
|
-
const CANCEL_HANDLE_ACTION = 'cancel';
|
|
11
6
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* why those cannot be safely folded into agent-facing text.
|
|
7
|
+
* UI-kit's confirmation planner owns the sub-handle segments appended to the caller's base:
|
|
8
|
+
* literals chosen by the mechanism, never host data. Neither needs sanitizing, unlike
|
|
9
|
+
* `RowMenu`'s per-item keys (see this file's "Agent handles" contract).
|
|
16
10
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
if (tone === 'danger')
|
|
23
|
-
return 'cannot be undone';
|
|
24
|
-
if (tone === 'warning')
|
|
25
|
-
return 'changes access, but is reversible';
|
|
26
|
-
return undefined;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* The confirm action's agent-facing label: what it does (`confirmLabel`), what it applies to
|
|
30
|
-
* (`title`), and — when the tone declares one — its consequence tier.
|
|
31
|
-
*
|
|
32
|
-
* @param confirmLabel - The button's own visible text, e.g. `"Delete"`.
|
|
33
|
-
* @param title - The dialog's title, e.g. `"Delete role?"`.
|
|
34
|
-
* @param tone - The dialog's resolved tone.
|
|
35
|
-
* @returns A label an agent can use to judge whether confirming is safe, without having read
|
|
36
|
-
* `body` (which this function never receives — see this file's doc comment for why).
|
|
37
|
-
* @complexity O(1).
|
|
38
|
-
*/
|
|
39
|
-
function confirmDialogConfirmLabel(confirmLabel, title, tone) {
|
|
40
|
-
const consequence = confirmDialogConsequencePhrase(tone);
|
|
41
|
-
return consequence === undefined ? `${confirmLabel} — ${title}` : `${confirmLabel} — ${title}; ${consequence}`;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* The cancel action's agent-facing label. Unlike {@link confirmDialogConfirmLabel}, its consequence
|
|
45
|
-
* is a guarantee of this component's own contract (cancelling never calls `onConfirm`) rather than
|
|
46
|
-
* something read off `tone`, so it needs no tone input at all.
|
|
47
|
-
*
|
|
48
|
-
* @param cancelLabel - The button's own visible text, already defaulted by the caller.
|
|
49
|
-
* @param title - The dialog's title, e.g. `"Delete role?"`.
|
|
50
|
-
* @returns A label stating that this action leaves the titled action unconfirmed.
|
|
51
|
-
* @complexity O(1).
|
|
52
|
-
*/
|
|
53
|
-
function confirmDialogCancelLabel(cancelLabel, title) {
|
|
54
|
-
return `${cancelLabel} — leaves "${title}" unconfirmed; no action taken`;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Builds the `data-agent-*` attribute props for one of this dialog's two actions, or nothing at
|
|
58
|
-
* all when the dialog published no base handle — same shape as `RowMenu.tsx`'s local
|
|
59
|
-
* `rowMenuAgentProps`, kept local and unexported here since only this one component needs it.
|
|
11
|
+
* Its plain-language consequence phrase is keyed off the dialog's three-tier `ConfirmTone`
|
|
12
|
+
* vocabulary (`"default"` / `"warning"` / `"danger"`, documented in `../../types.js`), rather
|
|
13
|
+
* than reparsed from `title` or `body`, which cannot safely supply agent-facing consequence text.
|
|
14
|
+
* The confirm label names the action (`confirmLabel`), target (`title`) and declared consequence;
|
|
15
|
+
* the planner does not parse `body` to decide whether an action is safe.
|
|
60
16
|
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
17
|
+
* The cancel label's consequence is a guarantee of the contract (cancelling never calls
|
|
18
|
+
* `onConfirm`), rather than something read off `tone`, so it needs no tone input at all.
|
|
19
|
+
* Agent attributes retain the shape used by `RowMenu`'s local `rowMenuAgentProps`; injecting
|
|
20
|
+
* admin's attribute port into the shared owner preserves that shape and handle validation
|
|
21
|
+
* without keeping a second local implementation. No base handle means no agent attributes.
|
|
66
22
|
*/
|
|
67
|
-
function confirmDialogAgentProps(base, action, options) {
|
|
68
|
-
return base === undefined ? {} : agentHandle({ handle: `${base}-${action}` }, options);
|
|
69
|
-
}
|
|
70
23
|
/**
|
|
71
24
|
* Controlled modal confirm — renders the `<dialog>` markup and delegates its open/close and focus
|
|
72
25
|
* lifecycle to {@link useConfirmDialog} (injectable via the `useDialog` prop, defaulted to the real
|
|
@@ -76,16 +29,26 @@ function confirmDialogAgentProps(base, action, options) {
|
|
|
76
29
|
* is no browser-assigned "default button" for Enter to reach for at all; confirm can only ever fire
|
|
77
30
|
* from an explicit click or explicit Tab-then-Enter onto it.
|
|
78
31
|
*/
|
|
79
|
-
export function ConfirmDialog({ useDialog = useConfirmDialog, agentHandle: baseHandle, agentMayConfirm = true, ...props }) {
|
|
80
|
-
const { titleId, dialogRef, cancelRef, handleNativeCancel, handleBackdropClick } = useDialog({ open: props.open, onCancel: props.onCancel, document }, { pending: props.pending });
|
|
32
|
+
export function ConfirmDialog({ useDialog = useConfirmDialog, agentHandle: baseHandle, agentMayConfirm = true, ...props }, _optional = {}) {
|
|
81
33
|
const tone = resolveTone({}, props);
|
|
82
34
|
const cancelLabel = useConfirmDialogCancelLabel({}, { explicit: props.cancelLabel });
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
35
|
+
const controller = useConfirmController({
|
|
36
|
+
open: props.open, title: props.title, body: props.body, confirmLabel: props.confirmLabel,
|
|
37
|
+
cancelLabel, tone, agentMayConfirm,
|
|
38
|
+
...(baseHandle === undefined ? {} : { agentHandle: baseHandle }),
|
|
39
|
+
...(props.pending === undefined ? {} : { pending: props.pending }),
|
|
40
|
+
onConfirm: () => props.onConfirm(), onCancel: () => props.onCancel(),
|
|
41
|
+
}, {
|
|
42
|
+
// UI-kit names selects separately; agentic publishes them as fields and still owns handle validation.
|
|
43
|
+
agent: ((required, optional = {}) => agentHandle(required, {
|
|
44
|
+
...(optional.role === undefined ? {} : { role: optional.role === 'select' ? 'field' : optional.role }),
|
|
45
|
+
...(optional.label === undefined ? {} : { label: optional.label }),
|
|
46
|
+
})),
|
|
47
|
+
});
|
|
48
|
+
const { titleId, dialogRef, cancelRef, handleNativeCancel, handleBackdropClick } = useDialog({ open: props.open, onCancel: () => { controller.requestDismiss({ reason: 'close' }); }, document }, { pending: controller.pending });
|
|
49
|
+
// Keep admin's concise accessible names; the shared planner still supplies consequence-aware agent labels.
|
|
50
|
+
const { 'aria-label': _cancelName, ...cancelAttrs } = controller.cancel.attrs ?? {};
|
|
51
|
+
const { 'aria-label': _confirmName, ...confirmAttrs } = controller.confirm.attrs ?? {};
|
|
52
|
+
return (_jsxs("dialog", { ref: dialogRef, className: "confirm-dialog", "aria-labelledby": titleId, onCancel: handleNativeCancel, onClick: handleBackdropClick, children: [_jsx("h2", { id: titleId, children: props.title }), _jsxs("div", { className: "confirm-dialog-body", children: [props.body, controller.error] }), _jsxs("div", { className: "confirm-dialog-actions", children: [_jsx("button", { ref: cancelRef, type: "button", className: "btn-secondary", disabled: controller.pending, onClick: () => controller.cancel.onPress?.({}), ...cancelAttrs, children: cancelLabel }), _jsx("button", { type: "button", className: toneClassName({ tone }), disabled: controller.pending, onClick: () => controller.confirm.onPress?.({}), ...confirmAttrs, children: props.confirmLabel })] })] }));
|
|
90
53
|
}
|
|
91
54
|
//# sourceMappingURL=ConfirmDialog.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type KeyboardEvent } from 'react';
|
|
1
|
+
import { type KeyboardEvent, type RefObject } from 'react';
|
|
2
2
|
/**
|
|
3
3
|
* @file `RowMenu`'s open/close state, viewport-aware positioning, and keyboard/focus behavior,
|
|
4
4
|
* split out of the component so it can be swapped for a fake via the `useRowMenu` prop on
|
|
@@ -9,6 +9,25 @@ interface Position {
|
|
|
9
9
|
left: number;
|
|
10
10
|
placement: 'below' | 'above';
|
|
11
11
|
}
|
|
12
|
+
type RowMenuWindow = Pick<Window, 'innerHeight' | 'innerWidth' | 'addEventListener' | 'removeEventListener'>;
|
|
13
|
+
type RowMenuDocument = Pick<Document, 'addEventListener' | 'removeEventListener'>;
|
|
14
|
+
/** What `useRowMenu` hands `RowMenu` — and the shape an injected `useRowMenu` fake must return. */
|
|
15
|
+
export interface RowMenuState {
|
|
16
|
+
readonly open: boolean;
|
|
17
|
+
readonly position: Position | null;
|
|
18
|
+
readonly triggerRef: RefObject<HTMLButtonElement | null>;
|
|
19
|
+
/** A callback ref from the real hook (see {@link trackOpenMenu}; `null` while closed), or a host
|
|
20
|
+
* hook's ref object. Spelled out rather than React's `Ref`, whose callback form carries a brand
|
|
21
|
+
* that fails to match across two installed `@types/react` copies (Jini's vs a host app's). */
|
|
22
|
+
readonly menuRef: RefObject<HTMLDivElement | null> | ((menu: HTMLDivElement | null) => void) | null;
|
|
23
|
+
readonly itemRefs: RefObject<Array<HTMLButtonElement | null>>;
|
|
24
|
+
readonly onTriggerClick: () => void;
|
|
25
|
+
readonly onTriggerKeyDown: (event: KeyboardEvent<HTMLButtonElement>) => void;
|
|
26
|
+
readonly onMenuKeyDown: (event: KeyboardEvent<HTMLDivElement>) => void;
|
|
27
|
+
readonly selectItem: (item: {
|
|
28
|
+
readonly onSelect: () => void;
|
|
29
|
+
}) => void;
|
|
30
|
+
}
|
|
12
31
|
/**
|
|
13
32
|
* Owns `RowMenu`'s open/close state, positioning, and keyboard/focus behavior.
|
|
14
33
|
*
|
|
@@ -17,20 +36,8 @@ interface Position {
|
|
|
17
36
|
*/
|
|
18
37
|
export declare function useRowMenu({ itemCount, window, document }: {
|
|
19
38
|
readonly itemCount: number;
|
|
20
|
-
readonly window:
|
|
21
|
-
readonly document:
|
|
22
|
-
}):
|
|
23
|
-
open: boolean;
|
|
24
|
-
position: Position | null;
|
|
25
|
-
triggerRef: import("react").RefObject<HTMLButtonElement | null>;
|
|
26
|
-
menuRef: import("react").RefObject<HTMLDivElement | null>;
|
|
27
|
-
itemRefs: import("react").RefObject<(HTMLButtonElement | null)[]>;
|
|
28
|
-
onTriggerClick: () => void;
|
|
29
|
-
onTriggerKeyDown: (e: KeyboardEvent<HTMLButtonElement>) => void;
|
|
30
|
-
onMenuKeyDown: (e: KeyboardEvent<HTMLDivElement>) => void;
|
|
31
|
-
selectItem: ({ onSelect }: {
|
|
32
|
-
readonly onSelect: () => void;
|
|
33
|
-
}) => void;
|
|
34
|
-
};
|
|
39
|
+
readonly window: RowMenuWindow;
|
|
40
|
+
readonly document: RowMenuDocument;
|
|
41
|
+
}): RowMenuState;
|
|
35
42
|
export {};
|
|
36
43
|
//# sourceMappingURL=RowMenu.hooks.d.ts.map
|