create-vuetify 2.3.0 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/index.mjs +1110 -127
  2. package/package.json +20 -25
  3. package/template/javascript/base/eslint.config.js +1 -23
  4. package/template/javascript/base/package.json +5 -9
  5. package/template/javascript/base/src/components/HelloWorld.vue +42 -109
  6. package/template/javascript/base/src/router/index.js +0 -1
  7. package/template/javascript/base/vite.config.mjs +14 -2
  8. package/template/javascript/default/package.json +10 -10
  9. package/template/javascript/default/src/components/AppFooter.vue +6 -3
  10. package/template/javascript/default/src/components/HelloWorld.vue +41 -108
  11. package/template/javascript/default/vite.config.mjs +8 -2
  12. package/template/javascript/essentials/_eslintrc-auto-import.json +11 -1
  13. package/template/javascript/essentials/package.json +3 -3
  14. package/template/javascript/essentials/src/App.vue +9 -0
  15. package/template/javascript/essentials/src/layouts/README.md +1 -1
  16. package/template/javascript/essentials/src/layouts/default.vue +4 -6
  17. package/template/javascript/essentials/vite.config.mjs +20 -4
  18. package/template/typescript/base/eslint.config.js +1 -36
  19. package/template/typescript/base/package.json +4 -9
  20. package/template/typescript/base/src/components/HelloWorld.vue +42 -109
  21. package/template/typescript/base/vite.config.mts +13 -1
  22. package/template/typescript/default/README.md +1 -1
  23. package/template/typescript/default/package.json +12 -14
  24. package/template/typescript/default/src/components/HelloWorld.vue +41 -108
  25. package/template/typescript/default/vite.config.mts +6 -0
  26. package/template/typescript/essentials/_eslintrc-auto-import.json +13 -0
  27. package/template/typescript/essentials/env.d.ts +1 -1
  28. package/template/typescript/essentials/package.json +3 -3
  29. package/template/typescript/essentials/src/App.vue +9 -0
  30. package/template/typescript/essentials/src/auto-imports.d.ts +16 -66
  31. package/template/typescript/essentials/src/components/AppFooter.vue +6 -3
  32. package/template/typescript/essentials/src/layouts/README.md +1 -1
  33. package/template/typescript/essentials/src/layouts/default.vue +4 -6
  34. package/template/typescript/essentials/vite.config.mts +18 -4
  35. package/template/typescript/nuxt/assets/logo.png +0 -0
  36. package/template/typescript/nuxt/assets/logo.svg +6 -0
  37. package/template/typescript/nuxt/components/AppFooter.vue +38 -35
  38. package/template/typescript/nuxt/components/HelloWorld.vue +44 -107
  39. package/template/typescript/nuxt/modules/vuetify.ts +35 -10
  40. package/template/typescript/nuxt/pages/index.vue +0 -1
  41. package/template/typescript/nuxt/plugins/vuetify-nuxt.ts +2 -2
  42. package/template/typescript/nuxt/plugins/vuetify.ts +1 -1
@@ -1,48 +1,51 @@
1
1
  <script setup lang="ts">
