@hywax/cms 0.0.23 → 1.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.
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 +85 -204
  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 +29 -0
  31. package/dist/runtime/components/Layout.vue +81 -0
  32. package/dist/runtime/components/Layout.vue.d.ts +29 -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 -13
  107. package/.nuxt/cms/editor-content-light.ts +0 -13
  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 -22
  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 -67
  122. package/dist/runtime/components/EditorContentFull.vue.d.ts +0 -23
  123. package/dist/runtime/components/EditorContentLight.vue +0 -60
  124. package/dist/runtime/components/EditorContentLight.vue.d.ts +0 -23
  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 -156
  130. package/dist/runtime/components/InputUploraImage.vue.d.ts +0 -38
  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
@@ -1,49 +0,0 @@
1
- <template>
2
- <UDropdownMenu :items="items">
3
- <UChip
4
- :ui="{ base: 'z-1 size-3' }"
5
- :show="hiddenColumnsCount > 0"
6
- :text="hiddenColumnsCount"
7
- size="xl"
8
- >
9
- <UButton
10
- :icon="appConfig.ui.icons.columns"
11
- variant="outline"
12
- color="neutral"
13
- label="Колонки"
14
- />
15
- </UChip>
16
- </UDropdownMenu>
17
- </template>
18
-
19
- <script>
20
- import theme from "#build/cms/table-panel-column-visibility";
21
- import { computed, useAppConfig } from "#imports";
22
- import { tv } from "../tv";
23
- </script>
24
-
25
- <script setup>
26
- const props = defineProps({
27
- table: { type: Object, required: false },
28
- class: { type: null, required: false },
29
- ui: { type: null, required: false }
30
- });
31
- const visibility = defineModel({ type: Object, ...{ default: {} } });
32
- const appConfig = useAppConfig();
33
- const items = computed(() => {
34
- if (!props.table) {
35
- return [];
36
- }
37
- return props.table.getAllColumns().filter((column) => column.getCanHide()).map((column) => ({
38
- label: typeof column.columnDef.header === "string" ? column.columnDef.header : column.columnDef.id,
39
- type: "checkbox",
40
- checked: column.getIsVisible(),
41
- onUpdateChecked: (checked) => visibility.value = { ...visibility.value, [column.id]: checked },
42
- onSelect: (event) => event.preventDefault()
43
- }));
44
- });
45
- const hiddenColumnsCount = computed(() => {
46
- return items.value.reduce((sum, item) => item.checked ? sum : sum + 1, 0);
47
- });
48
- const _ui = computed(() => tv({ extend: tv(theme), ...appConfig.cms?.tablePanelColumnVisibility || {} })());
49
- </script>
@@ -1,20 +0,0 @@
1
- import type { AppConfig } from '@nuxt/schema';
2
- import type { Table, VisibilityState } from '@tanstack/vue-table';
3
- import type { ComponentConfig } from '../types';
4
- import theme from '#build/cms/table-panel-column-visibility';
5
- type TablePanelColumnVisibility = ComponentConfig<typeof theme, AppConfig, 'tablePanelColumnVisibility'>;
6
- export interface TablePanelColumnVisibilityProps {
7
- table?: Table<any>;
8
- class?: any;
9
- ui?: TablePanelColumnVisibility['slots'];
10
- }
11
- declare const _default: import("vue").DefineComponent<TablePanelColumnVisibilityProps & {
12
- modelValue?: VisibilityState;
13
- }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
14
- "update:modelValue": (value: VisibilityState) => any;
15
- }, string, import("vue").PublicProps, Readonly<TablePanelColumnVisibilityProps & {
16
- modelValue?: VisibilityState;
17
- }> & Readonly<{
18
- "onUpdate:modelValue"?: ((value: VisibilityState) => any) | undefined;
19
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
20
- export default _default;
@@ -1,79 +0,0 @@
1
- <template>
2
- <UPopover v-model:open="isOpen">
3
- <UChip
4
- :ui="{ base: 'z-1 size-3' }"
5
- :show="!!appliedCount"
6
- :text="appliedCount"
7
- size="xl"
8
- >
9
- <UButton
10
- :icon="appConfig.ui.icons.filter"
11
- variant="outline"
12
- color="neutral"
13
- label="Фильтры"
14
- />
15
- </UChip>
16
-
17
- <template #content>
18
- <UForm
19
- :id="formId"
20
- :state="props.state"
21
- class="p-4 w-xs max-h-[60vh] overflow-y-auto"
22
- v-bind="optionalFormProps"
23
- @submit="handleSubmit"
24
- >
25
- <slot />
26
- </UForm>
27
-
28
- <USeparator class="mt-0" orientation="horizontal" />
29
-
30
- <div class="flex justify-end space-x-2 p-2">
31
- <UButton
32
- color="neutral"
33
- label="Сбросить"
34
- variant="ghost"
35
- @click="handleResetClick"
36
- />
37
-
38
- <UButton
39
- type="submit"
40
- label="Применить"
41
- color="primary"
42
- :form="formId"
43
- />
44
- </div>
45
- </template>
46
- </UPopover>
47
- </template>
48
-
49
- <script>
50
- import theme from "#build/cms/table-panel-filters";
51
- import { computed, ref, useAppConfig, useId } from "#imports";
52
- import { reactivePick } from "@vueuse/core";
53
- import { useForwardProps } from "reka-ui";
54
- import { tv } from "../tv";
55
- </script>
56
-
57
- <script setup>
58
- const props = defineProps({
59
- state: { type: null, required: true },
60
- schema: { type: null, required: false },
61
- appliedCount: { type: Number, required: false },
62
- class: { type: null, required: false },
63
- ui: { type: null, required: false }
64
- });
65
- const emit = defineEmits(["submit", "reset"]);
66
- const appConfig = useAppConfig();
67
- const formId = `form-${useId()}`;
68
- const isOpen = ref(false);
69
- const optionalFormProps = useForwardProps(reactivePick(props, "schema"));
70
- function handleResetClick() {
71
- emit("reset");
72
- isOpen.value = false;
73
- }
74
- function handleSubmit() {
75
- emit("submit");
76
- isOpen.value = false;
77
- }
78
- const _ui = computed(() => tv({ extend: tv(theme), ...appConfig.cms?.tablePanelFilters || {} })());
79
- </script>
@@ -1,34 +0,0 @@
1
- import type { AppConfig } from '@nuxt/schema';
2
- import type { FormProps } from '@nuxt/ui';
3
- import type { ComponentConfig } from '../types';
4
- import theme from '#build/cms/table-panel-filters';
5
- type TablePanelFilters = ComponentConfig<typeof theme, AppConfig, 'tablePanelFilters'>;
6
- export interface TablePanelFiltersProps<T> {
7
- state: FormProps<T>['state'];
8
- schema?: FormProps<T>['schema'];
9
- appliedCount?: number;
10
- class?: any;
11
- ui?: TablePanelFilters['slots'];
12
- }
13
- export interface TablePanelFiltersEmits {
14
- submit: [];
15
- reset: [];
16
- }
17
- declare const _default: <T extends object>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
18
- props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
19
- readonly onReset?: (() => any) | undefined;
20
- readonly onSubmit?: (() => any) | undefined;
21
- } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onSubmit" | "onReset"> & TablePanelFiltersProps<T> & Partial<{}>> & import("vue").PublicProps;
22
- expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
23
- attrs: any;
24
- slots: {
25
- default?: (props: {}) => any;
26
- };
27
- emit: ((evt: "reset") => void) & ((evt: "submit") => void);
28
- }>) => import("vue").VNode & {
29
- __ctx?: Awaited<typeof __VLS_setup>;
30
- };
31
- export default _default;
32
- type __VLS_PrettifyLocal<T> = {
33
- [K in keyof T]: T[K];
34
- } & {};
@@ -1,15 +0,0 @@
1
- import type { NitroFetchRequest } from 'nitropack';
2
- import type { AsyncDataRequestStatus } from 'nuxt/app';
3
- import type { Ref } from 'vue';
4
- interface UseDeleteConfirmOptions {
5
- url: NitroFetchRequest;
6
- title?: string;
7
- message?: string;
8
- onSuccess?: () => void;
9
- }
10
- interface UseDeleteConfirmReturn {
11
- execute: () => void;
12
- status: Ref<AsyncDataRequestStatus>;
13
- }
14
- export declare function useDeleteConfirm(options: UseDeleteConfirmOptions): UseDeleteConfirmReturn;
15
- export {};
@@ -1,27 +0,0 @@
1
- import { useApi, useOverlay } from "#imports";
2
- import ModalConfirm from "../components/ModalConfirm.vue";
3
- export function useDeleteConfirm(options) {
4
- const modal = useOverlay().create(ModalConfirm, { destroyOnClose: true });
5
- const { execute: _execute, status } = useApi(options.url, {
6
- method: "delete",
7
- immediate: false,
8
- onResponse: async ({ response }) => {
9
- if (!response.ok) {
10
- return;
11
- }
12
- options.onSuccess?.();
13
- }
14
- });
15
- function execute() {
16
- modal.open({
17
- title: options.title || "\u0423\u0434\u0430\u043B\u0438\u0442\u044C",
18
- message: options.message || "\u0412\u044B \u0443\u0432\u0435\u0440\u0435\u043D\u044B, \u0447\u0442\u043E \u0445\u043E\u0442\u0438\u0442\u0435 \u0443\u0434\u0430\u043B\u0438\u0442\u044C? \u0412\u044B \u043D\u0435 \u0441\u043C\u043E\u0436\u0435\u0442\u0435 \u043E\u0442\u043C\u0435\u043D\u0438\u0442\u044C \u044D\u0442\u043E \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435.",
19
- color: "error",
20
- onConfirm: () => _execute()
21
- });
22
- }
23
- return {
24
- execute,
25
- status
26
- };
27
- }
@@ -1,12 +0,0 @@
1
- import type { ComputedRef, MaybeRefOrGetter } from 'vue';
2
- import type { SEO } from '../types';
3
- interface SEOStats {
4
- progress: number;
5
- color: 'error' | 'warning' | 'success';
6
- }
7
- interface UseSeoStatsReturn {
8
- title: ComputedRef<SEOStats>;
9
- description: ComputedRef<SEOStats>;
10
- }
11
- export declare function useSeoStats(options: MaybeRefOrGetter<SEO>): UseSeoStatsReturn;
12
- export {};
@@ -1,44 +0,0 @@
1
- import { computed, toValue } from "#imports";
2
- function computeScore(length, recommendedLength, maxLength) {
3
- if (length === 0) {
4
- return 0;
5
- }
6
- if (length < recommendedLength) {
7
- return length / recommendedLength * 100;
8
- }
9
- if (length > maxLength) {
10
- return Math.max(0, 100 - (length - maxLength) / maxLength * 100);
11
- }
12
- return 100;
13
- }
14
- function computeColor(score) {
15
- if (score < 30) {
16
- return "error";
17
- }
18
- if (score < 70) {
19
- return "warning";
20
- }
21
- return "success";
22
- }
23
- export function useSeoStats(options) {
24
- const title = computed(() => {
25
- const value = toValue(options);
26
- const score = computeScore(value.title.length, 45, 60);
27
- return {
28
- progress: Math.round(score),
29
- color: computeColor(score)
30
- };
31
- });
32
- const description = computed(() => {
33
- const value = toValue(options);
34
- const score = computeScore(value.description.length, 130, 160);
35
- return {
36
- progress: Math.round(score),
37
- color: computeColor(score)
38
- };
39
- });
40
- return {
41
- title,
42
- description
43
- };
44
- }
@@ -1,43 +0,0 @@
1
- <template>
2
- <BlockHandlePopover class="will-change-transform">
3
- <BlockHandleAdd>
4
- <UButton
5
- variant="ghost"
6
- color="neutral"
7
- size="xs"
8
- :icon="appConfig.ui.icons.plus"
9
- />
10
- </BlockHandleAdd>
11
- <BlockHandleDraggable class="cursor-grab">
12
- <UDropdownMenu
13
- :items="menuItems"
14
- :content="{ align: 'start', side: 'bottom', sideOffset: 8 }"
15
- :ui="{ content: 'w-48' }"
16
- >
17
- <UButton
18
- variant="ghost"
19
- color="neutral"
20
- size="xs"
21
- :icon="appConfig.ui.icons.ellipsisVertical"
22
- />
23
- </UDropdownMenu>
24
- </BlockHandleDraggable>
25
- </BlockHandlePopover>
26
- </template>
27
-
28
- <script setup>
29
- import { computed, useAppConfig } from "#imports";
30
- import { useEditor } from "prosekit/vue";
31
- import { BlockHandleAdd, BlockHandleDraggable, BlockHandlePopover } from "prosekit/vue/block-handle";
32
- const appConfig = useAppConfig();
33
- const _editor = useEditor();
34
- const menuItems = computed(() => [
35
- {
36
- icon: appConfig.ui.icons.trash,
37
- label: "\u0423\u0434\u0430\u043B\u0438\u0442\u044C",
38
- color: "error",
39
- onSelect: () => {
40
- }
41
- }
42
- ]);
43
- </script>
@@ -1,2 +0,0 @@
1
- declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
- export default _default;
@@ -1,92 +0,0 @@
1
- <template>
2
- <AutocompletePopover :regex="regex" class="relative block w-56 max-h-60! select-none overflow-auto whitespace-nowrap bg-default shadow-lg rounded-md ring ring-default [&:not([data-state])]:hidden">
3
- <AutocompleteList class="flex flex-col gap p-1">
4
- <AutocompleteItem
5
- v-for="item in items"
6
- :key="item.label"
7
- class="group flex items-center text-sm gap-1.5 px-2.5 py-1.5 rounded-md text-default data-[focused]:bg-elevated/50 data-[focused]:text-highlighted transition-colors"
8
- @select="item.command"
9
- >
10
- <UIcon :name="item.icon" class="size-5 text-dimmed group-data-[focused]:text-default transition-colors" />
11
- <span class="truncate">
12
- {{ item.label }}
13
- </span>
14
- </AutocompleteItem>
15
-
16
- <AutocompleteEmpty class="flex items-center justify-center text-sm text-muted px-2.5 py-1.5">
17
- Ничего не найдено
18
- </AutocompleteEmpty>
19
- </AutocompleteList>
20
- </AutocompletePopover>
21
- </template>
22
-
23
- <script setup>
24
- import { useAppConfig } from "#imports";
25
- import { useEditor } from "prosekit/vue";
26
- import { AutocompleteEmpty, AutocompleteItem, AutocompleteList, AutocompletePopover } from "prosekit/vue/autocomplete";
27
- const appConfig = useAppConfig();
28
- const editor = useEditor();
29
- const regex = /\/((?:\S.*)?)$/u;
30
- const items = [
31
- // {
32
- // label: 'Параграф',
33
- // icon: appConfig.ui.icons.pilcrow,
34
- // command: () => editor.value.commands.setParagraph(),
35
- // },
36
- {
37
- label: "\u0417\u0430\u0433\u043E\u043B\u043E\u0432\u043E\u043A H2",
38
- icon: appConfig.ui.icons.heading2,
39
- command: () => editor.value.commands.setHeading({ level: 2 })
40
- },
41
- {
42
- label: "\u0417\u0430\u0433\u043E\u043B\u043E\u0432\u043E\u043A H3",
43
- icon: appConfig.ui.icons.heading3,
44
- command: () => editor.value.commands.setHeading({ level: 3 })
45
- },
46
- {
47
- label: "\u0417\u0430\u0433\u043E\u043B\u043E\u0432\u043E\u043A H4",
48
- icon: appConfig.ui.icons.heading4,
49
- command: () => editor.value.commands.setHeading({ level: 4 })
50
- },
51
- {
52
- label: "\u041D\u0443\u043C\u0435\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0439 \u0441\u043F\u0438\u0441\u043E\u043A",
53
- icon: appConfig.ui.icons.list,
54
- command: () => editor.value.commands.wrapInList({ kind: "bullet" })
55
- },
56
- {
57
- label: "\u041C\u0430\u0440\u043A\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0439 \u0441\u043F\u0438\u0441\u043E\u043A",
58
- icon: appConfig.ui.icons.listOrdered,
59
- command: () => editor.value.commands.wrapInList({ kind: "ordered" })
60
- },
61
- {
62
- label: "\u0421\u043F\u0438\u0441\u043E\u043A \u0437\u0430\u0434\u0430\u0447",
63
- icon: appConfig.ui.icons.checkSquare,
64
- command: () => editor.value.commands.wrapInList({ kind: "task" })
65
- },
66
- {
67
- label: "\u0418\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435",
68
- icon: appConfig.ui.icons.image,
69
- command: () => editor.value.commands.setUploraImage()
70
- },
71
- {
72
- label: "\u0426\u0438\u0442\u0430\u0442\u0430",
73
- icon: appConfig.ui.icons.quote,
74
- command: () => editor.value.commands.setBlockquote()
75
- },
76
- {
77
- label: "\u0417\u0430\u043C\u0435\u0442\u043A\u0430",
78
- icon: appConfig.ui.icons.info,
79
- command: () => editor.value.commands.toggleCallout()
80
- },
81
- // {
82
- // label: 'Разделитель',
83
- // icon: appConfig.ui.icons.minus,
84
- // command: () => editor.value.commands.insertHorizontalRule(),
85
- // },
86
- {
87
- label: "\u041A\u043E\u0434",
88
- icon: appConfig.ui.icons.code,
89
- command: () => editor.value.commands.setCodeBlock()
90
- }
91
- ];
92
- </script>
@@ -1,7 +0,0 @@
1
- export interface CommandItem {
2
- label: string;
3
- icon: string;
4
- command: () => void;
5
- }
6
- declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
7
- export default _default;
@@ -1,81 +0,0 @@
1
- <template>
2
- <InlinePopover
3
- placement="top"
4
- :default-open="false"
5
- :open="popoverOpen"
6
- :offset="48"
7
- class="bg-default shadow-lg rounded-md ring ring-default flex gap-1 p-2 [&:not([data-state])]:hidden"
8
- @open-change="openChangeHandler"
9
- >
10
- <div v-if="editMode" class="flex gap-2">
11
- <UInput v-model="formState.href" placeholder="Введите ссылку..." size="sm" />
12
- <UButton :icon="appConfig.ui.icons.link" size="sm" @click="linkUpdateHandler" />
13
- </div>
14
- <div v-else class="flex gap-1 items-center">
15
- <div class="w-32 text-sm truncate mr-1">
16
- <ULink :href="formState.href" target="_blank" rel="noopener noreferrer nofollow">
17
- {{ formState.href }}
18
- </ULink>
19
- </div>
20
- <UButton
21
- :icon="appConfig.ui.icons.linkOff"
22
- size="sm"
23
- variant="ghost"
24
- color="error"
25
- @click="linkRemoveHandler"
26
- />
27
- <UButton
28
- :icon="appConfig.ui.icons.edit"
29
- size="sm"
30
- variant="ghost"
31
- @click="editMode = true"
32
- />
33
- </div>
34
- </InlinePopover>
35
- </template>
36
-
37
- <script setup>
38
- import { reactive, ref, useAppConfig, watch } from "#imports";
39
- import { useEditor } from "prosekit/vue";
40
- import { InlinePopover } from "prosekit/vue/inline-popover";
41
- const appConfig = useAppConfig();
42
- const popoverOpen = defineModel("open", { type: Boolean, ...{ default: false } });
43
- const editor = useEditor({ update: true });
44
- const editMode = ref(false);
45
- const formState = reactive({
46
- href: ""
47
- });
48
- function getCurrentLink(state) {
49
- const { $from } = state.selection;
50
- const marks = $from.marksAcross($from);
51
- const defaultAttrs = { href: "" };
52
- if (!marks) {
53
- return defaultAttrs;
54
- }
55
- for (const mark of marks) {
56
- if (mark.type.name === "link") {
57
- return mark.attrs;
58
- }
59
- }
60
- return defaultAttrs;
61
- }
62
- function linkUpdateHandler() {
63
- editor.value.commands.addLink(formState);
64
- popoverOpen.value = false;
65
- }
66
- function linkRemoveHandler() {
67
- editor.value.commands.removeLink();
68
- popoverOpen.value = false;
69
- }
70
- function openChangeHandler(open) {
71
- popoverOpen.value = open;
72
- }
73
- watch(popoverOpen, (value) => {
74
- if (value === false) {
75
- editMode.value = false;
76
- return;
77
- }
78
- Object.assign(formState, getCurrentLink(editor.value.state));
79
- editMode.value = formState.href.length === 0;
80
- });
81
- </script>
@@ -1,9 +0,0 @@
1
- type __VLS_PublicProps = {
2
- 'open'?: boolean;
3
- };
4
- declare const _default: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
5
- "update:open": (value: boolean) => any;
6
- }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
7
- "onUpdate:open"?: ((value: boolean) => any) | undefined;
8
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
- export default _default;
@@ -1,75 +0,0 @@
1
- <template>
2
- <div>
3
- <InlinePopover class="bg-default shadow-lg rounded-md ring ring-default flex gap-1 p-1 [&:not([data-state])]:hidden">
4
- <UButton
5
- v-for="(item, key) in textTransformItems"
6
- :key="key"
7
- :icon="item.icon"
8
- :variant="item.active ? 'soft' : 'ghost'"
9
- :disabled="item.disabled"
10
- color="neutral"
11
- size="xs"
12
- @click="item.action()"
13
- />
14
- </InlinePopover>
15
-
16
- <TooltipLink v-model:open="linkMenuOpen" />
17
- </div>
18
- </template>
19
-
20
- <script setup>
21
- import { computed, ref, useAppConfig } from "#imports";
22
- import { useEditor } from "prosekit/vue";
23
- import { InlinePopover } from "prosekit/vue/inline-popover";
24
- import TooltipLink from "./TooltipLink.vue";
25
- const appConfig = useAppConfig();
26
- const editor = useEditor({ update: true });
27
- const linkMenuOpen = ref(false);
28
- const textTransformItems = computed(() => [
29
- {
30
- label: "\u0416\u0438\u0440\u043D\u044B\u0439",
31
- icon: appConfig.ui.icons.bold,
32
- active: editor.value.marks.bold.isActive(),
33
- disabled: !editor.value.commands.toggleBold.canExec(),
34
- action: () => editor.value.commands.toggleBold()
35
- },
36
- {
37
- label: "\u041A\u0443\u0440\u0441\u0438\u0432",
38
- icon: appConfig.ui.icons.italic,
39
- active: editor.value.marks.italic.isActive(),
40
- disabled: !editor.value.commands.toggleItalic.canExec(),
41
- action: () => editor.value.commands.toggleItalic()
42
- },
43
- {
44
- label: "\u041F\u043E\u0434\u0447\u0435\u0440\u043A\u043D\u0443\u0442\u044B\u0439",
45
- icon: appConfig.ui.icons.underline,
46
- active: editor.value.marks.underline.isActive(),
47
- disabled: !editor.value.commands.toggleUnderline.canExec(),
48
- action: () => editor.value.commands.toggleUnderline()
49
- },
50
- {
51
- label: "\u0417\u0430\u0447\u0435\u0440\u043A\u043D\u0443\u0442\u044B\u0439",
52
- icon: appConfig.ui.icons.strike,
53
- active: editor.value.marks.strike.isActive(),
54
- disabled: !editor.value.commands.toggleStrike.canExec(),
55
- action: () => editor.value.commands.toggleStrike()
56
- },
57
- {
58
- label: "\u041A\u043E\u0434",
59
- icon: appConfig.ui.icons.code,
60
- active: editor.value.marks.code.isActive(),
61
- disabled: !editor.value.commands.toggleCode.canExec(),
62
- action: () => editor.value.commands.toggleCode()
63
- },
64
- {
65
- label: "\u0421\u0441\u044B\u043B\u043A\u0430",
66
- icon: appConfig.ui.icons.link,
67
- active: editor.value.marks.link.isActive(),
68
- disabled: !editor.value.commands.addLink.canExec({ href: "" }),
69
- action: () => {
70
- editor.value.commands.expandLink();
71
- linkMenuOpen.value = !linkMenuOpen.value;
72
- }
73
- }
74
- ]);
75
- </script>
@@ -1,9 +0,0 @@
1
- export interface TooltipMenuItem {
2
- label: string;
3
- icon: string;
4
- active: boolean;
5
- disabled: boolean;
6
- action: () => void;
7
- }
8
- declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
9
- export default _default;