@shwfed/nuxt 0.6.1 → 0.7.1
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/dist/module.json +1 -1
- package/dist/module.mjs +13 -0
- package/dist/runtime/components/locale.d.vue.ts +14 -0
- package/dist/runtime/components/locale.vue +89 -0
- package/dist/runtime/components/locale.vue.d.ts +14 -0
- package/dist/runtime/components/query.vue +53 -3
- package/dist/runtime/style.css +1 -1
- package/package.json +5 -1
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -8,6 +8,19 @@ const module$1 = defineNuxtModule({
|
|
|
8
8
|
name: "@shwfed/nuxt",
|
|
9
9
|
configKey: "shwfed"
|
|
10
10
|
},
|
|
11
|
+
moduleDependencies: {
|
|
12
|
+
"@nuxt/fonts": {
|
|
13
|
+
version: "^0.14.0",
|
|
14
|
+
defaults: {
|
|
15
|
+
families: [
|
|
16
|
+
{ name: "Noto Sans", provider: "npm" },
|
|
17
|
+
{ name: "Noto Sans SC", provider: "npm" },
|
|
18
|
+
{ name: "Noto Sans JP", provider: "npm" },
|
|
19
|
+
{ name: "Fira Mono", provider: "npm" }
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
},
|
|
11
24
|
setup(options, nuxt) {
|
|
12
25
|
const resolver = createResolver(import.meta.url);
|
|
13
26
|
const resolvedConfig = defu(options, {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
interface LocaleItem {
|
|
2
|
+
locale: string;
|
|
3
|
+
message: string;
|
|
4
|
+
}
|
|
5
|
+
type __VLS_ModelProps = {
|
|
6
|
+
modelValue?: Array<LocaleItem>;
|
|
7
|
+
};
|
|
8
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
9
|
+
"update:modelValue": (value: LocaleItem[] | undefined) => any;
|
|
10
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
|
|
11
|
+
"onUpdate:modelValue"?: ((value: LocaleItem[] | undefined) => any) | undefined;
|
|
12
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
13
|
+
declare const _default: typeof __VLS_export;
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { Icon } from "@iconify/vue";
|
|
3
|
+
import { useSortable } from "@vueuse/integrations/useSortable";
|
|
4
|
+
import { useTemplateRef } from "vue";
|
|
5
|
+
import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupText } from "./ui/input-group";
|
|
6
|
+
import {
|
|
7
|
+
DropdownMenu,
|
|
8
|
+
DropdownMenuContent,
|
|
9
|
+
DropdownMenuItem,
|
|
10
|
+
DropdownMenuTrigger
|
|
11
|
+
} from "./ui/dropdown-menu";
|
|
12
|
+
const list = defineModel({ type: Array });
|
|
13
|
+
const ul = useTemplateRef("ul");
|
|
14
|
+
useSortable(ul, list);
|
|
15
|
+
const allLocales = ["zh", "ja", "en"];
|
|
16
|
+
const localeNames = {
|
|
17
|
+
zh: "\u4E2D\u6587",
|
|
18
|
+
ja: "\u65E5\u672C\u8A9E",
|
|
19
|
+
en: "English"
|
|
20
|
+
};
|
|
21
|
+
const getAvailableLocales = (currentItem) => {
|
|
22
|
+
const selectedLocales = new Set(list.value?.map((i) => i.locale) ?? []);
|
|
23
|
+
return allLocales.filter((locale) => !selectedLocales.has(locale) || locale === currentItem.locale);
|
|
24
|
+
};
|
|
25
|
+
const removeItem = (item) => {
|
|
26
|
+
if (list.value === void 0) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const index = list.value.indexOf(item);
|
|
30
|
+
if (index > -1) {
|
|
31
|
+
list.value.splice(index, 1);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<template>
|
|
37
|
+
<div
|
|
38
|
+
ref="ul"
|
|
39
|
+
class="flex flex-col gap-2"
|
|
40
|
+
>
|
|
41
|
+
<InputGroup
|
|
42
|
+
v-for="item in list"
|
|
43
|
+
:key="item.locale"
|
|
44
|
+
class="bg-white/90"
|
|
45
|
+
>
|
|
46
|
+
<InputGroupAddon
|
|
47
|
+
align="inline-start"
|
|
48
|
+
data-drag-handle
|
|
49
|
+
>
|
|
50
|
+
<Icon icon="fluent:re-order-dots-vertical-20-regular" />
|
|
51
|
+
</InputGroupAddon>
|
|
52
|
+
<InputGroupAddon align="inline-start">
|
|
53
|
+
<DropdownMenu>
|
|
54
|
+
<DropdownMenuTrigger as-child>
|
|
55
|
+
<InputGroupAddon
|
|
56
|
+
align="inline-start"
|
|
57
|
+
class="cursor-pointer"
|
|
58
|
+
>
|
|
59
|
+
<Icon :icon="`circle-flags:lang-${item.locale}`" />
|
|
60
|
+
</InputGroupAddon>
|
|
61
|
+
</DropdownMenuTrigger>
|
|
62
|
+
<DropdownMenuContent>
|
|
63
|
+
<DropdownMenuItem
|
|
64
|
+
v-for="locale in getAvailableLocales(item)"
|
|
65
|
+
:key="locale"
|
|
66
|
+
@select="item.locale = locale"
|
|
67
|
+
>
|
|
68
|
+
<Icon :icon="`circle-flags:lang-${locale}`" />
|
|
69
|
+
{{ localeNames[locale] }}
|
|
70
|
+
</DropdownMenuItem>
|
|
71
|
+
</DropdownMenuContent>
|
|
72
|
+
</DropdownMenu>
|
|
73
|
+
</InputGroupAddon>
|
|
74
|
+
<InputGroupAddon align="inline-end">
|
|
75
|
+
<InputGroupButton
|
|
76
|
+
align="inline-end"
|
|
77
|
+
variant="destructive"
|
|
78
|
+
@click="removeItem(item)"
|
|
79
|
+
>
|
|
80
|
+
<Icon icon="fluent:delete-20-regular" />
|
|
81
|
+
</InputGroupButton>
|
|
82
|
+
</InputGroupAddon>
|
|
83
|
+
<InputGroupText
|
|
84
|
+
v-model="item.message"
|
|
85
|
+
class="flex-1"
|
|
86
|
+
/>
|
|
87
|
+
</InputGroup>
|
|
88
|
+
</div>
|
|
89
|
+
</template>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
interface LocaleItem {
|
|
2
|
+
locale: string;
|
|
3
|
+
message: string;
|
|
4
|
+
}
|
|
5
|
+
type __VLS_ModelProps = {
|
|
6
|
+
modelValue?: Array<LocaleItem>;
|
|
7
|
+
};
|
|
8
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
9
|
+
"update:modelValue": (value: LocaleItem[] | undefined) => any;
|
|
10
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
|
|
11
|
+
"onUpdate:modelValue"?: ((value: LocaleItem[] | undefined) => any) | undefined;
|
|
12
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
13
|
+
declare const _default: typeof __VLS_export;
|
|
14
|
+
export default _default;
|
|
@@ -10,10 +10,11 @@ import { useCheating, useId } from "#imports";
|
|
|
10
10
|
import { defu } from "defu";
|
|
11
11
|
import { Dialog, DialogScrollContent, DialogHeader, DialogTitle, DialogDescription } from "./ui/dialog";
|
|
12
12
|
import { Skeleton } from "./ui/skeleton";
|
|
13
|
-
import { ref, watch } from "vue";
|
|
13
|
+
import { ref, useTemplateRef, watch } from "vue";
|
|
14
14
|
import { Effect, Either, Schema } from "effect";
|
|
15
|
-
import { computedAsync } from "@vueuse/core";
|
|
15
|
+
import { computedAsync, createReusableTemplate } from "@vueuse/core";
|
|
16
16
|
import { getRead } from "../utilities/query-config/global";
|
|
17
|
+
import { useSortable } from "@vueuse/integrations/useSortable";
|
|
17
18
|
import { FieldSchema } from "../utilities/query-config/schema";
|
|
18
19
|
</script>
|
|
19
20
|
|
|
@@ -63,6 +64,10 @@ const modelValue = defineModel("modelValue", { type: Object, ...{
|
|
|
63
64
|
} });
|
|
64
65
|
const isCheating = useCheating();
|
|
65
66
|
const isDialogOpen = ref(false);
|
|
67
|
+
const [DefineTextConfiguration, TextConfiguration] = createReusableTemplate();
|
|
68
|
+
const [DefineNumberConfiguration, NumberConfiguration] = createReusableTemplate();
|
|
69
|
+
const sortableFields = useTemplateRef("sortableFields");
|
|
70
|
+
useSortable(sortableFields, [], {});
|
|
66
71
|
</script>
|
|
67
72
|
|
|
68
73
|
<template>
|
|
@@ -89,7 +94,24 @@ const isDialogOpen = ref(false);
|
|
|
89
94
|
<DialogDescription class="sr-only">
|
|
90
95
|
<DialogTitle>Configure query fields dynamically</DialogTitle>
|
|
91
96
|
</DialogDescription>
|
|
92
|
-
<
|
|
97
|
+
<ul
|
|
98
|
+
ref="sortableFields"
|
|
99
|
+
class="flex flex-col gap-2"
|
|
100
|
+
>
|
|
101
|
+
<template
|
|
102
|
+
v-for="field of fields"
|
|
103
|
+
:key="field.path"
|
|
104
|
+
>
|
|
105
|
+
<TextConfiguration
|
|
106
|
+
v-if="field.type === 'string'"
|
|
107
|
+
v-bind="field"
|
|
108
|
+
/>
|
|
109
|
+
<NumberConfiguration
|
|
110
|
+
v-if="field.type === 'number'"
|
|
111
|
+
v-bind="field"
|
|
112
|
+
/>
|
|
113
|
+
</template>
|
|
114
|
+
</ul>
|
|
93
115
|
</DialogScrollContent>
|
|
94
116
|
</Dialog>
|
|
95
117
|
|
|
@@ -98,6 +120,34 @@ const isDialogOpen = ref(false);
|
|
|
98
120
|
class="absolute inset-0 z-10 w-full h-full"
|
|
99
121
|
/>
|
|
100
122
|
|
|
123
|
+
<DefineTextConfiguration #="{ path }">
|
|
124
|
+
<InputGroup>
|
|
125
|
+
<InputGroupAddon>
|
|
126
|
+
<Icon
|
|
127
|
+
icon="fluent:re-order-dots-20-regular"
|
|
128
|
+
/>
|
|
129
|
+
</InputGroupAddon>
|
|
130
|
+
<InputGroupInput
|
|
131
|
+
:model-value="path"
|
|
132
|
+
class="font-mono"
|
|
133
|
+
/>
|
|
134
|
+
</InputGroup>
|
|
135
|
+
</DefineTextConfiguration>
|
|
136
|
+
|
|
137
|
+
<DefineNumberConfiguration #="{ path }">
|
|
138
|
+
<InputGroup>
|
|
139
|
+
<InputGroupAddon>
|
|
140
|
+
<Icon
|
|
141
|
+
icon="fluent:re-order-dots-20-regular"
|
|
142
|
+
/>
|
|
143
|
+
</InputGroupAddon>
|
|
144
|
+
<InputGroupInput
|
|
145
|
+
:model-value="path"
|
|
146
|
+
class="font-mono"
|
|
147
|
+
/>
|
|
148
|
+
</InputGroup>
|
|
149
|
+
</DefineNumberConfiguration>
|
|
150
|
+
|
|
101
151
|
<Field
|
|
102
152
|
v-for="(field, i) in fields"
|
|
103
153
|
:key="field.path"
|
package/dist/runtime/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@import "tailwindcss";@plugin "@tailwindcss/typography";@source "components"
|
|
1
|
+
@import "tailwindcss";@plugin "@tailwindcss/typography";@source "components";@theme{--font-sans:"Noto Sans","Noto Sans SC","Noto Sans JP","sans-serif";--font-mono:"Berkeley Mono","Fira Mono","monospace"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shwfed/nuxt",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -37,9 +37,13 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@date-fns/tz": "^1.4.1",
|
|
40
|
+
"@fontsource-variable/noto-sans": "^5.2.10",
|
|
41
|
+
"@fontsource-variable/noto-sans-jp": "^5.2.10",
|
|
42
|
+
"@fontsource-variable/noto-sans-sc": "^5.2.10",
|
|
40
43
|
"@iconify/vue": "^5.0.0",
|
|
41
44
|
"@intlify/unplugin-vue-i18n": "^11.0.3",
|
|
42
45
|
"@marcbachmann/cel-js": "^7.2.1",
|
|
46
|
+
"@nuxt/fonts": "^0.14.0",
|
|
43
47
|
"@nuxt/kit": "^4.3.0",
|
|
44
48
|
"@tailwindcss/typography": "^0.5.19",
|
|
45
49
|
"@tailwindcss/vite": "^4.2.1",
|