2
- const items = shallowRef([
3
- {
4
- title: 'Vuetify Documentation',
5
- icon: `$vuetify`,
6
- href: 'https://vuetifyjs.com/',
7
- },
8
- {
9
- title: 'Vuetify Support',
10
- icon: 'mdi-shield-star-outline',
11
- href: 'https://support.vuetifyjs.com/',
12
- },
13
- {
14
- title: 'Vuetify X',
15
- icon: ['M2.04875 3.00002L9.77052 13.3248L1.99998 21.7192H3.74882L10.5519 14.3697L16.0486 21.7192H22L13.8437 10.8137L21.0765 3.00002H19.3277L13.0624 9.76874L8.0001 3.00002H2.04875ZM4.62054 4.28821H7.35461L19.4278 20.4308H16.6937L4.62054 4.28821Z'],
16
- href: 'https://x.com/vuetifyjs',
17
- },
18
- {
19
- title: 'Vuetify GitHub',
20
- icon: `mdi-github`,
21
- href: 'https://github.com/vuetifyjs/vuetify',
22
- },
23
- {
24
- title: 'Vuetify Discord',
25
- icon: ['M22,24L16.75,19L17.38,21H4.5A2.5,2.5 0 0,1 2,18.5V3.5A2.5,2.5 0 0,1 4.5,1H19.5A2.5,2.5 0 0,1 22,3.5V24M12,6.8C9.32,6.8 7.44,7.95 7.44,7.95C8.47,7.03 10.27,6.5 10.27,6.5L10.1,6.33C8.41,6.36 6.88,7.53 6.88,7.53C5.16,11.12 5.27,14.22 5.27,14.22C6.67,16.03 8.75,15.9 8.75,15.9L9.46,15C8.21,14.73 7.42,13.62 7.42,13.62C7.42,13.62 9.3,14.9 12,14.9C14.7,14.9 16.58,13.62 16.58,13.62C16.58,13.62 15.79,14.73 14.54,15L15.25,15.9C15.25,15.9 17.33,16.03 18.73,14.22C18.73,14.22 18.84,11.12 17.12,7.53C17.12,7.53 15.59,6.36 13.9,6.33L13.73,6.5C13.73,6.5 15.53,7.03 16.56,7.95C16.56,7.95 14.68,6.8 12,6.8M9.93,10.59C10.58,10.59 11.11,11.16 11.1,11.86C11.1,12.55 10.58,13.13 9.93,13.13C9.29,13.13 8.77,12.55 8.77,11.86C8.77,11.16 9.28,10.59 9.93,10.59M14.1,10.59C14.75,10.59 15.27,11.16 15.27,11.86C15.27,12.55 14.75,13.13 14.1,13.13C13.46,13.13 12.94,12.55 12.94,11.86C12.94,11.16 13.45,10.59 14.1,10.59Z'],
26
- href: 'https://community.vuetifyjs.com/',
27
- },
28
- {
29
- title: 'Vuetify Reddit',
30
- icon: `mdi-reddit`,
31
- href: 'https://reddit.com/r/vuetifyjs',
32
- },
33
- ])
2
+ const items = shallowRef([
3
+ {
4
+ title: 'Vuetify Documentation',
5
+ icon: `$vuetify`,
6
+ href: 'https://vuetifyjs.com/',
7
+ },
8
+ {
9
+ title: 'Vuetify Support',
10
+ icon: 'mdi-shield-star-outline',
11
+ href: 'https://support.vuetifyjs.com/',
12
+ },
13
+ {
14
+ title: 'Vuetify X',
15
+ icon: ['M2.04875 3.00002L9.77052 13.3248L1.99998 21.7192H3.74882L10.5519 14.3697L16.0486 21.7192H22L13.8437 10.8137L21.0765 3.00002H19.3277L13.0624 9.76874L8.0001 3.00002H2.04875ZM4.62054 4.28821H7.35461L19.4278 20.4308H16.6937L4.62054 4.28821Z'],
16
+ href: 'https://x.com/vuetifyjs',
17
+ },
18
+ {
19
+ title: 'Vuetify GitHub',
20
+ icon: `mdi-github`,
21
+ href: 'https://github.com/vuetifyjs/vuetify',
22
+ },
23
+ {
24
+ title: 'Vuetify Discord',
25
+ icon: ['M22,24L16.75,19L17.38,21H4.5A2.5,2.5 0 0,1 2,18.5V3.5A2.5,2.5 0 0,1 4.5,1H19.5A2.5,2.5 0 0,1 22,3.5V24M12,6.8C9.32,6.8 7.44,7.95 7.44,7.95C8.47,7.03 10.27,6.5 10.27,6.5L10.1,6.33C8.41,6.36 6.88,7.53 6.88,7.53C5.16,11.12 5.27,14.22 5.27,14.22C6.67,16.03 8.75,15.9 8.75,15.9L9.46,15C8.21,14.73 7.42,13.62 7.42,13.62C7.42,13.62 9.3,14.9 12,14.9C14.7,14.9 16.58,13.62 16.58,13.62C16.58,13.62 15.79,14.73 14.54,15L15.25,15.9C15.25,15.9 17.33,16.03 18.73,14.22C18.73,14.22 18.84,11.12 17.12,7.53C17.12,7.53 15.59,6.36 13.9,6.33L13.73,6.5C13.73,6.5 15.53,7.03 16.56,7.95C16.56,7.95 14.68,6.8 12,6.8M9.93,10.59C10.58,10.59 11.11,11.16 11.1,11.86C11.1,12.55 10.58,13.13 9.93,13.13C9.29,13.13 8.77,12.55 8.77,11.86C8.77,11.16 9.28,10.59 9.93,10.59M14.1,10.59C14.75,10.59 15.27,11.16 15.27,11.86C15.27,12.55 14.75,13.13 14.1,13.13C13.46,13.13 12.94,12.55 12.94,11.86C12.94,11.16 13.45,10.59 14.1,10.59Z'],
26
+ href: 'https://community.vuetifyjs.com/',
27
+ },
28
+ {
29
+ title: 'Vuetify Reddit',
30
+ icon: `mdi-reddit`,
31
+ href: 'https://reddit.com/r/vuetifyjs',
32
+ },
33
+ ])
34
34
  </script>
