katecms 0.0.0-stage → 1.0.0-beta.1
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/README.md +5 -3
- package/dist/module.d.mts +93 -0
- package/dist/module.json +9 -0
- package/dist/module.mjs +579 -0
- package/dist/runtime/assets/img/katecms-logo.svg +17 -0
- package/dist/runtime/composables/getCollection.d.ts +62 -0
- package/dist/runtime/composables/getCollection.js +167 -0
- package/dist/runtime/composables/getOptions.d.ts +22 -0
- package/dist/runtime/composables/getOptions.js +22 -0
- package/dist/runtime/composables/getQueryCollection.d.ts +95 -0
- package/dist/runtime/composables/getQueryCollection.js +199 -0
- package/dist/runtime/composables/getTerms.d.ts +79 -0
- package/dist/runtime/composables/getTerms.js +148 -0
- package/dist/runtime/composables/useAuth.d.ts +14 -0
- package/dist/runtime/composables/useAuth.js +33 -0
- package/dist/runtime/composables/useAuthCooldown.d.ts +6 -0
- package/dist/runtime/composables/useAuthCooldown.js +44 -0
- package/dist/runtime/composables/useCmsPaths.d.ts +15 -0
- package/dist/runtime/composables/useCmsPaths.js +21 -0
- package/dist/runtime/composables/useKateCmsExtensions.d.ts +49 -0
- package/dist/runtime/composables/useKateCmsExtensions.js +29 -0
- package/dist/runtime/composables/useMediaLibrary.d.ts +84 -0
- package/dist/runtime/composables/useMediaLibrary.js +140 -0
- package/dist/runtime/composables/useMenuAccess.d.ts +8 -0
- package/dist/runtime/composables/useMenuAccess.js +16 -0
- package/dist/runtime/internal/admin/AdminHeader.d.vue.ts +24 -0
- package/dist/runtime/internal/admin/AdminHeader.vue +91 -0
- package/dist/runtime/internal/admin/AdminHeader.vue.d.ts +24 -0
- package/dist/runtime/internal/admin/AppMenu.d.vue.ts +3 -0
- package/dist/runtime/internal/admin/AppMenu.vue +244 -0
- package/dist/runtime/internal/admin/AppMenu.vue.d.ts +3 -0
- package/dist/runtime/internal/admin/AppUser.d.vue.ts +3 -0
- package/dist/runtime/internal/admin/AppUser.vue +227 -0
- package/dist/runtime/internal/admin/AppUser.vue.d.ts +3 -0
- package/dist/runtime/internal/admin/CollectionEntryForm.d.vue.ts +41 -0
- package/dist/runtime/internal/admin/CollectionEntryForm.vue +916 -0
- package/dist/runtime/internal/admin/CollectionEntryForm.vue.d.ts +41 -0
- package/dist/runtime/internal/admin/ConfirmDialog.d.vue.ts +28 -0
- package/dist/runtime/internal/admin/ConfirmDialog.vue +136 -0
- package/dist/runtime/internal/admin/ConfirmDialog.vue.d.ts +28 -0
- package/dist/runtime/internal/admin/DictionaryTermForm.d.vue.ts +33 -0
- package/dist/runtime/internal/admin/DictionaryTermForm.vue +328 -0
- package/dist/runtime/internal/admin/DictionaryTermForm.vue.d.ts +33 -0
- package/dist/runtime/internal/admin/EntryRevisions.d.vue.ts +15 -0
- package/dist/runtime/internal/admin/EntryRevisions.vue +125 -0
- package/dist/runtime/internal/admin/EntryRevisions.vue.d.ts +15 -0
- package/dist/runtime/internal/admin/MediaLibraryFilters.d.vue.ts +16 -0
- package/dist/runtime/internal/admin/MediaLibraryFilters.vue +153 -0
- package/dist/runtime/internal/admin/MediaLibraryFilters.vue.d.ts +16 -0
- package/dist/runtime/internal/admin/MediaLibraryModal.d.vue.ts +65 -0
- package/dist/runtime/internal/admin/MediaLibraryModal.vue +451 -0
- package/dist/runtime/internal/admin/MediaLibraryModal.vue.d.ts +65 -0
- package/dist/runtime/internal/admin/OptionPageForm.d.vue.ts +26 -0
- package/dist/runtime/internal/admin/OptionPageForm.vue +222 -0
- package/dist/runtime/internal/admin/OptionPageForm.vue.d.ts +26 -0
- package/dist/runtime/internal/admin/UserAvatarField.d.vue.ts +12 -0
- package/dist/runtime/internal/admin/UserAvatarField.vue +305 -0
- package/dist/runtime/internal/admin/UserAvatarField.vue.d.ts +12 -0
- package/dist/runtime/internal/fields/AccordionField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/AccordionField.vue +220 -0
- package/dist/runtime/internal/fields/AccordionField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/ButtonGroupField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/ButtonGroupField.vue +109 -0
- package/dist/runtime/internal/fields/ButtonGroupField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/CheckboxField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/CheckboxField.vue +190 -0
- package/dist/runtime/internal/fields/CheckboxField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/ColorPickerField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/ColorPickerField.vue +791 -0
- package/dist/runtime/internal/fields/ColorPickerField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/DatePickerField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/DatePickerField.vue +26 -0
- package/dist/runtime/internal/fields/DatePickerField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/DateTimePickerField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/DateTimePickerField.vue +26 -0
- package/dist/runtime/internal/fields/DateTimePickerField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/DictionaryField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/DictionaryField.vue +345 -0
- package/dist/runtime/internal/fields/DictionaryField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/EmailField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/EmailField.vue +21 -0
- package/dist/runtime/internal/fields/EmailField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/FileField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/FileField.vue +408 -0
- package/dist/runtime/internal/fields/FileField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/FlexibleContentField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/FlexibleContentField.vue +1114 -0
- package/dist/runtime/internal/fields/FlexibleContentField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/GalleryField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/GalleryField.vue +584 -0
- package/dist/runtime/internal/fields/GalleryField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/GroupField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/GroupField.vue +111 -0
- package/dist/runtime/internal/fields/GroupField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/ImageField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/ImageField.vue +638 -0
- package/dist/runtime/internal/fields/ImageField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/ImageSelectField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/ImageSelectField.vue +179 -0
- package/dist/runtime/internal/fields/ImageSelectField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/LinkField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/LinkField.vue +303 -0
- package/dist/runtime/internal/fields/LinkField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/NumberField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/NumberField.vue +25 -0
- package/dist/runtime/internal/fields/NumberField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/OembedField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/OembedField.vue +161 -0
- package/dist/runtime/internal/fields/OembedField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/OpenStreetMapField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/OpenStreetMapField.vue +1502 -0
- package/dist/runtime/internal/fields/OpenStreetMapField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/PageLinkField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/PageLinkField.vue +153 -0
- package/dist/runtime/internal/fields/PageLinkField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/PasswordField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/PasswordField.vue +108 -0
- package/dist/runtime/internal/fields/PasswordField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/PostObjectField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/PostObjectField.vue +151 -0
- package/dist/runtime/internal/fields/PostObjectField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/RadioField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/RadioField.vue +163 -0
- package/dist/runtime/internal/fields/RadioField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/RangeField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/RangeField.vue +48 -0
- package/dist/runtime/internal/fields/RangeField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/RelationshipField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/RelationshipField.vue +525 -0
- package/dist/runtime/internal/fields/RelationshipField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/RepeaterField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/RepeaterField.vue +856 -0
- package/dist/runtime/internal/fields/RepeaterField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/SelectField.d.vue.ts +21 -0
- package/dist/runtime/internal/fields/SelectField.vue +101 -0
- package/dist/runtime/internal/fields/SelectField.vue.d.ts +21 -0
- package/dist/runtime/internal/fields/SeparatorField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/SeparatorField.vue +63 -0
- package/dist/runtime/internal/fields/SeparatorField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/TabField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/TabField.vue +210 -0
- package/dist/runtime/internal/fields/TabField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/TextField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/TextField.vue +22 -0
- package/dist/runtime/internal/fields/TextField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/TextareaField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/TextareaField.vue +62 -0
- package/dist/runtime/internal/fields/TextareaField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/TimePickerField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/TimePickerField.vue +24 -0
- package/dist/runtime/internal/fields/TimePickerField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/TrueFalseField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/TrueFalseField.vue +151 -0
- package/dist/runtime/internal/fields/TrueFalseField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/UrlField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/UrlField.vue +21 -0
- package/dist/runtime/internal/fields/UrlField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/UserField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/UserField.vue +164 -0
- package/dist/runtime/internal/fields/UserField.vue.d.ts +0 -0
- package/dist/runtime/internal/fields/WysiwygField.d.vue.ts +0 -0
- package/dist/runtime/internal/fields/WysiwygField.vue +971 -0
- package/dist/runtime/internal/fields/WysiwygField.vue.d.ts +0 -0
- package/dist/runtime/internal/parts/DateTimeControl.d.vue.ts +90 -0
- package/dist/runtime/internal/parts/DateTimeControl.vue +568 -0
- package/dist/runtime/internal/parts/DateTimeControl.vue.d.ts +90 -0
- package/dist/runtime/internal/parts/FieldAddon.d.vue.ts +0 -0
- package/dist/runtime/internal/parts/FieldAddon.vue +43 -0
- package/dist/runtime/internal/parts/FieldAddon.vue.d.ts +0 -0
- package/dist/runtime/internal/parts/FieldInstructions.d.vue.ts +0 -0
- package/dist/runtime/internal/parts/FieldInstructions.vue +24 -0
- package/dist/runtime/internal/parts/FieldInstructions.vue.d.ts +0 -0
- package/dist/runtime/internal/parts/FieldLabel.d.vue.ts +0 -0
- package/dist/runtime/internal/parts/FieldLabel.vue +40 -0
- package/dist/runtime/internal/parts/FieldLabel.vue.d.ts +0 -0
- package/dist/runtime/internal/parts/FieldWrapper.d.vue.ts +0 -0
- package/dist/runtime/internal/parts/FieldWrapper.vue +47 -0
- package/dist/runtime/internal/parts/FieldWrapper.vue.d.ts +0 -0
- package/dist/runtime/internal/parts/ImageCropper.d.vue.ts +17 -0
- package/dist/runtime/internal/parts/ImageCropper.vue +363 -0
- package/dist/runtime/internal/parts/ImageCropper.vue.d.ts +17 -0
- package/dist/runtime/internal/parts/InputControl.d.vue.ts +0 -0
- package/dist/runtime/internal/parts/InputControl.vue +163 -0
- package/dist/runtime/internal/parts/InputControl.vue.d.ts +0 -0
- package/dist/runtime/internal/ui/UiButton.d.vue.ts +35 -0
- package/dist/runtime/internal/ui/UiButton.vue +204 -0
- package/dist/runtime/internal/ui/UiButton.vue.d.ts +35 -0
- package/dist/runtime/internal/ui/UiNotice.d.vue.ts +40 -0
- package/dist/runtime/internal/ui/UiNotice.vue +253 -0
- package/dist/runtime/internal/ui/UiNotice.vue.d.ts +40 -0
- package/dist/runtime/internal/ui/UiSelect.d.vue.ts +61 -0
- package/dist/runtime/internal/ui/UiSelect.vue +1212 -0
- package/dist/runtime/internal/ui/UiSelect.vue.d.ts +61 -0
- package/dist/runtime/middleware/auth-guard.d.ts +9 -0
- package/dist/runtime/middleware/auth-guard.js +37 -0
- package/dist/runtime/pages/admin/collections/[id].d.vue.ts +3 -0
- package/dist/runtime/pages/admin/collections/[id].vue +423 -0
- package/dist/runtime/pages/admin/collections/[id].vue.d.ts +3 -0
- package/dist/runtime/pages/admin/collections/create.d.vue.ts +3 -0
- package/dist/runtime/pages/admin/collections/create.vue +179 -0
- package/dist/runtime/pages/admin/collections/create.vue.d.ts +3 -0
- package/dist/runtime/pages/admin/collections/index.d.vue.ts +3 -0
- package/dist/runtime/pages/admin/collections/index.vue +828 -0
- package/dist/runtime/pages/admin/collections/index.vue.d.ts +3 -0
- package/dist/runtime/pages/admin/demo-fields.d.vue.ts +3 -0
- package/dist/runtime/pages/admin/demo-fields.vue +1327 -0
- package/dist/runtime/pages/admin/demo-fields.vue.d.ts +3 -0
- package/dist/runtime/pages/admin/dictionaries/[id].d.vue.ts +3 -0
- package/dist/runtime/pages/admin/dictionaries/[id].vue +213 -0
- package/dist/runtime/pages/admin/dictionaries/[id].vue.d.ts +3 -0
- package/dist/runtime/pages/admin/dictionaries/index.d.vue.ts +3 -0
- package/dist/runtime/pages/admin/dictionaries/index.vue +387 -0
- package/dist/runtime/pages/admin/dictionaries/index.vue.d.ts +3 -0
- package/dist/runtime/pages/admin/index.d.vue.ts +3 -0
- package/dist/runtime/pages/admin/index.vue +138 -0
- package/dist/runtime/pages/admin/index.vue.d.ts +3 -0
- package/dist/runtime/pages/admin/login.d.vue.ts +3 -0
- package/dist/runtime/pages/admin/login.vue +373 -0
- package/dist/runtime/pages/admin/login.vue.d.ts +3 -0
- package/dist/runtime/pages/admin/media.d.vue.ts +3 -0
- package/dist/runtime/pages/admin/media.vue +1054 -0
- package/dist/runtime/pages/admin/media.vue.d.ts +3 -0
- package/dist/runtime/pages/admin/options/[page].d.vue.ts +3 -0
- package/dist/runtime/pages/admin/options/[page].vue +151 -0
- package/dist/runtime/pages/admin/options/[page].vue.d.ts +3 -0
- package/dist/runtime/pages/admin/register.d.vue.ts +3 -0
- package/dist/runtime/pages/admin/register.vue +391 -0
- package/dist/runtime/pages/admin/register.vue.d.ts +3 -0
- package/dist/runtime/pages/admin/users/[id].d.vue.ts +3 -0
- package/dist/runtime/pages/admin/users/[id].vue +337 -0
- package/dist/runtime/pages/admin/users/[id].vue.d.ts +3 -0
- package/dist/runtime/pages/admin/users/create.d.vue.ts +3 -0
- package/dist/runtime/pages/admin/users/create.vue +201 -0
- package/dist/runtime/pages/admin/users/create.vue.d.ts +3 -0
- package/dist/runtime/pages/admin/users/index.d.vue.ts +3 -0
- package/dist/runtime/pages/admin/users/index.vue +329 -0
- package/dist/runtime/pages/admin/users/index.vue.d.ts +3 -0
- package/dist/runtime/pages/index.d.vue.ts +3 -0
- package/dist/runtime/pages/index.vue +399 -0
- package/dist/runtime/pages/index.vue.d.ts +3 -0
- package/dist/runtime/server/api/_katecms/auth/login.post.d.ts +5 -0
- package/dist/runtime/server/api/_katecms/auth/login.post.js +44 -0
- package/dist/runtime/server/api/_katecms/auth/logout.post.d.ts +4 -0
- package/dist/runtime/server/api/_katecms/auth/logout.post.js +6 -0
- package/dist/runtime/server/api/_katecms/auth/register.post.d.ts +19 -0
- package/dist/runtime/server/api/_katecms/auth/register.post.js +83 -0
- package/dist/runtime/server/api/_katecms/auth/state.get.d.ts +9 -0
- package/dist/runtime/server/api/_katecms/auth/state.get.js +12 -0
- package/dist/runtime/server/api/_katecms/collections/[collection]/[id].delete.d.ts +15 -0
- package/dist/runtime/server/api/_katecms/collections/[collection]/[id].delete.js +59 -0
- package/dist/runtime/server/api/_katecms/collections/[collection]/[id].get.d.ts +4 -0
- package/dist/runtime/server/api/_katecms/collections/[collection]/[id].get.js +50 -0
- package/dist/runtime/server/api/_katecms/collections/[collection]/[id].patch.d.ts +4 -0
- package/dist/runtime/server/api/_katecms/collections/[collection]/[id].patch.js +130 -0
- package/dist/runtime/server/api/_katecms/collections/[collection]/revisions/[revisionId].post.d.ts +4 -0
- package/dist/runtime/server/api/_katecms/collections/[collection]/revisions/[revisionId].post.js +123 -0
- package/dist/runtime/server/api/_katecms/collections/[collection]/revisions.get.d.ts +6 -0
- package/dist/runtime/server/api/_katecms/collections/[collection]/revisions.get.js +31 -0
- package/dist/runtime/server/api/_katecms/collections/[collection].get.d.ts +8 -0
- package/dist/runtime/server/api/_katecms/collections/[collection].get.js +135 -0
- package/dist/runtime/server/api/_katecms/collections/[collection].post.d.ts +4 -0
- package/dist/runtime/server/api/_katecms/collections/[collection].post.js +91 -0
- package/dist/runtime/server/api/_katecms/dictionaries/[dictionary]/[id].delete.d.ts +7 -0
- package/dist/runtime/server/api/_katecms/dictionaries/[dictionary]/[id].delete.js +31 -0
- package/dist/runtime/server/api/_katecms/dictionaries/[dictionary]/[id].get.d.ts +4 -0
- package/dist/runtime/server/api/_katecms/dictionaries/[dictionary]/[id].get.js +45 -0
- package/dist/runtime/server/api/_katecms/dictionaries/[dictionary]/[id].patch.d.ts +4 -0
- package/dist/runtime/server/api/_katecms/dictionaries/[dictionary]/[id].patch.js +83 -0
- package/dist/runtime/server/api/_katecms/dictionaries/[dictionary].get.d.ts +4 -0
- package/dist/runtime/server/api/_katecms/dictionaries/[dictionary].get.js +38 -0
- package/dist/runtime/server/api/_katecms/dictionaries/[dictionary].post.d.ts +4 -0
- package/dist/runtime/server/api/_katecms/dictionaries/[dictionary].post.js +64 -0
- package/dist/runtime/server/api/_katecms/media/[id]/regenerate.post.d.ts +8 -0
- package/dist/runtime/server/api/_katecms/media/[id]/regenerate.post.js +30 -0
- package/dist/runtime/server/api/_katecms/media/[id].delete.d.ts +7 -0
- package/dist/runtime/server/api/_katecms/media/[id].delete.js +22 -0
- package/dist/runtime/server/api/_katecms/media/[id].get.d.ts +9 -0
- package/dist/runtime/server/api/_katecms/media/[id].get.js +17 -0
- package/dist/runtime/server/api/_katecms/media/[id].patch.d.ts +6 -0
- package/dist/runtime/server/api/_katecms/media/[id].patch.js +48 -0
- package/dist/runtime/server/api/_katecms/media/index.get.d.ts +5 -0
- package/dist/runtime/server/api/_katecms/media/index.get.js +75 -0
- package/dist/runtime/server/api/_katecms/media/index.post.d.ts +9 -0
- package/dist/runtime/server/api/_katecms/media/index.post.js +84 -0
- package/dist/runtime/server/api/_katecms/media/regenerate.post.d.ts +7 -0
- package/dist/runtime/server/api/_katecms/media/regenerate.post.js +30 -0
- package/dist/runtime/server/api/_katecms/menu.get.d.ts +8 -0
- package/dist/runtime/server/api/_katecms/menu.get.js +14 -0
- package/dist/runtime/server/api/_katecms/oembed.get.d.ts +2 -0
- package/dist/runtime/server/api/_katecms/oembed.get.js +53 -0
- package/dist/runtime/server/api/_katecms/options/[page].get.d.ts +7 -0
- package/dist/runtime/server/api/_katecms/options/[page].get.js +28 -0
- package/dist/runtime/server/api/_katecms/options/[page].patch.d.ts +4 -0
- package/dist/runtime/server/api/_katecms/options/[page].patch.js +36 -0
- package/dist/runtime/server/api/_katecms/query.get.d.ts +24 -0
- package/dist/runtime/server/api/_katecms/query.get.js +270 -0
- package/dist/runtime/server/api/_katecms/relation/entries.get.d.ts +17 -0
- package/dist/runtime/server/api/_katecms/relation/entries.get.js +74 -0
- package/dist/runtime/server/api/_katecms/relation/terms.get.d.ts +17 -0
- package/dist/runtime/server/api/_katecms/relation/terms.get.js +51 -0
- package/dist/runtime/server/api/_katecms/resolve.get.d.ts +17 -0
- package/dist/runtime/server/api/_katecms/resolve.get.js +116 -0
- package/dist/runtime/server/api/_katecms/terms.get.d.ts +20 -0
- package/dist/runtime/server/api/_katecms/terms.get.js +201 -0
- package/dist/runtime/server/api/_katecms/users/[id].delete.d.ts +11 -0
- package/dist/runtime/server/api/_katecms/users/[id].delete.js +45 -0
- package/dist/runtime/server/api/_katecms/users/[id].patch.d.ts +19 -0
- package/dist/runtime/server/api/_katecms/users/[id].patch.js +129 -0
- package/dist/runtime/server/api/_katecms/users.get.d.ts +10 -0
- package/dist/runtime/server/api/_katecms/users.get.js +34 -0
- package/dist/runtime/server/api/_katecms/users.post.d.ts +10 -0
- package/dist/runtime/server/api/_katecms/users.post.js +62 -0
- package/dist/runtime/server/api/uploads/[...key].get.d.ts +3 -0
- package/dist/runtime/server/api/uploads/[...key].get.js +28 -0
- package/dist/runtime/server/kit.d.ts +5 -0
- package/dist/runtime/server/kit.js +5 -0
- package/dist/runtime/server/middleware/admin-headers.d.ts +3 -0
- package/dist/runtime/server/middleware/admin-headers.js +12 -0
- package/dist/runtime/server/plugins/auto-migrate.d.ts +2 -0
- package/dist/runtime/server/plugins/auto-migrate.js +45 -0
- package/dist/runtime/server/tsconfig.json +3 -0
- package/dist/runtime/server/utils/auth-attempts.d.ts +22 -0
- package/dist/runtime/server/utils/auth-attempts.js +42 -0
- package/dist/runtime/server/utils/auth-rate-limit.d.ts +11 -0
- package/dist/runtime/server/utils/auth-rate-limit.js +36 -0
- package/dist/runtime/server/utils/client-address.d.ts +16 -0
- package/dist/runtime/server/utils/client-address.js +23 -0
- package/dist/runtime/server/utils/collections.d.ts +42 -0
- package/dist/runtime/server/utils/collections.js +300 -0
- package/dist/runtime/server/utils/db.d.ts +3 -0
- package/dist/runtime/server/utils/db.js +25 -0
- package/dist/runtime/server/utils/dictionaries.d.ts +53 -0
- package/dist/runtime/server/utils/dictionaries.js +301 -0
- package/dist/runtime/server/utils/media-list.d.ts +18 -0
- package/dist/runtime/server/utils/media-list.js +84 -0
- package/dist/runtime/server/utils/media.d.ts +12 -0
- package/dist/runtime/server/utils/media.js +77 -0
- package/dist/runtime/server/utils/oembed-fetch.d.ts +4 -0
- package/dist/runtime/server/utils/oembed-fetch.js +142 -0
- package/dist/runtime/server/utils/options.d.ts +17 -0
- package/dist/runtime/server/utils/options.js +66 -0
- package/dist/runtime/server/utils/permissions.d.ts +13 -0
- package/dist/runtime/server/utils/permissions.js +20 -0
- package/dist/runtime/server/utils/public-fields-query.d.ts +6 -0
- package/dist/runtime/server/utils/public-fields-query.js +8 -0
- package/dist/runtime/server/utils/public-term.d.ts +8 -0
- package/dist/runtime/server/utils/public-term.js +80 -0
- package/dist/runtime/server/utils/regenerate.d.ts +12 -0
- package/dist/runtime/server/utils/regenerate.js +40 -0
- package/dist/runtime/server/utils/relation.d.ts +18 -0
- package/dist/runtime/server/utils/relation.js +77 -0
- package/dist/runtime/server/utils/request-address.d.ts +6 -0
- package/dist/runtime/server/utils/request-address.js +10 -0
- package/dist/runtime/server/utils/revisions.d.ts +20 -0
- package/dist/runtime/server/utils/revisions.js +172 -0
- package/dist/runtime/server/utils/session.d.ts +18 -0
- package/dist/runtime/server/utils/session.js +71 -0
- package/dist/runtime/server/utils/upload-headers.d.ts +2 -0
- package/dist/runtime/server/utils/upload-headers.js +30 -0
- package/dist/runtime/server/utils/users.d.ts +13 -0
- package/dist/runtime/server/utils/users.js +47 -0
- package/dist/runtime/utils/admin-users.d.ts +20 -0
- package/dist/runtime/utils/admin-users.js +19 -0
- package/dist/runtime/utils/auth-error.d.ts +6 -0
- package/dist/runtime/utils/auth-error.js +11 -0
- package/dist/runtime/utils/cms-paths.d.ts +5 -0
- package/dist/runtime/utils/cms-paths.js +13 -0
- package/dist/runtime/utils/collections.d.ts +176 -0
- package/dist/runtime/utils/collections.js +30 -0
- package/dist/runtime/utils/dictionaries.d.ts +65 -0
- package/dist/runtime/utils/dictionaries.js +14 -0
- package/dist/runtime/utils/field-errors.d.ts +4 -0
- package/dist/runtime/utils/field-errors.js +9 -0
- package/dist/runtime/utils/field-values.d.ts +19 -0
- package/dist/runtime/utils/field-values.js +82 -0
- package/dist/runtime/utils/helpers.d.ts +4 -0
- package/dist/runtime/utils/helpers.js +20 -0
- package/dist/runtime/utils/media-library-query.d.ts +54 -0
- package/dist/runtime/utils/media-library-query.js +190 -0
- package/dist/runtime/utils/options.d.ts +19 -0
- package/dist/runtime/utils/options.js +3 -0
- package/dist/runtime/utils/preview.d.ts +22 -0
- package/dist/runtime/utils/preview.js +33 -0
- package/dist/runtime/utils/relation.d.ts +33 -0
- package/dist/runtime/utils/relation.js +23 -0
- package/dist/runtime/utils/slugify.d.ts +2 -0
- package/dist/runtime/utils/slugify.js +4 -0
- package/dist/types.d.mts +7 -0
- package/package.json +84 -3
- package/src/admin-components.ts +124 -0
- package/src/module.ts +592 -0
- package/src/runtime/assets/img/katecms-logo.svg +17 -0
- package/src/runtime/assets/styles/_functions.scss +70 -0
- package/src/runtime/assets/styles/_index.scss +3 -0
- package/src/runtime/assets/styles/_mixins.scss +256 -0
- package/src/runtime/assets/styles/_variables.scss +35 -0
- package/src/runtime/composables/getCollection.ts +253 -0
- package/src/runtime/composables/getOptions.ts +42 -0
- package/src/runtime/composables/getQueryCollection.ts +325 -0
- package/src/runtime/composables/getTerms.ts +231 -0
- package/src/runtime/composables/useAuth.ts +43 -0
- package/src/runtime/composables/useAuthCooldown.ts +52 -0
- package/src/runtime/composables/useCmsPaths.ts +24 -0
- package/src/runtime/composables/useKateCmsExtensions.ts +81 -0
- package/src/runtime/composables/useMediaLibrary.ts +168 -0
- package/src/runtime/composables/useMenuAccess.ts +25 -0
- package/src/runtime/internal/admin/AdminHeader.vue +106 -0
- package/src/runtime/internal/admin/AppMenu.vue +290 -0
- package/src/runtime/internal/admin/AppUser.vue +260 -0
- package/src/runtime/internal/admin/CollectionEntryForm.vue +1044 -0
- package/src/runtime/internal/admin/ConfirmDialog.vue +164 -0
- package/src/runtime/internal/admin/DictionaryTermForm.vue +400 -0
- package/src/runtime/internal/admin/EntryRevisions.vue +145 -0
- package/src/runtime/internal/admin/MediaLibraryFilters.vue +186 -0
- package/src/runtime/internal/admin/MediaLibraryModal.vue +526 -0
- package/src/runtime/internal/admin/OptionPageForm.vue +277 -0
- package/src/runtime/internal/admin/UserAvatarField.vue +337 -0
- package/src/runtime/internal/fields/AccordionField.vue +258 -0
- package/src/runtime/internal/fields/ButtonGroupField.vue +144 -0
- package/src/runtime/internal/fields/CheckboxField.vue +228 -0
- package/src/runtime/internal/fields/ColorPickerField.vue +926 -0
- package/src/runtime/internal/fields/DatePickerField.vue +33 -0
- package/src/runtime/internal/fields/DateTimePickerField.vue +33 -0
- package/src/runtime/internal/fields/DictionaryField.vue +403 -0
- package/src/runtime/internal/fields/EmailField.vue +28 -0
- package/src/runtime/internal/fields/FileField.vue +480 -0
- package/src/runtime/internal/fields/FlexibleContentField.vue +1296 -0
- package/src/runtime/internal/fields/GalleryField.vue +677 -0
- package/src/runtime/internal/fields/GroupField.vue +136 -0
- package/src/runtime/internal/fields/ImageField.vue +730 -0
- package/src/runtime/internal/fields/ImageSelectField.vue +213 -0
- package/src/runtime/internal/fields/LinkField.vue +338 -0
- package/src/runtime/internal/fields/NumberField.vue +32 -0
- package/src/runtime/internal/fields/OembedField.vue +187 -0
- package/src/runtime/internal/fields/OpenStreetMapField.vue +1716 -0
- package/src/runtime/internal/fields/PageLinkField.vue +186 -0
- package/src/runtime/internal/fields/PasswordField.vue +127 -0
- package/src/runtime/internal/fields/PostObjectField.vue +187 -0
- package/src/runtime/internal/fields/RadioField.vue +195 -0
- package/src/runtime/internal/fields/RangeField.vue +62 -0
- package/src/runtime/internal/fields/RelationshipField.vue +604 -0
- package/src/runtime/internal/fields/RepeaterField.vue +999 -0
- package/src/runtime/internal/fields/SelectField.vue +118 -0
- package/src/runtime/internal/fields/SeparatorField.vue +77 -0
- package/src/runtime/internal/fields/TabField.vue +249 -0
- package/src/runtime/internal/fields/TextField.vue +29 -0
- package/src/runtime/internal/fields/TextareaField.vue +61 -0
- package/src/runtime/internal/fields/TimePickerField.vue +31 -0
- package/src/runtime/internal/fields/TrueFalseField.vue +181 -0
- package/src/runtime/internal/fields/UrlField.vue +28 -0
- package/src/runtime/internal/fields/UserField.vue +203 -0
- package/src/runtime/internal/fields/WysiwygField.vue +1061 -0
- package/src/runtime/internal/parts/DateTimeControl.vue +657 -0
- package/src/runtime/internal/parts/FieldAddon.vue +60 -0
- package/src/runtime/internal/parts/FieldInstructions.vue +38 -0
- package/src/runtime/internal/parts/FieldLabel.vue +56 -0
- package/src/runtime/internal/parts/FieldWrapper.vue +63 -0
- package/src/runtime/internal/parts/ImageCropper.vue +415 -0
- package/src/runtime/internal/parts/InputControl.vue +189 -0
- package/src/runtime/internal/ui/UiButton.vue +274 -0
- package/src/runtime/internal/ui/UiNotice.vue +302 -0
- package/src/runtime/internal/ui/UiSelect.vue +1420 -0
- package/src/runtime/middleware/auth-guard.ts +52 -0
- package/src/runtime/pages/admin/collections/[id].vue +486 -0
- package/src/runtime/pages/admin/collections/create.vue +208 -0
- package/src/runtime/pages/admin/collections/index.vue +955 -0
- package/src/runtime/pages/admin/demo-fields.vue +1354 -0
- package/src/runtime/pages/admin/dictionaries/[id].vue +246 -0
- package/src/runtime/pages/admin/dictionaries/index.vue +438 -0
- package/src/runtime/pages/admin/index.vue +155 -0
- package/src/runtime/pages/admin/login.vue +159 -0
- package/src/runtime/pages/admin/media.vue +1176 -0
- package/src/runtime/pages/admin/options/[page].vue +174 -0
- package/src/runtime/pages/admin/register.vue +179 -0
- package/src/runtime/pages/admin/users/[id].vue +382 -0
- package/src/runtime/pages/admin/users/create.vue +232 -0
- package/src/runtime/pages/admin/users/index.vue +374 -0
- package/src/runtime/pages/index.vue +265 -0
- package/src/runtime/server/api/_katecms/auth/login.post.ts +62 -0
- package/src/runtime/server/api/_katecms/auth/logout.post.ts +7 -0
- package/src/runtime/server/api/_katecms/auth/register.post.ts +112 -0
- package/src/runtime/server/api/_katecms/auth/state.get.ts +19 -0
- package/src/runtime/server/api/_katecms/collections/[collection]/[id].delete.ts +77 -0
- package/src/runtime/server/api/_katecms/collections/[collection]/[id].get.ts +57 -0
- package/src/runtime/server/api/_katecms/collections/[collection]/[id].patch.ts +157 -0
- package/src/runtime/server/api/_katecms/collections/[collection]/revisions/[revisionId].post.ts +133 -0
- package/src/runtime/server/api/_katecms/collections/[collection]/revisions.get.ts +35 -0
- package/src/runtime/server/api/_katecms/collections/[collection].get.ts +177 -0
- package/src/runtime/server/api/_katecms/collections/[collection].post.ts +111 -0
- package/src/runtime/server/api/_katecms/dictionaries/[dictionary]/[id].delete.ts +37 -0
- package/src/runtime/server/api/_katecms/dictionaries/[dictionary]/[id].get.ts +51 -0
- package/src/runtime/server/api/_katecms/dictionaries/[dictionary]/[id].patch.ts +101 -0
- package/src/runtime/server/api/_katecms/dictionaries/[dictionary].get.ts +43 -0
- package/src/runtime/server/api/_katecms/dictionaries/[dictionary].post.ts +78 -0
- package/src/runtime/server/api/_katecms/media/[id]/regenerate.post.ts +39 -0
- package/src/runtime/server/api/_katecms/media/[id].delete.ts +28 -0
- package/src/runtime/server/api/_katecms/media/[id].get.ts +25 -0
- package/src/runtime/server/api/_katecms/media/[id].patch.ts +60 -0
- package/src/runtime/server/api/_katecms/media/index.get.ts +96 -0
- package/src/runtime/server/api/_katecms/media/index.post.ts +104 -0
- package/src/runtime/server/api/_katecms/media/regenerate.post.ts +38 -0
- package/src/runtime/server/api/_katecms/menu.get.ts +19 -0
- package/src/runtime/server/api/_katecms/oembed.get.ts +62 -0
- package/src/runtime/server/api/_katecms/options/[page].get.ts +35 -0
- package/src/runtime/server/api/_katecms/options/[page].patch.ts +46 -0
- package/src/runtime/server/api/_katecms/query.get.ts +332 -0
- package/src/runtime/server/api/_katecms/relation/entries.get.ts +98 -0
- package/src/runtime/server/api/_katecms/relation/terms.get.ts +61 -0
- package/src/runtime/server/api/_katecms/resolve.get.ts +148 -0
- package/src/runtime/server/api/_katecms/terms.get.ts +258 -0
- package/src/runtime/server/api/_katecms/users/[id].delete.ts +57 -0
- package/src/runtime/server/api/_katecms/users/[id].patch.ts +177 -0
- package/src/runtime/server/api/_katecms/users.get.ts +48 -0
- package/src/runtime/server/api/_katecms/users.post.ts +85 -0
- package/src/runtime/server/api/uploads/[...key].get.ts +33 -0
- package/src/runtime/server/kit.ts +5 -0
- package/src/runtime/server/middleware/admin-headers.ts +14 -0
- package/src/runtime/server/plugins/auto-migrate.ts +53 -0
- package/src/runtime/server/tsconfig.json +3 -0
- package/src/runtime/server/utils/auth-attempts.ts +71 -0
- package/src/runtime/server/utils/auth-rate-limit.ts +48 -0
- package/src/runtime/server/utils/client-address.ts +41 -0
- package/src/runtime/server/utils/collections.ts +381 -0
- package/src/runtime/server/utils/db.ts +36 -0
- package/src/runtime/server/utils/dictionaries.ts +397 -0
- package/src/runtime/server/utils/media-list.ts +131 -0
- package/src/runtime/server/utils/media.ts +94 -0
- package/src/runtime/server/utils/oembed-fetch.ts +157 -0
- package/src/runtime/server/utils/options.ts +86 -0
- package/src/runtime/server/utils/permissions.ts +44 -0
- package/src/runtime/server/utils/public-fields-query.ts +14 -0
- package/src/runtime/server/utils/public-term.ts +98 -0
- package/src/runtime/server/utils/regenerate.ts +56 -0
- package/src/runtime/server/utils/relation.ts +96 -0
- package/src/runtime/server/utils/request-address.ts +16 -0
- package/src/runtime/server/utils/revisions.ts +256 -0
- package/src/runtime/server/utils/session.ts +112 -0
- package/src/runtime/server/utils/upload-headers.ts +35 -0
- package/src/runtime/server/utils/users.ts +67 -0
- package/src/runtime/utils/admin-users.ts +43 -0
- package/src/runtime/utils/auth-error.ts +22 -0
- package/src/runtime/utils/cms-paths.ts +17 -0
- package/src/runtime/utils/collections.ts +228 -0
- package/src/runtime/utils/dictionaries.ts +89 -0
- package/src/runtime/utils/field-errors.ts +12 -0
- package/src/runtime/utils/field-values.ts +101 -0
- package/src/runtime/utils/helpers.ts +33 -0
- package/src/runtime/utils/media-library-query.ts +263 -0
- package/src/runtime/utils/options.ts +25 -0
- package/src/runtime/utils/preview.ts +56 -0
- package/src/runtime/utils/relation.ts +60 -0
- package/src/runtime/utils/slugify.ts +10 -0
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { computed } from "vue";
|
|
2
|
+
import { useAsyncData, useRequestFetch } from "#imports";
|
|
3
|
+
function asList(value) {
|
|
4
|
+
if (value == null) {
|
|
5
|
+
return [];
|
|
6
|
+
}
|
|
7
|
+
const raw = Array.isArray(value) ? value : [value];
|
|
8
|
+
return [...new Set(raw.map((item) => String(item).trim()).filter(Boolean))];
|
|
9
|
+
}
|
|
10
|
+
function csv(value) {
|
|
11
|
+
const list = asList(value);
|
|
12
|
+
return list.length > 0 ? list.join(",") : void 0;
|
|
13
|
+
}
|
|
14
|
+
function flag(value) {
|
|
15
|
+
if (value === void 0) {
|
|
16
|
+
return void 0;
|
|
17
|
+
}
|
|
18
|
+
return value ? "1" : "0";
|
|
19
|
+
}
|
|
20
|
+
export async function getTerms(options) {
|
|
21
|
+
const dictionary = computed(() => asList(options.dictionary).join(","));
|
|
22
|
+
const perPage = computed(() => options.perPage);
|
|
23
|
+
const offset = computed(() => options.offset);
|
|
24
|
+
const includeIds = computed(() => csv(options.includeIds));
|
|
25
|
+
const excludeIds = computed(() => csv(options.excludeIds));
|
|
26
|
+
const excludeTreeIds = computed(() => csv(options.excludeTreeIds));
|
|
27
|
+
const parentId = computed(() => {
|
|
28
|
+
if (options.parentId === void 0) {
|
|
29
|
+
return void 0;
|
|
30
|
+
}
|
|
31
|
+
if (options.parentId == null || options.parentId === 0) {
|
|
32
|
+
return "0";
|
|
33
|
+
}
|
|
34
|
+
return String(options.parentId);
|
|
35
|
+
});
|
|
36
|
+
const childOf = computed(() => options.childOf != null && options.childOf > 0 ? String(options.childOf) : void 0);
|
|
37
|
+
const childless = computed(() => flag(options.childless));
|
|
38
|
+
const slug = computed(() => csv(options.slug));
|
|
39
|
+
const title = computed(() => csv(options.title));
|
|
40
|
+
const search = computed(() => options.search);
|
|
41
|
+
const hideEmpty = computed(() => flag(options.hideEmpty));
|
|
42
|
+
const hierarchical = computed(() => flag(options.hierarchical));
|
|
43
|
+
const padCounts = computed(() => flag(options.padCounts));
|
|
44
|
+
const fieldsQuery = computed(() => options.fieldsQuery ? JSON.stringify(options.fieldsQuery) : void 0);
|
|
45
|
+
const orderBy = computed(() => options.orderBy);
|
|
46
|
+
const orderByField = computed(() => options.orderByField ? JSON.stringify(options.orderByField) : void 0);
|
|
47
|
+
const order = computed(() => options.order);
|
|
48
|
+
const returnMode = computed(() => options.return);
|
|
49
|
+
const includeIdsSet = computed(() => options.includeIds !== void 0);
|
|
50
|
+
const excludeIdsSet = computed(() => options.excludeIds !== void 0);
|
|
51
|
+
const excludeTreeIdsSet = computed(() => options.excludeTreeIds !== void 0);
|
|
52
|
+
const slugSet = computed(() => options.slug !== void 0);
|
|
53
|
+
const titleSet = computed(() => options.title !== void 0);
|
|
54
|
+
const requestFetch = useRequestFetch();
|
|
55
|
+
const { data, pending, error, refresh } = await useAsyncData(
|
|
56
|
+
[
|
|
57
|
+
"katecms-terms",
|
|
58
|
+
dictionary.value,
|
|
59
|
+
perPage.value ?? "",
|
|
60
|
+
offset.value ?? "",
|
|
61
|
+
includeIdsSet.value ? includeIds.value ?? "" : "-",
|
|
62
|
+
excludeIdsSet.value ? excludeIds.value ?? "" : "-",
|
|
63
|
+
excludeTreeIdsSet.value ? excludeTreeIds.value ?? "" : "-",
|
|
64
|
+
parentId.value ?? "-",
|
|
65
|
+
childOf.value ?? "",
|
|
66
|
+
childless.value ?? "",
|
|
67
|
+
slugSet.value ? slug.value ?? "" : "-",
|
|
68
|
+
titleSet.value ? title.value ?? "" : "-",
|
|
69
|
+
search.value ?? "",
|
|
70
|
+
hideEmpty.value ?? "",
|
|
71
|
+
hierarchical.value ?? "",
|
|
72
|
+
padCounts.value ?? "",
|
|
73
|
+
fieldsQuery.value ?? "",
|
|
74
|
+
orderBy.value ?? "",
|
|
75
|
+
orderByField.value ?? "",
|
|
76
|
+
order.value ?? "",
|
|
77
|
+
returnMode.value ?? ""
|
|
78
|
+
].join(":"),
|
|
79
|
+
() => requestFetch("/api/_katecms/terms", {
|
|
80
|
+
query: {
|
|
81
|
+
dictionary: dictionary.value,
|
|
82
|
+
...perPage.value != null ? { perPage: perPage.value } : {},
|
|
83
|
+
...offset.value != null ? { offset: offset.value } : {},
|
|
84
|
+
...includeIdsSet.value ? { includeIds: includeIds.value ?? "" } : {},
|
|
85
|
+
...excludeIdsSet.value ? { excludeIds: excludeIds.value ?? "" } : {},
|
|
86
|
+
...excludeTreeIdsSet.value ? { excludeTreeIds: excludeTreeIds.value ?? "" } : {},
|
|
87
|
+
...parentId.value != null ? { parentId: parentId.value } : {},
|
|
88
|
+
...childOf.value ? { childOf: childOf.value } : {},
|
|
89
|
+
...childless.value != null ? { childless: childless.value } : {},
|
|
90
|
+
...slugSet.value ? { slug: slug.value ?? "" } : {},
|
|
91
|
+
...titleSet.value ? { title: title.value ?? "" } : {},
|
|
92
|
+
...search.value ? { search: search.value } : {},
|
|
93
|
+
...hideEmpty.value != null ? { hideEmpty: hideEmpty.value } : {},
|
|
94
|
+
...hierarchical.value != null ? { hierarchical: hierarchical.value } : {},
|
|
95
|
+
...padCounts.value != null ? { padCounts: padCounts.value } : {},
|
|
96
|
+
...fieldsQuery.value ? { fieldsQuery: fieldsQuery.value } : {},
|
|
97
|
+
...orderBy.value ? { orderBy: orderBy.value } : {},
|
|
98
|
+
...orderByField.value ? { orderByField: orderByField.value } : {},
|
|
99
|
+
...order.value ? { order: order.value } : {},
|
|
100
|
+
...returnMode.value ? { return: returnMode.value } : {}
|
|
101
|
+
}
|
|
102
|
+
}),
|
|
103
|
+
{
|
|
104
|
+
watch: [
|
|
105
|
+
dictionary,
|
|
106
|
+
perPage,
|
|
107
|
+
offset,
|
|
108
|
+
includeIds,
|
|
109
|
+
includeIdsSet,
|
|
110
|
+
excludeIds,
|
|
111
|
+
excludeIdsSet,
|
|
112
|
+
excludeTreeIds,
|
|
113
|
+
excludeTreeIdsSet,
|
|
114
|
+
parentId,
|
|
115
|
+
childOf,
|
|
116
|
+
childless,
|
|
117
|
+
slug,
|
|
118
|
+
slugSet,
|
|
119
|
+
title,
|
|
120
|
+
titleSet,
|
|
121
|
+
search,
|
|
122
|
+
hideEmpty,
|
|
123
|
+
hierarchical,
|
|
124
|
+
padCounts,
|
|
125
|
+
fieldsQuery,
|
|
126
|
+
orderBy,
|
|
127
|
+
orderByField,
|
|
128
|
+
order,
|
|
129
|
+
returnMode
|
|
130
|
+
]
|
|
131
|
+
}
|
|
132
|
+
);
|
|
133
|
+
const terms = computed(() => data.value?.terms ?? []);
|
|
134
|
+
const ids = computed(() => data.value?.ids ?? []);
|
|
135
|
+
const titles = computed(() => data.value?.titles ?? []);
|
|
136
|
+
const map = computed(() => data.value?.map ?? {});
|
|
137
|
+
const total = computed(() => data.value?.total ?? 0);
|
|
138
|
+
return {
|
|
139
|
+
terms,
|
|
140
|
+
ids,
|
|
141
|
+
titles,
|
|
142
|
+
map,
|
|
143
|
+
total,
|
|
144
|
+
pending,
|
|
145
|
+
error,
|
|
146
|
+
refresh
|
|
147
|
+
};
|
|
148
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { AuthState, SafeUser } from '@katecms/core';
|
|
2
|
+
/**
|
|
3
|
+
* Shared auth snapshot for admin UI (header profile, logout, etc.).
|
|
4
|
+
* Uses a stable fetch key so multiple consumers share one request.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useAuth(): {
|
|
7
|
+
user: import("vue").ComputedRef<SafeUser | null>;
|
|
8
|
+
authState: import("vue").Ref<AuthState | undefined, AuthState | undefined>;
|
|
9
|
+
refresh: (opts?: import("nuxt/app").AsyncDataExecuteOptions) => Promise<void>;
|
|
10
|
+
pending: import("vue").Ref<boolean, boolean>;
|
|
11
|
+
error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined, import("nuxt/app").NuxtError<unknown> | undefined>;
|
|
12
|
+
loggingOut: import("vue").Ref<boolean, boolean>;
|
|
13
|
+
logout: () => Promise<void>;
|
|
14
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { computed, ref } from "vue";
|
|
2
|
+
import { $fetch, navigateTo, useFetch } from "#imports";
|
|
3
|
+
import { useCmsPaths } from "./useCmsPaths.js";
|
|
4
|
+
export function useAuth() {
|
|
5
|
+
const paths = useCmsPaths();
|
|
6
|
+
const { data, refresh, pending, error, clear } = useFetch("/api/_katecms/auth/state", {
|
|
7
|
+
key: "katecms-auth-state"
|
|
8
|
+
});
|
|
9
|
+
const user = computed(() => data.value?.user ?? null);
|
|
10
|
+
const loggingOut = ref(false);
|
|
11
|
+
async function logout() {
|
|
12
|
+
if (loggingOut.value) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
loggingOut.value = true;
|
|
16
|
+
try {
|
|
17
|
+
await $fetch("/api/_katecms/auth/logout", { method: "POST" });
|
|
18
|
+
clear();
|
|
19
|
+
await navigateTo(paths.login);
|
|
20
|
+
} finally {
|
|
21
|
+
loggingOut.value = false;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
user,
|
|
26
|
+
authState: data,
|
|
27
|
+
refresh,
|
|
28
|
+
pending,
|
|
29
|
+
error,
|
|
30
|
+
loggingOut,
|
|
31
|
+
logout
|
|
32
|
+
};
|
|
33
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Client-side wait after the server reports `retryAfterMs` on a failed auth attempt. */
|
|
2
|
+
export declare function useAuthCooldown(): {
|
|
3
|
+
remainingSec: import("vue").ComputedRef<number>;
|
|
4
|
+
locked: import("vue").ComputedRef<boolean>;
|
|
5
|
+
start: (retryAfterMs: number, unlock?: () => void) => void;
|
|
6
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { computed, onUnmounted, ref } from "vue";
|
|
2
|
+
export function useAuthCooldown() {
|
|
3
|
+
const cooldownUntil = ref(0);
|
|
4
|
+
const now = ref(Date.now());
|
|
5
|
+
let timer;
|
|
6
|
+
let onUnlock;
|
|
7
|
+
const remainingMs = computed(() => Math.max(0, cooldownUntil.value - now.value));
|
|
8
|
+
const remainingSec = computed(() => Math.ceil(remainingMs.value / 1e3));
|
|
9
|
+
const locked = computed(() => remainingMs.value > 0);
|
|
10
|
+
function finish() {
|
|
11
|
+
if (!timer) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
clearInterval(timer);
|
|
15
|
+
timer = void 0;
|
|
16
|
+
const done = onUnlock;
|
|
17
|
+
onUnlock = void 0;
|
|
18
|
+
done?.();
|
|
19
|
+
}
|
|
20
|
+
function tick() {
|
|
21
|
+
now.value = Date.now();
|
|
22
|
+
if (remainingMs.value <= 0) {
|
|
23
|
+
finish();
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function start(retryAfterMs, unlock) {
|
|
27
|
+
if (retryAfterMs <= 0) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
onUnlock = unlock;
|
|
31
|
+
cooldownUntil.value = Date.now() + retryAfterMs;
|
|
32
|
+
now.value = Date.now();
|
|
33
|
+
if (!timer) {
|
|
34
|
+
timer = setInterval(tick, 250);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
onUnmounted(() => {
|
|
38
|
+
if (timer) {
|
|
39
|
+
clearInterval(timer);
|
|
40
|
+
timer = void 0;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
return { remainingSec, locked, start };
|
|
44
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare function useCmsPaths(): {
|
|
2
|
+
admin: string;
|
|
3
|
+
media: string;
|
|
4
|
+
users: string;
|
|
5
|
+
user: (id: number | string) => string;
|
|
6
|
+
demoFields: string;
|
|
7
|
+
collection: (slug: string) => string;
|
|
8
|
+
collectionCreate: (slug: string) => string;
|
|
9
|
+
collectionEntry: (slug: string, id: number | string) => string;
|
|
10
|
+
dictionary: (slug: string) => string;
|
|
11
|
+
dictionaryTerm: (slug: string, id: number | string) => string;
|
|
12
|
+
option: (slug: string) => string;
|
|
13
|
+
login: string;
|
|
14
|
+
register: string;
|
|
15
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useRuntimeConfig } from "#imports";
|
|
2
|
+
import { cmsAdminChildPath, cmsRoutePath } from "../utils/cms-paths.js";
|
|
3
|
+
export function useCmsPaths() {
|
|
4
|
+
const config = useRuntimeConfig().public.katecms;
|
|
5
|
+
const admin = cmsRoutePath(config?.adminPath || "admin");
|
|
6
|
+
return {
|
|
7
|
+
admin,
|
|
8
|
+
media: `${admin}/media`,
|
|
9
|
+
users: `${admin}/users`,
|
|
10
|
+
user: (id) => `${admin}/users/${id}`,
|
|
11
|
+
demoFields: `${admin}/demo-fields`,
|
|
12
|
+
collection: (slug) => `${admin}/collections/${encodeURIComponent(slug)}`,
|
|
13
|
+
collectionCreate: (slug) => `${admin}/collections/${encodeURIComponent(slug)}/create`,
|
|
14
|
+
collectionEntry: (slug, id) => `${admin}/collections/${encodeURIComponent(slug)}/${id}`,
|
|
15
|
+
dictionary: (slug) => `${admin}/dictionaries/${encodeURIComponent(slug)}`,
|
|
16
|
+
dictionaryTerm: (slug, id) => `${admin}/dictionaries/${encodeURIComponent(slug)}/${id}`,
|
|
17
|
+
option: (slug) => `${admin}/options/${encodeURIComponent(slug)}`,
|
|
18
|
+
login: cmsAdminChildPath(config?.adminPath || "admin", config?.loginPath || "login"),
|
|
19
|
+
register: cmsAdminChildPath(config?.adminPath || "admin", config?.registerPath || "register")
|
|
20
|
+
};
|
|
21
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { ComputedRef } from 'vue';
|
|
2
|
+
import type { AdminCollectionMeta, AdminEntry, PublicDictionaryTerm } from '../utils/collections.js';
|
|
3
|
+
/** Nuxt hook fired by `getCollection()` for the current route. */
|
|
4
|
+
export declare const MIRAICMS_COLLECTION_HOOK: "katecms:collection";
|
|
5
|
+
/** Page resolved by `getCollection()` for the current route. */
|
|
6
|
+
export interface KateCmsPublicPage {
|
|
7
|
+
isArchive: ComputedRef<boolean>;
|
|
8
|
+
isTerm: ComputedRef<boolean>;
|
|
9
|
+
entry: ComputedRef<AdminEntry | null>;
|
|
10
|
+
term: ComputedRef<PublicDictionaryTerm | null>;
|
|
11
|
+
collection: ComputedRef<AdminCollectionMeta | null>;
|
|
12
|
+
link: ComputedRef<string | null>;
|
|
13
|
+
}
|
|
14
|
+
declare module '#app' {
|
|
15
|
+
interface RuntimeNuxtHooks {
|
|
16
|
+
'katecms:collection': (page: KateCmsPublicPage) => void;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
/** Extra admin menu items, registered by addons. */
|
|
20
|
+
export interface KateCmsMenuExtra {
|
|
21
|
+
key: string;
|
|
22
|
+
label: string;
|
|
23
|
+
to: string;
|
|
24
|
+
/** Inline SVG markup, same shape as the built-in menu icons. */
|
|
25
|
+
icon?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Resource the user must be allowed to read (`GET /api/_katecms/menu`).
|
|
28
|
+
* Omit to show the item to everyone who can open the admin.
|
|
29
|
+
*/
|
|
30
|
+
access?: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Addon tab in the collection entry sidebar.
|
|
34
|
+
* The form supplies the "Page" tab. `key: "page"` is reserved for that tab.
|
|
35
|
+
*/
|
|
36
|
+
export interface KateCmsEntrySidebarTab {
|
|
37
|
+
key: string;
|
|
38
|
+
label: string;
|
|
39
|
+
/** Component name already registered on the Vue app. */
|
|
40
|
+
component: string;
|
|
41
|
+
}
|
|
42
|
+
export declare function useKateCmsEntrySidebar(): import("vue").Ref<KateCmsEntrySidebarTab[], KateCmsEntrySidebarTab[]>;
|
|
43
|
+
/** Register or replace one collection-entry sidebar tab. Addons call this from a plugin. */
|
|
44
|
+
export declare function registerKateCmsEntrySidebarTab(tab: KateCmsEntrySidebarTab): void;
|
|
45
|
+
/** Extra panels under a dictionary term form, registered by addons as component names. */
|
|
46
|
+
export declare function useKateCmsTermPanels(): import("vue").Ref<string[], string[]>;
|
|
47
|
+
export declare function useKateCmsMenuItems(): import("vue").Ref<KateCmsMenuExtra[], KateCmsMenuExtra[]>;
|
|
48
|
+
export { registerKateCmsField } from '../utils/helpers.js';
|
|
49
|
+
export { provideKateCmsFieldErrors } from '../utils/field-errors.js';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { useState } from "#imports";
|
|
2
|
+
export const MIRAICMS_COLLECTION_HOOK = "katecms:collection";
|
|
3
|
+
export function useKateCmsEntrySidebar() {
|
|
4
|
+
return useState("katecms:entry-sidebar", () => []);
|
|
5
|
+
}
|
|
6
|
+
export function registerKateCmsEntrySidebarTab(tab) {
|
|
7
|
+
const key = tab.key.trim();
|
|
8
|
+
const label = tab.label.trim();
|
|
9
|
+
const component = tab.component.trim();
|
|
10
|
+
if (!key || key === "page" || !label || !component) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const tabs = useKateCmsEntrySidebar();
|
|
14
|
+
const next = { key, label, component };
|
|
15
|
+
const index = tabs.value.findIndex((item) => item.key === key);
|
|
16
|
+
if (index === -1) {
|
|
17
|
+
tabs.value.push(next);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
tabs.value[index] = next;
|
|
21
|
+
}
|
|
22
|
+
export function useKateCmsTermPanels() {
|
|
23
|
+
return useState("katecms:term-panels", () => []);
|
|
24
|
+
}
|
|
25
|
+
export function useKateCmsMenuItems() {
|
|
26
|
+
return useState("katecms:menu-items", () => []);
|
|
27
|
+
}
|
|
28
|
+
export { registerKateCmsField } from "../utils/helpers.js";
|
|
29
|
+
export { provideKateCmsFieldErrors } from "../utils/field-errors.js";
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { MediaItem } from '@katecms/core';
|
|
2
|
+
import type { MediaLibraryFilterState } from '../utils/media-library-query.js';
|
|
3
|
+
/** Page size for media pickers. The library page uses the same size. */
|
|
4
|
+
export declare const MEDIA_LIBRARY_PAGE_SIZE = 40;
|
|
5
|
+
/**
|
|
6
|
+
* Paged media library for pickers.
|
|
7
|
+
* `matches` runs on each loaded page so a field can hide files it cannot use.
|
|
8
|
+
* `fetched` counts raw API rows, so scrolling continues past pages that were filtered out.
|
|
9
|
+
*/
|
|
10
|
+
export declare function useMediaLibrary(matches: () => (item: MediaItem) => boolean, options?: {
|
|
11
|
+
baseType?: 'image';
|
|
12
|
+
}): {
|
|
13
|
+
items: import("vue").Ref<{
|
|
14
|
+
id: number;
|
|
15
|
+
filename: string;
|
|
16
|
+
mime_type: string;
|
|
17
|
+
filesize: number;
|
|
18
|
+
width: number | null;
|
|
19
|
+
height: number | null;
|
|
20
|
+
url: string;
|
|
21
|
+
alt: string | null;
|
|
22
|
+
caption: string | null;
|
|
23
|
+
uploaded_by: number | null;
|
|
24
|
+
uploaded_by_name: string | null;
|
|
25
|
+
variants_status: import("@katecms/core").MediaVariantsStatus;
|
|
26
|
+
variants: {
|
|
27
|
+
url: string;
|
|
28
|
+
size: string;
|
|
29
|
+
format: string;
|
|
30
|
+
filename: string;
|
|
31
|
+
width: number;
|
|
32
|
+
height: number;
|
|
33
|
+
filesize: number;
|
|
34
|
+
}[];
|
|
35
|
+
created_at: string;
|
|
36
|
+
}[], MediaItem[] | {
|
|
37
|
+
id: number;
|
|
38
|
+
filename: string;
|
|
39
|
+
mime_type: string;
|
|
40
|
+
filesize: number;
|
|
41
|
+
width: number | null;
|
|
42
|
+
height: number | null;
|
|
43
|
+
url: string;
|
|
44
|
+
alt: string | null;
|
|
45
|
+
caption: string | null;
|
|
46
|
+
uploaded_by: number | null;
|
|
47
|
+
uploaded_by_name: string | null;
|
|
48
|
+
variants_status: import("@katecms/core").MediaVariantsStatus;
|
|
49
|
+
variants: {
|
|
50
|
+
url: string;
|
|
51
|
+
size: string;
|
|
52
|
+
format: string;
|
|
53
|
+
filename: string;
|
|
54
|
+
width: number;
|
|
55
|
+
height: number;
|
|
56
|
+
filesize: number;
|
|
57
|
+
}[];
|
|
58
|
+
created_at: string;
|
|
59
|
+
}[]>;
|
|
60
|
+
total: import("vue").Ref<number, number>;
|
|
61
|
+
months: import("vue").Ref<string[], string[]>;
|
|
62
|
+
filters: import("vue").Ref<{
|
|
63
|
+
type: import("../utils/media-library-query.js").MediaTypeFilter;
|
|
64
|
+
month: string;
|
|
65
|
+
search: string;
|
|
66
|
+
sort: import("../utils/media-library-query.js").MediaSort;
|
|
67
|
+
}, MediaLibraryFilterState | {
|
|
68
|
+
type: import("../utils/media-library-query.js").MediaTypeFilter;
|
|
69
|
+
month: string;
|
|
70
|
+
search: string;
|
|
71
|
+
sort: import("../utils/media-library-query.js").MediaSort;
|
|
72
|
+
}>;
|
|
73
|
+
loading: import("vue").Ref<boolean, boolean>;
|
|
74
|
+
loadingMore: import("vue").Ref<boolean, boolean>;
|
|
75
|
+
hasMore: import("vue").ComputedRef<boolean>;
|
|
76
|
+
load: (loadOptions?: {
|
|
77
|
+
resetFilters?: boolean;
|
|
78
|
+
silent?: boolean;
|
|
79
|
+
}) => Promise<void>;
|
|
80
|
+
loadMore: () => Promise<void>;
|
|
81
|
+
applyFilters: (next: MediaLibraryFilterState) => Promise<void>;
|
|
82
|
+
prepend: (item: MediaItem) => void;
|
|
83
|
+
replace: (item: MediaItem) => void;
|
|
84
|
+
};
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { computed, ref } from "vue";
|
|
2
|
+
import { $fetch } from "#imports";
|
|
3
|
+
import {
|
|
4
|
+
defaultMediaLibraryFilters,
|
|
5
|
+
localUtcOffsetMinutes,
|
|
6
|
+
mediaLibraryQuery,
|
|
7
|
+
mediaMatchesFilters,
|
|
8
|
+
monthKey,
|
|
9
|
+
normalizeMediaLibraryFilters
|
|
10
|
+
} from "../utils/media-library-query.js";
|
|
11
|
+
export const MEDIA_LIBRARY_PAGE_SIZE = 40;
|
|
12
|
+
export function useMediaLibrary(matches, options) {
|
|
13
|
+
const items = ref([]);
|
|
14
|
+
const total = ref(0);
|
|
15
|
+
const fetched = ref(0);
|
|
16
|
+
const months = ref([]);
|
|
17
|
+
const filters = ref(defaultMediaLibraryFilters());
|
|
18
|
+
const loading = ref(false);
|
|
19
|
+
const loadingMore = ref(false);
|
|
20
|
+
const hasMore = computed(() => fetched.value < total.value);
|
|
21
|
+
let requestId = 0;
|
|
22
|
+
function fetchPage(offset) {
|
|
23
|
+
return $fetch("/api/_katecms/media", {
|
|
24
|
+
query: mediaLibraryQuery(filters.value, {
|
|
25
|
+
limit: MEDIA_LIBRARY_PAGE_SIZE,
|
|
26
|
+
offset
|
|
27
|
+
}, options?.baseType)
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
function accept(list) {
|
|
31
|
+
return list.filter(matches());
|
|
32
|
+
}
|
|
33
|
+
function fieldHidesType() {
|
|
34
|
+
return options?.baseType === "image" && filters.value.type !== "all" && filters.value.type !== "image";
|
|
35
|
+
}
|
|
36
|
+
function rememberMonth(iso) {
|
|
37
|
+
const key = monthKey(iso, localUtcOffsetMinutes());
|
|
38
|
+
if (!key || months.value.includes(key)) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
months.value = [...months.value, key].sort((a, b) => b.localeCompare(a));
|
|
42
|
+
}
|
|
43
|
+
async function load(loadOptions) {
|
|
44
|
+
const id = ++requestId;
|
|
45
|
+
if (loadOptions?.resetFilters) {
|
|
46
|
+
filters.value = defaultMediaLibraryFilters();
|
|
47
|
+
}
|
|
48
|
+
if (!loadOptions?.silent) {
|
|
49
|
+
loading.value = true;
|
|
50
|
+
items.value = [];
|
|
51
|
+
fetched.value = 0;
|
|
52
|
+
}
|
|
53
|
+
try {
|
|
54
|
+
const res = await fetchPage(0);
|
|
55
|
+
if (id !== requestId) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
total.value = res.total;
|
|
59
|
+
months.value = res.months;
|
|
60
|
+
if (fieldHidesType()) {
|
|
61
|
+
fetched.value = res.total;
|
|
62
|
+
items.value = [];
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
fetched.value = res.media.length;
|
|
66
|
+
items.value = accept(res.media);
|
|
67
|
+
} finally {
|
|
68
|
+
if (id === requestId && !loadOptions?.silent) {
|
|
69
|
+
loading.value = false;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
async function loadMore() {
|
|
74
|
+
if (loading.value || loadingMore.value || !hasMore.value) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
const id = requestId;
|
|
78
|
+
loadingMore.value = true;
|
|
79
|
+
try {
|
|
80
|
+
const res = await fetchPage(fetched.value);
|
|
81
|
+
if (id !== requestId) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
total.value = res.total;
|
|
85
|
+
if (!res.media.length) {
|
|
86
|
+
fetched.value = total.value;
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
fetched.value += res.media.length;
|
|
90
|
+
const seen = new Set(items.value.map((item) => item.id));
|
|
91
|
+
const next = accept(res.media).filter((item) => !seen.has(item.id));
|
|
92
|
+
items.value = [...items.value, ...next];
|
|
93
|
+
} finally {
|
|
94
|
+
loadingMore.value = false;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
async function applyFilters(next) {
|
|
98
|
+
filters.value = normalizeMediaLibraryFilters(next);
|
|
99
|
+
await load();
|
|
100
|
+
}
|
|
101
|
+
function prepend(item) {
|
|
102
|
+
if (mediaMatchesFilters(item, { ...filters.value, month: "all" })) {
|
|
103
|
+
rememberMonth(item.created_at);
|
|
104
|
+
}
|
|
105
|
+
if (!matches()(item) || !mediaMatchesFilters(item, filters.value)) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
if (filters.value.sort !== "date-desc") {
|
|
109
|
+
void load({ silent: true });
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
const index = items.value.findIndex((entry) => entry.id === item.id);
|
|
113
|
+
if (index >= 0) {
|
|
114
|
+
items.value[index] = item;
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
items.value = [item, ...items.value];
|
|
118
|
+
total.value += 1;
|
|
119
|
+
}
|
|
120
|
+
function replace(item) {
|
|
121
|
+
const index = items.value.findIndex((entry) => entry.id === item.id);
|
|
122
|
+
if (index >= 0) {
|
|
123
|
+
items.value[index] = item;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return {
|
|
127
|
+
items,
|
|
128
|
+
total,
|
|
129
|
+
months,
|
|
130
|
+
filters,
|
|
131
|
+
loading,
|
|
132
|
+
loadingMore,
|
|
133
|
+
hasMore,
|
|
134
|
+
load,
|
|
135
|
+
loadMore,
|
|
136
|
+
applyFilters,
|
|
137
|
+
prepend,
|
|
138
|
+
replace
|
|
139
|
+
};
|
|
140
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface MenuAccess {
|
|
2
|
+
visible: string[];
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* Resources the current user may read, for addon menu items.
|
|
6
|
+
* Fetched once per admin shell. A later sign-in loads it again.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useMenuAccess(): import("nuxt/app").AsyncData<MenuAccess | undefined, import("nuxt/app").NuxtError<unknown> | undefined>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useAsyncData, useRequestFetch } from "#imports";
|
|
2
|
+
export function useMenuAccess() {
|
|
3
|
+
const request = useRequestFetch();
|
|
4
|
+
return useAsyncData(
|
|
5
|
+
"katecms-menu",
|
|
6
|
+
() => request("/api/_katecms/menu"),
|
|
7
|
+
{
|
|
8
|
+
getCachedData: (key, nuxtApp, ctx) => {
|
|
9
|
+
if (nuxtApp.isHydrating && ctx.cause === "initial") {
|
|
10
|
+
return nuxtApp.payload.data[key];
|
|
11
|
+
}
|
|
12
|
+
return void 0;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
);
|
|
16
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
title: string;
|
|
3
|
+
/** When set, a back button is shown before the title. */
|
|
4
|
+
backTo?: string;
|
|
5
|
+
/** Secondary line under the title. */
|
|
6
|
+
meta?: string;
|
|
7
|
+
/** Shown after the title, for example a result count. */
|
|
8
|
+
count?: string | number;
|
|
9
|
+
};
|
|
10
|
+
declare const __VLS_template: () => {
|
|
11
|
+
__VLS_Slots: {
|
|
12
|
+
default?: (props: {}) => any;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
|
|
16
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
17
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
18
|
+
declare const _default: typeof __VLS_export;
|
|
19
|
+
export default _default;
|
|
20
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
21
|
+
new (): {
|
|
22
|
+
$slots: S;
|
|
23
|
+
};
|
|
24
|
+
};
|