@jini-ai/admin 0.7.2 → 0.7.3-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -4
- package/dist/agent-plugins/agent-plugins.module.d.ts +1 -1
- package/dist/agent-plugins/agent-plugins.module.js +1 -1
- package/dist/agent-plugins/controllers/agent-plugin-files.controller.d.ts +3 -3
- package/dist/agent-plugins/controllers/agent-plugin-files.controller.js +1 -1
- package/dist/agent-plugins/controllers/agent-plugins.controller.d.ts +3 -3
- package/dist/agent-plugins/controllers/agent-plugins.controller.js +30 -27
- package/dist/agent-plugins/index.d.ts +11 -8
- package/dist/agent-plugins/index.js +7 -8
- package/dist/agent-plugins/models.d.ts +19 -11
- package/dist/agent-plugins/ports.d.ts +1 -1
- package/dist/agent-plugins/ports.js +1 -1
- package/dist/agent-plugins/react/components/AgentPluginFileContent.d.ts +4 -2
- package/dist/agent-plugins/react/components/AgentPluginFileContent.js +3 -3
- package/dist/agent-plugins/react/components/AgentPluginFileTree.d.ts +4 -2
- package/dist/agent-plugins/react/components/AgentPluginFileTree.js +2 -2
- package/dist/agent-plugins/react/components/AgentPluginInspector.d.ts +4 -2
- package/dist/agent-plugins/react/components/AgentPluginInspector.js +3 -3
- package/dist/agent-plugins/react/components/AgentPluginListPanel.d.ts +5 -3
- package/dist/agent-plugins/react/components/AgentPluginListPanel.js +3 -3
- package/dist/agent-plugins/react/components/AgentPluginRow.d.ts +3 -1
- package/dist/agent-plugins/react/components/AgentPluginRow.js +3 -3
- package/dist/agent-plugins/react/hooks/AgentPluginInspector.hooks.js +2 -2
- package/dist/agent-plugins/react/hooks/AgentPluginPanel.hooks.d.ts +6 -5
- package/dist/agent-plugins/react/hooks/AgentPluginRow.hooks.d.ts +5 -4
- package/dist/agent-plugins/react/hooks/AgentPluginsPage.hooks.d.ts +11 -7
- package/dist/agent-plugins/react/hooks/AgentPluginsPage.hooks.js +3 -3
- package/dist/agent-plugins/react/hooks/AgentPluginsPorts.hooks.d.ts +5 -0
- package/dist/agent-plugins/react/hooks/AgentPluginsPorts.hooks.js +11 -1
- package/dist/agent-plugins/react/hooks/MarketplaceTab.hooks.d.ts +1 -1
- package/dist/agent-plugins/react/index.d.ts +25 -71
- package/dist/agent-plugins/react/index.js +9 -6
- package/dist/agent-plugins/react/pages/AgentPluginsPage.d.ts +8 -2
- package/dist/agent-plugins/react/pages/AgentPluginsPage.js +3 -3
- package/dist/agent-plugins/react/tabs/DownloadedTab.d.ts +2 -2
- package/dist/agent-plugins/react/tabs/DownloadedTab.js +1 -1
- package/dist/agent-plugins/react/tabs/InstalledTab.d.ts +2 -2
- package/dist/agent-plugins/react/tabs/InstalledTab.js +1 -1
- package/dist/agent-plugins/react/tabs/MarketplaceTab.d.ts +5 -2
- package/dist/agent-plugins/react/tabs/MarketplaceTab.js +3 -3
- package/dist/browser/index.d.ts +2 -0
- package/dist/browser/index.js +2 -0
- package/dist/browser/react-root-errors.d.ts +19 -0
- package/dist/browser/react-root-errors.js +16 -0
- package/dist/comments/adapters/http.js +2 -3
- package/dist/comments/adapters/memory.d.ts +5 -3
- package/dist/comments/adapters/memory.js +5 -6
- package/dist/comments/comments.module.d.ts +3 -3
- package/dist/comments/comments.module.js +1 -1
- package/dist/comments/controllers/comment-queue.controller.d.ts +14 -12
- package/dist/comments/controllers/comment-queue.controller.js +154 -155
- package/dist/comments/controllers/comment-settings.controller.d.ts +4 -4
- package/dist/comments/controllers/comment-settings.controller.js +40 -39
- package/dist/comments/controllers/comments.controller.d.ts +4 -4
- package/dist/comments/controllers/comments.controller.js +1 -2
- package/dist/comments/ports.d.ts +3 -3
- package/dist/comments/ports.js +1 -1
- package/dist/comments/react/components/QueueActionsCell.d.ts +20 -0
- package/dist/comments/react/components/QueueActionsCell.js +15 -0
- package/dist/comments/react/components/QueueSection.d.ts +20 -9
- package/dist/comments/react/components/QueueSection.js +9 -20
- package/dist/comments/react/components/SettingsFields.d.ts +13 -0
- package/dist/comments/react/components/SettingsFields.js +17 -0
- package/dist/comments/react/components/SettingsSection.d.ts +4 -1
- package/dist/comments/react/components/SettingsSection.js +5 -10
- package/dist/comments/react/hooks/CommentsPage.hooks.js +1 -1
- package/dist/comments/react/hooks/CommentsPorts.hooks.d.ts +5 -0
- package/dist/comments/react/hooks/CommentsPorts.hooks.js +11 -1
- package/dist/comments/react/hooks/QueueActionsCell.hooks.d.ts +13 -0
- package/dist/comments/react/hooks/QueueActionsCell.hooks.js +7 -0
- package/dist/comments/react/hooks/QueueSection.hooks.d.ts +3 -11
- package/dist/comments/react/hooks/QueueSection.hooks.js +8 -11
- package/dist/comments/react/hooks/use-comment-queue.hooks.js +4 -4
- package/dist/comments/react/hooks/use-comment-settings.hooks.js +3 -3
- package/dist/comments/react/hooks/use-comments.hooks.js +3 -3
- package/dist/comments/react/index.d.ts +27 -89
- package/dist/comments/react/index.js +5 -6
- package/dist/comments/react/pages/CommentsPage.d.ts +4 -1
- package/dist/comments/react/pages/CommentsPage.js +2 -2
- package/dist/comments/rules.d.ts +1 -1
- package/dist/comments/rules.js +2 -3
- package/dist/contracts/credential-management.d.ts +1 -1
- package/dist/contracts/credential-management.js +1 -1
- package/dist/contracts/media-picker.d.ts +1 -1
- package/dist/contracts/media-picker.js +1 -1
- package/dist/contracts/playground-render-target.d.ts +1 -1
- package/dist/contracts/playground-render-target.js +1 -1
- package/dist/core/entities/rules.d.ts +8 -2
- package/dist/core/entities/rules.js +3 -3
- package/dist/core/index.d.ts +1 -2
- package/dist/core/index.js +1 -3
- package/dist/core/ledger-slice.d.ts +3 -3
- package/dist/core/ledger-slice.js +3 -3
- package/dist/core/manifest/rules.js +1 -1
- package/dist/core/manifest/types.d.ts +11 -0
- package/dist/core/module/create-admin.d.ts +1 -8
- package/dist/core/module/create-admin.js +4 -9
- package/dist/core/module/index.d.ts +1 -5
- package/dist/core/module/index.js +1 -3
- package/dist/core/ports/auth.d.ts +2 -2
- package/dist/core/ports/auth.js +1 -1
- package/dist/core/ports/comment-repo.d.ts +53 -0
- package/dist/core/ports/comment-repo.js +2 -0
- package/dist/core/ports/comments.d.ts +1 -1
- package/dist/core/ports/comments.js +1 -1
- package/dist/core/ports/database.d.ts +1 -1
- package/dist/core/ports/embed-policy.d.ts +19 -0
- package/dist/core/ports/embed-policy.js +2 -0
- package/dist/core/ports/entities.d.ts +14 -0
- package/dist/core/ports/forms-catalog.d.ts +27 -0
- package/dist/core/ports/forms-catalog.js +2 -0
- package/dist/core/ports/forms.d.ts +3 -3
- package/dist/core/ports/identity.d.ts +1 -1
- package/dist/core/ports/identity.js +1 -1
- package/dist/core/ports/index.d.ts +3 -0
- package/dist/core/ports/media.d.ts +1 -1
- package/dist/core/ports/plugins.d.ts +1 -1
- package/dist/core/react/bind-react.d.ts +6 -16
- package/dist/core/react/bind-react.js +1 -1
- package/dist/core/react/index.d.ts +3 -2
- package/dist/core/react/index.js +3 -2
- package/dist/core/react/module-ui.d.ts +10 -0
- package/dist/core/react/module-ui.js +6 -0
- package/dist/core/react/use-controller.d.ts +1 -1
- package/dist/core/react/use-controller.js +2 -1
- package/dist/core/routing/route-template.d.ts +11 -0
- package/dist/core/routing/route-template.js +23 -0
- package/dist/core/transport/http.js +7 -5
- package/dist/core/transport/index.d.ts +0 -1
- package/dist/core/transport/index.js +0 -1
- package/dist/forms/adapters/http.js +2 -2
- package/dist/forms/adapters/memory.d.ts +1 -1
- package/dist/forms/adapters/memory.js +35 -26
- package/dist/forms/controllers/draft-store.d.ts +4 -4
- package/dist/forms/controllers/draft-store.js +1 -1
- package/dist/forms/controllers/field-attributes-dialog.controller.d.ts +7 -8
- package/dist/forms/controllers/field-attributes-dialog.controller.js +8 -6
- package/dist/forms/controllers/form-editor.controller.d.ts +8 -5
- package/dist/forms/controllers/form-editor.controller.js +2 -2
- package/dist/forms/controllers/form-fields-editor.controller.d.ts +4 -4
- package/dist/forms/controllers/form-submission-detail.controller.d.ts +4 -4
- package/dist/forms/controllers/form-submissions.controller.d.ts +4 -4
- package/dist/forms/controllers/forms-list.controller.d.ts +4 -4
- package/dist/forms/field-settings.d.ts +32 -16
- package/dist/forms/field-settings.js +52 -41
- package/dist/forms/forms.module.d.ts +5 -4
- package/dist/forms/forms.module.js +3 -3
- package/dist/forms/html-rules.d.ts +4 -2
- package/dist/forms/html-rules.js +19 -19
- package/dist/forms/index.d.ts +6 -4
- package/dist/forms/index.js +3 -3
- package/dist/forms/messages.en.js +1 -1
- package/dist/forms/models.d.ts +1 -1
- package/dist/forms/ports.d.ts +8 -4
- package/dist/forms/ports.js +3 -1
- package/dist/forms/react/components/FieldAttributesDialog.d.ts +4 -1
- package/dist/forms/react/components/FieldAttributesDialog.js +6 -28
- package/dist/forms/react/components/FieldAttributesStyling.d.ts +26 -0
- package/dist/forms/react/components/FieldAttributesStyling.js +42 -0
- package/dist/forms/react/components/FieldSettingsRows.js +3 -4
- package/dist/forms/react/components/FieldSettingsSection.d.ts +4 -1
- package/dist/forms/react/components/FieldSettingsSection.js +3 -3
- package/dist/forms/react/components/FormEditorFieldsBody.d.ts +5 -2
- package/dist/forms/react/components/FormEditorFieldsBody.js +3 -3
- package/dist/forms/react/components/FormEditorFieldsBodyParts.js +1 -1
- package/dist/forms/react/components/FormEditorFieldsSlot.d.ts +6 -0
- package/dist/forms/react/components/FormEditorFieldsSlot.js +10 -0
- package/dist/forms/react/components/FormEditorHeader.d.ts +9 -0
- package/dist/forms/react/components/FormEditorHeader.js +16 -0
- package/dist/forms/react/components/FormEditorHeaderText.d.ts +1 -1
- package/dist/forms/react/components/FormEditorHeaderText.js +1 -1
- package/dist/forms/react/components/FormEditorMainPanel.d.ts +1 -1
- package/dist/forms/react/components/FormEditorMainPanel.js +4 -4
- package/dist/forms/react/components/FormEditorTabStrip.d.ts +5 -2
- package/dist/forms/react/components/FormEditorTabStrip.js +3 -4
- package/dist/forms/react/components/FormFieldRow.d.ts +10 -0
- package/dist/forms/react/components/FormFieldRow.js +53 -0
- package/dist/forms/react/components/FormFieldsEditor.d.ts +4 -1
- package/dist/forms/react/components/FormFieldsEditor.js +6 -22
- package/dist/forms/react/components/FormFieldsTableParts.d.ts +10 -0
- package/dist/forms/react/components/FormFieldsTableParts.js +11 -0
- package/dist/forms/react/components/FormSubmissionDate.d.ts +1 -1
- package/dist/forms/react/components/FormSubmissionDate.js +1 -1
- package/dist/forms/react/components/FormSubmissionDetail.d.ts +4 -1
- package/dist/forms/react/components/FormSubmissionDetail.js +3 -3
- package/dist/forms/react/components/FormSubmissions.d.ts +6 -1
- package/dist/forms/react/components/FormSubmissions.js +3 -3
- package/dist/forms/react/components/FormSubmissionsTable.js +1 -1
- package/dist/forms/react/components/FormsListParts.d.ts +36 -0
- package/dist/forms/react/components/FormsListParts.js +41 -0
- package/dist/forms/react/hooks/FormsPorts.hooks.d.ts +7 -1
- package/dist/forms/react/hooks/FormsPorts.hooks.js +11 -1
- package/dist/forms/react/hooks/forms-view.hooks.d.ts +17 -11
- package/dist/forms/react/hooks/forms-view.hooks.js +13 -11
- package/dist/forms/react/hooks/use-field-attributes-dialog.hooks.d.ts +4 -1
- package/dist/forms/react/hooks/use-field-attributes-dialog.hooks.js +6 -4
- package/dist/forms/react/hooks/use-form-editor-parts.hooks.d.ts +127 -0
- package/dist/forms/react/hooks/use-form-editor-parts.hooks.js +223 -0
- package/dist/forms/react/hooks/use-form-editor.hooks.d.ts +13 -3
- package/dist/forms/react/hooks/use-form-editor.hooks.js +34 -210
- package/dist/forms/react/hooks/use-form-fields-editor.hooks.js +2 -2
- package/dist/forms/react/hooks/use-form-submission-detail.hooks.d.ts +2 -2
- package/dist/forms/react/hooks/use-form-submission-detail.hooks.js +4 -4
- package/dist/forms/react/hooks/use-form-submissions.hooks.d.ts +2 -2
- package/dist/forms/react/hooks/use-form-submissions.hooks.js +4 -5
- package/dist/forms/react/hooks/use-forms-list.hooks.js +3 -3
- package/dist/forms/react/index.d.ts +35 -26
- package/dist/forms/react/index.js +5 -6
- package/dist/forms/react/pages/FormEditor.d.ts +2 -2
- package/dist/forms/react/pages/FormEditor.js +7 -12
- package/dist/forms/react/pages/FormsList.d.ts +5 -2
- package/dist/forms/react/pages/FormsList.js +4 -30
- package/dist/forms/rules.d.ts +5 -5
- package/dist/forms/rules.js +8 -20
- package/dist/media/adapters/http.d.ts +24 -2
- package/dist/media/adapters/http.js +133 -10
- package/dist/media/adapters/memory.js +41 -46
- package/dist/media/conformance/media-api.conformance.js +60 -42
- package/dist/media/controllers/edit-media.controller.d.ts +5 -5
- package/dist/media/controllers/edit-media.controller.js +20 -17
- package/dist/media/controllers/library.controller.d.ts +14 -14
- package/dist/media/controllers/library.controller.js +180 -167
- package/dist/media/controllers/providers.controller.d.ts +4 -4
- package/dist/media/controllers/providers.controller.js +46 -40
- package/dist/media/html-attributes.d.ts +23 -13
- package/dist/media/html-attributes.js +15 -23
- package/dist/media/index.d.ts +5 -4
- package/dist/media/index.js +3 -3
- package/dist/media/media.module.d.ts +6 -5
- package/dist/media/media.module.js +3 -3
- package/dist/media/ports.d.ts +8 -3
- package/dist/media/ports.js +4 -1
- package/dist/media/react/components/EditMediaPanel.d.ts +4 -1
- package/dist/media/react/components/EditMediaPanel.js +3 -3
- package/dist/media/react/components/MediaCard.d.ts +7 -2
- package/dist/media/react/components/MediaCard.js +6 -6
- package/dist/media/react/components/MediaDialog.d.ts +4 -1
- package/dist/media/react/components/MediaDialog.js +3 -3
- package/dist/media/react/components/MediaGrid.d.ts +4 -1
- package/dist/media/react/components/MediaGrid.js +2 -2
- package/dist/media/react/components/MediaIcons.d.ts +9 -9
- package/dist/media/react/components/MediaIcons.js +9 -9
- package/dist/media/react/components/MediaLightbox.d.ts +4 -1
- package/dist/media/react/components/MediaLightbox.js +3 -3
- package/dist/media/react/components/MediaPicker.d.ts +4 -1
- package/dist/media/react/components/MediaPicker.js +3 -3
- package/dist/media/react/components/MediaPurgeDialog.d.ts +4 -1
- package/dist/media/react/components/MediaPurgeDialog.js +3 -3
- package/dist/media/react/components/UploadButton.d.ts +4 -1
- package/dist/media/react/components/UploadButton.js +3 -3
- package/dist/media/react/hooks/EditMediaPanel.hooks.d.ts +6 -3
- package/dist/media/react/hooks/EditMediaPanel.hooks.js +62 -50
- package/dist/media/react/hooks/LibraryTab.hooks.d.ts +23 -23
- package/dist/media/react/hooks/LibraryTab.hooks.js +52 -36
- package/dist/media/react/hooks/MediaCard.hooks.d.ts +1 -1
- package/dist/media/react/hooks/MediaCard.hooks.js +2 -1
- package/dist/media/react/hooks/MediaDialog.hooks.d.ts +1 -1
- package/dist/media/react/hooks/MediaPage.hooks.d.ts +22 -18
- package/dist/media/react/hooks/MediaPage.hooks.js +3 -3
- package/dist/media/react/hooks/MediaPicker.hooks.d.ts +1 -1
- package/dist/media/react/hooks/MediaPicker.hooks.js +2 -2
- package/dist/media/react/hooks/MediaPorts.hooks.d.ts +7 -0
- package/dist/media/react/hooks/MediaPorts.hooks.js +11 -1
- package/dist/media/react/hooks/MediaQuery.hooks.d.ts +3 -3
- package/dist/media/react/hooks/MediaQuery.hooks.js +1 -1
- package/dist/media/react/hooks/ProvidersTab.hooks.d.ts +7 -1
- package/dist/media/react/hooks/ProvidersTab.hooks.js +49 -46
- package/dist/media/react/index.d.ts +39 -114
- package/dist/media/react/index.js +55 -48
- package/dist/media/react/pages/MediaPage.d.ts +4 -1
- package/dist/media/react/pages/MediaPage.js +2 -2
- package/dist/media/react/tabs/LibraryTab.d.ts +5 -2
- package/dist/media/react/tabs/LibraryTab.js +3 -3
- package/dist/media/react/tabs/ProvidersTab.d.ts +5 -2
- package/dist/media/react/tabs/ProvidersTab.js +2 -2
- package/dist/media/rules.d.ts +0 -7
- package/dist/media/rules.js +0 -12
- package/dist/playground/controllers/playground.controller.d.ts +3 -3
- package/dist/playground/controllers/playground.controller.js +1 -1
- package/dist/playground/playground.module.d.ts +1 -1
- package/dist/playground/playground.module.js +1 -1
- package/dist/playground/react/components/Canvas.d.ts +5 -2
- package/dist/playground/react/components/Canvas.js +3 -3
- package/dist/playground/react/hooks/Canvas.hooks.d.ts +1 -1
- package/dist/playground/react/hooks/PlaygroundPage.hooks.d.ts +7 -3
- package/dist/playground/react/hooks/PlaygroundPorts.hooks.js +1 -1
- package/dist/playground/react/index.d.ts +9 -9
- package/dist/playground/react/pages/PlaygroundPage.d.ts +8 -2
- package/dist/playground/react/pages/PlaygroundPage.js +3 -3
- package/dist/playground/react/tabs/CanvasTab.d.ts +2 -2
- package/dist/playground/react/tabs/CanvasTab.js +1 -1
- package/dist/react/OverlayHost.d.ts +4 -1
- package/dist/react/OverlayHost.js +2 -2
- package/dist/react/components/ConfirmDialog/ConfirmDialog.d.ts +12 -2
- package/dist/react/components/ConfirmDialog/ConfirmDialog.hooks.js +1 -2
- package/dist/react/components/ConfirmDialog/ConfirmDialog.js +6 -4
- package/dist/react/components/ConfirmDialog/confirm-dialog-attrs.d.ts +1 -1
- package/dist/react/components/ConfirmDialog/confirm-dialog-attrs.js +1 -1
- package/dist/react/components/InteractiveHtmlEditor/InteractiveHtmlEditor.d.ts +2 -2
- package/dist/react/components/InteractiveHtmlEditor/InteractiveHtmlEditor.js +9 -8
- package/dist/react/components/RowMenu/RowMenu.hooks.js +66 -63
- package/dist/react/components/RowMenu/RowMenu.js +1 -1
- package/dist/react/components/Sidebar.d.ts +11 -4
- package/dist/react/components/Sidebar.js +11 -101
- package/dist/react/components/SidebarIcon.d.ts +4 -0
- package/dist/react/components/SidebarIcon.js +91 -0
- package/dist/react/components/ThemePreviewReloadControl.d.ts +7 -0
- package/dist/react/components/ThemePreviewReloadControl.js +5 -0
- package/dist/react/entities/EntityDetail.d.ts +4 -1
- package/dist/react/entities/EntityDetail.hooks.d.ts +14 -0
- package/dist/react/entities/EntityDetail.hooks.js +10 -0
- package/dist/react/entities/EntityDetail.js +3 -6
- package/dist/react/entities/EntityEdit.d.ts +6 -1
- package/dist/react/entities/EntityEdit.js +23 -6
- package/dist/react/entities/EntityField.d.ts +3 -1
- package/dist/react/entities/EntityField.js +9 -6
- package/dist/react/entities/EntityList.d.ts +4 -1
- package/dist/react/entities/EntityList.hooks.d.ts +33 -0
- package/dist/react/entities/EntityList.hooks.js +28 -0
- package/dist/react/entities/EntityList.js +3 -23
- package/dist/react/entities/FailureNotice.d.ts +29 -0
- package/dist/react/entities/FailureNotice.js +33 -0
- package/dist/react/entities/contribution.d.ts +2 -0
- package/dist/react/entities/contribution.js +2 -2
- package/dist/react/entities/rules.d.ts +6 -1
- package/dist/react/entities/rules.js +7 -4
- package/dist/react/entities/types.d.ts +19 -0
- package/dist/react/entities/use-entity-edit.d.ts +11 -2
- package/dist/react/entities/use-entity-edit.js +18 -12
- package/dist/react/entities/use-entity-read.d.ts +7 -2
- package/dist/react/entities/use-entity-read.js +9 -4
- package/dist/react/hooks/use-browser-telemetry-feed.d.ts +13 -0
- package/dist/react/hooks/use-browser-telemetry-feed.js +14 -0
- package/dist/react/hooks/use-overflow-title.d.ts +17 -0
- package/dist/react/hooks/use-overflow-title.js +29 -0
- package/dist/react/hooks/use-process-restart.d.ts +46 -0
- package/dist/react/hooks/use-process-restart.js +59 -0
- package/dist/react/hooks/use-rail-label-titles.d.ts +18 -0
- package/dist/react/hooks/use-rail-label-titles.js +44 -0
- package/dist/react/index.d.ts +6 -0
- package/dist/react/index.js +5 -0
- package/dist/react/kit-media-providers.d.ts +187 -0
- package/dist/react/kit-media-providers.js +2 -0
- package/dist/react/kit.d.ts +478 -0
- package/dist/react/kit.js +75 -0
- package/dist/react/overlays.d.ts +4 -4
- package/dist/react/overlays.js +1 -1
- package/dist/react/shell/AdminShell.d.ts +2 -2
- package/dist/react/shell/AdminShell.js +56 -24
- package/dist/react/shell/index.d.ts +1 -1
- package/dist/react/shell/model.d.ts +9 -1
- package/dist/react/shell/model.js +31 -15
- package/dist/react/shell/shell-hooks.d.ts +34 -0
- package/dist/react/shell/shell-hooks.js +31 -0
- package/dist/react/shell/theme-ports.d.ts +1 -1
- package/dist/react/shell/types.d.ts +97 -3
- package/dist/react/shell/use-admin-theme.d.ts +4 -2
- package/dist/react/shell/use-admin-theme.js +4 -3
- package/dist/react/testing-kit-media-providers.d.ts +3 -0
- package/dist/react/testing-kit-media-providers.js +96 -0
- package/dist/react/testing-kit.d.ts +11 -0
- package/dist/react/testing-kit.js +114 -0
- package/dist/redirects/adapters/memory.js +42 -33
- package/dist/redirects/conformance/redirects-api.conformance.js +1 -1
- package/dist/redirects/controllers/hit-count.controller.d.ts +5 -5
- package/dist/redirects/controllers/hit-count.controller.js +1 -1
- package/dist/redirects/controllers/import-redirects.controller.d.ts +5 -5
- package/dist/redirects/controllers/import-redirects.controller.js +1 -1
- package/dist/redirects/controllers/redirects.controller.d.ts +5 -5
- package/dist/redirects/controllers/redirects.controller.js +1 -1
- package/dist/redirects/index.d.ts +11 -7
- package/dist/redirects/index.js +6 -7
- package/dist/redirects/messages.en.d.ts +1 -0
- package/dist/redirects/messages.en.js +1 -0
- package/dist/redirects/ports.d.ts +2 -2
- package/dist/redirects/ports.js +1 -1
- package/dist/redirects/react/components/CreateRedirectForm.d.ts +17 -0
- package/dist/redirects/react/components/CreateRedirectForm.js +19 -0
- package/dist/redirects/react/components/HitCountCell.js +2 -2
- package/dist/redirects/react/components/ImportRedirectsForm.js +1 -1
- package/dist/redirects/react/hooks/RedirectsPage.hooks.d.ts +1 -1
- package/dist/redirects/react/hooks/RedirectsPorts.hooks.d.ts +5 -0
- package/dist/redirects/react/hooks/RedirectsPorts.hooks.js +11 -1
- package/dist/redirects/react/hooks/use-hit-count-cell.hooks.js +3 -3
- package/dist/redirects/react/hooks/use-import-redirects-form.hooks.js +4 -4
- package/dist/redirects/react/hooks/use-redirects.hooks.d.ts +1 -1
- package/dist/redirects/react/hooks/use-redirects.hooks.js +4 -4
- package/dist/redirects/react/hooks/wired.hooks.d.ts +1 -1
- package/dist/redirects/react/index.d.ts +28 -90
- package/dist/redirects/react/index.js +6 -7
- package/dist/redirects/react/pages/RedirectsPage.d.ts +3 -1
- package/dist/redirects/react/pages/RedirectsPage.js +5 -5
- package/dist/redirects/redirects.module.d.ts +3 -2
- package/dist/redirects/redirects.module.js +1 -1
- package/dist/security/controllers/access-tokens.controller.d.ts +4 -4
- package/dist/security/controllers/access-tokens.controller.js +20 -15
- package/dist/security/controllers/other-credentials.controller.d.ts +4 -4
- package/dist/security/controllers/other-credentials.controller.js +1 -1
- package/dist/security/controllers/root-key.controller.d.ts +4 -4
- package/dist/security/controllers/root-key.controller.js +1 -1
- package/dist/security/ports.d.ts +3 -3
- package/dist/security/ports.js +1 -1
- package/dist/security/react/components/CredentialEditor.d.ts +4 -2
- package/dist/security/react/components/CredentialEditor.js +3 -3
- package/dist/security/react/hooks/AccessTokensTab.hooks.d.ts +5 -5
- package/dist/security/react/hooks/RootKeyTab.hooks.d.ts +1 -1
- package/dist/security/react/hooks/SecurityPage.hooks.d.ts +7 -3
- package/dist/security/react/hooks/SecurityPorts.hooks.js +1 -1
- package/dist/security/react/index.d.ts +22 -22
- package/dist/security/react/pages/SecurityPage.d.ts +8 -2
- package/dist/security/react/pages/SecurityPage.js +3 -3
- package/dist/security/react/tabs/AccessTokensTab.d.ts +5 -2
- package/dist/security/react/tabs/AccessTokensTab.js +3 -3
- package/dist/security/react/tabs/RootKeyTab.d.ts +5 -2
- package/dist/security/react/tabs/RootKeyTab.js +3 -3
- package/dist/security/rules.d.ts +1 -1
- package/dist/security/security.module.d.ts +4 -4
- package/dist/security/security.module.js +1 -1
- package/dist/seo/controllers/entry-picker.controller.d.ts +7 -7
- package/dist/seo/controllers/entry-picker.controller.js +1 -1
- package/dist/seo/controllers/entry-section.controller.d.ts +9 -9
- package/dist/seo/controllers/entry-section.controller.js +1 -1
- package/dist/seo/controllers/media-ref.controller.d.ts +9 -9
- package/dist/seo/controllers/media-ref.controller.js +1 -1
- package/dist/seo/controllers/seo-entry.controller.d.ts +7 -7
- package/dist/seo/controllers/seo-entry.controller.js +1 -1
- package/dist/seo/controllers/seo.controller.d.ts +7 -7
- package/dist/seo/controllers/seo.controller.js +1 -1
- package/dist/seo/controllers/sitemap.controller.d.ts +7 -7
- package/dist/seo/controllers/sitemap.controller.js +2 -2
- package/dist/seo/index.d.ts +4 -2
- package/dist/seo/index.js +2 -2
- package/dist/seo/ports.d.ts +2 -2
- package/dist/seo/ports.js +1 -1
- package/dist/seo/react/components/AnalyzePanel.d.ts +13 -0
- package/dist/seo/react/components/AnalyzePanel.js +21 -0
- package/dist/seo/react/components/EntryPicker.d.ts +19 -0
- package/dist/seo/react/components/EntryPicker.js +25 -0
- package/dist/seo/react/components/MediaPickerBridge.d.ts +4 -1
- package/dist/seo/react/components/MediaPickerBridge.js +2 -2
- package/dist/seo/react/components/MediaRefField.d.ts +5 -2
- package/dist/seo/react/components/MediaRefField.js +5 -5
- package/dist/seo/react/components/SeoEntryFields.d.ts +19 -0
- package/dist/seo/react/components/SeoEntryFields.js +19 -0
- package/dist/seo/react/components/SeoEntryPanel.d.ts +31 -0
- package/dist/seo/react/components/SeoEntryPanel.js +64 -0
- package/dist/seo/react/components/SeoIcons.d.ts +3 -3
- package/dist/seo/react/components/SeoIcons.js +3 -3
- package/dist/seo/react/components/SeoSection.d.ts +27 -0
- package/dist/seo/react/components/SeoSection.js +24 -0
- package/dist/seo/react/components/SitemapModal.d.ts +42 -2
- package/dist/seo/react/components/SitemapModal.js +17 -17
- package/dist/seo/react/hooks/MediaRefField.hooks.js +6 -6
- package/dist/seo/react/hooks/SeoModuleTabs.d.ts +2 -2
- package/dist/seo/react/hooks/SeoModuleTabs.js +3 -1
- package/dist/seo/react/hooks/SeoPage.hooks.d.ts +2 -2
- package/dist/seo/react/hooks/SeoPorts.hooks.d.ts +5 -0
- package/dist/seo/react/hooks/SeoPorts.hooks.js +11 -1
- package/dist/seo/react/hooks/SeoQuery.hooks.d.ts +3 -3
- package/dist/seo/react/hooks/SeoQuery.hooks.js +1 -1
- package/dist/seo/react/hooks/SitemapModal.hooks.js +1 -1
- package/dist/seo/react/hooks/use-entry-picker.hooks.js +1 -1
- package/dist/seo/react/hooks/use-seo-entry-panel.hooks.js +3 -3
- package/dist/seo/react/hooks/use-seo-entry-section.hooks.js +2 -2
- package/dist/seo/react/hooks/use-seo.hooks.js +3 -3
- package/dist/seo/react/hooks/use-share-image-warning.hooks.js +1 -1
- package/dist/seo/react/hooks/use-sitemap-modal.hooks.d.ts +4 -1
- package/dist/seo/react/hooks/use-sitemap-modal.hooks.js +6 -5
- package/dist/seo/react/index.d.ts +28 -21
- package/dist/seo/react/index.js +5 -6
- package/dist/seo/react/pages/SeoPage.d.ts +16 -82
- package/dist/seo/react/pages/SeoPage.js +29 -216
- package/dist/seo/react/tabs/SeoDefaultsSections.d.ts +19 -0
- package/dist/seo/react/tabs/SeoDefaultsSections.js +48 -0
- package/dist/seo/react/tabs/SeoDefaultsTab.d.ts +24 -0
- package/dist/seo/react/tabs/SeoDefaultsTab.js +30 -0
- package/dist/seo/react/tabs/SeoSitemapTab.d.ts +24 -0
- package/dist/seo/react/tabs/SeoSitemapTab.js +38 -0
- package/dist/seo/rules.d.ts +3 -3
- package/dist/seo/rules.js +6 -6
- package/dist/seo/seo.module.d.ts +3 -3
- package/dist/seo/seo.module.js +1 -1
- package/dist/source-control/controllers/source-control.controller.d.ts +3 -3
- package/dist/source-control/controllers/source-control.controller.js +1 -1
- package/dist/source-control/ports.d.ts +1 -1
- package/dist/source-control/ports.js +1 -1
- package/dist/source-control/react/components/SourceControlCredentialFields.d.ts +4 -2
- package/dist/source-control/react/components/SourceControlCredentialFields.js +3 -3
- package/dist/source-control/react/components/SourceControlProviderRow.d.ts +1 -1
- package/dist/source-control/react/components/SourceControlProviderRow.js +2 -2
- package/dist/source-control/react/hooks/ProvidersTab.hooks.d.ts +1 -1
- package/dist/source-control/react/hooks/ProvidersTab.hooks.js +2 -2
- package/dist/source-control/react/hooks/SourceControlPage.hooks.d.ts +7 -3
- package/dist/source-control/react/hooks/SourceControlPorts.hooks.d.ts +5 -0
- package/dist/source-control/react/hooks/SourceControlPorts.hooks.js +11 -1
- package/dist/source-control/react/index.d.ts +25 -50
- package/dist/source-control/react/index.js +9 -6
- package/dist/source-control/react/pages/SourceControlPage.d.ts +8 -2
- package/dist/source-control/react/pages/SourceControlPage.js +3 -3
- package/dist/source-control/react/tabs/ProvidersTab.d.ts +5 -2
- package/dist/source-control/react/tabs/ProvidersTab.js +3 -3
- package/dist/source-control/source-control.module.d.ts +2 -2
- package/dist/source-control/source-control.module.js +1 -1
- package/dist/widgets/adapters/http.js +2 -2
- package/dist/widgets/adapters/memory.js +26 -20
- package/dist/widgets/controllers/instance-editor.controller.d.ts +3 -3
- package/dist/widgets/controllers/instance-editor.controller.js +48 -38
- package/dist/widgets/controllers/library.controller.d.ts +3 -3
- package/dist/widgets/controllers/library.controller.js +1 -2
- package/dist/widgets/controllers/region-editor.controller.d.ts +3 -3
- package/dist/widgets/controllers/region-editor.controller.js +5 -5
- package/dist/widgets/controllers/regions.controller.d.ts +3 -3
- package/dist/widgets/controllers/regions.controller.js +1 -2
- package/dist/widgets/index.d.ts +2 -1
- package/dist/widgets/index.js +1 -1
- package/dist/widgets/messages.en.js +1 -1
- package/dist/widgets/ports.d.ts +3 -3
- package/dist/widgets/ports.js +1 -1
- package/dist/widgets/react/components/RegionPlacementRow.d.ts +14 -0
- package/dist/widgets/react/components/RegionPlacementRow.js +8 -0
- package/dist/widgets/react/components/TrashWidgetDialog.d.ts +11 -0
- package/dist/widgets/react/components/TrashWidgetDialog.js +8 -0
- package/dist/widgets/react/components/WidgetInstanceNotices.js +1 -1
- package/dist/widgets/react/components/WidgetPageHeaders.d.ts +42 -0
- package/dist/widgets/react/components/WidgetPageHeaders.js +54 -0
- package/dist/widgets/react/components/WidgetRegionEditorHeaderActions.js +1 -1
- package/dist/widgets/react/components/WidgetTableColumns.d.ts +12 -0
- package/dist/widgets/react/components/WidgetTableColumns.js +47 -0
- package/dist/widgets/react/hooks/WidgetsPorts.hooks.d.ts +12 -7
- package/dist/widgets/react/hooks/WidgetsPorts.hooks.js +11 -0
- package/dist/widgets/react/hooks/WidgetsQuery.hooks.d.ts +2 -2
- package/dist/widgets/react/hooks/WidgetsQuery.hooks.js +1 -1
- package/dist/widgets/react/hooks/page-views.hooks.d.ts +1 -1
- package/dist/widgets/react/hooks/page-views.hooks.js +1 -1
- package/dist/widgets/react/hooks/use-widget-instance-editor.hooks.d.ts +2 -2
- package/dist/widgets/react/hooks/use-widget-instance-editor.hooks.js +3 -3
- package/dist/widgets/react/hooks/use-widget-region-editor.hooks.d.ts +1 -1
- package/dist/widgets/react/hooks/use-widget-region-editor.hooks.js +2 -2
- package/dist/widgets/react/hooks/use-widget-regions.hooks.d.ts +3 -1
- package/dist/widgets/react/hooks/use-widget-regions.hooks.js +7 -6
- package/dist/widgets/react/hooks/use-widgets-library.hooks.d.ts +4 -2
- package/dist/widgets/react/hooks/use-widgets-library.hooks.js +7 -6
- package/dist/widgets/react/index.d.ts +41 -34
- package/dist/widgets/react/index.js +5 -6
- package/dist/widgets/react/pages/WidgetInstanceEditor.d.ts +5 -1
- package/dist/widgets/react/pages/WidgetInstanceEditor.js +7 -9
- package/dist/widgets/react/pages/WidgetRegionEditor.d.ts +5 -1
- package/dist/widgets/react/pages/WidgetRegionEditor.js +8 -10
- package/dist/widgets/react/pages/WidgetRegions.d.ts +5 -1
- package/dist/widgets/react/pages/WidgetRegions.js +6 -8
- package/dist/widgets/react/pages/WidgetsLibrary.d.ts +5 -1
- package/dist/widgets/react/pages/WidgetsLibrary.js +8 -45
- package/dist/widgets/rules.d.ts +5 -3
- package/dist/widgets/rules.js +4 -9
- package/dist/widgets/widgets.module.d.ts +3 -3
- package/dist/widgets/widgets.module.js +1 -1
- package/package.json +25 -59
- package/dist/consent/react/ConsentFields.d.ts +0 -39
- package/dist/consent/react/ConsentFields.js +0 -87
- package/dist/consent/react/ConsentPreviewFrame.d.ts +0 -14
- package/dist/consent/react/ConsentPreviewFrame.js +0 -14
- package/dist/consent/react/ConsentSettingsPanel.d.ts +0 -54
- package/dist/consent/react/ConsentSettingsPanel.js +0 -13
- package/dist/consent/react/index.d.ts +0 -8
- package/dist/consent/react/index.js +0 -4
- package/dist/consent/react/settings-panel.hooks.d.ts +0 -49
- package/dist/consent/react/settings-panel.hooks.js +0 -57
- package/dist/core/module/controller-store.d.ts +0 -22
- package/dist/core/module/controller-store.js +0 -32
- package/dist/core/module/define-admin-module.d.ts +0 -4
- package/dist/core/module/define-admin-module.js +0 -5
- package/dist/core/module/token.d.ts +0 -19
- package/dist/core/module/token.js +0 -4
- package/dist/core/module/types.d.ts +0 -79
- package/dist/core/module/types.js +0 -2
- package/dist/core/permissions/rules.d.ts +0 -35
- package/dist/core/permissions/rules.js +0 -34
- package/dist/core/transport/errors.d.ts +0 -62
- package/dist/core/transport/errors.js +0 -63
- package/dist/core/transport/query-suffix.d.ts +0 -3
- package/dist/core/transport/query-suffix.js +0 -5
- package/dist/media/styles.d.ts +0 -4
- package/dist/media/styles.js +0 -5
- package/dist/react/bind-react.d.ts +0 -2
- package/dist/react/bind-react.js +0 -3
- package/dist/react/use-controller.d.ts +0 -2
- package/dist/react/use-controller.js +0 -3
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { type FocusEvent, type MouseEvent, type ReactNode } from 'react';
|
|
2
2
|
import type { AdminNavGroup, AdminNavItem } from '../../core/manifest/rules.js';
|
|
3
|
+
import { useNavSections } from '../hooks/use-nav-sections.js';
|
|
4
|
+
import { useSidebarRail } from '../hooks/use-sidebar-rail.js';
|
|
3
5
|
/** Handlers that make any element participate in rail-mode tooltips. Spread onto a host's own
|
|
4
6
|
* control: `<button {...railTooltipProps('Log out')}>`. */
|
|
5
7
|
export interface RailTooltipHandlers {
|
|
@@ -27,6 +29,7 @@ export interface SidebarContextValue {
|
|
|
27
29
|
*/
|
|
28
30
|
export declare function useSidebar(): SidebarContextValue;
|
|
29
31
|
export interface SidebarProps {
|
|
32
|
+
useSidebarRailHook?: typeof useSidebarRail;
|
|
30
33
|
/** The active panel's id — matched against `AdminNavItem.id` by `Sidebar.Nav`. */
|
|
31
34
|
activeId: string;
|
|
32
35
|
/** Where the admin is mounted. Defaults to `/core`'s `DEFAULT_ADMIN_BASE`. */
|
|
@@ -61,8 +64,9 @@ export interface SidebarProps {
|
|
|
61
64
|
id?: string;
|
|
62
65
|
children?: ReactNode;
|
|
63
66
|
}
|
|
64
|
-
declare function SidebarRoot(props: SidebarProps): import("react").JSX.Element;
|
|
67
|
+
declare function SidebarRoot({ useSidebarRailHook, ...props }: SidebarProps): import("react").JSX.Element;
|
|
65
68
|
export interface SidebarMobileHeaderProps {
|
|
69
|
+
useSidebarHook?: typeof useSidebar;
|
|
66
70
|
onClose: () => void;
|
|
67
71
|
/** @default "Navigation" */
|
|
68
72
|
title?: ReactNode;
|
|
@@ -76,8 +80,10 @@ export interface SidebarMobileHeaderProps {
|
|
|
76
80
|
* rather than staying on the topbar toggle behind it, so a keyboard or screen-reader user is
|
|
77
81
|
* actually inside the drawer they just opened.
|
|
78
82
|
*/
|
|
79
|
-
declare function SidebarMobileHeader(props: SidebarMobileHeaderProps): import("react").JSX.Element;
|
|
83
|
+
declare function SidebarMobileHeader({ useSidebarHook, ...props }: SidebarMobileHeaderProps): import("react").JSX.Element;
|
|
80
84
|
export interface SidebarNavProps {
|
|
85
|
+
useSidebarHook?: typeof useSidebar;
|
|
86
|
+
useNavSectionsHook?: typeof useNavSections;
|
|
81
87
|
/** From `/core`'s `buildNav({ panels: resolvePanels({ panels }, context) })`. */
|
|
82
88
|
groups: readonly AdminNavGroup[];
|
|
83
89
|
/** Label on a `soon` item's badge. @default "Soon" */
|
|
@@ -101,7 +107,7 @@ export interface SidebarNavProps {
|
|
|
101
107
|
*/
|
|
102
108
|
collapsibleGroups?: readonly string[];
|
|
103
109
|
}
|
|
104
|
-
declare function SidebarNav(props: SidebarNavProps): import("react").JSX.Element;
|
|
110
|
+
declare function SidebarNav({ useSidebarHook, useNavSectionsHook, ...props }: SidebarNavProps): import("react").JSX.Element;
|
|
105
111
|
export interface SidebarFooterProps {
|
|
106
112
|
children?: ReactNode;
|
|
107
113
|
className?: string;
|
|
@@ -109,6 +115,7 @@ export interface SidebarFooterProps {
|
|
|
109
115
|
/** The bottom region. Carries no content of its own — the host decides what belongs there. */
|
|
110
116
|
declare function SidebarFooter(props: SidebarFooterProps): import("react").JSX.Element;
|
|
111
117
|
export interface SidebarRailToggleProps {
|
|
118
|
+
useSidebarHook?: typeof useSidebar;
|
|
112
119
|
/** @default "Expand sidebar" */
|
|
113
120
|
expandLabel?: string;
|
|
114
121
|
/** @default "Collapse sidebar" */
|
|
@@ -119,7 +126,7 @@ export interface SidebarRailToggleProps {
|
|
|
119
126
|
* button. Typically hidden by the host stylesheet inside the mobile drawer, which has its own close
|
|
120
127
|
* control and no rail concept.
|
|
121
128
|
*/
|
|
122
|
-
declare function SidebarRailToggle(props: SidebarRailToggleProps): import("react").JSX.Element;
|
|
129
|
+
declare function SidebarRailToggle({ useSidebarHook, ...props }: SidebarRailToggleProps): import("react").JSX.Element;
|
|
123
130
|
/**
|
|
124
131
|
* Grouped admin sidebar. See the file header for why this is a compound component and what the
|
|
125
132
|
* context costs.
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { createContext,
|
|
2
|
+
import { createContext, useContext, useEffect, useMemo, useRef, useState, } from 'react';
|
|
3
3
|
import { createPortal } from 'react-dom';
|
|
4
4
|
import { DEFAULT_ADMIN_BASE, adminHref } from '../../core/routing/rules.js';
|
|
5
5
|
import { useNavSections } from '../hooks/use-nav-sections.js';
|
|
6
6
|
import { useSidebarRail } from '../hooks/use-sidebar-rail.js';
|
|
7
|
+
import { Icon } from './SidebarIcon.js';
|
|
7
8
|
const SidebarContext = createContext(null);
|
|
8
9
|
/**
|
|
9
10
|
* Reads the enclosing `<Sidebar>`'s state. Throws outside one — see the file header on why this
|
|
@@ -18,97 +19,6 @@ export function useSidebar() {
|
|
|
18
19
|
}
|
|
19
20
|
return value;
|
|
20
21
|
}
|
|
21
|
-
/**
|
|
22
|
-
* Shape elements `AdminNavEntry.icon` markup may use. A host draws its own glyphs as raw inner
|
|
23
|
-
* SVG (see that field's doc comment in `core/manifest/types.ts`), so this can't be a fixed set of
|
|
24
|
-
* named icons — but it also means the string reaching {@link Icon} was written by whoever owns the
|
|
25
|
-
* nav entry, which soon enough will be a descriptor rather than code. `g` is included so multi-path
|
|
26
|
-
* icons can group and transform their pieces together.
|
|
27
|
-
*/
|
|
28
|
-
const ICON_ALLOWED_TAGS = new Set(['path', 'circle', 'rect', 'line', 'polygon', 'polyline', 'ellipse', 'g']);
|
|
29
|
-
/**
|
|
30
|
-
* Presentation attributes let through on an icon shape, mapped from their SVG/XML spelling to the
|
|
31
|
-
* camelCase prop name React expects. Anything not listed here — `style`, `href`/`xlink:href`, every
|
|
32
|
-
* `on*` handler — is dropped by {@link sanitizeIconNode} rather than passed through, so there is no
|
|
33
|
-
* allowlist gap to keep in sync with a separate denylist.
|
|
34
|
-
*/
|
|
35
|
-
const ICON_ALLOWED_ATTRS = {
|
|
36
|
-
d: 'd',
|
|
37
|
-
cx: 'cx',
|
|
38
|
-
cy: 'cy',
|
|
39
|
-
r: 'r',
|
|
40
|
-
rx: 'rx',
|
|
41
|
-
ry: 'ry',
|
|
42
|
-
x: 'x',
|
|
43
|
-
y: 'y',
|
|
44
|
-
width: 'width',
|
|
45
|
-
height: 'height',
|
|
46
|
-
x1: 'x1',
|
|
47
|
-
y1: 'y1',
|
|
48
|
-
x2: 'x2',
|
|
49
|
-
y2: 'y2',
|
|
50
|
-
points: 'points',
|
|
51
|
-
transform: 'transform',
|
|
52
|
-
fill: 'fill',
|
|
53
|
-
'fill-rule': 'fillRule',
|
|
54
|
-
opacity: 'opacity',
|
|
55
|
-
'stroke-width': 'strokeWidth',
|
|
56
|
-
'stroke-linecap': 'strokeLinecap',
|
|
57
|
-
'stroke-linejoin': 'strokeLinejoin',
|
|
58
|
-
'clip-rule': 'clipRule',
|
|
59
|
-
};
|
|
60
|
-
/**
|
|
61
|
-
* Rebuilds one parsed element as a React element, keeping only {@link ICON_ALLOWED_TAGS} /
|
|
62
|
-
* {@link ICON_ALLOWED_ATTRS}. This is what stands in for `dangerouslySetInnerHTML`: the browser's
|
|
63
|
-
* own parser does the tokenizing (far less error-prone than a hand-rolled regex over SVG/XML), and
|
|
64
|
-
* this function decides what survives the trip into React's tree — a `<script>`, a `<foreignObject>`
|
|
65
|
-
* carrying arbitrary HTML, an `<image>`/`<use>` reference, or an `onload=` attribute all fail to
|
|
66
|
-
* match anything on either allowlist and are simply not there afterward, whatever they contained.
|
|
67
|
-
*/
|
|
68
|
-
function sanitizeIconNode(node, key) {
|
|
69
|
-
const tag = node.tagName.toLowerCase();
|
|
70
|
-
if (!ICON_ALLOWED_TAGS.has(tag))
|
|
71
|
-
return null;
|
|
72
|
-
// `key` goes straight into the props object — `createElement` pulls it out as the element's
|
|
73
|
-
// reserved key rather than forwarding it to the DOM, the same as writing `key={key}` in JSX.
|
|
74
|
-
const props = { key };
|
|
75
|
-
for (const attr of Array.from(node.attributes)) {
|
|
76
|
-
const propName = ICON_ALLOWED_ATTRS[attr.name.toLowerCase()];
|
|
77
|
-
if (propName)
|
|
78
|
-
props[propName] = attr.value;
|
|
79
|
-
}
|
|
80
|
-
const children = Array.from(node.children)
|
|
81
|
-
.map((child, i) => sanitizeIconNode(child, i))
|
|
82
|
-
.filter((child) => child !== null);
|
|
83
|
-
return createElement(tag, props, children.length ? children : undefined);
|
|
84
|
-
}
|
|
85
|
-
// Reused across parses rather than constructed per render — `DOMParser` instances are stateless
|
|
86
|
-
// and this runs once per icon render, but there is no reason to pay allocation cost for it twice.
|
|
87
|
-
let iconMarkupParser;
|
|
88
|
-
/**
|
|
89
|
-
* Parses one `AdminNavEntry.icon` string into a sanitized element list. Wrapping in a throwaway
|
|
90
|
-
* `<svg>` document (never attached to the page — this is markup parsing, not rendering) lets the
|
|
91
|
-
* browser's own XML parser validate structure for free: malformed markup surfaces as a
|
|
92
|
-
* `parsererror` node, which is treated the same as empty input — the row loses its icon, not its
|
|
93
|
-
* label or link.
|
|
94
|
-
*/
|
|
95
|
-
function parseIconMarkup(markup) {
|
|
96
|
-
if (!markup)
|
|
97
|
-
return [];
|
|
98
|
-
iconMarkupParser ??= new DOMParser();
|
|
99
|
-
const doc = iconMarkupParser.parseFromString(`<svg xmlns="http://www.w3.org/2000/svg">${markup}</svg>`, 'image/svg+xml');
|
|
100
|
-
if (doc.getElementsByTagName('parsererror').length > 0)
|
|
101
|
-
return [];
|
|
102
|
-
return Array.from(doc.documentElement.children)
|
|
103
|
-
.map((child, i) => sanitizeIconNode(child, i))
|
|
104
|
-
.filter((child) => child !== null);
|
|
105
|
-
}
|
|
106
|
-
function Icon(props) {
|
|
107
|
-
// Re-parsing on every keystroke of an unrelated state update would be wasted work for a string
|
|
108
|
-
// that, in practice, never changes after the nav manifest is built.
|
|
109
|
-
const children = useMemo(() => parseIconMarkup(props.markup), [props.markup]);
|
|
110
|
-
return (_jsx("svg", { viewBox: "0 0 18 18", fill: "none", stroke: "currentColor", strokeWidth: 1.5, children: children }));
|
|
111
|
-
}
|
|
112
22
|
/**
|
|
113
23
|
* Rail-mode tooltip, portaled to `document.body`.
|
|
114
24
|
*
|
|
@@ -133,8 +43,8 @@ const sidebarStorage = {
|
|
|
133
43
|
getItem: (key) => localStorage.getItem(key),
|
|
134
44
|
setItem: (key, value) => localStorage.setItem(key, value),
|
|
135
45
|
};
|
|
136
|
-
function SidebarRoot(props) {
|
|
137
|
-
const rail =
|
|
46
|
+
function SidebarRoot({ useSidebarRailHook = useSidebarRail, ...props }) {
|
|
47
|
+
const rail = useSidebarRailHook({ storage: sidebarStorage, events: window }, {
|
|
138
48
|
storageKey: props.railStorageKey, defaultCollapsed: props.railDefaultCollapsed,
|
|
139
49
|
railOverride: props.railOverride, onCollapsedChange: props.onRailCollapsedChange,
|
|
140
50
|
});
|
|
@@ -188,8 +98,8 @@ function SidebarRoot(props) {
|
|
|
188
98
|
* rather than staying on the topbar toggle behind it, so a keyboard or screen-reader user is
|
|
189
99
|
* actually inside the drawer they just opened.
|
|
190
100
|
*/
|
|
191
|
-
function SidebarMobileHeader(props) {
|
|
192
|
-
const { open } =
|
|
101
|
+
function SidebarMobileHeader({ useSidebarHook = useSidebar, ...props }) {
|
|
102
|
+
const { open } = useSidebarHook();
|
|
193
103
|
const closeButtonRef = useRef(null);
|
|
194
104
|
useEffect(() => {
|
|
195
105
|
if (open)
|
|
@@ -197,9 +107,9 @@ function SidebarMobileHeader(props) {
|
|
|
197
107
|
}, [open]);
|
|
198
108
|
return (_jsxs("div", { className: "cms-nav-mobile-head", children: [_jsx("span", { children: props.title ?? 'Navigation' }), _jsx("button", { ref: closeButtonRef, type: "button", className: "cms-nav-close", onClick: props.onClose, "aria-label": props.closeLabel ?? 'Close navigation', children: _jsx("svg", { viewBox: "0 0 18 18", fill: "none", stroke: "currentColor", strokeWidth: 1.5, children: _jsx("path", { d: "M5 5 13 13M13 5 5 13", strokeLinecap: "round" }) }) })] }));
|
|
199
109
|
}
|
|
200
|
-
function SidebarNav(props) {
|
|
201
|
-
const { activeId, base, collapsed, railTooltipProps } =
|
|
202
|
-
const sections =
|
|
110
|
+
function SidebarNav({ useSidebarHook = useSidebar, useNavSectionsHook = useNavSections, ...props }) {
|
|
111
|
+
const { activeId, base, collapsed, railTooltipProps } = useSidebarHook();
|
|
112
|
+
const sections = useNavSectionsHook({ storage: sidebarStorage, events: window });
|
|
203
113
|
return (_jsx(_Fragment, { children: props.groups.map((group, gi) => {
|
|
204
114
|
/**
|
|
205
115
|
* Rail mode force-expands every section, deliberately. Collapsed to a rail the group
|
|
@@ -253,8 +163,8 @@ function SidebarFooter(props) {
|
|
|
253
163
|
* button. Typically hidden by the host stylesheet inside the mobile drawer, which has its own close
|
|
254
164
|
* control and no rail concept.
|
|
255
165
|
*/
|
|
256
|
-
function SidebarRailToggle(props) {
|
|
257
|
-
const { collapsed, toggleRail } =
|
|
166
|
+
function SidebarRailToggle({ useSidebarHook = useSidebar, ...props }) {
|
|
167
|
+
const { collapsed, toggleRail } = useSidebarHook();
|
|
258
168
|
const label = collapsed ? (props.expandLabel ?? 'Expand sidebar') : (props.collapseLabel ?? 'Collapse sidebar');
|
|
259
169
|
return (_jsx("div", { className: "cms-rail-toggle-row", children: _jsx("button", { type: "button", className: "cms-rail-toggle", onClick: toggleRail, "aria-expanded": !collapsed, "aria-label": label, title: label, children: _jsx("svg", { viewBox: "0 0 18 18", fill: "none", stroke: "currentColor", strokeWidth: 1.5, "aria-hidden": "true", children: _jsx("path", { d: "M6.5 4.5 3.5 9l3 4.5M11.5 4.5 14.5 9l-3 4.5" }) }) }) }));
|
|
260
170
|
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createElement, useMemo } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* Shape elements `AdminNavEntry.icon` markup may use. A host draws its own glyphs as raw inner
|
|
5
|
+
* SVG (see that field's doc comment in `core/manifest/types.ts`), so this can't be a fixed set of
|
|
6
|
+
* named icons — but it also means the string reaching {@link Icon} was written by whoever owns the
|
|
7
|
+
* nav entry, which soon enough will be a descriptor rather than code. `g` is included so multi-path
|
|
8
|
+
* icons can group and transform their pieces together.
|
|
9
|
+
*/
|
|
10
|
+
const ICON_ALLOWED_TAGS = new Set(['path', 'circle', 'rect', 'line', 'polygon', 'polyline', 'ellipse', 'g']);
|
|
11
|
+
/**
|
|
12
|
+
* Presentation attributes let through on an icon shape, mapped from their SVG/XML spelling to the
|
|
13
|
+
* camelCase prop name React expects. Anything not listed here — `style`, `href`/`xlink:href`, every
|
|
14
|
+
* `on*` handler — is dropped by {@link sanitizeIconNode} rather than passed through, so there is no
|
|
15
|
+
* allowlist gap to keep in sync with a separate denylist.
|
|
16
|
+
*/
|
|
17
|
+
const ICON_ALLOWED_ATTRS = {
|
|
18
|
+
d: 'd',
|
|
19
|
+
cx: 'cx',
|
|
20
|
+
cy: 'cy',
|
|
21
|
+
r: 'r',
|
|
22
|
+
rx: 'rx',
|
|
23
|
+
ry: 'ry',
|
|
24
|
+
x: 'x',
|
|
25
|
+
y: 'y',
|
|
26
|
+
width: 'width',
|
|
27
|
+
height: 'height',
|
|
28
|
+
x1: 'x1',
|
|
29
|
+
y1: 'y1',
|
|
30
|
+
x2: 'x2',
|
|
31
|
+
y2: 'y2',
|
|
32
|
+
points: 'points',
|
|
33
|
+
transform: 'transform',
|
|
34
|
+
fill: 'fill',
|
|
35
|
+
'fill-rule': 'fillRule',
|
|
36
|
+
opacity: 'opacity',
|
|
37
|
+
'stroke-width': 'strokeWidth',
|
|
38
|
+
'stroke-linecap': 'strokeLinecap',
|
|
39
|
+
'stroke-linejoin': 'strokeLinejoin',
|
|
40
|
+
'clip-rule': 'clipRule',
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Rebuilds one parsed element as a React element, keeping only {@link ICON_ALLOWED_TAGS} /
|
|
44
|
+
* {@link ICON_ALLOWED_ATTRS}. This is what stands in for `dangerouslySetInnerHTML`: the browser's
|
|
45
|
+
* own parser does the tokenizing (far less error-prone than a hand-rolled regex over SVG/XML), and
|
|
46
|
+
* this function decides what survives the trip into React's tree — a `<script>`, a `<foreignObject>`
|
|
47
|
+
* carrying arbitrary HTML, an `<image>`/`<use>` reference, or an `onload=` attribute all fail to
|
|
48
|
+
* match anything on either allowlist and are simply not there afterward, whatever they contained.
|
|
49
|
+
*/
|
|
50
|
+
function sanitizeIconNode(node, key) {
|
|
51
|
+
const tag = node.tagName.toLowerCase();
|
|
52
|
+
if (!ICON_ALLOWED_TAGS.has(tag))
|
|
53
|
+
return null;
|
|
54
|
+
// `key` goes straight into the props object — `createElement` pulls it out as the element's
|
|
55
|
+
// reserved key rather than forwarding it to the DOM, the same as writing `key={key}` in JSX.
|
|
56
|
+
const props = { key };
|
|
57
|
+
for (const attr of Array.from(node.attributes)) {
|
|
58
|
+
const propName = ICON_ALLOWED_ATTRS[attr.name.toLowerCase()];
|
|
59
|
+
if (propName)
|
|
60
|
+
props[propName] = attr.value;
|
|
61
|
+
}
|
|
62
|
+
const children = Array.from(node.children)
|
|
63
|
+
.map((child, i) => sanitizeIconNode(child, i))
|
|
64
|
+
.filter((child) => child !== null);
|
|
65
|
+
return createElement(tag, props, children.length ? children : undefined);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Parses one `AdminNavEntry.icon` string into a sanitized element list. Wrapping in a throwaway
|
|
69
|
+
* `<svg>` document (never attached to the page — this is markup parsing, not rendering) lets the
|
|
70
|
+
* browser's own XML parser validate structure for free: malformed markup surfaces as a
|
|
71
|
+
* `parsererror` node, which is treated the same as empty input — the row loses its icon, not its
|
|
72
|
+
* label or link.
|
|
73
|
+
*/
|
|
74
|
+
function parseIconMarkup(markup) {
|
|
75
|
+
if (!markup)
|
|
76
|
+
return [];
|
|
77
|
+
const iconMarkupParser = new DOMParser();
|
|
78
|
+
const doc = iconMarkupParser.parseFromString(`<svg xmlns="http://www.w3.org/2000/svg">${markup}</svg>`, 'image/svg+xml');
|
|
79
|
+
if (doc.getElementsByTagName('parsererror').length > 0)
|
|
80
|
+
return [];
|
|
81
|
+
return Array.from(doc.documentElement.children)
|
|
82
|
+
.map((child, i) => sanitizeIconNode(child, i))
|
|
83
|
+
.filter((child) => child !== null);
|
|
84
|
+
}
|
|
85
|
+
export function Icon(props) {
|
|
86
|
+
// Re-parsing on every keystroke of an unrelated state update would be wasted work for a string
|
|
87
|
+
// that, in practice, never changes after the nav manifest is built.
|
|
88
|
+
const children = useMemo(() => parseIconMarkup(props.markup), [props.markup]);
|
|
89
|
+
return (_jsx("svg", { viewBox: "0 0 18 18", fill: "none", stroke: "currentColor", strokeWidth: 1.5, children: children }));
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=SidebarIcon.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
export function ThemePreviewReloadControl({ className, label, reload, disabled = false, }) {
|
|
3
|
+
return (_jsx("button", { type: "button", className: className, "aria-label": label, title: label, onClick: reload, disabled: disabled, children: _jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [_jsx("path", { d: "M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8" }), _jsx("path", { d: "M21 3v5h-5" })] }) }));
|
|
4
|
+
}
|
|
5
|
+
//# sourceMappingURL=ThemePreviewReloadControl.js.map
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import type { EntityDetailProps } from './types.js';
|
|
2
|
-
|
|
2
|
+
import { useEntityDetail } from './EntityDetail.hooks.js';
|
|
3
|
+
export declare function EntityDetail({ entityName, id, registry, translate, routes, refreshToken, useDetailHook }: EntityDetailProps & {
|
|
4
|
+
readonly useDetailHook?: typeof useEntityDetail;
|
|
5
|
+
}): import("react").JSX.Element;
|
|
3
6
|
//# sourceMappingURL=EntityDetail.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { EntityDetailProps } from './types.js';
|
|
2
|
+
import { useEntityRead } from './use-entity-read.js';
|
|
3
|
+
/** Read the selected entity and discard results from an obsolete registry or route. */
|
|
4
|
+
export declare function useEntityDetail({ registry, entityName, id, refreshToken }: Pick<EntityDetailProps, 'registry' | 'entityName' | 'id' | 'refreshToken'>, { useReadHook }?: {
|
|
5
|
+
readonly useReadHook?: typeof useEntityRead;
|
|
6
|
+
}): {
|
|
7
|
+
port: import("../../core/index.js").AdminErasedEntityPort | null;
|
|
8
|
+
result: {
|
|
9
|
+
readonly data: import("./use-entity-read.js").EntityLoadedRow | undefined;
|
|
10
|
+
readonly error: unknown;
|
|
11
|
+
readonly loading: boolean;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=EntityDetail.hooks.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useCallback, useMemo } from 'react';
|
|
2
|
+
import { loadEntityRow, useEntityRead } from './use-entity-read.js';
|
|
3
|
+
/** Read the selected entity and discard results from an obsolete registry or route. */
|
|
4
|
+
export function useEntityDetail({ registry, entityName, id, refreshToken }, { useReadHook = useEntityRead } = {}) {
|
|
5
|
+
const port = useMemo(() => registry.getEntity({ name: entityName }), [registry, entityName]);
|
|
6
|
+
const load = useCallback(() => loadEntityRow({ registry, entityName, id }), [registry, entityName, id, port]);
|
|
7
|
+
const result = useReadHook({ load, scope: port, refreshToken });
|
|
8
|
+
return { port, result };
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=EntityDetail.hooks.js.map
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback, useMemo } from 'react';
|
|
3
2
|
import { EntityCell } from './EntityCell.js';
|
|
4
|
-
import {
|
|
3
|
+
import { useEntityDetail } from './EntityDetail.hooks.js';
|
|
5
4
|
import { readTitle } from './rules.js';
|
|
6
|
-
export function EntityDetail({ entityName, id, registry, translate, routes }) {
|
|
7
|
-
const port
|
|
8
|
-
const load = useCallback(() => loadEntityRow({ registry, entityName, id }), [registry, entityName, id, port]);
|
|
9
|
-
const result = useEntityRead({ load, scope: port });
|
|
5
|
+
export function EntityDetail({ entityName, id, registry, translate, routes, refreshToken, useDetailHook = useEntityDetail }) {
|
|
6
|
+
const { port, result } = useDetailHook({ registry, entityName, id, refreshToken });
|
|
10
7
|
if (port === null)
|
|
11
8
|
return _jsx("p", { role: "alert", children: translate({ key: 'Unknown entity' }) });
|
|
12
9
|
if (result.error)
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import type { EntityEditProps } from './types.js';
|
|
2
|
+
import { useEntityEdit } from './use-entity-edit.js';
|
|
3
|
+
/** Every custom hook the editor uses, injectable and defaulted to the real one. */
|
|
4
|
+
export interface EntityEditHooks {
|
|
5
|
+
readonly useEditHook?: typeof useEntityEdit;
|
|
6
|
+
}
|
|
2
7
|
/** Host entity editing uses the existing registry/ports and core draft validation.
|
|
3
8
|
* Required booleans default false, optional booleans remain unset, and invalid JSON blocks save
|
|
4
9
|
* while preserving textarea contents. Creates omit undefined; updates retain explicit undefined
|
|
@@ -9,5 +14,5 @@ import type { EntityEditProps } from './types.js';
|
|
|
9
14
|
* live refresh and dirty-navigation prompts remain host responsibilities. Registry changes must
|
|
10
15
|
* replace the registry object; memoized per-entity ports can then refresh diagnostic wrappers.
|
|
11
16
|
*/
|
|
12
|
-
export declare function EntityEdit(props: EntityEditProps): import("react").JSX.Element;
|
|
17
|
+
export declare function EntityEdit(props: EntityEditProps & EntityEditHooks): import("react").JSX.Element;
|
|
13
18
|
//# sourceMappingURL=EntityEdit.d.ts.map
|
|
@@ -1,22 +1,39 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useId, useMemo } from 'react';
|
|
3
|
+
import { EntityCell } from './EntityCell.js';
|
|
3
4
|
import { EntityField } from './EntityField.js';
|
|
5
|
+
import { copyToClipboard, describeEntityFailure, FailureNotice } from './FailureNotice.js';
|
|
4
6
|
import { RelationTruncationNotice } from './RelationTruncationNotice.js';
|
|
5
7
|
import { useEntityEdit } from './use-entity-edit.js';
|
|
6
8
|
import { entityText } from './types.js';
|
|
7
|
-
|
|
9
|
+
/** A `persistedOnly` field on a saved row: its label and value, no control. */
|
|
10
|
+
function PersistedValue({ form, field, id, relations, translate }) {
|
|
11
|
+
return _jsxs("div", { children: [_jsx("span", { children: translate({ key: field.label ?? field.name }) }), ' ', _jsx(EntityCell, { field: field, row: { ...form.draft, id }, relations: relations, translate: translate })] });
|
|
12
|
+
}
|
|
13
|
+
function EntityFieldRow({ edit, form, field, inputId, relations, translate, id }) {
|
|
14
|
+
if (field.persistedOnly !== true)
|
|
15
|
+
return _jsx(EditableField, { edit: edit, form: form, field: field, inputId: inputId, relations: relations, translate: translate });
|
|
16
|
+
return id === null ? null : _jsx(PersistedValue, { form: form, field: field, id: id, relations: relations, translate: translate });
|
|
17
|
+
}
|
|
18
|
+
function EditableField({ edit, form, field, inputId, relations, translate }) {
|
|
8
19
|
const missing = edit.missing.includes(field.name);
|
|
9
20
|
const invalid = edit.invalid.some((problem) => problem.field === field.name);
|
|
10
21
|
const jsonError = form.jsonErrors[field.name] === true;
|
|
11
22
|
return _jsxs("div", { children: [_jsxs("label", { htmlFor: inputId, children: [translate({ key: field.label ?? field.name }), field.required ? ' *' : '', field.kind === 'datetime' ? ` (${translate({ key: 'UTC' })})` : ''] }), _jsx(EntityField, { inputId: inputId, field: field, value: form.draft[field.name], text: form.jsonText[field.name] ?? '', relations: relations, translate: translate, disabled: edit.pending !== null, invalid: missing || invalid || jsonError, onChange: ({ value }) => edit.setField({ name: field.name, value }), onTextChange: ({ text }) => edit.setJsonText({ name: field.name, text }) }), missing ? _jsx("p", { children: translate({ key: 'Required' }) }) : null, invalid ? _jsx("p", { children: translate({ key: 'Invalid value' }) }) : null, jsonError ? _jsx("p", { role: "alert", children: translate({ key: 'Invalid JSON' }) }) : null] });
|
|
12
23
|
}
|
|
24
|
+
function EditFailure({ edit, translate, describeFailure, copyText }) {
|
|
25
|
+
if (edit.failure === null)
|
|
26
|
+
return null;
|
|
27
|
+
const view = describeFailure ? describeFailure({ error: edit.failure.error }) : describeEntityFailure({ error: edit.failure.error, translate });
|
|
28
|
+
return _jsx(FailureNotice, { view: view, translate: translate, onReload: edit.reload, onRetry: () => { void edit.retry(); }, copyText: copyText });
|
|
29
|
+
}
|
|
13
30
|
function EditActions({ edit, canRemove, translate }) {
|
|
14
31
|
return _jsxs(_Fragment, { children: [_jsx("button", { type: "submit", disabled: !edit.canSave, children: translate({ key: edit.pending === 'save' ? 'Saving' : 'Save' }) }), canRemove ? _jsx("button", { type: "button", disabled: edit.pending !== null, onClick: () => { void edit.remove(); }, children: translate({ key: edit.pending === 'remove' ? 'Deleting' : 'Delete' }) }) : null] });
|
|
15
32
|
}
|
|
16
|
-
function EntityEditor(props) {
|
|
17
|
-
const { port, translate, routes, entityName, id } = props;
|
|
33
|
+
function EntityEditor({ useEditHook = useEntityEdit, ...props }) {
|
|
34
|
+
const { port, translate, routes, entityName, id, describeFailure, copyText = copyToClipboard } = props;
|
|
18
35
|
const formId = useId();
|
|
19
|
-
const edit =
|
|
36
|
+
const edit = useEditHook(props);
|
|
20
37
|
if (edit.read.error)
|
|
21
38
|
return _jsx("p", { role: "alert", children: translate({ key: 'Unable to load row' }) });
|
|
22
39
|
if (edit.read.loading || !edit.read.data)
|
|
@@ -27,7 +44,7 @@ function EntityEditor(props) {
|
|
|
27
44
|
if (!form)
|
|
28
45
|
return _jsx("p", { role: "status", children: translate({ key: 'Row not found' }) });
|
|
29
46
|
const { relations } = edit.read.data;
|
|
30
|
-
return _jsxs("form", { className: "page", onSubmit: (e) => { e.preventDefault(); void edit.save(); }, children: [_jsx("a", { href: routes.href({ entity: entityName }), children: translate({ key: port.descriptor.labelPlural }) }), _jsx("h1", { children: entityText({ translate, key: id === null ? 'New {entity}' : 'Edit {entity}', values: { entity: translate({ key: port.descriptor.labelSingular }) } }) }),
|
|
47
|
+
return _jsxs("form", { className: "page", onSubmit: (e) => { e.preventDefault(); void edit.save(); }, children: [_jsx("a", { href: routes.href({ entity: entityName }), children: translate({ key: port.descriptor.labelPlural }) }), _jsx("h1", { children: entityText({ translate, key: id === null ? 'New {entity}' : 'Edit {entity}', values: { entity: translate({ key: port.descriptor.labelSingular }) } }) }), _jsx(EditFailure, { edit: edit, translate: translate, describeFailure: describeFailure, copyText: copyText }), port.descriptor.fields.map((field, index) => _jsx(EntityFieldRow, { edit: edit, form: form, field: field, inputId: `${formId}-${index}`, relations: relations, translate: translate, id: id }, field.name)), _jsx(RelationTruncationNotice, { relations: relations, translate: translate }), _jsx(EditActions, { edit: edit, canRemove: id !== null && port.remove !== undefined, translate: translate })] });
|
|
31
48
|
}
|
|
32
49
|
/** Host entity editing uses the existing registry/ports and core draft validation.
|
|
33
50
|
* Required booleans default false, optional booleans remain unset, and invalid JSON blocks save
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
+
import { useAgentHandle } from '../kit.js';
|
|
2
3
|
import type { AdminEntityField } from '../../core/ports/entities.js';
|
|
3
4
|
import { type EntityTranslate } from './types.js';
|
|
4
5
|
import { type RelationIndex } from './rules.js';
|
|
5
6
|
interface EntityFieldProps {
|
|
7
|
+
readonly useAgentHandleHook?: typeof useAgentHandle;
|
|
6
8
|
readonly agentHandle?: string | false | undefined;
|
|
7
9
|
readonly inputId: string;
|
|
8
10
|
readonly field: AdminEntityField;
|
|
@@ -19,6 +21,6 @@ interface EntityFieldProps {
|
|
|
19
21
|
readonly text: string;
|
|
20
22
|
}) => void;
|
|
21
23
|
}
|
|
22
|
-
export declare function EntityField(required: EntityFieldProps): ReactNode;
|
|
24
|
+
export declare function EntityField({ useAgentHandleHook, ...required }: EntityFieldProps): ReactNode;
|
|
23
25
|
export {};
|
|
24
26
|
//# sourceMappingURL=EntityField.d.ts.map
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { agentHandleProps } from '@jini-ai/
|
|
3
|
-
import { useAgentHandle } from '
|
|
4
|
-
import { Select } from '@jini-ai/ui/admin-widgets';
|
|
2
|
+
import { agentHandleProps } from '@jini-ai/core/agent-handles';
|
|
3
|
+
import { useAgentHandle, WidgetSelect as Select } from '../kit.js';
|
|
5
4
|
import { selectTranslate } from './types.js';
|
|
6
5
|
import { fromDatetimeLocalValue, toDatetimeLocalValue } from './rules.js';
|
|
7
6
|
const fieldLabel = ({ field, translate }) => translate({ key: field.label ?? field.name });
|
|
@@ -36,9 +35,13 @@ function NumberInput(props) {
|
|
|
36
35
|
const { field, value, onChange } = props;
|
|
37
36
|
return _jsx("input", { ...commonProps(props), type: "number", step: field.kind === 'integer' ? '1' : 'any', value: typeof value === 'number' ? value : '', onChange: (e) => onChange({ value: e.target.value === '' ? undefined : Number(e.target.value) }) });
|
|
38
37
|
}
|
|
39
|
-
export function EntityField(required) {
|
|
40
|
-
const base =
|
|
41
|
-
|
|
38
|
+
export function EntityField({ useAgentHandleHook = useAgentHandle, ...required }) {
|
|
39
|
+
const base = useAgentHandleHook({ agentHandle: required.agentHandle });
|
|
40
|
+
return _jsx(EntityFieldInput, { ...required, agentHandle: base ?? false });
|
|
41
|
+
}
|
|
42
|
+
/** The kind-specific control, split from `EntityField` so the injected-hook default does not push
|
|
43
|
+
* the kind switch past the complexity limit. */
|
|
44
|
+
function EntityFieldInput(props) {
|
|
42
45
|
const { field, value, onChange } = props;
|
|
43
46
|
switch (field.kind) {
|
|
44
47
|
case 'json': return _jsx("textarea", { ...commonProps(props), value: props.text, onChange: (e) => props.onTextChange({ text: e.target.value }) });
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { type EntityListProps } from './types.js';
|
|
2
|
+
import { useEntityList } from './EntityList.hooks.js';
|
|
2
3
|
/** Cursor history records actual returned page lengths; never sort a server-paginated page locally.
|
|
3
4
|
* Host translation, registry and navigation are injected, and this list uses the existing DataTable.
|
|
4
5
|
* Relation choices are bounded to 100, expose truncation and retain raw IDs for unresolved labels.
|
|
5
6
|
*/
|
|
6
|
-
export declare function EntityList(props: EntityListProps
|
|
7
|
+
export declare function EntityList({ useListHook, ...props }: EntityListProps & {
|
|
8
|
+
readonly useListHook?: typeof useEntityList;
|
|
9
|
+
}): import("react").JSX.Element;
|
|
7
10
|
//# sourceMappingURL=EntityList.d.ts.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { EntityListProps } from './types.js';
|
|
2
|
+
import { useEntityRead } from './use-entity-read.js';
|
|
3
|
+
/** Track cursor history and read the selected page with its relation labels. */
|
|
4
|
+
export declare function useEntityList({ entityName, registry, limitParam, refreshToken, search }: Pick<EntityListProps, 'entityName' | 'registry' | 'limitParam' | 'refreshToken' | 'search'>, { useReadHook }?: {
|
|
5
|
+
readonly useReadHook?: typeof useEntityRead;
|
|
6
|
+
}): {
|
|
7
|
+
port: import("../../core/index.js").AdminErasedEntityPort | null;
|
|
8
|
+
entries: {
|
|
9
|
+
cursor: string | null;
|
|
10
|
+
offset: number;
|
|
11
|
+
}[];
|
|
12
|
+
position: {
|
|
13
|
+
cursor: string | null;
|
|
14
|
+
offset: number;
|
|
15
|
+
};
|
|
16
|
+
setWalk: import("react").Dispatch<import("react").SetStateAction<{
|
|
17
|
+
token: string;
|
|
18
|
+
port: import("../../core/index.js").AdminErasedEntityPort | null;
|
|
19
|
+
entries: {
|
|
20
|
+
cursor: string | null;
|
|
21
|
+
offset: number;
|
|
22
|
+
}[];
|
|
23
|
+
}>>;
|
|
24
|
+
result: {
|
|
25
|
+
readonly data: {
|
|
26
|
+
page: import("../../core/index.js").AdminEntityPage<import("../../core/index.js").AdminEntityRowData>;
|
|
27
|
+
relations: Readonly<Record<string, import("./rules.js").RelationOptions>>;
|
|
28
|
+
} | null | undefined;
|
|
29
|
+
readonly error: unknown;
|
|
30
|
+
readonly loading: boolean;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=EntityList.hooks.d.ts.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useCallback, useMemo, useState } from 'react';
|
|
2
|
+
import { loadRelationIndex, resolveEntityPageSize } from './rules.js';
|
|
3
|
+
import { useEntityRead } from './use-entity-read.js';
|
|
4
|
+
/** Track cursor history and read the selected page with its relation labels. */
|
|
5
|
+
export function useEntityList({ entityName, registry, limitParam, refreshToken, search }, { useReadHook = useEntityRead } = {}) {
|
|
6
|
+
const port = useMemo(() => registry.getEntity({ name: entityName }), [registry, entityName]);
|
|
7
|
+
const limit = resolveEntityPageSize({ raw: limitParam });
|
|
8
|
+
const text = search === null || search === undefined || search === '' ? undefined : search;
|
|
9
|
+
const token = JSON.stringify([entityName, limit, text ?? null]);
|
|
10
|
+
const [walk, setWalk] = useState({ token, port, entries: [{ cursor: null, offset: 0 }] });
|
|
11
|
+
const walkIsCurrent = walk.token === token && walk.port === port;
|
|
12
|
+
if (!walkIsCurrent)
|
|
13
|
+
setWalk({ token, port, entries: [{ cursor: null, offset: 0 }] });
|
|
14
|
+
const entries = walkIsCurrent ? walk.entries : [{ cursor: null, offset: 0 }];
|
|
15
|
+
const position = entries[entries.length - 1];
|
|
16
|
+
const load = useCallback(async () => {
|
|
17
|
+
if (port === null)
|
|
18
|
+
return null;
|
|
19
|
+
const [page, relations] = await Promise.all([
|
|
20
|
+
port.list({ limit, ...(position.cursor === null ? {} : { cursor: position.cursor }), ...(text === undefined ? {} : { search: text }) }),
|
|
21
|
+
loadRelationIndex({ descriptor: port.descriptor, registry }),
|
|
22
|
+
]);
|
|
23
|
+
return { page, relations };
|
|
24
|
+
}, [port, registry, limit, position.cursor, text]);
|
|
25
|
+
const result = useReadHook({ load, scope: port, refreshToken });
|
|
26
|
+
return { port, entries, position, setWalk, result };
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=EntityList.hooks.js.map
|
|
@@ -1,36 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback, useMemo, useState } from 'react';
|
|
3
2
|
import { DataTable } from '../components/DataTable.js';
|
|
4
3
|
import { EntityCell } from './EntityCell.js';
|
|
5
4
|
import { RelationTruncationNotice } from './RelationTruncationNotice.js';
|
|
6
5
|
import { entityText } from './types.js';
|
|
7
|
-
import {
|
|
8
|
-
import { useEntityRead } from './use-entity-read.js';
|
|
6
|
+
import { useEntityList } from './EntityList.hooks.js';
|
|
9
7
|
/** Cursor history records actual returned page lengths; never sort a server-paginated page locally.
|
|
10
8
|
* Host translation, registry and navigation are injected, and this list uses the existing DataTable.
|
|
11
9
|
* Relation choices are bounded to 100, expose truncation and retain raw IDs for unresolved labels.
|
|
12
10
|
*/
|
|
13
|
-
export function EntityList(props) {
|
|
11
|
+
export function EntityList({ useListHook = useEntityList, ...props }) {
|
|
14
12
|
const { entityName, registry, translate, routes } = props;
|
|
15
|
-
const port =
|
|
16
|
-
const limit = resolveEntityPageSize({ raw: props.limitParam });
|
|
17
|
-
const token = JSON.stringify([entityName, limit]);
|
|
18
|
-
const [walk, setWalk] = useState({ token, port, entries: [{ cursor: null, offset: 0 }] });
|
|
19
|
-
const walkIsCurrent = walk.token === token && walk.port === port;
|
|
20
|
-
if (!walkIsCurrent)
|
|
21
|
-
setWalk({ token, port, entries: [{ cursor: null, offset: 0 }] });
|
|
22
|
-
const entries = walkIsCurrent ? walk.entries : [{ cursor: null, offset: 0 }];
|
|
23
|
-
const position = entries[entries.length - 1];
|
|
24
|
-
const load = useCallback(async () => {
|
|
25
|
-
if (port === null)
|
|
26
|
-
return null;
|
|
27
|
-
const [page, relations] = await Promise.all([
|
|
28
|
-
port.list(position.cursor === null ? { limit } : { limit, cursor: position.cursor }),
|
|
29
|
-
loadRelationIndex({ descriptor: port.descriptor, registry }),
|
|
30
|
-
]);
|
|
31
|
-
return { page, relations };
|
|
32
|
-
}, [port, registry, limit, position.cursor]);
|
|
33
|
-
const result = useEntityRead({ load, scope: port });
|
|
13
|
+
const { port, entries, position, setWalk, result } = useListHook({ entityName, registry, limitParam: props.limitParam, refreshToken: props.refreshToken, search: props.search });
|
|
34
14
|
if (port === null)
|
|
35
15
|
return _jsx("p", { role: "alert", children: translate({ key: 'Unknown entity' }) });
|
|
36
16
|
if (result.error)
|