@nuxt-atelier/admin 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +6 -2
- package/dist/module.d.mts +52 -0
- package/dist/module.json +12 -0
- package/dist/module.mjs +188 -0
- package/dist/runtime/admin.css +1 -0
- package/dist/runtime/ai-off.d.ts +1 -0
- package/dist/runtime/ai-off.js +1 -0
- package/dist/runtime/appearance.d.ts +59 -0
- package/dist/runtime/appearance.js +111 -0
- package/dist/runtime/branding.d.ts +11 -0
- package/dist/runtime/branding.js +14 -0
- package/dist/runtime/components/App.d.vue.ts +6 -0
- package/dist/runtime/components/App.vue +170 -0
- package/dist/runtime/components/App.vue.d.ts +6 -0
- package/dist/runtime/components/AppearanceModal.d.vue.ts +3 -0
- package/dist/runtime/components/AppearanceModal.vue +267 -0
- package/dist/runtime/components/AppearanceModal.vue.d.ts +3 -0
- package/dist/runtime/components/AuthFrame.d.vue.ts +15 -0
- package/dist/runtime/components/AuthFrame.vue +56 -0
- package/dist/runtime/components/AuthFrame.vue.d.ts +15 -0
- package/dist/runtime/components/Brand.d.vue.ts +6 -0
- package/dist/runtime/components/Brand.vue +22 -0
- package/dist/runtime/components/Brand.vue.d.ts +6 -0
- package/dist/runtime/components/CollectionList.d.vue.ts +6 -0
- package/dist/runtime/components/CollectionList.vue +312 -0
- package/dist/runtime/components/CollectionList.vue.d.ts +6 -0
- package/dist/runtime/components/CommentsPanel.d.vue.ts +9 -0
- package/dist/runtime/components/CommentsPanel.vue +228 -0
- package/dist/runtime/components/CommentsPanel.vue.d.ts +9 -0
- package/dist/runtime/components/EntryEdit.d.vue.ts +9 -0
- package/dist/runtime/components/EntryEdit.vue +451 -0
- package/dist/runtime/components/EntryEdit.vue.d.ts +9 -0
- package/dist/runtime/components/FieldInput.d.vue.ts +13 -0
- package/dist/runtime/components/FieldInput.vue +325 -0
- package/dist/runtime/components/FieldInput.vue.d.ts +13 -0
- package/dist/runtime/components/FormSubmissions.d.vue.ts +6 -0
- package/dist/runtime/components/FormSubmissions.vue +197 -0
- package/dist/runtime/components/FormSubmissions.vue.d.ts +6 -0
- package/dist/runtime/components/GlobalSearch.d.vue.ts +10 -0
- package/dist/runtime/components/GlobalSearch.vue +145 -0
- package/dist/runtime/components/GlobalSearch.vue.d.ts +10 -0
- package/dist/runtime/components/Home.d.vue.ts +3 -0
- package/dist/runtime/components/Home.vue +226 -0
- package/dist/runtime/components/Home.vue.d.ts +3 -0
- package/dist/runtime/components/Icon.d.ts +14 -0
- package/dist/runtime/components/Icon.js +12 -0
- package/dist/runtime/components/MediaDetails.d.vue.ts +11 -0
- package/dist/runtime/components/MediaDetails.vue +222 -0
- package/dist/runtime/components/MediaDetails.vue.d.ts +11 -0
- package/dist/runtime/components/MediaField.d.vue.ts +14 -0
- package/dist/runtime/components/MediaField.vue +86 -0
- package/dist/runtime/components/MediaField.vue.d.ts +14 -0
- package/dist/runtime/components/MediaGrid.d.vue.ts +13 -0
- package/dist/runtime/components/MediaGrid.vue +49 -0
- package/dist/runtime/components/MediaGrid.vue.d.ts +13 -0
- package/dist/runtime/components/MediaLibrary.d.vue.ts +12 -0
- package/dist/runtime/components/MediaLibrary.vue +151 -0
- package/dist/runtime/components/MediaLibrary.vue.d.ts +12 -0
- package/dist/runtime/components/NotFound.d.vue.ts +6 -0
- package/dist/runtime/components/NotFound.vue +29 -0
- package/dist/runtime/components/NotFound.vue.d.ts +6 -0
- package/dist/runtime/components/NotificationBell.d.vue.ts +3 -0
- package/dist/runtime/components/NotificationBell.vue +53 -0
- package/dist/runtime/components/NotificationBell.vue.d.ts +3 -0
- package/dist/runtime/components/Page.d.vue.ts +28 -0
- package/dist/runtime/components/Page.vue +84 -0
- package/dist/runtime/components/Page.vue.d.ts +28 -0
- package/dist/runtime/components/RelatedCreate.d.vue.ts +16 -0
- package/dist/runtime/components/RelatedCreate.vue +86 -0
- package/dist/runtime/components/RelatedCreate.vue.d.ts +16 -0
- package/dist/runtime/components/RevisionHistory.d.vue.ts +16 -0
- package/dist/runtime/components/RevisionHistory.vue +145 -0
- package/dist/runtime/components/RevisionHistory.vue.d.ts +16 -0
- package/dist/runtime/components/RichTextEditor.d.vue.ts +15 -0
- package/dist/runtime/components/RichTextEditor.vue +190 -0
- package/dist/runtime/components/RichTextEditor.vue.d.ts +15 -0
- package/dist/runtime/components/RobotsSettings.d.vue.ts +3 -0
- package/dist/runtime/components/RobotsSettings.vue +173 -0
- package/dist/runtime/components/RobotsSettings.vue.d.ts +3 -0
- package/dist/runtime/components/RoleEdit.d.vue.ts +6 -0
- package/dist/runtime/components/RoleEdit.vue +234 -0
- package/dist/runtime/components/RoleEdit.vue.d.ts +6 -0
- package/dist/runtime/components/Roles.d.vue.ts +3 -0
- package/dist/runtime/components/Roles.vue +129 -0
- package/dist/runtime/components/Roles.vue.d.ts +3 -0
- package/dist/runtime/components/ScheduleSection.d.vue.ts +12 -0
- package/dist/runtime/components/ScheduleSection.vue +120 -0
- package/dist/runtime/components/ScheduleSection.vue.d.ts +12 -0
- package/dist/runtime/components/SeoPanel.d.vue.ts +7 -0
- package/dist/runtime/components/SeoPanel.vue +81 -0
- package/dist/runtime/components/SeoPanel.vue.d.ts +7 -0
- package/dist/runtime/components/Setup.d.vue.ts +3 -0
- package/dist/runtime/components/Setup.vue +79 -0
- package/dist/runtime/components/Setup.vue.d.ts +3 -0
- package/dist/runtime/components/SharedBlockUsage.d.vue.ts +7 -0
- package/dist/runtime/components/SharedBlockUsage.vue +91 -0
- package/dist/runtime/components/SharedBlockUsage.vue.d.ts +7 -0
- package/dist/runtime/components/Shell.d.vue.ts +15 -0
- package/dist/runtime/components/Shell.vue +277 -0
- package/dist/runtime/components/Shell.vue.d.ts +15 -0
- package/dist/runtime/components/SignIn.d.vue.ts +3 -0
- package/dist/runtime/components/SignIn.vue +106 -0
- package/dist/runtime/components/SignIn.vue.d.ts +3 -0
- package/dist/runtime/components/Toaster.d.vue.ts +3 -0
- package/dist/runtime/components/Toaster.vue +24 -0
- package/dist/runtime/components/Toaster.vue.d.ts +3 -0
- package/dist/runtime/components/Users.d.vue.ts +3 -0
- package/dist/runtime/components/Users.vue +226 -0
- package/dist/runtime/components/Users.vue.d.ts +3 -0
- package/dist/runtime/composables/debounced.d.ts +3 -0
- package/dist/runtime/composables/debounced.js +11 -0
- package/dist/runtime/composables/useAtelierAdmin.d.ts +17 -0
- package/dist/runtime/composables/useAtelierAdmin.js +53 -0
- package/dist/runtime/composables/useAtelierAdminPortal.d.ts +3 -0
- package/dist/runtime/composables/useAtelierAdminPortal.js +5 -0
- package/dist/runtime/composables/useAtelierAdminSchema.d.ts +182 -0
- package/dist/runtime/composables/useAtelierAdminSchema.js +26 -0
- package/dist/runtime/composables/useAtelierCollection.d.ts +49 -0
- package/dist/runtime/composables/useAtelierCollection.js +77 -0
- package/dist/runtime/composables/useAtelierComments.d.ts +50 -0
- package/dist/runtime/composables/useAtelierComments.js +46 -0
- package/dist/runtime/composables/useAtelierDashboard.d.ts +42 -0
- package/dist/runtime/composables/useAtelierDashboard.js +16 -0
- package/dist/runtime/composables/useAtelierEntryForm.d.ts +77 -0
- package/dist/runtime/composables/useAtelierEntryForm.js +184 -0
- package/dist/runtime/composables/useAtelierGlobalSearch.d.ts +12 -0
- package/dist/runtime/composables/useAtelierGlobalSearch.js +17 -0
- package/dist/runtime/composables/useAtelierMediaLibrary.d.ts +75 -0
- package/dist/runtime/composables/useAtelierMediaLibrary.js +85 -0
- package/dist/runtime/composables/useAtelierNavigation.d.ts +20 -0
- package/dist/runtime/composables/useAtelierNavigation.js +37 -0
- package/dist/runtime/composables/useAtelierNotifications.d.ts +21 -0
- package/dist/runtime/composables/useAtelierNotifications.js +34 -0
- package/dist/runtime/composables/useAtelierPermissions.d.ts +11 -0
- package/dist/runtime/composables/useAtelierPermissions.js +15 -0
- package/dist/runtime/composables/useAtelierPresence.d.ts +32 -0
- package/dist/runtime/composables/useAtelierPresence.js +95 -0
- package/dist/runtime/composables/useAtelierRealtime.d.ts +10 -0
- package/dist/runtime/composables/useAtelierRealtime.js +74 -0
- package/dist/runtime/composables/useAtelierRoles.d.ts +13 -0
- package/dist/runtime/composables/useAtelierRoles.js +15 -0
- package/dist/runtime/composables/useAtelierSeo.d.ts +34 -0
- package/dist/runtime/composables/useAtelierSeo.js +57 -0
- package/dist/runtime/composables/useAtelierSession.d.ts +35 -0
- package/dist/runtime/composables/useAtelierSession.js +36 -0
- package/dist/runtime/composables/useAtelierSetting.d.ts +11 -0
- package/dist/runtime/composables/useAtelierSetting.js +16 -0
- package/dist/runtime/composables/useAtelierUsers.d.ts +18 -0
- package/dist/runtime/composables/useAtelierUsers.js +16 -0
- package/dist/runtime/crystal-neuo/VERSION +3 -0
- package/dist/runtime/crystal-neuo/components/Alert.d.vue.ts +25 -0
- package/dist/runtime/crystal-neuo/components/Alert.vue +25 -0
- package/dist/runtime/crystal-neuo/components/Alert.vue.d.ts +25 -0
- package/dist/runtime/crystal-neuo/components/Avatar.d.vue.ts +15 -0
- package/dist/runtime/crystal-neuo/components/Avatar.vue +25 -0
- package/dist/runtime/crystal-neuo/components/Avatar.vue.d.ts +15 -0
- package/dist/runtime/crystal-neuo/components/Badge.d.vue.ts +25 -0
- package/dist/runtime/crystal-neuo/components/Badge.vue +17 -0
- package/dist/runtime/crystal-neuo/components/Badge.vue.d.ts +25 -0
- package/dist/runtime/crystal-neuo/components/Breadcrumb.d.vue.ts +16 -0
- package/dist/runtime/crystal-neuo/components/Breadcrumb.vue +26 -0
- package/dist/runtime/crystal-neuo/components/Breadcrumb.vue.d.ts +16 -0
- package/dist/runtime/crystal-neuo/components/Button.d.vue.ts +35 -0
- package/dist/runtime/crystal-neuo/components/Button.vue +31 -0
- package/dist/runtime/crystal-neuo/components/Button.vue.d.ts +35 -0
- package/dist/runtime/crystal-neuo/components/Card.d.vue.ts +25 -0
- package/dist/runtime/crystal-neuo/components/Card.vue +17 -0
- package/dist/runtime/crystal-neuo/components/Card.vue.d.ts +25 -0
- package/dist/runtime/crystal-neuo/components/Checkbox.d.vue.ts +23 -0
- package/dist/runtime/crystal-neuo/components/Checkbox.vue +45 -0
- package/dist/runtime/crystal-neuo/components/Checkbox.vue.d.ts +23 -0
- package/dist/runtime/crystal-neuo/components/DatePicker.d.vue.ts +24 -0
- package/dist/runtime/crystal-neuo/components/DatePicker.vue +43 -0
- package/dist/runtime/crystal-neuo/components/DatePicker.vue.d.ts +24 -0
- package/dist/runtime/crystal-neuo/components/Dialog.d.vue.ts +41 -0
- package/dist/runtime/crystal-neuo/components/Dialog.vue +63 -0
- package/dist/runtime/crystal-neuo/components/Dialog.vue.d.ts +41 -0
- package/dist/runtime/crystal-neuo/components/Drawer.d.vue.ts +34 -0
- package/dist/runtime/crystal-neuo/components/Drawer.vue +45 -0
- package/dist/runtime/crystal-neuo/components/Drawer.vue.d.ts +34 -0
- package/dist/runtime/crystal-neuo/components/FileUpload.d.vue.ts +32 -0
- package/dist/runtime/crystal-neuo/components/FileUpload.vue +94 -0
- package/dist/runtime/crystal-neuo/components/FileUpload.vue.d.ts +32 -0
- package/dist/runtime/crystal-neuo/components/Input.d.vue.ts +26 -0
- package/dist/runtime/crystal-neuo/components/Input.vue +48 -0
- package/dist/runtime/crystal-neuo/components/Input.vue.d.ts +26 -0
- package/dist/runtime/crystal-neuo/components/List.d.vue.ts +25 -0
- package/dist/runtime/crystal-neuo/components/List.vue +19 -0
- package/dist/runtime/crystal-neuo/components/List.vue.d.ts +25 -0
- package/dist/runtime/crystal-neuo/components/ListItem.d.vue.ts +20 -0
- package/dist/runtime/crystal-neuo/components/ListItem.vue +13 -0
- package/dist/runtime/crystal-neuo/components/ListItem.vue.d.ts +20 -0
- package/dist/runtime/crystal-neuo/components/Menu.d.vue.ts +26 -0
- package/dist/runtime/crystal-neuo/components/Menu.vue +120 -0
- package/dist/runtime/crystal-neuo/components/Menu.vue.d.ts +26 -0
- package/dist/runtime/crystal-neuo/components/Modal.d.vue.ts +32 -0
- package/dist/runtime/crystal-neuo/components/Modal.vue +37 -0
- package/dist/runtime/crystal-neuo/components/Modal.vue.d.ts +32 -0
- package/dist/runtime/crystal-neuo/components/Nav.d.vue.ts +24 -0
- package/dist/runtime/crystal-neuo/components/Nav.vue +15 -0
- package/dist/runtime/crystal-neuo/components/Nav.vue.d.ts +24 -0
- package/dist/runtime/crystal-neuo/components/NavLink.d.vue.ts +22 -0
- package/dist/runtime/crystal-neuo/components/NavLink.vue +23 -0
- package/dist/runtime/crystal-neuo/components/NavLink.vue.d.ts +22 -0
- package/dist/runtime/crystal-neuo/components/Pagination.d.vue.ts +23 -0
- package/dist/runtime/crystal-neuo/components/Pagination.vue +58 -0
- package/dist/runtime/crystal-neuo/components/Pagination.vue.d.ts +23 -0
- package/dist/runtime/crystal-neuo/components/Progress.d.vue.ts +18 -0
- package/dist/runtime/crystal-neuo/components/Progress.vue +35 -0
- package/dist/runtime/crystal-neuo/components/Progress.vue.d.ts +18 -0
- package/dist/runtime/crystal-neuo/components/Radio.d.vue.ts +28 -0
- package/dist/runtime/crystal-neuo/components/Radio.vue +40 -0
- package/dist/runtime/crystal-neuo/components/Radio.vue.d.ts +28 -0
- package/dist/runtime/crystal-neuo/components/SegmentedControl.d.vue.ts +31 -0
- package/dist/runtime/crystal-neuo/components/SegmentedControl.vue +39 -0
- package/dist/runtime/crystal-neuo/components/SegmentedControl.vue.d.ts +31 -0
- package/dist/runtime/crystal-neuo/components/Select.d.vue.ts +28 -0
- package/dist/runtime/crystal-neuo/components/Select.vue +48 -0
- package/dist/runtime/crystal-neuo/components/Select.vue.d.ts +28 -0
- package/dist/runtime/crystal-neuo/components/Sheet.d.vue.ts +29 -0
- package/dist/runtime/crystal-neuo/components/Sheet.vue +37 -0
- package/dist/runtime/crystal-neuo/components/Sheet.vue.d.ts +29 -0
- package/dist/runtime/crystal-neuo/components/Skeleton.d.vue.ts +13 -0
- package/dist/runtime/crystal-neuo/components/Skeleton.vue +17 -0
- package/dist/runtime/crystal-neuo/components/Skeleton.vue.d.ts +13 -0
- package/dist/runtime/crystal-neuo/components/Slider.d.vue.ts +28 -0
- package/dist/runtime/crystal-neuo/components/Slider.vue +41 -0
- package/dist/runtime/crystal-neuo/components/Slider.vue.d.ts +28 -0
- package/dist/runtime/crystal-neuo/components/TabBar.d.vue.ts +28 -0
- package/dist/runtime/crystal-neuo/components/TabBar.vue +29 -0
- package/dist/runtime/crystal-neuo/components/TabBar.vue.d.ts +28 -0
- package/dist/runtime/crystal-neuo/components/Table.d.vue.ts +31 -0
- package/dist/runtime/crystal-neuo/components/Table.vue +36 -0
- package/dist/runtime/crystal-neuo/components/Table.vue.d.ts +31 -0
- package/dist/runtime/crystal-neuo/components/Tabs.d.vue.ts +40 -0
- package/dist/runtime/crystal-neuo/components/Tabs.vue +79 -0
- package/dist/runtime/crystal-neuo/components/Tabs.vue.d.ts +40 -0
- package/dist/runtime/crystal-neuo/components/Textarea.d.vue.ts +25 -0
- package/dist/runtime/crystal-neuo/components/Textarea.vue +48 -0
- package/dist/runtime/crystal-neuo/components/Textarea.vue.d.ts +25 -0
- package/dist/runtime/crystal-neuo/components/Toast.d.vue.ts +32 -0
- package/dist/runtime/crystal-neuo/components/Toast.vue +67 -0
- package/dist/runtime/crystal-neuo/components/Toast.vue.d.ts +32 -0
- package/dist/runtime/crystal-neuo/components/Toggle.d.vue.ts +21 -0
- package/dist/runtime/crystal-neuo/components/Toggle.vue +43 -0
- package/dist/runtime/crystal-neuo/components/Toggle.vue.d.ts +21 -0
- package/dist/runtime/crystal-neuo/components/Tooltip.d.vue.ts +23 -0
- package/dist/runtime/crystal-neuo/components/Tooltip.vue +38 -0
- package/dist/runtime/crystal-neuo/components/Tooltip.vue.d.ts +23 -0
- package/dist/runtime/crystal-neuo/components/cn.d.ts +1 -0
- package/dist/runtime/crystal-neuo/components/cn.js +3 -0
- package/dist/runtime/crystal-neuo/components/useControlAttrs.d.ts +15 -0
- package/dist/runtime/crystal-neuo/components/useControlAttrs.js +11 -0
- package/dist/runtime/crystal-neuo/components/useFocusTrap.d.ts +9 -0
- package/dist/runtime/crystal-neuo/components/useFocusTrap.js +55 -0
- package/dist/runtime/crystal-neuo/components/useModalDialog.d.ts +11 -0
- package/dist/runtime/crystal-neuo/components/useModalDialog.js +42 -0
- package/dist/runtime/crystal-neuo/contract/alert.contract.d.ts +3 -0
- package/dist/runtime/crystal-neuo/contract/alert.contract.js +18 -0
- package/dist/runtime/crystal-neuo/contract/avatar.contract.d.ts +3 -0
- package/dist/runtime/crystal-neuo/contract/avatar.contract.js +18 -0
- package/dist/runtime/crystal-neuo/contract/badge.contract.d.ts +3 -0
- package/dist/runtime/crystal-neuo/contract/badge.contract.js +18 -0
- package/dist/runtime/crystal-neuo/contract/breadcrumb.contract.d.ts +3 -0
- package/dist/runtime/crystal-neuo/contract/breadcrumb.contract.js +19 -0
- package/dist/runtime/crystal-neuo/contract/button.contract.d.ts +3 -0
- package/dist/runtime/crystal-neuo/contract/button.contract.js +22 -0
- package/dist/runtime/crystal-neuo/contract/card.contract.d.ts +3 -0
- package/dist/runtime/crystal-neuo/contract/card.contract.js +18 -0
- package/dist/runtime/crystal-neuo/contract/checkbox.contract.d.ts +3 -0
- package/dist/runtime/crystal-neuo/contract/checkbox.contract.js +19 -0
- package/dist/runtime/crystal-neuo/contract/date-picker.contract.d.ts +3 -0
- package/dist/runtime/crystal-neuo/contract/date-picker.contract.js +22 -0
- package/dist/runtime/crystal-neuo/contract/dialog.contract.d.ts +3 -0
- package/dist/runtime/crystal-neuo/contract/dialog.contract.js +23 -0
- package/dist/runtime/crystal-neuo/contract/drawer.contract.d.ts +3 -0
- package/dist/runtime/crystal-neuo/contract/drawer.contract.js +23 -0
- package/dist/runtime/crystal-neuo/contract/file-upload.contract.d.ts +17 -0
- package/dist/runtime/crystal-neuo/contract/file-upload.contract.js +36 -0
- package/dist/runtime/crystal-neuo/contract/index.d.ts +67 -0
- package/dist/runtime/crystal-neuo/contract/index.js +96 -0
- package/dist/runtime/crystal-neuo/contract/input.contract.d.ts +3 -0
- package/dist/runtime/crystal-neuo/contract/input.contract.js +19 -0
- package/dist/runtime/crystal-neuo/contract/list.contract.d.ts +3 -0
- package/dist/runtime/crystal-neuo/contract/list.contract.js +21 -0
- package/dist/runtime/crystal-neuo/contract/menu.contract.d.ts +21 -0
- package/dist/runtime/crystal-neuo/contract/menu.contract.js +51 -0
- package/dist/runtime/crystal-neuo/contract/modal.contract.d.ts +3 -0
- package/dist/runtime/crystal-neuo/contract/modal.contract.js +24 -0
- package/dist/runtime/crystal-neuo/contract/nav.contract.d.ts +3 -0
- package/dist/runtime/crystal-neuo/contract/nav.contract.js +18 -0
- package/dist/runtime/crystal-neuo/contract/pagination.contract.d.ts +11 -0
- package/dist/runtime/crystal-neuo/contract/pagination.contract.js +32 -0
- package/dist/runtime/crystal-neuo/contract/progress.contract.d.ts +3 -0
- package/dist/runtime/crystal-neuo/contract/progress.contract.js +19 -0
- package/dist/runtime/crystal-neuo/contract/radio.contract.d.ts +3 -0
- package/dist/runtime/crystal-neuo/contract/radio.contract.js +24 -0
- package/dist/runtime/crystal-neuo/contract/segmented-control.contract.d.ts +3 -0
- package/dist/runtime/crystal-neuo/contract/segmented-control.contract.js +23 -0
- package/dist/runtime/crystal-neuo/contract/select.contract.d.ts +3 -0
- package/dist/runtime/crystal-neuo/contract/select.contract.js +24 -0
- package/dist/runtime/crystal-neuo/contract/sheet.contract.d.ts +3 -0
- package/dist/runtime/crystal-neuo/contract/sheet.contract.js +23 -0
- package/dist/runtime/crystal-neuo/contract/skeleton.contract.d.ts +3 -0
- package/dist/runtime/crystal-neuo/contract/skeleton.contract.js +18 -0
- package/dist/runtime/crystal-neuo/contract/slider.contract.d.ts +3 -0
- package/dist/runtime/crystal-neuo/contract/slider.contract.js +24 -0
- package/dist/runtime/crystal-neuo/contract/tab-bar.contract.d.ts +3 -0
- package/dist/runtime/crystal-neuo/contract/tab-bar.contract.js +19 -0
- package/dist/runtime/crystal-neuo/contract/table.contract.d.ts +3 -0
- package/dist/runtime/crystal-neuo/contract/table.contract.js +18 -0
- package/dist/runtime/crystal-neuo/contract/tabs.contract.d.ts +3 -0
- package/dist/runtime/crystal-neuo/contract/tabs.contract.js +26 -0
- package/dist/runtime/crystal-neuo/contract/textarea.contract.d.ts +3 -0
- package/dist/runtime/crystal-neuo/contract/textarea.contract.js +19 -0
- package/dist/runtime/crystal-neuo/contract/toast.contract.d.ts +3 -0
- package/dist/runtime/crystal-neuo/contract/toast.contract.js +18 -0
- package/dist/runtime/crystal-neuo/contract/toggle.contract.d.ts +3 -0
- package/dist/runtime/crystal-neuo/contract/toggle.contract.js +22 -0
- package/dist/runtime/crystal-neuo/contract/tooltip.contract.d.ts +3 -0
- package/dist/runtime/crystal-neuo/contract/tooltip.contract.js +18 -0
- package/dist/runtime/crystal-neuo/contract/types.d.ts +76 -0
- package/dist/runtime/crystal-neuo/contract/types.js +12 -0
- package/dist/runtime/crystal-neuo/css/crystal-neuo.css +1 -0
- package/dist/runtime/crystal-neuo/runtime/axes.d.ts +16 -0
- package/dist/runtime/crystal-neuo/runtime/axes.js +9 -0
- package/dist/runtime/crystal-neuo/runtime/index.d.ts +62 -0
- package/dist/runtime/crystal-neuo/runtime/index.js +115 -0
- package/dist/runtime/crystal-neuo/runtime/platform.d.ts +11 -0
- package/dist/runtime/crystal-neuo/runtime/platform.js +18 -0
- package/dist/runtime/crystal-neuo/runtime/refraction.d.ts +42 -0
- package/dist/runtime/crystal-neuo/runtime/refraction.js +183 -0
- package/dist/runtime/css/shell.css +1 -0
- package/dist/runtime/i18n/en.d.ts +2 -0
- package/dist/runtime/i18n/en.js +511 -0
- package/dist/runtime/i18n/index.d.ts +15 -0
- package/dist/runtime/i18n/index.js +52 -0
- package/dist/runtime/overrides.d.ts +5 -0
- package/dist/runtime/overrides.js +6 -0
- package/dist/runtime/pages/AdminPage.d.vue.ts +3 -0
- package/dist/runtime/pages/AdminPage.vue +49 -0
- package/dist/runtime/pages/AdminPage.vue.d.ts +3 -0
- package/dist/runtime/passkeys-off.d.ts +1 -0
- package/dist/runtime/passkeys-off.js +3 -0
- package/dist/runtime/passkeys.d.ts +1 -0
- package/dist/runtime/passkeys.js +6 -0
- package/dist/runtime/toast.d.ts +15 -0
- package/dist/runtime/toast.js +19 -0
- package/dist/runtime/types.d.ts +137 -0
- package/dist/runtime/types.js +0 -0
- package/dist/types.d.mts +3 -0
- package/package.json +59 -4
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { keepPreviousData, useMutation, useQuery, useQueryClient } from "@tanstack/vue-query";
|
|
2
|
+
import { computed, reactive, toValue, watch } from "vue";
|
|
3
|
+
import { atelierFetch } from "./useAtelierAdmin.js";
|
|
4
|
+
import { useAtelierAdminSchema } from "./useAtelierAdminSchema.js";
|
|
5
|
+
const TEXT = /* @__PURE__ */ new Set(["text", "slug", "email", "url", "textarea"]);
|
|
6
|
+
export function titleField(type) {
|
|
7
|
+
if (!type)
|
|
8
|
+
return void 0;
|
|
9
|
+
const keys = Object.keys(type.fields);
|
|
10
|
+
return ["title", "name", "label"].find((k) => k in type.fields) ?? keys.find((k) => TEXT.has(type.fields[k].type));
|
|
11
|
+
}
|
|
12
|
+
export function useAtelierCollection(name, initial = {}) {
|
|
13
|
+
const client = useQueryClient();
|
|
14
|
+
const { schema } = useAtelierAdminSchema();
|
|
15
|
+
const type = computed(() => schema.value?.collections.find((c) => c.name === toValue(name)));
|
|
16
|
+
const state = reactive({ page: 1, pageSize: 25, sort: "-_updatedAt", search: "", columns: [], ...initial });
|
|
17
|
+
watch(type, (t) => {
|
|
18
|
+
if (t && !state.columns.length)
|
|
19
|
+
state.columns = t.admin?.columns ?? [titleField(t)].filter((k) => !!k);
|
|
20
|
+
}, { immediate: true });
|
|
21
|
+
watch(() => [state.search, state.filter, state.sort, state.pageSize, state.locale], () => {
|
|
22
|
+
state.page = 1;
|
|
23
|
+
});
|
|
24
|
+
const filter = computed(() => {
|
|
25
|
+
const search = state.search.trim();
|
|
26
|
+
const field = titleField(type.value);
|
|
27
|
+
const parts = [state.filter, search && field ? { [field]: { contains: search } } : void 0].filter(Boolean);
|
|
28
|
+
return parts.length > 1 ? { and: parts } : parts[0];
|
|
29
|
+
});
|
|
30
|
+
const params = computed(() => ({
|
|
31
|
+
draft: "true",
|
|
32
|
+
...type.value?.localized && state.locale ? { locale: state.locale } : {},
|
|
33
|
+
sort: state.sort,
|
|
34
|
+
limit: state.pageSize,
|
|
35
|
+
offset: (state.page - 1) * state.pageSize,
|
|
36
|
+
...filter.value ? { filter: JSON.stringify(filter.value) } : {}
|
|
37
|
+
}));
|
|
38
|
+
const list = useQuery({
|
|
39
|
+
queryKey: ["atelier", "collections", computed(() => toValue(name)), "list", params],
|
|
40
|
+
queryFn: () => atelierFetch(`/collections/${encodeURIComponent(toValue(name))}`, { query: params.value }),
|
|
41
|
+
placeholderData: keepPreviousData,
|
|
42
|
+
// an adapter's content (an external backend) isn't listed here
|
|
43
|
+
enabled: computed(() => !!type.value && !type.value.adapter)
|
|
44
|
+
});
|
|
45
|
+
async function each(entries, run) {
|
|
46
|
+
const settled = await Promise.allSettled(entries.map(run));
|
|
47
|
+
const result = { succeeded: [], failed: [] };
|
|
48
|
+
settled.forEach((outcome, i) => outcome.status === "fulfilled" ? result.succeeded.push(entries[i].id) : result.failed.push({ id: entries[i].id, error: outcome.reason }));
|
|
49
|
+
await client.invalidateQueries({ queryKey: ["atelier", "collections", toValue(name)] });
|
|
50
|
+
return result;
|
|
51
|
+
}
|
|
52
|
+
const path = (entry, sub = "") => `/collections/${encodeURIComponent(toValue(name))}/${encodeURIComponent(entry.id)}${sub}`;
|
|
53
|
+
return {
|
|
54
|
+
type,
|
|
55
|
+
state,
|
|
56
|
+
entries: computed(() => list.data.value?.items ?? []),
|
|
57
|
+
total: computed(() => list.data.value?.total ?? 0),
|
|
58
|
+
pages: computed(() => Math.max(1, Math.ceil((list.data.value?.total ?? 0) / state.pageSize))),
|
|
59
|
+
loading: list.isPending,
|
|
60
|
+
error: computed(() => list.error.value),
|
|
61
|
+
refresh: list.refetch,
|
|
62
|
+
publish: useMutation({ mutationFn: (entries) => each(entries, (e) => atelierFetch(path(e, "/publish"), { method: "POST", body: { version: e.version } })) }),
|
|
63
|
+
unpublish: useMutation({ mutationFn: (entries) => each(entries, (e) => atelierFetch(path(e, "/unpublish"), { method: "POST" })) }),
|
|
64
|
+
remove: useMutation({ mutationFn: (entries) => each(entries, (e) => atelierFetch(path(e), { method: "DELETE" })) }),
|
|
65
|
+
/** The entries as a JSON or CSV file's contents (CSV: the visible columns, then id and dates). */
|
|
66
|
+
exportEntries(entries, format) {
|
|
67
|
+
if (format === "json")
|
|
68
|
+
return JSON.stringify(entries, null, 2);
|
|
69
|
+
const cell = (value) => {
|
|
70
|
+
const text = value === null || value === void 0 ? "" : typeof value === "object" ? JSON.stringify(value) : String(value);
|
|
71
|
+
return /[",\n\r]/.test(text) ? `"${text.replace(/"/g, '""')}"` : text;
|
|
72
|
+
};
|
|
73
|
+
const header = ["id", ...state.columns, "createdAt", "updatedAt"];
|
|
74
|
+
return [header, ...entries.map((e) => [e.id, ...state.columns.map((c) => e.data[c]), e.createdAt, e.updatedAt])].map((row) => row.map(cell).join(",")).join("\r\n");
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { MaybeRefOrGetter } from 'vue';
|
|
2
|
+
export interface EntryComment {
|
|
3
|
+
id: string;
|
|
4
|
+
block: string | null;
|
|
5
|
+
thread: string | null;
|
|
6
|
+
author: string;
|
|
7
|
+
authorName: string;
|
|
8
|
+
body: string;
|
|
9
|
+
mentions: string[];
|
|
10
|
+
resolvedAt: string | null;
|
|
11
|
+
resolvedBy: string | null;
|
|
12
|
+
createdAt: string;
|
|
13
|
+
/** About a block that's no longer in the entry. */
|
|
14
|
+
orphaned: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface CommentThread extends EntryComment {
|
|
17
|
+
replies: EntryComment[];
|
|
18
|
+
}
|
|
19
|
+
export declare function useAtelierComments(target: MaybeRefOrGetter<{
|
|
20
|
+
type: string;
|
|
21
|
+
id: string;
|
|
22
|
+
} | null>): {
|
|
23
|
+
/** Threads, oldest first, each with its replies. */
|
|
24
|
+
threads: import("vue").ComputedRef<CommentThread[]>;
|
|
25
|
+
loading: import("vue").Ref<true, true> | import("vue").Ref<false, false>;
|
|
26
|
+
/** Who can be mentioned: users who may read the entry. */
|
|
27
|
+
people: import("vue").ComputedRef<{
|
|
28
|
+
id: string;
|
|
29
|
+
name: string;
|
|
30
|
+
}[]>;
|
|
31
|
+
add: import("@tanstack/vue-query").UseMutationReturnType<EntryComment, Error, {
|
|
32
|
+
body: string;
|
|
33
|
+
block?: string | null;
|
|
34
|
+
thread?: string | null;
|
|
35
|
+
mentions?: string[];
|
|
36
|
+
}, unknown, import("@tanstack/vue-query").MutationResult<EntryComment, Error, {
|
|
37
|
+
body: string;
|
|
38
|
+
block?: string | null;
|
|
39
|
+
thread?: string | null;
|
|
40
|
+
mentions?: string[];
|
|
41
|
+
}, unknown>>;
|
|
42
|
+
resolve: import("@tanstack/vue-query").UseMutationReturnType<unknown, Error, {
|
|
43
|
+
id: string;
|
|
44
|
+
resolved: boolean;
|
|
45
|
+
}, unknown, import("@tanstack/vue-query").MutationResult<unknown, Error, {
|
|
46
|
+
id: string;
|
|
47
|
+
resolved: boolean;
|
|
48
|
+
}, unknown>>;
|
|
49
|
+
remove: import("@tanstack/vue-query").UseMutationReturnType<unknown, Error, string, unknown, import("@tanstack/vue-query").MutationResult<unknown, Error, string, unknown>>;
|
|
50
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { useMutation, useQuery, useQueryClient } from "@tanstack/vue-query";
|
|
2
|
+
import { computed, toValue } from "vue";
|
|
3
|
+
import { atelierFetch } from "./useAtelierAdmin.js";
|
|
4
|
+
import { useAtelierRealtime } from "./useAtelierRealtime.js";
|
|
5
|
+
export function useAtelierComments(target) {
|
|
6
|
+
const client = useQueryClient();
|
|
7
|
+
const realtime = useAtelierRealtime();
|
|
8
|
+
const t = computed(() => toValue(target));
|
|
9
|
+
const path = computed(() => t.value ? `/comments/${encodeURIComponent(t.value.type)}/${encodeURIComponent(t.value.id)}` : "");
|
|
10
|
+
const queryKey = computed(() => ["atelier", "comments", t.value?.type ?? "", t.value?.id ?? ""]);
|
|
11
|
+
const query = useQuery({
|
|
12
|
+
queryKey,
|
|
13
|
+
queryFn: () => atelierFetch(path.value),
|
|
14
|
+
enabled: computed(() => !!t.value),
|
|
15
|
+
refetchInterval: () => realtime.pollInterval()
|
|
16
|
+
});
|
|
17
|
+
const people = useQuery({
|
|
18
|
+
queryKey: computed(() => ["atelier", "collab", "people", t.value?.type ?? "", t.value?.id ?? ""]),
|
|
19
|
+
queryFn: () => atelierFetch(`/collab/${encodeURIComponent(t.value.type)}/${encodeURIComponent(t.value.id)}/people`),
|
|
20
|
+
enabled: computed(() => !!t.value),
|
|
21
|
+
staleTime: 5 * 6e4
|
|
22
|
+
});
|
|
23
|
+
const refresh = () => client.invalidateQueries({ queryKey: queryKey.value });
|
|
24
|
+
return {
|
|
25
|
+
/** Threads, oldest first, each with its replies. */
|
|
26
|
+
threads: computed(() => {
|
|
27
|
+
const all = query.data.value ?? [];
|
|
28
|
+
return all.filter((c) => !c.thread).map((c) => ({ ...c, replies: all.filter((r) => r.thread === c.id) }));
|
|
29
|
+
}),
|
|
30
|
+
loading: query.isPending,
|
|
31
|
+
/** Who can be mentioned: users who may read the entry. */
|
|
32
|
+
people: computed(() => people.data.value ?? []),
|
|
33
|
+
add: useMutation({
|
|
34
|
+
mutationFn: (input) => atelierFetch(path.value, { method: "POST", body: input }),
|
|
35
|
+
onSuccess: refresh
|
|
36
|
+
}),
|
|
37
|
+
resolve: useMutation({
|
|
38
|
+
mutationFn: ({ id, resolved }) => atelierFetch(`${path.value}/${encodeURIComponent(id)}`, { method: "PATCH", body: { resolved } }),
|
|
39
|
+
onSuccess: refresh
|
|
40
|
+
}),
|
|
41
|
+
remove: useMutation({
|
|
42
|
+
mutationFn: (id) => atelierFetch(`${path.value}/${encodeURIComponent(id)}`, { method: "DELETE" }),
|
|
43
|
+
onSuccess: refresh
|
|
44
|
+
})
|
|
45
|
+
};
|
|
46
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export interface Dashboard {
|
|
2
|
+
drafts: {
|
|
3
|
+
type: string;
|
|
4
|
+
id: string;
|
|
5
|
+
version: number;
|
|
6
|
+
publishedVersion: number | null;
|
|
7
|
+
updatedAt: string;
|
|
8
|
+
data: Record<string, unknown>;
|
|
9
|
+
}[];
|
|
10
|
+
scheduled: {
|
|
11
|
+
type: string;
|
|
12
|
+
id: string;
|
|
13
|
+
singleton: boolean;
|
|
14
|
+
action: 'publish' | 'unpublish';
|
|
15
|
+
version?: number;
|
|
16
|
+
runAt: string;
|
|
17
|
+
}[];
|
|
18
|
+
activity?: {
|
|
19
|
+
id: string;
|
|
20
|
+
at: string;
|
|
21
|
+
action: string;
|
|
22
|
+
actorId: string | null;
|
|
23
|
+
target?: {
|
|
24
|
+
type: string;
|
|
25
|
+
id: string;
|
|
26
|
+
} | null;
|
|
27
|
+
}[];
|
|
28
|
+
failedJobs?: {
|
|
29
|
+
id: string;
|
|
30
|
+
name: string;
|
|
31
|
+
lastError: string | null;
|
|
32
|
+
attempts: number;
|
|
33
|
+
runAt: string;
|
|
34
|
+
}[];
|
|
35
|
+
pendingMigrations?: number;
|
|
36
|
+
}
|
|
37
|
+
export declare function useAtelierDashboard(): {
|
|
38
|
+
dashboard: import("vue").ComputedRef<Dashboard | undefined>;
|
|
39
|
+
loading: import("vue").Ref<true, true> | import("vue").Ref<false, false>;
|
|
40
|
+
/** Queues a failed job again. */
|
|
41
|
+
retry: import("@tanstack/vue-query").UseMutationReturnType<unknown, Error, string, unknown, import("@tanstack/vue-query").MutationResult<unknown, Error, string, unknown>>;
|
|
42
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useMutation, useQuery, useQueryClient } from "@tanstack/vue-query";
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
import { atelierFetch } from "./useAtelierAdmin.js";
|
|
4
|
+
export function useAtelierDashboard() {
|
|
5
|
+
const client = useQueryClient();
|
|
6
|
+
const query = useQuery({ queryKey: ["atelier", "dashboard"], queryFn: () => atelierFetch("/dashboard") });
|
|
7
|
+
return {
|
|
8
|
+
dashboard: computed(() => query.data.value),
|
|
9
|
+
loading: query.isPending,
|
|
10
|
+
/** Queues a failed job again. */
|
|
11
|
+
retry: useMutation({
|
|
12
|
+
mutationFn: (id) => atelierFetch(`/jobs/${encodeURIComponent(id)}/retry`, { method: "POST" }),
|
|
13
|
+
onSuccess: () => client.invalidateQueries({ queryKey: ["atelier", "dashboard"] })
|
|
14
|
+
})
|
|
15
|
+
};
|
|
16
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { MaybeRefOrGetter } from 'vue';
|
|
2
|
+
import type { AdminApiError, Entry } from '../types.js';
|
|
3
|
+
export interface EntryFormTarget {
|
|
4
|
+
kind: 'collection' | 'singleton';
|
|
5
|
+
name: string;
|
|
6
|
+
/** A collection entry's id; none for a new entry. */
|
|
7
|
+
id?: string;
|
|
8
|
+
/** Localized collections: a new entry's locale (the default locale when unset). Localized singletons: the version's. */
|
|
9
|
+
locale?: string;
|
|
10
|
+
}
|
|
11
|
+
type Saved = Entry & {
|
|
12
|
+
version: number;
|
|
13
|
+
};
|
|
14
|
+
export declare function useAtelierEntryForm(target: MaybeRefOrGetter<EntryFormTarget>): {
|
|
15
|
+
type: import("vue").ComputedRef<import("../types.js").CollectionType | import("../types.js").SingletonType | undefined>;
|
|
16
|
+
form: import("@tanstack/vue-form").FormApi<Record<string, unknown>, import("@tanstack/vue-form").FormValidateOrFn<Record<string, unknown>> | undefined, import("@tanstack/vue-form").FormValidateOrFn<Record<string, unknown>> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<Record<string, unknown>> | undefined, import("@tanstack/vue-form").FormValidateOrFn<Record<string, unknown>> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<Record<string, unknown>> | undefined, import("@tanstack/vue-form").FormValidateOrFn<Record<string, unknown>> | undefined, ({ value }: {
|
|
17
|
+
value: Record<string, unknown>;
|
|
18
|
+
formApi: import("@tanstack/vue-form").FormApi<Record<string, unknown>, any, any, any, any, any, any, any, any, any, any, any>;
|
|
19
|
+
signal: AbortSignal;
|
|
20
|
+
}) => Promise<{
|
|
21
|
+
fields: {
|
|
22
|
+
[k: string]: string;
|
|
23
|
+
};
|
|
24
|
+
} | undefined>, import("@tanstack/vue-form").FormValidateOrFn<Record<string, unknown>> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<Record<string, unknown>> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<Record<string, unknown>> | undefined, unknown> & import("@tanstack/vue-form").VueFormApi<Record<string, unknown>, import("@tanstack/vue-form").FormValidateOrFn<Record<string, unknown>> | undefined, import("@tanstack/vue-form").FormValidateOrFn<Record<string, unknown>> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<Record<string, unknown>> | undefined, import("@tanstack/vue-form").FormValidateOrFn<Record<string, unknown>> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<Record<string, unknown>> | undefined, import("@tanstack/vue-form").FormValidateOrFn<Record<string, unknown>> | undefined, ({ value }: {
|
|
25
|
+
value: Record<string, unknown>;
|
|
26
|
+
formApi: import("@tanstack/vue-form").FormApi<Record<string, unknown>, any, any, any, any, any, any, any, any, any, any, any>;
|
|
27
|
+
signal: AbortSignal;
|
|
28
|
+
}) => Promise<{
|
|
29
|
+
fields: {
|
|
30
|
+
[k: string]: string;
|
|
31
|
+
};
|
|
32
|
+
} | undefined>, import("@tanstack/vue-form").FormValidateOrFn<Record<string, unknown>> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<Record<string, unknown>> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<Record<string, unknown>> | undefined, unknown>;
|
|
33
|
+
submit: () => Promise<void>;
|
|
34
|
+
entry: import("vue").ComputedRef<Saved | undefined>;
|
|
35
|
+
/** The entry's API path, and the query its requests take (a localized singleton's locale). */
|
|
36
|
+
url: import("vue").ComputedRef<string>;
|
|
37
|
+
/** Served by a content adapter (an external backend), not the database. */
|
|
38
|
+
adapter: import("vue").ComputedRef<boolean>;
|
|
39
|
+
localeQuery: import("vue").ComputedRef<{
|
|
40
|
+
locale: string;
|
|
41
|
+
} | {
|
|
42
|
+
locale?: undefined;
|
|
43
|
+
}>;
|
|
44
|
+
isNew: import("vue").ComputedRef<boolean>;
|
|
45
|
+
loading: import("vue").ComputedRef<boolean>;
|
|
46
|
+
loadError: import("vue").ComputedRef<AdminApiError | null>;
|
|
47
|
+
/** Whether the form has changes not saved yet. */
|
|
48
|
+
dirty: Readonly<import("vue").Ref<boolean, boolean>>;
|
|
49
|
+
/** Unsaved changes found in this browser from an earlier visit, offered back (see restoreRecovery). */
|
|
50
|
+
recovery: import("vue").Ref<{
|
|
51
|
+
values: Record<string, unknown>;
|
|
52
|
+
savedAt: string;
|
|
53
|
+
} | null, {
|
|
54
|
+
values: Record<string, unknown>;
|
|
55
|
+
savedAt: string;
|
|
56
|
+
} | {
|
|
57
|
+
values: Record<string, unknown>;
|
|
58
|
+
savedAt: string;
|
|
59
|
+
} | null>;
|
|
60
|
+
restoreRecovery: () => void;
|
|
61
|
+
/** Drops the recovery copy (and the offer). */
|
|
62
|
+
discardRecovery: () => void;
|
|
63
|
+
shelve: () => Promise<void>;
|
|
64
|
+
reload: () => Promise<void>;
|
|
65
|
+
startFrom: (data: Record<string, unknown> | null) => void;
|
|
66
|
+
/** Saved changes the site doesn't show yet. */
|
|
67
|
+
unpublished: import("vue").ComputedRef<boolean>;
|
|
68
|
+
save: import("@tanstack/vue-query").UseMutationReturnType<Saved, AdminApiError, Record<string, unknown>, unknown, import("@tanstack/vue-query").MutationResult<Saved, AdminApiError, Record<string, unknown>, unknown>>;
|
|
69
|
+
translate: import("@tanstack/vue-query").UseMutationReturnType<Saved, Error, string, unknown, import("@tanstack/vue-query").MutationResult<Saved, Error, string, unknown>>;
|
|
70
|
+
/** Localized collections: this version's locale, and the ids of its translations by locale. */
|
|
71
|
+
locale: import("vue").ComputedRef<string | undefined>;
|
|
72
|
+
translations: import("vue").ComputedRef<Record<string, string>>;
|
|
73
|
+
publish: import("@tanstack/vue-query").UseMutationReturnType<Saved, Error, void, unknown, import("@tanstack/vue-query").MutationResult<Saved, Error, void, unknown>>;
|
|
74
|
+
unpublish: import("@tanstack/vue-query").UseMutationReturnType<Saved, Error, void, unknown, import("@tanstack/vue-query").MutationResult<Saved, Error, void, unknown>>;
|
|
75
|
+
remove: import("@tanstack/vue-query").UseMutationReturnType<unknown, Error, void, unknown, import("@tanstack/vue-query").MutationResult<unknown, Error, void, unknown>>;
|
|
76
|
+
};
|
|
77
|
+
export {};
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { useForm } from "@tanstack/vue-form";
|
|
2
|
+
import { useMutation, useQuery, useQueryClient } from "@tanstack/vue-query";
|
|
3
|
+
import { computed, onScopeDispose, ref, toValue, watch } from "vue";
|
|
4
|
+
import { defaultsFactory, slugify, validateEntry } from "#atelier/shared/fields";
|
|
5
|
+
import { atelierFetch } from "./useAtelierAdmin.js";
|
|
6
|
+
import { useAtelierAdminSchema } from "./useAtelierAdminSchema.js";
|
|
7
|
+
const fromState = (state) => ({ id: state.ref.id ?? state.ref.name, version: state.version, data: state.data, publishedVersion: null });
|
|
8
|
+
const copy = (value) => JSON.parse(JSON.stringify(value));
|
|
9
|
+
export function useAtelierEntryForm(target) {
|
|
10
|
+
const client = useQueryClient();
|
|
11
|
+
const { schema } = useAtelierAdminSchema();
|
|
12
|
+
const t = computed(() => toValue(target));
|
|
13
|
+
const type = computed(() => t.value.kind === "collection" ? schema.value?.collections.find((c) => c.name === t.value.name) : schema.value?.singletons.find((s) => s.name === t.value.name));
|
|
14
|
+
const adapter = computed(() => !!type.value?.adapter);
|
|
15
|
+
const base = computed(() => adapter.value ? `/content/${t.value.kind}/${encodeURIComponent(t.value.name)}` : t.value.kind === "collection" ? `/collections/${encodeURIComponent(t.value.name)}` : `/singletons/${encodeURIComponent(t.value.name)}`);
|
|
16
|
+
const url = computed(() => t.value.kind === "collection" && t.value.id ? `${base.value}/${encodeURIComponent(t.value.id)}` : base.value);
|
|
17
|
+
const isNew = computed(() => t.value.kind === "collection" && !t.value.id);
|
|
18
|
+
const singletonLocale = computed(() => t.value.kind === "singleton" && type.value?.localized ? t.value.locale ?? schema.value?.locales.default : void 0);
|
|
19
|
+
const localeQuery = computed(() => singletonLocale.value ? { locale: singletonLocale.value } : {});
|
|
20
|
+
const entry = useQuery({
|
|
21
|
+
queryKey: ["atelier", computed(() => `${t.value.kind}s`), computed(() => t.value.name), "entry", computed(() => t.value.id ?? singletonLocale.value ?? "")],
|
|
22
|
+
queryFn: () => adapter.value ? atelierFetch(url.value).then(fromState) : atelierFetch(url.value, { query: { draft: "true", ...localeQuery.value } }),
|
|
23
|
+
enabled: computed(() => !!type.value && !isNew.value)
|
|
24
|
+
});
|
|
25
|
+
const version = computed(() => entry.data.value?.version ?? null);
|
|
26
|
+
const form = useForm({
|
|
27
|
+
defaultValues: {},
|
|
28
|
+
// validation runs again on every submit (see submit()): a failed one mustn't block the next
|
|
29
|
+
canSubmitWhenInvalid: true,
|
|
30
|
+
validators: {
|
|
31
|
+
// the server validates too (and checks uniqueness); this only saves a round trip
|
|
32
|
+
onSubmitAsync: async ({ value }) => {
|
|
33
|
+
const fields = type.value?.fields ?? {};
|
|
34
|
+
const result = await validateEntry(fields, value, { isUnique: async () => true, blocks: schema.value?.blocks });
|
|
35
|
+
return result.success ? void 0 : { fields: Object.fromEntries(result.errors.map((e) => [e.path, e.message])) };
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
onSubmit: async ({ value }) => {
|
|
39
|
+
await save.mutateAsync(value);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
watch([type, () => entry.data.value], ([fieldsOf, loaded]) => {
|
|
43
|
+
if (!fieldsOf || form.state.isDirty)
|
|
44
|
+
return;
|
|
45
|
+
if (isNew.value)
|
|
46
|
+
form.reset(defaultsFactory(fieldsOf.fields)());
|
|
47
|
+
else if (loaded)
|
|
48
|
+
form.reset(copy(loaded.data));
|
|
49
|
+
}, { immediate: true });
|
|
50
|
+
const recoveryKey = computed(() => `atelier-admin-recovery:${t.value.kind}:${t.value.name}:${t.value.id ?? "new"}`);
|
|
51
|
+
const storage = () => {
|
|
52
|
+
try {
|
|
53
|
+
return globalThis.localStorage;
|
|
54
|
+
} catch {
|
|
55
|
+
return void 0;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
const recovery = ref(null);
|
|
59
|
+
const values = form.useStore((state) => state.values);
|
|
60
|
+
const dirty = form.useStore((state) => state.isDirty);
|
|
61
|
+
watch(() => [type.value, entry.data.value, isNew.value], ([fieldsOf, loaded, fresh]) => {
|
|
62
|
+
if (!fieldsOf || !loaded && !fresh || recovery.value)
|
|
63
|
+
return;
|
|
64
|
+
const raw = storage()?.getItem(recoveryKey.value);
|
|
65
|
+
const copyOf = raw ? JSON.parse(raw) : null;
|
|
66
|
+
if (copyOf && JSON.stringify(copyOf.values) !== JSON.stringify(loaded?.data ?? defaultsFactory(fieldsOf.fields)()))
|
|
67
|
+
recovery.value = copyOf;
|
|
68
|
+
}, { immediate: true });
|
|
69
|
+
watch(() => Object.entries(type.value?.fields ?? {}).filter(([, f]) => f.type === "slug" && f.from).map(([key, f]) => [key, values.value[f.from]]), (now, before) => {
|
|
70
|
+
for (const [key, source] of now) {
|
|
71
|
+
const previous = before?.find(([k]) => k === key)?.[1];
|
|
72
|
+
const current = values.value[key];
|
|
73
|
+
if (entry.data.value?.publishedVersion)
|
|
74
|
+
return;
|
|
75
|
+
if (typeof source === "string" && source !== previous && (!current || current === slugify(String(previous ?? ""))))
|
|
76
|
+
form.setFieldValue(key, slugify(source));
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
let timer;
|
|
80
|
+
watch(values, (current) => {
|
|
81
|
+
if (!dirty.value)
|
|
82
|
+
return;
|
|
83
|
+
clearTimeout(timer);
|
|
84
|
+
timer = setTimeout(() => storage()?.setItem(recoveryKey.value, JSON.stringify({ values: current, savedAt: (/* @__PURE__ */ new Date()).toISOString() })), 400);
|
|
85
|
+
}, { deep: true });
|
|
86
|
+
onScopeDispose(() => clearTimeout(timer));
|
|
87
|
+
const forgetRecovery = () => {
|
|
88
|
+
clearTimeout(timer);
|
|
89
|
+
storage()?.removeItem(recoveryKey.value);
|
|
90
|
+
recovery.value = null;
|
|
91
|
+
};
|
|
92
|
+
function restoreRecovery() {
|
|
93
|
+
const copyOf = recovery.value;
|
|
94
|
+
if (!copyOf)
|
|
95
|
+
return;
|
|
96
|
+
for (const [key, value] of Object.entries(copyOf.values))
|
|
97
|
+
form.setFieldValue(key, value);
|
|
98
|
+
recovery.value = null;
|
|
99
|
+
}
|
|
100
|
+
const invalidate = () => client.invalidateQueries({ queryKey: ["atelier", `${t.value.kind}s`, t.value.name] });
|
|
101
|
+
async function shelve() {
|
|
102
|
+
clearTimeout(timer);
|
|
103
|
+
if (dirty.value) {
|
|
104
|
+
const copyOf = { values: copy(values.value), savedAt: (/* @__PURE__ */ new Date()).toISOString() };
|
|
105
|
+
storage()?.setItem(recoveryKey.value, JSON.stringify(copyOf));
|
|
106
|
+
recovery.value = copyOf;
|
|
107
|
+
}
|
|
108
|
+
await entry.refetch();
|
|
109
|
+
if (entry.data.value)
|
|
110
|
+
form.reset(copy(entry.data.value.data));
|
|
111
|
+
}
|
|
112
|
+
function startFrom(data) {
|
|
113
|
+
if (type.value)
|
|
114
|
+
form.reset({ ...defaultsFactory(type.value.fields)(), ...copy(data ?? {}) });
|
|
115
|
+
}
|
|
116
|
+
async function reload() {
|
|
117
|
+
await entry.refetch();
|
|
118
|
+
if (entry.data.value && !dirty.value)
|
|
119
|
+
form.reset(copy(entry.data.value.data));
|
|
120
|
+
}
|
|
121
|
+
const serverErrors = (error) => {
|
|
122
|
+
for (const { path, message } of error.errors ?? [])
|
|
123
|
+
form.setFieldMeta(path, (meta) => ({ ...meta, errorMap: { ...meta?.errorMap, onServer: message } }));
|
|
124
|
+
};
|
|
125
|
+
const save = useMutation({
|
|
126
|
+
mutationFn: (data) => adapter.value ? atelierFetch(url.value, isNew.value ? { method: "POST", body: { data } } : { method: "PUT", body: { version: version.value, data } }).then(fromState) : isNew.value ? atelierFetch(base.value, { method: "POST", body: { data, ...t.value.locale ? { locale: t.value.locale } : {} } }) : atelierFetch(url.value, { method: "PATCH", query: localeQuery.value, body: { version: version.value, data } }),
|
|
127
|
+
onSuccess: async (saved) => {
|
|
128
|
+
forgetRecovery();
|
|
129
|
+
client.setQueryData(["atelier", `${t.value.kind}s`, t.value.name, "entry", saved.id && t.value.kind === "collection" ? saved.id : ""], saved);
|
|
130
|
+
form.reset(copy(saved.data));
|
|
131
|
+
await invalidate();
|
|
132
|
+
},
|
|
133
|
+
onError: serverErrors
|
|
134
|
+
});
|
|
135
|
+
const publish = useMutation({
|
|
136
|
+
mutationFn: () => atelierFetch(`${url.value}/publish`, { method: "POST", query: localeQuery.value, body: { version: version.value } }),
|
|
137
|
+
onSuccess: invalidate
|
|
138
|
+
});
|
|
139
|
+
const unpublish = useMutation({ mutationFn: () => atelierFetch(`${url.value}/unpublish`, { method: "POST", query: localeQuery.value }), onSuccess: invalidate });
|
|
140
|
+
const translate = useMutation({
|
|
141
|
+
mutationFn: (locale) => atelierFetch(`${url.value}/translations`, { method: "POST", body: { locale } }),
|
|
142
|
+
onSuccess: invalidate
|
|
143
|
+
});
|
|
144
|
+
const remove = useMutation({ mutationFn: () => atelierFetch(url.value, { method: "DELETE" }), onSuccess: () => (forgetRecovery(), invalidate()) });
|
|
145
|
+
async function submit() {
|
|
146
|
+
for (const key of Object.keys(form.state.fieldMeta))
|
|
147
|
+
form.setFieldMeta(key, (meta) => ({ ...meta, errorMap: { ...meta?.errorMap, onSubmit: void 0, onServer: void 0 } }));
|
|
148
|
+
await form.handleSubmit();
|
|
149
|
+
}
|
|
150
|
+
return {
|
|
151
|
+
type,
|
|
152
|
+
form,
|
|
153
|
+
submit,
|
|
154
|
+
entry: computed(() => entry.data.value),
|
|
155
|
+
/** The entry's API path, and the query its requests take (a localized singleton's locale). */
|
|
156
|
+
url,
|
|
157
|
+
/** Served by a content adapter (an external backend), not the database. */
|
|
158
|
+
adapter,
|
|
159
|
+
localeQuery,
|
|
160
|
+
isNew,
|
|
161
|
+
loading: computed(() => !isNew.value && entry.isPending.value),
|
|
162
|
+
loadError: computed(() => entry.error.value),
|
|
163
|
+
/** Whether the form has changes not saved yet. */
|
|
164
|
+
dirty,
|
|
165
|
+
/** Unsaved changes found in this browser from an earlier visit, offered back (see restoreRecovery). */
|
|
166
|
+
recovery,
|
|
167
|
+
restoreRecovery,
|
|
168
|
+
/** Drops the recovery copy (and the offer). */
|
|
169
|
+
discardRecovery: forgetRecovery,
|
|
170
|
+
shelve,
|
|
171
|
+
reload,
|
|
172
|
+
startFrom,
|
|
173
|
+
/** Saved changes the site doesn't show yet. */
|
|
174
|
+
unpublished: computed(() => !!entry.data.value && entry.data.value.publishedVersion !== entry.data.value.version),
|
|
175
|
+
save,
|
|
176
|
+
translate,
|
|
177
|
+
/** Localized collections: this version's locale, and the ids of its translations by locale. */
|
|
178
|
+
locale: computed(() => singletonLocale.value ?? entry.data.value?.locale ?? t.value.locale),
|
|
179
|
+
translations: computed(() => entry.data.value?.translations ?? {}),
|
|
180
|
+
publish,
|
|
181
|
+
unpublish,
|
|
182
|
+
remove
|
|
183
|
+
};
|
|
184
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { MaybeRefOrGetter } from 'vue';
|
|
2
|
+
export interface GlobalSearchResult {
|
|
3
|
+
kind: 'entry' | 'singleton' | 'media' | 'user';
|
|
4
|
+
type?: string;
|
|
5
|
+
id: string;
|
|
6
|
+
title: string;
|
|
7
|
+
detail?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function useAtelierGlobalSearch(query: MaybeRefOrGetter<string>): {
|
|
10
|
+
results: import("vue").ComputedRef<GlobalSearchResult[]>;
|
|
11
|
+
loading: import("vue").ComputedRef<boolean>;
|
|
12
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { keepPreviousData, useQuery } from "@tanstack/vue-query";
|
|
2
|
+
import { computed, toValue } from "vue";
|
|
3
|
+
import { refDebounced } from "./debounced.js";
|
|
4
|
+
import { atelierFetch } from "./useAtelierAdmin.js";
|
|
5
|
+
export function useAtelierGlobalSearch(query) {
|
|
6
|
+
const text = refDebounced(computed(() => toValue(query).trim()), 200);
|
|
7
|
+
const search = useQuery({
|
|
8
|
+
queryKey: ["atelier", "global-search", text],
|
|
9
|
+
queryFn: () => atelierFetch("/search/admin", { query: { q: text.value } }),
|
|
10
|
+
enabled: computed(() => !!text.value),
|
|
11
|
+
placeholderData: keepPreviousData
|
|
12
|
+
});
|
|
13
|
+
return {
|
|
14
|
+
results: computed(() => text.value ? search.data.value?.results ?? [] : []),
|
|
15
|
+
loading: computed(() => !!text.value && search.isFetching.value)
|
|
16
|
+
};
|
|
17
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { MediaSummary } from '#atelier/shared/query';
|
|
2
|
+
export interface MediaItem extends MediaSummary {
|
|
3
|
+
size: number;
|
|
4
|
+
folder: string;
|
|
5
|
+
tags: string[];
|
|
6
|
+
private: boolean;
|
|
7
|
+
createdAt: string;
|
|
8
|
+
updatedAt: string;
|
|
9
|
+
}
|
|
10
|
+
export interface MediaChanges {
|
|
11
|
+
title?: string | null;
|
|
12
|
+
alt?: Record<string, string> | null;
|
|
13
|
+
caption?: string | null;
|
|
14
|
+
credits?: string | null;
|
|
15
|
+
folder?: string;
|
|
16
|
+
tags?: string[];
|
|
17
|
+
focal?: {
|
|
18
|
+
x: number;
|
|
19
|
+
y: number;
|
|
20
|
+
} | null;
|
|
21
|
+
private?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface MediaUsage {
|
|
24
|
+
type: string;
|
|
25
|
+
id: string;
|
|
26
|
+
field: string;
|
|
27
|
+
}
|
|
28
|
+
export interface MediaListState {
|
|
29
|
+
search: string;
|
|
30
|
+
folder: string;
|
|
31
|
+
tag: string;
|
|
32
|
+
/** `image`, `video`, `audio`, `application/pdf`, or '' for every kind. */
|
|
33
|
+
kind: string;
|
|
34
|
+
page: number;
|
|
35
|
+
pageSize: number;
|
|
36
|
+
}
|
|
37
|
+
/** Files above this go up in resumable chunks of this size. */
|
|
38
|
+
export declare const CHUNK: number;
|
|
39
|
+
export declare function useAtelierMediaLibrary(initial?: Partial<MediaListState>): {
|
|
40
|
+
state: {
|
|
41
|
+
search: string;
|
|
42
|
+
folder: string;
|
|
43
|
+
tag: string;
|
|
44
|
+
kind: string;
|
|
45
|
+
page: number;
|
|
46
|
+
pageSize: number;
|
|
47
|
+
};
|
|
48
|
+
items: import("vue").ComputedRef<MediaItem[]>;
|
|
49
|
+
total: import("vue").ComputedRef<number>;
|
|
50
|
+
pages: import("vue").ComputedRef<number>;
|
|
51
|
+
loading: import("vue").Ref<true, true> | import("vue").Ref<false, false>;
|
|
52
|
+
upload: (file: File, options?: {
|
|
53
|
+
folder?: string;
|
|
54
|
+
private?: boolean;
|
|
55
|
+
}) => Promise<MediaItem>;
|
|
56
|
+
progress: import("vue").Ref<Record<string, number>, Record<string, number>>;
|
|
57
|
+
update: import("@tanstack/vue-query").UseMutationReturnType<MediaItem, Error, {
|
|
58
|
+
id: string;
|
|
59
|
+
changes: MediaChanges;
|
|
60
|
+
}, unknown, import("@tanstack/vue-query").MutationResult<MediaItem, Error, {
|
|
61
|
+
id: string;
|
|
62
|
+
changes: MediaChanges;
|
|
63
|
+
}, unknown>>;
|
|
64
|
+
usage: (id: string) => Promise<MediaUsage[]>;
|
|
65
|
+
/** Deletes an item; refused (409 `referenced`, with `usages`) while entries use it, unless `force`. */
|
|
66
|
+
remove: import("@tanstack/vue-query").UseMutationReturnType<unknown, Error, {
|
|
67
|
+
id: string;
|
|
68
|
+
force?: boolean;
|
|
69
|
+
}, unknown, import("@tanstack/vue-query").MutationResult<unknown, Error, {
|
|
70
|
+
id: string;
|
|
71
|
+
force?: boolean;
|
|
72
|
+
}, unknown>>;
|
|
73
|
+
};
|
|
74
|
+
/** One media item, for a media field's preview. */
|
|
75
|
+
export declare function useAtelierMediaItem(id: () => string | null | undefined): import("@tanstack/vue-query").UseQueryReturnType<MediaItem, Error>;
|