35
35
 
36
36
  <template>
37
- <v-footer height="40" app>
37
+ <v-footer
38
+ app
39
+ height="40"
40
+ >
38
41
  <NuxtLink
39
42
  v-for="item in items"
40
43
  :key="item.title"
41
- :href="item.href"
42
- :title="item.title"
43
44
  class="d-inline-block mx-2 social-link"
45
+ :href="item.href"
44
46
  rel="noopener noreferrer"
45
47
  target="_blank"
48
+ :title="item.title"
46
49
  >
47
50
  <v-icon
48
51
  :icon="item.icon"
@@ -1,23 +1,17 @@
1
1
  <template>
2
- <v-container class="fill-height">
3
- <v-responsive
4
- class="align-centerfill-height mx-auto"
5
- max-width="900"
6
- >
2
+ <v-container class="fill-height" max-width="900">
3
+ <div>
7
4
  <v-img
8
5
  class="mb-4"
9
6
  height="150"
10
7
  src="~/assets/logo.png"
11
8
  />
12
9
 
13
- <div class="text-center">
10
+ <div class="mb-8 text-center">
14
11
  <div class="text-body-2 font-weight-light mb-n1">Welcome to</div>
15
-
16
12
  <h1 class="text-h2 font-weight-bold">Vuetify</h1>
17
13
  </div>
18
14
 
19
- <div class="py-4" />
20
-
21
15
  <v-row>
22
16
  <v-col cols="12">
23
17
  <v-card
@@ -26,14 +20,16 @@
26
20
  image="https://cdn.vuetifyjs.com/docs/images/one/create/feature.png"
27
21
  prepend-icon="mdi-rocket-launch-outline"
28
22
  rounded="lg"
29
- variant="outlined"
23
+ variant="tonal"
30
24
  >
31
25
  <template #image>
32
26
  <v-img position="top right" />
33
27
  </template>
34
28
 
35
29
  <template #title>
36
- <h2 class="text-h5 font-weight-bold">Get started</h2>
30
+ <h2 class="text-h5 font-weight-bold">
31
+ Get started
32
+ </h2>
37
33
  </template>
38
34
 
39
35
  <template #subtitle>
@@ -41,113 +37,54 @@
41
37
  Change this page by updating <v-kbd>{{ `<HelloWorld />` }}</v-kbd> in <v-kbd>components/HelloWorld.vue</v-kbd>.
42
38
  </div>
43
39
  </template>
44
-
45
- <v-overlay
46
- opacity=".12"
47
- scrim="primary"
48
- contained
49
- model-value
50
- persistent
51
- />
52
- </v-card>
53
- </v-col>
54
-
55
- <v-col cols="6">
56
- <v-card
57
- append-icon="mdi-open-in-new"
58
- class="py-4"
59
- color="surface-variant"
60
- href="https://vuetifyjs.com/"
61
- prepend-icon="mdi-text-box-outline"
62
- rel="noopener noreferrer"
63
- rounded="lg"
64
- subtitle="Learn about all things Vuetify in our documentation."
65
- target="_blank"
66
- title="Documentation"
67
- variant="text"
68
- >
69
- <v-overlay
70
- opacity=".06"
71
- scrim="primary"
72
- contained
73
- model-value
74
- persistent
75
- />
76
40
  </v-card>
77
41
  </v-col>
78
42
 
79
- <v-col cols="6">
43
+ <v-col v-for="link in links" :key="link.href" cols="6">
80
44
  <v-card
81
45
  append-icon="mdi-open-in-new"
82
46
  class="py-4"
83
47
  color="surface-variant"
84
- href="https://vuetifyjs.com/introduction/why-vuetify/#feature-guides"
85
- prepend-icon="mdi-star-circle-outline"
48
+ :href="link.href"
49
+ :prepend-icon="link.icon"
86
50
  rel="noopener noreferrer"
87
51
  rounded="lg"
88
- subtitle="Explore available framework Features."
52
+ :subtitle="link.subtitle"
89
53
  target="_blank"
