@hywax/cms 0.0.22 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (182) hide show
  1. package/.nuxt/cms/editor/index.ts +0 -2
  2. package/.nuxt/cms/form-panel-section.ts +2 -2
  3. package/.nuxt/cms/index.ts +8 -21
  4. package/.nuxt/cms/table-search-input.ts +6 -0
  5. package/dist/module.json +3 -3
  6. package/dist/module.mjs +78 -182
  7. package/dist/runtime/components/AutocompleteSelect.d.vue.ts +56 -0
  8. package/dist/runtime/components/AutocompleteSelect.vue +131 -77
  9. package/dist/runtime/components/AutocompleteSelect.vue.d.ts +43 -29
  10. package/dist/runtime/components/{ButtonDelete.vue.d.ts → ButtonDeleteConfirm.d.vue.ts} +4 -3
  11. package/dist/runtime/components/{ButtonDelete.vue → ButtonDeleteConfirm.vue} +1 -1
  12. package/dist/runtime/components/ButtonDeleteConfirm.vue.d.ts +36 -0
  13. package/dist/runtime/components/DatePicker.d.vue.ts +43 -0
  14. package/dist/runtime/components/DatePicker.vue +232 -0
  15. package/dist/runtime/components/DatePicker.vue.d.ts +43 -0
  16. package/dist/runtime/components/EditorFull.d.vue.ts +13 -0
  17. package/dist/runtime/components/EditorFull.vue +127 -0
  18. package/dist/runtime/components/EditorFull.vue.d.ts +13 -0
  19. package/dist/runtime/components/EditorLinkPopover.d.vue.ts +8 -0
  20. package/dist/runtime/components/EditorLinkPopover.vue +137 -0
  21. package/dist/runtime/components/EditorLinkPopover.vue.d.ts +8 -0
  22. package/dist/runtime/components/FormPanel.d.vue.ts +47 -0
  23. package/dist/runtime/components/FormPanel.vue +10 -7
  24. package/dist/runtime/components/FormPanel.vue.d.ts +21 -15
  25. package/dist/runtime/components/FormPanelAsideSection.d.vue.ts +24 -0
  26. package/dist/runtime/components/FormPanelAsideSection.vue.d.ts +2 -1
  27. package/dist/runtime/components/FormPanelSection.d.vue.ts +21 -0
  28. package/dist/runtime/components/FormPanelSection.vue +2 -2
  29. package/dist/runtime/components/FormPanelSection.vue.d.ts +3 -2
  30. package/dist/runtime/components/Layout.d.vue.ts +27 -0
  31. package/dist/runtime/components/Layout.vue +79 -0
  32. package/dist/runtime/components/Layout.vue.d.ts +27 -0
  33. package/dist/runtime/components/ModalConfirm.d.vue.ts +33 -0
  34. package/dist/runtime/components/ModalConfirm.vue.d.ts +3 -2
  35. package/dist/runtime/components/TableColumnSorting.d.vue.ts +17 -0
  36. package/dist/runtime/components/{TablePanelColumnSorting.vue → TableColumnSorting.vue} +27 -18
  37. package/dist/runtime/components/TableColumnSorting.vue.d.ts +17 -0
  38. package/dist/runtime/components/TableColumnVisibility.d.vue.ts +24 -0
  39. package/dist/runtime/components/TableColumnVisibility.vue +111 -0
  40. package/dist/runtime/components/TableColumnVisibility.vue.d.ts +24 -0
  41. package/dist/runtime/components/TableFilters.d.vue.ts +90 -0
  42. package/dist/runtime/components/TableFilters.vue +198 -0
  43. package/dist/runtime/components/TableFilters.vue.d.ts +90 -0
  44. package/dist/runtime/components/TablePanel.d.vue.ts +95 -0
  45. package/dist/runtime/components/TablePanel.vue +207 -66
  46. package/dist/runtime/components/TablePanel.vue.d.ts +76 -31
  47. package/dist/runtime/components/TableSearchInput.d.vue.ts +33 -0
  48. package/dist/runtime/components/TableSearchInput.vue +96 -0
  49. package/dist/runtime/components/TableSearchInput.vue.d.ts +33 -0
  50. package/dist/runtime/components/UploraImage.d.vue.ts +35 -0
  51. package/dist/runtime/components/UploraImage.vue.d.ts +3 -2
  52. package/dist/runtime/components/prose/UploraImage.d.vue.ts +14 -0
  53. package/dist/runtime/components/prose/UploraImage.vue.d.ts +2 -1
  54. package/dist/runtime/composables/useAdmin.d.ts +1 -1
  55. package/dist/runtime/composables/useAdmin.js +2 -1
  56. package/dist/runtime/composables/useApi.d.ts +1 -1
  57. package/dist/runtime/composables/useAsyncHandler.d.ts +1 -1
  58. package/dist/runtime/composables/useAsyncHandler.js +1 -1
  59. package/dist/runtime/composables/useEditorDragHandle.d.ts +16 -0
  60. package/dist/runtime/composables/useEditorDragHandle.js +95 -0
  61. package/dist/runtime/composables/useEditorSuggestions.d.ts +68 -0
  62. package/dist/runtime/composables/useEditorSuggestions.js +24 -0
  63. package/dist/runtime/composables/useEditorToolbar.d.ts +120 -0
  64. package/dist/runtime/composables/useEditorToolbar.js +87 -0
  65. package/dist/runtime/composables/useFormState.d.ts +12 -0
  66. package/dist/runtime/composables/useFormState.js +33 -0
  67. package/dist/runtime/composables/useLogout.d.ts +1 -1
  68. package/dist/runtime/composables/useLogout.js +3 -1
  69. package/dist/runtime/composables/useNotification.d.ts +12 -0
  70. package/dist/runtime/composables/useNotification.js +46 -0
  71. package/dist/runtime/composables/useQueryState.d.ts +28 -0
  72. package/dist/runtime/composables/useQueryState.js +105 -0
  73. package/dist/runtime/composables/useRouteQuery.d.ts +37 -0
  74. package/dist/runtime/composables/useRouteQuery.js +81 -0
  75. package/dist/runtime/composables/useRowSelection.d.ts +8 -0
  76. package/dist/runtime/composables/useRowSelection.js +46 -0
  77. package/dist/runtime/composables/useTable.d.ts +17 -11
  78. package/dist/runtime/composables/useTable.js +47 -53
  79. package/dist/runtime/composables/useUplora.d.ts +1 -1
  80. package/dist/runtime/composables/useUplora.js +2 -1
  81. package/dist/runtime/index.css +1 -1
  82. package/dist/runtime/plugins/zod.d.ts +2 -0
  83. package/dist/runtime/plugins/zod.js +26 -0
  84. package/dist/runtime/server/api/uplora/[id].delete.d.ts +1 -5
  85. package/dist/runtime/tv.d.ts +1 -1
  86. package/dist/runtime/types/date.d.ts +5 -0
  87. package/dist/runtime/types/index.d.ts +3 -21
  88. package/dist/runtime/types/index.js +1 -21
  89. package/dist/runtime/types/utils.d.ts +7 -0
  90. package/dist/runtime/utils/date.d.ts +9 -0
  91. package/dist/runtime/utils/date.js +28 -0
  92. package/dist/runtime/utils/formatters.d.ts +2 -0
  93. package/dist/runtime/utils/formatters.js +8 -0
  94. package/dist/runtime/utils/index.d.ts +5 -2
  95. package/dist/runtime/utils/index.js +5 -2
  96. package/dist/runtime/utils/storage.d.ts +2 -0
  97. package/dist/runtime/utils/storage.js +10 -0
  98. package/dist/runtime/utils/table.d.ts +23 -0
  99. package/dist/runtime/utils/table.js +51 -0
  100. package/package.json +26 -25
  101. package/.nuxt/cms/button-clear.ts +0 -5
  102. package/.nuxt/cms/button-copy.ts +0 -5
  103. package/.nuxt/cms/button-delete.ts +0 -5
  104. package/.nuxt/cms/editor/callout.ts +0 -21
  105. package/.nuxt/cms/editor/uplora-image.ts +0 -5
  106. package/.nuxt/cms/editor-content-full.ts +0 -6
  107. package/.nuxt/cms/editor-content-light.ts +0 -6
  108. package/.nuxt/cms/input-seo.ts +0 -5
  109. package/.nuxt/cms/input-slug.ts +0 -5
  110. package/.nuxt/cms/input-uplora-image.ts +0 -15
  111. package/.nuxt/cms/table-cell-preview.ts +0 -9
  112. package/.nuxt/cms/table-cell-seo.ts +0 -5
  113. package/.nuxt/cms/table-cell-user.ts +0 -9
  114. package/.nuxt/cms/table-panel-column-sorting.ts +0 -5
  115. package/.nuxt/cms/table-panel-column-visibility.ts +0 -5
  116. package/.nuxt/cms/table-panel-filters.ts +0 -5
  117. package/dist/runtime/components/ButtonClear.vue +0 -35
  118. package/dist/runtime/components/ButtonClear.vue.d.ts +0 -35
  119. package/dist/runtime/components/ButtonCopy.vue +0 -40
  120. package/dist/runtime/components/ButtonCopy.vue.d.ts +0 -23
  121. package/dist/runtime/components/EditorContentFull.vue +0 -53
  122. package/dist/runtime/components/EditorContentFull.vue.d.ts +0 -20
  123. package/dist/runtime/components/EditorContentLight.vue +0 -46
  124. package/dist/runtime/components/EditorContentLight.vue.d.ts +0 -20
  125. package/dist/runtime/components/InputSeo.vue +0 -73
  126. package/dist/runtime/components/InputSeo.vue.d.ts +0 -19
  127. package/dist/runtime/components/InputSlug.vue +0 -70
  128. package/dist/runtime/components/InputSlug.vue.d.ts +0 -29
  129. package/dist/runtime/components/InputUploraImage.vue +0 -136
  130. package/dist/runtime/components/InputUploraImage.vue.d.ts +0 -35
  131. package/dist/runtime/components/TableCellPreview.vue +0 -41
  132. package/dist/runtime/components/TableCellPreview.vue.d.ts +0 -18
  133. package/dist/runtime/components/TableCellSeo.vue +0 -34
  134. package/dist/runtime/components/TableCellSeo.vue.d.ts +0 -13
  135. package/dist/runtime/components/TableCellUser.vue +0 -40
  136. package/dist/runtime/components/TableCellUser.vue.d.ts +0 -18
  137. package/dist/runtime/components/TablePanelColumnSorting.vue.d.ts +0 -20
  138. package/dist/runtime/components/TablePanelColumnVisibility.vue +0 -49
  139. package/dist/runtime/components/TablePanelColumnVisibility.vue.d.ts +0 -20
  140. package/dist/runtime/components/TablePanelFilters.vue +0 -79
  141. package/dist/runtime/components/TablePanelFilters.vue.d.ts +0 -34
  142. package/dist/runtime/composables/useDeleteConfirm.d.ts +0 -15
  143. package/dist/runtime/composables/useDeleteConfirm.js +0 -27
  144. package/dist/runtime/composables/useSeoStats.d.ts +0 -12
  145. package/dist/runtime/composables/useSeoStats.js +0 -44
  146. package/dist/runtime/editor/components/BlockMenu.vue +0 -43
  147. package/dist/runtime/editor/components/BlockMenu.vue.d.ts +0 -2
  148. package/dist/runtime/editor/components/SlashCommand.vue +0 -92
  149. package/dist/runtime/editor/components/SlashCommand.vue.d.ts +0 -7
  150. package/dist/runtime/editor/components/TooltipLink.vue +0 -81
  151. package/dist/runtime/editor/components/TooltipLink.vue.d.ts +0 -9
  152. package/dist/runtime/editor/components/TooltipMenu.vue +0 -75
  153. package/dist/runtime/editor/components/TooltipMenu.vue.d.ts +0 -9
  154. package/dist/runtime/editor/extensions/callout/CalloutView.vue +0 -85
  155. package/dist/runtime/editor/extensions/callout/CalloutView.vue.d.ts +0 -7
  156. package/dist/runtime/editor/extensions/callout/extension.d.ts +0 -13
  157. package/dist/runtime/editor/extensions/callout/extension.js +0 -48
  158. package/dist/runtime/editor/extensions/callout/index.d.ts +0 -2
  159. package/dist/runtime/editor/extensions/callout/index.js +0 -2
  160. package/dist/runtime/editor/extensions/callout/types.d.ts +0 -3
  161. package/dist/runtime/editor/extensions/index.d.ts +0 -26
  162. package/dist/runtime/editor/extensions/index.js +0 -85
  163. package/dist/runtime/editor/extensions/uplora-image/UploraImageView.vue +0 -29
  164. package/dist/runtime/editor/extensions/uplora-image/UploraImageView.vue.d.ts +0 -7
  165. package/dist/runtime/editor/extensions/uplora-image/extension.d.ts +0 -13
  166. package/dist/runtime/editor/extensions/uplora-image/extension.js +0 -60
  167. package/dist/runtime/editor/extensions/uplora-image/index.d.ts +0 -2
  168. package/dist/runtime/editor/extensions/uplora-image/index.js +0 -2
  169. package/dist/runtime/editor/extensions/uplora-image/types.d.ts +0 -5
  170. package/dist/runtime/editor/extensions/uplora-image/types.js +0 -0
  171. package/dist/runtime/editor/markdown/index.d.ts +0 -3
  172. package/dist/runtime/editor/markdown/index.js +0 -47
  173. package/dist/runtime/editor/markdown/nodes/callout.d.ts +0 -2
  174. package/dist/runtime/editor/markdown/nodes/callout.js +0 -21
  175. package/dist/runtime/editor/markdown/nodes/uploraImage.d.ts +0 -2
  176. package/dist/runtime/editor/markdown/nodes/uploraImage.js +0 -31
  177. package/dist/runtime/utils/dictionaries.d.ts +0 -4
  178. package/dist/runtime/utils/dictionaries.js +0 -6
  179. /package/.nuxt/cms/{autocomplete-select.ts → button-delete-confirm.ts} +0 -0
  180. /package/dist/runtime/{editor/extensions/callout/types.js → types/date.js} +0 -0
  181. /package/dist/runtime/utils/{image.d.ts → uplora.d.ts} +0 -0
  182. /package/dist/runtime/utils/{image.js → uplora.js} +0 -0
