From 5b376b0207597625c317b8e89c29ea699e55205e Mon Sep 17 00:00:00 2001 From: CRBroughton Date: Thu, 18 Nov 2021 19:39:53 +0000 Subject: [PATCH 01/29] removed vetur as dep --- package.json | 7 ------- 1 file changed, 7 deletions(-) diff --git a/package.json b/package.json index 4f05606..62207a3 100644 --- a/package.json +++ b/package.json @@ -23,9 +23,6 @@ "Composition API", "Vue Snippets" ], - "extensionDependencies": [ - "octref.vetur" - ], "categories": [ "Snippets" ], @@ -43,10 +40,6 @@ "language": "html", "path": "./snippets/vue-template.json" }, - { - "language": "vue-html", - "path": "./snippets/vue-template.json" - }, { "language": "javascript", "path": "./snippets/vue-script.json" From 00cd321566d416ef297d53f895bec4d444f3ac4d Mon Sep 17 00:00:00 2001 From: CRBroughton Date: Thu, 18 Nov 2021 19:59:17 +0000 Subject: [PATCH 02/29] removed volar section --- README.md | 7 ------- 1 file changed, 7 deletions(-) diff --git a/README.md b/README.md index baaad3f..c929e42 100644 --- a/README.md +++ b/README.md @@ -28,13 +28,6 @@ ext install Vue VSCode Snippets You can enable tab completion (recommended) by opening `Code > Preferences > Settings` (on a Mac) and applying `"editor.tabCompletion": "onlySnippets"` to your personal settings -### Volar Usage - -This extension works out of the box with Vetur, but if you would rather use Volar, either remove `extensionDependencies` or set it to `volar` instead of `vetur`. You can find this file in the extensions package.json (with [versionnumber] replaced with the current installed version, i.e. 2.2.1): - -- Mac: `~/.vscode/extensions/sdras.vue-vscode-snippets-[versionnumber]/package.json` -- Windows: `C:\Users\\.vscode\extensions\sdras.vue-vscode-snippets-[versionnumber]` - ## Snippets ### Vue From 289173b7a2ac7dca2ce1012a6cf750b747c05a49 Mon Sep 17 00:00:00 2001 From: CRBroughton Date: Thu, 18 Nov 2021 20:00:20 +0000 Subject: [PATCH 03/29] removed yarn.lock --- yarn.lock | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 yarn.lock diff --git a/yarn.lock b/yarn.lock deleted file mode 100644 index fb57ccd..0000000 --- a/yarn.lock +++ /dev/null @@ -1,4 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - From 9c3f534510f1472b091a04af35743e4826ada8b1 Mon Sep 17 00:00:00 2001 From: CRBroughton Date: Thu, 18 Nov 2021 21:36:10 +0000 Subject: [PATCH 04/29] added pinia.json --- package.json | 4 ++++ snippets/pinia.json | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 snippets/pinia.json diff --git a/package.json b/package.json index 62207a3..ef95fd3 100644 --- a/package.json +++ b/package.json @@ -75,6 +75,10 @@ { "language": "typescript", "path": "./snippets/nuxt-config.json" + }, + { + "language": "typescript", + "path": "./snippets/pinia.json" } ] } diff --git a/snippets/pinia.json b/snippets/pinia.json new file mode 100644 index 0000000..c870a91 --- /dev/null +++ b/snippets/pinia.json @@ -0,0 +1,20 @@ +{ + "Pinia Store": { + "prefix": "pstore", + "body": [ + "import { defineStore } from 'pinia'", + "", + "export const useCounterStore = defineStore('counter', {", + "\tstate: () => {", + "\t\treturn { count: 0 }", + "\t},", + "\tactions: {", + "\t\tincrement() {", + "\t\t\tthis.count++", + "\t\t},", + "\t},", + "})" + ], + "description": "Basic Pinia Store" + } +} \ No newline at end of file From 6799af485e8f2614d73b97fcfa362a3620bc87cd Mon Sep 17 00:00:00 2001 From: CRBroughton Date: Fri, 19 Nov 2021 07:19:32 +0000 Subject: [PATCH 05/29] added state refs and patching --- snippets/pinia.json | 66 ++++++++++++++++++++++++++++++++------------- 1 file changed, 48 insertions(+), 18 deletions(-) diff --git a/snippets/pinia.json b/snippets/pinia.json index c870a91..eabf7f4 100644 --- a/snippets/pinia.json +++ b/snippets/pinia.json @@ -1,20 +1,50 @@ { - "Pinia Store": { - "prefix": "pstore", - "body": [ - "import { defineStore } from 'pinia'", - "", - "export const useCounterStore = defineStore('counter', {", - "\tstate: () => {", - "\t\treturn { count: 0 }", - "\t},", - "\tactions: {", - "\t\tincrement() {", - "\t\t\tthis.count++", - "\t\t},", - "\t},", - "})" - ], - "description": "Basic Pinia Store" - } + "Pinia Store": { + "prefix": "pstore", + "body": [ + "import { defineStore } from 'pinia'", + "", + "export const useCounterStore = defineStore('counter', {", + "\tstate: () => {", + "\t\treturn { count: 0 }", + "\t},", + "\tactions: {", + "\t\tincrement() {", + "\t\t\tthis.count++", + "\t\t},", + "\t},", + "})" + ], + "description": "Basic Pinia Store" + }, + "Pinia Store State Refs": { + "prefix": "pstorestaterefs", + "body": [ + "import { useCounterStore } from '@/store/main'", + "", + "const store = useCounterStore()", + "const { count } = storeToRefs(store)", + "// You can access destructured state like so: store.counter++" + ], + "description": "Destructure Pinia State" + }, + "Pinia Store Patch": { + "prefix": "pstorepatch", + "body": [ + "store.$patch({", + "\tcount: store.count++", + "})" + ], + "description": "Pinia Store Patch" + }, + "Pinia Store Patch Function": { + "prefix": "pstorepatchfunction", + "body": [ + "store.$patch((state) => {", + "\tstate.items.push({ name: 'shoes', quantity: 1 })", + "\tstate.hasChanged = true", + "})" + ], + "description": "Pinia Store Patch Function" + } } \ No newline at end of file From ac7a3e6ea25ed33adbcfcdab34c1296daa319005 Mon Sep 17 00:00:00 2001 From: CRBroughton Date: Fri, 19 Nov 2021 07:24:26 +0000 Subject: [PATCH 06/29] updated pinia.json prefixes --- snippets/pinia.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snippets/pinia.json b/snippets/pinia.json index eabf7f4..aaa3c35 100644 --- a/snippets/pinia.json +++ b/snippets/pinia.json @@ -29,7 +29,7 @@ "description": "Destructure Pinia State" }, "Pinia Store Patch": { - "prefix": "pstorepatch", + "prefix": "ppatch", "body": [ "store.$patch({", "\tcount: store.count++", @@ -38,7 +38,7 @@ "description": "Pinia Store Patch" }, "Pinia Store Patch Function": { - "prefix": "pstorepatchfunction", + "prefix": "ppatchf", "body": [ "store.$patch((state) => {", "\tstate.items.push({ name: 'shoes', quantity: 1 })", From 491524098520a7f6eeef2e8d8a10b6902f8f2fe7 Mon Sep 17 00:00:00 2001 From: CRBroughton Date: Fri, 19 Nov 2021 07:24:45 +0000 Subject: [PATCH 07/29] added pinia table to README.md --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index c929e42..cd8f669 100644 --- a/README.md +++ b/README.md @@ -141,6 +141,15 @@ You can enable tab completion (recommended) by opening `Code > Preferences > Set | `vstore-import` | Import vuex store into main.js | | `vstore2` | Updated Base for Vuex store | +### Pinia + +| Snippet | Purpose | +| --------------- | ------------------------------ | +| `pstore` | Base for Pinia store.ts | +| `pstateref` | Vuex Getter | +| `ppatch` | Pinia Patch | +| `ppatchf` | Pinia Patch Function | + ### Vue Router | Snippet | Purpose | From 47e4f8635dc5eab60338b2156fcd6bfe062c8d9f Mon Sep 17 00:00:00 2001 From: CRBroughton Date: Fri, 19 Nov 2021 07:33:51 +0000 Subject: [PATCH 08/29] updated keywords --- package.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/package.json b/package.json index ef95fd3..b41975b 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,8 @@ "Vue 3", "Vue 2", "Composition API", + "Vuex", + "Pinia", "Vue Snippets" ], "categories": [ From be6d32ea433aef038eff1e16a9df83a7f9a80960 Mon Sep 17 00:00:00 2001 From: CRBroughton Date: Fri, 19 Nov 2021 07:36:20 +0000 Subject: [PATCH 09/29] fixed pstateref description --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cd8f669..96a732f 100644 --- a/README.md +++ b/README.md @@ -146,7 +146,7 @@ You can enable tab completion (recommended) by opening `Code > Preferences > Set | Snippet | Purpose | | --------------- | ------------------------------ | | `pstore` | Base for Pinia store.ts | -| `pstateref` | Vuex Getter | +| `pstateref` | Access Pinia State | | `ppatch` | Pinia Patch | | `ppatchf` | Pinia Patch Function | From c28d07b8124971666ed2911402a2beeb692c220c Mon Sep 17 00:00:00 2001 From: CRBroughton Date: Fri, 19 Nov 2021 08:42:56 +0000 Subject: [PATCH 10/29] pinia state refs prefix changed --- snippets/pinia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/pinia.json b/snippets/pinia.json index aaa3c35..0c0218b 100644 --- a/snippets/pinia.json +++ b/snippets/pinia.json @@ -18,7 +18,7 @@ "description": "Basic Pinia Store" }, "Pinia Store State Refs": { - "prefix": "pstorestaterefs", + "prefix": "pstateref", "body": [ "import { useCounterStore } from '@/store/main'", "", From 048af80f0a3609316d534858c7f5e446e962c906 Mon Sep 17 00:00:00 2001 From: CRBroughton Date: Sun, 20 Feb 2022 15:39:46 +0000 Subject: [PATCH 11/29] added store import command --- snippets/pinia.json | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/snippets/pinia.json b/snippets/pinia.json index 0c0218b..780ef15 100644 --- a/snippets/pinia.json +++ b/snippets/pinia.json @@ -46,5 +46,12 @@ "})" ], "description": "Pinia Store Patch Function" + }, + "Pinia Import Store": { + "prefix": "pstore-import", + "body": [ + "import { useCounterStore } from '@/store/main'" + ], + "description": "Import a Pinia store" } } \ No newline at end of file From 4ea188082a1af7cdc20063308dfed61e4c536751 Mon Sep 17 00:00:00 2001 From: CRBroughton Date: Sun, 20 Feb 2022 15:48:57 +0000 Subject: [PATCH 12/29] Revert "removed yarn.lock" This reverts commit 289173b7a2ac7dca2ce1012a6cf750b747c05a49. --- yarn.lock | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 yarn.lock diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 0000000..fb57ccd --- /dev/null +++ b/yarn.lock @@ -0,0 +1,4 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + From ef3aca8504b2ff4f61123de65f76cd2c71aa9e06 Mon Sep 17 00:00:00 2001 From: CRBroughton Date: Sun, 20 Feb 2022 15:52:00 +0000 Subject: [PATCH 13/29] added vue-html --- package.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/package.json b/package.json index 2066fb6..b0b05c1 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,10 @@ "language": "html", "path": "./snippets/vue-template.json" }, + { + "language": "vue-html", + "path": "./snippets/vue-template.json" + }, { "language": "javascript", "path": "./snippets/vue-script.json" From 1d385bed6c5acf6b00d2dc1e2100cbd0e7e81b07 Mon Sep 17 00:00:00 2001 From: CRBroughton Date: Sun, 20 Feb 2022 18:53:44 +0000 Subject: [PATCH 14/29] moved composition API scripts to the top --- snippets/vue.json | 58 +++++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/snippets/vue.json b/snippets/vue.json index 578866c..d7c3e61 100644 --- a/snippets/vue.json +++ b/snippets/vue.json @@ -168,12 +168,6 @@ "Vue Single File Component Composition API": { "prefix": "vbase-3", "body": [ - "", - "", "", "", - "" ], @@ -193,17 +193,17 @@ "Vue Single File Component Setup Composition API": { "prefix": "vbase-3-setup", "body": [ + "", + "", "", "", - "", - "", - "" ], @@ -212,12 +212,6 @@ "Vue Single File Component Composition API Reactive": { "prefix": "vbase-3-reactive", "body": [ - "", - "", "", "", - "" ], @@ -243,12 +243,6 @@ "Vue Single File Component Composition API with Typescript": { "prefix": "vbase-3-ts", "body": [ - "", - "", "", "", + "", + "", "" @@ -269,16 +269,16 @@ "Vue Single File Component Setup Composition API with Typescript": { "prefix": "vbase-3-ts-setup", "body": [ + "", + "", "", "", - "", - "", "" From d28fa47841fa83d8e5a642abd3a17a37f09da4ed Mon Sep 17 00:00:00 2001 From: CRBroughton Date: Sun, 20 Feb 2022 21:17:49 +0000 Subject: [PATCH 15/29] added defineProps script snippet --- snippets/vue-script.json | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/snippets/vue-script.json b/snippets/vue-script.json index 2abfffe..764a33c 100644 --- a/snippets/vue-script.json +++ b/snippets/vue-script.json @@ -304,6 +304,19 @@ ], "description": "vue.config.js" }, + "Vue Composition API - defineProps with Interface": { + "prefix": "vdefineprops", + "body": [ + "interface Props {", + "\t${1:msg: string}", + "}", + "\t", + "// For default values for your props, use :", + "// withDefaults(defineProps(), { msg: 'myDefaultValue' })}", + "defineProps()" + ], + "description": "Vue Composition api - defineProps with Interface" + }, "Vue Composition API - Reactive": { "prefix": "v3reactive", "body": ["const ${1:name} = reactive({", "\t${2:count}: ${3:0}", "})"], From 6f7bd6952cecefd3d703c0f87a07f589168e90a8 Mon Sep 17 00:00:00 2001 From: CRBroughton Date: Sun, 20 Feb 2022 21:18:05 +0000 Subject: [PATCH 16/29] updated README.md with vdefineprops --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index bd162df..90c30bc 100644 --- a/README.md +++ b/README.md @@ -113,6 +113,7 @@ You can enable tab completion (recommended) by opening `Code > Preferences > Set | Snippet | Purpose | | ------------------- | ----------------------------------------------------- | +| `vdefineprops` | Vue Composition API - defineProps with Interface | | `v3reactive` | Vue Composition API - reactive | | `v3reactive-setup` | Vue Composition API - reactive with setup boilerplate | | `v3computed` | Vue Composition API - computed | From 448c0975886b9835f2a2c32b26eb9668a240d347 Mon Sep 17 00:00:00 2001 From: CRBroughton Date: Fri, 4 Mar 2022 21:44:10 +0000 Subject: [PATCH 17/29] added vdefineemits --- README.md | 1 + snippets/vue-script.json | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 90c30bc..ba1a99a 100644 --- a/README.md +++ b/README.md @@ -114,6 +114,7 @@ You can enable tab completion (recommended) by opening `Code > Preferences > Set | Snippet | Purpose | | ------------------- | ----------------------------------------------------- | | `vdefineprops` | Vue Composition API - defineProps with Interface | +| `vdefineemits` | Vue Composition API - defineEmits with Interface | | `v3reactive` | Vue Composition API - reactive | | `v3reactive-setup` | Vue Composition API - reactive with setup boilerplate | | `v3computed` | Vue Composition API - computed | diff --git a/snippets/vue-script.json b/snippets/vue-script.json index 764a33c..44584f1 100644 --- a/snippets/vue-script.json +++ b/snippets/vue-script.json @@ -310,13 +310,25 @@ "interface Props {", "\t${1:msg: string}", "}", - "\t", + "", "// For default values for your props, use :", "// withDefaults(defineProps(), { msg: 'myDefaultValue' })}", "defineProps()" ], "description": "Vue Composition api - defineProps with Interface" }, + "Vue Composition API - defineEmits with Interface": { + "prefix": "vdefineemits", + "body": [ + "interface Emits {", + "\t$(e: 'change', id: number): void", + "\t$(e: 'update', value: string): void", + "}", + "", + "defineEmits()" + ], + "description": "Vue Composition api - defineEmits with Interface" + }, "Vue Composition API - Reactive": { "prefix": "v3reactive", "body": ["const ${1:name} = reactive({", "\t${2:count}: ${3:0}", "})"], From 08dcf84d1c8cc60bd9a70c2c2a6b0dd5448a680b Mon Sep 17 00:00:00 2001 From: CRBroughton Date: Mon, 7 Mar 2022 18:25:29 +0000 Subject: [PATCH 18/29] modified functions to match examples --- snippets/vue-script.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/snippets/vue-script.json b/snippets/vue-script.json index 44584f1..79497c4 100644 --- a/snippets/vue-script.json +++ b/snippets/vue-script.json @@ -313,7 +313,7 @@ "", "// For default values for your props, use :", "// withDefaults(defineProps(), { msg: 'myDefaultValue' })}", - "defineProps()" + "const props = defineProps()" ], "description": "Vue Composition api - defineProps with Interface" }, @@ -321,11 +321,11 @@ "prefix": "vdefineemits", "body": [ "interface Emits {", - "\t$(e: 'change', id: number): void", - "\t$(e: 'update', value: string): void", + "\t(e: 'change', id: number): void", + "\t(e: 'update', value: string): void", "}", "", - "defineEmits()" + "const emit = defineEmits()" ], "description": "Vue Composition api - defineEmits with Interface" }, From 02d12e430560238241017f3cb041f3aeeecf7327 Mon Sep 17 00:00:00 2001 From: CRBroughton Date: Mon, 7 Mar 2022 18:30:11 +0000 Subject: [PATCH 19/29] changed prefixes simplified the required prefixes to match the Vue2 prefixes --- snippets/vue-script.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snippets/vue-script.json b/snippets/vue-script.json index 79497c4..dc79d17 100644 --- a/snippets/vue-script.json +++ b/snippets/vue-script.json @@ -305,7 +305,7 @@ "description": "vue.config.js" }, "Vue Composition API - defineProps with Interface": { - "prefix": "vdefineprops", + "prefix": "v3props", "body": [ "interface Props {", "\t${1:msg: string}", @@ -318,7 +318,7 @@ "description": "Vue Composition api - defineProps with Interface" }, "Vue Composition API - defineEmits with Interface": { - "prefix": "vdefineemits", + "prefix": "v3emits", "body": [ "interface Emits {", "\t(e: 'change', id: number): void", From 1d8ac0ace2779e6d0f0ec3e4c5909a942033fca4 Mon Sep 17 00:00:00 2001 From: CRBroughton Date: Tue, 8 Mar 2022 18:46:21 +0000 Subject: [PATCH 20/29] added computed getter setter --- snippets/vue-script.json | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/snippets/vue-script.json b/snippets/vue-script.json index dc79d17..ef8edb4 100644 --- a/snippets/vue-script.json +++ b/snippets/vue-script.json @@ -339,6 +339,23 @@ "body": ["const ${1:name} = computed(() => {", "\treturn ${2}", "})"], "description": "Vue Composition api - computed" }, + "Vue Composition API - Computed Get / Set": { + "prefix": "v3computedgetset", + "body": [ + "const props = defineProps(['modelValue'])", + "const emit = defineEmits(['update:modelValue'])", + "", + "const value = computed({", + "\tget() {", + "\t\treturn props.modelValue", + "\t},", + "\tset(value: string) {", + "\t\temit('update:modelValue', value)", + "\t}", + "})" + ], + "description": "Vue Composition api - computed get / set" + }, "Vue Composition API - watch - single source": { "prefix": "v3watch", "body": ["watch(() => ${1:foo}, (newValue, oldValue) => {", "\t${2}", "})"], From 3a7cd0fb72231426b6ba304ad7e72fbbc0386199 Mon Sep 17 00:00:00 2001 From: CRBroughton Date: Tue, 8 Mar 2022 18:47:18 +0000 Subject: [PATCH 21/29] added computed get / set to README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index ba1a99a..dda1be8 100644 --- a/README.md +++ b/README.md @@ -118,6 +118,7 @@ You can enable tab completion (recommended) by opening `Code > Preferences > Set | `v3reactive` | Vue Composition API - reactive | | `v3reactive-setup` | Vue Composition API - reactive with setup boilerplate | | `v3computed` | Vue Composition API - computed | +| `v3computedgetset` | Vue Composition API - computed get / set | | `v3watch` | Vue Composition API - watcher single source | | `v3watch-array` | Vue Composition API - watch as array | | `v3watcheffect` | Vue Composition API - watchEffect | From 5520b7553e755e4baaac049634a69e9951e239a3 Mon Sep 17 00:00:00 2001 From: CRBroughton Date: Mon, 30 May 2022 18:35:57 +0100 Subject: [PATCH 22/29] add v3store command for composition store --- README.md | 5 +++-- snippets/vue-script.json | 21 +++++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index dda1be8..bb22dbe 100644 --- a/README.md +++ b/README.md @@ -113,8 +113,9 @@ You can enable tab completion (recommended) by opening `Code > Preferences > Set | Snippet | Purpose | | ------------------- | ----------------------------------------------------- | -| `vdefineprops` | Vue Composition API - defineProps with Interface | -| `vdefineemits` | Vue Composition API - defineEmits with Interface | +| `v3props` | Vue Composition API - defineProps with Interface | +| `v3emits` | Vue Composition API - defineEmits with Interface | +| `v3store` | Vue Composition API - Store using Provide / Inject | | `v3reactive` | Vue Composition API - reactive | | `v3reactive-setup` | Vue Composition API - reactive with setup boilerplate | | `v3computed` | Vue Composition API - computed | diff --git a/snippets/vue-script.json b/snippets/vue-script.json index ef8edb4..8ebce00 100644 --- a/snippets/vue-script.json +++ b/snippets/vue-script.json @@ -329,6 +329,27 @@ ], "description": "Vue Composition api - defineEmits with Interface" }, + "Vue Composition API - Store using Provide / Inject": { + "prefix": "v3store", + "body": [ + "import { provide, inject, InjectionKey } from 'vue'", + "", + "const store = () => {}", + "", + "const storeKey: InjectionKey> = Symbol('composition-store')", + "", + "export const provideStore = () => {", + "\tconst state = store()", + "\tprovide(storeKey, state)", + "\treturn state", + "}", + "", + "export const useStore = () => {", + "\treturn inject(storeKey)", + "}" + ], + "description": "Vue Composition api - Store using Provide / Inject" + }, "Vue Composition API - Reactive": { "prefix": "v3reactive", "body": ["const ${1:name} = reactive({", "\t${2:count}: ${3:0}", "})"], From fc00f321dd02045f906965a6971972b9a5ac95b3 Mon Sep 17 00:00:00 2001 From: CRBroughton Date: Sun, 11 Jun 2023 11:28:58 +0100 Subject: [PATCH 23/29] update defineEmits to 3.3, add defineSlots, add generic component --- snippets/vue-script.json | 16 ++++++++++++++-- snippets/vue.json | 21 +++++++++++++++++++++ 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/snippets/vue-script.json b/snippets/vue-script.json index 8ebce00..0aa4695 100644 --- a/snippets/vue-script.json +++ b/snippets/vue-script.json @@ -321,14 +321,26 @@ "prefix": "v3emits", "body": [ "interface Emits {", - "\t(e: 'change', id: number): void", - "\t(e: 'update', value: string): void", + "\tfoo: [id: number]", + "\tbar: [name: string, ...rest: any[]]", "}", "", "const emit = defineEmits()" ], "description": "Vue Composition api - defineEmits with Interface" }, + "Vue Composition API - defineSlots with Interface": { + "prefix": "v3slots", + "body": [ + "interface Slots {", + "\tdefault?: (props: { msg: string }) => any", + "\titem?: (props: { id: number }) => any", + "}", + "", + "const slots = defineSlots()" + ], + "description": "Vue Composition api - defineEmits with Interface" + }, "Vue Composition API - Store using Provide / Inject": { "prefix": "v3store", "body": [ diff --git a/snippets/vue.json b/snippets/vue.json index d7c3e61..2607e12 100644 --- a/snippets/vue.json +++ b/snippets/vue.json @@ -285,6 +285,27 @@ ], "description": "Base for Vue File Setup Composition API - Typescript" }, + "Vue Single File Generic Component": { + "prefix": "vbase-3-generic", + "body": [ + "", + "", + "", + "" + ] + }, "Vue Single File Component with Class based Typescript format": { "prefix": "vbase-ts-class", "body": [ From c798e05e67e71b6644c9f408f5b859987baa3da0 Mon Sep 17 00:00:00 2001 From: CRBroughton Date: Sun, 11 Jun 2023 11:34:42 +0100 Subject: [PATCH 24/29] add spacing to generic component --- snippets/vue.json | 1 + 1 file changed, 1 insertion(+) diff --git a/snippets/vue.json b/snippets/vue.json index 2607e12..7068a76 100644 --- a/snippets/vue.json +++ b/snippets/vue.json @@ -295,6 +295,7 @@ "}>()", "", "", + "", "