@hywax/cms 3.4.1 → 3.4.3

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.
@@ -3,11 +3,14 @@ const cmsConfig = {
3
3
  "formats": {
4
4
  "serverDateTime": "YYYY-MM-DD HH:mm:ss"
5
5
  },
6
- "prose": {
7
- "enabled": true,
6
+ "components": {
8
7
  "uploraImage": {
9
- "formats": [],
10
- "sizes": []
8
+ "formats": []
9
+ },
10
+ "prose": {
11
+ "uploraImage": {
12
+ "sizes": []
13
+ }
11
14
  }
12
15
  }
13
16
  }
@@ -1,5 +1,5 @@
1
1
  export default {
2
2
  "slots": {
3
- "base": ""
3
+ "base": "rounded-lg"
4
4
  }
5
5
  }
package/.nuxt/cms.css CHANGED
@@ -4,9 +4,10 @@
4
4
  @source "./cms/form-slug.ts";
5
5
  @source "./cms/form-uplora-image.ts";
6
6
  @source "./cms/uplora-image.ts";
7
+ @source "./cms/button-delete-confirm.ts";
8
+ @source "./cms/modal-confirm.ts";
7
9
  @source "./cms/form-seo.ts";
8
10
  @source "./cms/table-panel.ts";
9
- @source "./cms/modal-confirm.ts";
10
11
  @source "./cms/table-search-input.ts";
11
12
 
12
13
 
package/dist/module.d.mts CHANGED
@@ -50,14 +50,20 @@ interface CMSCoreOptions {
50
50
  formats?: {
51
51
  serverDateTime?: string;
52
52
  };
53
- /**
54
- * Prose configuration
55
- */
56
- prose?: {
57
- enabled?: boolean;
53
+ components?: {
54
+ /**
55
+ * Uplora image configuration
56
+ */
58
57
  uploraImage?: {
59
58
  formats?: ImageFormat[];
60
- sizes?: ImageSize[];
59
+ };
60
+ /**
61
+ * Prose configuration
62
+ */
63
+ prose?: {
64
+ uploraImage?: {
65
+ sizes?: ImageSize[];
66
+ };
61
67
  };
62
68
  };
63
69
  }
package/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hywax/cms",
3
- "version": "3.4.1",
3
+ "version": "3.4.3",
4
4
  "configKey": "cms",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
package/dist/module.mjs CHANGED
@@ -7,7 +7,7 @@ import { pascalCase, kebabCase, camelCase } from 'scule';
7
7
  import { globSync } from 'tinyglobby';
8
8
 
9
9
  const name = "@hywax/cms";
10
- const version = "3.4.1";
10
+ const version = "3.4.3";
11
11
 
12
12
  function createContext(options, nuxt) {
13
13
  const { resolve } = createResolver(import.meta.url);
@@ -31,6 +31,19 @@ const defaultModuleOptions = {
31
31
  envPrefix: "APP_",
32
32
  unovis: false,
33
33
  componentDetection: true,
34
+ components: {
35
+ uploraImage: {
36
+ formats: []
37
+ },
38
+ prose: {
39
+ uploraImage: {
40
+ sizes: []
41
+ }
42
+ }
43
+ },
44
+ formats: {
45
+ serverDateTime: "YYYY-MM-DD HH:mm:ss"
46
+ },
34
47
  httpStatuses: {
35
48
  badRequest: {
36
49
  code: 400,
@@ -80,16 +93,6 @@ const defaultModuleOptions = {
80
93
  code: 503,
81
94
  message: "\u0421\u0435\u0440\u0432\u0438\u0441 \u043D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u0435\u043D"
82
95
  }
83
- },
84
- formats: {
85
- serverDateTime: "YYYY-MM-DD HH:mm:ss"
86
- },
87
- prose: {
88
- enabled: true,
89
- uploraImage: {
90
- formats: [],
91
- sizes: []
92
- }
93
96
  }
94
97
  };
95
98
 
@@ -560,7 +563,7 @@ const theme = {
560
563
 
561
564
  const uploraImage = {
562
565
  slots: {
563
- base: ""
566
+ base: "rounded-lg"
564
567
  }
565
568
  };
566
569
 
@@ -607,7 +610,7 @@ async function getAppTemplates({ options, resolve, nuxt, detectedComponents: con
607
610
  }
608
611
  }
609
612
  async function generateSources() {
610
- const sources2 = [];
613
+ const sources = [];
611
614
  const layers = getLayerDirectories(nuxt).map((layer) => layer.app);
612
615
  if (options.componentDetection) {
613
616
  const detectedComponents = await detectUsedComponents({
@@ -628,14 +631,12 @@ async function getAppTemplates({ options, resolve, nuxt, detectedComponents: con
628
631
  logger.success(`CMS detected ${detectedComponents.size} components in use (including dependencies)`);
629
632
  }
630
633
  previousDetectedComponents = detectedComponents;
631
- if (options.prose?.enabled) {
632
- sources2.push('@source "./cms/prose";');
633
- }
634
+ sources.push('@source "./cms/prose";');
634
635
  for (const component of detectedComponents) {
635
636
  const kebabComponent = kebabCase(component);
636
637
  const camelComponent = camelCase(component);
637
638
  if (theme[camelComponent]) {
638
- sources2.push(`@source "./cms/${kebabComponent}.ts";`);
639
+ sources.push(`@source "./cms/${kebabComponent}.ts";`);
639
640
  }
640
641
  contextDetectedComponents.add(component);
641
642
  }
@@ -644,27 +645,26 @@ async function getAppTemplates({ options, resolve, nuxt, detectedComponents: con
644
645
  logger.info("CMS detected no components in use, including all components");
645
646
  }
646
647
  previousDetectedComponents = /* @__PURE__ */ new Set();
647
- sources2.push('@source "./cms";');
648
+ sources.push('@source "./cms";');
648
649
  }
649
650
  } else {
650
- sources2.push('@source "./cms";');
651
+ sources.push('@source "./cms";');
651
652
  }
652
- return sources2.join("\n");
653
- }
654
- if (options.prose?.enabled) {
655
- templates.push({
656
- filename: `cms/prose/index.ts`,
657
- write: true,
658
- getContents: () => Object.keys(themeProse).map((component) => `export { default as ${component} } from './${kebabCase(component)}'`).join("\n")
659
- });
660
- writeThemeTemplate(themeProse, "prose");
653
+ return sources.join("\n");
661
654
  }
655
+ templates.push({
656
+ filename: `cms/prose/index.ts`,
657
+ write: true,
658
+ getContents: () => Object.keys(themeProse).map((component) => `export { default as ${component} } from './${kebabCase(component)}'`).join("\n")
659
+ });
660
+ writeThemeTemplate(themeProse, "prose");
662
661
  writeThemeTemplate(theme);
663
- const sources = await generateSources();
662
+ await generateSources();
664
663
  templates.push({
665
664
  filename: "cms.css",
666
665
  write: true,
667
666
  getContents: async () => {
667
+ const sources = await generateSources();
668
668
  return `${sources}
669
669
  ${options.unovis ? `
670
670
  @layer components {
@@ -704,7 +704,7 @@ ${options.unovis ? `
704
704
  write: true,
705
705
  getContents: () => [
706
706
  ...Object.keys(theme).map((component) => `export { default as ${component} } from './${kebabCase(component)}'`),
707
- ...options.prose?.enabled ? [`export * as prose from './prose'`] : []
707
+ `export * as prose from './prose'`
708
708
  ].join("\n")
709
709
  });
710
710
  templates.push({
@@ -744,7 +744,7 @@ export {}
744
744
  const config = {
745
745
  name: options.name,
746
746
  formats: options.formats,
747
- prose: options.prose
747
+ components: options.components
748
748
  };
749
749
  return `const cmsConfig = ${JSON.stringify(config, null, 2)}
750
750
 
@@ -4,10 +4,10 @@ import type { ComponentProps } from 'vue-component-type-helpers';
4
4
  import type { ComponentConfig } from '../types';
5
5
  import type { ModalConfirmEmits, ModalConfirmProps } from './ModalConfirm.vue';
6
6
  import theme from '#build/cms/button-delete-confirm';
7
- import ModalConfirm from './ModalConfirm.vue';
7
+ import CModalConfirm from './ModalConfirm.vue';
8
8
  type ButtonDelete = ComponentConfig<typeof theme, AppConfig, 'buttonDelete'>;
9
9
  export interface ButtonDeleteProps extends Pick<ModalConfirmProps, 'onConfirm'> {
10
- modalProps?: Omit<ModalProps & ComponentProps<typeof ModalConfirm>, 'title' | 'message' | 'onConfirm' | 'confirmButton'>;
10
+ modalProps?: Omit<ModalProps & ComponentProps<typeof CModalConfirm>, 'title' | 'message' | 'onConfirm' | 'confirmButton'>;
11
11
  confirmText?: string;
12
12
  confirmLabel?: string;
13
13
  title?: string;
@@ -24,7 +24,7 @@ import theme from "#build/cms/button-delete-confirm";
24
24
  import { useAppConfig, useOverlay } from "#imports";
25
25
  import { computed } from "vue";
26
26
  import { tv } from "../tv";
27
- import ModalConfirm from "./ModalConfirm.vue";
27
+ import CModalConfirm from "./ModalConfirm.vue";
28
28
  </script>
29
29
 
30
30
  <script setup>
@@ -46,7 +46,7 @@ const props = defineProps({
46
46
  });
47
47
  defineEmits(["confirm", "close"]);
48
48
  const appConfig = useAppConfig();
49
- const modal = useOverlay().create(ModalConfirm);
49
+ const modal = useOverlay().create(CModalConfirm);
50
50
  function handleDeleteClick() {
51
51
  return modal.open({
52
52
  ...props.modalProps,
@@ -4,10 +4,10 @@ import type { ComponentProps } from 'vue-component-type-helpers';
4
4
  import type { ComponentConfig } from '../types';
5
5
  import type { ModalConfirmEmits, ModalConfirmProps } from './ModalConfirm.vue';
6
6
  import theme from '#build/cms/button-delete-confirm';
7
- import ModalConfirm from './ModalConfirm.vue';
7
+ import CModalConfirm from './ModalConfirm.vue';
8
8
  type ButtonDelete = ComponentConfig<typeof theme, AppConfig, 'buttonDelete'>;
9
9
  export interface ButtonDeleteProps extends Pick<ModalConfirmProps, 'onConfirm'> {
10
- modalProps?: Omit<ModalProps & ComponentProps<typeof ModalConfirm>, 'title' | 'message' | 'onConfirm' | 'confirmButton'>;
10
+ modalProps?: Omit<ModalProps & ComponentProps<typeof CModalConfirm>, 'title' | 'message' | 'onConfirm' | 'confirmButton'>;
11
11
  confirmText?: string;
12
12
  confirmLabel?: string;
13
13
  title?: string;
@@ -72,7 +72,7 @@
72
72
  }"
73
73
  >
74
74
  <template #link>
75
- <EditorLinkPopover :editor="editor" />
75
+ <CEditorLinkPopover :editor="editor" />
76
76
  </template>
77
77
  </UEditorToolbar>
78
78
 
@@ -93,7 +93,7 @@ import { useEditorDragHandle } from "../composables/useEditorDragHandle";
93
93
  import { useEditorSuggestions } from "../composables/useEditorSuggestions";
94
94
  import { useEditorToolbar } from "../composables/useEditorToolbar";
95
95
  import { UploraImage as UploraImageExtension, UploraImageHandlers } from "../editor/uplora-image/EditorUploraImage";
96
- import EditorLinkPopover from "./EditorLinkPopover.vue";
96
+ import CEditorLinkPopover from "./EditorLinkPopover.vue";
97
97
  </script>
98
98
 
99
99
  <script setup>
@@ -27,7 +27,7 @@
27
27
  @click="resetState()"
28
28
  />
29
29
 
30
- <ButtonDeleteConfirm
30
+ <CButtonDeleteConfirm
31
31
  color="error"
32
32
  size="sm"
33
33
  variant="ghost"
@@ -103,7 +103,7 @@ import { imagesExtensions } from "@uplora/formats";
103
103
  import { computed, useId } from "vue";
104
104
  import { z } from "zod";
105
105
  import { tv } from "../tv";
106
- import ButtonDeleteConfirm from "./ButtonDeleteConfirm.vue";
106
+ import CButtonDeleteConfirm from "./ButtonDeleteConfirm.vue";
107
107
  </script>
108
108
 
109
109
  <script setup>
@@ -16,18 +16,18 @@
16
16
  <template #right>
17
17
  <slot name="toolbar-right" />
18
18
 
19
- <TableColumnVisibility
19
+ <CTableColumnVisibility
20
20
  v-model:visibility="columnVisibility"
21
21
  v-model:order="columnOrder"
22
22
  :table="tableRef?.tableApi"
23
23
  :storage-key="storageKey"
24
24
  />
25
- <TableColumnSorting
25
+ <CTableColumnSorting
26
26
  :model-value="sorting"
27
27
  :table="tableRef?.tableApi"
28
28
  @update:model-value="emit('update:sorting', $event)"
29
29
  />
30
- <TableFilters
30
+ <CTableFilters
31
31
  v-if="props.filtersSource"
32
32
  :model-value="props.filters"
33
33
  :schema="props.filtersSchema"
@@ -43,7 +43,7 @@
43
43
  >
44
44
  <slot :name="pageTableSlot" v-bind="slotData" />
45
45
  </template>
46
- </TableFilters>
46
+ </CTableFilters>
47
47
  </template>
48
48
  </UDashboardToolbar>
49
49
  </template>
@@ -137,9 +137,9 @@ import { useForwardProps } from "reka-ui";
137
137
  import { computed, h, ref, useTemplateRef, watch } from "vue";
138
138
  import { tv } from "../tv";
139
139
  import CModalConfirm from "./ModalConfirm.vue";
140
- import TableColumnSorting from "./TableColumnSorting.vue";
141
- import TableColumnVisibility from "./TableColumnVisibility.vue";
142
- import TableFilters from "./TableFilters.vue";
140
+ import CTableColumnSorting from "./TableColumnSorting.vue";
141
+ import CTableColumnVisibility from "./TableColumnVisibility.vue";
142
+ import CTableFilters from "./TableFilters.vue";
143
143
  </script>
144
144
 
145
145
  <script setup>
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div class="relative flex items-center gap-2">
3
3
  <div v-if="image" class="overflow-hidden rounded-lg shrink-0">
4
- <UploraImage
4
+ <CUploraImage
5
5
  v-bind="image"
6
6
  :sizes="[{ width: 32, height: 32, descriptor: '1x' }]"
7
7
  :ui="{ picture: 'aspect-square' }"
@@ -27,7 +27,7 @@
27
27
  </template>
28
28
 
29
29
  <script setup>
30
- import UploraImage from "./UploraImage.vue";
30
+ import CUploraImage from "./UploraImage.vue";
31
31
  defineProps({
32
32
  to: { type: null, required: false },
33
33
  target: { type: [String, Object, null], required: false },
@@ -33,7 +33,7 @@
33
33
 
34
34
  <script>
35
35
  import theme from "#build/cms/uplora-image";
36
- import { useAppConfig, useHead, useNuxtApp } from "#imports";
36
+ import { getCmsConfig, useAppConfig, useHead, useNuxtApp } from "#imports";
37
37
  import { computed, onMounted, useTemplateRef } from "vue";
38
38
  import { tv } from "../tv";
39
39
  import { buildUploraImage } from "../utils";
@@ -55,11 +55,13 @@ const props = defineProps({
55
55
  ui: { type: null, required: false }
56
56
  });
57
57
  const emit = defineEmits(["load", "error"]);
58
+ const appConfig = useAppConfig();
59
+ const cmsConfig = getCmsConfig();
58
60
  const nuxtApp = useNuxtApp();
59
61
  const initialLoad = nuxtApp.isHydrating;
60
62
  const image = computed(() => buildUploraImage({
61
63
  id: props.image,
62
- formats: props.formats,
64
+ formats: props.formats ?? cmsConfig?.components?.uploraImage?.formats,
63
65
  sizes: props.sizes
64
66
  }));
65
67
  const sources = computed(() => {
@@ -106,6 +108,5 @@ onMounted(() => {
106
108
  emit("error", event);
107
109
  };
108
110
  });
109
- const appConfig = useAppConfig();
110
111
  const ui = computed(() => tv({ extend: tv(theme), ...appConfig.cms?.uploraImage || {} })());
111
112
  </script>
@@ -1,11 +1,12 @@
1
1
  import type { AppConfig } from '@nuxt/schema';
2
- import type { ComponentConfig } from '../../types';
2
+ import type { ComponentConfig, ImageSize } from '../../types';
3
3
  import theme from '#build/cms/prose/uplora-image';
4
4
  export type ProseUploraImage = ComponentConfig<typeof theme, AppConfig, 'uploraImage', 'cms.prose'>;
5
5
  export interface ProseUploraImageProps {
6
6
  image?: string;
7
7
  alt?: string;
8
8
  color?: string;
9
+ sizes?: ImageSize[];
9
10
  class?: any;
10
11
  ui?: ProseUploraImage['slots'];
11
12
  }
@@ -5,7 +5,6 @@
5
5
  :class="ui.base({ class: [props.ui?.base, props.class] })"
6
6
  :alt="alt"
7
7
  :color="color"
8
- :formats="formats"
9
8
  :sizes="sizes"
10
9
  />
11
10
  </template>
@@ -23,12 +22,12 @@ const props = defineProps({
23
22
  image: { type: String, required: false },
24
23
  alt: { type: String, required: false },
25
24
  color: { type: String, required: false },
25
+ sizes: { type: Array, required: false },
26
26
  class: { type: null, required: false },
27
27
  ui: { type: null, required: false }
28
28
  });
29
29
  const appConfig = useAppConfig();
30
30
  const cmsConfig = getCmsConfig();
31
- const formats = cmsConfig?.prose?.uploraImage?.formats.length > 0 ? cmsConfig?.prose?.uploraImage?.formats : void 0;
32
- const sizes = cmsConfig?.prose?.uploraImage?.sizes.length > 0 ? cmsConfig?.prose?.uploraImage?.sizes : void 0;
31
+ const sizes = props.sizes ?? cmsConfig?.components?.prose?.uploraImage?.sizes;
33
32
  const ui = computed(() => tv({ extend: tv(theme), ...appConfig.cms?.prose?.uploraImage || {} })());
34
33
  </script>
@@ -1,11 +1,12 @@
1
1
  import type { AppConfig } from '@nuxt/schema';
2
- import type { ComponentConfig } from '../../types';
2
+ import type { ComponentConfig, ImageSize } from '../../types';
3
3
  import theme from '#build/cms/prose/uplora-image';
4
4
  export type ProseUploraImage = ComponentConfig<typeof theme, AppConfig, 'uploraImage', 'cms.prose'>;
5
5
  export interface ProseUploraImageProps {
6
6
  image?: string;
7
7
  alt?: string;
8
8
  color?: string;
9
+ sizes?: ImageSize[];
9
10
  class?: any;
10
11
  ui?: ProseUploraImage['slots'];
11
12
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hywax/cms",
3
3
  "type": "module",
4
- "version": "3.4.1",
4
+ "version": "3.4.3",
5
5
  "description": "Hywax CMS. ⚠️ This package is intended for internal use only.",
6
6
  "imports": {
7
7
  "#build/cms/*": "./.nuxt/cms/*.ts",