@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.
- package/.nuxt/cms/table-cell-user.ts +5 -1
- package/dist/module.d.mts +5 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +15 -6
- package/dist/runtime/components/AutocompleteSelect.vue +1 -0
- package/dist/runtime/components/InputSlug.vue +2 -6
- package/dist/runtime/components/InputSlug.vue.d.ts +1 -3
- package/dist/runtime/components/TableCellPreview.vue +2 -1
- package/dist/runtime/components/TableCellUser.vue +19 -12
- package/dist/runtime/components/TableCellUser.vue.d.ts +4 -1
- package/dist/runtime/components/TablePanel.vue +2 -0
- package/dist/runtime/utils/features.d.ts +4 -0
- package/dist/runtime/utils/features.js +13 -0
- package/dist/runtime/utils/index.d.ts +2 -0
- package/dist/runtime/utils/index.js +2 -0
- package/dist/runtime/utils/logger.d.ts +1 -0
- package/dist/runtime/utils/logger.js +2 -0
- package/package.json +2 -1
package/dist/module.d.mts
CHANGED
package/dist/module.json
CHANGED
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.
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
:
|
|
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
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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,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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const logger: import("consola").ConsolaInstance;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hywax/cms",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
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",
|