@hywax/cms 0.0.3 → 0.0.5

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 (104) hide show
  1. package/.nuxt/cms/autocomplete-select.ts +5 -0
  2. package/.nuxt/cms/button-copy.ts +5 -0
  3. package/.nuxt/cms/button-delete.ts +5 -0
  4. package/.nuxt/cms/form-panel-aside-section.ts +9 -0
  5. package/.nuxt/cms/form-panel-section.ts +8 -0
  6. package/.nuxt/cms/form-panel.ts +15 -0
  7. package/.nuxt/cms/http-codes.ts +8 -0
  8. package/.nuxt/cms/index.ts +16 -0
  9. package/.nuxt/cms/input-seo.ts +5 -0
  10. package/.nuxt/cms/input-slug.ts +5 -0
  11. package/.nuxt/cms/modal-confirm.ts +5 -0
  12. package/.nuxt/cms/table-cell-preview.ts +9 -0
  13. package/.nuxt/cms/table-cell-seo.ts +5 -0
  14. package/.nuxt/cms/table-cell-user.ts +5 -0
  15. package/.nuxt/cms/table-panel-column-sorting.ts +5 -0
  16. package/.nuxt/cms/table-panel-column-visibility.ts +5 -0
  17. package/.nuxt/cms/table-panel-filters.ts +5 -0
  18. package/.nuxt/cms/table-panel.ts +8 -0
  19. package/cli/templates.mjs +3 -2
  20. package/dist/module.d.mts +22 -13
  21. package/dist/module.json +1 -1
  22. package/dist/module.mjs +261 -35
  23. package/dist/runtime/components/AutocompleteSelect.vue +170 -0
  24. package/dist/runtime/components/AutocompleteSelect.vue.d.ts +42 -0
  25. package/dist/runtime/components/ButtonCopy.vue +40 -0
  26. package/dist/runtime/components/ButtonCopy.vue.d.ts +23 -0
  27. package/dist/runtime/components/ButtonDelete.vue +52 -0
  28. package/dist/runtime/components/ButtonDelete.vue.d.ts +28 -0
  29. package/dist/runtime/components/FormPanel.vue +70 -0
  30. package/dist/runtime/components/FormPanel.vue.d.ts +41 -0
  31. package/dist/runtime/components/FormPanelAsideSection.vue +41 -0
  32. package/dist/runtime/components/FormPanelAsideSection.vue.d.ts +23 -0
  33. package/dist/runtime/components/FormPanelSection.vue +31 -0
  34. package/dist/runtime/components/FormPanelSection.vue.d.ts +20 -0
  35. package/dist/runtime/components/InputSeo.vue +73 -0
  36. package/dist/runtime/components/InputSeo.vue.d.ts +19 -0
  37. package/dist/runtime/components/InputSlug.vue +70 -0
  38. package/dist/runtime/components/InputSlug.vue.d.ts +29 -0
  39. package/dist/runtime/components/ModalConfirm.vue +91 -0
  40. package/dist/runtime/components/ModalConfirm.vue.d.ts +26 -0
  41. package/dist/runtime/components/TableCellPreview.vue +40 -0
  42. package/dist/runtime/components/TableCellPreview.vue.d.ts +18 -0
  43. package/dist/runtime/components/TableCellSeo.vue +34 -0
  44. package/dist/runtime/components/TableCellSeo.vue.d.ts +13 -0
  45. package/dist/runtime/components/TableCellUser.vue +33 -0
  46. package/dist/runtime/components/TableCellUser.vue.d.ts +15 -0
  47. package/dist/runtime/components/TablePanel.vue +153 -0
  48. package/dist/runtime/components/TablePanel.vue.d.ts +50 -0
  49. package/dist/runtime/components/TablePanelColumnSorting.vue +72 -0
  50. package/dist/runtime/components/TablePanelColumnSorting.vue.d.ts +20 -0
  51. package/dist/runtime/components/TablePanelColumnVisibility.vue +49 -0
  52. package/dist/runtime/components/TablePanelColumnVisibility.vue.d.ts +20 -0
  53. package/dist/runtime/components/TablePanelFilters.vue +79 -0
  54. package/dist/runtime/components/TablePanelFilters.vue.d.ts +34 -0
  55. package/dist/runtime/components/prose/UploraImage.vue +8 -3
  56. package/dist/runtime/composables/useDeleteConfirm.d.ts +15 -0
  57. package/dist/runtime/composables/useDeleteConfirm.js +29 -0
  58. package/dist/runtime/composables/useSeoStats.d.ts +2 -2
  59. package/dist/runtime/composables/useSeoStats.js +1 -1
  60. package/dist/runtime/composables/useTable.d.ts +19 -0
  61. package/dist/runtime/composables/useTable.js +90 -0
  62. package/dist/runtime/editor/markdown/index.d.ts +3 -0
  63. package/dist/runtime/editor/markdown/index.js +47 -0
  64. package/dist/runtime/editor/markdown/nodes/callout.d.ts +2 -0
  65. package/dist/runtime/editor/markdown/nodes/callout.js +21 -0
  66. package/dist/runtime/editor/markdown/nodes/uploraImage.d.ts +2 -0
  67. package/dist/runtime/editor/markdown/nodes/uploraImage.js +31 -0
  68. package/dist/runtime/plugins/api.js +1 -4
  69. package/dist/runtime/server/errors/InternalHttpError.d.ts +4 -0
  70. package/dist/runtime/server/errors/InternalHttpError.js +6 -0
  71. package/dist/runtime/server/errors/TimeoutError.d.ts +2 -0
  72. package/dist/runtime/server/errors/TimeoutError.js +2 -0
  73. package/dist/runtime/server/errors/index.d.ts +2 -0
  74. package/dist/runtime/server/errors/index.js +2 -0
  75. package/dist/runtime/server/types/errors.d.ts +8 -0
  76. package/dist/runtime/server/types/errors.js +0 -0
  77. package/dist/runtime/server/types/index.d.ts +1 -0
  78. package/dist/runtime/server/types/index.js +1 -0
  79. package/dist/runtime/server/utils/errors.d.ts +8 -0
  80. package/dist/runtime/server/utils/errors.js +57 -0
  81. package/dist/runtime/server/utils/httpHandler.d.ts +10 -0
  82. package/dist/runtime/server/utils/httpHandler.js +15 -0
  83. package/dist/runtime/server/utils/pagination.d.ts +11 -0
  84. package/dist/runtime/server/utils/pagination.js +12 -0
  85. package/dist/runtime/server/utils/timeout.d.ts +7 -0
  86. package/dist/runtime/server/utils/timeout.js +9 -0
  87. package/dist/runtime/server/utils/validation.d.ts +3 -0
  88. package/dist/runtime/server/utils/validation.js +26 -0
  89. package/dist/runtime/types/index.d.ts +17 -0
  90. package/dist/runtime/types/index.js +17 -0
  91. package/dist/runtime/types/query.d.ts +22 -0
  92. package/dist/runtime/types/query.js +0 -0
  93. package/dist/runtime/types/utils.d.ts +4 -1
  94. package/dist/runtime/utils/avatar.d.ts +1 -0
  95. package/dist/runtime/utils/avatar.js +9 -0
  96. package/dist/runtime/utils/dictionaries.d.ts +4 -0
  97. package/dist/runtime/utils/dictionaries.js +6 -0
  98. package/dist/runtime/utils/image.js +1 -1
  99. package/dist/runtime/utils/index.d.ts +3 -0
  100. package/dist/runtime/utils/index.js +3 -0
  101. package/dist/runtime/utils/slugify.d.ts +1 -0
  102. package/dist/runtime/utils/slugify.js +12 -0
  103. package/dist/types.d.mts +6 -2
  104. package/package.json +12 -7
