-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathtypes.ts
432 lines (416 loc) · 12.3 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
import type { LocaleOptions, RtlOptions, VuetifyOptions } from 'vuetify'
export type DateAdapter = 'vuetify' | 'date-fns' | 'moment' | 'luxon' | 'dayjs' | 'js-joda' | 'date-fns-jalali' | 'jalaali' | 'hijri' | 'custom'
/**
* Date configuration.
*/
export interface DateOptions {
/**
* The date adapter.
*
* The adapter will be picked from the dependencies.
* When multiple `@date-io/xxxx` libraries installed in your project,
* you should specify the adapter otherwise an error will be thrown.
*
* If you want to use a custom adapter, configure `adapter: 'custom'`,
* and then add a Nuxt plugin to configure the adapter using `vuetify:configuration` hook.
*
* @default 'vuetify'
*/
adapter?: DateAdapter
/**
* Formats.
*/
formats?: Record<string, string>
/**
* Locales.
*
* When `@nuxtjs/i18n` Nuxt module is present, this option will be ignored, locales will be extracted from the available locales.
*/
locale?: Record<string, any>
}
export type IconSetName = 'mdi' | 'fa' | 'fa4' | 'md' | 'mdi-svg' | 'fa-svg' | 'unocss-mdi' | 'custom'
export type IconFontName = 'unocss-mdi' | 'mdi' | 'fa' | 'fa4' | 'md'
export interface JSSVGIconSet {
aliases?: Record<string, string>
}
export interface FontAwesomeSvgIconSet {
/**
* The libraries to import and register with the corresponding name.
*
* For example, to import free svg icons, `libraries` should be (the default):
* `libraries: [[false, 'fas', '@fortawesome/free-solid-svg-icons']]
*
* Following with the example, the resulting import will be:
* `import { fas } from '@fortawesome/free-solid-svg-icons'`
*
* @default [[false, 'fas', '@fortawesome/free-solid-svg-icons']]
*/
libraries?: [defaultExport: boolean, name: string, library: string][]
}
export interface FontIconSet {
name: IconFontName
/**
* Use CDN?
*
* - mdi: https://cdn.jsdelivr.net/npm/@mdi/[email protected]/css/materialdesignicons.min.css
* - md: https://fonts.googleapis.com/css?family=Material+Icons
* - fa: https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@latest/css/all.min.css
* - fa4: https://cdn.jsdelivr.net/npm/[email protected]/css/font-awesome.min.css
*
* @default the corresponding CDN for the icon set
*/
cdn?: string
}
export interface UnoCCSMdiIconSet {
collapse?: string
complete?: string
cancel?: string
close?: string
delete?: string
clear?: string
success?: string
info?: string
warning?: string
error?: string
prev?: string
next?: string
checkboxOn?: string
checkboxOff?: string
checkboxIndeterminate?: string
delimiter?: string
sortAsc?: string
sortDesc?: string
expand?: string
menu?: string
subgroup?: string
dropdown?: string
radioOn?: string
radioOff?: string
edit?: string
ratingEmpty?: string
ratingFull?: string
ratingHalf?: string
loading?: string
first?: string
last?: string
unfold?: string
file?: string
plus?: string
minus?: string
calendar?: string
}
export interface IconsOptions {
/**
* @default 'mdi'
*/
defaultSet: IconSetName
/**
* The prefix for UnoCSS Preset Icons.
*
* @default 'i-'
*/
unocssIconPrefix?: string
/**
* Override the default mdi icons.
*
* Icon names should include the prefix and the collection, for example:
* - home: i-<collection>:<icon>
*/
unocssIcons?: UnoCCSMdiIconSet
unocssAdditionalIcons?: Record<string, string>
sets?: IconFontName | IconFontName[] | FontIconSet[]
svg?: {
mdi?: JSSVGIconSet
fa?: FontAwesomeSvgIconSet
}
}
export type ComponentName = keyof typeof import('vuetify/components')
export type Components = false | ComponentName | ComponentName[]
export type DirectiveName = keyof typeof import('vuetify/directives')
export type Directives = boolean | DirectiveName | DirectiveName[]
export type LabComponentName = keyof typeof import('vuetify/labs/components')
export type LabComponents = boolean | LabComponentName | LabComponentName[]
export type VuetifyLocale = keyof typeof import('vuetify/locale')
export interface VOptions extends Partial<Omit<VuetifyOptions, | 'ssr' | 'aliases' | 'components' | 'directives' | 'locale' | 'date' | 'icons'>> {
/**
* Configure the SSR options.
*
* This option is only used when SSR is enabled in your Nuxt configuration.
*/
ssr?: {
clientWidth: number
clientHeight?: number
}
aliases?: Record<string, ComponentName>
/**
* Do you need to configure some global components?.
*
* @default false
*/
components?: Components
/**
* Configure the locale messages, the locale, the fallback locale and RTL options.
*
* When `@nuxtjs/i18n` Nuxt module is present, the following options will be ignored:
* - `locale`
* - `fallback`
* - `rtl`
* - `messages`
*
* The adapter will be `vuetify`, if you want to use another adapter, check `date` option.
*/
locale?: Omit<LocaleOptions, 'adapter'> & RtlOptions
/**
* Include locale messages?
*
* When `@nuxtjs/i18n` Nuxt module is present, this option will be ignored.
*
* You can include the locales you want to use in your application, this module will load and configure the messages for you.
*/
localeMessages?: VuetifyLocale | VuetifyLocale[]
/**
* Include the lab components?
*
* You can include all lab components configuring `labComponents: true`.
*
* You can provide an array with the names of the lab components to include.
*
* @see https://vuetifyjs.com/en/labs/introduction/
*
* @default false
*/
labComponents?: LabComponents
/**
* Include the directives?
*
* You can include all directives configuring `directives: true`.
*
* You can provide an array with the names of the directives to include.
*
* @default false
*/
directives?: Directives
/**
* Date configuration.
*
* When this option is configured, the `v-date-picker` lab component will be included.
*
* @see https://vuetifyjs.com/features/dates/
* @see https://vuetifyjs.com/components/date-pickers/
*/
date?: DateOptions
/**
* Include the icons?
*
* By default, `mdi` icons will be used via cdn: https://cdn.jsdelivr.net/npm/@mdi/[email protected]/css/materialdesignicons.min.css.
*
* @see https://vuetifyjs.com/en/features/icon-fonts/
*/
icons?: false | IconsOptions
}
export interface MOptions {
/**
* @default true
*/
importComposables?: boolean
/**
* If you are using another composables that collide with the Vuetify ones,
* enable this flag to prefix them with `V`:
* - `useLocale` -> `useVLocale`
* - `useDefaults` -> `useVDefaults`
* - `useDisplay` -> `useVDisplay`
* - `useLayout` -> `useVLayout`
* - `useRtl` -> `useVRtl`
* - `useTheme` -> `useVTheme`
* - `useGoTo` -> `useVGoTo`
*
* @default false
*/
prefixComposables?: boolean
/**
* Vuetify styles.
*
* If you want to use configFile on SSR, you have to disable `experimental.inlineSSRStyles` in nuxt.config.
*
* @see https://github.com/vuetifyjs/vuetify-loader/tree/master/packages/vite-plugin
* @see https://github.com/userquin/vuetify-nuxt-module/issues/78 and https://github.com/userquin/vuetify-nuxt-module/issues/74
*
* @default true
*/
styles?: true | 'none' | 'sass' | {
configFile: string
}
/**
* The module will add `vuetify/styles` in Nuxt `css` by default.
*
* If you want to add custom styles, you should enable this flag to avoid registering `vuetify/styles`.
*
* @see https://github.com/vuetifyjs/nuxt-module/pull/213
* @default false
*/
disableVuetifyStyles?: boolean
/**
* Disable the modern SASS compiler and API.
*
* The module will check for `sass-embedded` dev dependency:
* - if `disableModernSassCompiler` is enabled, the module will configure the legacy SASS compiler.
* - if `sass-embedded` dependency is installed, the module will configure the modern SASS compiler.
* - otherwise, the module will configure the modern SASS API and will enable [preprocessorMaxWorkers](https://vitejs.dev/config/shared-options.html#css-preprocessormaxworkers), only if not configured from user land.
*
* @https://vitejs.dev/config/shared-options.html#css-preprocessoroptions
* @see https://vitejs.dev/config/shared-options.html#css-preprocessormaxworkers
*
* @default false
*/
disableModernSassCompiler?: boolean
/**
* Add Vuetify Vite Plugin `transformAssetsUrls`?
*
* @default true
*/
includeTransformAssetsUrls?: boolean | Record<string, string[]>
/**
* Directives Vuetify Vite Plugin should ignore.
*
* @since v0.15.1
*/
ignoreDirectives?: DirectiveName | DirectiveName[]
/**
* Vuetify SSR client hints.
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Client_hints
*/
ssrClientHints?: {
/**
* Should the module reload the page on first request?
*
* @default false
*/
reloadOnFirstRequest?: boolean
/**
* Enable `Sec-CH-Viewport-Width` and `Sec-CH-Viewport-Height` headers?
*
* @see https://wicg.github.io/responsive-image-client-hints/#sec-ch-viewport-width
* @see https://wicg.github.io/responsive-image-client-hints/#sec-ch-viewport-height
*
* @default false
*/
viewportSize?: boolean
/**
* Enable `Sec-CH-Prefers-Color-Scheme` header?
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Sec-CH-Prefers-Color-Scheme
*
* @default false
*/
prefersColorScheme?: boolean
/**
* The options for `prefersColorScheme`, `prefersColorScheme` must be enabled.
*
* If you want the module to handle the color scheme for you, you should configure this option, otherwise you'll need to add your custom implementation.
*/
prefersColorSchemeOptions?: {
/**
* The name for the cookie.
*
* @default 'color-scheme'
*/
cookieName?: string
/**
* The name for the dark theme.
*
* @default 'dark'
*/
darkThemeName?: string
/**
* The name for the light theme.
*
* @default 'light'
*/
lightThemeName?: string
/**
* Use the browser theme only?
*
* This flag can be used when your application provides a custom dark and light themes,
* but will not provide a theme switcher, that's, using by default the browser theme.
*
* @default false
*/
useBrowserThemeOnly?: boolean
}
/**
* Enable `Sec-CH-Prefers-Reduced-Motion` header?
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Sec-CH-Prefers-Reduced-Motion
*
* @default false
*/
prefersReducedMotion?: boolean
}
}
export interface VuetifyModuleOptions {
moduleOptions?: MOptions
/**
* Vuetify options.
*
* You can inline the configuration or specify a file path:
* `vuetifyOptions: './vuetify.options.ts'`
*
* The path should be relative to the root folder.
*/
vuetifyOptions?: string | VOptions
}
export interface InlineModuleOptions extends Omit<VuetifyModuleOptions, 'vuetifyOptions'> {
vuetifyOptions: VOptions
}
export interface ExternalVuetifyOptions extends VOptions {
config?: boolean
}
/**
* Request headers received from the client in SSR.
*/
export interface SSRClientHints {
/**
* Is the first request the browser hits the server?
*/
firstRequest: boolean
/**
* The browser supports prefer-color-scheme client hints?
*/
prefersColorSchemeAvailable: boolean
/**
* The browser supports prefer-reduced-motion client hints?
*/
prefersReducedMotionAvailable: boolean
/**
* The browser supports viewport-height client hints?
*/
viewportHeightAvailable: boolean
/**
* The browser supports viewport-width client hints?
*/
viewportWidthAvailable: boolean
prefersColorScheme?: 'dark' | 'light' | 'no-preference'
prefersReducedMotion?: 'no-preference' | 'reduce'
viewportHeight?: number
viewportWidth?: number
/**
* The theme name from the cookie.
*/
colorSchemeFromCookie?: string
colorSchemeCookie?: string
}
export interface SSRClientHintsConfiguration {
enabled: boolean
viewportSize: boolean
prefersColorScheme: boolean
prefersReducedMotion: boolean
prefersColorSchemeOptions?: {
baseUrl: string
defaultTheme: string
themeNames: string[]
cookieName: string
darkThemeName: string
lightThemeName: string
}
}