vuetify-nuxt-module 0.4.2 → 0.4.4
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.
- package/README.md +413 -379
- package/dist/module.d.ts +8 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +46 -24
- package/dist/runtime/plugins/vuetify-sync.d.ts +2 -0
- package/dist/runtime/plugins/vuetify-sync.mjs +12 -0
- package/dist/runtime/plugins/vuetify.mjs +0 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,379 +1,413 @@
|
|
|
1
|
-
<div align="center">
|
|
2
|
-
<picture>
|
|
3
|
-
<source media="(prefers-color-scheme: dark)" srcset="https://github.com/userquin/vuetify-nuxt-module/raw/main/hero-dark.svg" />
|
|
4
|
-
<img alt="vuetify-nuxt-module - Zero-config Nuxt module for Vuetify" src='https://github.com/userquin/vuetify-nuxt-module/raw/main/hero.svg' alt="vuetify-nuxt-module - Zero-config Nuxt module for Vuetify"><br>
|
|
5
|
-
</picture>
|
|
6
|
-
<p>Zero-config Nuxt module for Vuetify</p>
|
|
7
|
-
</div>
|
|
8
|
-
|
|
9
|
-
<p align='center'>
|
|
10
|
-
<a href='https://www.npmjs.com/package/vuetify-nuxt-module' target="__blank">
|
|
11
|
-
<img src='https://img.shields.io/npm/v/vuetify-nuxt-module?color=33A6B8&label=' alt="NPM version">
|
|
12
|
-
</a>
|
|
13
|
-
<a href="https://www.npmjs.com/package/vuetify-nuxt-module" target="__blank">
|
|
14
|
-
<img alt="NPM Downloads" src="https://img.shields.io/npm/dm/vuetify-nuxt-module?color=476582&label=">
|
|
15
|
-
</a>
|
|
16
|
-
<!--
|
|
17
|
-
<a href="https://vite-pwa-org.netlify.app/frameworks/nuxt" target="__blank">
|
|
18
|
-
<img src="https://img.shields.io/static/v1?label=&message=docs%20%26%20guides&color=2e859c" alt="Docs & Guides">
|
|
19
|
-
</a>
|
|
20
|
-
-->
|
|
21
|
-
<br>
|
|
22
|
-
<a href="https://github.com/userquin/vuetify-nuxt-module" target="__blank">
|
|
23
|
-
<img alt="GitHub stars" src="https://img.shields.io/github/stars/userquin/vuetify-nuxt-module?style=social">
|
|
24
|
-
</a>
|
|
25
|
-
</p>
|
|
26
|
-
|
|
27
|
-
<br>
|
|
28
|
-
|
|
29
|
-
## 🚀 Features
|
|
30
|
-
|
|
31
|
-
- 👌 **Zero-Config**: sensible built-in default [Vuetify](https://vuetifyjs.com/) configuration for common use cases
|
|
32
|
-
-
|
|
33
|
-
- ⚡ **Fully Tree Shakable**: by default, only the needed Vuetify components are imported
|
|
34
|
-
- 🛠️ **Versatile**: custom Vuetify [directives](https://vuetifyjs.com/en/getting-started/installation/#manual-steps) and [labs components](https://vuetifyjs.com/en/labs/introduction/) registration
|
|
35
|
-
- ✨ **Configurable Styles**: configure your variables using [Vuetify SASS Variables](https://vuetifyjs.com/en/features/sass-variables/)
|
|
36
|
-
- 💥 **SSR**: automatic SSR detection and configuration
|
|
37
|
-
- 😃 **Icon Fonts**: configure the [icon font](https://vuetifyjs.com/en/features/icon-fonts/) you want to use, the module will automatically import it for you using CDN or local dependencies
|
|
38
|
-
- 🎭 **SVG Icons**: ready to use [@mdi/js](https://www.npmjs.com/package/@mdi/js) and [@fortawesome/vue-fontawesome](https://www.npmjs.com/package/@fortawesome/vue-fontawesome) SVG icons packs
|
|
39
|
-
- 📦 **Multiple Icon Sets**: register [multiple icon sets](https://vuetifyjs.com/en/features/icon-fonts/#multiple-icon-sets)
|
|
40
|
-
- 🌍 **I18n Ready**: install [@nuxtjs/i18n](https://v8.i18n.nuxtjs.org/) Nuxt module, and you're ready to use Vuetify [internationalization](https://vuetifyjs.com/en/features/internationalization/) features
|
|
41
|
-
- 📆 **Date Components**: use Vuetify components [that require date functionality](https://vuetifyjs.com/en/features/dates/) installing and configuring one of the [@date-io](https://github.com/dmtrKovalenko/date-io#projects) adapters
|
|
42
|
-
- ⚙️ **Auto-Import Vuetify Composables**: you don't need to import Vuetify composables manually, they are automatically imported for you
|
|
43
|
-
- 🎨 **Vuetify Blueprints**: use [Vuetify Blueprints](https://vuetifyjs.com/en/features/blueprints/) to quickly scaffold components
|
|
44
|
-
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
- [
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
##
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
-
|
|
345
|
-
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
-
|
|
366
|
-
- `
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
[
|
|
1
|
+
<div align="center">
|
|
2
|
+
<picture>
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://github.com/userquin/vuetify-nuxt-module/raw/main/hero-dark.svg" />
|
|
4
|
+
<img alt="vuetify-nuxt-module - Zero-config Nuxt module for Vuetify" src='https://github.com/userquin/vuetify-nuxt-module/raw/main/hero.svg' alt="vuetify-nuxt-module - Zero-config Nuxt module for Vuetify"><br>
|
|
5
|
+
</picture>
|
|
6
|
+
<p>Zero-config Nuxt module for Vuetify</p>
|
|
7
|
+
</div>
|
|
8
|
+
|
|
9
|
+
<p align='center'>
|
|
10
|
+
<a href='https://www.npmjs.com/package/vuetify-nuxt-module' target="__blank">
|
|
11
|
+
<img src='https://img.shields.io/npm/v/vuetify-nuxt-module?color=33A6B8&label=' alt="NPM version">
|
|
12
|
+
</a>
|
|
13
|
+
<a href="https://www.npmjs.com/package/vuetify-nuxt-module" target="__blank">
|
|
14
|
+
<img alt="NPM Downloads" src="https://img.shields.io/npm/dm/vuetify-nuxt-module?color=476582&label=">
|
|
15
|
+
</a>
|
|
16
|
+
<!--
|
|
17
|
+
<a href="https://vite-pwa-org.netlify.app/frameworks/nuxt" target="__blank">
|
|
18
|
+
<img src="https://img.shields.io/static/v1?label=&message=docs%20%26%20guides&color=2e859c" alt="Docs & Guides">
|
|
19
|
+
</a>
|
|
20
|
+
-->
|
|
21
|
+
<br>
|
|
22
|
+
<a href="https://github.com/userquin/vuetify-nuxt-module" target="__blank">
|
|
23
|
+
<img alt="GitHub stars" src="https://img.shields.io/github/stars/userquin/vuetify-nuxt-module?style=social">
|
|
24
|
+
</a>
|
|
25
|
+
</p>
|
|
26
|
+
|
|
27
|
+
<br>
|
|
28
|
+
|
|
29
|
+
## 🚀 Features
|
|
30
|
+
|
|
31
|
+
- 👌 **Zero-Config**: sensible built-in default [Vuetify](https://vuetifyjs.com/) configuration for common use cases
|
|
32
|
+
- 🔌 **Extensible**: expose the ability to customize the Vuetify configuration via [Nuxt Plugin Hooks](https://nuxt.com/docs/guide/going-further/hooks#usage-with-plugins)
|
|
33
|
+
- ⚡ **Fully Tree Shakable**: by default, only the needed Vuetify components are imported
|
|
34
|
+
- 🛠️ **Versatile**: custom Vuetify [directives](https://vuetifyjs.com/en/getting-started/installation/#manual-steps) and [labs components](https://vuetifyjs.com/en/labs/introduction/) registration
|
|
35
|
+
- ✨ **Configurable Styles**: configure your variables using [Vuetify SASS Variables](https://vuetifyjs.com/en/features/sass-variables/)
|
|
36
|
+
- 💥 **SSR**: automatic SSR detection and configuration
|
|
37
|
+
- 😃 **Icon Fonts**: configure the [icon font](https://vuetifyjs.com/en/features/icon-fonts/) you want to use, the module will automatically import it for you using CDN or local dependencies
|
|
38
|
+
- 🎭 **SVG Icons**: ready to use [@mdi/js](https://www.npmjs.com/package/@mdi/js) and [@fortawesome/vue-fontawesome](https://www.npmjs.com/package/@fortawesome/vue-fontawesome) SVG icons packs
|
|
39
|
+
- 📦 **Multiple Icon Sets**: register [multiple icon sets](https://vuetifyjs.com/en/features/icon-fonts/#multiple-icon-sets)
|
|
40
|
+
- 🌍 **I18n Ready**: install [@nuxtjs/i18n](https://v8.i18n.nuxtjs.org/) Nuxt module, and you're ready to use Vuetify [internationalization](https://vuetifyjs.com/en/features/internationalization/) features
|
|
41
|
+
- 📆 **Date Components**: use Vuetify components [that require date functionality](https://vuetifyjs.com/en/features/dates/) installing and configuring one of the [@date-io](https://github.com/dmtrKovalenko/date-io#projects) adapters
|
|
42
|
+
- ⚙️ **Auto-Import Vuetify Composables**: you don't need to import Vuetify composables manually, they are automatically imported for you
|
|
43
|
+
- 🎨 **Vuetify Blueprints**: use [Vuetify Blueprints](https://vuetifyjs.com/en/features/blueprints/) to quickly scaffold components
|
|
44
|
+
- 🔩 **Nuxt Layers and Hooks**: load your Vuetify configuration using [Nuxt Layers](https://nuxt.com/docs/getting-started/layers#layers) or using a custom module via `vuetify:registerModule` [Nuxt Hook](https://nuxt.com/docs/guide/going-further/hooks#nuxt-hooks-build-time)
|
|
45
|
+
- 👀 **Nuxt DevTools**: ready to inspect your Vuetify styles with the [Nuxt DevTools](https://github.com/nuxt/devtools) inspector
|
|
46
|
+
- 🦾 **Type Strong**: written in [TypeScript](https://www.typescriptlang.org/)
|
|
47
|
+
|
|
48
|
+
## 📦 Install
|
|
49
|
+
|
|
50
|
+
> Requires Vite, will not work with Webpack
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
npm i vuetify-nuxt-module -D
|
|
54
|
+
|
|
55
|
+
# yarn
|
|
56
|
+
yarn add vuetify-nuxt-module -D
|
|
57
|
+
|
|
58
|
+
# pnpm
|
|
59
|
+
pnpm add vuetify-nuxt-module -D
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
[](https://stackblitz.com/github/userquin/vuetify-nuxt-module)
|
|
63
|
+
|
|
64
|
+
## 🦄 Usage
|
|
65
|
+
|
|
66
|
+
> `vuetify-nuxt-module` is strongly opinionated and has a built-in default configuration out of the box. You can use it without any configuration, and it will work for most use cases.
|
|
67
|
+
|
|
68
|
+
Add `vuetify-nuxt-module` module to `nuxt.config.ts` and configure it:
|
|
69
|
+
|
|
70
|
+
```ts
|
|
71
|
+
// Nuxt config file
|
|
72
|
+
import { defineNuxtConfig } from 'nuxt/config'
|
|
73
|
+
|
|
74
|
+
export default defineNuxtConfig({
|
|
75
|
+
modules: [
|
|
76
|
+
'vuetify-nuxt-module'
|
|
77
|
+
],
|
|
78
|
+
vuetify: {
|
|
79
|
+
moduleOptions: {
|
|
80
|
+
/* module specific options */
|
|
81
|
+
},
|
|
82
|
+
vuetifyOptions: {
|
|
83
|
+
/* vuetify options */
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
})
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## 🔥 Components, Directives, Lab Components
|
|
90
|
+
|
|
91
|
+
The module will enable automatic tree shaking for Vuetify components.
|
|
92
|
+
|
|
93
|
+
You don't need to install any Vuetify Vite Plugin (the module will throw an error if any Vuetify Vite Plugin is installed in your Nuxt configuration):
|
|
94
|
+
- the module will provide auto-import support via `vuetify/dist/json/importMap.json` json file and Nuxt `components:extend` hook.
|
|
95
|
+
- the module will register a custom Vite Plugin for Vuetify styles: it is just a copy from the original Vuetify Vite Styles Plugin, changing some virtual names mappings and handling SSR flags.
|
|
96
|
+
|
|
97
|
+
### Global Components
|
|
98
|
+
|
|
99
|
+
If you need to add some global component, use `vuetifyOptions.components` module option, it has been declared properly to have better DX.
|
|
100
|
+
|
|
101
|
+
Check the [components definition](https://github.com/userquin/vuetify-nuxt-module/blob/main/src/types.ts#L80-L81).
|
|
102
|
+
|
|
103
|
+
You can also provide [Aliasing & Virtual Components](https://vuetifyjs.com/en/features/aliasing/#virtual-component-defaults) via `vuetifyOptions.aliases` module option to register components with a different name, only available for global components. The components require to be registered globally.
|
|
104
|
+
|
|
105
|
+
### Directives
|
|
106
|
+
|
|
107
|
+
By default, the module will not register any Vuetify directive. If you need to register some directive, use `vuetifyOptions.directives` module option, it has been declared properly to have better DX.
|
|
108
|
+
|
|
109
|
+
You can register all the directives or only the ones you need: check the [directives definition](https://github.com/userquin/vuetify-nuxt-module/blob/main/src/types.ts#L82-L83).
|
|
110
|
+
|
|
111
|
+
### Labs Components
|
|
112
|
+
|
|
113
|
+
The module provides support to use Vuetify [labs components](https://vuetifyjs.com/en/labs/introduction/) via `vuetifyOptions.labsComponents` module option, it has been declared properly to have better DX.
|
|
114
|
+
|
|
115
|
+
You can register all the labs components or only the ones you need: check the [labsComponent definition](https://github.com/userquin/vuetify-nuxt-module/blob/main/src/types.ts#L84-L85).
|
|
116
|
+
|
|
117
|
+
## 🔩 Nuxt Layers and Hooks
|
|
118
|
+
|
|
119
|
+
You can load your Vuetify configuration using [Nuxt Layers](https://nuxt.com/docs/getting-started/layers#layers) or using a custom module via `vuetify:registerModule` [Nuxt Hook](https://nuxt.com/docs/guide/going-further/hooks#nuxt-hooks-build-time).
|
|
120
|
+
|
|
121
|
+
### Nuxt Layers
|
|
122
|
+
|
|
123
|
+
Add your Vuetify configuration to a layer and then configure the module to use it:
|
|
124
|
+
```ts
|
|
125
|
+
// Nuxt config file
|
|
126
|
+
import { defineNuxtConfig } from 'nuxt/config'
|
|
127
|
+
|
|
128
|
+
export default defineNuxtConfig({
|
|
129
|
+
extends: ['my-awesome-vuetify-layer'],
|
|
130
|
+
modules: ['vuetify-nuxt-module']
|
|
131
|
+
})
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Nuxt Hook
|
|
135
|
+
|
|
136
|
+
You can use a custom module to load your Vuetify configuration:
|
|
137
|
+
```ts
|
|
138
|
+
// Nuxt config file
|
|
139
|
+
import MyVuetifyModule from './modules/my-vuetify-module'
|
|
140
|
+
|
|
141
|
+
export default defineNuxtConfig({
|
|
142
|
+
modules: [MyVuetifyModule, 'vuetify-nuxt-module']
|
|
143
|
+
})
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
and your module will load your configuration via `vuetify:registerModule` Nuxt hook:
|
|
147
|
+
```ts
|
|
148
|
+
// modules/my-vuetify-module
|
|
149
|
+
export default defineNuxtModule({
|
|
150
|
+
setup(_options, nuxt) {
|
|
151
|
+
nuxt.hook('vuetify:registerModule', register => register({
|
|
152
|
+
moduleOptions: {
|
|
153
|
+
/* module specific options */
|
|
154
|
+
},
|
|
155
|
+
vuetifyOptions: {
|
|
156
|
+
/* vuetify options */
|
|
157
|
+
},
|
|
158
|
+
}))
|
|
159
|
+
},
|
|
160
|
+
})
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## 😃 Font Icons
|
|
164
|
+
|
|
165
|
+
This module supports the following font icons libraries:
|
|
166
|
+
- [Material Design Icons](https://materialdesignicons.com/)
|
|
167
|
+
- [Material Icons](https://fonts.google.com/icons)
|
|
168
|
+
- [Font Awesome 4](https://fontawesome.com/v4.7.0/)
|
|
169
|
+
- [Font Awesome 5](https://fontawesome.com/)
|
|
170
|
+
|
|
171
|
+
By default, the module will use the `mdi` font icon library. You can change it by setting the `defaultSet` option to:
|
|
172
|
+
- `mdi` for [Material Design Icons](https://materialdesignicons.com/)
|
|
173
|
+
- `md` for [Material Icons](https://fonts.google.com/icons)
|
|
174
|
+
- `fa4` for [Font Awesome 4](https://fontawesome.com/v4.7.0/)
|
|
175
|
+
- `fa` for [Font Awesome 5](https://fontawesome.com)
|
|
176
|
+
|
|
177
|
+
To configure a font icon you only need to specify the default set:
|
|
178
|
+
```ts
|
|
179
|
+
// Nuxt config file
|
|
180
|
+
import { defineNuxtConfig } from 'nuxt/config'
|
|
181
|
+
|
|
182
|
+
export default defineNuxtConfig({
|
|
183
|
+
modules: ['vuetify-nuxt-module'],
|
|
184
|
+
vuetify: {
|
|
185
|
+
vuetifyOptions: {
|
|
186
|
+
icons: {
|
|
187
|
+
defaultSet: 'mdi'
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
})
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
The module will use the CDN version of the font icon. If you want to use the local version, you only need to install the corresponding dependency, the module will auto-detect it and will switch to register the font to use the local version.
|
|
195
|
+
|
|
196
|
+
The CDN used for each font icon library, you can use the `cdn` option to change it:
|
|
197
|
+
- [CDN for Material Design Icons (mdi)](https://cdn.jsdelivr.net/npm/@mdi/font@5.x/css/materialdesignicons.min.css)
|
|
198
|
+
- [CDN for Material Icons (md)](https://fonts.googleapis.com/css?family=Material+Icons)
|
|
199
|
+
- [CDN for Font Awesome 4 (fa4)](https://cdn.jsdelivr.net/npm/font-awesome@4.x/css/font-awesome.min.css)
|
|
200
|
+
- [CDN for Font Awesome 5 (fa)](https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@latest/css/all.min.css)
|
|
201
|
+
|
|
202
|
+
To change the CDN for a font icon library you only need to specify the `cdn` option:
|
|
203
|
+
```ts
|
|
204
|
+
// Nuxt config file
|
|
205
|
+
import { defineNuxtConfig } from 'nuxt/config'
|
|
206
|
+
|
|
207
|
+
export default defineNuxtConfig({
|
|
208
|
+
modules: ['vuetify-nuxt-module'],
|
|
209
|
+
vuetify: {
|
|
210
|
+
vuetifyOptions: {
|
|
211
|
+
icons: {
|
|
212
|
+
defaultSet: 'mdi',
|
|
213
|
+
sets: [{
|
|
214
|
+
name: 'mdi',
|
|
215
|
+
cdn: 'https://cdn.jsdelivr.net/npm/@mdi/font@latest/css/materialdesignicons'
|
|
216
|
+
}]
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
})
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
## 🎭 SVG Icons
|
|
224
|
+
|
|
225
|
+
This module supports the following SVG icon libraries:
|
|
226
|
+
- [@mdi/js](https://www.npmjs.com/package/@mdi/js)
|
|
227
|
+
- [@fortawesome/fontawesome-svg-core](https://www.npmjs.com/package/@fortawesome/fontawesome-svg-core)
|
|
228
|
+
|
|
229
|
+
We're trying to figure out how to include the following SVG icon libraries:
|
|
230
|
+
- [Nuxt Icon](https://github.com/nuxt-modules/icon)
|
|
231
|
+
- [unplugin-icons](https://github.com/antfu/unplugin-icons)
|
|
232
|
+
|
|
233
|
+
### mdi-svg
|
|
234
|
+
|
|
235
|
+
You only need to add `@mdi/js` dependency to your project and configure the default set:
|
|
236
|
+
```ts
|
|
237
|
+
// Nuxt config file
|
|
238
|
+
import { defineNuxtConfig } from 'nuxt/config'
|
|
239
|
+
|
|
240
|
+
export default defineNuxtConfig({
|
|
241
|
+
modules: ['vuetify-nuxt-module'],
|
|
242
|
+
vuetify: {
|
|
243
|
+
vuetifyOptions: {
|
|
244
|
+
icons: {
|
|
245
|
+
defaultSet: 'mdi-svg'
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
})
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
You can also add icon aliases:
|
|
253
|
+
```ts
|
|
254
|
+
// Nuxt config file
|
|
255
|
+
import { defineNuxtConfig } from 'nuxt/config'
|
|
256
|
+
|
|
257
|
+
export default defineNuxtConfig({
|
|
258
|
+
modules: ['vuetify-nuxt-module'],
|
|
259
|
+
vuetify: {
|
|
260
|
+
vuetifyOptions: {
|
|
261
|
+
icons: {
|
|
262
|
+
defaultSet: 'mdi-svg',
|
|
263
|
+
svg: {
|
|
264
|
+
mdi: {
|
|
265
|
+
aliases: {
|
|
266
|
+
account: 'mdiAccount'
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
})
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
### fa-svg
|
|
277
|
+
|
|
278
|
+
You only need to add `@fortawesome/fontawesome-svg-core`, `@fortawesome/vue-fontawesome` and `@fortawesome/free-solid-svg-icons` dependencies to your project and configure the default set:
|
|
279
|
+
```ts
|
|
280
|
+
// Nuxt config file
|
|
281
|
+
import { defineNuxtConfig } from 'nuxt/config'
|
|
282
|
+
|
|
283
|
+
export default defineNuxtConfig({
|
|
284
|
+
modules: ['vuetify-nuxt-module'],
|
|
285
|
+
vuetify: {
|
|
286
|
+
vuetifyOptions: {
|
|
287
|
+
icons: {
|
|
288
|
+
defaultSet: 'fa-svg'
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
})
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
You can also add more libraries and install them in your project, the module will register them for you (this is the default configuration using the above configuration):
|
|
296
|
+
```ts
|
|
297
|
+
// Nuxt config file
|
|
298
|
+
import { defineNuxtConfig } from 'nuxt/config'
|
|
299
|
+
|
|
300
|
+
export default defineNuxtConfig({
|
|
301
|
+
modules: ['vuetify-nuxt-module'],
|
|
302
|
+
vuetify: {
|
|
303
|
+
vuetifyOptions: {
|
|
304
|
+
icons: {
|
|
305
|
+
defaultSet: 'fa-svg',
|
|
306
|
+
svg: {
|
|
307
|
+
fa: {
|
|
308
|
+
libraries: [
|
|
309
|
+
[/* default export? */ false, /* export name */ 'fas', /* library */ '@fortawesome/free-solid-svg-icons']
|
|
310
|
+
]
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
})
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
## 📦 Multiple Icon Sets
|
|
320
|
+
|
|
321
|
+
You can register multiple icons sets adding them to the sets array, don't forget to add the default set, otherwise 'mdi' will be used:
|
|
322
|
+
```ts
|
|
323
|
+
// Nuxt config file
|
|
324
|
+
import { defineNuxtConfig } from 'nuxt/config'
|
|
325
|
+
|
|
326
|
+
export default defineNuxtConfig({
|
|
327
|
+
modules: ['vuetify-nuxt-module'],
|
|
328
|
+
vuetify: {
|
|
329
|
+
vuetifyOptions: {
|
|
330
|
+
icons: {
|
|
331
|
+
defaultSet: 'mdi',
|
|
332
|
+
sets: ['mdi', 'fa']
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
})
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
## 🌍 I18n support
|
|
340
|
+
|
|
341
|
+
> Requires latest [@nuxtjs/i18n](https://v8.i18n.nuxtjs.org/) Nuxt module: `8.0.0.beta.13`.
|
|
342
|
+
|
|
343
|
+
You can check the playground folder, you can run it using single or multiple json files per locale:
|
|
344
|
+
- for single file per locale: run from root folder `pnpm install && nr dev:prepare && nr dev`
|
|
345
|
+
- for multiple files per locale: run from root folder `pnpm install && nr dev:prepare:multiple-json && nr dev:multiple-json`
|
|
346
|
+
|
|
347
|
+
## 📆 Date components support
|
|
348
|
+
|
|
349
|
+
Right now you can only use Vuetify adapter, there is a bug and will not work, I'm working on it: https://github.com/userquin/vuetify-nuxt-module/pull/9#issuecomment-1620023814.
|
|
350
|
+
|
|
351
|
+
To use Vuetify components [that require date functionality](https://vuetifyjs.com/en/features/dates/):
|
|
352
|
+
- install one of the [@date-io](https://github.com/dmtrKovalenko/date-io#projects) adapters (optional)
|
|
353
|
+
- configure the date entry in your Vuetify configuration:
|
|
354
|
+
```ts
|
|
355
|
+
vuetifyOptions: {
|
|
356
|
+
date: {
|
|
357
|
+
adapter: 'vuetify' // 'vuetify' | 'date-fns' | 'moment' | 'luxon' | 'dayjs' | 'js-joda' | 'date-fns-jalali' | 'jalaali' | 'hijri' | 'custom'
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
If you also have `@nuxtjs/i18n` module installed, `vuetifyOptions.date.locale` will be automatically configured, beware, the configured `locale` entry will be ignored.
|
|
363
|
+
|
|
364
|
+
If you want to use a custom date adapter, you can configure it using `vuetifyOptions.date.adapter = 'custom'`, and then:
|
|
365
|
+
- add a Nuxt Plugin and add the `vuetify:configuration` hook to configure your Vuetify options
|
|
366
|
+
- you can import the `virtual:vuetify-date-configuration` module, you will have access to the configuration:
|
|
367
|
+
```ts
|
|
368
|
+
import { adapter, dateConfiguration, i18n } from 'virtual:vuetify-date-configuration'
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
Check out [vuetify-date](https://github.com/userquin/vuetify-nuxt-module/blob/main/src/runtime/plugins/vuetify-date.mts) plugin for an example of a custom date adapter and how to access to the configuration.
|
|
372
|
+
|
|
373
|
+
## ⚙️ Auto-Import Vuetify Composables
|
|
374
|
+
|
|
375
|
+
No more Vuetify composables manual imports, auto import is enabled by default:
|
|
376
|
+
- [useDate](https://vuetifyjs.com/en/api/use-date/)
|
|
377
|
+
- [useDefaults](https://vuetifyjs.com/en/api/use-defaults/)
|
|
378
|
+
- [useDisplay](https://vuetifyjs.com/en/api/use-display/)
|
|
379
|
+
- [useLayout](https://vuetifyjs.com/en/api/use-layout/)
|
|
380
|
+
- [useLocale](https://vuetifyjs.com/en/api/use-locale/)
|
|
381
|
+
- [useRtl](https://vuetifyjs.com/en/api/use-rtl/)
|
|
382
|
+
- [useTheme](https://vuetifyjs.com/en/api/use-theme/)
|
|
383
|
+
|
|
384
|
+
You can disable auto-import using `moduleOptions.importComposables: false`.
|
|
385
|
+
|
|
386
|
+
If you are using another composables that collide with the Vuetify ones, enable `moduleOptions.prefixComposables: true` to prefix them with `V`:
|
|
387
|
+
- `useLocale` => `useVLocale`
|
|
388
|
+
- `useDefaults` => `useVDefaults`
|
|
389
|
+
- `useDisplay` => `useVDisplay`
|
|
390
|
+
- `useLayout` => `useVLayout`
|
|
391
|
+
- `useRtl` => `useVRtl`
|
|
392
|
+
- `useTheme` => `useVTheme`
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
## 🎨 Vuetify Blueprints
|
|
396
|
+
|
|
397
|
+
The module supports Vuetify Blueprints, just add it to the `vuetifyOptions.blueprint` module option, but with some limitations:
|
|
398
|
+
- `ssr` will be ignored, this flag can be only configured internally by the module via the Nuxt ssr option
|
|
399
|
+
- `components` will be ignored, configure them using the `vuetifyOptions.components` module option
|
|
400
|
+
- `directives` will be ignored, configure them using the `vuetifyOptions.directives` module option
|
|
401
|
+
- `locale` will be ignored, configure it using the `vuetifyOptions.locale` module option
|
|
402
|
+
- `date` will be ignored, configure it using the `vuetifyOptions.date` module option
|
|
403
|
+
- `icons` will be ignored, configure it using the `vuetifyOptions.icons` module option
|
|
404
|
+
|
|
405
|
+
## 👀 Full config
|
|
406
|
+
|
|
407
|
+
Check out the type declaration [src/types.ts](https://github.com/userquin/vuetify-nuxt-module/blob/main/src/types.ts).
|
|
408
|
+
|
|
409
|
+
The virtual modules can be found in [configuration.d.ts](https://github.com/userquin/vuetify-nuxt-module/blob/main/configuration.d.ts) file.
|
|
410
|
+
|
|
411
|
+
## 📄 License
|
|
412
|
+
|
|
413
|
+
[MIT](https://github.com/userquin/vuetify-nuxt-module/blob/main/LICENSE) License © 2023-PRESENT [Joaquín Sánchez](https://github.com/userquin)
|
package/dist/module.d.ts
CHANGED
|
@@ -174,6 +174,14 @@ interface ModuleOptions {
|
|
|
174
174
|
*/
|
|
175
175
|
vuetifyOptions?: VOptions;
|
|
176
176
|
}
|
|
177
|
+
declare module '@nuxt/schema' {
|
|
178
|
+
interface NuxtConfig {
|
|
179
|
+
vuetify?: ModuleOptions;
|
|
180
|
+
}
|
|
181
|
+
interface NuxtHooks {
|
|
182
|
+
'vuetify:registerModule': (registerModule: (config: ModuleOptions) => void) => void;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
177
185
|
declare module '#app' {
|
|
178
186
|
interface NuxtApp {
|
|
179
187
|
$vuetify: ReturnType<typeof vuetify['createVuetify']>;
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { utimes, readFile } from 'node:fs/promises';
|
|
2
|
-
import { useLogger, defineNuxtModule, createResolver, hasNuxtModule, extendWebpackConfig, addImports, addPlugin } from '@nuxt/kit';
|
|
2
|
+
import { useLogger, defineNuxtModule, isNuxt3, getNuxtVersion, createResolver, hasNuxtModule, extendWebpackConfig, addImports, addPlugin } from '@nuxt/kit';
|
|
3
3
|
import defu from 'defu';
|
|
4
|
-
import { isPackageExists } from 'local-pkg';
|
|
5
4
|
import { resolveVuetifyBase, normalizePath, writeStyles, cacheDir } from '@vuetify/loader-shared';
|
|
6
5
|
import { isAbsolute, join, relative } from 'pathe';
|
|
7
6
|
import { normalizePath as normalizePath$1 } from 'vite';
|
|
7
|
+
import { isPackageExists } from 'local-pkg';
|
|
8
8
|
|
|
9
|
-
const version = "0.4.
|
|
9
|
+
const version = "0.4.4";
|
|
10
10
|
|
|
11
11
|
function isSubdir(root, test) {
|
|
12
12
|
const relative$1 = relative(root, test);
|
|
@@ -545,6 +545,41 @@ function toKebabCase(str = "") {
|
|
|
545
545
|
}
|
|
546
546
|
toKebabCase.cache = /* @__PURE__ */ new Map();
|
|
547
547
|
|
|
548
|
+
function detectDate() {
|
|
549
|
+
const result = [];
|
|
550
|
+
return result;
|
|
551
|
+
}
|
|
552
|
+
function cleanupBlueprint(vuetifyOptions) {
|
|
553
|
+
const blueprint = vuetifyOptions.blueprint;
|
|
554
|
+
if (blueprint) {
|
|
555
|
+
delete blueprint.ssr;
|
|
556
|
+
delete blueprint.components;
|
|
557
|
+
delete blueprint.directives;
|
|
558
|
+
delete blueprint.locale;
|
|
559
|
+
delete blueprint.date;
|
|
560
|
+
delete blueprint.icons;
|
|
561
|
+
vuetifyOptions.blueprint = blueprint;
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
async function mergeVuetifyModules(options, nuxt) {
|
|
566
|
+
const moduleOptions = [];
|
|
567
|
+
await nuxt.callHook("vuetify:registerModule", (layerModuleOptions) => moduleOptions.push(layerModuleOptions));
|
|
568
|
+
if (nuxt.options._layers.length > 1) {
|
|
569
|
+
nuxt.options._layers.forEach((layer, idx) => {
|
|
570
|
+
if (idx > 0 && layer.config.vuetify)
|
|
571
|
+
moduleOptions.push(layer.config.vuetify);
|
|
572
|
+
});
|
|
573
|
+
}
|
|
574
|
+
moduleOptions.push(options);
|
|
575
|
+
if (moduleOptions.length > 1) {
|
|
576
|
+
const [base, ...rest] = moduleOptions;
|
|
577
|
+
return defu(base, ...rest);
|
|
578
|
+
} else {
|
|
579
|
+
return options;
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
|
|
548
583
|
const CONFIG_KEY = "vuetify";
|
|
549
584
|
const logger = useLogger(`nuxt:${CONFIG_KEY}`);
|
|
550
585
|
const module = defineNuxtModule({
|
|
@@ -565,9 +600,12 @@ const module = defineNuxtModule({
|
|
|
565
600
|
styles: true
|
|
566
601
|
}
|
|
567
602
|
}),
|
|
568
|
-
setup(options, nuxt) {
|
|
603
|
+
async setup(options, nuxt) {
|
|
569
604
|
var _a, _b;
|
|
605
|
+
if (!isNuxt3(nuxt))
|
|
606
|
+
logger.error(`Cannot support nuxt version: ${getNuxtVersion(nuxt)}`);
|
|
570
607
|
const resolver = createResolver(import.meta.url);
|
|
608
|
+
options = await mergeVuetifyModules(options, nuxt);
|
|
571
609
|
const { vuetifyOptions = {} } = options;
|
|
572
610
|
const {
|
|
573
611
|
directives = false,
|
|
@@ -696,19 +734,19 @@ const module = defineNuxtModule({
|
|
|
696
734
|
});
|
|
697
735
|
const runtimeDir = resolver.resolve("./runtime");
|
|
698
736
|
addPlugin({
|
|
699
|
-
src: resolver.resolve(runtimeDir,
|
|
737
|
+
src: resolver.resolve(runtimeDir, `plugins/vuetify${i18n ? "-sync" : ""}`)
|
|
700
738
|
});
|
|
701
739
|
addPlugin({
|
|
702
|
-
src: resolver.resolve(runtimeDir, "plugins/vuetify-icons
|
|
740
|
+
src: resolver.resolve(runtimeDir, "plugins/vuetify-icons")
|
|
703
741
|
});
|
|
704
742
|
if (i18n) {
|
|
705
743
|
addPlugin({
|
|
706
|
-
src: resolver.resolve(runtimeDir, "plugins/vuetify-i18n
|
|
744
|
+
src: resolver.resolve(runtimeDir, "plugins/vuetify-i18n")
|
|
707
745
|
});
|
|
708
746
|
}
|
|
709
747
|
if (dateAdapter) {
|
|
710
748
|
addPlugin({
|
|
711
|
-
src: resolver.resolve(runtimeDir, "plugins/vuetify-date
|
|
749
|
+
src: resolver.resolve(runtimeDir, "plugins/vuetify-date")
|
|
712
750
|
});
|
|
713
751
|
}
|
|
714
752
|
}
|
|
@@ -721,21 +759,5 @@ function checkVuetifyPlugins(config) {
|
|
|
721
759
|
if (plugin)
|
|
722
760
|
throw new Error("Remove vite-plugin-vuetify plugin from Vite Plugins entry in Nuxt config file!");
|
|
723
761
|
}
|
|
724
|
-
function detectDate() {
|
|
725
|
-
const result = [];
|
|
726
|
-
return result;
|
|
727
|
-
}
|
|
728
|
-
function cleanupBlueprint(vuetifyOptions) {
|
|
729
|
-
const blueprint = vuetifyOptions.blueprint;
|
|
730
|
-
if (blueprint) {
|
|
731
|
-
delete blueprint.ssr;
|
|
732
|
-
delete blueprint.components;
|
|
733
|
-
delete blueprint.directives;
|
|
734
|
-
delete blueprint.locale;
|
|
735
|
-
delete blueprint.date;
|
|
736
|
-
delete blueprint.icons;
|
|
737
|
-
vuetifyOptions.blueprint = blueprint;
|
|
738
|
-
}
|
|
739
|
-
}
|
|
740
762
|
|
|
741
763
|
export { module as default };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { configureVuetify } from "./config.mjs";
|
|
2
|
+
import { defineNuxtPlugin } from "#imports";
|
|
3
|
+
import { useNuxtApp } from "#app";
|
|
4
|
+
export default defineNuxtPlugin({
|
|
5
|
+
name: "vuetify:configuration:plugin",
|
|
6
|
+
enforce: "post",
|
|
7
|
+
// i18n runtime plugin is async
|
|
8
|
+
parallel: false,
|
|
9
|
+
setup() {
|
|
10
|
+
useNuxtApp().hook("app:created", configureVuetify);
|
|
11
|
+
}
|
|
12
|
+
});
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vuetify-nuxt-module",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.4",
|
|
5
5
|
"packageManager": "pnpm@8.6.7",
|
|
6
|
-
"description": "Zero-Config Nuxt Module for Vuetify
|
|
6
|
+
"description": "Zero-Config Nuxt Module for Vuetify",
|
|
7
7
|
"author": "userquin <userquin@gmail.com>",
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"homepage": "https://github.com/userquin/vuetify-nuxt-module#readme",
|