@hywax/cms 1.1.1 → 1.2.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.
@@ -0,0 +1,19 @@
1
+ export default {
2
+ "slots": {
3
+ "root": "wrap-anywhere",
4
+ "text": "pe-5",
5
+ "button": "p-0 -ms-4 align-middle"
6
+ },
7
+ "variants": {
8
+ "buttonInvisible": {
9
+ "true": {
10
+ "button": "invisible"
11
+ }
12
+ },
13
+ "to": {
14
+ "true": {
15
+ "text": "ps-0"
16
+ }
17
+ }
18
+ }
19
+ }
@@ -1,3 +1,4 @@
1
+ export { default as ButtonCopyText } from './button-copy-text'
1
2
  export { default as ButtonDeleteConfirm } from './button-delete-confirm'
2
3
  export { default as FormPanel } from './form-panel'
3
4
  export { default as FormPanelAsideSection } from './form-panel-aside-section'
package/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hywax/cms",
3
- "version": "1.1.1",
3
+ "version": "1.2.0",
4
4
  "configKey": "cms",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
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 = "1.1.1";
9
+ const version = "1.2.0";
10
10
 
11
11
  function createContext(options, nuxt) {
12
12
  const { resolve } = createResolver(import.meta.url);
@@ -161,9 +161,6 @@ function prepareMergeConfigs({ nuxt, options }) {
161
161
  nuxt.options.experimental = defu(nuxt.options.experimental || {}, {
162
162
  typedPages: true
163
163
  });
164
- nuxt.options.future = defu(nuxt.options.future || {}, {
165
- compatibilityVersion: 5
166
- });
167
164
  nuxt.options.runtimeConfig.public = defu(nuxt.options.runtimeConfig.public || {}, {
168
165
  fluxorUrl: options.fluxorUrl,
169
166
  version: "develop"
@@ -242,6 +239,26 @@ function prepareServerRoutes({ resolve }) {
242
239
  });
243
240
  }
244
241
 
242
+ const buttonCopyText = {
243
+ slots: {
244
+ root: "wrap-anywhere",
245
+ text: "pe-5",
246
+ button: "p-0 -ms-4 align-middle"
247
+ },
248
+ variants: {
249
+ buttonInvisible: {
250
+ true: {
251
+ button: "invisible"
252
+ }
253
+ },
254
+ to: {
255
+ true: {
256
+ text: "ps-0"
257
+ }
258
+ }
259
+ }
260
+ };
261
+
245
262
  const buttonDeleteConfirm = {
246
263
  slots: {
247
264
  root: ""
@@ -316,6 +333,7 @@ const uploraImage$1 = {
316
333
 
317
334
  const theme = {
318
335
  __proto__: null,
336
+ ButtonCopyText: buttonCopyText,
319
337
  ButtonDeleteConfirm: buttonDeleteConfirm,
320
338
  FormPanel: formPanel,
321
339
  FormPanelAsideSection: formPanelAsideSection,
@@ -0,0 +1,26 @@
1
+ import type { AppConfig } from '@nuxt/schema';
2
+ import type { ButtonProps } from '@nuxt/ui';
3
+ import type { RouteLocationRaw } from 'vue-router';
4
+ import type { ComponentConfig } from '../types';
5
+ import theme from '#build/cms/button-copy-text';
6
+ type ButtonCopyText = ComponentConfig<typeof theme, AppConfig, 'buttonCopyText'>;
7
+ export interface Props extends Pick<ButtonProps, 'target' | 'external' | 'label'> {
8
+ text?: string | number | null;
9
+ showAction?: boolean;
10
+ alwaysShowTooltip?: boolean;
11
+ to?: RouteLocationRaw;
12
+ class?: any;
13
+ ui?: ButtonCopyText['slots'];
14
+ }
15
+ declare const _default: typeof __VLS_export;
16
+ export default _default;
17
+ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
18
+ default?: (props: {}) => any;
19
+ } & {
20
+ default?: (props: {}) => any;
21
+ }>;
22
+ type __VLS_WithSlots<T, S> = T & {
23
+ new (): {
24
+ $slots: S;
25
+ };
26
+ };
@@ -0,0 +1,70 @@
1
+ <template>
2
+ <div v-if="textValue" ref="button-copy-text" :class="ui.root({ class: [props.class, props.ui?.root] })">
3
+ <UButton
4
+ v-if="to"
5
+ :to="to"
6
+ :class="ui.text({ class: props.ui?.text })"
7
+ :external="external"
8
+ :target="target"
9
+ variant="link"
10
+ color="info"
11
+ >
12
+ <slot>{{ textValue }}</slot>
13
+ </UButton>
14
+ <span v-else :class="ui.text({ class: props.ui?.text })">
15
+ <slot>{{ textValue }}</slot>
16
+ </span>
17
+
18
+ <UTooltip
19
+ v-if="showAction"
20
+ :text="tooltipText"
21
+ :content="{ side: 'top' }"
22
+ disable-hoverable-content
23
+ disable-closing-trigger
24
+ >
25
+ <UButton
26
+ :class="ui.button({ class: props.ui?.button })"
27
+ :icon="copied ? 'check' : 'copy'"
28
+ variant="link"
29
+ size="sm"
30
+ :color="copied ? 'success' : 'neutral'"
31
+ @click="copy(textValue)"
32
+ />
33
+ </UTooltip>
34
+ </div>
35
+ </template>
36
+
37
+ <script>
38
+ import theme from "#build/cms/button-copy-text";
39
+ import { useAppConfig } from "#imports";
40
+ import { useClipboard, useElementHover } from "@vueuse/core";
41
+ import { computed, useTemplateRef } from "vue";
42
+ import { tv } from "../tv";
43
+ </script>
44
+
45
+ <script setup>
46
+ const props = defineProps({
47
+ text: { type: [String, Number, null], required: false },
48
+ showAction: { type: Boolean, required: false },
49
+ alwaysShowTooltip: { type: Boolean, required: false },
50
+ to: { type: null, required: false },
51
+ class: { type: null, required: false },
52
+ ui: { type: null, required: false },
53
+ target: { type: [String, Object, null], required: false },
54
+ external: { type: Boolean, required: false },
55
+ label: { type: String, required: false }
56
+ });
57
+ const appConfig = useAppConfig();
58
+ const { copy, copied } = useClipboard();
59
+ const tooltipText = computed(() => copied.value ? "\u0421\u043A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u043D\u043E" : "\u0421\u043A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C");
60
+ const copyTextRef = useTemplateRef("button-copy-text");
61
+ const isHovered = useElementHover(copyTextRef);
62
+ const textValue = computed(() => {
63
+ const text = props.label ?? props.text;
64
+ return typeof text === "number" ? text.toString() : text;
65
+ });
66
+ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.cms?.buttonCopyText || {} })({
67
+ buttonInvisible: !isHovered.value && !props.alwaysShowTooltip,
68
+ to: !!props.to
69
+ }));
70
+ </script>
@@ -0,0 +1,26 @@
1
+ import type { AppConfig } from '@nuxt/schema';
2
+ import type { ButtonProps } from '@nuxt/ui';
3
+ import type { RouteLocationRaw } from 'vue-router';
4
+ import type { ComponentConfig } from '../types';
5
+ import theme from '#build/cms/button-copy-text';
6
+ type ButtonCopyText = ComponentConfig<typeof theme, AppConfig, 'buttonCopyText'>;
7
+ export interface Props extends Pick<ButtonProps, 'target' | 'external' | 'label'> {
8
+ text?: string | number | null;
9
+ showAction?: boolean;
10
+ alwaysShowTooltip?: boolean;
11
+ to?: RouteLocationRaw;
12
+ class?: any;
13
+ ui?: ButtonCopyText['slots'];
14
+ }
15
+ declare const _default: typeof __VLS_export;
16
+ export default _default;
17
+ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
18
+ default?: (props: {}) => any;
19
+ } & {
20
+ default?: (props: {}) => any;
21
+ }>;
22
+ type __VLS_WithSlots<T, S> = T & {
23
+ new (): {
24
+ $slots: S;
25
+ };
26
+ };
@@ -23,8 +23,8 @@ export default _default;
23
23
  declare const __VLS_export: <R extends boolean = false>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
24
24
  props: import("vue").PublicProps & __VLS_PrettifyLocal<Props<R> & {
25
25
  onBlur?: ((event: FocusEvent) => any) | undefined;
26
- onChange?: ((event: Event) => any) | undefined;
27
26
  onFocus?: ((event: FocusEvent) => any) | undefined;
27
+ onChange?: ((event: Event) => any) | undefined;
28
28
  "onUpdate:modelValue"?: ((value: ModelValue<R>) => any) | undefined;
29
29
  }> & (typeof globalThis extends {
30
30
  __VLS_PROPS_FALLBACK: infer P;
@@ -32,7 +32,7 @@ declare const __VLS_export: <R extends boolean = false>(__VLS_props: NonNullable
32
32
  expose: (exposed: {}) => void;
33
33
  attrs: any;
34
34
  slots: {};
35
- emit: ((evt: "blur", event: FocusEvent) => void) & ((evt: "change", event: Event) => void) & ((evt: "focus", event: FocusEvent) => void) & ((evt: "update:modelValue", value: ModelValue<R>) => void);
35
+ emit: ((evt: "blur", event: FocusEvent) => void) & ((evt: "focus", event: FocusEvent) => void) & ((evt: "change", event: Event) => void) & ((evt: "update:modelValue", value: ModelValue<R>) => void);
36
36
  }>) => import("vue").VNode & {
37
37
  __ctx?: Awaited<typeof __VLS_setup>;
38
38
  };
@@ -23,8 +23,8 @@ export default _default;
23
23
  declare const __VLS_export: <R extends boolean = false>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
24
24
  props: import("vue").PublicProps & __VLS_PrettifyLocal<Props<R> & {
25
25
  onBlur?: ((event: FocusEvent) => any) | undefined;
26
- onChange?: ((event: Event) => any) | undefined;
27
26
  onFocus?: ((event: FocusEvent) => any) | undefined;
27
+ onChange?: ((event: Event) => any) | undefined;
28
28
  "onUpdate:modelValue"?: ((value: ModelValue<R>) => any) | undefined;
29
29
  }> & (typeof globalThis extends {
30
30
  __VLS_PROPS_FALLBACK: infer P;
@@ -32,7 +32,7 @@ declare const __VLS_export: <R extends boolean = false>(__VLS_props: NonNullable
32
32
  expose: (exposed: {}) => void;
33
33
  attrs: any;
34
34
  slots: {};
35
- emit: ((evt: "blur", event: FocusEvent) => void) & ((evt: "change", event: Event) => void) & ((evt: "focus", event: FocusEvent) => void) & ((evt: "update:modelValue", value: ModelValue<R>) => void);
35
+ emit: ((evt: "blur", event: FocusEvent) => void) & ((evt: "focus", event: FocusEvent) => void) & ((evt: "change", event: Event) => void) & ((evt: "update:modelValue", value: ModelValue<R>) => void);
36
36
  }>) => import("vue").VNode & {
37
37
  __ctx?: Awaited<typeof __VLS_setup>;
38
38
  };
@@ -4,11 +4,10 @@ import type { FetchError } from 'ofetch';
4
4
  import type { Ref } from 'vue';
5
5
  type PickFrom<T, K extends Array<string>> = T extends Array<any> ? T : T extends Record<string, any> ? keyof T extends K[number] ? T : K[number] extends never ? T : Pick<T, K[number]> : T;
6
6
  type KeysOf<T> = Array<T extends T ? (keyof T extends string ? keyof T : never) : never>;
7
- type DefaultAsyncDataValue = undefined;
8
7
  /**
9
8
  * На данный момент нет возможности использовать `useFetch` со своим $fetch,
10
9
  * поэтому приходится использовать костыль.
11
10
  * https://github.com/nuxt/nuxt/issues/14736
12
11
  */
13
- export declare function useApi<ResT = void, ErrorT = FetchError, ReqT extends NitroFetchRequest = NitroFetchRequest, Method extends AvailableRouterMethod<ReqT> = ResT extends void ? 'get' extends AvailableRouterMethod<ReqT> ? 'get' : AvailableRouterMethod<ReqT> : AvailableRouterMethod<ReqT>, _ResT = ResT extends void ? FetchResult<ReqT, Method> : ResT, DataT = _ResT, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = DefaultAsyncDataValue>(request: Ref<ReqT> | ReqT | (() => ReqT), opts?: UseFetchOptions<_ResT, DataT, PickKeys, DefaultT, ReqT, Method>): AsyncData<PickFrom<DataT, PickKeys> | DefaultT, ErrorT | DefaultAsyncDataValue>;
12
+ export declare function useApi<ResT = void, ErrorT = FetchError, ReqT extends NitroFetchRequest = NitroFetchRequest, Method extends AvailableRouterMethod<ReqT> = ResT extends void ? 'get' extends AvailableRouterMethod<ReqT> ? 'get' : AvailableRouterMethod<ReqT> : AvailableRouterMethod<ReqT>, _ResT = ResT extends void ? FetchResult<ReqT, Method> : ResT, DataT = _ResT, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = undefined>(request: Ref<ReqT> | ReqT | (() => ReqT), opts?: UseFetchOptions<_ResT, DataT, PickKeys, DefaultT, ReqT, Method>): AsyncData<PickFrom<DataT, PickKeys> | DefaultT, ErrorT | undefined>;
14
13
  export {};
@@ -1,12 +1,12 @@
1
- import type { StringOrVNode, ToastProps } from '@nuxt/ui';
1
+ import type { ToastProps } from '@nuxt/ui';
2
2
  type NotificationOptions = Omit<ToastProps, 'title' | 'icon' | 'color' | 'defaultOpen'> & {
3
3
  onClick?: (toast: Omit<ToastProps, 'defaultOpen'>) => void;
4
4
  };
5
- export declare function useNotification(): {
6
- success: (message: string, options?: NotificationOptions) => import("@nuxt/ui/runtime/composables/useToast.js").Toast;
7
- error: (message: string, options?: NotificationOptions) => import("@nuxt/ui/runtime/composables/useToast.js").Toast;
8
- warning: (message: StringOrVNode, options?: NotificationOptions) => import("@nuxt/ui/runtime/composables/useToast.js").Toast;
9
- notify: (toast: Partial<import("@nuxt/ui/runtime/composables/useToast.js").Toast>) => import("@nuxt/ui/runtime/composables/useToast.js").Toast;
10
- info: (message: StringOrVNode, options?: NotificationOptions) => import("@nuxt/ui/runtime/composables/useToast.js").Toast;
11
- };
5
+ interface UseNotificationReturn {
6
+ success: (message: string, options?: NotificationOptions) => void;
7
+ error: (message: string, options?: NotificationOptions) => void;
8
+ warning: (message: string, options?: NotificationOptions) => void;
9
+ info: (message: string, options?: NotificationOptions) => void;
10
+ }
11
+ export declare function useNotification(): UseNotificationReturn;
12
12
  export {};
@@ -40,7 +40,6 @@ export function useNotification() {
40
40
  success,
41
41
  error,
42
42
  warning,
43
- notify,
44
43
  info
45
44
  };
46
45
  }
@@ -7,8 +7,10 @@ declare module '@tanstack/table-core' {
7
7
  headerLabel?: string;
8
8
  }
9
9
  }
10
- export declare function createTableFiltersFields<S extends FormSchema, F extends readonly FiltersField<S>[]>(_schema: S, fields: F): {
11
- -readonly [P in keyof F]: F[P];
10
+ export declare function useTableFiltersFields<S extends FormSchema, F extends readonly FiltersField<S>[]>(_schema: S, fields: F): {
11
+ filtersFields: {
12
+ -readonly [P in keyof F]: F[P];
13
+ };
12
14
  };
13
15
  export type TableColumnFormat = 'number' | 'date' | 'date-time';
14
16
  export type TableColumnCustom<T extends TableData, D = unknown> = TableColumn<T, D> & {
@@ -18,6 +20,8 @@ export type TableColumnCustom<T extends TableData, D = unknown> = TableColumn<T,
18
20
  external?: boolean;
19
21
  emptyValue?: string;
20
22
  };
21
- export declare function createTableColumns<I extends Record<string, any>, T extends readonly TableColumnCustom<I>[] = readonly TableColumnCustom<I>[]>(columns: T): {
22
- -readonly [P in keyof T]: T[P];
23
+ export declare function useTableColumns<I extends Record<string, any>, T extends readonly TableColumnCustom<I>[] = readonly TableColumnCustom<I>[]>(columns: T): {
24
+ columns: {
25
+ -readonly [P in keyof T]: T[P];
26
+ };
23
27
  };
@@ -1,9 +1,9 @@
1
1
  import { UButton } from "#components";
2
2
  import { h } from "vue";
3
- import { formatDate, formatDateTime } from "./date.js";
4
- import { formatNumber } from "./formatters.js";
5
- export function createTableFiltersFields(_schema, fields) {
6
- return fields;
3
+ import { formatDate, formatDateTime } from "../utils/date.js";
4
+ import { formatNumber } from "../utils/formatters.js";
5
+ export function useTableFiltersFields(_schema, fields) {
6
+ return { filtersFields: fields };
7
7
  }
8
8
  function applyFormat(value, column) {
9
9
  if (value === void 0 || value === null || !column.format) {
@@ -46,6 +46,6 @@ function transformColumn(column) {
46
46
  }
47
47
  return col;
48
48
  }
49
- export function createTableColumns(columns) {
50
- return columns.map((c) => transformColumn(c));
49
+ export function useTableColumns(columns) {
50
+ return { columns: columns.map((c) => transformColumn(c)) };
51
51
  }
@@ -5,5 +5,4 @@ export * from './formatters';
5
5
  export * from './logger';
6
6
  export * from './slugify';
7
7
  export * from './storage';
8
- export * from './table';
9
8
  export * from './uplora';
@@ -5,5 +5,4 @@ export * from "./formatters.js";
5
5
  export * from "./logger.js";
6
6
  export * from "./slugify.js";
7
7
  export * from "./storage.js";
8
- export * from "./table.js";
9
8
  export * from "./uplora.js";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hywax/cms",
3
3
  "type": "module",
4
- "version": "1.1.1",
4
+ "version": "1.2.0",
5
5
  "description": "Hywax CMS. ⚠️ This package is intended for internal use only.",
6
6
  "repository": {
7
7
  "type": "git",
@@ -68,7 +68,7 @@
68
68
  "consola": "^3.4.2",
69
69
  "defu": "^6.1.4",
70
70
  "fast-copy": "^3.0.2",
71
- "fast-equals": "^5.2.2",
71
+ "fast-equals": "^5.4.0",
72
72
  "nuxt-auth-utils": "^0.5.26",
73
73
  "pathe": "^2.0.3",
74
74
  "scule": "^1.3.0",
@@ -86,13 +86,13 @@
86
86
  "@types/node": "^24.10.4",
87
87
  "@types/sortablejs": "^1.15.9",
88
88
  "@vue/test-utils": "^2.4.6",
89
- "changelogen": "^0.6.1",
89
+ "changelogen": "^0.6.2",
90
90
  "eslint": "^9.39.2",
91
91
  "happy-dom": "^20.0.11",
92
92
  "husky": "^9.1.7",
93
- "lint-staged": "^16.1.2",
93
+ "lint-staged": "^16.2.7",
94
94
  "nuxt": "^4.2.2",
95
- "typescript": "^5.8.3",
95
+ "typescript": "^5.9.3",
96
96
  "vitest": "^3.2.4",
97
97
  "vue-tsc": "^3.2.1"
98
98
  },