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 +287 -261
- package/dist/module.d.ts +29 -11
- package/dist/module.json +1 -1
- package/dist/module.mjs +20 -5
- package/dist/types.d.ts +1 -1
- package/package.json +1 -1
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
|
-
-
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
-
-
|
|
40
|
-
-
|
|
41
|
-
-
|
|
42
|
-
-
|
|
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
|
-
[](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
|
-
|
|
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
|
-
|
|
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
|
+
[](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 © 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
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
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
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.
|
|
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 {
|
|
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
|
|
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'
|