@shwfed/nuxt 0.1.77 → 0.1.79

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@shwfed/nuxt",
3
3
  "configKey": "@shwfed/nuxt",
4
- "version": "0.1.77",
4
+ "version": "0.1.79",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -66,6 +66,8 @@ type __VLS_Props = {
66
66
  * Structured command entries for profile menu and command palette.
67
67
  */
68
68
  commands?: Array<ProfileCommandInputItem | ProfileCommandInputGroup>;
69
+ read?: <T>(identity: string) => Effect.Effect<T>;
70
+ write?: <T>(identity: string, value: T) => Effect.Effect<void>;
69
71
  };
70
72
  declare var __VLS_108: {}, __VLS_124: {}, __VLS_347: {};
71
73
  type __VLS_Slots = {} & {
@@ -9,6 +9,7 @@ import { useI18n } from "vue-i18n";
9
9
  import { Icon } from "@iconify/vue";
10
10
  import { Effect } from "effect";
11
11
  import { setGlobalDslContext } from "../plugins/cel/context";
12
+ import { setQueryConfigAccessors } from "../utilities/query-config/global";
12
13
  import { Sidebar, SidebarContent, SidebarGroup, SidebarGroupContent, SidebarGroupLabel, SidebarMenu, SidebarMenuAction, SidebarMenuButton, SidebarMenuItem, SidebarProvider } from "./ui/sidebar";
13
14
  import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "./ui/collapsible";
14
15
  import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from "./ui/dropdown-menu";
@@ -25,7 +26,9 @@ const { t } = useI18n();
25
26
  const props = defineProps({
26
27
  dsl: { type: null, required: false },
27
28
  sidebar: { type: Array, required: false },
28
- commands: { type: Array, required: false }
29
+ commands: { type: Array, required: false },
30
+ read: { type: Function, required: false },
31
+ write: { type: Function, required: false }
29
32
  });
30
33
  const { active, tabs, nameOf, close } = useNavigationTabs(() => props.sidebar ?? []);
31
34
  const ui = reactive({
@@ -47,6 +50,9 @@ const { start: startProfileCloseTimer, stop: stopProfileCloseTimer } = useTimeou
47
50
  const { meta_k } = useMagicKeys();
48
51
  whenever(() => meta_k?.value, () => ui.isCommandPaletteOpen = !ui.isCommandPaletteOpen);
49
52
  setGlobalDslContext(await props.dsl?.pipe(Effect.scoped).pipe(Effect.runPromise) ?? {});
53
+ if (props.read !== void 0 && props.write !== void 0) {
54
+ setQueryConfigAccessors(props.read, props.write);
55
+ }
50
56
  const {
51
57
  isFavorited: isNavigationFavorited,
52
58
  canBeFavorited: canBeNavigationFavorited,
@@ -66,6 +66,8 @@ type __VLS_Props = {
66
66
  * Structured command entries for profile menu and command palette.
67
67
  */
68
68
  commands?: Array<ProfileCommandInputItem | ProfileCommandInputGroup>;
69
+ read?: <T>(identity: string) => Effect.Effect<T>;
70
+ write?: <T>(identity: string, value: T) => Effect.Effect<void>;
69
71
  };
70
72
  declare var __VLS_108: {}, __VLS_124: {}, __VLS_347: {};
71
73
  type __VLS_Slots = {} & {
@@ -1,66 +1,26 @@
1
- import { Field } from './ui/field/index.js';
2
- import type { ClassValue } from 'clsx';
3
- type Option = Readonly<{
4
- label: Record<string, string>;
5
- value: string | number;
6
- icon?: string;
7
- }>;
8
- type OptionsGroup = Readonly<{
9
- label: Record<string, string>;
10
- value: string | number;
11
- options: ReadonlyArray<Option>;
12
- }>;
13
- type TextField = Readonly<{
14
- type: 'string';
15
- path: string;
16
- label: Record<string, string>;
17
- intial?: string;
18
- icon?: string;
19
- class?: ClassValue;
20
- treatEmptyAsDifferentStateFromNull?: boolean;
21
- }>;
22
- type SelectField = Readonly<{
23
- type: 'select';
24
- path: string;
25
- label: Record<string, string>;
26
- intial?: string;
27
- icon?: string;
28
- options: ReadonlyArray<OptionsGroup>;
29
- class?: ClassValue;
30
- }>;
31
- type NumberField = Readonly<{
32
- type: 'number';
33
- path: string;
34
- label: Record<string, string>;
35
- intial?: string;
36
- icon?: string;
37
- class?: ClassValue;
38
- min?: number;
39
- max?: number;
40
- step?: number;
41
- }>;
42
- type Field = TextField | SelectField | NumberField;
43
1
  declare const _default: typeof __VLS_export;
44
2
  export default _default;
45
3
  declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
46
- fields: ReadonlyArray<Field>;
4
+ identifier: string;
47
5
  } & {
48
6
  modelValue?: Record<string, unknown>;
49
7
  }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
50
8
  "update:modelValue": (value: Record<string, unknown>) => any;
51
9
  }, string, import("vue").PublicProps, Readonly<{
52
- fields: ReadonlyArray<Field>;
10
+ identifier: string;
53
11
  } & {
54
12
  modelValue?: Record<string, unknown>;
55
13
  }> & Readonly<{
56
14
  "onUpdate:modelValue"?: ((value: Record<string, unknown>) => any) | undefined;
57
15
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
58
16
  option?: (props: {
59
- option: Readonly<{
60
- label: Record<string, string>;
61
- value: string | number;
62
- icon?: string;
63
- }>;
17
+ option: {
18
+ readonly label: {
19
+ readonly [x: string]: string;
20
+ };
21
+ readonly value: string | number;
22
+ readonly icon?: string | undefined;
23
+ };
64
24
  }) => any;
65
25
  }>;
66
26
  type __VLS_WithSlots<T, S> = T & {
@@ -8,33 +8,100 @@ import { deleteProperty, getProperty, hasProperty, setProperty } from "dot-prop"
8
8
  import { CommandGroup, CommandItem } from "./ui/command";
9
9
  import { useCheating, useId } from "#imports";
10
10
  import { defu } from "defu";
11
+ import { Dialog, DialogScrollContent, DialogHeader, DialogTitle, DialogDescription } from "./ui/dialog";
12
+ import { Skeleton } from "./ui/skeleton";
13
+ import { ref, watch } from "vue";
14
+ import { Effect, Either, Schema } from "effect";
15
+ import { computedAsync } from "@vueuse/core";
16
+ import { getRead } from "../utilities/query-config/global";
17
+ import { FieldSchema } from "../utilities/query-config/schema";
11
18
  </script>
12
19
 
13
20
  <script setup>
14
21
  const id = useId();
15
22
  const props = defineProps({
16
- fields: { type: Array, required: true }
17
- });
18
- const { t } = useI18n({
19
- messages: props.fields.reduce((acc, field, i) => {
20
- function t2(locales) {
21
- return Object.fromEntries(Object.entries(locales).map(([locale, message]) => [locale, { [`${id}-${i}`]: message }]));
22
- }
23
- return defu(acc, t2(field.label));
24
- }, {})
23
+ identifier: { type: String, required: true }
25
24
  });
25
+ const read = getRead();
26
+ const fields = computedAsync(
27
+ () => Effect.gen(function* () {
28
+ const result = yield* read(props.identifier).pipe(Effect.either);
29
+ return yield* Either.match(result, {
30
+ onLeft: () => Effect.succeed([]),
31
+ onRight: (data) => Schema.decodeUnknown(Schema.Array(FieldSchema))(data).pipe(
32
+ Effect.either,
33
+ Effect.map(
34
+ (decodeResult) => Either.match(decodeResult, {
35
+ onLeft: () => [],
36
+ onRight: (fields2) => fields2
37
+ })
38
+ )
39
+ )
40
+ });
41
+ }).pipe(Effect.runPromise)
42
+ );
43
+ const { t, mergeLocaleMessage } = useI18n();
44
+ watch(fields, (fields2) => {
45
+ if (fields2 === void 0) {
46
+ return;
47
+ }
48
+ const messages = fields2.reduce((acc, field, i) => {
49
+ const fieldMessages = Object.fromEntries(
50
+ Object.entries(field.label).map(([locale, message]) => [
51
+ locale,
52
+ { [`${id}-${i}`]: message }
53
+ ])
54
+ );
55
+ return defu(acc, fieldMessages);
56
+ }, {});
57
+ for (const [locale, messageMap] of Object.entries(messages)) {
58
+ mergeLocaleMessage(locale, messageMap);
59
+ }
60
+ }, { immediate: true });
26
61
  const modelValue = defineModel("modelValue", { type: Object, ...{
27
62
  default: () => ({})
28
63
  } });
29
64
  const isCheating = useCheating();
65
+ const isDialogOpen = ref(false);
30
66
  </script>
31
67
 
32
68
  <template>
33
- <div>
69
+ <div
70
+ :class="[
71
+ 'relative p-1 border border-dashed',
72
+ isCheating ? 'border-(--primary)/20 rounded hover:border-(--primary)/40 transition-colors duration-150 group cursor-pointer' : 'border-transparent'
73
+ ]"
74
+ >
75
+ <button
76
+ v-if="isCheating"
77
+ type="button"
78
+ class="absolute inset-0 z-10 w-full h-full bg-transparent cursor-pointer"
79
+ @click="isDialogOpen = true"
80
+ >
81
+ <span class="sr-only">Edit query fields</span>
82
+ </button>
83
+
84
+ <Dialog v-model:open="isDialogOpen">
85
+ <DialogScrollContent class="w-80%">
86
+ <DialogHeader>
87
+ <DialogTitle>配置搜索项</DialogTitle>
88
+ </DialogHeader>
89
+ <DialogDescription class="sr-only">
90
+ <DialogTitle>Configure query fields dynamically</DialogTitle>
91
+ </DialogDescription>
92
+ <pre class="text-xs overflow-auto">{{ JSON.stringify(fields, null, 2) }}</pre>
93
+ </DialogScrollContent>
94
+ </Dialog>
95
+
96
+ <Skeleton
97
+ v-if="fields === void 0"
98
+ class="absolute inset-0 z-10 w-full h-full"
99
+ />
100
+
34
101
  <Field
35
102
  v-for="(field, i) in fields"
36
103
  :key="field.path"
37
- :class="field.class"
104
+ :style="field.style"
38
105
  >
39
106
  <InputGroup>
40
107
  <InputGroupInput
@@ -81,7 +148,7 @@ const isCheating = useCheating();
81
148
  :max="field.max"
82
149
  :step="field.step"
83
150
  @update:model-value="(value) => {
84
- if (!value) {
151
+ if (!value && value !== 0) {
85
152
  deleteProperty(modelValue, field.path);
86
153
  } else {
87
154
  setProperty(modelValue, field.path, value);
@@ -118,9 +185,14 @@ const isCheating = useCheating();
118
185
  </InputGroup>
119
186
  <FieldLabel
120
187
  v-if="isCheating"
121
- class="font-mono"
188
+ class="flex items-center gap-1"
122
189
  >
123
- {{ field.path }}
190
+ <span class="font-mono">
191
+ {{ field.path }}
192
+ </span>
193
+ <span class="text-zinc-500">
194
+ ({{ t(`${id}-${i}`) }})
195
+ </span>
124
196
  </FieldLabel>
125
197
  <FieldLabel v-else>
126
198
  {{ t(`${id}-${i}`) }}
@@ -1,66 +1,26 @@
1
- import { Field } from './ui/field/index.js';
2
- import type { ClassValue } from 'clsx';
3
- type Option = Readonly<{
4
- label: Record<string, string>;
5
- value: string | number;
6
- icon?: string;
7
- }>;
8
- type OptionsGroup = Readonly<{
9
- label: Record<string, string>;
10
- value: string | number;
11
- options: ReadonlyArray<Option>;
12
- }>;
13
- type TextField = Readonly<{
14
- type: 'string';
15
- path: string;
16
- label: Record<string, string>;
17
- intial?: string;
18
- icon?: string;
19
- class?: ClassValue;
20
- treatEmptyAsDifferentStateFromNull?: boolean;
21
- }>;
22
- type SelectField = Readonly<{
23
- type: 'select';
24
- path: string;
25
- label: Record<string, string>;
26
- intial?: string;
27
- icon?: string;
28
- options: ReadonlyArray<OptionsGroup>;
29
- class?: ClassValue;
30
- }>;
31
- type NumberField = Readonly<{
32
- type: 'number';
33
- path: string;
34
- label: Record<string, string>;
35
- intial?: string;
36
- icon?: string;
37
- class?: ClassValue;
38
- min?: number;
39
- max?: number;
40
- step?: number;
41
- }>;
42
- type Field = TextField | SelectField | NumberField;
43
1
  declare const _default: typeof __VLS_export;
44
2
  export default _default;
45
3
  declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
46
- fields: ReadonlyArray<Field>;
4
+ identifier: string;
47
5
  } & {
48
6
  modelValue?: Record<string, unknown>;
49
7
  }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
50
8
  "update:modelValue": (value: Record<string, unknown>) => any;
51
9
  }, string, import("vue").PublicProps, Readonly<{
52
- fields: ReadonlyArray<Field>;
10
+ identifier: string;
53
11
  } & {
54
12
  modelValue?: Record<string, unknown>;
55
13
  }> & Readonly<{
56
14
  "onUpdate:modelValue"?: ((value: Record<string, unknown>) => any) | undefined;
57
15
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
58
16
  option?: (props: {
59
- option: Readonly<{
60
- label: Record<string, string>;
61
- value: string | number;
62
- icon?: string;
63
- }>;
17
+ option: {
18
+ readonly label: {
19
+ readonly [x: string]: string;
20
+ };
21
+ readonly value: string | number;
22
+ readonly icon?: string | undefined;
23
+ };
64
24
  }) => any;
65
25
  }>;
66
26
  type __VLS_WithSlots<T, S> = T & {
@@ -1,4 +1,5 @@
1
1
  <script setup>
2
+ import { Icon } from "@iconify/vue";
2
3
  import { reactiveOmit } from "@vueuse/core";
3
4
  import {
4
5
  DialogClose,
@@ -26,12 +27,12 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits);
26
27
  <template>
27
28
  <DialogPortal>
28
29
  <DialogOverlay
29
- class="fixed inset-0 z-50 grid place-items-center overflow-y-auto bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"
30
+ class="fixed inset-0 z-50 grid place-items-center overflow-y-auto bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"
30
31
  >
31
32
  <DialogContent
32
33
  :class="
33
34
  cn(
34
- 'relative z-50 grid w-full max-w-lg my-8 gap-4 border border-border bg-background p-6 shadow-lg duration-200 sm:rounded-lg md:w-full',
35
+ 'relative z-50 grid w-full max-w-lg my-8 gap-4 border border-zinc-200 bg-white p-6 shadow-lg duration-200 sm:rounded-lg md:w-full',
35
36
  props.class
36
37
  )
37
38
  "
@@ -8,6 +8,6 @@ const props = defineProps({
8
8
  <template>
9
9
  <div
10
10
  data-slot="skeleton"
11
- :class="cn('animate-pulse rounded-md bg-[color-mix(in_srgb,var(--primary)_10%,white)]', props.class)"
11
+ :class="cn('animate-pulse rounded-md bg-zinc-300/20', props.class)"
12
12
  />
13
13
  </template>
@@ -0,0 +1,4 @@
1
+ import type { Effect } from 'effect';
2
+ export declare function setQueryConfigAccessors(read: <T>(identity: string) => Effect.Effect<T>, write: <T>(identity: string, value: T) => Effect.Effect<void>): void;
3
+ export declare function getRead(): <T>(identity: string) => Effect.Effect<T>;
4
+ export declare function getWrite(): <T>(identity: string, value: T) => Effect.Effect<void>;
@@ -0,0 +1,18 @@
1
+ let readFn;
2
+ let writeFn;
3
+ export function setQueryConfigAccessors(read, write) {
4
+ readFn = read;
5
+ writeFn = write;
6
+ }
7
+ export function getRead() {
8
+ if (readFn === void 0) {
9
+ throw new Error("Query config accessors not set. Ensure app.vue receives read and write props.");
10
+ }
11
+ return readFn;
12
+ }
13
+ export function getWrite() {
14
+ if (writeFn === void 0) {
15
+ throw new Error("Query config accessors not set. Ensure app.vue receives read and write props.");
16
+ }
17
+ return writeFn;
18
+ }
@@ -0,0 +1,3 @@
1
+ export { I18nLabelSchema, OptionSchema, OptionsGroupSchema, TextFieldSchema, SelectFieldSchema, NumberFieldSchema, FieldSchema, } from './schema.js';
2
+ export type { I18nLabel, Option, OptionsGroup, TextField, SelectField, NumberField, Field, } from './schema.js';
3
+ export { setQueryConfigAccessors, getRead, getWrite, } from './global.js';
@@ -0,0 +1,14 @@
1
+ export {
2
+ I18nLabelSchema,
3
+ OptionSchema,
4
+ OptionsGroupSchema,
5
+ TextFieldSchema,
6
+ SelectFieldSchema,
7
+ NumberFieldSchema,
8
+ FieldSchema
9
+ } from "./schema.js";
10
+ export {
11
+ setQueryConfigAccessors,
12
+ getRead,
13
+ getWrite
14
+ } from "./global.js";
@@ -0,0 +1,96 @@
1
+ import { Schema } from 'effect';
2
+ declare const I18nLabelSchema: Schema.Record$<typeof Schema.String, typeof Schema.String>;
3
+ declare const OptionSchema: Schema.Struct<{
4
+ label: Schema.Record$<typeof Schema.String, typeof Schema.String>;
5
+ value: Schema.Union<[typeof Schema.String, typeof Schema.Number]>;
6
+ icon: Schema.optional<typeof Schema.String>;
7
+ }>;
8
+ declare const OptionsGroupSchema: Schema.Struct<{
9
+ label: Schema.Record$<typeof Schema.String, typeof Schema.String>;
10
+ value: Schema.Union<[typeof Schema.String, typeof Schema.Number]>;
11
+ options: Schema.Array$<Schema.Struct<{
12
+ label: Schema.Record$<typeof Schema.String, typeof Schema.String>;
13
+ value: Schema.Union<[typeof Schema.String, typeof Schema.Number]>;
14
+ icon: Schema.optional<typeof Schema.String>;
15
+ }>>;
16
+ }>;
17
+ declare const TextFieldSchema: Schema.Struct<{
18
+ type: Schema.Literal<["string"]>;
19
+ path: typeof Schema.String;
20
+ label: Schema.Record$<typeof Schema.String, typeof Schema.String>;
21
+ initial: Schema.optional<typeof Schema.String>;
22
+ icon: Schema.optional<typeof Schema.String>;
23
+ style: Schema.optional<typeof Schema.Object>;
24
+ treatEmptyAsDifferentStateFromNull: Schema.optional<typeof Schema.Boolean>;
25
+ }>;
26
+ declare const SelectFieldSchema: Schema.Struct<{
27
+ type: Schema.Literal<["select"]>;
28
+ path: typeof Schema.String;
29
+ label: Schema.Record$<typeof Schema.String, typeof Schema.String>;
30
+ initial: Schema.optional<typeof Schema.String>;
31
+ icon: Schema.optional<typeof Schema.String>;
32
+ options: Schema.Array$<Schema.Struct<{
33
+ label: Schema.Record$<typeof Schema.String, typeof Schema.String>;
34
+ value: Schema.Union<[typeof Schema.String, typeof Schema.Number]>;
35
+ options: Schema.Array$<Schema.Struct<{
36
+ label: Schema.Record$<typeof Schema.String, typeof Schema.String>;
37
+ value: Schema.Union<[typeof Schema.String, typeof Schema.Number]>;
38
+ icon: Schema.optional<typeof Schema.String>;
39
+ }>>;
40
+ }>>;
41
+ style: Schema.optional<typeof Schema.Object>;
42
+ }>;
43
+ declare const NumberFieldSchema: Schema.Struct<{
44
+ type: Schema.Literal<["number"]>;
45
+ path: typeof Schema.String;
46
+ label: Schema.Record$<typeof Schema.String, typeof Schema.String>;
47
+ initial: Schema.optional<typeof Schema.String>;
48
+ icon: Schema.optional<typeof Schema.String>;
49
+ style: Schema.optional<typeof Schema.Object>;
50
+ min: Schema.optional<typeof Schema.Number>;
51
+ max: Schema.optional<typeof Schema.Number>;
52
+ step: Schema.optional<typeof Schema.Number>;
53
+ }>;
54
+ declare const FieldSchema: Schema.Union<[Schema.Struct<{
55
+ type: Schema.Literal<["string"]>;
56
+ path: typeof Schema.String;
57
+ label: Schema.Record$<typeof Schema.String, typeof Schema.String>;
58
+ initial: Schema.optional<typeof Schema.String>;
59
+ icon: Schema.optional<typeof Schema.String>;
60
+ style: Schema.optional<typeof Schema.Object>;
61
+ treatEmptyAsDifferentStateFromNull: Schema.optional<typeof Schema.Boolean>;
62
+ }>, Schema.Struct<{
63
+ type: Schema.Literal<["select"]>;
64
+ path: typeof Schema.String;
65
+ label: Schema.Record$<typeof Schema.String, typeof Schema.String>;
66
+ initial: Schema.optional<typeof Schema.String>;
67
+ icon: Schema.optional<typeof Schema.String>;
68
+ options: Schema.Array$<Schema.Struct<{
69
+ label: Schema.Record$<typeof Schema.String, typeof Schema.String>;
70
+ value: Schema.Union<[typeof Schema.String, typeof Schema.Number]>;
71
+ options: Schema.Array$<Schema.Struct<{
72
+ label: Schema.Record$<typeof Schema.String, typeof Schema.String>;
73
+ value: Schema.Union<[typeof Schema.String, typeof Schema.Number]>;
74
+ icon: Schema.optional<typeof Schema.String>;
75
+ }>>;
76
+ }>>;
77
+ style: Schema.optional<typeof Schema.Object>;
78
+ }>, Schema.Struct<{
79
+ type: Schema.Literal<["number"]>;
80
+ path: typeof Schema.String;
81
+ label: Schema.Record$<typeof Schema.String, typeof Schema.String>;
82
+ initial: Schema.optional<typeof Schema.String>;
83
+ icon: Schema.optional<typeof Schema.String>;
84
+ style: Schema.optional<typeof Schema.Object>;
85
+ min: Schema.optional<typeof Schema.Number>;
86
+ max: Schema.optional<typeof Schema.Number>;
87
+ step: Schema.optional<typeof Schema.Number>;
88
+ }>]>;
89
+ export { I18nLabelSchema, OptionSchema, OptionsGroupSchema, TextFieldSchema, SelectFieldSchema, NumberFieldSchema, FieldSchema, };
90
+ export type I18nLabel = Schema.Schema.Type<typeof I18nLabelSchema>;
91
+ export type Option = Schema.Schema.Type<typeof OptionSchema>;
92
+ export type OptionsGroup = Schema.Schema.Type<typeof OptionsGroupSchema>;
93
+ export type TextField = Schema.Schema.Type<typeof TextFieldSchema>;
94
+ export type SelectField = Schema.Schema.Type<typeof SelectFieldSchema>;
95
+ export type NumberField = Schema.Schema.Type<typeof NumberFieldSchema>;
96
+ export type Field = Schema.Schema.Type<typeof FieldSchema>;
@@ -0,0 +1,51 @@
1
+ import { Schema } from "effect";
2
+ const I18nLabelSchema = Schema.Record({ key: Schema.String, value: Schema.String });
3
+ const OptionSchema = Schema.Struct({
4
+ label: I18nLabelSchema,
5
+ value: Schema.Union(Schema.String, Schema.Number),
6
+ icon: Schema.optional(Schema.String)
7
+ });
8
+ const OptionsGroupSchema = Schema.Struct({
9
+ label: I18nLabelSchema,
10
+ value: Schema.Union(Schema.String, Schema.Number),
11
+ options: Schema.Array(OptionSchema)
12
+ });
13
+ const TextFieldSchema = Schema.Struct({
14
+ type: Schema.Literal("string"),
15
+ path: Schema.String,
16
+ label: I18nLabelSchema,
17
+ initial: Schema.optional(Schema.String),
18
+ icon: Schema.optional(Schema.String),
19
+ style: Schema.optional(Schema.Object),
20
+ treatEmptyAsDifferentStateFromNull: Schema.optional(Schema.Boolean)
21
+ });
22
+ const SelectFieldSchema = Schema.Struct({
23
+ type: Schema.Literal("select"),
24
+ path: Schema.String,
25
+ label: I18nLabelSchema,
26
+ initial: Schema.optional(Schema.String),
27
+ icon: Schema.optional(Schema.String),
28
+ options: Schema.Array(OptionsGroupSchema),
29
+ style: Schema.optional(Schema.Object)
30
+ });
31
+ const NumberFieldSchema = Schema.Struct({
32
+ type: Schema.Literal("number"),
33
+ path: Schema.String,
34
+ label: I18nLabelSchema,
35
+ initial: Schema.optional(Schema.String),
36
+ icon: Schema.optional(Schema.String),
37
+ style: Schema.optional(Schema.Object),
38
+ min: Schema.optional(Schema.Number),
39
+ max: Schema.optional(Schema.Number),
40
+ step: Schema.optional(Schema.Number)
41
+ });
42
+ const FieldSchema = Schema.Union(TextFieldSchema, SelectFieldSchema, NumberFieldSchema);
43
+ export {
44
+ I18nLabelSchema,
45
+ OptionSchema,
46
+ OptionsGroupSchema,
47
+ TextFieldSchema,
48
+ SelectFieldSchema,
49
+ NumberFieldSchema,
50
+ FieldSchema
51
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shwfed/nuxt",
3
- "version": "0.1.77",
3
+ "version": "0.1.79",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -29,7 +29,7 @@
29
29
  "dev": "npm run dev:prepare && nuxt dev playground",
30
30
  "dev:build": "nuxt build playground",
31
31
  "dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxt prepare playground",
32
- "release": "npm run lint && npm run test && npm run prepack && changelogen --release && npm publish && git push --follow-tags && git pull --tags --force origin main",
32
+ "release": "npm run lint && npm run test && npm run prepack && changelogen --release --push && npm publish",
33
33
  "lint": "eslint .",
34
34
  "postinstall": "husky",
35
35
  "test": "vitest run",