@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,85 @@
|
|
|
1
|
+
import { keepPreviousData, useMutation, useQuery, useQueryClient } from "@tanstack/vue-query";
|
|
2
|
+
import { computed, reactive, ref, watch } from "vue";
|
|
3
|
+
import { refDebounced } from "./debounced.js";
|
|
4
|
+
import { atelierFetch } from "./useAtelierAdmin.js";
|
|
5
|
+
export const CHUNK = 5 * 1024 * 1024;
|
|
6
|
+
export function useAtelierMediaLibrary(initial = {}) {
|
|
7
|
+
const client = useQueryClient();
|
|
8
|
+
const state = reactive({ search: "", folder: "", tag: "", kind: "", page: 1, pageSize: 40, ...initial });
|
|
9
|
+
const search = refDebounced(computed(() => state.search.trim()), 250);
|
|
10
|
+
watch(() => [search.value, state.folder, state.tag, state.kind], () => state.page = 1);
|
|
11
|
+
const filter = computed(() => {
|
|
12
|
+
const parts = [
|
|
13
|
+
search.value ? { or: ["filename", "title", "caption", "credits"].map((f) => ({ [f]: { contains: search.value } })) } : void 0,
|
|
14
|
+
state.folder ? { folder: { eq: state.folder } } : void 0,
|
|
15
|
+
state.tag ? { tags: { contains: state.tag } } : void 0,
|
|
16
|
+
state.kind ? { mime: { contains: state.kind } } : void 0
|
|
17
|
+
].filter(Boolean);
|
|
18
|
+
return parts.length > 1 ? { and: parts } : parts[0];
|
|
19
|
+
});
|
|
20
|
+
const params = computed(() => ({ limit: state.pageSize, offset: (state.page - 1) * state.pageSize, ...filter.value ? { filter: JSON.stringify(filter.value) } : {} }));
|
|
21
|
+
const list = useQuery({
|
|
22
|
+
queryKey: ["atelier", "media", "list", params],
|
|
23
|
+
queryFn: () => atelierFetch("/media", { query: params.value }),
|
|
24
|
+
placeholderData: keepPreviousData
|
|
25
|
+
});
|
|
26
|
+
const refresh = () => client.invalidateQueries({ queryKey: ["atelier", "media"] });
|
|
27
|
+
const progress = ref({});
|
|
28
|
+
async function upload(file, options = {}) {
|
|
29
|
+
const set = (share) => progress.value = { ...progress.value, [file.name]: share };
|
|
30
|
+
set(0);
|
|
31
|
+
try {
|
|
32
|
+
if (file.size <= CHUNK) {
|
|
33
|
+
const query = { filename: file.name, ...options.folder ? { folder: options.folder } : {}, ...options.private ? { private: "true" } : {} };
|
|
34
|
+
const item = await atelierFetch("/media", { method: "POST", query, body: file });
|
|
35
|
+
set(1);
|
|
36
|
+
return item;
|
|
37
|
+
}
|
|
38
|
+
const session = await atelierFetch("/media/uploads", { method: "POST", body: { filename: file.name, size: file.size, ...options } });
|
|
39
|
+
let offset = 0;
|
|
40
|
+
while (offset < file.size) {
|
|
41
|
+
try {
|
|
42
|
+
await atelierFetch(`/media/uploads/${session.id}`, { method: "PUT", query: { offset }, body: file.slice(offset, offset + CHUNK) });
|
|
43
|
+
offset = Math.min(file.size, offset + CHUNK);
|
|
44
|
+
} catch (error) {
|
|
45
|
+
const status = await atelierFetch(`/media/uploads/${session.id}`).catch(() => void 0);
|
|
46
|
+
if (!status || status.received === offset)
|
|
47
|
+
throw error;
|
|
48
|
+
offset = status.received;
|
|
49
|
+
}
|
|
50
|
+
set(offset / file.size);
|
|
51
|
+
}
|
|
52
|
+
return await atelierFetch(`/media/uploads/${session.id}/complete`, { method: "POST" });
|
|
53
|
+
} finally {
|
|
54
|
+
const { [file.name]: _, ...rest } = progress.value;
|
|
55
|
+
progress.value = rest;
|
|
56
|
+
await refresh();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
state,
|
|
61
|
+
items: computed(() => list.data.value?.items ?? []),
|
|
62
|
+
total: computed(() => list.data.value?.total ?? 0),
|
|
63
|
+
pages: computed(() => Math.max(1, Math.ceil((list.data.value?.total ?? 0) / state.pageSize))),
|
|
64
|
+
loading: list.isPending,
|
|
65
|
+
upload,
|
|
66
|
+
progress,
|
|
67
|
+
update: useMutation({
|
|
68
|
+
mutationFn: ({ id, changes }) => atelierFetch(`/media/${encodeURIComponent(id)}`, { method: "PATCH", body: changes }),
|
|
69
|
+
onSuccess: refresh
|
|
70
|
+
}),
|
|
71
|
+
usage: (id) => atelierFetch(`/media/${encodeURIComponent(id)}/usage`),
|
|
72
|
+
/** Deletes an item; refused (409 `referenced`, with `usages`) while entries use it, unless `force`. */
|
|
73
|
+
remove: useMutation({
|
|
74
|
+
mutationFn: ({ id, force }) => atelierFetch(`/media/${encodeURIComponent(id)}`, { method: "DELETE", ...force ? { query: { force: "true" } } : {} }),
|
|
75
|
+
onSuccess: refresh
|
|
76
|
+
})
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
export function useAtelierMediaItem(id) {
|
|
80
|
+
return useQuery({
|
|
81
|
+
queryKey: ["atelier", "media", "item", computed(() => id() ?? "")],
|
|
82
|
+
queryFn: () => atelierFetch(`/media/${encodeURIComponent(id())}`),
|
|
83
|
+
enabled: computed(() => !!id())
|
|
84
|
+
});
|
|
85
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface NavigationItem {
|
|
2
|
+
label: string;
|
|
3
|
+
icon: string;
|
|
4
|
+
to: string;
|
|
5
|
+
group?: string;
|
|
6
|
+
}
|
|
7
|
+
/** `blogPosts` → `Blog posts` */
|
|
8
|
+
export declare const humanize: (name: string) => string;
|
|
9
|
+
/** One entry of a collection: `labels.singular`, else its name without a plural "s" (`authors` → `Author`). */
|
|
10
|
+
export declare const singularLabel: (type: {
|
|
11
|
+
name: string;
|
|
12
|
+
labels?: {
|
|
13
|
+
singular?: string;
|
|
14
|
+
};
|
|
15
|
+
}) => string;
|
|
16
|
+
/** Whether a user managing `capabilities` may open a page that requires any one of `requires` (none: everyone). */
|
|
17
|
+
export declare const allowed: (requires: readonly string[], capabilities: readonly string[]) => boolean;
|
|
18
|
+
export declare function useAtelierNavigation(): {
|
|
19
|
+
items: import("vue").ComputedRef<NavigationItem[]>;
|
|
20
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { computed } from "vue";
|
|
2
|
+
import customPages from "#atelier-admin-pages";
|
|
3
|
+
import { useAdminI18n } from "../i18n/index.js";
|
|
4
|
+
import { useAtelierAdmin } from "./useAtelierAdmin.js";
|
|
5
|
+
import { useAtelierAdminSchema } from "./useAtelierAdminSchema.js";
|
|
6
|
+
export const humanize = (name) => {
|
|
7
|
+
const words = name.replace(/([a-z\d])([A-Z])/g, "$1 $2").replace(/[-_]+/g, " ").toLowerCase();
|
|
8
|
+
return words.charAt(0).toUpperCase() + words.slice(1);
|
|
9
|
+
};
|
|
10
|
+
export const singularLabel = (type) => type.labels?.singular ?? humanize(type.name.replace(/(?<=[^s])s$/, ""));
|
|
11
|
+
const AREAS = [
|
|
12
|
+
{ capability: "users", label: "nav.users", icon: "users", path: "users" },
|
|
13
|
+
{ capability: "roles", label: "nav.roles", icon: "shield", path: "roles" },
|
|
14
|
+
{ capability: "settings", label: "nav.searchEngines", icon: "search", path: "settings/robots" }
|
|
15
|
+
];
|
|
16
|
+
export const allowed = (requires, capabilities) => !requires.length || requires.some((r) => capabilities.includes(r));
|
|
17
|
+
export function useAtelierNavigation() {
|
|
18
|
+
const { to } = useAtelierAdmin();
|
|
19
|
+
const { schema } = useAtelierAdminSchema();
|
|
20
|
+
const { t } = useAdminI18n();
|
|
21
|
+
const items = computed(() => {
|
|
22
|
+
const s = schema.value;
|
|
23
|
+
if (!s)
|
|
24
|
+
return [];
|
|
25
|
+
return [
|
|
26
|
+
{ label: t("nav.dashboard"), icon: "i-lucide-layout-dashboard", to: to() },
|
|
27
|
+
...s.collections.map((c) => ({ label: c.labels?.plural ?? humanize(c.name), icon: c.admin?.icon ?? "i-lucide-files", to: to("collections", c.name), group: c.admin?.group ?? t("nav.content") })),
|
|
28
|
+
...s.singletons.map((one) => ({ label: one.label ?? humanize(one.name), icon: one.admin?.icon ?? "i-lucide-file-text", to: to("singletons", one.name), group: one.admin?.group ?? t("nav.content") })),
|
|
29
|
+
// the media library: everyone signed in browses it
|
|
30
|
+
{ label: t("nav.media"), icon: "image", to: to("media"), group: t("nav.content") },
|
|
31
|
+
...AREAS.filter((a) => s.capabilities.includes(a.capability)).map((a) => ({ label: t(a.label), icon: a.icon, to: to(...a.path.split("/")), group: t("nav.settings") })),
|
|
32
|
+
// the app's and plugins' pages, for those allowed to open them
|
|
33
|
+
...customPages.filter((p) => !p.hidden && allowed(p.requires, s.capabilities)).toSorted((a, b) => (a.order ?? 0) - (b.order ?? 0)).map((p) => ({ label: p.label, icon: p.icon ?? "file-text", to: to(...p.path.split("/")), group: p.group ?? t("nav.tools") }))
|
|
34
|
+
];
|
|
35
|
+
});
|
|
36
|
+
return { items };
|
|
37
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface AdminNotification {
|
|
2
|
+
id: string;
|
|
3
|
+
kind: 'mention' | 'reply' | 'takeover';
|
|
4
|
+
data: {
|
|
5
|
+
type: string;
|
|
6
|
+
entry: string;
|
|
7
|
+
by: string;
|
|
8
|
+
byName: string;
|
|
9
|
+
comment?: string;
|
|
10
|
+
thread?: string;
|
|
11
|
+
excerpt?: string;
|
|
12
|
+
};
|
|
13
|
+
readAt: string | null;
|
|
14
|
+
createdAt: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function useAtelierNotifications(): {
|
|
17
|
+
items: import("vue").ComputedRef<AdminNotification[]>;
|
|
18
|
+
unread: import("vue").ComputedRef<number>;
|
|
19
|
+
/** Marks these notifications read, or all of them. */
|
|
20
|
+
markRead: import("@tanstack/vue-query").UseMutationReturnType<unknown, Error, string[] | undefined, unknown, import("@tanstack/vue-query").MutationResult<unknown, Error, string[] | undefined, unknown>>;
|
|
21
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { useMutation, useQuery, useQueryClient } from "@tanstack/vue-query";
|
|
2
|
+
import { computed, onBeforeUnmount, watch } from "vue";
|
|
3
|
+
import { atelierFetch } from "./useAtelierAdmin.js";
|
|
4
|
+
import { useAtelierRealtime } from "./useAtelierRealtime.js";
|
|
5
|
+
import { useAtelierSession } from "./useAtelierSession.js";
|
|
6
|
+
export function useAtelierNotifications() {
|
|
7
|
+
const client = useQueryClient();
|
|
8
|
+
const realtime = useAtelierRealtime();
|
|
9
|
+
const { user } = useAtelierSession();
|
|
10
|
+
const queryKey = ["atelier", "notifications"];
|
|
11
|
+
const query = useQuery({
|
|
12
|
+
queryKey,
|
|
13
|
+
queryFn: () => atelierFetch("/notifications", { query: { limit: 20 } }),
|
|
14
|
+
enabled: computed(() => !!user.value),
|
|
15
|
+
refetchInterval: () => realtime.pollInterval()
|
|
16
|
+
});
|
|
17
|
+
let unfollow = () => {
|
|
18
|
+
};
|
|
19
|
+
watch(() => user.value?.id, (id) => {
|
|
20
|
+
unfollow();
|
|
21
|
+
unfollow = id ? realtime.follow(`user:${id}`, () => void query.refetch()) : () => {
|
|
22
|
+
};
|
|
23
|
+
}, { immediate: true });
|
|
24
|
+
onBeforeUnmount(() => unfollow());
|
|
25
|
+
return {
|
|
26
|
+
items: computed(() => query.data.value?.items ?? []),
|
|
27
|
+
unread: computed(() => query.data.value?.unread ?? 0),
|
|
28
|
+
/** Marks these notifications read, or all of them. */
|
|
29
|
+
markRead: useMutation({
|
|
30
|
+
mutationFn: (ids) => atelierFetch("/notifications/read", { method: "POST", body: ids ? { ids } : {} }),
|
|
31
|
+
onSuccess: () => client.invalidateQueries({ queryKey })
|
|
32
|
+
})
|
|
33
|
+
};
|
|
34
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Capability, ContentAction } from '../types.js';
|
|
2
|
+
export declare function useAtelierPermissions(): {
|
|
3
|
+
/** Whether the user may do `action` on the collection or singleton `name` (on some entries, for own-only rules). */
|
|
4
|
+
can: (action: ContentAction, name: string) => boolean;
|
|
5
|
+
/** Whether `action` is limited to the user's own entries. */
|
|
6
|
+
ownOnly: (action: ContentAction, name: string) => boolean;
|
|
7
|
+
/** Whether the user manages an admin area (users, roles, media…). */
|
|
8
|
+
manages: (capability: Capability) => boolean;
|
|
9
|
+
/** Whether the user may change `field` of `name` (not read-only for their role). */
|
|
10
|
+
canWrite: (name: string, field: string) => boolean;
|
|
11
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useAtelierAdminSchema } from "./useAtelierAdminSchema.js";
|
|
2
|
+
export function useAtelierPermissions() {
|
|
3
|
+
const { schema } = useAtelierAdminSchema();
|
|
4
|
+
const type = (name) => schema.value?.collections.find((c) => c.name === name) ?? schema.value?.singletons.find((s) => s.name === name);
|
|
5
|
+
return {
|
|
6
|
+
/** Whether the user may do `action` on the collection or singleton `name` (on some entries, for own-only rules). */
|
|
7
|
+
can: (action, name) => type(name)?.can[action] ?? false,
|
|
8
|
+
/** Whether `action` is limited to the user's own entries. */
|
|
9
|
+
ownOnly: (action, name) => type(name)?.ownOnly.includes(action) ?? false,
|
|
10
|
+
/** Whether the user manages an admin area (users, roles, media…). */
|
|
11
|
+
manages: (capability) => schema.value?.capabilities.includes(capability) ?? false,
|
|
12
|
+
/** Whether the user may change `field` of `name` (not read-only for their role). */
|
|
13
|
+
canWrite: (name, field) => !(type(name)?.readOnly.includes(field) ?? true)
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { MaybeRefOrGetter } from 'vue';
|
|
2
|
+
export interface EntryLock {
|
|
3
|
+
userId: string;
|
|
4
|
+
name: string;
|
|
5
|
+
acquiredAt: string;
|
|
6
|
+
expiresAt: string;
|
|
7
|
+
mine: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface EntryViewer {
|
|
10
|
+
userId: string;
|
|
11
|
+
name: string;
|
|
12
|
+
seenAt: string;
|
|
13
|
+
me: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface Presence {
|
|
16
|
+
lock: EntryLock | null;
|
|
17
|
+
viewers: EntryViewer[];
|
|
18
|
+
granted?: boolean;
|
|
19
|
+
}
|
|
20
|
+
/** `target` is the entry (`id`: a singleton's name) or null for none (a new entry); `canEdit` asks for the lock. */
|
|
21
|
+
export declare function useAtelierPresence(target: MaybeRefOrGetter<{
|
|
22
|
+
type: string;
|
|
23
|
+
id: string;
|
|
24
|
+
} | null>, canEdit: MaybeRefOrGetter<boolean>): {
|
|
25
|
+
lock: import("vue").ComputedRef<EntryLock | null>;
|
|
26
|
+
/** Everyone else with the entry open. */
|
|
27
|
+
others: import("vue").ComputedRef<EntryViewer[]>;
|
|
28
|
+
/** Someone else is editing: look, don't touch. */
|
|
29
|
+
lockedByOther: import("vue").ComputedRef<boolean>;
|
|
30
|
+
takingOver: import("vue").Ref<boolean, boolean>;
|
|
31
|
+
takeover(): Promise<void>;
|
|
32
|
+
};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { useQuery, useQueryClient } from "@tanstack/vue-query";
|
|
2
|
+
import { computed, onBeforeUnmount, onMounted, ref, toValue, watch } from "vue";
|
|
3
|
+
import { useRuntimeConfig } from "#imports";
|
|
4
|
+
import { atelierFetch } from "./useAtelierAdmin.js";
|
|
5
|
+
import { useAtelierRealtime } from "./useAtelierRealtime.js";
|
|
6
|
+
const HEARTBEAT = 2e4;
|
|
7
|
+
export function useAtelierPresence(target, canEdit) {
|
|
8
|
+
const client = useQueryClient();
|
|
9
|
+
const realtime = useAtelierRealtime();
|
|
10
|
+
const idleTimeout = (useRuntimeConfig().public.atelier?.collaboration?.idleTimeout ?? 900) * 1e3;
|
|
11
|
+
const path = computed(() => {
|
|
12
|
+
const t = toValue(target);
|
|
13
|
+
return t ? `/collab/${encodeURIComponent(t.type)}/${encodeURIComponent(t.id)}` : "";
|
|
14
|
+
});
|
|
15
|
+
const queryKey = computed(() => ["atelier", "collab", path.value]);
|
|
16
|
+
const query = useQuery({
|
|
17
|
+
queryKey,
|
|
18
|
+
queryFn: () => atelierFetch(path.value),
|
|
19
|
+
enabled: computed(() => !!path.value),
|
|
20
|
+
refetchInterval: () => realtime.pollInterval()
|
|
21
|
+
});
|
|
22
|
+
let lastActive = Date.now();
|
|
23
|
+
const active = () => lastActive = Date.now();
|
|
24
|
+
const heartbeat = async (takeover = false) => {
|
|
25
|
+
if (!path.value)
|
|
26
|
+
return;
|
|
27
|
+
const edit = toValue(canEdit) && (takeover || Date.now() - lastActive < idleTimeout);
|
|
28
|
+
try {
|
|
29
|
+
client.setQueryData(queryKey.value, await atelierFetch(path.value, { method: "POST", body: { edit, ...takeover ? { takeover } : {} } }));
|
|
30
|
+
} catch {
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
const leave = (from) => {
|
|
34
|
+
if (from)
|
|
35
|
+
void atelierFetch(from, { method: "DELETE" }).catch(() => {
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
let timer;
|
|
39
|
+
let unfollow = () => {
|
|
40
|
+
};
|
|
41
|
+
function open() {
|
|
42
|
+
unfollow();
|
|
43
|
+
const t = toValue(target);
|
|
44
|
+
unfollow = t ? realtime.follow(`entry:${t.type}:${t.id}`, (kind) => {
|
|
45
|
+
if (kind === "lock" || kind === "presence")
|
|
46
|
+
void query.refetch();
|
|
47
|
+
else if (kind === "comments")
|
|
48
|
+
void client.invalidateQueries({ queryKey: ["atelier", "comments", t.type, t.id] });
|
|
49
|
+
}) : () => {
|
|
50
|
+
};
|
|
51
|
+
void heartbeat();
|
|
52
|
+
}
|
|
53
|
+
watch(path, (_, before) => {
|
|
54
|
+
leave(before ?? "");
|
|
55
|
+
open();
|
|
56
|
+
});
|
|
57
|
+
watch(() => query.data.value?.lock, (lock2, before) => {
|
|
58
|
+
if (!lock2 && before && !before.mine && toValue(canEdit))
|
|
59
|
+
void heartbeat();
|
|
60
|
+
});
|
|
61
|
+
const onPageHide = () => path.value && fetch(`/api/_atelier${path.value}`, { method: "DELETE", keepalive: true, headers: csrfHeader() });
|
|
62
|
+
onMounted(() => {
|
|
63
|
+
for (const event of ["keydown", "pointerdown", "scroll"])
|
|
64
|
+
addEventListener(event, active, { capture: true, passive: true });
|
|
65
|
+
addEventListener("pagehide", onPageHide);
|
|
66
|
+
timer = setInterval(() => void heartbeat(), HEARTBEAT);
|
|
67
|
+
open();
|
|
68
|
+
});
|
|
69
|
+
onBeforeUnmount(() => {
|
|
70
|
+
for (const event of ["keydown", "pointerdown", "scroll"])
|
|
71
|
+
removeEventListener(event, active, { capture: true });
|
|
72
|
+
removeEventListener("pagehide", onPageHide);
|
|
73
|
+
clearInterval(timer);
|
|
74
|
+
unfollow();
|
|
75
|
+
leave(path.value);
|
|
76
|
+
});
|
|
77
|
+
const lock = computed(() => query.data.value?.lock ?? null);
|
|
78
|
+
const takingOver = ref(false);
|
|
79
|
+
return {
|
|
80
|
+
lock,
|
|
81
|
+
/** Everyone else with the entry open. */
|
|
82
|
+
others: computed(() => (query.data.value?.viewers ?? []).filter((v) => !v.me)),
|
|
83
|
+
/** Someone else is editing: look, don't touch. */
|
|
84
|
+
lockedByOther: computed(() => !!lock.value && !lock.value.mine),
|
|
85
|
+
takingOver,
|
|
86
|
+
async takeover() {
|
|
87
|
+
takingOver.value = true;
|
|
88
|
+
await heartbeat(true).finally(() => takingOver.value = false);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
function csrfHeader() {
|
|
93
|
+
const token = document.cookie.split("; ").find((c) => c.startsWith("atelier-csrf="))?.slice("atelier-csrf=".length);
|
|
94
|
+
return token ? { "x-atelier-csrf": token } : {};
|
|
95
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
type Listener = (kind: string) => void;
|
|
2
|
+
export declare function useAtelierRealtime(): {
|
|
3
|
+
/** True while changes are pushed; poll more often when false. */
|
|
4
|
+
connected: import("vue").Ref<boolean, boolean>;
|
|
5
|
+
/** How often to poll: rarely while connected, every 20 seconds otherwise. */
|
|
6
|
+
pollInterval: () => 60000 | 20000;
|
|
7
|
+
/** Calls `listener` with what changed in `topic`; returns the unfollow. */
|
|
8
|
+
follow(topic: string, listener: Listener): () => void;
|
|
9
|
+
};
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { ref } from "vue";
|
|
2
|
+
import { useRuntimeConfig } from "#imports";
|
|
3
|
+
import { atelierFetch } from "./useAtelierAdmin.js";
|
|
4
|
+
const connected = ref(false);
|
|
5
|
+
const listeners = /* @__PURE__ */ new Map();
|
|
6
|
+
let socket;
|
|
7
|
+
let retry;
|
|
8
|
+
let failures = 0;
|
|
9
|
+
const send = (message) => socket?.readyState === WebSocket.OPEN && socket.send(JSON.stringify(message));
|
|
10
|
+
async function connect() {
|
|
11
|
+
if (socket || retry || !listeners.size)
|
|
12
|
+
return;
|
|
13
|
+
try {
|
|
14
|
+
const { ticket } = await atelierFetch("/collab/ticket", { method: "POST" });
|
|
15
|
+
const scheme = location.protocol === "https:" ? "wss" : "ws";
|
|
16
|
+
socket = new WebSocket(`${scheme}://${location.host}/api/_atelier/ws?ticket=${encodeURIComponent(ticket)}`);
|
|
17
|
+
} catch {
|
|
18
|
+
return reconnect();
|
|
19
|
+
}
|
|
20
|
+
socket.addEventListener("open", () => {
|
|
21
|
+
connected.value = true;
|
|
22
|
+
failures = 0;
|
|
23
|
+
for (const topic of listeners.keys())
|
|
24
|
+
send({ subscribe: topic });
|
|
25
|
+
});
|
|
26
|
+
socket.addEventListener("message", (event) => {
|
|
27
|
+
try {
|
|
28
|
+
const { topic, kind } = JSON.parse(String(event.data));
|
|
29
|
+
listeners.get(topic)?.forEach((listener) => listener(kind));
|
|
30
|
+
} catch {
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
socket.addEventListener("close", () => {
|
|
34
|
+
socket = void 0;
|
|
35
|
+
connected.value = false;
|
|
36
|
+
reconnect();
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
function reconnect() {
|
|
40
|
+
if (retry || !listeners.size)
|
|
41
|
+
return;
|
|
42
|
+
failures++;
|
|
43
|
+
retry = setTimeout(() => {
|
|
44
|
+
retry = void 0;
|
|
45
|
+
void connect();
|
|
46
|
+
}, Math.min(6e4, 2e3 * 2 ** Math.min(failures, 5)));
|
|
47
|
+
}
|
|
48
|
+
export function useAtelierRealtime() {
|
|
49
|
+
const enabled = useRuntimeConfig().public.atelier?.collaboration?.realtime ?? false;
|
|
50
|
+
return {
|
|
51
|
+
/** True while changes are pushed; poll more often when false. */
|
|
52
|
+
connected,
|
|
53
|
+
/** How often to poll: rarely while connected, every 20 seconds otherwise. */
|
|
54
|
+
pollInterval: () => connected.value ? 6e4 : 2e4,
|
|
55
|
+
/** Calls `listener` with what changed in `topic`; returns the unfollow. */
|
|
56
|
+
follow(topic, listener) {
|
|
57
|
+
if (!enabled || typeof WebSocket === "undefined")
|
|
58
|
+
return () => {
|
|
59
|
+
};
|
|
60
|
+
const set = listeners.get(topic) ?? listeners.set(topic, /* @__PURE__ */ new Set()).get(topic);
|
|
61
|
+
set.add(listener);
|
|
62
|
+
if (set.size === 1)
|
|
63
|
+
send({ subscribe: topic });
|
|
64
|
+
void connect();
|
|
65
|
+
return () => {
|
|
66
|
+
set.delete(listener);
|
|
67
|
+
if (set.size)
|
|
68
|
+
return;
|
|
69
|
+
listeners.delete(topic);
|
|
70
|
+
send({ unsubscribe: topic });
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Role, RoleEntry } from '../types.js';
|
|
2
|
+
export declare function useAtelierRoles(): {
|
|
3
|
+
roles: import("vue").ComputedRef<RoleEntry[]>;
|
|
4
|
+
loading: import("vue").Ref<true, true> | import("vue").Ref<false, false>;
|
|
5
|
+
save: import("@tanstack/vue-query").UseMutationReturnType<Role, Error, {
|
|
6
|
+
name: string;
|
|
7
|
+
role: Role;
|
|
8
|
+
}, unknown, import("@tanstack/vue-query").MutationResult<Role, Error, {
|
|
9
|
+
name: string;
|
|
10
|
+
role: Role;
|
|
11
|
+
}, unknown>>;
|
|
12
|
+
remove: import("@tanstack/vue-query").UseMutationReturnType<unknown, Error, string, unknown, import("@tanstack/vue-query").MutationResult<unknown, Error, string, unknown>>;
|
|
13
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useMutation, useQuery, useQueryClient } from "@tanstack/vue-query";
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
import { atelierFetch } from "./useAtelierAdmin.js";
|
|
4
|
+
export function useAtelierRoles() {
|
|
5
|
+
const client = useQueryClient();
|
|
6
|
+
const list = useQuery({ queryKey: ["atelier", "roles"], queryFn: () => atelierFetch("/roles") });
|
|
7
|
+
const refresh = () => Promise.all([client.invalidateQueries({ queryKey: ["atelier", "roles"] }), client.invalidateQueries({ queryKey: ["atelier", "schema"] })]);
|
|
8
|
+
const path = (name) => `/roles/${encodeURIComponent(name)}`;
|
|
9
|
+
return {
|
|
10
|
+
roles: computed(() => list.data.value ?? []),
|
|
11
|
+
loading: list.isPending,
|
|
12
|
+
save: useMutation({ mutationFn: ({ name, role }) => atelierFetch(path(name), { method: "PUT", body: role }), onSuccess: refresh }),
|
|
13
|
+
remove: useMutation({ mutationFn: (name) => atelierFetch(path(name), { method: "DELETE" }), onSuccess: refresh })
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { MaybeRefOrGetter } from 'vue';
|
|
2
|
+
import type { MediaSummary } from '#atelier/shared/query';
|
|
3
|
+
export type SeoCheck = 'description-missing' | 'description-short' | 'description-long' | 'title-long' | 'image-alt-missing' | 'title-duplicate';
|
|
4
|
+
/** Lengths past which search results usually cut the text. */
|
|
5
|
+
export declare const SEO_LIMITS: {
|
|
6
|
+
title: number;
|
|
7
|
+
descriptionMin: number;
|
|
8
|
+
description: number;
|
|
9
|
+
};
|
|
10
|
+
export interface SeoInput {
|
|
11
|
+
collection: string;
|
|
12
|
+
/** The entry's id, so it isn't its own duplicate. */
|
|
13
|
+
id?: string;
|
|
14
|
+
data: Record<string, unknown>;
|
|
15
|
+
path?: string | null;
|
|
16
|
+
media?: Record<string, MediaSummary>;
|
|
17
|
+
locale?: string;
|
|
18
|
+
}
|
|
19
|
+
export declare function useAtelierSeo(input: MaybeRefOrGetter<SeoInput>): {
|
|
20
|
+
/** As search results show the page: the title (with the site's template), the address and the description. */
|
|
21
|
+
search: import("vue").ComputedRef<{
|
|
22
|
+
title: string;
|
|
23
|
+
url: string;
|
|
24
|
+
description: string;
|
|
25
|
+
}>;
|
|
26
|
+
/** As a shared link shows it. */
|
|
27
|
+
social: import("vue").ComputedRef<{
|
|
28
|
+
title: string;
|
|
29
|
+
description: string;
|
|
30
|
+
image: string | undefined;
|
|
31
|
+
}>;
|
|
32
|
+
robots: import("vue").ComputedRef<string | undefined>;
|
|
33
|
+
checks: import("vue").ComputedRef<SeoCheck[]>;
|
|
34
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { useQuery } from "@tanstack/vue-query";
|
|
2
|
+
import { refDebounced } from "./debounced.js";
|
|
3
|
+
import { computed, toValue } from "vue";
|
|
4
|
+
import { resolveSeo } from "#atelier/shared/seo";
|
|
5
|
+
import { useRuntimeConfig } from "#imports";
|
|
6
|
+
import { atelierFetch } from "./useAtelierAdmin.js";
|
|
7
|
+
export const SEO_LIMITS = { title: 60, descriptionMin: 50, description: 160 };
|
|
8
|
+
export function useAtelierSeo(input) {
|
|
9
|
+
const config = useRuntimeConfig().public.atelier;
|
|
10
|
+
const seo = computed(() => {
|
|
11
|
+
const { data, media, path } = toValue(input);
|
|
12
|
+
return resolveSeo({ data, media }, { path: path ?? "/", siteUrl: config.siteUrl });
|
|
13
|
+
});
|
|
14
|
+
const title = computed(() => (config.seo?.titleTemplate ?? "%s").replace("%s", seo.value.title));
|
|
15
|
+
const ownTitle = refDebounced(computed(() => seo.value.title.trim()), 400);
|
|
16
|
+
const titleKey = computed(() => {
|
|
17
|
+
const data = toValue(input).data;
|
|
18
|
+
const seoTitle = data.seo?.title;
|
|
19
|
+
return typeof seoTitle === "string" && seoTitle.trim() ? "seo.title" : ["title", "name"].find((k) => typeof data[k] === "string");
|
|
20
|
+
});
|
|
21
|
+
const duplicates = useQuery({
|
|
22
|
+
queryKey: ["atelier", "collections", computed(() => toValue(input).collection), "seo-title", titleKey, ownTitle],
|
|
23
|
+
queryFn: () => atelierFetch(`/collections/${encodeURIComponent(toValue(input).collection)}`, {
|
|
24
|
+
query: { draft: "true", limit: 2, fields: titleKey.value, filter: JSON.stringify({ [titleKey.value]: { eq: ownTitle.value } }), ...toValue(input).locale ? { locale: toValue(input).locale } : {} }
|
|
25
|
+
}),
|
|
26
|
+
enabled: computed(() => !!ownTitle.value && !!titleKey.value && titleKey.value !== "seo.title")
|
|
27
|
+
});
|
|
28
|
+
const checks = computed(() => {
|
|
29
|
+
const { data, media } = toValue(input);
|
|
30
|
+
const found = [];
|
|
31
|
+
const description = seo.value.description ?? "";
|
|
32
|
+
if (!description)
|
|
33
|
+
found.push("description-missing");
|
|
34
|
+
else if (description.length < SEO_LIMITS.descriptionMin)
|
|
35
|
+
found.push("description-short");
|
|
36
|
+
else if (description.length > SEO_LIMITS.description)
|
|
37
|
+
found.push("description-long");
|
|
38
|
+
if (title.value.length > SEO_LIMITS.title)
|
|
39
|
+
found.push("title-long");
|
|
40
|
+
const imageId = [data.seo?.image, data.image, data.cover].find((x) => typeof x === "string" && x);
|
|
41
|
+
const image = imageId ? media?.[imageId] : void 0;
|
|
42
|
+
const locale = toValue(input).locale;
|
|
43
|
+
if (image && !(image.alt?.[locale ?? ""] || image.alt?.[""] || Object.values(image.alt ?? {}).some(Boolean)))
|
|
44
|
+
found.push("image-alt-missing");
|
|
45
|
+
if ((duplicates.data.value?.items ?? []).some((e) => e.id !== toValue(input).id))
|
|
46
|
+
found.push("title-duplicate");
|
|
47
|
+
return found;
|
|
48
|
+
});
|
|
49
|
+
return {
|
|
50
|
+
/** As search results show the page: the title (with the site's template), the address and the description. */
|
|
51
|
+
search: computed(() => ({ title: title.value, url: seo.value.canonical, description: seo.value.description ?? "" })),
|
|
52
|
+
/** As a shared link shows it. */
|
|
53
|
+
social: computed(() => ({ title: seo.value.title, description: seo.value.description ?? "", image: seo.value.image })),
|
|
54
|
+
robots: computed(() => seo.value.robots),
|
|
55
|
+
checks
|
|
56
|
+
};
|
|
57
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { AdminUser } from '../types.js';
|
|
2
|
+
export declare function useAtelierSession(): {
|
|
3
|
+
user: import("vue").ComputedRef<AdminUser | null>;
|
|
4
|
+
/** True until it's known whether someone is signed in and whether setup is needed. */
|
|
5
|
+
loading: import("vue").ComputedRef<boolean>;
|
|
6
|
+
/** No user exists yet: show first-run setup. */
|
|
7
|
+
setupNeeded: import("vue").ComputedRef<boolean>;
|
|
8
|
+
/** Setup takes the server's setup token (NUXT_ATELIER_AUTH_SETUP_TOKEN). */
|
|
9
|
+
setupToken: import("vue").ComputedRef<boolean>;
|
|
10
|
+
/** Other ways to sign in (the auth adapter's OAuth providers): links that come back to `redirect`. */
|
|
11
|
+
providers: import("vue").ComputedRef<{
|
|
12
|
+
id: string;
|
|
13
|
+
name: string;
|
|
14
|
+
url: string;
|
|
15
|
+
}[]>;
|
|
16
|
+
signIn: import("@tanstack/vue-query").UseMutationReturnType<AdminUser, Error, {
|
|
17
|
+
email: string;
|
|
18
|
+
password: string;
|
|
19
|
+
}, unknown, import("@tanstack/vue-query").MutationResult<AdminUser, Error, {
|
|
20
|
+
email: string;
|
|
21
|
+
password: string;
|
|
22
|
+
}, unknown>>;
|
|
23
|
+
signOut: import("@tanstack/vue-query").UseMutationReturnType<unknown, Error, void, unknown, import("@tanstack/vue-query").MutationResult<unknown, Error, void, unknown>>;
|
|
24
|
+
createAdmin: import("@tanstack/vue-query").UseMutationReturnType<AdminUser, Error, {
|
|
25
|
+
email: string;
|
|
26
|
+
name?: string;
|
|
27
|
+
password: string;
|
|
28
|
+
token?: string;
|
|
29
|
+
}, unknown, import("@tanstack/vue-query").MutationResult<AdminUser, Error, {
|
|
30
|
+
email: string;
|
|
31
|
+
name?: string;
|
|
32
|
+
password: string;
|
|
33
|
+
token?: string;
|
|
34
|
+
}, unknown>>;
|
|
35
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { useMutation, useQuery, useQueryClient } from "@tanstack/vue-query";
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
import { atelierFetch } from "./useAtelierAdmin.js";
|
|
4
|
+
export function useAtelierSession() {
|
|
5
|
+
const client = useQueryClient();
|
|
6
|
+
const me = useQuery({ queryKey: ["atelier", "me"], queryFn: () => atelierFetch("/auth/me") });
|
|
7
|
+
const setup = useQuery({ queryKey: ["atelier", "setup"], queryFn: () => atelierFetch("/setup") });
|
|
8
|
+
const providers = useQuery({ queryKey: ["atelier", "providers"], queryFn: () => atelierFetch("/auth/providers"), staleTime: Infinity });
|
|
9
|
+
const reset = async () => {
|
|
10
|
+
client.removeQueries({ predicate: (q) => !["me", "setup", "providers"].includes(q.queryKey[1]) });
|
|
11
|
+
await client.invalidateQueries({ queryKey: ["atelier"] });
|
|
12
|
+
};
|
|
13
|
+
const signIn = useMutation({
|
|
14
|
+
mutationFn: (credentials) => atelierFetch("/auth/login", { method: "POST", body: credentials }),
|
|
15
|
+
onSuccess: reset
|
|
16
|
+
});
|
|
17
|
+
const signOut = useMutation({ mutationFn: () => atelierFetch("/auth/logout", { method: "POST" }), onSuccess: reset });
|
|
18
|
+
const createAdmin = useMutation({
|
|
19
|
+
mutationFn: (admin) => atelierFetch("/setup", { method: "POST", body: admin }),
|
|
20
|
+
onSuccess: reset
|
|
21
|
+
});
|
|
22
|
+
return {
|
|
23
|
+
user: computed(() => me.data.value?.user ?? null),
|
|
24
|
+
/** True until it's known whether someone is signed in and whether setup is needed. */
|
|
25
|
+
loading: computed(() => me.isPending.value || setup.isPending.value),
|
|
26
|
+
/** No user exists yet: show first-run setup. */
|
|
27
|
+
setupNeeded: computed(() => setup.data.value?.needed ?? false),
|
|
28
|
+
/** Setup takes the server's setup token (NUXT_ATELIER_AUTH_SETUP_TOKEN). */
|
|
29
|
+
setupToken: computed(() => setup.data.value?.token ?? false),
|
|
30
|
+
/** Other ways to sign in (the auth adapter's OAuth providers): links that come back to `redirect`. */
|
|
31
|
+
providers: computed(() => providers.data.value?.providers ?? []),
|
|
32
|
+
signIn,
|
|
33
|
+
signOut,
|
|
34
|
+
createAdmin
|
|
35
|
+
};
|
|
36
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface Setting<T> {
|
|
2
|
+
value: T;
|
|
3
|
+
source: 'database' | 'config';
|
|
4
|
+
config: T;
|
|
5
|
+
}
|
|
6
|
+
export declare function useAtelierSetting<T>(key: string): {
|
|
7
|
+
setting: import("vue").ComputedRef<Setting<T> | undefined>;
|
|
8
|
+
loading: import("vue").Ref<true, true> | import("vue").Ref<false, false>;
|
|
9
|
+
save: import("@tanstack/vue-query").UseMutationReturnType<Setting<T>, Error, T, unknown, import("@tanstack/vue-query").MutationResult<Setting<T>, Error, T, unknown>>;
|
|
10
|
+
reset: import("@tanstack/vue-query").UseMutationReturnType<Setting<T>, Error, void, unknown, import("@tanstack/vue-query").MutationResult<Setting<T>, Error, void, unknown>>;
|
|
11
|
+
};
|