@@ -0,0 +1,5 @@
1
+ export default {
2
+ "slots": {
3
+ "root": ""
4
+ }
5
+ }
@@ -0,0 +1,5 @@
1
+ export default {
2
+ "slots": {
3
+ "root": ""
4
+ }
5
+ }
@@ -0,0 +1,5 @@
1
+ export default {
2
+ "slots": {
3
+ "root": ""
4
+ }
5
+ }
@@ -0,0 +1,9 @@
1
+ export default {
2
+ "slots": {
3
+ "root": "",
4
+ "header": "flex items-center gap-2 mb-2",
5
+ "icon": "size-5",
6
+ "title": "break-words text-sm font-semibold",
7
+ "body": ""
8
+ }
9
+ }
@@ -0,0 +1,8 @@
1
+ export default {
2
+ "slots": {
3
+ "root": "",
4
+ "title": "text-base text-pretty font-semibold text-highlighted",
5
+ "description": "text-[15px] text-pretty text-muted mt-1",
6
+ "body": "relative rounded-lg bg-elevated/50 ring ring-default grid gap-x-8 gap-y-4 p-4 sm:p-6 mt-4"
7
+ }
8
+ }
@@ -0,0 +1,15 @@
1
+ export default {
2
+ "slots": {
3
+ "root": "",
4
+ "form": "flex flex-1 flex-row",
5
+ "body": "flex-1 overflow-y-auto w-full lg:max-w-2xl mx-auto p-4 sm:p-6",
6
+ "sidebar": "flex-1 overflow-y-auto border-l border-default w-full max-w-xs p-4 sm:p-4"
7
+ },
8
+ "variants": {
9
+ "asideDivide": {
10
+ "true": {
11
+ "sidebar": "*:not-last:after:absolute *:not-last:after:inset-x-1 *:not-last:after:bottom-0 *:not-last:after:bg-border *:not-last:after:h-px *:not-last:relative *:not-last:pb-4 flex flex-col gap-4"
12
+ }
13
+ }
14
+ }
15
+ }
@@ -0,0 +1,8 @@
1
+ export const HTTP_CODE_BAD_REQUEST = '400: Неверный запрос'
2
+ export const HTTP_CODE_UNAUTHORIZED = '401: Не авторизован'
3
+ export const HTTP_CODE_FORBIDDEN = '403: Доступ запрещен'
4
+ export const HTTP_CODE_NOT_FOUND = '404: Не найдено'
5
+ export const HTTP_CODE_REQUEST_TIMEOUT = '408: Время ожидания запроса истекло'
6
+ export const HTTP_CODE_INTERNAL_SERVER_ERROR = '500: Внутренняя ошибка сервера'
7
+ export const HTTP_CODE_BAD_GATEWAY = '502: Ошибка шлюза'
8
+ export const HTTP_CODE_SERVICE_UNAVAILABLE = '503: Сервис недоступен'
@@ -1,2 +1,18 @@
1
+ export { default as autocompleteSelect } from './autocomplete-select'
1
2
  export { default as buttonClear } from './button-clear'
