@hywax/cms 0.0.19 → 0.0.20

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,9 @@
1
1
  export default {
2
2
  "slots": {
3
- "root": ""
3
+ "root": "flex items-center gap-2",
4
+ "avatar": "bg-elevated size-7 rounded-md",
5
+ "container": "text-xs",
6
+ "name": "font-medium text-default",
7
+ "description": "text-muted truncate max-w-40"
4
8
  }
5
9
  }
package/dist/module.d.mts CHANGED
@@ -32,6 +32,11 @@ interface CMSOptions {
32
32
  * @defaultValue {}
33
33
  */
34
34
  httpCodes?: Record<string, string>;
35
+ /**
36
+ * Features
37
+ * @defaultValue {}
38
+ */
39
+ features?: Record<string, boolean>;
35
40
  }
36
41
 
37
42
  declare module '@nuxt/schema' {
package/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hywax/cms",
3
- "version": "0.0.19",
3
+ "version": "0.0.20",
4
4
  "configKey": "cms",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.1",
package/dist/module.mjs CHANGED
@@ -6,7 +6,7 @@ import { snakeCase, kebabCase } from 'scule';
6
6
  import { readFile, writeFile } from 'node:fs/promises';
7
7
 
8
8
  const name = "@hywax/cms";
9
- const version = "0.0.19";
9
+ const version = "0.0.20";
10
10
 
11
11
  function createContext(options, nuxt) {
12
12
  const { resolve } = createResolver(import.meta.url);
@@ -21,7 +21,11 @@ function createContext(options, nuxt) {
21
21
  };
22
22
  }
23
23
 
24
- const defaultCMSConfig = {};
24
+ function defaultCMSConfig(options) {
25
+ return {
26
+ features: options.features
27
+ };
28
+ }
25
29
  const defaultModuleOptions = {
26
30
  name: "cms",
27
31
  prefix: "C",
@@ -37,7 +41,8 @@ const defaultModuleOptions = {
37
41
  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
42
  badGateway: "502: \u041E\u0448\u0438\u0431\u043A\u0430 \u0448\u043B\u044E\u0437\u0430",
39
43
  serviceUnavailable: "503: \u0421\u0435\u0440\u0432\u0438\u0441 \u043D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u0435\u043D"
40
- }
44
+ },
45
+ features: {}
41
46
  };
42
47
 
