@hywax/cms 3.4.0 → 3.4.2

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.
@@ -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.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hywax/cms",
3
- "version": "3.4.0",
3
+ "version": "3.4.2",
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.0";
10
+ const version = "3.4.2";
11
11
 
12
12
  function createContext(options, nuxt) {
13
13
  const { resolve } = createResolver(import.meta.url);
@@ -219,7 +219,7 @@ function resolveComponentDependencies(component, dependencyGraph, resolved = /*
219
219
  }
220
220
  return resolved;
221
221
  }
222
- async function detectUsedComponents([dirs, type], prefix, componentDir, includeComponents) {
222
+ async function detectUsedComponents({ dirs, prefix, componentDir, includeComponents = [], allowComponents = [] }) {
223
223
  const detectedComponents = /* @__PURE__ */ new Set();
224
224
  if (includeComponents && includeComponents.length > 0) {
225
225
  for (const component of includeComponents) {
@@ -227,10 +227,16 @@ async function detectUsedComponents([dirs, type], prefix, componentDir, includeC
227
227
  }
228
228
  }
229
229
  const componentPattern = new RegExp(`<(?:Lazy)?${prefix}([A-Z][a-zA-Z]+)|\\b(?:Lazy)?${prefix}([A-Z][a-zA-Z]+)\\b`, "g");
230
- if (type === "files") {
231
- for (const file of dirs) {
230
+ const filesPattern = allowComponents.length ? `**/(${allowComponents.join("|")}).{vue,ts,js,tsx,jsx}` : "**/*.{vue,ts,js,tsx,jsx}";
231
+ for (const dir of dirs) {
232
+ const appFiles = globSync([filesPattern], {
233
+ cwd: dir,
234
+ ignore: ["node_modules/**", ".nuxt/**", "dist/**"]
235
+ });
236
+ for (const file of appFiles) {
232
237
  try {
233
- const content = await readFile(file, "utf-8");
238
+ const filePath = join(dir, file);
239
+ const content = await readFile(filePath, "utf-8");
234
240
  const matches = content.matchAll(componentPattern);
235
241
  for (const match of matches) {
236
242
  const componentName = match[1] || match[2];
@@ -241,27 +247,6 @@ async function detectUsedComponents([dirs, type], prefix, componentDir, includeC
241
247
  } catch {
242
248
  }
243
249
  }
244
- } else if (type === "dirs") {
245
- for (const dir of dirs) {
246
- const appFiles = globSync(["**/*.{vue,ts,js,tsx,jsx}"], {
247
- cwd: dir,
248
- ignore: ["node_modules/**", ".nuxt/**", "dist/**"]
249
- });
250
- for (const file of appFiles) {
251
- try {
252
- const filePath = join(dir, file);
253
- const content = await readFile(filePath, "utf-8");
254
- const matches = content.matchAll(componentPattern);
255
- for (const match of matches) {
256
- const componentName = match[1] || match[2];
257
- if (componentName) {
258
- detectedComponents.add(componentName);
259
- }
260
- }
261
- } catch {
262
- }
263
- }
264
- }
265
250
  }
266
251
  if (detectedComponents.size === 0) {
267
252
  return void 0;
@@ -269,7 +254,7 @@ async function detectUsedComponents([dirs, type], prefix, componentDir, includeC
269
254
  const dependencyGraph = await buildComponentDependencyGraph(componentDir, componentPattern);
270
255
  const allComponents = /* @__PURE__ */ new Set();
271
256
  for (const component of detectedComponents) {
272
- const resolved = resolveComponentDependencies(component, dependencyGraph);
257
+ const resolved = resolveComponentDependencies(component, dependencyGraph, /* @__PURE__ */ new Set());
273
258
  for (const resolvedComponent of resolved) {
274
259
  allComponents.add(resolvedComponent);
275
260
  }
@@ -347,11 +332,12 @@ async function prepareMergeConfigs({ nuxt, options, resolve, detectedComponents:
347
332
  }
348
333
  }
349
334
  });
350
- const detectedComponents = await detectUsedComponents(
351
- [[...contextDetectedComponents].map((component) => resolve(`./runtime/components/${component}.vue`)), "files"],
352
- "U",
353
- resolve("./runtime/components")
354
- );
335
+ const detectedComponents = await detectUsedComponents({
336
+ dirs: [resolve("./runtime/components"), resolve("./runtime/composables")],
337
+ prefix: "U",
338
+ componentDir: resolve("./runtime/components"),
339
+ allowComponents: [...contextDetectedComponents]
340
+ });
355
341
  nuxt.options.ui = defu(nuxt.options.ui || {}, {
356
342
  colorMode: true,
357
343
  fonts: true,
@@ -574,7 +560,7 @@ const theme = {
574
560
 
575
561
  const uploraImage = {
576
562
  slots: {
577
- base: ""
563
+ base: "rounded-lg"
578
564
  }
579
565
  };
580
566
 
@@ -624,12 +610,12 @@ async function getAppTemplates({ options, resolve, nuxt, detectedComponents: con
624
610
  const sources2 = [];
625
611
  const layers = getLayerDirectories(nuxt).map((layer) => layer.app);
626
612
  if (options.componentDetection) {
627
- const detectedComponents = await detectUsedComponents(
628
- [layers, "dirs"],
629
- options.componentsPrefix,
630
- resolve("./runtime/components"),
631
- Array.isArray(options.componentDetection) ? options.componentDetection : void 0
632
- );
613
+ const detectedComponents = await detectUsedComponents({
614
+ dirs: layers,
615
+ prefix: options.componentsPrefix,
616
+ componentDir: resolve("./runtime/components"),
617
+ includeComponents: Array.isArray(options.componentDetection) ? options.componentDetection : void 0
618
+ });
633
619
  if (detectedComponents && detectedComponents.size > 0) {
634
620
  if (previousDetectedComponents) {
635
621
  const newComponents = Array.from(detectedComponents).filter(
@@ -650,8 +636,8 @@ async function getAppTemplates({ options, resolve, nuxt, detectedComponents: con
650
636
  const camelComponent = camelCase(component);
651
637
  if (theme[camelComponent]) {
652
638
  sources2.push(`@source "./cms/${kebabComponent}.ts";`);
653
- contextDetectedComponents.add(component);
654
639
  }
640
+ contextDetectedComponents.add(component);
655
641
  }
656
642
  } else {
657
643
  if (!previousDetectedComponents || previousDetectedComponents.size > 0) {
@@ -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 },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hywax/cms",
3
3
  "type": "module",
4
- "version": "3.4.0",
4
+ "version": "3.4.2",
5
5
  "description": "Hywax CMS. ⚠️ This package is intended for internal use only.",
6
6
  "imports": {
7
7
  "#build/cms/*": "./.nuxt/cms/*.ts",