From 042f756eef6edb7ab55828859de6da0babe39940 Mon Sep 17 00:00:00 2001 From: Simon He <57086651+Simon-He95@users.noreply.github.com> Date: Wed, 25 Oct 2023 18:11:28 +0800 Subject: [PATCH] feat: support nuxtUi --- src/ui/nuxtUi/nuxtUi2/UAvatar.json | 16 ++++++++-------- src/ui/nuxtUi/nuxtUi2/UBadge.json | 8 ++++---- src/ui/nuxtUi/nuxtUi2/UButton.json | 8 ++++---- src/ui/nuxtUi/nuxtUi2/UDropdown.json | 8 ++++---- src/ui/nuxtUi/nuxtUi2/UForm.json | 9 ++------- src/ui/nuxtUi/nuxtUi2/UFormGroup.json | 8 ++++---- src/ui/nuxtUi/nuxtUi2/UInput.json | 16 ++++++++-------- src/ui/nuxtUi/nuxtUi2/UKbd.json | 8 ++++---- src/ui/nuxtUi/nuxtUi2/UPagination.json | 8 ++++---- src/ui/nuxtUi/nuxtUi2/UPopover.json | 8 ++++---- src/ui/nuxtUi/nuxtUi2/URange.json | 8 ++++---- src/ui/nuxtUi/nuxtUi2/USelect.json | 16 ++++++++-------- src/ui/nuxtUi/nuxtUi2/USelectMenu.json | 8 ++++---- src/ui/nuxtUi/nuxtUi2/USkeleton.json | 13 +++++++++++++ src/ui/nuxtUi/nuxtUi2/USlideover.json | 8 ++++---- src/ui/nuxtUi/nuxtUi2/UTable.json | 5 +---- src/ui/nuxtUi/nuxtUi2/UTabs.json | 8 ++++---- src/ui/nuxtUi/nuxtUi2/UTextarea.json | 8 ++++---- src/ui/nuxtUi/nuxtUi2/index.ts | 8 +++++++- src/ui/utils.ts | 2 +- 20 files changed, 96 insertions(+), 85 deletions(-) create mode 100644 src/ui/nuxtUi/nuxtUi2/USkeleton.json diff --git a/src/ui/nuxtUi/nuxtUi2/UAvatar.json b/src/ui/nuxtUi/nuxtUi2/UAvatar.json index 4f1c4345..ad40486a 100644 --- a/src/ui/nuxtUi/nuxtUi2/UAvatar.json +++ b/src/ui/nuxtUi/nuxtUi2/UAvatar.json @@ -9,7 +9,9 @@ "value": "" }, "size": { - "type": [ + "type": "string", + "default": "config.default.size", + "value": [ "sm", "3xs", "2xs", @@ -19,9 +21,7 @@ "xl", "2xl", "3xl" - ], - "default": "config.default.size", - "value": "" + ] }, "icon": { "type": "string", @@ -44,14 +44,14 @@ "value": "" }, "chipPosition": { - "type": [ + "type": "string", + "default": "config.default.chipPosition", + "value": [ "top-right", "bottom-right", "top-left", "bottom-left" - ], - "default": "config.default.chipPosition", - "value": "" + ] }, "chipText": { "type": "string | number", diff --git a/src/ui/nuxtUi/nuxtUi2/UBadge.json b/src/ui/nuxtUi/nuxtUi2/UBadge.json index 864cf6c9..a0d08b61 100644 --- a/src/ui/nuxtUi/nuxtUi2/UBadge.json +++ b/src/ui/nuxtUi/nuxtUi2/UBadge.json @@ -4,14 +4,14 @@ "events": [], "props": { "size": { - "type": [ + "type": "string", + "default": "config.default.size", + "value": [ "sm", "xs", "md", "lg" - ], - "default": "config.default.size", - "value": "" + ] }, "ui": { "type": "any", diff --git a/src/ui/nuxtUi/nuxtUi2/UButton.json b/src/ui/nuxtUi/nuxtUi2/UButton.json index 7e648ef5..f694cd3f 100644 --- a/src/ui/nuxtUi/nuxtUi2/UButton.json +++ b/src/ui/nuxtUi/nuxtUi2/UButton.json @@ -4,16 +4,16 @@ "events": [], "props": { "size": { - "type": [ + "type": "string", + "default": "config.default.size", + "value": [ "sm", "2xs", "xs", "md", "lg", "xl" - ], - "default": "config.default.size", - "value": "" + ] }, "ui": { "type": "any", diff --git a/src/ui/nuxtUi/nuxtUi2/UDropdown.json b/src/ui/nuxtUi/nuxtUi2/UDropdown.json index 266fcd6e..2ce162b7 100644 --- a/src/ui/nuxtUi/nuxtUi2/UDropdown.json +++ b/src/ui/nuxtUi/nuxtUi2/UDropdown.json @@ -9,12 +9,12 @@ "value": "" }, "mode": { - "type": [ + "type": "string", + "default": "\"click\"", + "value": [ "click", "hover" - ], - "default": "\"click\"", - "value": "" + ] }, "popper": { "type": "{}", diff --git a/src/ui/nuxtUi/nuxtUi2/UForm.json b/src/ui/nuxtUi/nuxtUi2/UForm.json index 0ea4cf59..86a4c6d9 100644 --- a/src/ui/nuxtUi/nuxtUi2/UForm.json +++ b/src/ui/nuxtUi/nuxtUi2/UForm.json @@ -10,12 +10,7 @@ "required": true }, "schema": { - "type": [ - "ZodType", - "ObjectSchema", - "AnySchema", - "ObjectSchemaAsync" - ], + "type": "ZodType | ObjectSchema | AnySchema | ObjectSchemaAsync", "default": "undefined", "value": "" }, @@ -27,7 +22,7 @@ "validateOn": { "type": "FormEventType[]", "default": "[\"blur\", \"input\", \"change\", \"submit\"]", - "value": "" + "value": ["blur", "input", "change", "submit"] } }, "link": "https://ui.nuxt.com/elements/form" diff --git a/src/ui/nuxtUi/nuxtUi2/UFormGroup.json b/src/ui/nuxtUi/nuxtUi2/UFormGroup.json index 397d30cf..b79960e7 100644 --- a/src/ui/nuxtUi/nuxtUi2/UFormGroup.json +++ b/src/ui/nuxtUi/nuxtUi2/UFormGroup.json @@ -9,16 +9,16 @@ "value": "" }, "size": { - "type": [ + "type": "string", + "default": "null", + "value": [ "sm", "2xs", "xs", "md", "lg", "xl" - ], - "default": "null", - "value": "" + ] }, "ui": { "type": "any", diff --git a/src/ui/nuxtUi/nuxtUi2/UInput.json b/src/ui/nuxtUi/nuxtUi2/UInput.json index 008425c8..74bc6a0f 100644 --- a/src/ui/nuxtUi/nuxtUi2/UInput.json +++ b/src/ui/nuxtUi/nuxtUi2/UInput.json @@ -9,16 +9,16 @@ "value": "" }, "size": { - "type": [ + "type": "string", + "default": "null", + "value": [ "sm", "2xs", "xs", "md", "lg", "xl" - ], - "default": "null", - "value": "" + ] }, "ui": { "type": "any", @@ -61,12 +61,12 @@ "value": "" }, "variant": { - "type": [ + "type": "string", + "default": "config.default.variant", + "value": [ "outline", "none" - ], - "default": "config.default.variant", - "value": "" + ] }, "autofocusDelay": { "type": "number", diff --git a/src/ui/nuxtUi/nuxtUi2/UKbd.json b/src/ui/nuxtUi/nuxtUi2/UKbd.json index 5a829d5e..c6e9b9bb 100644 --- a/src/ui/nuxtUi/nuxtUi2/UKbd.json +++ b/src/ui/nuxtUi/nuxtUi2/UKbd.json @@ -9,13 +9,13 @@ "value": "" }, "size": { - "type": [ + "type": "string", + "default": "config.default.size", + "value": [ "sm", "xs", "md" - ], - "default": "config.default.size", - "value": "" + ] }, "ui": { "type": "any", diff --git a/src/ui/nuxtUi/nuxtUi2/UPagination.json b/src/ui/nuxtUi/nuxtUi2/UPagination.json index 55c98e29..9222428a 100644 --- a/src/ui/nuxtUi/nuxtUi2/UPagination.json +++ b/src/ui/nuxtUi/nuxtUi2/UPagination.json @@ -16,16 +16,16 @@ "required": true }, "size": { - "type": [ + "type": "string", + "default": "config.default.size", + "value": [ "sm", "2xs", "xs", "md", "lg", "xl" - ], - "default": "config.default.size", - "value": "" + ] }, "ui": { "type": "any", diff --git a/src/ui/nuxtUi/nuxtUi2/UPopover.json b/src/ui/nuxtUi/nuxtUi2/UPopover.json index 557d2e76..f2a2c68f 100644 --- a/src/ui/nuxtUi/nuxtUi2/UPopover.json +++ b/src/ui/nuxtUi/nuxtUi2/UPopover.json @@ -9,12 +9,12 @@ "value": "" }, "mode": { - "type": [ + "type": "string", + "default": "\"click\"", + "value": [ "click", "hover" - ], - "default": "\"click\"", - "value": "" + ] }, "popper": { "type": "{}", diff --git a/src/ui/nuxtUi/nuxtUi2/URange.json b/src/ui/nuxtUi/nuxtUi2/URange.json index 670f29f5..b936b06b 100644 --- a/src/ui/nuxtUi/nuxtUi2/URange.json +++ b/src/ui/nuxtUi/nuxtUi2/URange.json @@ -9,13 +9,13 @@ "value": "" }, "size": { - "type": [ + "type": "string", + "default": "null", + "value": [ "sm", "md", "lg" - ], - "default": "null", - "value": "" + ] }, "ui": { "type": "any", diff --git a/src/ui/nuxtUi/nuxtUi2/USelect.json b/src/ui/nuxtUi/nuxtUi2/USelect.json index ca642321..0df7b653 100644 --- a/src/ui/nuxtUi/nuxtUi2/USelect.json +++ b/src/ui/nuxtUi/nuxtUi2/USelect.json @@ -9,16 +9,16 @@ "value": "" }, "size": { - "type": [ + "type": "string", + "default": "null", + "value": [ "sm", "2xs", "xs", "md", "lg", "xl" - ], - "default": "null", - "value": "" + ] }, "ui": { "type": "any", @@ -56,12 +56,12 @@ "value": "" }, "variant": { - "type": [ + "type": "string", + "default": "config.default.variant", + "value": [ "outline", "none" - ], - "default": "config.default.variant", - "value": "" + ] }, "loadingIcon": { "type": "string", diff --git a/src/ui/nuxtUi/nuxtUi2/USelectMenu.json b/src/ui/nuxtUi/nuxtUi2/USelectMenu.json index 6b37b933..8d7f0050 100644 --- a/src/ui/nuxtUi/nuxtUi2/USelectMenu.json +++ b/src/ui/nuxtUi/nuxtUi2/USelectMenu.json @@ -9,16 +9,16 @@ "value": "" }, "size": { - "type": [ + "type": "string", + "default": "null", + "value": [ "sm", "2xs", "xs", "md", "lg", "xl" - ], - "default": "null", - "value": "" + ] }, "ui": { "type": "any", diff --git a/src/ui/nuxtUi/nuxtUi2/USkeleton.json b/src/ui/nuxtUi/nuxtUi2/USkeleton.json new file mode 100644 index 00000000..a814c91b --- /dev/null +++ b/src/ui/nuxtUi/nuxtUi2/USkeleton.json @@ -0,0 +1,13 @@ +{ + "name": "USkeleton", + "methods": [], + "events": [], + "props": { + "ui": { + "type": "any", + "default": "undefined", + "value": "" + } + }, + "link": "https://ui.nuxt.com/forms/skeleton" +} diff --git a/src/ui/nuxtUi/nuxtUi2/USlideover.json b/src/ui/nuxtUi/nuxtUi2/USlideover.json index 355a1bb2..0dd7816d 100644 --- a/src/ui/nuxtUi/nuxtUi2/USlideover.json +++ b/src/ui/nuxtUi/nuxtUi2/USlideover.json @@ -9,12 +9,12 @@ "value": "" }, "side": { - "type": [ + "type": "string", + "default": "\"right\"", + "value": [ "left", "right" - ], - "default": "\"right\"", - "value": "" + ] }, "transition": { "type": "boolean", diff --git a/src/ui/nuxtUi/nuxtUi2/UTable.json b/src/ui/nuxtUi/nuxtUi2/UTable.json index a5577515..39fc9ee9 100644 --- a/src/ui/nuxtUi/nuxtUi2/UTable.json +++ b/src/ui/nuxtUi/nuxtUi2/UTable.json @@ -4,10 +4,7 @@ "events": [], "props": { "sort": { - "type": [ - "{ column: string; direction: asc", - "desc; }" - ], + "type": "{ column: string; direction: \"asc\" | \"desc\"; }", "default": "{}", "value": "" }, diff --git a/src/ui/nuxtUi/nuxtUi2/UTabs.json b/src/ui/nuxtUi/nuxtUi2/UTabs.json index 89b73e9d..cce4e5f7 100644 --- a/src/ui/nuxtUi/nuxtUi2/UTabs.json +++ b/src/ui/nuxtUi/nuxtUi2/UTabs.json @@ -4,12 +4,12 @@ "events": [], "props": { "orientation": { - "type": [ + "type": "string", + "default": "\"horizontal\"", + "value": [ "horizontal", "vertical" - ], - "default": "\"horizontal\"", - "value": "" + ] }, "ui": { "type": "any", diff --git a/src/ui/nuxtUi/nuxtUi2/UTextarea.json b/src/ui/nuxtUi/nuxtUi2/UTextarea.json index 40bd13f3..845cb98d 100644 --- a/src/ui/nuxtUi/nuxtUi2/UTextarea.json +++ b/src/ui/nuxtUi/nuxtUi2/UTextarea.json @@ -9,16 +9,16 @@ "value": "" }, "size": { - "type": [ + "type": "string", + "default": "null", + "value": [ "sm", "2xs", "xs", "md", "lg", "xl" - ], - "default": "null", - "value": "" + ] }, "ui": { "type": "any", diff --git a/src/ui/nuxtUi/nuxtUi2/index.ts b/src/ui/nuxtUi/nuxtUi2/index.ts index 2a9fe44b..8d35edc6 100644 --- a/src/ui/nuxtUi/nuxtUi2/index.ts +++ b/src/ui/nuxtUi/nuxtUi2/index.ts @@ -31,6 +31,7 @@ import UContextMenu from './UContextMenu.json' import UNotification from './UNotification.json' import UCard from './UCard.json' import UContainer from './UContainer.json' +import USkeleton from './USkeleton.json' export function nuxtui2() { const map: any = [ @@ -65,6 +66,7 @@ export function nuxtui2() { UNotification, UCard, UContainer, + USkeleton, ] return propsReducer(map) @@ -232,7 +234,11 @@ export function nuxtui2Components() { UContainer.name, `<${UContainer.name}>`, ], - + [ + USkeleton.name, + USkeleton.name, + `<${USkeleton.name}>`, + ], ] return componentsReducer(map) } diff --git a/src/ui/utils.ts b/src/ui/utils.ts index cf8f6fba..be3d9ff7 100644 --- a/src/ui/utils.ts +++ b/src/ui/utils.ts @@ -104,7 +104,7 @@ export function propsReducer(map: string[], iconData?: { prefix: string; type: s content = `${key}="${v}"` snippet = `${key}="$\{1:${v}\}$2"` } - content += ` ${value.description}${value.default ? ` 默认:${value.default}` : ''}` + content += ` ${value.description || ''}${value.default ? ` 默认:${value.default}` : ''}` return createCompletionItem({ content, snippet, type, documentation, preselect: true, sortText: '0' }) },