diff --git a/CHANGELOG.md b/CHANGELOG.md index 74a5bfb..2f1aca1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,15 @@ All notable changes to the "vue3-vscode-snippets" extension will be documented in this file. +## `v0.2.0` + +### Features + +* Add more `Nuxt` snippets @ExEr7um in +* Add `Pinia` composition store snippets by @ExEr7um in +* Add `Histoire` snippets by @ExEr7um in +* Add `Vue Transition CSS` snippets by @ExEr7um in + ## `v0.1.1` ### Fixed diff --git a/README.md b/README.md index e4a57f5..700e9e7 100644 --- a/README.md +++ b/README.md @@ -79,11 +79,23 @@ These snippets were made to speed up Vue 3 development. With it you can write bo | `vsingleemit` | Single emit for defineEmits | | `vsingleemit-nopayload` | Single emit for defineEmits with no payload | +### CSS + +| Snippet | Purpose | +| -------------------------------- | -------------------------------------------- | +| `vcss-transition` | Vue Transition styles | +| `vcss-transition-named` | Vue Named Transition styles | +| `vcss-transition-tailwind` | Vue Transition styles for Tailwind CSS | +| `vcss-transition-named-tailwind` | Vue Named Transition styles for Tailwind CSS | +| `vcss-transition-group` | Vue Transition Group styles | +| `vcss-transition-group-tailwind` | Vue Transition Group styles for Tailwind CSS | + ### Pinia -| Snippet | Purpose | -| -------- | --------------------------------------- | -| `pstore` | Base code needed for a Pinia store file | +| Snippet | Purpose | +| -------------------- | ------------------------------------------------------------ | +| `pstore` | Base code needed for a Pinia store file | +| `pstore-composition` | Base code needed for a Pinia store file with Composition API | ### Vue Router @@ -119,6 +131,28 @@ These snippets were made to speed up Vue 3 development. With it you can write bo | `nhead-template` | `useHead` composable with title template | | `npagemeta` | `definePageMeta` composable | | `npagemeta-description` | `definePageMeta` composable with description | +| `nplugin` | Base code for Nuxt plugin | +| `nmiddleware` | Base code for Nuxt middleware | +| `nserverroute` | Base code for Nuxt server route | + +### Histoire + +| Snippet | Purpose | +| ----------------------- | ------------------------------------ | +| `hconfig` | Histoire config for Vue 3 | +| `hconfig-nuxt` | Histoire config for Nuxt 3 | +| `hbase` | Base code for story | +| `hbase-variant` | Base code for story with variant | +| `hbase-grid` | Base code for story with grid layout | +| `hvariant` | Story variant | +| `hgrid` | Histoire grid layout | +| `hcontrols-base` | Histoire controls base | +| `hcontrols-button` | Histoire controls - Button | +| `hcontrols-buttongroup` | Histoire controls - Button Group | +| `hcontrols-checkbox` | Histoire controls - Checkbox | +| `hcontrols-number` | Histoire controls - Number | +| `hcontrols-text` | Histoire controls - Text | +| `hcontrols-textarea` | Histoire controls - Textarea | ## Contributing diff --git a/package.json b/package.json index 5a75aac..2e43a9a 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "displayName": "Vue 3 VS Code Snippets", "description": "Vue 3 snippets for VS Code", "icon": "images/vue-logo.png", - "version": "0.1.1", + "version": "0.2.0", "publisher": "exer7um", "repository": { "type": "git", @@ -49,47 +49,75 @@ "snippets": [ { "language": "vue", - "path": "./snippets/vue.code-snippets" + "path": "./snippets/vue/vue.code-snippets" }, { "language": "html", - "path": "./snippets/vue-template.code-snippets" + "path": "./snippets/vue/vue-template.code-snippets" }, { "language": "javascript", - "path": "./snippets/vue-script.code-snippets" + "path": "./snippets/vue/vue-script.code-snippets" }, { "language": "typescript", - "path": "./snippets/vue-script.code-snippets" + "path": "./snippets/vue/vue-script.code-snippets" }, { "language": "javascript", - "path": "./snippets/pinia.code-snippets" + "path": "./snippets/vue/vue-router.code-snippets" }, { "language": "typescript", - "path": "./snippets/pinia.code-snippets" + "path": "./snippets/vue/vue-router.code-snippets" + }, + { + "language": "css", + "path": "./snippets/vue/vue-css.code-snippets" + }, + { + "language": "scss", + "path": "./snippets/vue/vue-css.code-snippets" + }, + { + "language": "less", + "path": "./snippets/vue/vue-css.code-snippets" + }, + { + "language": "javascript", + "path": "./snippets/pinia/pinia.code-snippets" + }, + { + "language": "typescript", + "path": "./snippets/pinia/pinia.code-snippets" + }, + { + "language": "html", + "path": "./snippets/nuxt/nuxt-template.code-snippets" }, { "language": "javascript", - "path": "./snippets/vue-router.code-snippets" + "path": "./snippets/nuxt/nuxt-script.code-snippets" }, { "language": "typescript", - "path": "./snippets/vue-router.code-snippets" + "path": "./snippets/nuxt/nuxt-script.code-snippets" + }, + { + "language": "vue", + "path": "./snippets/histoire/histoire.code-snippets" }, { "language": "html", - "path": "./snippets/nuxt-template.code-snippets" + "path": "./snippets/histoire/histoire-template.code-snippets" }, { "language": "javascript", - "path": "./snippets/nuxt-script.code-snippets" + "path": "./snippets/histoire/histoire-script.code-snippets" }, { "language": "typescript", - "path": "./snippets/nuxt-script.code-snippets" + "path": "./snippets/histoire/histoire-script.code-snippets" } ] } diff --git a/snippets/histoire/histoire-script.code-snippets b/snippets/histoire/histoire-script.code-snippets new file mode 100644 index 0000000..676d11c --- /dev/null +++ b/snippets/histoire/histoire-script.code-snippets @@ -0,0 +1,32 @@ +{ + "Histoire config": { + "prefix": "hconfig", + "body": [ + "import { defineConfig } from 'histoire'", + "import { HstVue } from '@histoire/plugin-vue'", + "", + "export default defineConfig({", + "\tplugins: [", + "\t\tHstVue(),", + "\t],", + "})" + ], + "description": "Histoire config for Vue 3" + }, + "Histoire config - Nuxt": { + "prefix": "hconfig-nuxt", + "body": [ + "import { defineConfig } from 'histoire'", + "import { HstVue } from '@histoire/plugin-vue'", + "import { HstNuxt } from '@histoire/plugin-nuxt'", + "", + "export default defineConfig({", + "\tplugins: [", + "\t\tHstVue(),", + "\t\tHstNuxt(),", + "\t],", + "})" + ], + "description": "Histoire config for Nuxt 3" + }, +} diff --git a/snippets/histoire/histoire-template.code-snippets b/snippets/histoire/histoire-template.code-snippets new file mode 100644 index 0000000..722496a --- /dev/null +++ b/snippets/histoire/histoire-template.code-snippets @@ -0,0 +1,93 @@ +{ + "Histoire story variant": { + "prefix": "hvariant", + "body": [ + "", + "\t$0", + "", + ], + "description": "Story variant" + }, + "Histoire grid layout": { + "prefix": "hgrid", + "body": [ + ":layout='{ type: 'grid', width: ${1:gridWidth} }'", + ], + "description": "Histoire grid layout" + }, + "Histoire controls": { + "prefix": "hcontrols-base", + "body": [ + "" + ], + "description": "Histoire controls base" + }, + "Histoire controls - Button": { + "prefix": "hcontrols-button", + "body": [ + "", + "\t$0", + "" + ], + "description": "Histoire controls - Button" + }, + "Histoire controls - Button Group": { + "prefix": "hcontrols-buttongroup", + "body": [ + "", + ], + "description": "Histoire controls - Button Group" + }, + "Histoire controls - Checkbox": { + "prefix": "hcontrols-checkbox", + "body": [ + "" + ], + "description": "Histoire controls - Checkbox" + }, + "Histoire controls - Number": { + "prefix": "hcontrols-number", + "body": [ + "" + ], + "description": "Histoire controls - Number" + }, + "Histoire controls - Text": { + "prefix": "hcontrols-text", + "body": [ + "" + ], + "description": "Histoire controls - Text" + }, + "Histoire controls - Textarea": { + "prefix": "hcontrols-textarea", + "body": [ + "" + ], + "description": "Histoire controls - Textarea" + }, +} diff --git a/snippets/histoire/histoire.code-snippets b/snippets/histoire/histoire.code-snippets new file mode 100644 index 0000000..8be2135 --- /dev/null +++ b/snippets/histoire/histoire.code-snippets @@ -0,0 +1,54 @@ +{ + "Histoire story base": { + "prefix": "hbase", + "body": [ + "", + "", + "", + ], + "description": "Base code for story" + }, + "Histoire story base with variant": { + "prefix": "hbase-variant", + "body": [ + "", + "", + "", + ], + "description": "Base code for story with variant" + }, + "Histoire story base with grid layout": { + "prefix": "hbase-grid", + "body": [ + "", + "", + "", + ], + "description": "Base code for story with grid layout" + }, +} diff --git a/snippets/nuxt-script.code-snippets b/snippets/nuxt/nuxt-script.code-snippets similarity index 77% rename from snippets/nuxt-script.code-snippets rename to snippets/nuxt/nuxt-script.code-snippets index 38388ff..31a344f 100644 --- a/snippets/nuxt-script.code-snippets +++ b/snippets/nuxt/nuxt-script.code-snippets @@ -80,4 +80,31 @@ ], "description": "Nuxt definePageMeta composable with description" }, + "Nuxt define plugin": { + "prefix": "nplugin", + "body": [ + "export default defineNuxtPlugin(nuxtApp => {", + "\t${0}", + "})", + ], + "description": "Base code for Nuxt plugin" + }, + "Nuxt define middleware": { + "prefix": "nmiddleware", + "body": [ + "export default defineNuxtRouteMiddleware((to, from) => {", + "\t${0}", + "})", + ], + "description": "Base code for Nuxt middleware" + }, + "Nuxt define server route": { + "prefix": "nserverroute", + "body": [ + "export default defineEventHandler((event) => {", + "\t${0}", + "})", + ], + "description": "Base code for Nuxt server route" + }, } diff --git a/snippets/nuxt-template.code-snippets b/snippets/nuxt/nuxt-template.code-snippets similarity index 100% rename from snippets/nuxt-template.code-snippets rename to snippets/nuxt/nuxt-template.code-snippets diff --git a/snippets/pinia.code-snippets b/snippets/pinia/pinia.code-snippets similarity index 51% rename from snippets/pinia.code-snippets rename to snippets/pinia/pinia.code-snippets index 92d1433..d472fb3 100644 --- a/snippets/pinia.code-snippets +++ b/snippets/pinia/pinia.code-snippets @@ -18,5 +18,21 @@ "" ], "description": "Base code needed for a Pinia store file" + }, + "Pinia Store Base - Composition API": { + "prefix": "pstore-composition", + "body": [ + "import { defineStore, acceptHMRUpdate } from \"pinia\"", + "", + "export const use${TM_FILENAME_BASE/(.*)/${1:/capitalize}/}Store = defineStore(\"$TM_FILENAME_BASE\", () => {", + "\t${0}", + "})", + "", + "if (import.meta.hot) {", + "\timport.meta.hot.accept(acceptHMRUpdate(use${TM_FILENAME_BASE/(.*)/${1:/capitalize}/}Store, import.meta.hot))", + "}", + "" + ], + "description": "Base code needed for a Pinia store file with Composition API" } } diff --git a/snippets/vue/vue-css.code-snippets b/snippets/vue/vue-css.code-snippets new file mode 100644 index 0000000..89a4dbd --- /dev/null +++ b/snippets/vue/vue-css.code-snippets @@ -0,0 +1,102 @@ +{ + "Vue Transition": { + "prefix": "vcss-transition", + "body": [ + ".v-enter-active,", + ".v-leave-active {", + "\ttransition: opacity 0.5s ease;", + "}", + "", + ".v-enter-from,", + ".v-leave-to {", + "\topacity: 0;", + "}" + ], + "description": "Vue Transition styles" + }, + "Vue Named Transition": { + "prefix": "vcss-transition-named", + "body": [ + ".${1:transitionName}-enter-active,", + ".${1:transitionName}-leave-active {", + "\ttransition: opacity 0.5s ease;", + "}", + "", + ".${1:transitionName}-enter-from,", + ".${1:transitionName}-leave-to {", + "\topacity: 0;", + "}" + ], + "description": "Vue Named Transition styles" + }, + "Vue Transition - Tailwind": { + "prefix": "vcss-transition-tailwind", + "body": [ + ".v-enter-active,", + ".v-leave-active {", + "\t@apply transition duration-500;", + "}", + "", + ".v-enter-from,", + ".v-leave-to {", + "\t@apply opacity-0;", + "}" + ], + "description": "Vue Transition styles for Tailwind CSS" + }, + "Vue Named Transition - Tailwind": { + "prefix": "vcss-transition-named-tailwind", + "body": [ + ".${1:transitionName}-enter-active,", + ".${1:transitionName}-leave-active {", + "\t@apply transition duration-500;", + "}", + "", + ".${1:transitionName}-enter-from,", + ".${1:transitionName}-leave-to {", + "\t@apply opacity-0;", + "}" + ], + "description": "Vue Named Transition styles for Tailwind CSS" + }, + "Vue Transition Group": { + "prefix": "vcss-transition-group", + "body": [ + ".${1:transitionName}-move,", + ".${1:transitionName}-enter-active,", + ".${1:transitionName}-leave-active {", + "\ttransition: opacity 0.5s ease;", + "}", + "", + ".${1:transitionName}-enter-from,", + ".${1:transitionName}-leave-to {", + "\topacity: 0;", + "}", + "", + ".${1:transitionName}-leave-active {", + "\tposition: absolute;", + "}" + ], + "description": "Vue Transition Group styles" + }, + "Vue Transition Group - Tailwind": { + "prefix": "vcss-transition-group-tailwind", + "body": [ + ".${1:transitionName}-move,", + ".${1:transitionName}-enter-active,", + ".${1:transitionName}-leave-active {", + "\t@apply transition duration-500;", + "}", + "", + ".${1:transitionName}-enter-from,", + ".${1:transitionName}-leave-to {", + "\t@apply opacity-0;", + "}", + "", + ".${1:transitionName}-leave-active {", + "\t@apply absolute;", + "}" + ], + "description": "Vue Transition Group styles for Tailwind CSS" + } +} diff --git a/snippets/vue-router.code-snippets b/snippets/vue/vue-router.code-snippets similarity index 100% rename from snippets/vue-router.code-snippets rename to snippets/vue/vue-router.code-snippets diff --git a/snippets/vue-script.code-snippets b/snippets/vue/vue-script.code-snippets similarity index 100% rename from snippets/vue-script.code-snippets rename to snippets/vue/vue-script.code-snippets diff --git a/snippets/vue-template.code-snippets b/snippets/vue/vue-template.code-snippets similarity index 100% rename from snippets/vue-template.code-snippets rename to snippets/vue/vue-template.code-snippets diff --git a/snippets/vue.code-snippets b/snippets/vue/vue.code-snippets similarity index 93% rename from snippets/vue.code-snippets rename to snippets/vue/vue.code-snippets index 7a80abf..dae7bd4 100644 --- a/snippets/vue.code-snippets +++ b/snippets/vue/vue.code-snippets @@ -4,8 +4,7 @@ "body": [ "" - , + "", "", "