3
+ export { default as buttonCopy } from './button-copy'
4
+ export { default as buttonDelete } from './button-delete'
5
+ export { default as formPanel } from './form-panel'
6
+ export { default as formPanelAsideSection } from './form-panel-aside-section'
7
+ export { default as formPanelSection } from './form-panel-section'
8
+ export { default as inputSeo } from './input-seo'
9
+ export { default as inputSlug } from './input-slug'
10
+ export { default as modalConfirm } from './modal-confirm'
11
+ export { default as tableCellPreview } from './table-cell-preview'
12
+ export { default as tableCellSeo } from './table-cell-seo'
13
+ export { default as tableCellUser } from './table-cell-user'
14
+ export { default as tablePanel } from './table-panel'
15
+ export { default as tablePanelColumnSorting } from './table-panel-column-sorting'
16
+ export { default as tablePanelColumnVisibility } from './table-panel-column-visibility'
17
+ export { default as tablePanelFilters } from './table-panel-filters'
2
18
  export { default as uploraImage } from './uplora-image'
@@ -0,0 +1,5 @@
1
+ export default {
2
+ "slots": {
3
+ "root": "flex flex-col gap-4"
4
+ }
5
+ }
@@ -0,0 +1,5 @@
1
+ export default {
2
+ "slots": {
3
+ "root": "flex flex-col gap-4"
4
+ }
5
+ }
@@ -0,0 +1,5 @@
1
+ export default {
2
+ "slots": {
3
+ "root": ""
4
+ }
5
+ }
@@ -0,0 +1,9 @@
1
+ export default {
2
+ "slots": {
3
+ "root": "flex items-center gap-2",
4
+ "image": "bg-elevated size-7 rounded-md",
5
+ "container": "text-xs",
6
+ "title": "font-medium text-default",
7
+ "description": "text-muted truncate max-w-40"
8
+ }
9
+ }
@@ -0,0 +1,5 @@
1
+ export default {
2
+ "slots": {
3
+ "root": "flex gap-2"
4
+ }
5
+ }
@@ -0,0 +1,5 @@
1
+ export default {
2
+ "slots": {
3
+ "root": ""
4
+ }
5
+ }
@@ -0,0 +1,5 @@
1
+ export default {
2
+ "slots": {
3
+ "root": ""
4
+ }
5
+ }
@@ -0,0 +1,5 @@
1
+ export default {
2
+ "slots": {
3
+ "root": ""
4
+ }
5
+ }
@@ -0,0 +1,5 @@
1
+ export default {
2
+ "slots": {
3
+ "root": ""
4
+ }
5
+ }
@@ -0,0 +1,8 @@
1
+ export default {
2
+ "slots": {
3
+ "root": "",
4
+ "table": "",
5
+ "loader": "absolute z-10 inset-0 left-0 bg-default/90 flex items-center justify-center",
6
+ "loaderIcon": "animate-spin size-6"
7
+ }
8
+ }
package/cli/templates.mjs CHANGED
@@ -23,7 +23,7 @@ import { computed, useAppConfig } from '#imports'
23
23
  import { Primitive } from 'reka-ui'
