Skip to content
This repository was archived by the owner on Jan 9, 2022. It is now read-only.

Commit eafc5ee

Browse files
committed
feat: split demo and lib src files
1 parent 417eff7 commit eafc5ee

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1191
-46
lines changed

demo/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
.DS_Store
3+
dist
4+
dist-ssr
5+
*.local

demo/README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Vue 3 + Typescript + Vite
2+
3+
This template should help get you started developing with Vue 3 and Typescript in Vite.
4+
5+
## Recommended IDE Setup
6+
7+
[VSCode](https://code.visualstudio.com/) + [Vetur](https://marketplace.visualstudio.com/items?itemName=octref.vetur). Make sure to enable `vetur.experimental.templateInterpolationService` in settings!
8+
9+
### If Using `<script setup>`
10+
11+
[`<script setup>`](https://github.com/vuejs/rfcs/pull/227) is a feature that is currently in RFC stage. To get proper IDE support for the syntax, use [Volar](https://marketplace.visualstudio.com/items?itemName=johnsoncodehk.volar) instead of Vetur (and disable Vetur).
12+
13+
## Type Support For `.vue` Imports in TS
14+
15+
Since TypeScript cannot handle type information for `.vue` imports, they are shimmed to be a generic Vue component type by default. In most cases this is fine if you don't really care about component prop types outside of templates. However, if you wish to get actual prop types in `.vue` imports (for example to get props validation when using manual `h(...)` calls), you can use the following:
16+
17+
### If Using Volar
18+
19+
Run `Volar: Switch TS Plugin on/off` from VSCode command palette.
20+
21+
### If Using Vetur
22+
23+
1. Install and add `@vuedx/typescript-plugin-vue` to the [plugins section](https://www.typescriptlang.org/tsconfig#plugins) in `tsconfig.json`
24+
2. Delete `src/shims-vue.d.ts` as it is no longer needed to provide module info to Typescript
25+
3. Open `src/main.ts` in VSCode
26+
4. Open the VSCode command palette
27+
5. Search and run "Select TypeScript version" -> "Use workspace version"
File renamed without changes.

demo/package.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "my-vue-app",
3+
"version": "0.0.0",
4+
"scripts": {
5+
"dev": "vite",
6+
"build": "vue-tsc --noEmit && vite build"
7+
},
8+
"dependencies": {
9+
"bootstrap-reboot": "^4.5.6",
10+
"vue": "^3.0.5"
11+
},
12+
"devDependencies": {
13+
"@vitejs/plugin-vue": "^1.3.0",
14+
"@vue/compiler-sfc": "^3.0.5",
15+
"typescript": "^4.3.2",
16+
"vite": "^2.4.4",
17+
"vue-tsc": "^0.2.2"
18+
}
19+
}
File renamed without changes.
File renamed without changes.

src/components/Dialogs/BaseDialog/BaseDialog.vue renamed to demo/src/components/Dialogs/BaseDialog/BaseDialog.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@
1515
</GDialog>
1616
</template>
1717

18-
<script>
19-
import { ref } from 'vue'
20-
import { GDialog } from '@/gitart-vue-dialog'
18+
<script lang="ts">
19+
import { ref, defineComponent } from 'vue'
20+
import { GDialog } from 'plugin/index.js'
2121
2222
import { useModelWrapper } from '@/composables/modelWrapper'
2323
2424
import BooleanSwitch from '@/components/PropControls/BooleanSwitch/BooleanSwitch.vue'
2525
26-
export default {
26+
export default defineComponent({
2727
name: 'BaseDialog',
2828
components: {
2929
GDialog,
@@ -46,5 +46,5 @@ export default {
4646
value,
4747
}
4848
},
49-
}
49+
})
5050
</script>

src/components/Dialogs/BaseDialog/BaseDialogWrapper.vue renamed to demo/src/components/Dialogs/BaseDialog/BaseDialogWrapper.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
<template>
22
<BaseDialog v-model="model" />
3-
43
<button @click="open">
54
BaseDialog
65
</button>
76
</template>
87

9-
<script>
8+
<script lang="ts">
109
import { ref } from 'vue'
1110
import BaseDialog from './BaseDialog.vue'
1211

0 commit comments

Comments
 (0)