@karibsen/eponyme 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 +609 -0
- package/dist/eponyme.d.mts +15 -0
- package/dist/eponyme.mjs +38 -0
- package/dist/module.d.mts +26 -0
- package/dist/module.json +9 -0
- package/dist/module.mjs +154 -0
- package/dist/runtime/assets/dashboard.css +1 -0
- package/dist/runtime/components/editor/EponymeCollectionPage.d.vue.ts +9 -0
- package/dist/runtime/components/editor/EponymeCollectionPage.vue +238 -0
- package/dist/runtime/components/editor/EponymeCollectionPage.vue.d.ts +9 -0
- package/dist/runtime/components/editor/EponymeCopy.d.vue.ts +7 -0
- package/dist/runtime/components/editor/EponymeCopy.vue +28 -0
- package/dist/runtime/components/editor/EponymeCopy.vue.d.ts +7 -0
- package/dist/runtime/components/editor/EponymeFolderNav.d.vue.ts +7 -0
- package/dist/runtime/components/editor/EponymeFolderNav.vue +146 -0
- package/dist/runtime/components/editor/EponymeFolderNav.vue.d.ts +7 -0
- package/dist/runtime/components/editor/EponymeFolderPage.d.vue.ts +7 -0
- package/dist/runtime/components/editor/EponymeFolderPage.vue +62 -0
- package/dist/runtime/components/editor/EponymeFolderPage.vue.d.ts +7 -0
- package/dist/runtime/components/editor/EponymeForm.d.vue.ts +9 -0
- package/dist/runtime/components/editor/EponymeForm.vue +309 -0
- package/dist/runtime/components/editor/EponymeForm.vue.d.ts +9 -0
- package/dist/runtime/components/editor/EponymeFormPage.d.vue.ts +8 -0
- package/dist/runtime/components/editor/EponymeFormPage.vue +288 -0
- package/dist/runtime/components/editor/EponymeFormPage.vue.d.ts +8 -0
- package/dist/runtime/components/editor/EponymeHistoryDialog.d.vue.ts +14 -0
- package/dist/runtime/components/editor/EponymeHistoryDialog.vue +97 -0
- package/dist/runtime/components/editor/EponymeHistoryDialog.vue.d.ts +14 -0
- package/dist/runtime/components/editor/EponymeNavigationLink.d.vue.ts +14 -0
- package/dist/runtime/components/editor/EponymeNavigationLink.vue +80 -0
- package/dist/runtime/components/editor/EponymeNavigationLink.vue.d.ts +14 -0
- package/dist/runtime/components/editor/EponymePageNavigation.d.vue.ts +8 -0
- package/dist/runtime/components/editor/EponymePageNavigation.vue +58 -0
- package/dist/runtime/components/editor/EponymePageNavigation.vue.d.ts +8 -0
- package/dist/runtime/components/editor/EponymePreviewPanel.d.vue.ts +16 -0
- package/dist/runtime/components/editor/EponymePreviewPanel.vue +100 -0
- package/dist/runtime/components/editor/EponymePreviewPanel.vue.d.ts +16 -0
- package/dist/runtime/components/editor/EponymeSidebar.d.vue.ts +6 -0
- package/dist/runtime/components/editor/EponymeSidebar.vue +244 -0
- package/dist/runtime/components/editor/EponymeSidebar.vue.d.ts +6 -0
- package/dist/runtime/components/editor/EponymeSidebarTree.d.vue.ts +18 -0
- package/dist/runtime/components/editor/EponymeSidebarTree.vue +84 -0
- package/dist/runtime/components/editor/EponymeSidebarTree.vue.d.ts +18 -0
- package/dist/runtime/components/fields/ArrayField.d.vue.ts +19 -0
- package/dist/runtime/components/fields/ArrayField.vue +198 -0
- package/dist/runtime/components/fields/ArrayField.vue.d.ts +19 -0
- package/dist/runtime/components/fields/BooleanField.d.vue.ts +16 -0
- package/dist/runtime/components/fields/BooleanField.vue +36 -0
- package/dist/runtime/components/fields/BooleanField.vue.d.ts +16 -0
- package/dist/runtime/components/fields/CheckboxGroupField.d.vue.ts +20 -0
- package/dist/runtime/components/fields/CheckboxGroupField.vue +52 -0
- package/dist/runtime/components/fields/CheckboxGroupField.vue.d.ts +20 -0
- package/dist/runtime/components/fields/ColorField.d.vue.ts +19 -0
- package/dist/runtime/components/fields/ColorField.vue +39 -0
- package/dist/runtime/components/fields/ColorField.vue.d.ts +19 -0
- package/dist/runtime/components/fields/DateField.d.vue.ts +18 -0
- package/dist/runtime/components/fields/DateField.vue +39 -0
- package/dist/runtime/components/fields/DateField.vue.d.ts +18 -0
- package/dist/runtime/components/fields/FieldRenderer.d.vue.ts +24 -0
- package/dist/runtime/components/fields/FieldRenderer.vue +135 -0
- package/dist/runtime/components/fields/FieldRenderer.vue.d.ts +24 -0
- package/dist/runtime/components/fields/NumberField.d.vue.ts +20 -0
- package/dist/runtime/components/fields/NumberField.vue +58 -0
- package/dist/runtime/components/fields/NumberField.vue.d.ts +20 -0
- package/dist/runtime/components/fields/RadioField.d.vue.ts +20 -0
- package/dist/runtime/components/fields/RadioField.vue +44 -0
- package/dist/runtime/components/fields/RadioField.vue.d.ts +20 -0
- package/dist/runtime/components/fields/RichTextField.d.vue.ts +20 -0
- package/dist/runtime/components/fields/RichTextField.vue +176 -0
- package/dist/runtime/components/fields/RichTextField.vue.d.ts +20 -0
- package/dist/runtime/components/fields/SectionField.d.vue.ts +20 -0
- package/dist/runtime/components/fields/SectionField.vue +127 -0
- package/dist/runtime/components/fields/SectionField.vue.d.ts +20 -0
- package/dist/runtime/components/fields/SelectField.d.vue.ts +21 -0
- package/dist/runtime/components/fields/SelectField.vue +42 -0
- package/dist/runtime/components/fields/SelectField.vue.d.ts +21 -0
- package/dist/runtime/components/fields/SlugField.d.vue.ts +20 -0
- package/dist/runtime/components/fields/SlugField.vue +35 -0
- package/dist/runtime/components/fields/SlugField.vue.d.ts +20 -0
- package/dist/runtime/components/fields/TabsField.d.vue.ts +19 -0
- package/dist/runtime/components/fields/TabsField.vue +109 -0
- package/dist/runtime/components/fields/TabsField.vue.d.ts +19 -0
- package/dist/runtime/components/fields/TextField.d.vue.ts +22 -0
- package/dist/runtime/components/fields/TextField.vue +56 -0
- package/dist/runtime/components/fields/TextField.vue.d.ts +22 -0
- package/dist/runtime/components/fields/TextareaField.d.vue.ts +20 -0
- package/dist/runtime/components/fields/TextareaField.vue +47 -0
- package/dist/runtime/components/fields/TextareaField.vue.d.ts +20 -0
- package/dist/runtime/components/fields/UrlField.d.vue.ts +17 -0
- package/dist/runtime/components/fields/UrlField.vue +35 -0
- package/dist/runtime/components/fields/UrlField.vue.d.ts +17 -0
- package/dist/runtime/components/ui/EPAccordion.d.vue.ts +26 -0
- package/dist/runtime/components/ui/EPAccordion.vue +64 -0
- package/dist/runtime/components/ui/EPAccordion.vue.d.ts +26 -0
- package/dist/runtime/components/ui/EPAvatar.d.vue.ts +9 -0
- package/dist/runtime/components/ui/EPAvatar.vue +25 -0
- package/dist/runtime/components/ui/EPAvatar.vue.d.ts +9 -0
- package/dist/runtime/components/ui/EPBadge.d.vue.ts +16 -0
- package/dist/runtime/components/ui/EPBadge.vue +17 -0
- package/dist/runtime/components/ui/EPBadge.vue.d.ts +16 -0
- package/dist/runtime/components/ui/EPButton.d.vue.ts +22 -0
- package/dist/runtime/components/ui/EPButton.vue +55 -0
- package/dist/runtime/components/ui/EPButton.vue.d.ts +22 -0
- package/dist/runtime/components/ui/EPCheckbox.d.vue.ts +11 -0
- package/dist/runtime/components/ui/EPCheckbox.vue +21 -0
- package/dist/runtime/components/ui/EPCheckbox.vue.d.ts +11 -0
- package/dist/runtime/components/ui/EPColorPicker.d.vue.ts +19 -0
- package/dist/runtime/components/ui/EPColorPicker.vue +63 -0
- package/dist/runtime/components/ui/EPColorPicker.vue.d.ts +19 -0
- package/dist/runtime/components/ui/EPDialog.d.vue.ts +24 -0
- package/dist/runtime/components/ui/EPDialog.vue +54 -0
- package/dist/runtime/components/ui/EPDialog.vue.d.ts +24 -0
- package/dist/runtime/components/ui/EPDropdownMenu.d.vue.ts +25 -0
- package/dist/runtime/components/ui/EPDropdownMenu.vue +40 -0
- package/dist/runtime/components/ui/EPDropdownMenu.vue.d.ts +25 -0
- package/dist/runtime/components/ui/EPFormField.d.vue.ts +24 -0
- package/dist/runtime/components/ui/EPFormField.vue +62 -0
- package/dist/runtime/components/ui/EPFormField.vue.d.ts +24 -0
- package/dist/runtime/components/ui/EPInputText.d.vue.ts +17 -0
- package/dist/runtime/components/ui/EPInputText.vue +33 -0
- package/dist/runtime/components/ui/EPInputText.vue.d.ts +17 -0
- package/dist/runtime/components/ui/EPLinkEditor.d.vue.ts +16 -0
- package/dist/runtime/components/ui/EPLinkEditor.vue +169 -0
- package/dist/runtime/components/ui/EPLinkEditor.vue.d.ts +16 -0
- package/dist/runtime/components/ui/EPRadioButton.d.vue.ts +16 -0
- package/dist/runtime/components/ui/EPRadioButton.vue +34 -0
- package/dist/runtime/components/ui/EPRadioButton.vue.d.ts +16 -0
- package/dist/runtime/components/ui/EPSelect.d.vue.ts +21 -0
- package/dist/runtime/components/ui/EPSelect.vue +73 -0
- package/dist/runtime/components/ui/EPSelect.vue.d.ts +21 -0
- package/dist/runtime/components/ui/EPSlider.d.vue.ts +16 -0
- package/dist/runtime/components/ui/EPSlider.vue +51 -0
- package/dist/runtime/components/ui/EPSlider.vue.d.ts +16 -0
- package/dist/runtime/components/ui/EPSwitch.d.vue.ts +11 -0
- package/dist/runtime/components/ui/EPSwitch.vue +23 -0
- package/dist/runtime/components/ui/EPSwitch.vue.d.ts +11 -0
- package/dist/runtime/components/ui/EPTextarea.d.vue.ts +12 -0
- package/dist/runtime/components/ui/EPTextarea.vue +18 -0
- package/dist/runtime/components/ui/EPTextarea.vue.d.ts +12 -0
- package/dist/runtime/components/ui/EPToast.d.vue.ts +13 -0
- package/dist/runtime/components/ui/EPToast.vue +60 -0
- package/dist/runtime/components/ui/EPToast.vue.d.ts +13 -0
- package/dist/runtime/components/ui/EPTooltip.d.vue.ts +17 -0
- package/dist/runtime/components/ui/EPTooltip.vue +34 -0
- package/dist/runtime/components/ui/EPTooltip.vue.d.ts +17 -0
- package/dist/runtime/components/ui/form-field-context.d.ts +12 -0
- package/dist/runtime/components/ui/form-field-context.js +1 -0
- package/dist/runtime/composables/useEponyme.d.ts +24 -0
- package/dist/runtime/composables/useEponyme.js +63 -0
- package/dist/runtime/composables/useEponymeAuth.d.ts +16 -0
- package/dist/runtime/composables/useEponymeAuth.js +81 -0
- package/dist/runtime/composables/useEponymeCollection.d.ts +27 -0
- package/dist/runtime/composables/useEponymeCollection.js +44 -0
- package/dist/runtime/composables/useEponymeColorPresets.d.ts +5 -0
- package/dist/runtime/composables/useEponymeColorPresets.js +16 -0
- package/dist/runtime/composables/useEponymeConfig.d.ts +1 -0
- package/dist/runtime/composables/useEponymeConfig.js +4 -0
- package/dist/runtime/composables/useEponymeForm.d.ts +35 -0
- package/dist/runtime/composables/useEponymeForm.js +75 -0
- package/dist/runtime/composables/useEponymeHistory.d.ts +26 -0
- package/dist/runtime/composables/useEponymeHistory.js +24 -0
- package/dist/runtime/composables/useEponymeValidation.d.ts +21 -0
- package/dist/runtime/composables/useEponymeValidation.js +34 -0
- package/dist/runtime/fields/array.d.ts +2 -0
- package/dist/runtime/fields/array.js +3 -0
- package/dist/runtime/fields/boolean.d.ts +2 -0
- package/dist/runtime/fields/boolean.js +3 -0
- package/dist/runtime/fields/checkbox-group.d.ts +2 -0
- package/dist/runtime/fields/checkbox-group.js +3 -0
- package/dist/runtime/fields/color.d.ts +2 -0
- package/dist/runtime/fields/color.js +3 -0
- package/dist/runtime/fields/date.d.ts +3 -0
- package/dist/runtime/fields/date.js +6 -0
- package/dist/runtime/fields/email.d.ts +2 -0
- package/dist/runtime/fields/email.js +3 -0
- package/dist/runtime/fields/image.d.ts +2 -0
- package/dist/runtime/fields/image.js +3 -0
- package/dist/runtime/fields/index.d.ts +37 -0
- package/dist/runtime/fields/index.js +19 -0
- package/dist/runtime/fields/number.d.ts +2 -0
- package/dist/runtime/fields/number.js +3 -0
- package/dist/runtime/fields/radio.d.ts +2 -0
- package/dist/runtime/fields/radio.js +3 -0
- package/dist/runtime/fields/rich-text.d.ts +2 -0
- package/dist/runtime/fields/rich-text.js +3 -0
- package/dist/runtime/fields/section.d.ts +2 -0
- package/dist/runtime/fields/section.js +3 -0
- package/dist/runtime/fields/select.d.ts +2 -0
- package/dist/runtime/fields/select.js +3 -0
- package/dist/runtime/fields/slug.d.ts +2 -0
- package/dist/runtime/fields/slug.js +3 -0
- package/dist/runtime/fields/string.d.ts +2 -0
- package/dist/runtime/fields/string.js +3 -0
- package/dist/runtime/fields/tab.d.ts +2 -0
- package/dist/runtime/fields/tab.js +3 -0
- package/dist/runtime/fields/textarea.d.ts +2 -0
- package/dist/runtime/fields/textarea.js +3 -0
- package/dist/runtime/fields/url.d.ts +2 -0
- package/dist/runtime/fields/url.js +3 -0
- package/dist/runtime/middleware/eponyme-auth.d.ts +2 -0
- package/dist/runtime/middleware/eponyme-auth.js +13 -0
- package/dist/runtime/middleware/eponyme-owner.d.ts +2 -0
- package/dist/runtime/middleware/eponyme-owner.js +7 -0
- package/dist/runtime/pages/EponymeChangePasswordPage.d.vue.ts +3 -0
- package/dist/runtime/pages/EponymeChangePasswordPage.vue +118 -0
- package/dist/runtime/pages/EponymeChangePasswordPage.vue.d.ts +3 -0
- package/dist/runtime/pages/EponymeDetailPage.d.vue.ts +3 -0
- package/dist/runtime/pages/EponymeDetailPage.vue +83 -0
- package/dist/runtime/pages/EponymeDetailPage.vue.d.ts +3 -0
- package/dist/runtime/pages/EponymeIndexPage.d.vue.ts +3 -0
- package/dist/runtime/pages/EponymeIndexPage.vue +51 -0
- package/dist/runtime/pages/EponymeIndexPage.vue.d.ts +3 -0
- package/dist/runtime/pages/EponymeLoginPage.d.vue.ts +3 -0
- package/dist/runtime/pages/EponymeLoginPage.vue +102 -0
- package/dist/runtime/pages/EponymeLoginPage.vue.d.ts +3 -0
- package/dist/runtime/pages/EponymeUsersPage.d.vue.ts +3 -0
- package/dist/runtime/pages/EponymeUsersPage.vue +261 -0
- package/dist/runtime/pages/EponymeUsersPage.vue.d.ts +3 -0
- package/dist/runtime/server/api/eponyme/[name].get.d.ts +4 -0
- package/dist/runtime/server/api/eponyme/[name].get.js +20 -0
- package/dist/runtime/server/api/eponyme/[name].patch.d.ts +11 -0
- package/dist/runtime/server/api/eponyme/[name].patch.js +20 -0
- package/dist/runtime/server/api/eponyme-auth/change-password.post.d.ts +4 -0
- package/dist/runtime/server/api/eponyme-auth/change-password.post.js +21 -0
- package/dist/runtime/server/api/eponyme-auth/login.post.d.ts +4 -0
- package/dist/runtime/server/api/eponyme-auth/login.post.js +12 -0
- package/dist/runtime/server/api/eponyme-auth/logout.post.d.ts +4 -0
- package/dist/runtime/server/api/eponyme-auth/logout.post.js +13 -0
- package/dist/runtime/server/api/eponyme-auth/session.get.d.ts +4 -0
- package/dist/runtime/server/api/eponyme-auth/session.get.js +5 -0
- package/dist/runtime/server/api/eponyme-collections/[path].delete.d.ts +4 -0
- package/dist/runtime/server/api/eponyme-collections/[path].delete.js +11 -0
- package/dist/runtime/server/api/eponyme-collections/[path].get.d.ts +4 -0
- package/dist/runtime/server/api/eponyme-collections/[path].get.js +11 -0
- package/dist/runtime/server/api/eponyme-collections/[path].post.d.ts +7 -0
- package/dist/runtime/server/api/eponyme-collections/[path].post.js +16 -0
- package/dist/runtime/server/api/eponyme-forms/[path].delete.d.ts +6 -0
- package/dist/runtime/server/api/eponyme-forms/[path].delete.js +19 -0
- package/dist/runtime/server/api/eponyme-forms/[path].get.d.ts +4 -0
- package/dist/runtime/server/api/eponyme-forms/[path].get.js +22 -0
- package/dist/runtime/server/api/eponyme-forms/[path].post.d.ts +19 -0
- package/dist/runtime/server/api/eponyme-forms/[path].post.js +36 -0
- package/dist/runtime/server/api/eponyme-history/[path].get.d.ts +4 -0
- package/dist/runtime/server/api/eponyme-history/[path].get.js +11 -0
- package/dist/runtime/server/api/eponyme-history/[path].patch.d.ts +2 -0
- package/dist/runtime/server/api/eponyme-history/[path].patch.js +18 -0
- package/dist/runtime/server/api/eponyme-sitemap.get.d.ts +4 -0
- package/dist/runtime/server/api/eponyme-sitemap.get.js +5 -0
- package/dist/runtime/server/api/eponyme-statuses.get.d.ts +4 -0
- package/dist/runtime/server/api/eponyme-statuses.get.js +7 -0
- package/dist/runtime/server/api/eponyme-users/[id]/reset-password.post.d.ts +5 -0
- package/dist/runtime/server/api/eponyme-users/[id]/reset-password.post.js +12 -0
- package/dist/runtime/server/api/eponyme-users/[id].patch.d.ts +4 -0
- package/dist/runtime/server/api/eponyme-users/[id].patch.js +14 -0
- package/dist/runtime/server/api/eponyme-users/index.get.d.ts +4 -0
- package/dist/runtime/server/api/eponyme-users/index.get.js +7 -0
- package/dist/runtime/server/api/eponyme-users/index.post.d.ts +5 -0
- package/dist/runtime/server/api/eponyme-users/index.post.js +13 -0
- package/dist/runtime/server/plugins/eponyme-sync.d.ts +2 -0
- package/dist/runtime/server/plugins/eponyme-sync.js +14 -0
- package/dist/runtime/server/services/eponyme-auth-service.d.ts +2 -0
- package/dist/runtime/server/services/eponyme-auth-service.js +15 -0
- package/dist/runtime/server/services/eponyme-auth-store.d.ts +119 -0
- package/dist/runtime/server/services/eponyme-auth-store.js +227 -0
- package/dist/runtime/server/services/eponyme-form-service.d.ts +3 -0
- package/dist/runtime/server/services/eponyme-form-service.js +8 -0
- package/dist/runtime/server/services/eponyme-form-store.d.ts +100 -0
- package/dist/runtime/server/services/eponyme-form-store.js +109 -0
- package/dist/runtime/server/services/eponyme-service.d.ts +3 -0
- package/dist/runtime/server/services/eponyme-service.js +8 -0
- package/dist/runtime/server/services/eponyme-store.d.ts +202 -0
- package/dist/runtime/server/services/eponyme-store.js +338 -0
- package/dist/runtime/server/utils/auth.d.ts +11 -0
- package/dist/runtime/server/utils/auth.js +41 -0
- package/dist/runtime/server/utils/eponyme-form.d.ts +14 -0
- package/dist/runtime/server/utils/eponyme-form.js +6 -0
- package/dist/runtime/server/utils/eponyme-sitemap.d.ts +7 -0
- package/dist/runtime/server/utils/eponyme-sitemap.js +7 -0
- package/dist/runtime/server/utils/form-route.d.ts +14 -0
- package/dist/runtime/server/utils/form-route.js +14 -0
- package/dist/runtime/server/utils/password.d.ts +4 -0
- package/dist/runtime/server/utils/password.js +30 -0
- package/dist/runtime/types/auth.d.ts +20 -0
- package/dist/runtime/types/auth.js +7 -0
- package/dist/runtime/types/eponyme-config.d.ts +11 -0
- package/dist/runtime/types/eponyme-navigation.d.ts +6 -0
- package/dist/runtime/types/eponyme-navigation.js +0 -0
- package/dist/runtime/types/eponyme.d.ts +87 -0
- package/dist/runtime/types/eponyme.js +0 -0
- package/dist/runtime/types/field.d.ts +203 -0
- package/dist/runtime/types/field.js +0 -0
- package/dist/runtime/types/index.d.ts +3 -0
- package/dist/runtime/types/index.js +3 -0
- package/dist/runtime/types/nuxt.d.ts +11 -0
- package/dist/runtime/utils/as-record.d.ts +1 -0
- package/dist/runtime/utils/as-record.js +3 -0
- package/dist/runtime/utils/build-eponyme-schema.d.ts +22 -0
- package/dist/runtime/utils/build-eponyme-schema.js +42 -0
- package/dist/runtime/utils/changed-paths.d.ts +6 -0
- package/dist/runtime/utils/changed-paths.js +25 -0
- package/dist/runtime/utils/create-default-eponyme-data.d.ts +5 -0
- package/dist/runtime/utils/create-default-eponyme-data.js +12 -0
- package/dist/runtime/utils/field-path.d.ts +14 -0
- package/dist/runtime/utils/field-path.js +23 -0
- package/dist/runtime/utils/get-eponyme-schemas.d.ts +7 -0
- package/dist/runtime/utils/get-eponyme-schemas.js +33 -0
- package/dist/runtime/utils/get-field-default-value.d.ts +4 -0
- package/dist/runtime/utils/get-field-default-value.js +56 -0
- package/dist/runtime/utils/humanize-label.d.ts +6 -0
- package/dist/runtime/utils/humanize-label.js +3 -0
- package/dist/runtime/utils/initials.d.ts +1 -0
- package/dist/runtime/utils/initials.js +3 -0
- package/dist/runtime/utils/is-field-visible.d.ts +2 -0
- package/dist/runtime/utils/is-field-visible.js +14 -0
- package/dist/runtime/utils/normalize-hex-color.d.ts +8 -0
- package/dist/runtime/utils/normalize-hex-color.js +11 -0
- package/dist/runtime/utils/normalize-slug.d.ts +1 -0
- package/dist/runtime/utils/normalize-slug.js +4 -0
- package/dist/runtime/utils/preview.d.ts +30 -0
- package/dist/runtime/utils/preview.js +30 -0
- package/dist/runtime/utils/validate-eponyme-data.d.ts +10 -0
- package/dist/runtime/utils/validate-eponyme-data.js +204 -0
- package/dist/types.d.mts +11 -0
- package/package.json +96 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, ref, watch } from "vue";
|
|
3
|
+
import EPButton from "../ui/EPButton.vue";
|
|
4
|
+
import EPSelect from "../ui/EPSelect.vue";
|
|
5
|
+
import { formatVersionDate, useEponymeHistory } from "../../composables/useEponymeHistory";
|
|
6
|
+
const props = defineProps({
|
|
7
|
+
name: { type: String, required: true },
|
|
8
|
+
path: { type: String, required: true },
|
|
9
|
+
open: { type: Boolean, required: true }
|
|
10
|
+
});
|
|
11
|
+
const emit = defineEmits(["update:open"]);
|
|
12
|
+
const { history, load } = useEponymeHistory(() => props.name);
|
|
13
|
+
const selected = ref("draft");
|
|
14
|
+
function newToken() {
|
|
15
|
+
return globalThis.crypto?.randomUUID?.() ?? `${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
16
|
+
}
|
|
17
|
+
const previewToken = ref(newToken());
|
|
18
|
+
const options = computed(() => [
|
|
19
|
+
{ label: "Draft (last saved)", value: "draft" },
|
|
20
|
+
{ label: "Published", value: "published" },
|
|
21
|
+
...history.value.map((version) => ({
|
|
22
|
+
label: `${formatVersionDate(version.createdAt)} \xB7 ${version.action}${version.user ? ` \xB7 ${version.user.username}` : ""}`,
|
|
23
|
+
value: String(version.id)
|
|
24
|
+
}))
|
|
25
|
+
]);
|
|
26
|
+
const previewUrl = computed(() => {
|
|
27
|
+
const url = new URL(props.path, "http://placeholder");
|
|
28
|
+
url.searchParams.set("__eponyme_preview", props.name);
|
|
29
|
+
url.searchParams.set("__eponyme_preview_version", selected.value);
|
|
30
|
+
url.searchParams.set("__eponyme_preview_token", previewToken.value);
|
|
31
|
+
return `${url.pathname}${url.search}`;
|
|
32
|
+
});
|
|
33
|
+
async function reload() {
|
|
34
|
+
previewToken.value = newToken();
|
|
35
|
+
await load();
|
|
36
|
+
if (selected.value !== "draft" && selected.value !== "published" && !history.value.some((version) => String(version.id) === selected.value))
|
|
37
|
+
selected.value = "draft";
|
|
38
|
+
}
|
|
39
|
+
watch(selected, () => {
|
|
40
|
+
previewToken.value = newToken();
|
|
41
|
+
});
|
|
42
|
+
function openInNewTab() {
|
|
43
|
+
window.open(previewUrl.value, "_blank", "noopener,noreferrer");
|
|
44
|
+
}
|
|
45
|
+
defineExpose({ reload });
|
|
46
|
+
watch(() => props.open, (open) => {
|
|
47
|
+
if (open) void load();
|
|
48
|
+
});
|
|
49
|
+
watch(() => props.name, () => {
|
|
50
|
+
selected.value = "draft";
|
|
51
|
+
previewToken.value = newToken();
|
|
52
|
+
});
|
|
53
|
+
</script>
|
|
54
|
+
|
|
55
|
+
<template>
|
|
56
|
+
<aside
|
|
57
|
+
v-if="open"
|
|
58
|
+
class="ep:fixed ep:z-100 ep:top-0 ep:right-0 ep:bottom-0 ep:flex ep:w-full ep:flex-col ep:border-l ep:border-border-ep ep:bg-theme-ep ep:shadow-2xl ep:md:w-[45vw] ep:lg:w-[40vw]"
|
|
59
|
+
aria-label="Preview"
|
|
60
|
+
>
|
|
61
|
+
<div class="ep:flex ep:flex-wrap ep:items-center ep:gap-2 ep:border-b ep:border-border-ep ep:p-3">
|
|
62
|
+
<EPSelect
|
|
63
|
+
size="sm"
|
|
64
|
+
class="ep:min-w-0 ep:flex-1"
|
|
65
|
+
:model-value="selected"
|
|
66
|
+
:options="options"
|
|
67
|
+
content-class="ep:z-110"
|
|
68
|
+
aria-label="Version to preview"
|
|
69
|
+
@update:model-value="selected = $event"
|
|
70
|
+
/>
|
|
71
|
+
<EPButton
|
|
72
|
+
icon="mingcute:refresh-2-line"
|
|
73
|
+
variant="ghost"
|
|
74
|
+
aria-label="Reload preview"
|
|
75
|
+
@click="reload"
|
|
76
|
+
/>
|
|
77
|
+
<EPButton
|
|
78
|
+
icon="mingcute:external-link-line"
|
|
79
|
+
variant="ghost"
|
|
80
|
+
aria-label="Open preview in a new tab"
|
|
81
|
+
@click="openInNewTab"
|
|
82
|
+
/>
|
|
83
|
+
<EPButton
|
|
84
|
+
icon="mingcute:close-line"
|
|
85
|
+
variant="ghost"
|
|
86
|
+
aria-label="Close preview"
|
|
87
|
+
@click="emit('update:open', false)"
|
|
88
|
+
/>
|
|
89
|
+
</div>
|
|
90
|
+
<p class="ep:m-0 ep:px-3 ep:py-2 ep:text-[11px] ep:text-muted-ep">
|
|
91
|
+
Shows saved content — unsaved edits appear after you save.
|
|
92
|
+
</p>
|
|
93
|
+
<iframe
|
|
94
|
+
:key="previewUrl"
|
|
95
|
+
:src="previewUrl"
|
|
96
|
+
title="Entry preview"
|
|
97
|
+
class="ep:min-h-0 ep:w-full ep:flex-1 ep:border-0 ep:bg-white"
|
|
98
|
+
/>
|
|
99
|
+
</aside>
|
|
100
|
+
</template>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
name: string;
|
|
3
|
+
/** Public route of the site rendering this entry, from `eponyme.previewPaths`. */
|
|
4
|
+
path: string;
|
|
5
|
+
open: boolean;
|
|
6
|
+
};
|
|
7
|
+
declare function reload(): Promise<void>;
|
|
8
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
|
|
9
|
+
reload: typeof reload;
|
|
10
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
11
|
+
"update:open": (value: boolean) => any;
|
|
12
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
13
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
14
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
15
|
+
declare const _default: typeof __VLS_export;
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
basePath: string;
|
|
3
|
+
};
|
|
4
|
+
declare const __VLS_export: 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>;
|
|
5
|
+
declare const _default: typeof __VLS_export;
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { navigateTo, useRequestFetch, useRoute, useState } from "#app";
|
|
3
|
+
import { onKeyStroke } from "@vueuse/core";
|
|
4
|
+
import { computed, nextTick, onBeforeUnmount, onMounted, ref, watch } from "vue";
|
|
5
|
+
import EponymeNavigationLink from "./EponymeNavigationLink.vue";
|
|
6
|
+
import EponymeSidebarTree from "./EponymeSidebarTree.vue";
|
|
7
|
+
import { useEponymeConfig } from "../../composables/useEponymeConfig";
|
|
8
|
+
import { getEponymeCollections, getEponymeForms, getEponymeSchemas } from "../../utils/get-eponyme-schemas";
|
|
9
|
+
import { useEponymeAuth } from "../../composables/useEponymeAuth";
|
|
10
|
+
import EPAvatar from "../ui/EPAvatar.vue";
|
|
11
|
+
import EPButton from "../ui/EPButton.vue";
|
|
12
|
+
import EPInputText from "../ui/EPInputText.vue";
|
|
13
|
+
const props = defineProps({
|
|
14
|
+
basePath: { type: String, required: true }
|
|
15
|
+
});
|
|
16
|
+
const route = useRoute();
|
|
17
|
+
const config = useEponymeConfig();
|
|
18
|
+
const collapsed = useState("eponyme:sidebar-collapsed", () => false);
|
|
19
|
+
const statuses = useState("eponyme:entry-statuses", () => ({}));
|
|
20
|
+
const requestFetch = useRequestFetch();
|
|
21
|
+
const searchInput = ref();
|
|
22
|
+
const searchQuery = ref("");
|
|
23
|
+
const collectionEntries = useState("eponyme:collection-entries", () => ({}));
|
|
24
|
+
const collections = getEponymeCollections(config);
|
|
25
|
+
const forms = getEponymeForms(config);
|
|
26
|
+
const normalizedBasePath = computed(() => props.basePath.replace(/\/$/, ""));
|
|
27
|
+
const navigationElement = ref();
|
|
28
|
+
const navigationScrollTop = useState(`eponyme:sidebar-scroll:${normalizedBasePath.value}`, () => 0);
|
|
29
|
+
const auth = useEponymeAuth();
|
|
30
|
+
async function logout() {
|
|
31
|
+
await auth.logout();
|
|
32
|
+
await navigateTo(`${normalizedBasePath.value}/login`);
|
|
33
|
+
}
|
|
34
|
+
async function restoreNavigationScroll() {
|
|
35
|
+
await nextTick();
|
|
36
|
+
if (navigationElement.value) navigationElement.value.scrollTop = navigationScrollTop.value;
|
|
37
|
+
}
|
|
38
|
+
onMounted(async () => {
|
|
39
|
+
await restoreNavigationScroll();
|
|
40
|
+
const [statusResponse, ...collectionResponses] = await Promise.all([
|
|
41
|
+
requestFetch("/api/eponyme-statuses"),
|
|
42
|
+
...Object.keys(collections).map((name) => requestFetch(`/api/eponyme-collections/${name}`, { query: { version: "draft" } }))
|
|
43
|
+
]);
|
|
44
|
+
statuses.value = { ...statusResponse.statuses };
|
|
45
|
+
collectionEntries.value = Object.fromEntries(Object.keys(collections).map((name, index) => [name, collectionResponses[index]?.entries ?? []]));
|
|
46
|
+
for (const [name, entries] of Object.entries(collectionEntries.value)) {
|
|
47
|
+
for (const entry of entries) statuses.value[`${name}/${entry.slug}`] = entry.status;
|
|
48
|
+
}
|
|
49
|
+
await restoreNavigationScroll();
|
|
50
|
+
});
|
|
51
|
+
onBeforeUnmount(() => {
|
|
52
|
+
if (navigationElement.value) navigationScrollTop.value = navigationElement.value.scrollTop;
|
|
53
|
+
});
|
|
54
|
+
onKeyStroke("k", (event) => {
|
|
55
|
+
if (!event.metaKey && !event.ctrlKey) return;
|
|
56
|
+
event.preventDefault();
|
|
57
|
+
searchInput.value?.$el?.focus();
|
|
58
|
+
});
|
|
59
|
+
const navigation = computed(() => {
|
|
60
|
+
const items = [];
|
|
61
|
+
for (const entry of Object.keys(getEponymeSchemas(config))) {
|
|
62
|
+
const parts = entry.split("/");
|
|
63
|
+
for (let depth = 0; depth < parts.length - 1; depth++) {
|
|
64
|
+
const path = parts.slice(0, depth + 1).join("/");
|
|
65
|
+
if (items.some((item) => item.kind === "folder" && item.path === path)) continue;
|
|
66
|
+
items.push({ kind: "folder", path });
|
|
67
|
+
}
|
|
68
|
+
items.push({ kind: "entry", path: entry });
|
|
69
|
+
}
|
|
70
|
+
for (const collection of Object.keys(collections)) {
|
|
71
|
+
const parts = collection.split("/");
|
|
72
|
+
for (let depth = 0; depth < parts.length; depth++) {
|
|
73
|
+
const path = parts.slice(0, depth + 1).join("/");
|
|
74
|
+
if (items.some((item) => item.kind === "folder" && item.path === path)) continue;
|
|
75
|
+
items.push({ kind: "folder", path });
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
for (const formName of Object.keys(forms)) {
|
|
79
|
+
const parts = formName.split("/");
|
|
80
|
+
for (let depth = 0; depth < parts.length - 1; depth++) {
|
|
81
|
+
const path = parts.slice(0, depth + 1).join("/");
|
|
82
|
+
if (items.some((item) => item.kind === "folder" && item.path === path)) continue;
|
|
83
|
+
items.push({ kind: "folder", path });
|
|
84
|
+
}
|
|
85
|
+
items.push({ kind: "entry", path: formName });
|
|
86
|
+
}
|
|
87
|
+
return items;
|
|
88
|
+
});
|
|
89
|
+
const navigationTree = computed(() => {
|
|
90
|
+
const root = [];
|
|
91
|
+
function addPath(pathValue, finalKind, configuredLabel) {
|
|
92
|
+
const parts = pathValue.split("/");
|
|
93
|
+
let children = root;
|
|
94
|
+
for (let index = 0; index < parts.length; index++) {
|
|
95
|
+
const part = parts[index];
|
|
96
|
+
const path = parts.slice(0, index + 1).join("/");
|
|
97
|
+
const kind = index === parts.length - 1 ? finalKind : "folder";
|
|
98
|
+
let node = children.find((item) => item.path === path);
|
|
99
|
+
if (!node) {
|
|
100
|
+
node = { kind, path, label: index === parts.length - 1 && configuredLabel ? configuredLabel : label(part), children: [] };
|
|
101
|
+
children.push(node);
|
|
102
|
+
} else if (index === parts.length - 1) {
|
|
103
|
+
node.kind = finalKind;
|
|
104
|
+
if (configuredLabel) node.label = configuredLabel;
|
|
105
|
+
}
|
|
106
|
+
children = node.children;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
for (const entry of Object.keys(getEponymeSchemas(config))) addPath(entry, "entry");
|
|
110
|
+
for (const [name, definition] of Object.entries(collections)) {
|
|
111
|
+
addPath(name, "collection", definition.label);
|
|
112
|
+
for (const entry of collectionEntries.value[name] ?? []) addPath(`${name}/${entry.slug}`, "entry", entry.title);
|
|
113
|
+
}
|
|
114
|
+
for (const [name, definition] of Object.entries(forms)) addPath(name, "form", definition.label);
|
|
115
|
+
return root;
|
|
116
|
+
});
|
|
117
|
+
const openFolders = useState(`eponyme:open-folders:${normalizedBasePath.value}`, () => navigation.value.filter((item) => item.kind === "folder").map((item) => item.path));
|
|
118
|
+
function label(name) {
|
|
119
|
+
return name.replace(/[-_]/g, " ").replace(/\b\w/g, (char) => char.toUpperCase());
|
|
120
|
+
}
|
|
121
|
+
function entryPath(name) {
|
|
122
|
+
return `${normalizedBasePath.value}/${name}`;
|
|
123
|
+
}
|
|
124
|
+
function isRouteInsideFolder(path) {
|
|
125
|
+
const target = entryPath(path);
|
|
126
|
+
return route.path === target || route.path.startsWith(`${target}/`);
|
|
127
|
+
}
|
|
128
|
+
watch(() => route.path, () => {
|
|
129
|
+
const next = new Set(openFolders.value);
|
|
130
|
+
for (const item of navigation.value) {
|
|
131
|
+
if (item.kind === "folder" && isRouteInsideFolder(item.path)) next.add(item.path);
|
|
132
|
+
}
|
|
133
|
+
openFolders.value = [...next];
|
|
134
|
+
});
|
|
135
|
+
</script>
|
|
136
|
+
|
|
137
|
+
<template>
|
|
138
|
+
<aside
|
|
139
|
+
class="eponyme-sidebar ep:flex ep:max-h-dvh ep:w-full ep:max-w-full ep:shrink-0 ep:flex-col ep:overflow-hidden ep:border-b ep:border-border-ep ep:bg-theme-ep ep:p-4 ep:transition-[width] ep:md:sticky ep:md:top-0 ep:md:h-dvh ep:md:border-r ep:md:border-b-0 ep:md:p-5"
|
|
140
|
+
:class="{ 'is-collapsed': collapsed }"
|
|
141
|
+
>
|
|
142
|
+
<div class="ep:flex ep:shrink-0 ep:items-center ep:justify-between ep:gap-2">
|
|
143
|
+
<NuxtLink
|
|
144
|
+
v-if="!collapsed"
|
|
145
|
+
:to="normalizedBasePath"
|
|
146
|
+
class="ep:flex ep:min-w-0 ep:items-center ep:gap-2 ep:px-3 ep:text-sm ep:font-bold ep:tracking-tight ep:text-white ep:no-underline"
|
|
147
|
+
>
|
|
148
|
+
Eponyme
|
|
149
|
+
</NuxtLink>
|
|
150
|
+
<button
|
|
151
|
+
type="button"
|
|
152
|
+
class="ep:flex ep:h-8 ep:w-8 ep:shrink-0 ep:cursor-pointer ep:items-center ep:justify-center ep:rounded-lg ep:border-0 ep:bg-transparent ep:text-muted-ep ep:transition ep:hover:bg-selected-ep ep:hover:text-white"
|
|
153
|
+
:aria-label="collapsed ? 'Expand sidebar' : 'Collapse sidebar'"
|
|
154
|
+
:title="collapsed ? 'Expand sidebar' : 'Collapse sidebar'"
|
|
155
|
+
@click="collapsed = !collapsed"
|
|
156
|
+
>
|
|
157
|
+
<Icon
|
|
158
|
+
:name="collapsed ? 'mingcute:layout-leftbar-open-line' : 'mingcute:layout-leftbar-close-line'"
|
|
159
|
+
size="18"
|
|
160
|
+
aria-hidden="true"
|
|
161
|
+
/>
|
|
162
|
+
</button>
|
|
163
|
+
</div>
|
|
164
|
+
<nav
|
|
165
|
+
v-if="!collapsed"
|
|
166
|
+
ref="navigationElement"
|
|
167
|
+
class="ep:mt-6 ep:grid ep:min-h-0 ep:min-w-0 ep:flex-1 ep:content-start ep:gap-1 ep:overflow-y-auto ep:overscroll-contain ep:pr-1"
|
|
168
|
+
aria-label="Content entries"
|
|
169
|
+
>
|
|
170
|
+
<div class="ep:relative ep:mb-3">
|
|
171
|
+
<Icon
|
|
172
|
+
name="mingcute:search-line"
|
|
173
|
+
size="17"
|
|
174
|
+
aria-hidden="true"
|
|
175
|
+
class="ep:pointer-events-none ep:absolute ep:top-1/2 ep:left-3 ep:-translate-y-1/2 ep:text-muted-ep"
|
|
176
|
+
/>
|
|
177
|
+
<EPInputText
|
|
178
|
+
ref="searchInput"
|
|
179
|
+
v-model="searchQuery"
|
|
180
|
+
padded
|
|
181
|
+
size="sm"
|
|
182
|
+
type="search"
|
|
183
|
+
placeholder="Search"
|
|
184
|
+
aria-label="Search content entries"
|
|
185
|
+
/>
|
|
186
|
+
<kbd class="ep:pointer-events-none ep:absolute ep:top-1/2 ep:right-2.5 ep:-translate-y-1/2 ep:rounded ep:border ep:border-border-ep ep:bg-theme-ep ep:px-1.5 ep:py-0.5 ep:font-sans ep:text-[10px] ep:font-medium ep:text-muted-ep">
|
|
187
|
+
⌘ K
|
|
188
|
+
</kbd>
|
|
189
|
+
</div>
|
|
190
|
+
<EponymeNavigationLink
|
|
191
|
+
:to="normalizedBasePath"
|
|
192
|
+
label="All entries"
|
|
193
|
+
:active="route.path === normalizedBasePath"
|
|
194
|
+
/>
|
|
195
|
+
<EponymeNavigationLink
|
|
196
|
+
v-if="auth.isOwner.value"
|
|
197
|
+
:to="`${normalizedBasePath}/users`"
|
|
198
|
+
label="Users"
|
|
199
|
+
:active="route.path === `${normalizedBasePath}/users`"
|
|
200
|
+
/>
|
|
201
|
+
<div
|
|
202
|
+
class="ep:my-3 ep:px-3 ep:text-[11px] ep:font-semibold ep:tracking-widest ep:text-muted-ep ep:uppercase"
|
|
203
|
+
>
|
|
204
|
+
Editables
|
|
205
|
+
</div>
|
|
206
|
+
<EponymeSidebarTree
|
|
207
|
+
:nodes="navigationTree"
|
|
208
|
+
:base-path="normalizedBasePath"
|
|
209
|
+
:current-path="route.path"
|
|
210
|
+
:statuses="statuses"
|
|
211
|
+
:open-folders="openFolders"
|
|
212
|
+
:can-edit="auth.canEdit.value"
|
|
213
|
+
@update:open-folders="openFolders = $event"
|
|
214
|
+
/>
|
|
215
|
+
</nav>
|
|
216
|
+
<div
|
|
217
|
+
v-if="!collapsed && auth.user.value"
|
|
218
|
+
class="ep:mt-5 ep:flex ep:shrink-0 ep:items-center ep:gap-3 ep:border-t ep:border-border-ep ep:px-2 ep:pt-4"
|
|
219
|
+
>
|
|
220
|
+
<EPAvatar
|
|
221
|
+
size="sm"
|
|
222
|
+
:fallback="auth.user.value.username"
|
|
223
|
+
/>
|
|
224
|
+
<div class="ep:min-w-0 ep:flex-1">
|
|
225
|
+
<p class="ep:m-0 ep:truncate ep:text-xs ep:font-semibold ep:text-white">
|
|
226
|
+
{{ auth.user.value.username }}
|
|
227
|
+
</p>
|
|
228
|
+
<p class="ep:mt-0.5 ep:mb-0 ep:text-[11px] ep:text-muted-ep ep:capitalize">
|
|
229
|
+
{{ auth.user.value.role }}
|
|
230
|
+
</p>
|
|
231
|
+
</div>
|
|
232
|
+
<EPButton
|
|
233
|
+
variant="ghost"
|
|
234
|
+
icon="mingcute:align-arrow-right-line"
|
|
235
|
+
aria-label="Log out"
|
|
236
|
+
@click="logout"
|
|
237
|
+
/>
|
|
238
|
+
</div>
|
|
239
|
+
</aside>
|
|
240
|
+
</template>
|
|
241
|
+
|
|
242
|
+
<style scoped>
|
|
243
|
+
@media (min-width:768px){.eponyme-sidebar{width:350px}.eponyme-sidebar.is-collapsed{width:76px}}
|
|
244
|
+
</style>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
basePath: string;
|
|
3
|
+
};
|
|
4
|
+
declare const __VLS_export: 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>;
|
|
5
|
+
declare const _default: typeof __VLS_export;
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { EponymeStatus } from '../../server/services/eponyme-store.js';
|
|
2
|
+
import type { EponymeNavigationNode } from '../../types/eponyme-navigation.js';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
nodes: EponymeNavigationNode[];
|
|
5
|
+
basePath: string;
|
|
6
|
+
currentPath: string;
|
|
7
|
+
statuses: Record<string, EponymeStatus>;
|
|
8
|
+
openFolders: string[];
|
|
9
|
+
canEdit?: boolean;
|
|
10
|
+
depth?: number;
|
|
11
|
+
};
|
|
12
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
13
|
+
"update:openFolders": (value: string[]) => any;
|
|
14
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
15
|
+
"onUpdate:openFolders"?: ((value: string[]) => any) | undefined;
|
|
16
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
17
|
+
declare const _default: typeof __VLS_export;
|
|
18
|
+
export default _default;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import EPAccordion from "../ui/EPAccordion.vue";
|
|
3
|
+
import EponymeNavigationLink from "./EponymeNavigationLink.vue";
|
|
4
|
+
defineOptions({ name: "EponymeSidebarTree" });
|
|
5
|
+
const props = defineProps({
|
|
6
|
+
nodes: { type: Array, required: true },
|
|
7
|
+
basePath: { type: String, required: true },
|
|
8
|
+
currentPath: { type: String, required: true },
|
|
9
|
+
statuses: { type: Object, required: true },
|
|
10
|
+
openFolders: { type: Array, required: true },
|
|
11
|
+
canEdit: { type: Boolean, required: false, default: false },
|
|
12
|
+
depth: { type: Number, required: false, default: 0 }
|
|
13
|
+
});
|
|
14
|
+
const emit = defineEmits(["update:openFolders"]);
|
|
15
|
+
function entryPath(path) {
|
|
16
|
+
return `${props.basePath}/${path}`;
|
|
17
|
+
}
|
|
18
|
+
function isOpen(path) {
|
|
19
|
+
return props.openFolders.includes(path);
|
|
20
|
+
}
|
|
21
|
+
function setOpen(path, open) {
|
|
22
|
+
const next = new Set(props.openFolders);
|
|
23
|
+
if (open) next.add(path);
|
|
24
|
+
else next.delete(path);
|
|
25
|
+
emit("update:openFolders", [...next]);
|
|
26
|
+
}
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<template>
|
|
30
|
+
<div class="ep:grid ep:w-full ep:min-w-0 ep:gap-1">
|
|
31
|
+
<template
|
|
32
|
+
v-for="node in nodes"
|
|
33
|
+
:key="`${node.kind}-${node.path}`"
|
|
34
|
+
>
|
|
35
|
+
<EPAccordion
|
|
36
|
+
v-if="node.kind === 'folder' || node.kind === 'collection'"
|
|
37
|
+
:value="node.path"
|
|
38
|
+
:model-value="isOpen(node.path)"
|
|
39
|
+
@update:model-value="setOpen(node.path, $event)"
|
|
40
|
+
>
|
|
41
|
+
<template #header>
|
|
42
|
+
<EponymeNavigationLink
|
|
43
|
+
:to="entryPath(node.path)"
|
|
44
|
+
:label="node.label"
|
|
45
|
+
:depth="depth"
|
|
46
|
+
folder
|
|
47
|
+
:collection="node.kind === 'collection'"
|
|
48
|
+
:active="currentPath === entryPath(node.path)"
|
|
49
|
+
/>
|
|
50
|
+
</template>
|
|
51
|
+
<template
|
|
52
|
+
v-if="node.kind === 'collection' && canEdit"
|
|
53
|
+
#action
|
|
54
|
+
>
|
|
55
|
+
<NuxtLink
|
|
56
|
+
:to="{ path: entryPath(node.path), query: { create: '1' } }"
|
|
57
|
+
class="ep:flex ep:h-7 ep:w-7 ep:items-center ep:justify-center ep:rounded-md ep:text-lg ep:font-medium ep:text-muted-ep ep:no-underline ep:transition ep:hover:bg-theme-ep ep:hover:text-white ep:focus-visible:outline-none ep:focus-visible:ring-2 ep:focus-visible:ring-white/20"
|
|
58
|
+
:aria-label="`Create in ${node.label}`"
|
|
59
|
+
title="Create entry"
|
|
60
|
+
@click.stop
|
|
61
|
+
>+</NuxtLink>
|
|
62
|
+
</template>
|
|
63
|
+
<EponymeSidebarTree
|
|
64
|
+
:nodes="node.children"
|
|
65
|
+
:base-path="basePath"
|
|
66
|
+
:current-path="currentPath"
|
|
67
|
+
:statuses="statuses"
|
|
68
|
+
:open-folders="openFolders"
|
|
69
|
+
:can-edit="canEdit"
|
|
70
|
+
:depth="depth + 1"
|
|
71
|
+
@update:open-folders="emit('update:openFolders', $event)"
|
|
72
|
+
/>
|
|
73
|
+
</EPAccordion>
|
|
74
|
+
<EponymeNavigationLink
|
|
75
|
+
v-else
|
|
76
|
+
:to="entryPath(node.path)"
|
|
77
|
+
:label="node.label"
|
|
78
|
+
:depth="depth"
|
|
79
|
+
:active="currentPath === entryPath(node.path)"
|
|
80
|
+
:draft="statuses[node.path] === 'draft'"
|
|
81
|
+
/>
|
|
82
|
+
</template>
|
|
83
|
+
</div>
|
|
84
|
+
</template>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { EponymeStatus } from '../../server/services/eponyme-store.js';
|
|
2
|
+
import type { EponymeNavigationNode } from '../../types/eponyme-navigation.js';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
nodes: EponymeNavigationNode[];
|
|
5
|
+
basePath: string;
|
|
6
|
+
currentPath: string;
|
|
7
|
+
statuses: Record<string, EponymeStatus>;
|
|
8
|
+
openFolders: string[];
|
|
9
|
+
canEdit?: boolean;
|
|
10
|
+
depth?: number;
|
|
11
|
+
};
|
|
12
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
13
|
+
"update:openFolders": (value: string[]) => any;
|
|
14
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
15
|
+
"onUpdate:openFolders"?: ((value: string[]) => any) | undefined;
|
|
16
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
17
|
+
declare const _default: typeof __VLS_export;
|
|
18
|
+
export default _default;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ArrayFieldDefinition } from '../../types/index.js';
|
|
2
|
+
import type { ValidationErrors } from '../../utils/validate-eponyme-data.js';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
fieldName: string;
|
|
5
|
+
definition: ArrayFieldDefinition;
|
|
6
|
+
modelValue: unknown;
|
|
7
|
+
/** Dotted path of this array; items extend it with their index. */
|
|
8
|
+
path?: string;
|
|
9
|
+
/** Errors of this subtree, keyed relative to this array (`0.title`, `1`). */
|
|
10
|
+
errors?: ValidationErrors;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
};
|
|
13
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
14
|
+
"update:modelValue": (value: unknown[]) => any;
|
|
15
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
16
|
+
"onUpdate:modelValue"?: ((value: unknown[]) => any) | undefined;
|
|
17
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
18
|
+
declare const _default: typeof __VLS_export;
|
|
19
|
+
export default _default;
|