24
24
  import { tv } from '${prose ? '../../utils/tv' : '../utils/tv'}'
25
25
 
26
- type ${upperName} = ComponentConfig<typeof theme, AppConfig, ${upperName}>
26
+ type ${upperName} = ComponentConfig<typeof theme, AppConfig, '${camelName}'>
27
27
 
28
28
  export interface ${upperName}Props {
29
29
  as?: any
@@ -62,13 +62,14 @@ function test({ name, prose }) {
62
62
  ? undefined
63
63
  : `
64
64
  import type { ${upperName}Props, ${upperName}Slots } from '../../../src/runtime/components/${upperName}.vue'
65
- import { describe, it, expect } from 'vitest'
65
+ import { describe, expect, it } from 'vitest'
66
66
  import ${upperName} from '../../../src/runtime/components/${upperName}.vue'
67
67
  import ComponentRender from '../../component-render'
68
68
 
69
69
  describe('${upperName}', () => {
70
70
  it.each([
71
71
  // Props
72
+ ['базовый компонент', { props: {} }],
72
73
  ['с алиасом', { props: { as: 'section' } }],
73
74
  ['с class', { props: { class: '' } }],
74
75
  ['с ui', { props: { ui: {} } }],
package/dist/module.d.mts CHANGED
@@ -1,17 +1,7 @@
1
1
  import * as _nuxt_schema from '@nuxt/schema';
2
2
  export * from '../dist/runtime/types/index.js';
3
3
 
4
- declare module '@nuxt/schema' {
5
- interface ConfigSchema {
6
- public?: {
7
- cms: {
8
- fluxorUrl: string;
9
- };
10
- };
11
- }
12
- }
13
-
14
- interface ModuleOptions {
4
+ interface CMSOptions {
15
5
  /**
16
6
  * Name of the module
17
7
  * @defaultValue 'cms'
@@ -27,8 +17,27 @@ interface ModuleOptions {
27
17
  * @defaultValue 'https://fluxor.uplora.ru'
28
18
  */
29
19
  fluxorUrl?: string;
20
+ /**
21
+ * Prefix for the environment variables
22
+ * @defaultValue 'APP_'
23
+ */
24
+ envPrefix?: string;
25
+ /**
26
+ * HTTP codes
27
+ * @defaultValue {}
28
+ */
29
+ httpCodes?: Record<string, string>;
30
30
  }
31
- declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
31
+
32
+ declare module '@nuxt/schema' {
33
+ interface ConfigSchema {
34
+ public?: {
35
+ fluxorUrl: string;
36
+ version: string;
37
+ };
38
+ }
39
+ }
40
+
41
+ declare const _default: _nuxt_schema.NuxtModule<CMSOptions, CMSOptions, false>;
32
42
 
33
43
  export { _default as default };
34
- export type { ModuleOptions };
package/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hywax/cms",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "configKey": "cms",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.1",
package/dist/module.mjs CHANGED
@@ -1,10 +1,89 @@
1
- import { addTypeTemplate, addTemplate, defineNuxtModule, hasNuxtModule, installModule, createResolver, addComponentsDir, addImportsDir, addPlugin } from '@nuxt/kit';
1
+ import { createResolver, addComponentsDir, addImportsDir, addPlugin, addImports, addServerImports, addServerImportsDir, addTypeTemplate, addTemplate, addServerTemplate, defineNuxtModule, hasNuxtModule, installModule } from '@nuxt/kit';
2
2
  import { defu } from 'defu';
3
- import 'node:url';
4
- import { kebabCase } from 'scule';
3
+ import { fileURLToPath } from 'node:url';
4
+ import { dirname } from 'pathe';
5
+ import { snakeCase, kebabCase } from 'scule';
5
6
 
6
7
  const name = "@hywax/cms";
7
- const version = "0.0.3";
8
+ const version = "0.0.5";
9
+
10
+ function createContext(options, nuxt) {
11
+ const { resolve } = createResolver(import.meta.url);
12
+ const distDir = dirname(fileURLToPath(import.meta.url));
13
+ const runtimeDir = fileURLToPath(new URL("./runtime", import.meta.url));
14
+ return {
15
+ options,
16
+ resolve,
17
+ distDir,
18
+ runtimeDir,
19
+ nuxt
20
+ };
21
+ }
22
+
23
+ function getDefaultCMSConfig() {
24
+ return {};
25
+ }
26
+ const defaultModuleOptions = {
27
+ name: "cms",
28
+ prefix: "C",
29
+ fluxorUrl: "https://fluxor.uplora.ru",
30
+ envPrefix: "APP_",
31
+ httpCodes: {
32
+ badRequest: "400: \u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0437\u0430\u043F\u0440\u043E\u0441",
33
+ unauthorized: "401: \u041D\u0435 \u0430\u0432\u0442\u043E\u0440\u0438\u0437\u043E\u0432\u0430\u043D",
34
+ forbidden: "403: \u0414\u043E\u0441\u0442\u0443\u043F \u0437\u0430\u043F\u0440\u0435\u0449\u0435\u043D",
35
+ notFound: "404: \u041D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E",
36
+ requestTimeout: "408: \u0412\u0440\u0435\u043C\u044F \u043E\u0436\u0438\u0434\u0430\u043D\u0438\u044F \u0437\u0430\u043F\u0440\u043E\u0441\u0430 \u0438\u0441\u0442\u0435\u043A\u043B\u043E",
37
+ internalServerError: "500: \u0412\u043D\u0443\u0442\u0440\u0435\u043D\u043D\u044F\u044F \u043E\u0448\u0438\u0431\u043A\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430",
38
+ badGateway: "502: \u041E\u0448\u0438\u0431\u043A\u0430 \u0448\u043B\u044E\u0437\u0430",
39
+ serviceUnavailable: "503: \u0421\u0435\u0440\u0432\u0438\u0441 \u043D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u0435\u043D"
40
+ }
41
+ };
42
+
43
+ function transformHttpCodes(httpCodes) {
44
+ return Object.entries(httpCodes).map(([code, value]) => ({
45
+ code: `HTTP_CODE_${snakeCase(code).toUpperCase()}`,
46
+ value
47
+ }));
48
+ }
49
+
50
+ function prepareAutoImports({ resolve, options, nuxt }) {
51
+ const httpCodesPath = resolve(nuxt.options.buildDir, "cms/http-codes.ts");
52
+ const httpCodesImports = transformHttpCodes(options.httpCodes).map(({ code }) => ({ name: code, from: httpCodesPath }));
53
+ addComponentsDir({
54
+ path: resolve("./runtime/components"),
55
+ pathPrefix: false,
56
+ prefix: options?.prefix,
57
+ ignore: ["prose/**"]
58
+ });
59
+ addComponentsDir({
60
+ path: resolve("./runtime/components/prose"),
61
+ prefix: "Prose",
62
+ pathPrefix: false,
63
+ global: true
64
+ });
65
+ addImportsDir(resolve("./runtime/composables"));
66
+ addPlugin(resolve("./runtime/plugins/api.ts"));
67
+ addImports([
68
+ ...httpCodesImports,
69
+ { name: "docToMarkdown", from: resolve("./runtime/editor/markdown") },
70
+ { name: "markdownToDoc", from: resolve("./runtime/editor/markdown") }
71
+ ]);
72
+ addServerImports([
73
+ ...httpCodesImports,
74
+ { name: "docToMarkdown", from: resolve("./runtime/editor/markdown") },
75
+ { name: "markdownToDoc", from: resolve("./runtime/editor/markdown") }
76
+ ]);
77
+ addServerImportsDir(resolve("./runtime/server/utils"));
78
+ nuxt.options.nitro.alias ||= {};
79
+ nuxt.options.nitro.alias["#cms/http-codes"] = httpCodesPath;
80
+ }
81
+
82
+ const autocompleteSelect = {
83
+ slots: {
84
+ root: ""
85
+ }
86
+ };
8
87
 
9
88
  const buttonClear = {
10
89
  slots: {
@@ -12,6 +91,120 @@ const buttonClear = {
12
91
  }
13
92
  };
14
93
 
94
+ const buttonCopy = {
95
+ slots: {
96
+ root: ""
97
+ }
98
+ };
99
+
100
+ const buttonDelete = {
101
+ slots: {
102
+ root: ""
103
+ }
104
+ };
105
+
106
+ const formPanel = {
107
+ slots: {
108
+ root: "",
109
+ form: "flex flex-1 flex-row",
110
+ body: "flex-1 overflow-y-auto w-full lg:max-w-2xl mx-auto p-4 sm:p-6",
111
+ sidebar: "flex-1 overflow-y-auto border-l border-default w-full max-w-xs p-4 sm:p-4"
112
+ },
113
+ variants: {
114
+ asideDivide: {
115
+ true: {
116
+ sidebar: "*:not-last:after:absolute *:not-last:after:inset-x-1 *:not-last:after:bottom-0 *:not-last:after:bg-border *:not-last:after:h-px *:not-last:relative *:not-last:pb-4 flex flex-col gap-4"
117
+ }
118
+ }
119
+ }
120
+ };
121
+
122
+ const formPanelAsideSection = {
123
+ slots: {
124
+ root: "",
125
+ header: "flex items-center gap-2 mb-2",
126
+ icon: "size-5",
127
+ title: "break-words text-sm font-semibold",
128
+ body: ""
129
+ }
130
+ };
131
+
132
+ const formPanelSection = {
133
+ slots: {
134
+ root: "",
135
+ title: "text-base text-pretty font-semibold text-highlighted",
136
+ description: "text-[15px] text-pretty text-muted mt-1",
137
+ body: "relative rounded-lg bg-elevated/50 ring ring-default grid gap-x-8 gap-y-4 p-4 sm:p-6 mt-4"
138
+ }
139
+ };
140
+
141
+ const inputSeo = {
142
+ slots: {
143
+ root: "flex flex-col gap-4"
144
+ }
145
+ };
146
+
147
+ const inputSlug = {
148
+ slots: {
149
+ root: "flex flex-col gap-4"
150
+ }
151
+ };
152
+
153
+ const modalConfirm = {
154
+ slots: {
155
+ root: ""
156
+ }
157
+ };
158
+
159
+ const tableCellPreview = {
160
+ slots: {
161
+ root: "flex items-center gap-2",
162
+ image: "bg-elevated size-7 rounded-md",
163
+ container: "text-xs",
164
+ title: "font-medium text-default",
165
+ description: "text-muted truncate max-w-40"
166
+ }
167
+ };
168
+
169
+ const tableCellSeo = {
170
+ slots: {
171
+ root: "flex gap-2"
172
+ }
173
+ };
174
+
175
+ const tableCellUser = {
176
+ slots: {
177
+ root: ""
178
+ }
179
+ };
180
+
181
+ const tablePanel = {
182
+ slots: {
183
+ root: "",
184
+ table: "",
185
+ loader: "absolute z-10 inset-0 left-0 bg-default/90 flex items-center justify-center",
186
+ loaderIcon: "animate-spin size-6"
187
+ }
188
+ };
189
+
190
+ const tablePanelColumnSorting = {
191
+ slots: {
192
+ root: ""
193
+ }
194
+ };
195
+
196
+ const tablePanelColumnVisibility = {
197
+ slots: {
198
+ root: ""
199
+ }
200
+ };
201
+
202
+ const tablePanelFilters = {
203
+ slots: {
204
+ root: ""
205
+ }
206
+ };
207
+
15
208
  const uploraImage$1 = {
16
209
  slots: {
17
210
  root: "relative grid grid-cols-[100%] grid-rows-[100%] overflow-hidden",
@@ -23,7 +216,23 @@ const uploraImage$1 = {
23
216
 
24
217
  const theme = {
25
218
  __proto__: null,
219
+ autocompleteSelect: autocompleteSelect,
26
220
  buttonClear: buttonClear,
221
+ buttonCopy: buttonCopy,
222
+ buttonDelete: buttonDelete,
223
+ formPanel: formPanel,
224
+ formPanelAsideSection: formPanelAsideSection,
225
+ formPanelSection: formPanelSection,
226
+ inputSeo: inputSeo,
227
+ inputSlug: inputSlug,
228
+ modalConfirm: modalConfirm,
229
+ tableCellPreview: tableCellPreview,
230
+ tableCellSeo: tableCellSeo,
231
+ tableCellUser: tableCellUser,
232
+ tablePanel: tablePanel,
233
+ tablePanelColumnSorting: tablePanelColumnSorting,
234
+ tablePanelColumnVisibility: tablePanelColumnVisibility,
235
+ tablePanelFilters: tablePanelFilters,
27
236
  uploraImage: uploraImage$1
28
237
  };
29
238
 
@@ -38,7 +247,7 @@ const themeProse = {
38
247
  uploraImage: uploraImage
39
248
  };
40
249
 
41
- function getTemplates(options) {
250
+ function getAppTemplates({ options }) {
42
251
  const templates = [];
43
252
  function writeThemeTemplate(theme2, path) {
44
253
  for (const component in theme2) {
@@ -97,8 +306,11 @@ function getTemplates(options) {
97
306
  filename: "types/cms.d.ts",
98
307
  getContents: () => `import * as cms from '#build/cms'
99
308
  import type { TVConfig } from '@nuxt/ui'
309
+ import type { RouteLocationRaw } from 'vue-router'
310
+
311
+ type AppConfigCMS = {
100
312
 
101
- type AppConfigCMS = TVConfig<typeof cms>
313
+ } & TVConfig<typeof cms>
102
314
 
103
315
  declare module '@nuxt/schema' {
104
316
  interface AppConfigInput {
@@ -112,20 +324,48 @@ declare module '@nuxt/schema' {
112
324
  export {}
113
325
  `
114
326
  });
327
+ templates.push({
328
+ filename: "cms/http-codes.ts",
329
+ write: true,
330
+ getContents: () => {
331
+ const httpCodes = transformHttpCodes(options.httpCodes);
332
+ const content = httpCodes.map(({ code, value }) => `export const ${code} = '${value}'`).join("\n");
333
+ return `${content}
334
+ `;
335
+ }
336
+ });
337
+ return templates;
338
+ }
339
+ function getServerTemplates(_context) {
340
+ const templates = [];
115
341
  return templates;
116
342
  }
117
- function addTemplates(options) {
118
- const templates = getTemplates(options);
119
- for (const template of templates) {
343
+ function prepareTemplates(context) {
344
+ const appTemplates = getAppTemplates(context);
345
+ const serverTemplates = getServerTemplates();
346
+ for (const template of appTemplates) {
120
347
  if (template.filename.endsWith(".d.ts")) {
121
348
  addTypeTemplate(template);
122
349
  } else {
123
350
  addTemplate(template);
124
351
  }
125
352
  }
353
+ for (const template of serverTemplates) {
354
+ if (template.filename.endsWith(".d.ts")) {
355
+ addTypeTemplate(template, { nitro: true, nuxt: false });
356
+ } else {
357
+ addServerTemplate(template);
358
+ }
359
+ }
126
360
  }
127
361
 
128
- const icons = {};
362
+ const icons = {
363
+ sortAsc: "lucide:arrow-up-wide-narrow",
364
+ sortDesc: "lucide:arrow-down-wide-narrow",
365
+ columns: "lucide:columns-3-cog",
366
+ filter: "lucide:filter",
367
+ link: "lucide:link-2"
368
+ };
129
369
 
130
370
  const module = defineNuxtModule({
131
371
  meta: {
@@ -133,15 +373,15 @@ const module = defineNuxtModule({
133
373
  version,
134
374
  configKey: "cms"
135
375
  },
136
- defaults: {
137
- name: "cms",
138
- prefix: "C",
139
- fluxorUrl: "https://fluxor.uplora.ru"
140
- },
376
+ defaults: defaultModuleOptions,
141
377
  async setup(options, nuxt) {
142
- nuxt.options.runtimeConfig.public.cms = defu(nuxt.options.runtimeConfig.public.cms || {}, {
143
- fluxorUrl: options.fluxorUrl
378
+ const context = createContext(options, nuxt);
379
+ nuxt.options.runtimeConfig.public = defu(nuxt.options.runtimeConfig.public || {}, {
380
+ fluxorUrl: options.fluxorUrl,
381
+ version: ""
144
382
  });
383
+ nuxt.options.runtimeConfig.nitro ||= {};
384
+ nuxt.options.runtimeConfig.nitro.envPrefix = options.envPrefix;
145
385
  nuxt.options.appConfig.ui = defu(nuxt.options.appConfig.ui || {}, {
146
386
  icons
147
387
  });
@@ -174,24 +414,10 @@ const module = defineNuxtModule({
174
414
  if (!hasNuxtModule("nuxt-auth-utils")) {
175
415
  await installModule("nuxt-auth-utils");
176
416
  }
177
- const { resolve } = createResolver(import.meta.url);
178
- nuxt.options.alias["#cms"] = resolve("./runtime");
179
- nuxt.options.appConfig.cms = defu(nuxt.options.appConfig.cms || {}, {});
180
- addComponentsDir({
181
- path: resolve("./runtime/components"),
182
- pathPrefix: false,
183
- prefix: options?.prefix || "C",
184
- ignore: ["prose/**"]
185
- });
186
- addComponentsDir({
187
- path: resolve("./runtime/components/prose"),
188
- prefix: "Prose",
189
- pathPrefix: false,
190
- global: true
191
- });
192
- addImportsDir(resolve("./runtime/composables"));
193
- addTemplates(options);
194
- addPlugin(resolve("./runtime/plugins/api.ts"));
417
+ nuxt.options.alias["#cms"] = context.resolve("./runtime");
418
+ nuxt.options.appConfig.cms = defu(nuxt.options.appConfig.cms || {}, getDefaultCMSConfig());
419
+ prepareAutoImports(context);
420
+ prepareTemplates(context);
195
421
  }
196
422
  });
197
423