vuetify-nuxt-module 0.4.0 → 0.4.2

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 CHANGED
@@ -1,321 +1,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
- - 🦾 **Type Strong**: written in [TypeScript](https://www.typescriptlang.org/)
45
-
46
- ## 📦 Install
47
-
48
- > Requires Vite, will not work with Webpack
49
-
50
- ```bash
51
- npm i vuetify-nuxt-module -D
52
-
53
- # yarn
54
- yarn add vuetify-nuxt-module -D
55
-
56
- # pnpm
57
- pnpm add vuetify-nuxt-module -D
58
- ```
59
-
60
- [![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/userquin/vuetify-nuxt-module)
61
-
62
- ## 🦄 Usage
63
-
64
- > `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.
65
-
66
- Add `vuetify-nuxt-module` module to `nuxt.config.ts` and configure it:
67
-
68
- ```ts
69
- // nuxt.config.ts
70
- import { defineNuxtConfig } from 'nuxt/config'
71
-
72
- export default defineNuxtConfig({
73
- modules: [
74
- 'vuetify-nuxt-module'
75
- ],
76
- vuetify: {
77
- moduleOptions: {
78
- /* module specific options */
79
- },
80
- vuetifyOptions: {
81
- /* vuetify options */
82
- }
83
- }
84
- })
85
- ```
86
-
87
- ## 🔥 Components, Directives, Lab Components
88
-
89
- The module will enable automatic tree shaking for Vuetify components.
90
-
91
- 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):
92
- - the module will provide auto-import support via `vuetify/dist/json/importMap.json` json file and Nuxt `components:extend` hook.
93
- - 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.
94
-
95
- ### Global Components
96
-
97
- If you need to add some global component, use `vuetifyOptions.components` module option, it has been declared properly to have better DX.
98
-
99
- Check the [components definition](https://github.com/userquin/vuetify-nuxt-module/blob/main/src/types.ts#L80-L81).
100
-
101
- 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.
102
-
103
- ### Directives
104
-
105
- 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.
106
-
107
- 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).
108
-
109
- ### Labs Components
110
-
111
- 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.
112
-
113
- 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).
114
-
115
- ## 😃 Font Icons
116
-
117
- This module supports the following font icons libraries:
118
- - [Material Design Icons](https://materialdesignicons.com/)
119
- - [Material Icons](https://fonts.google.com/icons)
120
- - [Font Awesome 4](https://fontawesome.com/v4.7.0/)
121
- - [Font Awesome 5](https://fontawesome.com/)
122
-
123
- By default, the module will use the `mdi` font icon library. You can change it by setting the `defaultSet` option to:
124
- - `mdi` for [Material Design Icons](https://materialdesignicons.com/)
125
- - `md` for [Material Icons](https://fonts.google.com/icons)
126
- - `fa4` for [Font Awesome 4](https://fontawesome.com/v4.7.0/)
127
- - `fa` for [Font Awesome 5](https://fontawesome.com)
128
-
129
- To configure a font icon you only need to specify the default set:
130
- ```ts
131
- vuetify: {
132
- vuetifyOptions: {
133
- icons: {
134
- defaultSet: 'mdi'
135
- }
136
- }
137
- }
138
- ```
139
-
140
- 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.
141
-
142
- The CDN used for each font icon library, you can use the `cdn` option to change it:
143
- - [CDN for Material Design Icons (mdi)](https://cdn.jsdelivr.net/npm/@mdi/font@5.x/css/materialdesignicons.min.css)
144
- - [CDN for Material Icons (md)](https://fonts.googleapis.com/css?family=Material+Icons)
145
- - [CDN for Font Awesome 4 (fa4)](https://cdn.jsdelivr.net/npm/font-awesome@4.x/css/font-awesome.min.css)
146
- - [CDN for Font Awesome 5 (fa)](https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@latest/css/all.min.css)
147
-
148
- To change the CDN for a font icon library you only need to specify the `cdn` option:
149
- ```ts
150
- vuetify: {
151
- vuetifyOptions: {
152
- icons: {
153
- defaultSet: 'mdi'
154
- sets: [{
155
- name: 'mdi',
156
- cdn: 'https://cdn.jsdelivr.net/npm/@mdi/font@latest/css/materialdesignicons'
157
- }]
158
- }
159
- }
160
- }
161
- ```
162
-
163
- ## 🎭 SVG Icons
164
-
165
- This module supports the following SVG icon libraries:
166
- - [@mdi/js](https://www.npmjs.com/package/@mdi/js)
167
- - [@fortawesome/fontawesome-svg-core](https://www.npmjs.com/package/@fortawesome/fontawesome-svg-core)
168
-
169
- We're trying to figure out how to include the following SVG icon libraries:
170
- - [Nuxt Icon](https://github.com/nuxt-modules/icon)
171
- - [unplugin-icons](https://github.com/antfu/unplugin-icons)
172
-
173
- ### mdi-svg
174
-
175
- You only need to add `@mdi/js` dependency to your project and configure the default set:
176
- ```ts
177
- vuetify: {
178
- vuetifyOptions: {
179
- icons: {
180
- defaultSet: 'mdi-svg'
181
- }
182
- }
183
- }
184
- ```
185
-
186
- You can also add icon aliases:
187
- ```ts
188
- vuetify: {
189
- vuetifyOptions: {
190
- icons: {
191
- defaultSet: 'mdi-svg',
192
- svg: {
193
- mdi: {
194
- aliases: {
195
- account: 'mdiAccount'
196
- }
197
- }
198
- }
199
- }
200
- }
201
- }
202
- ```
203
-
204
- ### fa-svg
205
-
206
- 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:
207
- ```ts
208
- vuetify: {
209
- vuetifyOptions: {
210
- icons: {
211
- defaultSet: 'fa-svg'
212
- }
213
- }
214
- }
215
- ```
216
-
217
- 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):
218
- ```ts
219
- vuetify: {
220
- vuetifyOptions: {
221
- icons: {
222
- defaultSet: 'fa-svg',
223
- svg: {
224
- fa: {
225
- libraries: [/* default export? */ false, /* export name */ 'fas', /* library */ '@fortawesome/free-solid-svg-icons']
226
- }
227
- }
228
- }
229
- }
230
- }
231
- ```
232
-
233
- ## 📦 Multiple Icon Sets
234
-
235
- 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:
236
- ```ts
237
- vuetify: {
238
- vuetifyOptions: {
239
- icons: {
240
- defaultSet: 'mdi'
241
- sets: ['mdi', 'fa']
242
- }
243
- }
244
- }
245
- ```
246
-
247
- ## 🌍 I18n support
248
-
249
- > Requires latest [@nuxtjs/i18n](https://v8.i18n.nuxtjs.org/) Nuxt module: `8.0.0.beta.13`.
250
-
251
- You can check the playground folder, you can run it using single or multiple json files per locale:
252
- - for single file per locale: run from root folder `pnpm install && nr dev:prepare && nr dev`
253
- - for multiple files per locale: run from root folder `pnpm install && nr dev:prepare:multiple-json && nr dev:multiple-json`
254
-
255
- ## 📆 Date components support
256
-
257
- 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.
258
-
259
- To use Vuetify components [that require date functionality](https://vuetifyjs.com/en/features/dates/):
260
- - install one of the [@date-io](https://github.com/dmtrKovalenko/date-io#projects) adapters (optional)
261
- - configure the date entry in your Vuetify configuration:
262
- ```ts
263
- vuetifyOptions: {
264
- date: {
265
- adapter: 'vuetify' // 'vuetify' | 'date-fns' | 'moment' | 'luxon' | 'dayjs' | 'js-joda' | 'date-fns-jalali' | 'jalaali' | 'hijri' | 'custom'
266
- }
267
- }
268
- ```
269
-
270
- If you also have `@nuxtjs/i18n` module installed, `vuetifyOptions.date.locale` will be automatically configured, beware, the configured `locale` entry will be ignored.
271
-
272
- If you want to use a custom date adapter, you can configure it using `vuetifyOptions.date.adapter = 'custom'`, and then:
273
- - add a Nuxt Plugin and add the `vuetify:configuration` hook to configure your Vuetify options
274
- - you can import the `virtual:vuetify-date-configuration` module, you will have access to the configuration:
275
- ```ts
276
- import { adapter, dateConfiguration, i18n } from 'virtual:vuetify-date-configuration'
277
- ```
278
-
279
- 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.
280
-
281
- ## ⚙️ Auto-Import Vuetify Composables
282
-
283
- No more Vuetify composables manual imports, auto import is enabled by default:
284
- - [useDate](https://vuetifyjs.com/en/api/use-date/)
285
- - [useDefaults](https://vuetifyjs.com/en/api/use-defaults/)
286
- - [useDisplay](https://vuetifyjs.com/en/api/use-display/)
287
- - [useLayout](https://vuetifyjs.com/en/api/use-layout/)
288
- - [useLocale](https://vuetifyjs.com/en/api/use-locale/)
289
- - [useRtl](https://vuetifyjs.com/en/api/use-rtl/)
290
- - [useTheme](https://vuetifyjs.com/en/api/use-theme/)
291
-
292
- You can disable auto-import using `moduleOptions.importComposables: false`.
293
-
294
- If you are using another composables that collide with the Vuetify ones, enable `moduleOptions.prefixComposables: true` to prefix them with `V`:
295
- - `useLocale` => `useVLocale`
296
- - `useDefaults` => `useVDefaults`
297
- - `useDisplay` => `useVDisplay`
298
- - `useLayout` => `useVLayout`
299
- - `useRtl` => `useVRtl`
300
- - `useTheme` => `useVTheme`
301
-
302
-
303
- ## 🎨 Vuetify Blueprints
304
-
305
- The module supports Vuetify Blueprints, just add it to the `vuetifyOptions.blueprint` module option, but with some limitations:
306
- - `ssr` will be ignored, this flag can be only configured internally by the module via the Nuxt ssr option.
307
- - `components` will be ignored, configure them using the `vuetifyOptions.components` module option
308
- - `directives` will be ignored, configure them using the `vuetifyOptions.directives` module option.
309
- - `locale` will be ignored, configure it using the `vuetifyOptions.locale` module option.
310
- - `date` will be ignored, configure it using the `vuetifyOptions.date` module option.
311
- - `icons` will be ignored, configure it using the `vuetifyOptions.icons` module option.
312
-
313
- ## 👀 Full config
314
-
315
- Check out the type declaration [src/types.ts](https://github.com/userquin/vuetify-nuxt-module/blob/main/src/types.ts).
316
-
317
- The virtual modules can be found in [configuration.d.ts](https://github.com/userquin/vuetify-nuxt-module/blob/main/configuration.d.ts) file.
318
-
319
- ## 📄 License
320
-
321
- [MIT](https://github.com/userquin/vuetify-nuxt-module/blob/main/LICENSE) License &copy; 2023-PRESENT [Joaquín Sánchez](https://github.com/userquin)
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
+ - 🦾 **Type Strong**: written in [TypeScript](https://www.typescriptlang.org/)
45
+
46
+ ## 📦 Install
47
+
48
+ > Requires Vite, will not work with Webpack
49
+
50
+ ```bash
51
+ npm i vuetify-nuxt-module -D
52
+
53
+ # yarn
54
+ yarn add vuetify-nuxt-module -D
55
+
56
+ # pnpm
57
+ pnpm add vuetify-nuxt-module -D
58
+ ```
59
+
60
+ [![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/userquin/vuetify-nuxt-module)
61
+
62
+ ## 🦄 Usage
63
+
64
+ > `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.
65
+
66
+ Add `vuetify-nuxt-module` module to `nuxt.config.ts` and configure it:
67
+
68
+ ```ts
69
+ // Nuxt config file
70
+ import { defineNuxtConfig } from 'nuxt/config'
71
+
72
+ export default defineNuxtConfig({
73
+ modules: [
74
+ 'vuetify-nuxt-module'
75
+ ],
76
+ vuetify: {
77
+ moduleOptions: {
78
+ /* module specific options */
79
+ },
80
+ vuetifyOptions: {
81
+ /* vuetify options */
82
+ }
83
+ }
84
+ })
85
+ ```
86
+
87
+ ## 🔥 Components, Directives, Lab Components
88
+
89
+ The module will enable automatic tree shaking for Vuetify components.
90
+
91
+ 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):
92
+ - the module will provide auto-import support via `vuetify/dist/json/importMap.json` json file and Nuxt `components:extend` hook.
93
+ - 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.
94
+
95
+ ### Global Components
96
+
97
+ If you need to add some global component, use `vuetifyOptions.components` module option, it has been declared properly to have better DX.
98
+
99
+ Check the [components definition](https://github.com/userquin/vuetify-nuxt-module/blob/main/src/types.ts#L80-L81).
100
+
101
+ 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.
102
+
103
+ ### Directives
104
+
105
+ 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.
106
+
107
+ 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).
108
+
109
+ ### Labs Components
110
+
111
+ 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.
112
+
113
+ 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).
114
+
115
+ ## 😃 Font Icons
116
+
117
+ This module supports the following font icons libraries:
118
+ - [Material Design Icons](https://materialdesignicons.com/)
119
+ - [Material Icons](https://fonts.google.com/icons)
120
+ - [Font Awesome 4](https://fontawesome.com/v4.7.0/)
121
+ - [Font Awesome 5](https://fontawesome.com/)
122
+
123
+ By default, the module will use the `mdi` font icon library. You can change it by setting the `defaultSet` option to:
124
+ - `mdi` for [Material Design Icons](https://materialdesignicons.com/)
125
+ - `md` for [Material Icons](https://fonts.google.com/icons)
126
+ - `fa4` for [Font Awesome 4](https://fontawesome.com/v4.7.0/)
127
+ - `fa` for [Font Awesome 5](https://fontawesome.com)
128
+
129
+ To configure a font icon you only need to specify the default set:
130
+ ```ts
131
+ // Nuxt config file
132
+ import { defineNuxtConfig } from 'nuxt/config'
133
+
134
+ export default defineNuxtConfig({
135
+ modules: [
136
+ 'vuetify-nuxt-module'
137
+ ],
138
+ vuetify: {
139
+ vuetifyOptions: {
140
+ icons: {
141
+ defaultSet: 'mdi'
142
+ }
143
+ }
144
+ }
145
+ })
146
+ ```
147
+
148
+ 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.
149
+
150
+ The CDN used for each font icon library, you can use the `cdn` option to change it:
151
+ - [CDN for Material Design Icons (mdi)](https://cdn.jsdelivr.net/npm/@mdi/font@5.x/css/materialdesignicons.min.css)
152
+ - [CDN for Material Icons (md)](https://fonts.googleapis.com/css?family=Material+Icons)
153
+ - [CDN for Font Awesome 4 (fa4)](https://cdn.jsdelivr.net/npm/font-awesome@4.x/css/font-awesome.min.css)
154
+ - [CDN for Font Awesome 5 (fa)](https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@latest/css/all.min.css)
155
+
156
+ To change the CDN for a font icon library you only need to specify the `cdn` option:
157
+ ```ts
158
+ // Nuxt config file
159
+ import { defineNuxtConfig } from 'nuxt/config'
160
+
161
+ export default defineNuxtConfig({
162
+ modules: [
163
+ 'vuetify-nuxt-module'
164
+ ],
165
+ vuetify: {
166
+ vuetifyOptions: {
167
+ icons: {
168
+ defaultSet: 'mdi',
169
+ sets: [{
170
+ name: 'mdi',
171
+ cdn: 'https://cdn.jsdelivr.net/npm/@mdi/font@latest/css/materialdesignicons'
172
+ }]
173
+ }
174
+ }
175
+ }
176
+ })
177
+ ```
178
+
179
+ ## 🎭 SVG Icons
180
+
181
+ This module supports the following SVG icon libraries:
182
+ - [@mdi/js](https://www.npmjs.com/package/@mdi/js)
183
+ - [@fortawesome/fontawesome-svg-core](https://www.npmjs.com/package/@fortawesome/fontawesome-svg-core)
184
+
185
+ We're trying to figure out how to include the following SVG icon libraries:
186
+ - [Nuxt Icon](https://github.com/nuxt-modules/icon)
187
+ - [unplugin-icons](https://github.com/antfu/unplugin-icons)
188
+
189
+ ### mdi-svg
190
+
191
+ You only need to add `@mdi/js` dependency to your project and configure the default set:
192
+ ```ts
193
+ // Nuxt config file
194
+ import { defineNuxtConfig } from 'nuxt/config'
195
+
196
+ export default defineNuxtConfig({
197
+ modules: [
198
+ 'vuetify-nuxt-module'
199
+ ],
200
+ vuetify: {
201
+ vuetifyOptions: {
202
+ icons: {
203
+ defaultSet: 'mdi-svg'
204
+ }
205
+ }
206
+ }
207
+ })
208
+ ```
209
+
210
+ You can also add icon aliases:
211
+ ```ts
212
+ // Nuxt config file
213
+ import { defineNuxtConfig } from 'nuxt/config'
214
+
215
+ export default defineNuxtConfig({
216
+ modules: [
217
+ 'vuetify-nuxt-module'
218
+ ],
219
+ vuetify: {
220
+ vuetifyOptions: {
221
+ icons: {
222
+ defaultSet: 'mdi-svg',
223
+ svg: {
224
+ mdi: {
225
+ aliases: {
226
+ account: 'mdiAccount'
227
+ }
228
+ }
229
+ }
230
+ }
231
+ }
232
+ }
233
+ })
234
+ ```
235
+
236
+ ### fa-svg
237
+
238
+ 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:
239
+ ```ts
240
+ // Nuxt config file
241
+ import { defineNuxtConfig } from 'nuxt/config'
242
+
243
+ export default defineNuxtConfig({
244
+ modules: [
245
+ 'vuetify-nuxt-module'
246
+ ],
247
+ vuetify: {
248
+ vuetifyOptions: {
249
+ icons: {
250
+ defaultSet: 'fa-svg'
251
+ }
252
+ }
253
+ }
254
+ })
255
+ ```
256
+
257
+ 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):
258
+ ```ts
259
+ // Nuxt config file
260
+ import { defineNuxtConfig } from 'nuxt/config'
261
+
262
+ export default defineNuxtConfig({
263
+ modules: [
264
+ 'vuetify-nuxt-module'
265
+ ],
266
+ vuetify: {
267
+ vuetifyOptions: {
268
+ icons: {
269
+ defaultSet: 'fa-svg',
270
+ svg: {
271
+ fa: {
272
+ libraries: [
273
+ [/* default export? */ false, /* export name */ 'fas', /* library */ '@fortawesome/free-solid-svg-icons']
274
+ ]
275
+ }
276
+ }
277
+ }
278
+ }
279
+ }
280
+ })
281
+ ```
282
+
283
+ ## 📦 Multiple Icon Sets
284
+
285
+ 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:
286
+ ```ts
287
+ // Nuxt config file
288
+ import { defineNuxtConfig } from 'nuxt/config'
289
+
290
+ export default defineNuxtConfig({
291
+ modules: [
292
+ 'vuetify-nuxt-module'
293
+ ],
294
+ vuetify: {
295
+ vuetifyOptions: {
296
+ icons: {
297
+ defaultSet: 'mdi',
298
+ sets: ['mdi', 'fa']
299
+ }
300
+ }
301
+ }
302
+ })
303
+ ```
304
+
305
+ ## 🌍 I18n support
306
+
307
+ > Requires latest [@nuxtjs/i18n](https://v8.i18n.nuxtjs.org/) Nuxt module: `8.0.0.beta.13`.
308
+
309
+ You can check the playground folder, you can run it using single or multiple json files per locale:
310
+ - for single file per locale: run from root folder `pnpm install && nr dev:prepare && nr dev`
311
+ - for multiple files per locale: run from root folder `pnpm install && nr dev:prepare:multiple-json && nr dev:multiple-json`
312
+
313
+ ## 📆 Date components support
314
+
315
+ 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.
316
+
317
+ To use Vuetify components [that require date functionality](https://vuetifyjs.com/en/features/dates/):
318
+ - install one of the [@date-io](https://github.com/dmtrKovalenko/date-io#projects) adapters (optional)
319
+ - configure the date entry in your Vuetify configuration:
320
+ ```ts
321
+ vuetifyOptions: {
322
+ date: {
323
+ adapter: 'vuetify' // 'vuetify' | 'date-fns' | 'moment' | 'luxon' | 'dayjs' | 'js-joda' | 'date-fns-jalali' | 'jalaali' | 'hijri' | 'custom'
324
+ }
325
+ }
326
+ ```
327
+
328
+ If you also have `@nuxtjs/i18n` module installed, `vuetifyOptions.date.locale` will be automatically configured, beware, the configured `locale` entry will be ignored.
329
+
330
+ If you want to use a custom date adapter, you can configure it using `vuetifyOptions.date.adapter = 'custom'`, and then:
331
+ - add a Nuxt Plugin and add the `vuetify:configuration` hook to configure your Vuetify options
332
+ - you can import the `virtual:vuetify-date-configuration` module, you will have access to the configuration:
333
+ ```ts
334
+ import { adapter, dateConfiguration, i18n } from 'virtual:vuetify-date-configuration'
335
+ ```
336
+
337
+ 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.
338
+
339
+ ## ⚙️ Auto-Import Vuetify Composables
340
+
341
+ No more Vuetify composables manual imports, auto import is enabled by default:
342
+ - [useDate](https://vuetifyjs.com/en/api/use-date/)
343
+ - [useDefaults](https://vuetifyjs.com/en/api/use-defaults/)
344
+ - [useDisplay](https://vuetifyjs.com/en/api/use-display/)
345
+ - [useLayout](https://vuetifyjs.com/en/api/use-layout/)
346
+ - [useLocale](https://vuetifyjs.com/en/api/use-locale/)
347
+ - [useRtl](https://vuetifyjs.com/en/api/use-rtl/)
348
+ - [useTheme](https://vuetifyjs.com/en/api/use-theme/)
349
+
350
+ You can disable auto-import using `moduleOptions.importComposables: false`.
351
+
352
+ If you are using another composables that collide with the Vuetify ones, enable `moduleOptions.prefixComposables: true` to prefix them with `V`:
353
+ - `useLocale` => `useVLocale`
354
+ - `useDefaults` => `useVDefaults`
355
+ - `useDisplay` => `useVDisplay`
356
+ - `useLayout` => `useVLayout`
357
+ - `useRtl` => `useVRtl`
358
+ - `useTheme` => `useVTheme`
359
+
360
+
361
+ ## 🎨 Vuetify Blueprints
362
+
363
+ The module supports Vuetify Blueprints, just add it to the `vuetifyOptions.blueprint` module option, but with some limitations:
364
+ - `ssr` will be ignored, this flag can be only configured internally by the module via the Nuxt ssr option.
365
+ - `components` will be ignored, configure them using the `vuetifyOptions.components` module option
366
+ - `directives` will be ignored, configure them using the `vuetifyOptions.directives` module option.
367
+ - `locale` will be ignored, configure it using the `vuetifyOptions.locale` module option.
368
+ - `date` will be ignored, configure it using the `vuetifyOptions.date` module option.
369
+ - `icons` will be ignored, configure it using the `vuetifyOptions.icons` module option.
370
+
371
+ ## 👀 Full config
372
+
373
+ Check out the type declaration [src/types.ts](https://github.com/userquin/vuetify-nuxt-module/blob/main/src/types.ts).
374
+
375
+ The virtual modules can be found in [configuration.d.ts](https://github.com/userquin/vuetify-nuxt-module/blob/main/configuration.d.ts) file.
376
+
377
+ ## 📄 License
378
+
379
+ [MIT](https://github.com/userquin/vuetify-nuxt-module/blob/main/LICENSE) License &copy; 2023-PRESENT [Joaquín Sánchez](https://github.com/userquin)
package/dist/module.json CHANGED
@@ -4,5 +4,5 @@
4
4
  "compatibility": {
5
5
  "nuxt": "^3.0.0"
6
6
  },
7
- "version": "0.4.0"
7
+ "version": "0.4.2"
8
8
  }
package/dist/module.mjs CHANGED
@@ -6,7 +6,7 @@ import { resolveVuetifyBase, normalizePath, writeStyles, cacheDir } from '@vueti
6
6
  import { isAbsolute, join, relative } from 'pathe';
7
7
  import { normalizePath as normalizePath$1 } from 'vite';
8
8
 
9
- const version = "0.4.0";
9
+ const version = "0.4.2";
10
10
 
11
11
  function isSubdir(root, test) {
12
12
  const relative$1 = relative(root, test);
@@ -232,13 +232,15 @@ export function vuetifyConfiguration() {
232
232
  components: new Set(components ? Array.isArray(components) ? components : [components] : []),
233
233
  labComponents: /* @__PURE__ */ new Set()
234
234
  };
235
- if (typeof directives === "boolean") {
236
- config.imports.push("import * as directives from 'vuetify/directives'");
237
- config.directives = "options.directives = directives";
238
- } else {
239
- const useDirectives = Array.isArray(directives) ? directives : [directives];
240
- config.imports.push(useDirectives.map((d) => `import { ${d} } from 'vuetify/directives/${d}'`).join("\n"));
241
- config.directives = `options.directives = {${useDirectives.join(",")}}`;
235
+ if (directives) {
236
+ if (typeof directives === "boolean") {
237
+ config.imports.push("import * as directives from 'vuetify/directives'");
238
+ config.directives = "options.directives = directives";
239
+ } else {
240
+ const useDirectives = Array.isArray(directives) ? directives : [directives];
241
+ config.imports.push(useDirectives.map((d) => `import { ${d} } from 'vuetify/directives/${d}'`).join("\n"));
242
+ config.directives = `options.directives = {${useDirectives.join(",")}}`;
243
+ }
242
244
  }
243
245
  config.imports.push(...Array.from(config.components).map((c) => `import {${c}} from 'vuetify/components/${c}'`));
244
246
  Object.entries(config.aliases).forEach(([key, component]) => {
@@ -606,8 +608,6 @@ const module = defineNuxtModule({
606
608
  dateAdapter = date[0];
607
609
  }
608
610
  }
609
- const runtimeDir = resolver.resolve("./runtime");
610
- nuxt.options.build.transpile.push(runtimeDir);
611
611
  nuxt.options.build.transpile.push(CONFIG_KEY);
612
612
  const icons = prepareIcons(logger, vuetifyOptions);
613
613
  (_a = nuxt.options).css ?? (_a.css = []);
@@ -694,20 +694,21 @@ const module = defineNuxtModule({
694
694
  ));
695
695
  }
696
696
  });
697
+ const runtimeDir = resolver.resolve("./runtime");
697
698
  addPlugin({
698
- src: resolver.resolve(runtimeDir, "plugins/vuetify.mts")
699
+ src: resolver.resolve(runtimeDir, "plugins/vuetify.ts")
699
700
  });
700
701
  addPlugin({
701
- src: resolver.resolve(runtimeDir, "plugins/vuetify-icons.mts")
702
+ src: resolver.resolve(runtimeDir, "plugins/vuetify-icons.ts")
702
703
  });
703
704
  if (i18n) {
704
705
  addPlugin({
705
- src: resolver.resolve(runtimeDir, "plugins/vuetify-i18n.mts")
706
+ src: resolver.resolve(runtimeDir, "plugins/vuetify-i18n.ts")
706
707
  });
707
708
  }
708
709
  if (dateAdapter) {
709
710
  addPlugin({
710
- src: resolver.resolve(runtimeDir, "plugins/vuetify-date.mts")
711
+ src: resolver.resolve(runtimeDir, "plugins/vuetify-date.ts")
711
712
  });
712
713
  }
713
714
  }
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,7 @@
1
+ import { configureDate } from "./date.mjs";
2
+ import { defineNuxtPlugin } from "#imports";
3
+ export default defineNuxtPlugin((nuxtApp) => {
4
+ nuxtApp.hook("vuetify:configuration", ({ vuetifyOptions }) => {
5
+ configureDate(vuetifyOptions);
6
+ });
7
+ });
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,7 @@
1
+ import { createAdapter } from "./i18n.mjs";
2
+ import { defineNuxtPlugin } from "#imports";
3
+ export default defineNuxtPlugin((nuxtApp) => {
4
+ nuxtApp.hook("vuetify:configuration", ({ vuetifyOptions }) => {
5
+ createAdapter(vuetifyOptions);
6
+ });
7
+ });
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,7 @@
1
+ import { configureIcons } from "./icons.mjs";
2
+ import { defineNuxtPlugin } from "#imports";
3
+ export default defineNuxtPlugin((nuxtApp) => {
4
+ nuxtApp.hook("vuetify:configuration", ({ vuetifyOptions }) => {
5
+ configureIcons(vuetifyOptions);
6
+ });
7
+ });
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,11 @@
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
+ parallel: false,
8
+ setup() {
9
+ useNuxtApp().hook("app:created", configureVuetify);
10
+ }
11
+ });
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "vuetify-nuxt-module",
3
3
  "type": "module",
4
- "version": "0.4.0",
5
- "packageManager": "pnpm@8.6.6",
4
+ "version": "0.4.2",
5
+ "packageManager": "pnpm@8.6.7",
6
6
  "description": "Zero-Config Nuxt Module for Vuetify ",
7
7
  "author": "userquin <userquin@gmail.com>",
8
8
  "license": "MIT",
@@ -114,4 +114,4 @@
114
114
  "installDependencies": false,
115
115
  "startCommand": "node .stackblitz.js && pnpm install && pnpm run dev"
116
116
  }
117
- }
117
+ }
@@ -1,8 +0,0 @@
1
- import { configureDate } from './date'
2
- import { defineNuxtPlugin } from '#imports'
3
-
4
- export default defineNuxtPlugin((nuxtApp) => {
5
- nuxtApp.hook('vuetify:configuration', ({ vuetifyOptions }) => {
6
- configureDate(vuetifyOptions)
7
- })
8
- })
@@ -1,8 +0,0 @@
1
- import { createAdapter } from './i18n'
2
- import { defineNuxtPlugin } from '#imports'
3
-
4
- export default defineNuxtPlugin((nuxtApp) => {
5
- nuxtApp.hook('vuetify:configuration', ({ vuetifyOptions }) => {
6
- createAdapter(vuetifyOptions)
7
- })
8
- })
@@ -1,8 +0,0 @@
1
- import { configureIcons } from './icons'
2
- import { defineNuxtPlugin } from '#imports'
3
-
4
- export default defineNuxtPlugin((nuxtApp) => {
5
- nuxtApp.hook('vuetify:configuration', ({ vuetifyOptions }) => {
6
- configureIcons(vuetifyOptions)
7
- })
8
- })
@@ -1,11 +0,0 @@
1
- import { configureVuetify } from './config'
2
- import { defineNuxtPlugin } from '#imports'
3
- import { useNuxtApp } from '#app'
4
-
5
- export default defineNuxtPlugin({
6
- name: 'vuetify:configuration:plugin',
7
- enforce: 'pre',
8
- setup() {
9
- useNuxtApp().hook('app:created', configureVuetify)
10
- },
11
- })