43
48
  function transformHttpCodes(httpCodes) {
@@ -84,7 +89,7 @@ function prepareAutoImports({ resolve, options, nuxt }) {
84
89
  nuxt.options.nitro.alias ||= {};
85
90
  nuxt.options.nitro.alias["#cms/http-codes"] = httpCodesPath;
86
91
  nuxt.options.alias["#cms"] = resolve("./runtime");
87
- nuxt.options.appConfig.cms = defu(nuxt.options.appConfig.cms || {}, defaultCMSConfig);
92
+ nuxt.options.appConfig.cms = defu(nuxt.options.appConfig.cms || {}, defaultCMSConfig(options));
88
93
  }
89
94
 
90
95
  async function prepareGenerateEnv({ nuxt }) {
@@ -320,7 +325,11 @@ const tableCellSeo = {
320
325
 
321
326
  const tableCellUser = {
322
327
  slots: {
323
- root: ""
328
+ root: "flex items-center gap-2",
329
+ avatar: "bg-elevated size-7 rounded-md",
330
+ container: "text-xs",
331
+ name: "font-medium text-default",
332
+ description: "text-muted truncate max-w-40"
324
333
  }
325
334
  };
326
335
 
@@ -498,7 +507,7 @@ import type { TVConfig } from '@nuxt/ui'
498
507
  import type { RouteLocationRaw } from 'vue-router'
499
508
 
500
509
  type AppConfigCMS = {
501
-
510
+ features: Record<string, boolean>
502
511
  } & TVConfig<typeof cms>
503
512
 
504
513
  declare module '@nuxt/schema' {
@@ -33,6 +33,7 @@
33
33
  import theme from "#build/cms/autocomplete-select";
34
34
  import { computed, ref, refDebounced, shallowRef, toRaw, triggerRef, useAppConfig, useAsyncData, useId, useInfiniteScroll, useNuxtData, useOffsetPagination, watch } from "#imports";
35
35
  import { tv } from "../tv";
36
+ import ButtonClear from "./ButtonClear.vue";
36
37
  </script>
37
38
 
38
39
  <script setup>
@@ -6,9 +6,7 @@
6
6
  >
7
7
  <UInput
8
8
  v-model="title"
9
- :color="color"
10
- :variant="variant"
11
- :size="size"
9
+ v-bind="inputProps"
12
10
  class="w-full"
13
11
  />
14
12
  </UFormField>
@@ -53,9 +51,7 @@ const props = defineProps({
53
51
  label: { type: String, required: false },
54
52
  titleKey: { type: String, required: false },
55
53
  slugKey: { type: String, required: false },
56
- color: { type: null, required: false },
57
- variant: { type: null, required: false },
58
- size: { type: null, required: false },
54
+ inputProps: { type: Object, required: false },
59
55
  as: { type: null, required: false },
60
56
  class: { type: null, required: false },
61
57
  ui: { type: null, required: false }
@@ -8,9 +8,7 @@ export interface InputSlugProps {
8
8
  label?: string;
9
9
  titleKey?: string;
10
10
  slugKey?: string;
11
- color?: InputProps['color'];
12
- variant?: InputProps['variant'];
13
- size?: InputProps['size'];
11
+ inputProps?: Omit<InputProps, 'modelModifiers'>;
14
12
  as?: any;
15
13
  class?: any;
16
14
  ui?: InputSlug['slots'];
@@ -2,7 +2,7 @@
2
2
  <ULink :to="to" :class="ui.root({ class: [props.ui?.root, props.class] })">
3
3
  <UploraImage
4
4
  v-if="thumbnail"
5
- :id="thumbnail.id"
5
+ :image="thumbnail.id"
6
6
  :alt="title"
7
7
  :lqip="thumbnail.lqip"
8
8
  :sizes="[{ width: 30, height: 30, descriptor: '1x' }]"
@@ -24,6 +24,7 @@
24
24
  import theme from "#build/cms/table-cell-preview";
25
25
  import { computed, useAppConfig } from "#imports";
26
26
  import { tv } from "../tv";
27
+ import UploraImage from "./UploraImage.vue";
27
28
  </script>
28
29
 
29
30
  <script setup>
@@ -1,15 +1,19 @@
1
1
  <template>
2
- <UUser
3
- :name="name"
4
- :description="description"
5
- :to="to"
6
- :avatar="{
7
- src: createAvatarByName(name)
8
- }"
9
- size="sm"
10
- :as="as"
11
- :class="ui.root({ class: [props.ui?.root, props.class] })"
12
- />
2
+ <ULink :to="to" :class="ui.root({ class: [props.ui?.root, props.class] })">
3
+ <UAvatar
4
+ v-bind="avatar"
5
+ size="sm"
6
+ :class="ui.avatar({ class: props.ui?.avatar })"
7
+ />
8
+ <div :class="ui.container({ class: props.ui?.container })">
9
+ <p :class="ui.name({ class: props.ui?.name })">
10
+ {{ name }}
11
+ </p>
12
+ <p v-if="description" :class="ui.description({ class: props.ui?.description })">
13
+ {{ description }}
14
+ </p>
15
+ </div>
16
+ </ULink>
13
17
  </template>
14
18
 
15
19
  <script>
@@ -23,11 +27,14 @@ import { createAvatarByName } from "../utils/avatar";
23
27
  const props = defineProps({
24
28
  name: { type: String, required: true },
25
29
  description: { type: String, required: false },
30
+ avatar: { type: Object, required: false },
26
31
  to: { type: null, required: false },
27
- as: { type: null, required: false },
28
32
  class: { type: null, required: false },
29
33
  ui: { type: null, required: false }
30
34
  });
31
35
  const appConfig = useAppConfig();
36
+ const avatar = computed(() => props.avatar ?? {
37
+ src: createAvatarByName(props.name)
38
+ });
32
39
  const ui = computed(() => tv({ extend: tv(theme), ...appConfig.cms?.tableCellUser || {} })());
33
40
  </script>
@@ -1,4 +1,5 @@
1
1
  import type { AppConfig } from '@nuxt/schema';
2
+ import type { AvatarProps } from '@nuxt/ui';
2
3
  import type { RouteLocationRaw } from 'vue-router';
3
4
  import type { ComponentConfig } from '../types';
4
5
  import theme from '#build/cms/table-cell-user';
@@ -6,8 +7,10 @@ type TableCellUser = ComponentConfig<typeof theme, AppConfig, 'tableCellUser'>;
6
7
  export interface TableCellUserProps {
7
8
  name: string;
8
9
  description?: string;
10
+ avatar?: Omit<AvatarProps, 'size'> & {
11
+ [key: string]: any;
12
+ };
9
13
  to?: RouteLocationRaw;
10
- as?: any;
11
14
  class?: any;
12
15
  ui?: TableCellUser['slots'];
13
16
  }
@@ -94,6 +94,8 @@ import { computed, h, ref, useAppConfig, useTemplateRef } from "#imports";
94
94
  import { objectOmit, reactivePick } from "@vueuse/core";
95
95
  import { useForwardProps } from "reka-ui";
96
96
  import { tv } from "../tv";
97
+ import TablePanelColumnSorting from "./TablePanelColumnSorting.vue";
98
+ import TablePanelColumnVisibility from "./TablePanelColumnVisibility.vue";
97
99
  </script>
98
100
 
99
101
  <script setup>
@@ -0,0 +1,4 @@
1
+ import type { AppConfig } from '@nuxt/schema';
2
+ type Feature = keyof AppConfig['cms']['features'];
3
+ export declare function featureIsEnabled(feature: Feature): any;
4
+ export {};
@@ -0,0 +1,13 @@
1
+ import { useAppConfig } from "#imports";
2
+ function isFeature(value) {
3
+ const appConfig = useAppConfig();
4
+ return typeof value === "string" && value in appConfig.cms.features;
5
+ }
6
+ export function featureIsEnabled(feature) {
7
+ if (!isFeature(feature)) {
8
+ console.warn(`Feature ${feature} is not a valid feature`);
9
+ return false;
10
+ }
11
+ const appConfig = useAppConfig();
12
+ return appConfig.cms.features[feature];
13
+ }
@@ -1,4 +1,6 @@
1
1
  export * from './avatar';
2
2
  export * from './dictionaries';
3
+ export * from './features';
3
4
  export * from './image';
5
+ export * from './logger';
4
6
  export * from './slugify';
@@ -1,4 +1,6 @@
1
1
  export * from "./avatar.js";
2
2
  export * from "./dictionaries.js";
3
+ export * from "./features.js";
3
4
  export * from "./image.js";
5
+ export * from "./logger.js";
4
6
  export * from "./slugify.js";
@@ -0,0 +1 @@
1
+ export declare const logger: import("consola").ConsolaInstance;
@@ -0,0 +1,2 @@
1
+ import { consola } from "consola";
2
+ export const logger = consola;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hywax/cms",
3
3
  "type": "module",
4
- "version": "0.0.19",
4
+ "version": "0.0.20",
5
5
  "description": "Hywax CMS. ⚠️ This package is intended for internal use only.",
6
6
  "repository": {
7
7
  "type": "git",
@@ -66,6 +66,7 @@
66
66
  "@uplora/formats": "^0.1.0",
67
67
  "@uplora/serializer": "^0.1.3",
68
68
  "@vueuse/nuxt": "^13.4.0",
69
+ "consola": "^3.4.2",
69
70
  "defu": "^6.1.4",
70
71
  "fast-equals": "^5.2.2",
71
72
  "nuxt-auth-utils": "^0.5.20",