vuetify-nuxt-module 0.2.2 → 0.2.3

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,261 +1,287 @@
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
- - 📖 [**Documentation & guides**](README.md#-features) (WIP)
32
- - 👌 **Zero-Config**: sensible built-in default [Vuetify](https://vuetifyjs.com/) configuration for common use cases
33
- - 🔩 **Extensible**: expose the ability to customize the Vuetify configuration via [Nuxt Plugin Hooks](https://nuxt.com/docs/guide/going-further/hooks#usage-with-plugins)
34
- - **Fully Tree Shakable**: by default, only the needed Vuetify components are imported
35
- - 🛠️ **Versatile**: custom Vuetify [directives](https://vuetifyjs.com/en/getting-started/installation/#manual-steps) and [labs components](https://vuetifyjs.com/en/labs/introduction/) registration
36
- - **Configurable Styles**: configure your variables using [Vuetify SASS Variables](https://vuetifyjs.com/en/features/sass-variables/)
37
- - 💥 **SSR**: automatic SSR detection and configuration
38
- - 😃 **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
39
- - 🎭 **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
40
- - 📦 **Multiple Icon Sets**: register [multiple icon sets](https://vuetifyjs.com/en/features/icon-fonts/#multiple-icon-sets)
41
- - 🌍 **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
42
- - 📆 **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
43
- - 🎨 **Vuetify Blueprints (WIP)**: 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
- ## 😃 Font Icons
88
-
89
- This module supports the following font icons libraries:
90
- - [Material Design Icons](https://materialdesignicons.com/)
91
- - [Material Icons](https://fonts.google.com/icons)
92
- - [Font Awesome 4](https://fontawesome.com/v4.7.0/)
93
- - [Font Awesome 5](https://fontawesome.com/)
94
-
95
- By default, the module will use the `mdi` font icon library. You can change it by setting the `defaultSet` option to:
96
- - `mdi` for [Material Design Icons](https://materialdesignicons.com/)
97
- - `md` for [Material Icons](https://fonts.google.com/icons)
98
- - `fa4` for [Font Awesome 4](https://fontawesome.com/v4.7.0/)
99
- - `fa` for [Font Awesome 5](https://fontawesome.com)
100
-
101
- To configure a font icon you only need to specify the default set:
102
- ```ts
103
- vuetify: {
104
- vuetifyOptions: {
105
- icons: {
106
- defaultSet: 'mdi'
107
- }
108
- }
109
- }
110
- ```
111
-
112
- 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.
113
-
114
- The CDN used for each font icon library, you can use the `cdn` option to change it:
115
- - [CDN for Material Design Icons (mdi)](https://cdn.jsdelivr.net/npm/@mdi/font@5.x/css/materialdesignicons.min.css)
116
- - [CDN for Material Icons (md)](https://fonts.googleapis.com/css?family=Material+Icons)
117
- - [CDN for Font Awesome 4 (fa4)](https://cdn.jsdelivr.net/npm/font-awesome@4.x/css/font-awesome.min.css)
118
- - [CDN for Font Awesome 5 (fa)](https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@latest/css/all.min.css)
119
-
120
- To change the CDN for a font icon library you only need to specify the `cdn` option:
121
- ```ts
122
- vuetify: {
123
- vuetifyOptions: {
124
- icons: {
125
- defaultSet: 'mdi'
126
- sets: [{
127
- name: 'mdi',
128
- cdn: 'https://cdn.jsdelivr.net/npm/@mdi/font@latest/css/materialdesignicons'
129
- }]
130
- }
131
- }
132
- }
133
- ```
134
-
135
- ## 🎭 SVG Icons
136
-
137
- This module supports the following SVG icon libraries:
138
- - [@mdi/js](https://www.npmjs.com/package/@mdi/js)
139
- - [@fortawesome/fontawesome-svg-core](https://www.npmjs.com/package/@fortawesome/fontawesome-svg-core)
140
-
141
- ### mdi-svg
142
-
143
- You only need to add `@mdi/js` dependency to your project and configure the default set:
144
- ```ts
145
- vuetify: {
146
- vuetifyOptions: {
147
- icons: {
148
- defaultSet: 'mdi-svg'
149
- }
150
- }
151
- }
152
- ```
153
-
154
- You can also add icon aliases:
155
- ```ts
156
- vuetify: {
157
- vuetifyOptions: {
158
- icons: {
159
- defaultSet: 'mdi-svg',
160
- svg: {
161
- mdi: {
162
- aliases: {
163
- account: 'mdiAccount'
164
- }
165
- }
166
- }
167
- }
168
- }
169
- }
170
- ```
171
-
172
- ### fa-svg
173
-
174
- 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:
175
- ```ts
176
- vuetify: {
177
- vuetifyOptions: {
178
- icons: {
179
- defaultSet: 'fa-svg'
180
- }
181
- }
182
- }
183
- ```
184
-
185
- 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):
186
- ```ts
187
- vuetify: {
188
- vuetifyOptions: {
189
- icons: {
190
- defaultSet: 'fa-svg',
191
- svg: {
192
- fa: {
193
- libraries: [/* default export? */ false, /* export name */ 'fas', /* import */ '@fortawesome/free-solid-svg-icons']
194
- }
195
- }
196
- }
197
- }
198
- }
199
- ```
200
-
201
- ## 📦 Multiple Icon Sets
202
-
203
- 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:
204
- ```ts
205
- vuetify: {
206
- vuetifyOptions: {
207
- icons: {
208
- defaultSet: 'mdi'
209
- sets: [{ name: 'mdi' }, { name: 'fa' }]
210
- }
211
- }
212
- }
213
- ```
214
-
215
- ## 🌍 I18n support
216
-
217
- > Requires latest [@nuxtjs/i18n](https://v8.i18n.nuxtjs.org/) Nuxt module: `8.0.0.beta.13`.
218
-
219
- You can check the playground folder, you can run it using single or multiple json files per locale:
220
- - for single file per locale: run from root folder `pnpm install && nr dev:prepare && nr dev`
221
- - for multiple files per locale: run from root folder `pnpm install && nr dev:prepare:multiple-json && nr dev:multiple-json`
222
-
223
- ## 📆 Date components support
224
-
225
- 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.
226
-
227
- To use Vuetify components [that require date functionality](https://vuetifyjs.com/en/features/dates/):
228
- - install one of the [@date-io](https://github.com/dmtrKovalenko/date-io#projects) adapters (optional)
229
- - configure the date entry in your Vuetify configuration:
230
- ```ts
231
- vuetifyOptions: {
232
- date: {
233
- adapter: 'vuetify' // 'vuetify' | 'date-fns' | 'moment' | 'luxon' | 'dayjs' | 'js-joda' | 'date-fns-jalali' | 'jalaali' | 'hijri' | 'custom'
234
- }
235
- }
236
- ```
237
-
238
- If you also have `@nuxtjs/i18n` module installed, `vuetifyOptions.date.locale` will be automatically configured, beware, the configured `locale` entry will be ignored.
239
-
240
- If you want to use a custom date adapter, you can configure it using `vuetifyOptions.date.adapter = 'custom'`, and then:
241
- - add a Nuxt Plugin and add the `vuetify:configuration` hook to configure your Vuetify options
242
- - you can import the `virtual:vuetify-date-configuration` module, you will have access to the configuration:
243
- ```ts
244
- import { adapter, dateConfiguration, i18n } from 'virtual:vuetify-date-configuration'
245
- ```
246
-
247
- Check out [vuetify-date](./src/runtime/plugins/vuetify-date.mts) plugin for an example of a custom date adapter and how to access to the configuration.
248
-
249
- ## 🎨 Vuetify Blueprints
250
-
251
- **WIP**
252
-
253
- ## 👀 Full config
254
-
255
- Check out the type declaration [src/types.ts](./src/types.ts).
256
-
257
- The virtual modules can be found in [configuration.d.ts](./configuration.d.ts) file.
258
-
259
- ## 📄 License
260
-
261
- [MIT](./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 (WIP)**: 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
+ ## 😃 Font Icons
88
+
89
+ This module supports the following font icons libraries:
90
+ - [Material Design Icons](https://materialdesignicons.com/)
91
+ - [Material Icons](https://fonts.google.com/icons)
92
+ - [Font Awesome 4](https://fontawesome.com/v4.7.0/)
93
+ - [Font Awesome 5](https://fontawesome.com/)
94
+
95
+ By default, the module will use the `mdi` font icon library. You can change it by setting the `defaultSet` option to:
96
+ - `mdi` for [Material Design Icons](https://materialdesignicons.com/)
97
+ - `md` for [Material Icons](https://fonts.google.com/icons)
98
+ - `fa4` for [Font Awesome 4](https://fontawesome.com/v4.7.0/)
99
+ - `fa` for [Font Awesome 5](https://fontawesome.com)
100
+
101
+ To configure a font icon you only need to specify the default set:
102
+ ```ts
103
+ vuetify: {
104
+ vuetifyOptions: {
105
+ icons: {
106
+ defaultSet: 'mdi'
107
+ }
108
+ }
109
+ }
110
+ ```
111
+
112
+ 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.
113
+
114
+ The CDN used for each font icon library, you can use the `cdn` option to change it:
115
+ - [CDN for Material Design Icons (mdi)](https://cdn.jsdelivr.net/npm/@mdi/font@5.x/css/materialdesignicons.min.css)
116
+ - [CDN for Material Icons (md)](https://fonts.googleapis.com/css?family=Material+Icons)
117
+ - [CDN for Font Awesome 4 (fa4)](https://cdn.jsdelivr.net/npm/font-awesome@4.x/css/font-awesome.min.css)
118
+ - [CDN for Font Awesome 5 (fa)](https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@latest/css/all.min.css)
119
+
120
+ To change the CDN for a font icon library you only need to specify the `cdn` option:
121
+ ```ts
122
+ vuetify: {
123
+ vuetifyOptions: {
124
+ icons: {
125
+ defaultSet: 'mdi'
126
+ sets: [{
127
+ name: 'mdi',
128
+ cdn: 'https://cdn.jsdelivr.net/npm/@mdi/font@latest/css/materialdesignicons'
129
+ }]
130
+ }
131
+ }
132
+ }
133
+ ```
134
+
135
+ ## 🎭 SVG Icons
136
+
137
+ This module supports the following SVG icon libraries:
138
+ - [@mdi/js](https://www.npmjs.com/package/@mdi/js)
139
+ - [@fortawesome/fontawesome-svg-core](https://www.npmjs.com/package/@fortawesome/fontawesome-svg-core)
140
+
141
+ We're trying to figure out how to include the following SVG icon libraries:
142
+ - [Nuxt Icon](https://github.com/nuxt-modules/icon)
143
+ - [unplugin-icons](https://github.com/antfu/unplugin-icons)
144
+
145
+ ### mdi-svg
146
+
147
+ You only need to add `@mdi/js` dependency to your project and configure the default set:
148
+ ```ts
149
+ vuetify: {
150
+ vuetifyOptions: {
151
+ icons: {
152
+ defaultSet: 'mdi-svg'
153
+ }
154
+ }
155
+ }
156
+ ```
157
+
158
+ You can also add icon aliases:
159
+ ```ts
160
+ vuetify: {
161
+ vuetifyOptions: {
162
+ icons: {
163
+ defaultSet: 'mdi-svg',
164
+ svg: {
165
+ mdi: {
166
+ aliases: {
167
+ account: 'mdiAccount'
168
+ }
169
+ }
170
+ }
171
+ }
172
+ }
173
+ }
174
+ ```
175
+
176
+ ### fa-svg
177
+
178
+ 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:
179
+ ```ts
180
+ vuetify: {
181
+ vuetifyOptions: {
182
+ icons: {
183
+ defaultSet: 'fa-svg'
184
+ }
185
+ }
186
+ }
187
+ ```
188
+
189
+ 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):
190
+ ```ts
191
+ vuetify: {
192
+ vuetifyOptions: {
193
+ icons: {
194
+ defaultSet: 'fa-svg',
195
+ svg: {
196
+ fa: {
197
+ libraries: [/* default export? */ false, /* export name */ 'fas', /* import */ '@fortawesome/free-solid-svg-icons']
198
+ }
199
+ }
200
+ }
201
+ }
202
+ }
203
+ ```
204
+
205
+ ## 📦 Multiple Icon Sets
206
+
207
+ 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:
208
+ ```ts
209
+ vuetify: {
210
+ vuetifyOptions: {
211
+ icons: {
212
+ defaultSet: 'mdi'
213
+ sets: [{ name: 'mdi' }, { name: 'fa' }]
214
+ }
215
+ }
216
+ }
217
+ ```
218
+
219
+ ## 🌍 I18n support
220
+
221
+ > Requires latest [@nuxtjs/i18n](https://v8.i18n.nuxtjs.org/) Nuxt module: `8.0.0.beta.13`.
222
+
223
+ You can check the playground folder, you can run it using single or multiple json files per locale:
224
+ - for single file per locale: run from root folder `pnpm install && nr dev:prepare && nr dev`
225
+ - for multiple files per locale: run from root folder `pnpm install && nr dev:prepare:multiple-json && nr dev:multiple-json`
226
+
227
+ ## 📆 Date components support
228
+
229
+ 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.
230
+
231
+ To use Vuetify components [that require date functionality](https://vuetifyjs.com/en/features/dates/):
232
+ - install one of the [@date-io](https://github.com/dmtrKovalenko/date-io#projects) adapters (optional)
233
+ - configure the date entry in your Vuetify configuration:
234
+ ```ts
235
+ vuetifyOptions: {
236
+ date: {
237
+ adapter: 'vuetify' // 'vuetify' | 'date-fns' | 'moment' | 'luxon' | 'dayjs' | 'js-joda' | 'date-fns-jalali' | 'jalaali' | 'hijri' | 'custom'
238
+ }
239
+ }
240
+ ```
241
+
242
+ If you also have `@nuxtjs/i18n` module installed, `vuetifyOptions.date.locale` will be automatically configured, beware, the configured `locale` entry will be ignored.
243
+
244
+ If you want to use a custom date adapter, you can configure it using `vuetifyOptions.date.adapter = 'custom'`, and then:
245
+ - add a Nuxt Plugin and add the `vuetify:configuration` hook to configure your Vuetify options
246
+ - you can import the `virtual:vuetify-date-configuration` module, you will have access to the configuration:
247
+ ```ts
248
+ import { adapter, dateConfiguration, i18n } from 'virtual:vuetify-date-configuration'
249
+ ```
250
+
251
+ Check out [vuetify-date](./src/runtime/plugins/vuetify-date.mts) plugin for an example of a custom date adapter and how to access to the configuration.
252
+
253
+ ## ⚙️ Auto-Import Vuetify Composables
254
+
255
+ No more Vuetify composables manual imports, auto import is enabled by default:
256
+ - [useDate](https://vuetifyjs.com/en/api/use-date/)
257
+ - [useDefaults](https://vuetifyjs.com/en/api/use-defaults/)
258
+ - [useDisplay](https://vuetifyjs.com/en/api/use-display/)
259
+ - [useLayout](https://vuetifyjs.com/en/api/use-layout/)
260
+ - [useLocale](https://vuetifyjs.com/en/api/use-locale/)
261
+ - [useRtl](https://vuetifyjs.com/en/api/use-rtl/)
262
+ - [useTheme](https://vuetifyjs.com/en/api/use-theme/)
263
+
264
+ You can disable auto-import using `moduleOptions.importComposables: false`.
265
+
266
+ If you are using another composables that collide with the Vuetify ones, enable `moduleOptions.prefixComposables: true` to prefix them with `V`:
267
+ - `useLocale` => `useVLocale`
268
+ - `useDefaults` => `useVDefaults`
269
+ - `useDisplay` => `useVDisplay`
270
+ - `useLayout` => `useVLayout`
271
+ - `useRtl` => `useVRtl`
272
+ - `useTheme` => `useVTheme`
273
+
274
+
275
+ ## 🎨 Vuetify Blueprints
276
+
277
+ **WIP**
278
+
279
+ ## 👀 Full config
280
+
281
+ Check out the type declaration [src/types.ts](./src/types.ts).
282
+
283
+ The virtual modules can be found in [configuration.d.ts](./configuration.d.ts) file.
284
+
285
+ ## 📄 License
286
+
287
+ [MIT](./LICENSE) License &copy; 2023-PRESENT [Joaquín Sánchez](https://github.com/userquin)
package/dist/module.d.ts CHANGED
@@ -112,17 +112,35 @@ interface VOptions extends Partial<Omit<VuetifyOptions, 'ssr' | 'directives' | '
112
112
  */
113
113
  icons?: false | IconsOptions;
114
114
  }
115
- interface ModuleOptions {
116
- moduleOptions?: {
117
- /**
118
- * Vuetify styles.
119
- *
120
- * @see https://github.com/vuetifyjs/vuetify-loader/tree/master/packages/vite-plugin
121
- */
122
- styles?: true | 'none' | 'expose' | 'sass' | {
123
- configFile: string;
124
- };
115
+ interface MOptions {
116
+ /**
117
+ * @default true
118
+ */
119
+ importComposables?: boolean;
120
+ /**
121
+ * If you are using another composables that collide with the Vuetify ones,
122
+ * enable this flag to prefix them with `V`:
123
+ * - `useLocale` -> `useVLocale`
124
+ * - `useDefaults` -> `useVDefaults`
125
+ * - `useDisplay` -> `useVDisplay`
126
+ * - `useLayout` -> `useVLayout`
127
+ * - `useRtl` -> `useVRtl`
128
+ * - `useTheme` -> `useVTheme`
129
+ *
130
+ * @default false
131
+ */
132
+ prefixComposables?: boolean;
133
+ /**
134
+ * Vuetify styles.
135
+ *
136
+ * @see https://github.com/vuetifyjs/vuetify-loader/tree/master/packages/vite-plugin
137
+ */
138
+ styles?: true | 'none' | 'expose' | 'sass' | {
139
+ configFile: string;
125
140
  };
141
+ }
142
+ interface ModuleOptions {
143
+ moduleOptions?: MOptions;
126
144
  /**
127
145
  * Vuetify options.
128
146
  */
@@ -142,4 +160,4 @@ declare module '#app' {
142
160
 
143
161
  declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
144
162
 
145
- export { BooleanOrArrayString, DateAdapter, DateOptions, FontAwesomeSvgIconSet, FontIconSet, IconSet, IconSetName, IconsOptions, JSSVGIconSet, ModuleOptions, VOptions, _default as default };
163
+ export { BooleanOrArrayString, DateAdapter, DateOptions, FontAwesomeSvgIconSet, FontIconSet, IconSet, IconSetName, IconsOptions, JSSVGIconSet, MOptions, ModuleOptions, VOptions, _default as default };
package/dist/module.json CHANGED
@@ -4,5 +4,5 @@
4
4
  "compatibility": {
5
5
  "nuxt": "^3.0.0"
6
6
  },
7
- "version": "0.2.2"
7
+ "version": "0.2.3"
8
8
  }
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, addPlugin } from '@nuxt/kit';
2
+ import { useLogger, defineNuxtModule, createResolver, hasNuxtModule, extendWebpackConfig, addImports, addPlugin } from '@nuxt/kit';
3
3
  import defu from 'defu';
4
4
  import { isPackageExists } from 'local-pkg';
5
5
  import { resolveVuetifyBase, normalizePath, writeStyles, cacheDir } from '@vuetify/loader-shared';
6
6
  import { isAbsolute, join, relative } from 'pathe';
7
7
  import { normalizePath as normalizePath$1 } from 'vite';
8
8
 
9
- const version = "0.2.2";
9
+ const version = "0.2.3";
10
10
 
11
11
  function isSubdir(root, test) {
12
12
  const relative$1 = relative(root, test);
@@ -483,23 +483,29 @@ const module = defineNuxtModule({
483
483
  directives: false
484
484
  },
485
485
  moduleOptions: {
486
+ importComposables: true,
486
487
  styles: true
487
488
  }
488
489
  }),
489
490
  setup(options, nuxt) {
490
491
  var _a, _b;
491
492
  const resolver = createResolver(import.meta.url);
492
- const { moduleOptions = {}, vuetifyOptions = {} } = options;
493
+ const { vuetifyOptions = {} } = options;
493
494
  const {
494
495
  directives = false,
495
496
  labComponents = false,
496
497
  ...vOptions
497
498
  } = vuetifyOptions;
499
+ const moduleOptions = defu(options.moduleOptions ?? {}, {
500
+ styles: true,
501
+ importComposables: true,
502
+ prefixComposables: false
503
+ });
498
504
  const isSSR = nuxt.options.ssr;
499
505
  const vuetifyAppOptions = defu(vOptions, {
500
506
  ssr: isSSR
501
507
  });
502
- const { styles = true } = moduleOptions;
508
+ const { styles } = moduleOptions;
503
509
  const i18n = hasNuxtModule("@nuxtjs/i18n", nuxt);
504
510
  let dateAdapter;
505
511
  const dateOptions = vuetifyOptions.date;
@@ -552,7 +558,6 @@ const module = defineNuxtModule({
552
558
  nuxt.hook("vite:extend", ({ config }) => checkVuetifyPlugins(config));
553
559
  nuxt.hook("prepare:types", ({ references }) => {
554
560
  references.push({ types: "vuetify-nuxt-module/configuration" });
555
- references.push({ types: "vuetify" });
556
561
  });
557
562
  const vuetifyBase = resolveVuetifyBase();
558
563
  nuxt.hook("components:extend", async (c) => {
@@ -563,6 +568,7 @@ const module = defineNuxtModule({
563
568
  pascalName: component,
564
569
  kebabName: toKebabCase(component),
565
570
  export: component,
571
+ // pointing to the mjs file, links will not work: there is d.mts file for each component
566
572
  filePath: `${resolver.resolve(vuetifyBase, `lib/${from}`)}`,
567
573
  shortPath: `components/${from}`,
568
574
  chunkName: toKebabCase(component),
@@ -573,6 +579,15 @@ const module = defineNuxtModule({
573
579
  });
574
580
  });
575
581
  });
582
+ if (moduleOptions.importComposables) {
583
+ const composables = ["useLocale", "useDefaults", "useDisplay", "useLayout", "useRtl", "useTheme"];
584
+ addImports(composables.map((name) => ({
585
+ name,
586
+ from: "vuetify",
587
+ as: moduleOptions.prefixComposables ? name.replace(/^use/, "useV") : void 0,
588
+ meta: { docsUrl: `https://vuetifyjs.com/en/api/${toKebabCase(name)}/` }
589
+ })));
590
+ }
576
591
  nuxt.hook("vite:extendConfig", (viteInlineConfig) => {
577
592
  viteInlineConfig.plugins = viteInlineConfig.plugins || [];
578
593
  checkVuetifyPlugins(viteInlineConfig);
package/dist/types.d.ts CHANGED
@@ -12,4 +12,4 @@ declare module 'nuxt/schema' {
12
12
  }
13
13
 
14
14
 
15
- export { BooleanOrArrayString, DateAdapter, DateOptions, FontAwesomeSvgIconSet, FontIconSet, IconSet, IconSetName, IconsOptions, JSSVGIconSet, ModuleOptions, VOptions, default } from './module'
15
+ export { BooleanOrArrayString, DateAdapter, DateOptions, FontAwesomeSvgIconSet, FontIconSet, IconSet, IconSetName, IconsOptions, JSSVGIconSet, MOptions, ModuleOptions, VOptions, default } from './module'
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vuetify-nuxt-module",
3
3
  "type": "module",
4
- "version": "0.2.2",
4
+ "version": "0.2.3",
5
5
  "packageManager": "pnpm@8.6.6",
6
6
  "description": "Zero-Config Nuxt Module for Vuetify ",
7
7
  "author": "userquin <userquin@gmail.com>",