90
- title="Features"
91
- variant="text"
92
- >
93
- <v-overlay
94
- opacity=".06"
95
- scrim="primary"
96
- contained
97
- model-value
98
- persistent
99
- />
100
- </v-card>
101
- </v-col>
102
-
103
- <v-col cols="6">
104
- <v-card
105
- append-icon="mdi-open-in-new"
106
- class="py-4"
107
- color="surface-variant"
108
- href="https://vuetifyjs.com/components/all"
109
- prepend-icon="mdi-widgets-outline"
110
- rel="noopener noreferrer"
111
- rounded="lg"
112
- subtitle="Discover components in the API Explorer."
113
- target="_blank"
114
- title="Components"
115
- variant="text"
116
- >
117
- <v-overlay
118
- opacity=".06"
119
- scrim="primary"
120
- contained
121
- model-value
122
- persistent
123
- />
124
- </v-card>
125
- </v-col>
126
-
127
- <v-col cols="6">
128
- <v-card
129
- append-icon="mdi-open-in-new"
130
- class="py-4"
131
- color="surface-variant"
132
- href="https://discord.vuetifyjs.com"
133
- prepend-icon="mdi-account-group-outline"
134
- rel="noopener noreferrer"
135
- rounded="lg"
136
- subtitle="Connect with Vuetify developers."
137
- target="_blank"
138
- title="Community"
139
- variant="text"
140
- >
141
- <v-overlay
142
- opacity=".06"
143
- scrim="primary"
144
- contained
145
- model-value
146
- persistent
147
- />
148
- </v-card>
54
+ :title="link.title"
55
+ variant="tonal"
56
+ />
149
57
  </v-col>
150
58
  </v-row>
151
- </v-responsive>
59
+ </div>
152
60
  </v-container>
153
61
  </template>
62
+
63
+ <script setup>
64
+ const links = [
65
+ {
66
+ href: 'https://vuetifyjs.com/',
67
+ icon: 'mdi-text-box-outline',
68
+ subtitle: 'Learn about all things Vuetify in our documentation.',
69
+ title: 'Documentation',
70
+ },
71
+ {
72
+ href: 'https://vuetifyjs.com/introduction/why-vuetify/#feature-guides',
73
+ icon: 'mdi-star-circle-outline',
74
+ subtitle: 'Explore available framework Features.',
75
+ title: 'Features',
76
+ },
77
+ {
78
+ href: 'https://vuetifyjs.com/components/all',
79
+ icon: 'mdi-widgets-outline',
80
+ subtitle: 'Discover components in the API Explorer.',
81
+ title: 'Components',
82
+ },
83
+ {
84
+ href: 'https://discord.vuetifyjs.com',
85
+ icon: 'mdi-account-group-outline',
86
+ subtitle: 'Connect with Vuetify developers.',
87
+ title: 'Community',
88
+ },
89
+ ]
90
+ </script>
@@ -2,8 +2,10 @@ import { defineNuxtModule } from '@nuxt/kit'
2
2
  import type { Options as ModuleOptions } from '@vuetify/loader-shared'
3
3
  import vuetify, { transformAssetUrls } from 'vite-plugin-vuetify'
4
4
  import path from 'upath'
5
- import { resolveVuetifyBase, isObject } from '@vuetify/loader-shared'
5
+ import { isObject, resolveVuetifyBase } from '@vuetify/loader-shared'
6
6
  import { pathToFileURL } from 'node:url'
7
+ import fs from 'node:fs'
8
+ import fsp from 'node:fs/promises'
7
9
 
8
10
  export type { ModuleOptions }
9
11
 
