@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,135 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, provide, reactive, toRef } from "vue";
|
|
3
|
+
import BooleanField from "./BooleanField.vue";
|
|
4
|
+
import CheckboxGroupField from "./CheckboxGroupField.vue";
|
|
5
|
+
import ColorField from "./ColorField.vue";
|
|
6
|
+
import DateField from "./DateField.vue";
|
|
7
|
+
import NumberField from "./NumberField.vue";
|
|
8
|
+
import RadioField from "./RadioField.vue";
|
|
9
|
+
import RichTextField from "./RichTextField.vue";
|
|
10
|
+
import SelectField from "./SelectField.vue";
|
|
11
|
+
import SlugField from "./SlugField.vue";
|
|
12
|
+
import TextareaField from "./TextareaField.vue";
|
|
13
|
+
import TextField from "./TextField.vue";
|
|
14
|
+
import UrlField from "./UrlField.vue";
|
|
15
|
+
import { formFieldContextKey } from "../ui/form-field-context";
|
|
16
|
+
import { humanizeLabel } from "../../utils/humanize-label";
|
|
17
|
+
import { fieldPathId } from "../../utils/field-path";
|
|
18
|
+
const props = defineProps({
|
|
19
|
+
fieldName: { type: String, required: true },
|
|
20
|
+
field: { type: Object, required: true },
|
|
21
|
+
modelValue: { type: null, required: false },
|
|
22
|
+
path: { type: String, required: false },
|
|
23
|
+
id: { type: String, required: false },
|
|
24
|
+
errors: { type: Array, required: false, default: () => [] },
|
|
25
|
+
disabled: { type: Boolean, required: false },
|
|
26
|
+
hideLabel: { type: Boolean, required: false },
|
|
27
|
+
compact: { type: Boolean, required: false }
|
|
28
|
+
});
|
|
29
|
+
const emit = defineEmits(["update:modelValue", "enter"]);
|
|
30
|
+
provide(formFieldContextKey, reactive({
|
|
31
|
+
hideLabel: toRef(props, "hideLabel"),
|
|
32
|
+
compact: toRef(props, "compact")
|
|
33
|
+
}));
|
|
34
|
+
const path = computed(() => props.path || props.fieldName);
|
|
35
|
+
const id = computed(() => props.id || fieldPathId(path.value));
|
|
36
|
+
const label = computed(() => humanizeLabel(props.fieldName, props.field.options.label));
|
|
37
|
+
const multiline = computed(() => props.field.type === "textarea" || props.field.type === "richText");
|
|
38
|
+
const component = computed(() => {
|
|
39
|
+
switch (props.field.type) {
|
|
40
|
+
case "richText":
|
|
41
|
+
return RichTextField;
|
|
42
|
+
case "textarea":
|
|
43
|
+
return TextareaField;
|
|
44
|
+
case "slug":
|
|
45
|
+
return SlugField;
|
|
46
|
+
case "boolean":
|
|
47
|
+
return BooleanField;
|
|
48
|
+
case "radio":
|
|
49
|
+
return RadioField;
|
|
50
|
+
case "checkboxGroup":
|
|
51
|
+
return CheckboxGroupField;
|
|
52
|
+
case "number":
|
|
53
|
+
return NumberField;
|
|
54
|
+
case "select":
|
|
55
|
+
return SelectField;
|
|
56
|
+
case "date":
|
|
57
|
+
return DateField;
|
|
58
|
+
case "color":
|
|
59
|
+
return ColorField;
|
|
60
|
+
case "url":
|
|
61
|
+
return UrlField;
|
|
62
|
+
default:
|
|
63
|
+
return TextField;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
const specificProps = computed(() => {
|
|
67
|
+
const field = props.field;
|
|
68
|
+
switch (field.type) {
|
|
69
|
+
case "richText":
|
|
70
|
+
case "textarea":
|
|
71
|
+
case "slug":
|
|
72
|
+
return {
|
|
73
|
+
placeholder: field.options.placeholder,
|
|
74
|
+
minLength: field.options.minLength,
|
|
75
|
+
maxLength: field.options.maxLength,
|
|
76
|
+
showCounter: field.options.showCounter
|
|
77
|
+
};
|
|
78
|
+
case "radio":
|
|
79
|
+
case "checkboxGroup":
|
|
80
|
+
return { options: field.options.options };
|
|
81
|
+
case "select":
|
|
82
|
+
return { options: field.options.options, placeholder: field.options.placeholder };
|
|
83
|
+
case "number":
|
|
84
|
+
return {
|
|
85
|
+
min: field.options.min,
|
|
86
|
+
max: field.options.max,
|
|
87
|
+
step: field.options.step,
|
|
88
|
+
slider: field.options.slider
|
|
89
|
+
};
|
|
90
|
+
case "date":
|
|
91
|
+
return { min: field.options.min, max: field.options.max };
|
|
92
|
+
case "boolean":
|
|
93
|
+
return {};
|
|
94
|
+
case "color":
|
|
95
|
+
return { presets: field.options.presets };
|
|
96
|
+
case "url":
|
|
97
|
+
return { placeholder: field.options.placeholder };
|
|
98
|
+
default: {
|
|
99
|
+
const options = field.options;
|
|
100
|
+
return {
|
|
101
|
+
inputType: field.type === "image" ? "url" : field.type === "email" ? "email" : "text",
|
|
102
|
+
placeholder: options.placeholder,
|
|
103
|
+
minLength: options.minLength,
|
|
104
|
+
maxLength: options.maxLength,
|
|
105
|
+
showCounter: options.showCounter,
|
|
106
|
+
preview: field.type === "image"
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
function handleKeydown(event) {
|
|
112
|
+
if (multiline.value || event.shiftKey) return;
|
|
113
|
+
emit("enter");
|
|
114
|
+
}
|
|
115
|
+
</script>
|
|
116
|
+
|
|
117
|
+
<template>
|
|
118
|
+
<div
|
|
119
|
+
class="ep:min-w-0"
|
|
120
|
+
@keydown.enter="handleKeydown"
|
|
121
|
+
>
|
|
122
|
+
<component
|
|
123
|
+
:is="component"
|
|
124
|
+
:id="id"
|
|
125
|
+
:model-value="modelValue"
|
|
126
|
+
:label="label"
|
|
127
|
+
:description="field.options.description"
|
|
128
|
+
:required="field.options.required"
|
|
129
|
+
:errors="errors"
|
|
130
|
+
:disabled="disabled"
|
|
131
|
+
v-bind="specificProps"
|
|
132
|
+
@update:model-value="emit('update:modelValue', $event)"
|
|
133
|
+
/>
|
|
134
|
+
</div>
|
|
135
|
+
</template>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { FieldDefinition } from '../../types/index.js';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
fieldName: string;
|
|
4
|
+
field: Exclude<FieldDefinition, {
|
|
5
|
+
type: 'array' | 'section' | 'tabs';
|
|
6
|
+
}>;
|
|
7
|
+
modelValue?: unknown;
|
|
8
|
+
/** Dotted path of this field in the document; defaults to its name at the root. */
|
|
9
|
+
path?: string;
|
|
10
|
+
id?: string;
|
|
11
|
+
errors?: string[];
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
hideLabel?: boolean;
|
|
14
|
+
compact?: boolean;
|
|
15
|
+
};
|
|
16
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
17
|
+
"update:modelValue": (value: unknown) => any;
|
|
18
|
+
enter: () => any;
|
|
19
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
20
|
+
"onUpdate:modelValue"?: ((value: unknown) => any) | undefined;
|
|
21
|
+
onEnter?: (() => any) | undefined;
|
|
22
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
23
|
+
declare const _default: typeof __VLS_export;
|
|
24
|
+
export default _default;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
id: string;
|
|
3
|
+
modelValue?: unknown;
|
|
4
|
+
label: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
required?: boolean;
|
|
7
|
+
min?: number;
|
|
8
|
+
max?: number;
|
|
9
|
+
step?: number;
|
|
10
|
+
slider?: boolean;
|
|
11
|
+
errors?: string[];
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
};
|
|
14
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
15
|
+
"update:modelValue": (value: string | number) => any;
|
|
16
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
17
|
+
"onUpdate:modelValue"?: ((value: string | number) => any) | undefined;
|
|
18
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
19
|
+
declare const _default: typeof __VLS_export;
|
|
20
|
+
export default _default;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import EPFormField from "../ui/EPFormField.vue";
|
|
3
|
+
import EPInputText from "../ui/EPInputText.vue";
|
|
4
|
+
import EPSlider from "../ui/EPSlider.vue";
|
|
5
|
+
defineProps({
|
|
6
|
+
id: { type: String, required: true },
|
|
7
|
+
modelValue: { type: null, required: false },
|
|
8
|
+
label: { type: String, required: true },
|
|
9
|
+
description: { type: String, required: false },
|
|
10
|
+
required: { type: Boolean, required: false },
|
|
11
|
+
min: { type: Number, required: false },
|
|
12
|
+
max: { type: Number, required: false },
|
|
13
|
+
step: { type: Number, required: false },
|
|
14
|
+
slider: { type: Boolean, required: false },
|
|
15
|
+
errors: { type: Array, required: false, default: () => [] },
|
|
16
|
+
disabled: { type: Boolean, required: false }
|
|
17
|
+
});
|
|
18
|
+
const emit = defineEmits(["update:modelValue"]);
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<template>
|
|
22
|
+
<EPFormField
|
|
23
|
+
:id="id"
|
|
24
|
+
:label="label"
|
|
25
|
+
:description="description"
|
|
26
|
+
:required="required"
|
|
27
|
+
:errors="errors"
|
|
28
|
+
>
|
|
29
|
+
<EPInputText
|
|
30
|
+
v-if="!slider"
|
|
31
|
+
:id="id"
|
|
32
|
+
:model-value="typeof modelValue === 'number' ? modelValue : ''"
|
|
33
|
+
type="number"
|
|
34
|
+
:min="min"
|
|
35
|
+
:max="max"
|
|
36
|
+
:step="step"
|
|
37
|
+
:required="required"
|
|
38
|
+
:invalid="Boolean(errors.length)"
|
|
39
|
+
:disabled="disabled"
|
|
40
|
+
@update:model-value="emit('update:modelValue', $event)"
|
|
41
|
+
/>
|
|
42
|
+
<ClientOnly v-else>
|
|
43
|
+
<EPSlider
|
|
44
|
+
:id="id"
|
|
45
|
+
:label="label"
|
|
46
|
+
:model-value="typeof modelValue === 'number' ? modelValue : void 0"
|
|
47
|
+
:min="min"
|
|
48
|
+
:max="max"
|
|
49
|
+
:step="step"
|
|
50
|
+
:disabled="disabled"
|
|
51
|
+
@update:model-value="emit('update:modelValue', $event)"
|
|
52
|
+
/>
|
|
53
|
+
<template #fallback>
|
|
54
|
+
<span class="ep:block ep:h-10 ep:w-full ep:rounded-lg ep:bg-selected-ep" />
|
|
55
|
+
</template>
|
|
56
|
+
</ClientOnly>
|
|
57
|
+
</EPFormField>
|
|
58
|
+
</template>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
id: string;
|
|
3
|
+
modelValue?: unknown;
|
|
4
|
+
label: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
required?: boolean;
|
|
7
|
+
min?: number;
|
|
8
|
+
max?: number;
|
|
9
|
+
step?: number;
|
|
10
|
+
slider?: boolean;
|
|
11
|
+
errors?: string[];
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
};
|
|
14
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
15
|
+
"update:modelValue": (value: string | number) => any;
|
|
16
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
17
|
+
"onUpdate:modelValue"?: ((value: string | number) => any) | undefined;
|
|
18
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
19
|
+
declare const _default: typeof __VLS_export;
|
|
20
|
+
export default _default;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
id: string;
|
|
3
|
+
modelValue?: unknown;
|
|
4
|
+
label: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
required?: boolean;
|
|
7
|
+
options: ReadonlyArray<{
|
|
8
|
+
label: string;
|
|
9
|
+
value: string;
|
|
10
|
+
}>;
|
|
11
|
+
errors?: string[];
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
};
|
|
14
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
15
|
+
"update:modelValue": (value: string) => any;
|
|
16
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
17
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
18
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
19
|
+
declare const _default: typeof __VLS_export;
|
|
20
|
+
export default _default;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import EPFormField from "../ui/EPFormField.vue";
|
|
3
|
+
import EPRadioButton from "../ui/EPRadioButton.vue";
|
|
4
|
+
defineProps({
|
|
5
|
+
id: { type: String, required: true },
|
|
6
|
+
modelValue: { type: null, required: false },
|
|
7
|
+
label: { type: String, required: true },
|
|
8
|
+
description: { type: String, required: false },
|
|
9
|
+
required: { type: Boolean, required: false },
|
|
10
|
+
options: { type: Array, required: true },
|
|
11
|
+
errors: { type: Array, required: false, default: () => [] },
|
|
12
|
+
disabled: { type: Boolean, required: false }
|
|
13
|
+
});
|
|
14
|
+
const emit = defineEmits(["update:modelValue"]);
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<template>
|
|
18
|
+
<EPFormField
|
|
19
|
+
:id="id"
|
|
20
|
+
:label="label"
|
|
21
|
+
:description="description"
|
|
22
|
+
:required="required"
|
|
23
|
+
:errors="errors"
|
|
24
|
+
>
|
|
25
|
+
<ClientOnly>
|
|
26
|
+
<EPRadioButton
|
|
27
|
+
:model-value="typeof modelValue === 'string' ? modelValue : ''"
|
|
28
|
+
:options="options"
|
|
29
|
+
:required="required"
|
|
30
|
+
:disabled="disabled"
|
|
31
|
+
@update:model-value="emit('update:modelValue', $event)"
|
|
32
|
+
/>
|
|
33
|
+
<template #fallback>
|
|
34
|
+
<div class="ep:grid ep:gap-2 ep:sm:grid-cols-2">
|
|
35
|
+
<div
|
|
36
|
+
v-for="option in options"
|
|
37
|
+
:key="option.value"
|
|
38
|
+
class="ep:h-12 ep:rounded-xl ep:border ep:border-border-ep ep:bg-selected-ep/40"
|
|
39
|
+
/>
|
|
40
|
+
</div>
|
|
41
|
+
</template>
|
|
42
|
+
</ClientOnly>
|
|
43
|
+
</EPFormField>
|
|
44
|
+
</template>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
id: string;
|
|
3
|
+
modelValue?: unknown;
|
|
4
|
+
label: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
required?: boolean;
|
|
7
|
+
options: ReadonlyArray<{
|
|
8
|
+
label: string;
|
|
9
|
+
value: string;
|
|
10
|
+
}>;
|
|
11
|
+
errors?: string[];
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
};
|
|
14
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
15
|
+
"update:modelValue": (value: string) => any;
|
|
16
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
17
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
18
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
19
|
+
declare const _default: typeof __VLS_export;
|
|
20
|
+
export default _default;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
id: string;
|
|
3
|
+
modelValue?: unknown;
|
|
4
|
+
label: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
required?: boolean;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
minLength?: number;
|
|
9
|
+
maxLength?: number;
|
|
10
|
+
showCounter?: boolean;
|
|
11
|
+
errors?: string[];
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
};
|
|
14
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
15
|
+
"update:modelValue": (value: string) => any;
|
|
16
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
17
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
18
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
19
|
+
declare const _default: typeof __VLS_export;
|
|
20
|
+
export default _default;
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import Image from "@tiptap/extension-image";
|
|
3
|
+
import Placeholder from "@tiptap/extension-placeholder";
|
|
4
|
+
import StarterKit from "@tiptap/starter-kit";
|
|
5
|
+
import { EditorContent, useEditor } from "@tiptap/vue-3";
|
|
6
|
+
import { computed, ref, watch } from "vue";
|
|
7
|
+
import EPFormField from "../ui/EPFormField.vue";
|
|
8
|
+
const props = defineProps({
|
|
9
|
+
id: { type: String, required: true },
|
|
10
|
+
modelValue: { type: null, required: false },
|
|
11
|
+
label: { type: String, required: true },
|
|
12
|
+
description: { type: String, required: false },
|
|
13
|
+
required: { type: Boolean, required: false },
|
|
14
|
+
placeholder: { type: String, required: false, default: "Start writing\u2026" },
|
|
15
|
+
minLength: { type: Number, required: false },
|
|
16
|
+
maxLength: { type: Number, required: false },
|
|
17
|
+
showCounter: { type: Boolean, required: false },
|
|
18
|
+
errors: { type: Array, required: false, default: () => [] },
|
|
19
|
+
disabled: { type: Boolean, required: false }
|
|
20
|
+
});
|
|
21
|
+
const emit = defineEmits(["update:modelValue"]);
|
|
22
|
+
const revision = ref(0);
|
|
23
|
+
const initialContent = typeof props.modelValue === "string" ? props.modelValue : "";
|
|
24
|
+
const editor = useEditor({
|
|
25
|
+
content: initialContent,
|
|
26
|
+
editable: !props.disabled,
|
|
27
|
+
extensions: [
|
|
28
|
+
StarterKit.configure({
|
|
29
|
+
heading: { levels: [2, 3] },
|
|
30
|
+
link: {
|
|
31
|
+
openOnClick: false,
|
|
32
|
+
autolink: true,
|
|
33
|
+
defaultProtocol: "https",
|
|
34
|
+
HTMLAttributes: { rel: "noopener noreferrer" }
|
|
35
|
+
}
|
|
36
|
+
}),
|
|
37
|
+
Placeholder.configure({ placeholder: props.placeholder }),
|
|
38
|
+
Image.configure({ HTMLAttributes: { class: "eponyme-rich-text-image" } })
|
|
39
|
+
],
|
|
40
|
+
onTransaction: () => revision.value++,
|
|
41
|
+
onUpdate: ({ editor: editor2 }) => emit("update:modelValue", editor2.isEmpty ? "" : editor2.getHTML())
|
|
42
|
+
});
|
|
43
|
+
function trackEditorRevision() {
|
|
44
|
+
return revision.value;
|
|
45
|
+
}
|
|
46
|
+
const characterCount = computed(() => {
|
|
47
|
+
trackEditorRevision();
|
|
48
|
+
return editor.value?.getText().length ?? 0;
|
|
49
|
+
});
|
|
50
|
+
watch(() => props.modelValue, (value) => {
|
|
51
|
+
const instance = editor.value;
|
|
52
|
+
if (!instance) return;
|
|
53
|
+
const next = typeof value === "string" ? value : "";
|
|
54
|
+
const current = instance.isEmpty ? "" : instance.getHTML();
|
|
55
|
+
if (next !== current) instance.commands.setContent(next, { emitUpdate: false });
|
|
56
|
+
});
|
|
57
|
+
watch(() => props.disabled, (disabled) => editor.value?.setEditable(!disabled));
|
|
58
|
+
function isActive(name, attributes = {}) {
|
|
59
|
+
trackEditorRevision();
|
|
60
|
+
return editor.value?.isActive(name, attributes) ?? false;
|
|
61
|
+
}
|
|
62
|
+
function setLink() {
|
|
63
|
+
const instance = editor.value;
|
|
64
|
+
if (!instance) return;
|
|
65
|
+
const current = String(instance.getAttributes("link").href ?? "");
|
|
66
|
+
const href = window.prompt("Link URL", current || "https://");
|
|
67
|
+
if (href === null) return;
|
|
68
|
+
if (!href.trim()) {
|
|
69
|
+
instance.chain().focus().extendMarkRange("link").unsetLink().run();
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
instance.chain().focus().extendMarkRange("link").setLink({ href: href.trim() }).run();
|
|
73
|
+
}
|
|
74
|
+
function setImage() {
|
|
75
|
+
const instance = editor.value;
|
|
76
|
+
if (!instance) return;
|
|
77
|
+
const src = window.prompt("Image URL", "https://");
|
|
78
|
+
if (src === null || !src.trim()) return;
|
|
79
|
+
if (!/^https?:\/\//i.test(src.trim())) {
|
|
80
|
+
window.alert("Must be an HTTP(S) URL.");
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
const alt = window.prompt("Alt text (describe the image)", "") ?? "";
|
|
84
|
+
instance.chain().focus().setImage({ src: src.trim(), alt: alt.trim() }).run();
|
|
85
|
+
}
|
|
86
|
+
const tools = computed(() => {
|
|
87
|
+
const instance = editor.value;
|
|
88
|
+
if (!instance) return [];
|
|
89
|
+
trackEditorRevision();
|
|
90
|
+
return [
|
|
91
|
+
{ icon: "mingcute:paragraph-line", title: "Paragraph", active: isActive("paragraph"), run: () => instance.chain().focus().setParagraph().run() },
|
|
92
|
+
{ icon: "mingcute:heading-2-line", title: "Heading 2", active: isActive("heading", { level: 2 }), run: () => instance.chain().focus().toggleHeading({ level: 2 }).run() },
|
|
93
|
+
{ icon: "mingcute:heading-3-line", title: "Heading 3", active: isActive("heading", { level: 3 }), run: () => instance.chain().focus().toggleHeading({ level: 3 }).run() },
|
|
94
|
+
{ icon: "mingcute:bold-line", title: "Bold", active: isActive("bold"), separated: true, run: () => instance.chain().focus().toggleBold().run() },
|
|
95
|
+
{ icon: "mingcute:italic-line", title: "Italic", active: isActive("italic"), run: () => instance.chain().focus().toggleItalic().run() },
|
|
96
|
+
{ icon: "mingcute:strikethrough-line", title: "Strikethrough", active: isActive("strike"), run: () => instance.chain().focus().toggleStrike().run() },
|
|
97
|
+
{ icon: "mingcute:link-line", title: "Link", active: isActive("link"), run: setLink },
|
|
98
|
+
{ icon: "mingcute:pic-line", title: "Image", active: isActive("image"), run: setImage },
|
|
99
|
+
{ icon: "mingcute:list-check-line", title: "Bullet list", active: isActive("bulletList"), separated: true, run: () => instance.chain().focus().toggleBulletList().run() },
|
|
100
|
+
{ icon: "mingcute:list-ordered-line", title: "Numbered list", active: isActive("orderedList"), run: () => instance.chain().focus().toggleOrderedList().run() },
|
|
101
|
+
{ icon: "mingcute:quote-left-line", title: "Quote", active: isActive("blockquote"), run: () => instance.chain().focus().toggleBlockquote().run() },
|
|
102
|
+
{ icon: "mingcute:back-2-line", title: "Undo", separated: true, disabled: !instance.can().chain().focus().undo().run(), run: () => instance.chain().focus().undo().run() },
|
|
103
|
+
{ icon: "mingcute:forward-2-line", title: "Redo", disabled: !instance.can().chain().focus().redo().run(), run: () => instance.chain().focus().redo().run() }
|
|
104
|
+
];
|
|
105
|
+
});
|
|
106
|
+
</script>
|
|
107
|
+
|
|
108
|
+
<template>
|
|
109
|
+
<EPFormField
|
|
110
|
+
:id="id"
|
|
111
|
+
:label="label"
|
|
112
|
+
:description="description"
|
|
113
|
+
:required="required"
|
|
114
|
+
:errors="errors"
|
|
115
|
+
>
|
|
116
|
+
<div
|
|
117
|
+
class="eponyme-rich-text ep:overflow-hidden ep:rounded-xl ep:bg-selected-ep ep:ring-white/10 ep:focus-within:ring-2"
|
|
118
|
+
:class="{ 'ep:opacity-60': disabled, 'ep:ring-2 ep:ring-danger-ep/40': errors.length }"
|
|
119
|
+
>
|
|
120
|
+
<div
|
|
121
|
+
v-if="editor"
|
|
122
|
+
class="ep:flex ep:flex-wrap ep:items-center ep:gap-1 ep:border-b ep:border-border-ep ep:p-2"
|
|
123
|
+
role="toolbar"
|
|
124
|
+
:aria-label="`${label} formatting`"
|
|
125
|
+
>
|
|
126
|
+
<template
|
|
127
|
+
v-for="tool in tools"
|
|
128
|
+
:key="tool.title"
|
|
129
|
+
>
|
|
130
|
+
<span
|
|
131
|
+
v-if="tool.separated"
|
|
132
|
+
class="ep:mx-1 ep:h-5 ep:w-px ep:bg-border-ep"
|
|
133
|
+
/>
|
|
134
|
+
<button
|
|
135
|
+
type="button"
|
|
136
|
+
class="rich-text-tool"
|
|
137
|
+
:class="{ 'is-active': tool.active }"
|
|
138
|
+
:disabled="disabled || tool.disabled"
|
|
139
|
+
:title="tool.title"
|
|
140
|
+
:aria-label="tool.title"
|
|
141
|
+
:aria-pressed="tool.active"
|
|
142
|
+
@mousedown.prevent="tool.run()"
|
|
143
|
+
>
|
|
144
|
+
<Icon
|
|
145
|
+
:name="tool.icon"
|
|
146
|
+
size="18"
|
|
147
|
+
aria-hidden="true"
|
|
148
|
+
/>
|
|
149
|
+
</button>
|
|
150
|
+
</template>
|
|
151
|
+
</div>
|
|
152
|
+
<EditorContent
|
|
153
|
+
v-if="editor"
|
|
154
|
+
:id="id"
|
|
155
|
+
:editor="editor"
|
|
156
|
+
class="ep:min-h-72"
|
|
157
|
+
/>
|
|
158
|
+
<div
|
|
159
|
+
v-else
|
|
160
|
+
class="ep:min-h-72 ep:p-5 ep:text-sm ep:text-muted-ep"
|
|
161
|
+
>
|
|
162
|
+
Loading editor…
|
|
163
|
+
</div>
|
|
164
|
+
</div>
|
|
165
|
+
<p
|
|
166
|
+
v-if="maxLength !== void 0 && showCounter !== false"
|
|
167
|
+
class="ep:mt-1.5 ep:mb-0 ep:text-right ep:text-[11px] ep:text-muted-ep"
|
|
168
|
+
>
|
|
169
|
+
{{ characterCount }} / {{ maxLength }}
|
|
170
|
+
</p>
|
|
171
|
+
</EPFormField>
|
|
172
|
+
</template>
|
|
173
|
+
|
|
174
|
+
<style scoped>
|
|
175
|
+
.rich-text-tool{align-items:center;background:transparent;border:0;border-radius:.45rem;color:var(--ep-color-muted-ep,#8d8d8d);cursor:pointer;display:flex;font-family:inherit;font-size:.75rem;font-weight:650;height:2rem;justify-content:center;min-width:2rem;padding:0 .55rem;transition:color .15s ease,background-color .15s ease}.rich-text-tool.is-active,.rich-text-tool:hover{background:var(--ep-color-theme-ep,#1c1c1c);color:#fff}.rich-text-tool:disabled{cursor:not-allowed;opacity:.35}.eponyme-rich-text :deep(.tiptap){color:var(--ep-color-text-ep,#e7e7e7);font-size:.925rem;line-height:1.75;min-height:18rem;outline:none;padding:1.25rem}.eponyme-rich-text :deep(.tiptap>:first-child){margin-top:0}.eponyme-rich-text :deep(.tiptap>:last-child){margin-bottom:0}.eponyme-rich-text :deep(.tiptap h2){font-size:1.5rem;line-height:1.25;margin:1.5rem 0 .75rem}.eponyme-rich-text :deep(.tiptap h3){font-size:1.2rem;line-height:1.3;margin:1.25rem 0 .625rem}.eponyme-rich-text :deep(.tiptap blockquote),.eponyme-rich-text :deep(.tiptap ol),.eponyme-rich-text :deep(.tiptap p),.eponyme-rich-text :deep(.tiptap ul){margin:.75rem 0}.eponyme-rich-text :deep(.tiptap ol),.eponyme-rich-text :deep(.tiptap ul){padding-left:1.5rem}.eponyme-rich-text :deep(.tiptap blockquote){border-left:2px solid var(--ep-color-muted-ep,#8d8d8d);color:var(--ep-color-muted-ep,#8d8d8d);padding-left:1rem}.eponyme-rich-text :deep(.tiptap img){border-radius:.75rem;height:auto;max-width:100%}.eponyme-rich-text :deep(.tiptap img.ProseMirror-selectednode){outline:2px solid #fff;outline-offset:2px}.eponyme-rich-text :deep(.tiptap a){color:#fff;text-decoration:underline;text-underline-offset:3px}.eponyme-rich-text :deep(.tiptap p.is-editor-empty:first-child:before){color:var(--ep-color-muted-ep,#8d8d8d);content:attr(data-placeholder);float:left;height:0;pointer-events:none}
|
|
176
|
+
</style>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
id: string;
|
|
3
|
+
modelValue?: unknown;
|
|
4
|
+
label: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
required?: boolean;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
minLength?: number;
|
|
9
|
+
maxLength?: number;
|
|
10
|
+
showCounter?: boolean;
|
|
11
|
+
errors?: string[];
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
};
|
|
14
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
15
|
+
"update:modelValue": (value: string) => any;
|
|
16
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
17
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
18
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
19
|
+
declare const _default: typeof __VLS_export;
|
|
20
|
+
export default _default;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { SectionFieldDefinition } from '../../types/index.js';
|
|
2
|
+
import type { ValidationErrors } from '../../utils/validate-eponyme-data.js';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
fieldName: string;
|
|
5
|
+
definition: SectionFieldDefinition;
|
|
6
|
+
modelValue: unknown;
|
|
7
|
+
/** Dotted path of this section; children extend it. */
|
|
8
|
+
path?: string;
|
|
9
|
+
/** Errors of this subtree, keyed relative to this section. */
|
|
10
|
+
errors?: ValidationErrors;
|
|
11
|
+
hideHeader?: boolean;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
};
|
|
14
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
15
|
+
"update:modelValue": (value: Record<string, unknown>) => any;
|
|
16
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
17
|
+
"onUpdate:modelValue"?: ((value: Record<string, unknown>) => any) | undefined;
|
|
18
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
19
|
+
declare const _default: typeof __VLS_export;
|
|
20
|
+
export default _default;
|