-
Notifications
You must be signed in to change notification settings - Fork 63
/
module.ts
92 lines (86 loc) · 2.47 KB
/
module.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
import {
defineNuxtModule,
createResolver,
addComponent,
installModule,
} from '@nuxt/kit'
export interface ModuleOptions {}
// Learn how to create a Nuxt module on https://nuxt.com/docs/guide/going-further/modules/
export default defineNuxtModule<ModuleOptions>({
meta: {
name: 'nuxt-icon',
configKey: 'icon',
compatibility: {
nuxt: '^3.0.0-rc.9',
},
},
defaults: {},
setup(_options, nuxt) {
const { resolve } = createResolver(import.meta.url)
// Define types for the app.config compatible with Nuxt Studio
nuxt.hook('schema:extend', (schemas) => {
schemas.push({
appConfig: {
nuxtIcon: {
$schema: {
title: 'Nuxt Icon',
description: 'Configure the defaults of Nuxt Icon'
},
size: {
$default: '1em',
$schema: {
title: 'Icon Size',
description: 'Set the default icon size. Set to false to disable the sizing of icon in style.',
tags: ['@studioIcon material-symbols:format-size-rounded'],
tsType: 'string | false'
},
},
class: {
$default: '',
$schema: {
title: 'CSS Class',
description: 'Set the default CSS class',
tags: ['@studioIcon material-symbols:css'],
},
},
aliases: {
$default: {},
$schema: {
title: 'Icon aliases',
description: 'Define Icon aliases to update them easily without code changes.',
tags: [
'@studioIcon material-symbols:star-rounded',
'@studioInputObjectValueType icon'
],
tsType: '{ [alias: string]: string }',
},
},
},
},
})
})
installModule('nuxt-config-schema')
addComponent({
name: 'Icon',
global: true,
filePath: resolve('./runtime/Icon.vue'),
})
addComponent({
name: 'IconCSS',
global: true,
filePath: resolve('./runtime/IconCSS.vue'),
})
// @ts-expect-error - private API
nuxt.hook('devtools:customTabs', (iframeTabs) => {
iframeTabs.push({
name: 'icones',
title: 'Icônes',
icon: 'i-arcticons-iconeration',
view: {
type: 'iframe',
src: 'https://icones.js.org'
}
})
})
}
})