@hywax/cms 3.2.1 → 3.3.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.
@@ -4,6 +4,7 @@ const cmsConfig = {
4
4
  "serverDateTime": "YYYY-MM-DD HH:mm:ss"
5
5
  },
6
6
  "prose": {
7
+ "enabled": true,
7
8
  "uploraImage": {
8
9
  "formats": [],
9
10
  "sizes": []
@@ -1,12 +1,13 @@
1
- export { default as ButtonCopyText } from './button-copy-text'
2
- export { default as ButtonDeleteConfirm } from './button-delete-confirm'
3
- export { default as FormPanel } from './form-panel'
4
- export { default as FormPanelAsideSection } from './form-panel-aside-section'
5
- export { default as FormPanelSection } from './form-panel-section'
6
- export { default as FormSeo } from './form-seo'
7
- export { default as FormSlug } from './form-slug'
8
- export { default as FormUploraImage } from './form-uplora-image'
9
- export { default as ModalConfirm } from './modal-confirm'
10
- export { default as TablePanel } from './table-panel'
11
- export { default as TableSearchInput } from './table-search-input'
12
- export { default as UploraImage } from './uplora-image'
1
+ export { default as buttonCopyText } from './button-copy-text'
2
+ export { default as buttonDeleteConfirm } from './button-delete-confirm'
3
+ export { default as formPanel } from './form-panel'
4
+ export { default as formPanelAsideSection } from './form-panel-aside-section'
5
+ export { default as formPanelSection } from './form-panel-section'
6
+ export { default as formSeo } from './form-seo'
7
+ export { default as formSlug } from './form-slug'
8
+ export { default as formUploraImage } from './form-uplora-image'
9
+ export { default as modalConfirm } from './modal-confirm'
10
+ export { default as tablePanel } from './table-panel'
11
+ export { default as tableSearchInput } from './table-search-input'
12
+ export { default as uploraImage } from './uplora-image'
13
+ export * as prose from './prose'
package/.nuxt/cms.css CHANGED
@@ -1,8 +1,5 @@
1
- @source "./cms/autocomplete-select.ts";
2
- @source "./cms/layout.ts";
3
- @source "./cms/ms.ts";
1
+ @source "./cms/prose";
4
2
  @source "./cms/form-panel.ts";
5
- @source "./cms/editor-full.ts";
6
3
  @source "./cms/form-panel-section.ts";
7
4
  @source "./cms/form-slug.ts";
8
5
  @source "./cms/form-uplora-image.ts";
@@ -11,10 +8,5 @@
11
8
  @source "./cms/table-panel.ts";
12
9
  @source "./cms/modal-confirm.ts";
13
10
  @source "./cms/table-search-input.ts";
14
- @source "./cms/table-preview-seo.ts";
15
- @source "./cms/ms-core-options.ts";
16
- @source "./cms/ms-nuxt-context.ts";
17
- @source "./cms/date-picker.ts";
18
- @source "./cms/ss.ts";
19
11
 
20
12
 
package/dist/module.d.mts CHANGED
@@ -54,6 +54,7 @@ interface CMSCoreOptions {
54
54
  * Prose configuration
55
55
  */
56
56
  prose?: {
57
+ enabled?: boolean;
57
58
  uploraImage?: {
58
59
  formats?: ImageFormat[];
59
60
  sizes?: ImageSize[];
package/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hywax/cms",
3
- "version": "3.2.1",
3
+ "version": "3.3.0",
4
4
  "configKey": "cms",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
package/dist/module.mjs CHANGED
@@ -3,11 +3,11 @@ import { fileURLToPath } from 'node:url';
3
3
  import { dirname, join } from 'pathe';
4
4
  import { readFile, writeFile } from 'node:fs/promises';
5
5
  import { defu } from 'defu';
6
- import { pascalCase, kebabCase } from 'scule';
6
+ import { pascalCase, kebabCase, camelCase } from 'scule';
7
7
  import { globSync } from 'tinyglobby';
8
8
 
9
9
  const name = "@hywax/cms";
10
- const version = "3.2.1";
10
+ const version = "3.3.0";
11
11
 
12
12
  function createContext(options, nuxt) {
13
13
  const { resolve } = createResolver(import.meta.url);
@@ -84,6 +84,7 @@ const defaultModuleOptions = {
84
84
  serverDateTime: "YYYY-MM-DD HH:mm:ss"
85
85
  },
86
86
  prose: {
87
+ enabled: true,
87
88
  uploraImage: {
88
89
  formats: [],
89
90
  sizes: []
@@ -540,22 +541,18 @@ const uploraImage$1 = {
540
541
 
541
542
  const theme = {
542
543
  __proto__: null,
543
- ButtonCopyText: buttonCopyText,
544
- ButtonDeleteConfirm: buttonDeleteConfirm,
545
- FormPanel: formPanel,
546
- FormPanelAsideSection: formPanelAsideSection,
547
- FormPanelSection: formPanelSection,
548
- FormSeo: formSeo,
549
- FormSlug: formSlug,
550
- FormUploraImage: formUploraImage,
551
- ModalConfirm: modalConfirm,
552
- TablePanel: tablePanel,
553
- TableSearchInput: tableSearchInput,
554
- UploraImage: uploraImage$1
555
- };
556
-
557
- const themeEditor = {
558
- __proto__: null
544
+ buttonCopyText: buttonCopyText,
545
+ buttonDeleteConfirm: buttonDeleteConfirm,
546
+ formPanel: formPanel,
547
+ formPanelAsideSection: formPanelAsideSection,
548
+ formPanelSection: formPanelSection,
549
+ formSeo: formSeo,
550
+ formSlug: formSlug,
551
+ formUploraImage: formUploraImage,
552
+ modalConfirm: modalConfirm,
553
+ tablePanel: tablePanel,
554
+ tableSearchInput: tableSearchInput,
555
+ uploraImage: uploraImage$1
559
556
  };
560
557
 
561
558
  const uploraImage = {
@@ -628,9 +625,15 @@ function getAppTemplates({ options, resolve, nuxt }) {
628
625
  logger.success(`CMS detected ${detectedComponents.size} components in use (including dependencies)`);
629
626
  }
630
627
  previousDetectedComponents = detectedComponents;
628
+ if (options.prose?.enabled) {
629
+ sources.push('@source "./cms/prose";');
630
+ }
631
631
  for (const component of detectedComponents) {
632
632
  const kebabComponent = kebabCase(component);
633
- sources.push(`@source "./cms/${kebabComponent}.ts";`);
633
+ const camelComponent = camelCase(component);
634
+ if (theme[camelComponent]) {
635
+ sources.push(`@source "./cms/${kebabComponent}.ts";`);
636
+ }
634
637
  }
635
638
  } else {
636
639
  if (!previousDetectedComponents || previousDetectedComponents.size > 0) {
@@ -644,19 +647,15 @@ function getAppTemplates({ options, resolve, nuxt }) {
644
647
  }
645
648
  return sources.join("\n");
646
649
  }
647
- writeThemeTemplate(themeProse, "prose");
648
- writeThemeTemplate(themeProse, "editor");
650
+ if (options.prose?.enabled) {
651
+ templates.push({
652
+ filename: `cms/prose/index.ts`,
653
+ write: true,
654
+ getContents: () => Object.keys(themeProse).map((component) => `export { default as ${component} } from './${kebabCase(component)}'`).join("\n")
655
+ });
656
+ writeThemeTemplate(themeProse, "prose");
657
+ }
649
658
  writeThemeTemplate(theme);
650
- templates.push({
651
- filename: `cms/prose/index.ts`,
652
- write: true,
653
- getContents: () => Object.keys(themeProse).map((component) => `export { default as ${component} } from './${kebabCase(component)}'`).join("\n")
654
- });
655
- templates.push({
656
- filename: `cms/editor/index.ts`,
657
- write: true,
658
- getContents: () => Object.keys(themeEditor).map((component) => `export { default as ${component} } from './${kebabCase(component)}'`).join("\n")
659
- });
660
659
  templates.push({
661
660
  filename: "cms.css",
662
661
  write: true,
@@ -699,24 +698,27 @@ ${options.unovis ? `
699
698
  templates.push({
700
699
  filename: "cms/index.ts",
701
700
  write: true,
702
- getContents: () => {
703
- return Object.keys(theme).map((component) => `export { default as ${component} } from './${kebabCase(component)}'`).join("\n");
704
- }
701
+ getContents: () => [
702
+ ...Object.keys(theme).map((component) => `export { default as ${component} } from './${kebabCase(component)}'`),
703
+ ...options.prose?.enabled ? [`export * as prose from './prose'`] : []
704
+ ].join("\n")
705
705
  });
706
706
  templates.push({
707
707
  filename: "types/cms.d.ts",
708
708
  getContents: () => `import * as cms from '#build/cms'
709
- import type { TVConfig } from '@nuxt/ui'
709
+ import type { TVConfig } from '@hywax/cms'
710
710
  import type { RouteLocationRaw } from 'vue-router'
711
711
 
712
- type AppConfigCMS = TVConfig<typeof cms>
712
+ type AppConfigCMS = {
713
+
714
+ } & TVConfig<typeof cms>
713
715
 
714
716
  declare module '@nuxt/schema' {
715
717
  interface AppConfigInput {
716
718
  /**
717
719
  * CMS theme configuration
718
720
  */
719
- cmsRuntime?: AppConfigCMS
721
+ cms?: AppConfigCMS
720
722
  }
721
723
  }
722
724
 
@@ -1 +1 @@
1
- @import "@nuxt/ui";@import "#build/cms.css";@source "./components";@source "./editor";@source "./prose";
1
+ @import "@nuxt/ui";@import "#build/cms.css";@source "./components";
@@ -39,5 +39,5 @@ export * from './date';
39
39
  export * from './image';
40
40
  export * from './query';
41
41
  export * from './seo';
42
- export type { ComponentSlots, ComponentVariants } from './tv';
42
+ export * from './tv';
43
43
  export * from './utils';
@@ -39,4 +39,5 @@ export * from "./date.js";
39
39
  export * from "./image.js";
40
40
  export * from "./query.js";
41
41
  export * from "./seo.js";
42
+ export * from "./tv.js";
42
43
  export * from "./utils.js";
@@ -4,11 +4,18 @@ import type { ClassValue, TVCompoundVariants, TVDefaultVariants, TVVariants } fr
4
4
  */
5
5
  export type TVConfig<T extends Record<string, any>> = {
6
6
  [P in keyof T]?: {
7
- [K in keyof T[P] as K extends 'base' | 'slots' | 'variants' | 'compoundVariants' | 'defaultVariants' ? K : never]?: K extends 'base' ? ClassValue : K extends 'slots' ? {
7
+ [K in keyof T[P] as K extends 'base' | 'slots' | 'variants' | 'defaultVariants' ? K : never]?: K extends 'base' ? ClassValue : K extends 'slots' ? {
8
8
  [S in keyof T[P]['slots']]?: ClassValue;
9
- } : K extends 'variants' ? TVVariants<T[P]['slots'], ClassValue, T[P]['variants']> : K extends 'compoundVariants' ? TVCompoundVariants<T[P]['variants'], T[P]['slots'], ClassValue, object, undefined> : K extends 'defaultVariants' ? TVDefaultVariants<T[P]['variants'], T[P]['slots'], object, undefined> : never;
9
+ } : K extends 'variants' ? TVVariants<T[P]['slots'], ClassValue, WidenVariantsValues<T[P]['variants']>> : K extends 'defaultVariants' ? TVDefaultVariants<WidenVariantsValues<T[P]['variants']>, T[P]['slots'], object, undefined> : never;
10
+ };
11
+ } & {
12
+ [P in keyof T]?: {
13
+ compoundVariants?: TVCompoundVariants<WidenVariantsValues<T[P]['variants']>, T[P]['slots'], ClassValue, object, undefined>;
10
14
  };
11
15
  };
16
+ type WidenVariantsValues<V extends Record<string, any> | undefined> = V extends Record<string, any> ? V & {
17
+ [K in keyof V]: V[K] extends Record<string, any> ? V[K] & Record<string & {}, any> : V[K];
18
+ } : V;
12
19
  /**
13
20
  * Utility type to flatten intersection types for better IDE hover information.
14
21
  * @template T The type to flatten.
@@ -26,21 +33,20 @@ export type ComponentSlots<T extends {
26
33
  }> = Id<{
27
34
  [K in keyof T['slots']]?: ClassValue;
28
35
  }>;
36
+ type ComponentUI<T extends {
37
+ slots?: Record<string, any>;
38
+ }> = Id<{
39
+ [K in keyof Required<T['slots']>]: (props?: Record<string, any>) => string;
40
+ }>;
29
41
  type GetComponentAppConfig<A, U extends string, K extends string> = A extends Record<U, Record<K, any>> ? A[U][K] : object;
30
- type ComponentAppConfig<T, A extends Record<string, any>, K extends string, U extends string = 'cms' | 'cms.prose' | 'cms.editor'> = A & (U extends 'cms.prose' ? {
42
+ type ComponentAppConfig<T, A extends Record<string, any>, K extends string, U extends string = 'cms' | 'cms.prose'> = A & (U extends 'cms.prose' ? {
31
43
  cms?: {
32
44
  prose?: {
33
45
  [k in K]?: Partial<T>;
34
46
  };
35
47
  };
36
- } : U extends 'cms.editor' ? {
37
- cms?: {
38
- editor?: {
39
- [k in K]?: Partial<T>;
40
- };
41
- };
42
48
  } : {
43
- [key in Exclude<U, 'cms.prose' | 'cms.editor'>]?: {
49
+ [key in Exclude<U, 'cms.prose'>]?: {
44
50
  [k in K]?: Partial<T>;
45
51
  };
46
52
  });
@@ -51,9 +57,10 @@ type ComponentAppConfig<T, A extends Record<string, any>, K extends string, U ex
51
57
  * @template K The key identifying the component (e.g., 'badge').
52
58
  * @template U The top-level key in AppConfig ('cms' or 'cms.prose').
53
59
  */
54
- export type ComponentConfig<T extends Record<string, any>, A extends Record<string, any>, K extends string, U extends 'cms' | 'cms.prose' | 'cms.editor' = 'cms'> = {
60
+ export type ComponentConfig<T extends Record<string, any>, A extends Record<string, any>, K extends string, U extends 'cms' | 'cms.prose' = 'cms'> = {
55
61
  AppConfig: ComponentAppConfig<T, A, K, U>;
56
62
  variants: ComponentVariants<T & GetComponentAppConfig<A, U, K>>;
57
63
  slots: ComponentSlots<T>;
64
+ ui: ComponentUI<T>;
58
65
  };
59
66
  export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hywax/cms",
3
3
  "type": "module",
4
- "version": "3.2.1",
4
+ "version": "3.3.0",
5
5
  "description": "Hywax CMS. ⚠️ This package is intended for internal use only.",
6
6
  "imports": {
7
7
  "#build/cms/*": "./.nuxt/cms/*.ts",
@@ -85,8 +85,8 @@
85
85
  },
86
86
  "devDependencies": {
87
87
  "@antfu/eslint-config": "^6.7.3",
88
- "@commitlint/cli": "^20.3.0",
89
- "@commitlint/config-conventional": "^20.3.0",
88
+ "@commitlint/cli": "^20.3.1",
89
+ "@commitlint/config-conventional": "^20.3.1",
90
90
  "@nuxt/devtools": "^3.1.1",
91
91
  "@nuxt/module-builder": "^1.0.2",
92
92
  "@nuxt/schema": "^4.2.2",
File without changes
@@ -1,5 +0,0 @@
1
- export default {
2
- "slots": {
3
- "base": ""
4
- }
5
- }