@@ -14,7 +16,7 @@ export default defineNuxtModule<ModuleOptions>({
14
16
  configKey: 'vuetify',
15
17
  },
16
18
  defaults: () => ({ styles: true }),
17
- setup(options, nuxt) {
19
+ setup (options, nuxt) {
18
20
  let configFile: string | undefined
19
21
  const vuetifyBase = resolveVuetifyBase()
20
22
  const noneFiles = new Set<string>()
@@ -22,8 +24,9 @@ export default defineNuxtModule<ModuleOptions>({
22
24
  let sassVariables = false
23
25
  const PREFIX = 'vuetify-styles/'
24
26
  const SSR_PREFIX = `/@${PREFIX}`
27
+ const resolveCss = resolveCssFactory()
25
28
 
26
- nuxt.hook('vite:extendConfig', (viteInlineConfig) => {
29
+ nuxt.hook('vite:extendConfig', viteInlineConfig => {
27
30
  // add vuetify transformAssetUrls
28
31
  viteInlineConfig.vue ??= {}
29
32
  viteInlineConfig.vue.template ??= {}
@@ -39,6 +42,8 @@ export default defineNuxtModule<ModuleOptions>({
39
42
  viteInlineConfig.css.preprocessorOptions ??= {}
40
43
  viteInlineConfig.css.preprocessorOptions.sass ??= {}
41
44
  viteInlineConfig.css.preprocessorOptions.sass.api = 'modern-compiler'
45
+ viteInlineConfig.css.preprocessorOptions.scss ??= {}
46
+ viteInlineConfig.css.preprocessorOptions.scss.api = 'modern-compiler'
42
47
 
43
48
  viteInlineConfig.plugins.push({
44
49
  name: 'vuetify:nuxt:styles',
@@ -59,7 +64,7 @@ export default defineNuxtModule<ModuleOptions>({
59
64
  },
60
65
  async resolveId (source, importer, { custom, ssr }) {
61
66
  if (source.startsWith(PREFIX) || source.startsWith(SSR_PREFIX)) {
62
- if (source.endsWith('.sass')) {
67
+ if (source.match(/\.s[ca]ss$/)) {
63
68
  return source
64
69
  }
65
70
 
@@ -74,8 +79,7 @@ export default defineNuxtModule<ModuleOptions>({
74
79
  )
75
80
  ) {
76
81
  if (options.styles === 'sass') {
77
- const target = source.replace(/\.css$/, '.sass')
78
- return this.resolve(target, importer, { skipSelf: true, custom })
82
+ return this.resolve(await resolveCss(source), importer, { skipSelf: true, custom })
79
83
  }
80
84
 
81
85
  const resolution = await this.resolve(source, importer, { skipSelf: true, custom })
@@ -83,7 +87,7 @@ export default defineNuxtModule<ModuleOptions>({
83
87
  if (!resolution)
84
88
  return undefined
85
89
 
86
- const target = resolution.id.replace(/\.css$/, '.sass')
90
+ const target = await resolveCss(resolution.id)
87
91
  if (isNone) {
88
92
  noneFiles.add(target)
89
93
  return target
@@ -94,7 +98,7 @@ export default defineNuxtModule<ModuleOptions>({
94
98
 
95
99
  return undefined
96
100
  },
97
- load(id){
101
+ load (id){
98
102
  if (sassVariables) {
99
103
  const target = id.startsWith(PREFIX)
100
104
  ? path.resolve(vuetifyBase, id.slice(PREFIX.length))
@@ -103,8 +107,9 @@ export default defineNuxtModule<ModuleOptions>({
103
107
  : undefined
104
108
 
105
109
  if (target) {
110
+ const suffix = target.match(/\.scss/) ? ';\n' : '\n'
106
111
  return {
107
- code: `@use "${configFile}"\n@use "${pathToFileURL(target).href}"`,
112
+ code: `@use "${configFile}"${suffix}@use "${pathToFileURL(target).href}"${suffix}`,
108
113
  map: {
109
114
  mappings: '',
110
115
  },
@@ -116,9 +121,29 @@ export default defineNuxtModule<ModuleOptions>({
116
121
  },
117
122
  })
118
123
  })
119
- }
124
+ },
120
125
  })
121
126
 
127
+ function resolveCssFactory () {
128
+ const mappings = new Map<string, string>()
129
+ return async (source: string) => {
130
+ let mapping = mappings.get(source)
131
+ if (!mapping) {
132
+ try {
133
+ mapping = source.replace(/\.css$/, '.sass')
134
+ await fsp.access(mapping, fs.constants.R_OK)
135
+ }
136
+ catch (err) {
137
+ if (!(err instanceof Error && 'code' in err && err.code === 'ENOENT'))
138
+ throw err
139
+ mapping = source.replace(/\.css$/, '.scss')
140
+ }
141
+ mappings.set(source, mapping)
142
+ }
143
+ return mapping
144
+ }
145
+ }
146
+
122
147
  function isSubdir (root: string, test: string) {
123
148
  const relative = path.relative(root, test)
124
149
  return relative && !relative.startsWith('..') && !path.isAbsolute(relative)
@@ -5,4 +5,3 @@
5
5
  <template>
6
6
  <HelloWorld />
7
7
  </template>
8
-
@@ -1,6 +1,6 @@
1
- export default defineNuxtPlugin((nuxtApp) => {
1
+ export default defineNuxtPlugin(nuxtApp => {
2
2
  // check https://vuetify-nuxt-module.netlify.app/guide/nuxt-runtime-hooks.html
3
- nuxtApp.hook('vuetify:before-create', (options) => {
3
+ nuxtApp.hook('vuetify:before-create', options => {
4
4
  if (import.meta.client) {
5
5
  console.log('vuetify:before-create', options)
6
6
  }
@@ -1,6 +1,6 @@
1
1
  import { createVuetify } from 'vuetify'
2
2
 
3
- export default defineNuxtPlugin((nuxtApp) => {
3
+ export default defineNuxtPlugin(nuxtApp => {
4
4
  const vuetify = createVuetify({
5
5
  // WARNING: when switching ssr option in nuxt.config.ts file you need to manually change it here
6
6
  ssr: true,