From 64af63ef4322317e01da86e377ce537a954995e4 Mon Sep 17 00:00:00 2001 From: Mehmet Date: Fri, 18 Nov 2022 11:22:40 +0300 Subject: [PATCH] feat: volar support (#82) --- packages/anu-vue/package.json | 7 +++--- packages/anu-vue/tsconfig.json | 3 +++ packages/anu-vue/volar.d.ts | 24 +++++++++++++++++++ .../guide/getting-started/installation.md | 14 +++++++++++ 4 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 packages/anu-vue/volar.d.ts diff --git a/packages/anu-vue/package.json b/packages/anu-vue/package.json index 22a1e30f..c170df3f 100644 --- a/packages/anu-vue/package.json +++ b/packages/anu-vue/package.json @@ -32,9 +32,10 @@ "./dist/style.css": "./dist/style.css" }, "files": [ - "dist" + "dist", + "volar.d.ts" ], - "types": "dist/types", + "types": "./dist/types", "scripts": { "dev": "nr gen-comp-meta && vite build --watch", "gen-comp-meta": "na tsx ../../scripts/gen-component-meta.ts", @@ -67,4 +68,4 @@ "@vueuse/core": "^8.7.5", "vue-router": "4" } -} +} \ No newline at end of file diff --git a/packages/anu-vue/tsconfig.json b/packages/anu-vue/tsconfig.json index f4c5327d..19efccf4 100644 --- a/packages/anu-vue/tsconfig.json +++ b/packages/anu-vue/tsconfig.json @@ -19,6 +19,9 @@ "paths": { "@/*": [ "*" + ], + "anu-vue": [ + "./src" ] } }, diff --git a/packages/anu-vue/volar.d.ts b/packages/anu-vue/volar.d.ts new file mode 100644 index 00000000..48965da5 --- /dev/null +++ b/packages/anu-vue/volar.d.ts @@ -0,0 +1,24 @@ +declare module 'vue' { + export interface GlobalComponents { + AAlert: typeof import('anu-vue')['AAlert'] + AAvatar: typeof import('anu-vue')['AAvatar'] + ABadge: typeof import('anu-vue')['ABadge'] + ABaseInput: typeof import('anu-vue')['ABaseInput'] + ABtn: typeof import('anu-vue')['ABtn'] + ACard: typeof import('anu-vue')['ACard'] + ACheckbox: typeof import('anu-vue')['ACheckbox'] + AChip: typeof import('anu-vue')['AChip'] + ADialog: typeof import('anu-vue')['ADialog'] + ADrawer: typeof import('anu-vue')['ADrawer'] + AInput: typeof import('anu-vue')['AInput'] + AList: typeof import('anu-vue')['AList'] + AMenu: typeof import('anu-vue')['AMenu'] + ARadio: typeof import('anu-vue')['ARadio'] + ASelect: typeof import('anu-vue')['ASelect'] + ASwitch: typeof import('anu-vue')['ASwitch'] + ATable: typeof import('anu-vue')['ATable'] + ATextarea: typeof import('anu-vue')['ATextarea'] + ATypography: typeof import('anu-vue')['ATypography'] + } + } + export { } diff --git a/packages/documentation/docs/guide/getting-started/installation.md b/packages/documentation/docs/guide/getting-started/installation.md index 7b8d8e06..a8c277b6 100644 --- a/packages/documentation/docs/guide/getting-started/installation.md +++ b/packages/documentation/docs/guide/getting-started/installation.md @@ -88,6 +88,20 @@ It's done! 🥳 + +## Volar Support +If you are using Volar, you can specify global component types by configuring compilerOptions.types in tsconfig.json. + +// tsconfig.json +```json +{ + "compilerOptions": { + // ... + "types": ["anu-vue/volar"] + } +} +``` + Now, Just refer to the component in your vue files: ```vue