@mframework/ui 0.0.6-beta2 → 0.0.6-beta4
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/module.ts +27 -29
- package/package.json +1 -2
- package/runtime/plugins/icon-switcher.ts +22 -12
package/module.ts
CHANGED
|
@@ -8,17 +8,18 @@ import {
|
|
|
8
8
|
} from '@nuxt/kit'
|
|
9
9
|
|
|
10
10
|
export interface MFrameworkUiOptions {
|
|
11
|
-
image
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
image ? : Record < string, any >
|
|
12
|
+
fonts ? : Record < string, any >
|
|
13
|
+
vuetify ? : {
|
|
14
|
+
vuetifyOptions ? : Record < string,
|
|
15
|
+
any >
|
|
16
|
+
}
|
|
17
|
+
tailwind ? : {
|
|
18
|
+
enable ? : boolean
|
|
18
19
|
}
|
|
19
20
|
}
|
|
20
21
|
|
|
21
|
-
export default defineNuxtModule<MFrameworkUiOptions>({
|
|
22
|
+
export default defineNuxtModule < MFrameworkUiOptions > ({
|
|
22
23
|
meta: {
|
|
23
24
|
name: '@mframework/ui',
|
|
24
25
|
configKey: 'mframeworkUi'
|
|
@@ -38,18 +39,15 @@ export default defineNuxtModule<MFrameworkUiOptions>({
|
|
|
38
39
|
}
|
|
39
40
|
},
|
|
40
41
|
async setup(options, nuxt) {
|
|
41
|
-
const {
|
|
42
|
+
const {
|
|
43
|
+
resolve
|
|
44
|
+
} = createResolver(import.meta.url)
|
|
42
45
|
|
|
43
46
|
//
|
|
44
47
|
// 1. Expose options to runtime
|
|
45
48
|
//
|
|
46
49
|
nuxt.options.runtimeConfig.public.mframeworkUi = options
|
|
47
50
|
|
|
48
|
-
//
|
|
49
|
-
// 2. Install @nuxt/image
|
|
50
|
-
//
|
|
51
|
-
await installModule('@nuxt/image', options.image || {})
|
|
52
|
-
|
|
53
51
|
//
|
|
54
52
|
// 3. Install @nuxt/fonts
|
|
55
53
|
//
|
|
@@ -65,7 +63,9 @@ export default defineNuxtModule<MFrameworkUiOptions>({
|
|
|
65
63
|
// Use Node resolution from this project's root to detect installed package
|
|
66
64
|
// without triggering Nuxt's module loader.
|
|
67
65
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
68
|
-
const {
|
|
66
|
+
const {
|
|
67
|
+
createRequire
|
|
68
|
+
} = await import('module')
|
|
69
69
|
const req = createRequire(import.meta.url)
|
|
70
70
|
try {
|
|
71
71
|
req.resolve('vuetify')
|
|
@@ -92,7 +92,10 @@ export default defineNuxtModule<MFrameworkUiOptions>({
|
|
|
92
92
|
nuxt.options.css = nuxt.options.css || []
|
|
93
93
|
nuxt.options.css.push(resolve('./runtime/assets/css/tailwind.css'))
|
|
94
94
|
|
|
95
|
-
nuxt.options.postcss = nuxt.options.postcss || {
|
|
95
|
+
nuxt.options.postcss = nuxt.options.postcss || {
|
|
96
|
+
plugins: {},
|
|
97
|
+
order: []
|
|
98
|
+
}
|
|
96
99
|
nuxt.options.postcss.plugins = nuxt.options.postcss.plugins || {}
|
|
97
100
|
// Use the new PostCSS adapter package name so Nuxt doesn't try to
|
|
98
101
|
// use the old `tailwindcss` package as a PostCSS plugin.
|
|
@@ -108,19 +111,14 @@ export default defineNuxtModule<MFrameworkUiOptions>({
|
|
|
108
111
|
// 6. Register plugins (icons, theme, icon switching, search).
|
|
109
112
|
// Only register plugins that require Vuetify when Vuetify is available.
|
|
110
113
|
//
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
addPlugin(resolve('./runtime/search/plugin'))
|
|
120
|
-
} catch (e) {
|
|
121
|
-
// ignore — plugin not critical
|
|
122
|
-
}
|
|
123
|
-
}
|
|
114
|
+
// Install Vuetify first
|
|
115
|
+
await installModule(resolveModule('vuetify-nuxt-module'), {
|
|
116
|
+
vuetifyOptions: options.vuetify?.vuetifyOptions || {}
|
|
117
|
+
})
|
|
118
|
+
|
|
119
|
+
// THEN load plugins that depend on Vuetify
|
|
120
|
+
addPlugin(resolve('./runtime/plugins/theme'))
|
|
121
|
+
addPlugin(resolve('./runtime/plugins/icon-switcher'))
|
|
124
122
|
|
|
125
123
|
//
|
|
126
124
|
// 7. Auto-import components from this module
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mframework/ui",
|
|
3
|
-
"version": "0.0.6-
|
|
3
|
+
"version": "0.0.6-beta4",
|
|
4
4
|
"description": "Official opinionated UI module for the M Framework.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ui",
|
|
@@ -28,7 +28,6 @@
|
|
|
28
28
|
"@fortawesome/vue-fontawesome": "^3.1.2",
|
|
29
29
|
"@mdi/font": "^7.4.47",
|
|
30
30
|
"@nuxt/fonts": "^0.13.0",
|
|
31
|
-
"@nuxt/image": "^2.0.0",
|
|
32
31
|
"@nuxt/kit": "^4.3.1",
|
|
33
32
|
"@vueuse/motion": "^3.0.3",
|
|
34
33
|
"tailwindcss": "^4.1.18",
|
|
@@ -1,22 +1,32 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defineNuxtPlugin } from '#app'
|
|
2
|
+
import { useVuetify } from 'vuetify-nuxt-module/runtime'
|
|
3
|
+
|
|
4
|
+
export default defineNuxtPlugin((nuxtApp) => {
|
|
5
|
+
const vuetify = useVuetify()
|
|
6
|
+
|
|
7
|
+
// If Vuetify isn't ready yet, skip plugin initialization
|
|
8
|
+
if (!vuetify || !vuetify.framework) {
|
|
9
|
+
console.warn('[mframework-ui] Vuetify not ready for icon-switcher plugin')
|
|
10
|
+
return
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const stored =
|
|
14
|
+
typeof localStorage !== 'undefined'
|
|
15
|
+
? localStorage.getItem('mframework-icon-set')
|
|
16
|
+
: null
|
|
2
17
|
|
|
3
|
-
export default (nuxtApp: any) => {
|
|
4
|
-
const stored = typeof localStorage !== 'undefined' ? localStorage.getItem('mframework-icon-set') : null
|
|
5
18
|
const initial = stored || 'mdi'
|
|
6
|
-
const framework = vuetify as any
|
|
7
19
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
;(vuetify as any).framework.icons = (vuetify as any).framework.icons || {}
|
|
11
|
-
;(vuetify as any).framework.icons.defaultSet = initial
|
|
20
|
+
vuetify.framework.icons = vuetify.framework.icons || {}
|
|
21
|
+
vuetify.framework.icons.defaultSet = initial
|
|
12
22
|
|
|
13
23
|
const setIconSet = (name: string) => {
|
|
14
|
-
|
|
15
|
-
|
|
24
|
+
vuetify.framework.icons.defaultSet = name
|
|
25
|
+
localStorage.setItem('mframework-icon-set', name)
|
|
16
26
|
}
|
|
17
27
|
|
|
18
28
|
nuxtApp.provide('mIcons', {
|
|
19
29
|
setIconSet,
|
|
20
|
-
current: () =>
|
|
30
|
+
current: () => vuetify.framework.icons.defaultSet
|
|
21
31
|
})
|
|
22
|
-
}
|
|
32
|
+
})
|