@@ -0,0 +1,232 @@
1
+ <template>
2
+ <UPopover v-model:open="isOpen" @update:open="onUpdateOpen">
3
+ <UButton
4
+ :id="id"
5
+ class="w-full"
6
+ :ui="{ base: `hover:bg-[unset] active:bg-[unset] ${modelValue ? '' : ' text-dimmed'}` }"
7
+ :name="name"
8
+ :color="color"
9
+ :icon="appConfig.ui.icons.calendar"
10
+ variant="outline"
11
+ :disabled="disabled"
12
+ :size="size"
13
+ v-bind="ariaAttrs"
14
+ >
15
+ <span class="truncate">{{ textValue }} </span>
16
+ </UButton>
17
+
18
+ <template #content>
19
+ <UCalendar
20
+ v-bind="calendarProps"
21
+ :model-value="calendarValue"
22
+ :range="range"
23
+ :disabled="disabled"
24
+ :prevent-deselect="false"
25
+ :ui="{ root: 'p-2' }"
26
+ :max-value="calendarMaxValue"
27
+ :min-value="calendarMinValue"
28
+ @update:model-value="handleCalendarUpdate($event)"
29
+ />
30
+
31
+ <template v-if="withTime">
32
+ <USeparator
33
+ orientation="horizontal"
34
+ />
35
+
36
+ <div class="p-2 flex justify-between items-center gap-2">
37
+ <div class="text-sm">
38
+ Время
39
+ </div>
40
+
41
+ <UInputTime
42
+ v-if="!range"
43
+ :model-value="calendarValue"
44
+ :disabled="disabled"
45
+ size="sm"
46
+ @update:model-value="handleTimeUpdate($event)"
47
+ />
48
+ <div v-else class="flex gap-2">
49
+ <UInputTime
50
+ :model-value="calendarValue?.start"
51
+ :disabled="disabled || !calendarValue?.start"
52
+ size="sm"
53
+ @update:model-value="handleTimeUpdate($event, 'start')"
54
+ />
55
+
56
+ <span class="text-sm text-dimmed self-center">—</span>
57
+
58
+ <UInputTime
59
+ :model-value="calendarValue?.end"
60
+ :disabled="disabled || !calendarValue?.end"
61
+ size="sm"
62
+ @update:model-value="handleTimeUpdate($event, 'end')"
63
+ />
64
+ </div>
65
+ </div>
66
+ </template>
67
+ </template>
68
+ </UPopover>
69
+ </template>
70
+
71
+ <script>
72
+ import { useAppConfig } from "#imports";
73
+ import { CalendarDateTime, getLocalTimeZone } from "@internationalized/date";
74
+ import { useFormField } from "@nuxt/ui/composables/useFormField";
75
+ import { reactiveOmit } from "@vueuse/core";
76
+ import { useForwardProps } from "reka-ui";
77
+ import { computed, ref } from "vue";
78
+ import { formatDate, formatServerDateTime } from "../utils";
79
+ function createCalendarDate(value, withTime = true) {
80
+ const date = new Date(value);
81
+ if (withTime) {
82
+ return new CalendarDateTime(date.getFullYear(), date.getMonth() + 1, date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds());
83
+ }
84
+ return new CalendarDateTime(date.getFullYear(), date.getMonth() + 1, date.getDate());
85
+ }
86
+ </script>
87
+
88
+ <script setup>
89
+ const props = defineProps({
90
+ modelValue: { type: null, required: true },
91
+ id: { type: String, required: false },
92
+ name: { type: String, required: false },
93
+ withTime: { type: Boolean, required: false, default: true },
94
+ minValue: { type: String, required: false },
95
+ maxValue: { type: String, required: false },
96
+ as: { type: null, required: false },
97
+ nextYearIcon: { type: null, required: false },
98
+ nextYear: { type: Object, required: false },
99
+ nextMonthIcon: { type: null, required: false },
100
+ nextMonth: { type: Object, required: false },
101
+ prevYearIcon: { type: null, required: false },
102
+ prevYear: { type: Object, required: false },
103
+ prevMonthIcon: { type: null, required: false },
104
+ prevMonth: { type: Object, required: false },
105
+ color: { type: null, required: false, default: "neutral" },
106
+ variant: { type: null, required: false },
107
+ size: { type: null, required: false },
108
+ range: { type: Boolean, required: false },
109
+ monthControls: { type: Boolean, required: false },
110
+ yearControls: { type: Boolean, required: false },
111
+ defaultValue: { type: null, required: false },
112
+ class: { type: null, required: false },
113
+ ui: { type: null, required: false },
114
+ defaultPlaceholder: { type: null, required: false },
115
+ placeholder: { type: null, required: false },
116
+ allowNonContiguousRanges: { type: Boolean, required: false },
117
+ pagedNavigation: { type: Boolean, required: false },
118
+ preventDeselect: { type: Boolean, required: false },
119
+ maximumDays: { type: Number, required: false },
120
+ weekStartsOn: { type: Number, required: false },
121
+ weekdayFormat: { type: String, required: false },
122
+ fixedWeeks: { type: Boolean, required: false },
123
+ numberOfMonths: { type: Number, required: false },
124
+ disabled: { type: Boolean, required: false },
125
+ readonly: { type: Boolean, required: false },
126
+ initialFocus: { type: Boolean, required: false },
127
+ isDateDisabled: { type: Function, required: false },
128
+ isDateUnavailable: { type: Function, required: false },
129
+ isDateHighlightable: { type: Function, required: false },
130
+ nextPage: { type: Function, required: false },
131
+ prevPage: { type: Function, required: false },
132
+ disableDaysOutsideCurrentView: { type: Boolean, required: false },
133
+ fixedDate: { type: String, required: false }
134
+ });
135
+ const emit = defineEmits(["update:modelValue", "change", "blur", "focus"]);
136
+ const appConfig = useAppConfig();
137
+ const calendarProps = useForwardProps(reactiveOmit(props, "modelValue", "id", "name", "withTime", "minValue", "maxValue"));
138
+ const {
139
+ id,
140
+ name,
141
+ color,
142
+ disabled,
143
+ ariaAttrs,
144
+ size,
145
+ emitFormBlur,
146
+ emitFormChange,
147
+ emitFormFocus,
148
+ emitFormInput
149
+ } = useFormField(props);
150
+ const isOpen = ref(false);
151
+ function isRange() {
152
+ return !!props.range;
153
+ }
154
+ const textValue = computed(() => {
155
+ if (!props.modelValue) {
156
+ return "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0434\u0430\u0442\u0443";
157
+ }
158
+ if (!isRange(props.modelValue)) {
159
+ return formatDate(props.modelValue);
160
+ }
161
+ return `${formatDate(props.modelValue.start)} - ${formatDate(props.modelValue.end)}`;
162
+ });
163
+ const calendarValue = computed(() => {
164
+ if (!props.modelValue) {
165
+ return void 0;
166
+ }
167
+ if (!isRange(props.modelValue)) {
168
+ return createCalendarDate(props.modelValue);
169
+ }
170
+ return {
171
+ start: createCalendarDate(props.modelValue.start),
172
+ end: createCalendarDate(props.modelValue.end)
173
+ };
174
+ });
175
+ const calendarMinValue = computed(
176
+ () => props.minValue ? createCalendarDate(props.minValue, false) : void 0
177
+ );
178
+ const calendarMaxValue = computed(
179
+ () => props.maxValue ? createCalendarDate(props.maxValue, false) : void 0
180
+ );
181
+ function onUpdateOpen(value) {
182
+ if (!value) {
183
+ const event = new FocusEvent("blur");
184
+ emit("blur", event);
185
+ emitFormBlur();
186
+ } else {
187
+ const event = new FocusEvent("focus");
188
+ emit("focus", event);
189
+ emitFormFocus();
190
+ }
191
+ }
192
+ function onUpdate(value) {
193
+ emit("update:modelValue", value);
194
+ emit("change", new Event("change", { target: { value } }));
195
+ emitFormChange();
196
+ emitFormInput();
197
+ }
198
+ function handleCalendarUpdate(calendarValue2, setInitialTime = true) {
199
+ if (!calendarValue2) {
200
+ onUpdate(void 0);
201
+ return;
202
+ }
203
+ if (isRange(calendarValue2) && (!calendarValue2.start || !calendarValue2.end)) {
204
+ return;
205
+ }
206
+ if (isRange(calendarValue2)) {
207
+ const endDate = calendarValue2.end.toDate(getLocalTimeZone());
208
+ setInitialTime && endDate.setHours(23, 59, 59, 999);
209
+ const value = {
210
+ start: formatServerDateTime(calendarValue2.start.toDate(getLocalTimeZone())),
211
+ end: formatServerDateTime(endDate)
212
+ };
213
+ onUpdate(value);
214
+ } else {
215
+ onUpdate(formatServerDateTime(calendarValue2.toDate(getLocalTimeZone())));
216
+ }
217
+ }
218
+ function handleTimeUpdate(timeValue, type) {
219
+ if (!timeValue) {
220
+ return;
221
+ }
222
+ if (!type) {
223
+ return handleCalendarUpdate(timeValue);
224
+ }
225
+ const otherType = type === "start" ? "end" : "start";
226
+ const value = {
227
+ [type]: timeValue,
228
+ [otherType]: calendarValue.value?.[otherType]
229
+ };
230
+ handleCalendarUpdate(value, false);
231
+ }
232
+ </script>
@@ -0,0 +1,43 @@
1
+ import type { DateValue } from '@internationalized/date';
2
+ import type { CalendarProps } from '@nuxt/ui';
3
+ import type { DateRange as CalendarDateRange } from 'reka-ui';
4
+ import type { DateRange, DateType } from '../types';
5
+ export type CalendarValue = DateValue | CalendarDateRange;
6
+ export type ModelValue<R extends boolean> = (R extends true ? DateRange : DateType) | undefined;
7
+ export interface Props<R extends boolean> extends Omit<CalendarProps<R, false>, 'modelValue' | 'multiple' | 'minValue' | 'maxValue'> {
8
+ modelValue: ModelValue<R>;
9
+ id?: string;
10
+ name?: string;
11
+ withTime?: boolean;
12
+ minValue?: DateType;
13
+ maxValue?: DateType;
14
+ }
15
+ export interface Emits<R extends boolean> {
16
+ 'update:modelValue': [value: ModelValue<R>];
17
+ 'change': [event: Event];
18
+ 'blur': [event: FocusEvent];
19
+ 'focus': [event: FocusEvent];
20
+ }
21
+ declare const _default: typeof __VLS_export;
22
+ export default _default;
23
+ declare const __VLS_export: <R extends boolean = false>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
24
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<Props<R> & {
25
+ onBlur?: ((event: FocusEvent) => any) | undefined;
26
+ onChange?: ((event: Event) => any) | undefined;
27
+ onFocus?: ((event: FocusEvent) => any) | undefined;
28
+ "onUpdate:modelValue"?: ((value: ModelValue<R>) => any) | undefined;
29
+ }> & (typeof globalThis extends {
30
+ __VLS_PROPS_FALLBACK: infer P;
31
+ } ? P : {});
32
+ expose: (exposed: {}) => void;
33
+ attrs: any;
34
+ slots: {};
35
+ emit: ((evt: "blur", event: FocusEvent) => void) & ((evt: "change", event: Event) => void) & ((evt: "focus", event: FocusEvent) => void) & ((evt: "update:modelValue", value: ModelValue<R>) => void);
36
+ }>) => import("vue").VNode & {
37
+ __ctx?: Awaited<typeof __VLS_setup>;
38
+ };
39
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
40
+ [K in keyof T]: T[K];
41
+ } : {
42
+ [K in keyof T as K]: T[K];
43
+ }) & {};
@@ -0,0 +1,13 @@
1
+ import type { EditorCustomHandlers, EditorEmits, EditorProps } from '@nuxt/ui';
2
+ export interface EditorFullProps extends Omit<EditorProps, 'autofocus' | 'contentType' | 'placeholder'> {
3
+ customHandlers?: EditorCustomHandlers;
4
+ }
5
+ export interface EditorFullEmits extends EditorEmits {
6
+ }
7
+ declare const __VLS_export: import("vue").DefineComponent<EditorFullProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
8
+ "update:modelValue": (value: import("@tiptap/core").Content) => any;
9
+ }, string, import("vue").PublicProps, Readonly<EditorFullProps> & Readonly<{
10
+ "onUpdate:modelValue"?: ((value: import("@tiptap/core").Content) => any) | undefined;
11
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
12
+ declare const _default: typeof __VLS_export;
13
+ export default _default;
@@ -0,0 +1,127 @@
1
+ <template>
2
+ <UEditor
3
+ v-slot="{ editor, handlers }"
4
+ class="min-h-screen"
5
+ :extensions="extensions"
6
+ autofocus
7
+ content-type="markdown"
8
+ placeholder="Введите '/' для выбора блока..."
9
+ v-bind="forwarded"
10
+ >
11
+ <UEditorDragHandle
12
+ v-slot="{ ui, onClick }"
13
+ :editor="editor"
14
+ @node-change="onNodeChange"
15
+ >
16
+ <UButton
17
+ :icon="appConfig.ui.icons.plus"
18
+ color="neutral"
19
+ variant="ghost"
20
+ size="sm"
21
+ :class="ui.handle()"
22
+ @click="(e) => {
23
+ e.stopPropagation();
24
+ const node = onClick();
25
+ handlers.suggestion?.execute(editor, { pos: node?.pos }).run();
26
+ }"
27
+ />
28
+
29
+ <UDropdownMenu
30
+ v-slot="{ open }"
31
+ :modal="false"
32
+ :items="getDragHandleItems(editor)"
33
+ :content="{ side: 'left' }"
34
+ :ui="{ content: 'w-48', label: 'text-xs' }"
35
+ @update:open="editor.chain().setMeta('lockDragHandle', $event).run()"
36
+ >
37
+ <UButton
38
+ color="neutral"
39
+ variant="ghost"
40
+ active-variant="soft"
41
+ size="sm"
42
+ :icon="appConfig.ui.icons.drag"
43
+ :active="open"
44
+ :class="ui.handle()"
45
+ />
46
+ </UDropdownMenu>
47
+ </UEditorDragHandle>
48
+
49
+ <UEditorToolbar
50
+ :editor="editor"
51
+ :items="bubbleToolbarItems"
52
+ layout="bubble"
53
+ :should-show="({ view, state }) => {
54
+ const { selection } = state;
55
+ return view.hasFocus() && !selection.empty;
56
+ }"
57
+ >
58
+ <template #link>
59
+ <EditorLinkPopover :editor="editor" />
60
+ </template>
61
+ </UEditorToolbar>
62
+
63
+ <UEditorSuggestionMenu
64
+ :editor="editor"
65
+ :items="suggestionItems"
66
+ />
67
+ </UEditor>
68
+ </template>
69
+
70
+ <script setup>
71
+ import { useAppConfig } from "#imports";
72
+ import { reactiveOmit } from "@vueuse/core";
73
+ import { useForwardPropsEmits } from "reka-ui";
74
+ import { computed } from "vue";
75
+ import { useEditorDragHandle } from "../composables/useEditorDragHandle";
76
+ import { useEditorSuggestions } from "../composables/useEditorSuggestions";
77
+ import { useEditorToolbar } from "../composables/useEditorToolbar";
78
+ import EditorLinkPopover from "./EditorLinkPopover.vue";
79
+ const props = defineProps({
80
+ customHandlers: { type: Object, required: false },
81
+ as: { type: null, required: false },
82
+ modelValue: { type: null, required: false },
83
+ starterKit: { type: Object, required: false },
84
+ markdown: { type: Object, required: false },
85
+ image: { type: Object, required: false },
86
+ mention: { type: Object, required: false },
87
+ handlers: { type: null, required: false },
88
+ class: { type: null, required: false },
89
+ ui: { type: null, required: false },
90
+ extensions: { type: Array, required: false },
91
+ injectCSS: { type: Boolean, required: false },
92
+ injectNonce: { type: null, required: false },
93
+ editable: { type: Boolean, required: false },
94
+ textDirection: { type: String, required: false },
95
+ editorProps: { type: Object, required: false },
96
+ parseOptions: { type: Object, required: false },
97
+ coreExtensionOptions: { type: Object, required: false },
98
+ enableInputRules: { type: [Array, Boolean], required: false },
99
+ enablePasteRules: { type: [Array, Boolean], required: false },
100
+ enableCoreExtensions: { type: [Boolean, Object], required: false },
101
+ enableContentCheck: { type: Boolean, required: false },
102
+ emitContentError: { type: Boolean, required: false },
103
+ onBeforeCreate: { type: Function, required: false },
104
+ onCreate: { type: Function, required: false },
105
+ onMount: { type: Function, required: false },
106
+ onUnmount: { type: Function, required: false },
107
+ onContentError: { type: Function, required: false },
108
+ onUpdate: { type: Function, required: false },
109
+ onSelectionUpdate: { type: Function, required: false },
110
+ onTransaction: { type: Function, required: false },
111
+ onFocus: { type: Function, required: false },
112
+ onBlur: { type: Function, required: false },
113
+ onDestroy: { type: Function, required: false },
114
+ onPaste: { type: Function, required: false },
115
+ onDrop: { type: Function, required: false },
116
+ onDelete: { type: Function, required: false }
117
+ });
118
+ const emit = defineEmits(["update:modelValue"]);
119
+ const forwarded = useForwardPropsEmits(reactiveOmit(props, "extensions", "customHandlers"), emit);
120
+ const appConfig = useAppConfig();
121
+ const extensions = computed(() => [
122
+ ...props.extensions || []
123
+ ]);
124
+ const { items: suggestionItems } = useEditorSuggestions(props.customHandlers);
125
+ const { getItems: getDragHandleItems, onNodeChange } = useEditorDragHandle(props.customHandlers);
126
+ const { bubbleToolbarItems } = useEditorToolbar(props.customHandlers);
127
+ </script>
@@ -0,0 +1,13 @@
1
+ import type { EditorCustomHandlers, EditorEmits, EditorProps } from '@nuxt/ui';
2
+ export interface EditorFullProps extends Omit<EditorProps, 'autofocus' | 'contentType' | 'placeholder'> {
3
+ customHandlers?: EditorCustomHandlers;
4
+ }
5
+ export interface EditorFullEmits extends EditorEmits {
6
+ }
7
+ declare const __VLS_export: import("vue").DefineComponent<EditorFullProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
8
+ "update:modelValue": (value: import("@tiptap/core").Content) => any;
9
+ }, string, import("vue").PublicProps, Readonly<EditorFullProps> & Readonly<{
10
+ "onUpdate:modelValue"?: ((value: import("@tiptap/core").Content) => any) | undefined;
11
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
12
+ declare const _default: typeof __VLS_export;
13
+ export default _default;
@@ -0,0 +1,8 @@
1
+ import type { Editor } from '@tiptap/vue-3';
2
+ type __VLS_Props = {
3
+ editor: Editor;
4
+ autoOpen?: boolean;
5
+ };
6
+ 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>;
7
+ declare const _default: typeof __VLS_export;
8
+ export default _default;
@@ -0,0 +1,137 @@
1
+ <template>
2
+ <UPopover
3
+ v-model:open="open"
4
+ :ui="{ content: 'p-0.5' }"
5
+ >
6
+ <UTooltip text="Ссылка">
7
+ <UButton
8
+ :icon="appConfig.ui.icons.link"
9
+ color="neutral"
10
+ active-color="primary"
11
+ variant="ghost"
12
+ active-variant="soft"
13
+ size="sm"
14
+ :active="active"
15
+ :disabled="disabled"
16
+ />
17
+ </UTooltip>
18
+
19
+ <template #content>
20
+ <UInput
21
+ v-model="url"
22
+ autofocus
23
+ name="url"
24
+ type="url"
25
+ variant="none"
26
+ placeholder="Выставить ссылку..."
27
+ @keydown="handleKeyDown"
28
+ >
29
+ <div class="flex items-center mr-0.5">
30
+ <UButton
31
+ :icon="appConfig.ui.icons.enter"
32
+ variant="ghost"
33
+ size="sm"
34
+ :disabled="!url && !active"
35
+ title="Выставить ссылку"
36
+ @click="setLink"
37
+ />
38
+
39
+ <USeparator
40
+ orientation="vertical"
41
+ class="h-6 mx-1"
42
+ />
43
+
44
+ <UButton
45
+ :icon="appConfig.ui.icons.external"
46
+ color="neutral"
47
+ variant="ghost"
48
+ size="sm"
49
+ :disabled="!url && !active"
50
+ title="Открыть в новом окне"
51
+ @click="openLink"
52
+ />
53
+
54
+ <UButton
55
+ :icon="appConfig.ui.icons.trash"
56
+ color="neutral"
57
+ variant="ghost"
58
+ size="sm"
59
+ :disabled="!url && !active"
60
+ title="Удалить ссылку"
61
+ @click="removeLink"
62
+ />
63
+ </div>
64
+ </UInput>
65
+ </template>
66
+ </UPopover>
67
+ </template>
68
+
69
+ <script setup>
70
+ import { useAppConfig } from "#imports";
71
+ import { computed, ref, watch } from "vue";
72
+ const props = defineProps({
73
+ editor: { type: Object, required: true },
74
+ autoOpen: { type: Boolean, required: false }
75
+ });
76
+ const appConfig = useAppConfig();
77
+ const open = ref(false);
78
+ const url = ref("");
79
+ const active = computed(() => props.editor.isActive("link"));
80
+ const disabled = computed(() => {
81
+ if (!props.editor.isEditable) {
82
+ return true;
83
+ }
84
+ const { selection } = props.editor.state;
85
+ return selection.empty && !props.editor.isActive("link");
86
+ });
87
+ watch(() => props.editor, (editor, _, onCleanup) => {
88
+ if (!editor) {
89
+ return;
90
+ }
91
+ const updateUrl = () => {
92
+ const { href } = editor.getAttributes("link");
93
+ url.value = href || "";
94
+ };
95
+ updateUrl();
96
+ editor.on("selectionUpdate", updateUrl);
97
+ onCleanup(() => {
98
+ editor.off("selectionUpdate", updateUrl);
99
+ });
100
+ }, { immediate: true });
101
+ watch(active, (isActive) => {
102
+ if (isActive && props.autoOpen) {
103
+ open.value = true;
104
+ }
105
+ });
106
+ function setLink() {
107
+ if (!url.value) {
108
+ return;
109
+ }
110
+ const { selection } = props.editor.state;
111
+ const isEmpty = selection.empty;
112
+ let chain = props.editor.chain().focus();
113
+ chain = chain.extendMarkRange("link").setLink({ href: url.value });
114
+ if (isEmpty) {
115
+ chain = chain.insertContent({ type: "text", text: url.value });
116
+ }
117
+ chain.run();
118
+ open.value = false;
119
+ }
120
+ function removeLink() {
121
+ props.editor.chain().focus().extendMarkRange("link").unsetLink().setMeta("preventAutolink", true).run();
122
+ url.value = "";
123
+ open.value = false;
124
+ }
125
+ function openLink() {
126
+ if (!url.value) {
127
+ return;
128
+ }
129
+ window.open(url.value, "_blank", "noopener,noreferrer");
130
+ }
131
+ function handleKeyDown(event) {
132
+ if (event.key === "Enter") {
133
+ event.preventDefault();
134
+ setLink();
135
+ }
136
+ }
137
+ </script>
@@ -0,0 +1,8 @@
1
+ import type { Editor } from '@tiptap/vue-3';
2
+ type __VLS_Props = {
3
+ editor: Editor;
4
+ autoOpen?: boolean;
5
+ };
6
+ 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>;
7
+ declare const _default: typeof __VLS_export;
8
+ export default _default;
@@ -0,0 +1,47 @@
1
+ import type { AppConfig } from '@nuxt/schema';
2
+ import type { FormData, FormSchema, FormSubmitEvent } from '@nuxt/ui';
3
+ import type { RouteLocationRaw } from 'vue-router';
4
+ import type { ComponentConfig } from '../types';
5
+ import theme from '#build/cms/form-panel';
6
+ type FormPanel = ComponentConfig<typeof theme, AppConfig, 'formPanel'>;
7
+ export interface FormPanelProps<S extends FormSchema, T extends FormData<S> = FormData<S>> {
8
+ title?: string;
9
+ toBack?: RouteLocationRaw;
10
+ formId?: string;
11
+ schema: S;
12
+ state: Partial<T>;
13
+ loading?: boolean;
14
+ handler: (event: FormSubmitEvent<T>) => Promise<void>;
15
+ asideDivide?: boolean;
16
+ showReset?: boolean;
17
+ class?: any;
18
+ ui?: FormPanel['slots'];
19
+ }
20
+ export interface FormPanelEmits<S extends FormSchema, T extends FormData<S> = FormData<S>> {
21
+ 'update:state': [value: T];
22
+ }
23
+ export interface FormPanelSlots {
24
+ default?: () => any;
25
+ sidebar?: () => any;
26
+ actions?: () => any;
27
+ }
28
+ declare const _default: typeof __VLS_export;
29
+ export default _default;
30
+ declare const __VLS_export: <S extends FormSchema, T extends FormData<S> = FormData<S>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
31
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<FormPanelProps<S, T> & {
32
+ "onUpdate:state"?: ((value: T) => any) | undefined;
33
+ }> & (typeof globalThis extends {
34
+ __VLS_PROPS_FALLBACK: infer P;
35
+ } ? P : {});
36
+ expose: (exposed: {}) => void;
37
+ attrs: any;
38
+ slots: FormPanelSlots;
39
+ emit: (evt: "update:state", value: T) => void;
40
+ }>) => import("vue").VNode & {
41
+ __ctx?: Awaited<typeof __VLS_setup>;
42
+ };
43
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
44
+ [K in keyof T]: T[K];
45
+ } : {
46
+ [K in keyof T as K]: T[K];
47
+ }) & {};