@mframework/ui 0.1.0-beta.0 → 0.1.0-beta.2

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.
Files changed (111) hide show
  1. package/dist/adapters/adapter-directus/src/types/ui.d.ts +21 -0
  2. package/dist/adapters/adapter-directus/src/types/ui.js +1 -0
  3. package/dist/module.d.mts +9 -0
  4. package/dist/module.d.ts +6 -0
  5. package/dist/module.js +68 -0
  6. package/dist/module.json +9 -0
  7. package/dist/module.mjs +38 -0
  8. package/dist/modules/ui/src/module.d.ts +8 -0
  9. package/dist/modules/ui/src/module.js +75 -0
  10. package/dist/modules/ui/src/runtime/composables/useMToast.d.ts +5 -0
  11. package/dist/modules/ui/src/runtime/composables/useMToast.js +11 -0
  12. package/dist/modules/ui/src/runtime/design/tokens.d.ts +22 -0
  13. package/dist/modules/ui/src/runtime/design/tokens.js +22 -0
  14. package/dist/modules/ui/src/runtime/plugins/builder.d.ts +3 -0
  15. package/dist/modules/ui/src/runtime/plugins/builder.js +311 -0
  16. package/dist/modules/ui/src/runtime/plugins/fontawesome.d.ts +3 -0
  17. package/dist/modules/ui/src/runtime/plugins/fontawesome.js +9 -0
  18. package/dist/modules/ui/src/runtime/plugins/formkit.d.ts +3 -0
  19. package/dist/modules/ui/src/runtime/plugins/formkit.js +8 -0
  20. package/dist/modules/ui/src/runtime/plugins/motion.d.ts +2 -0
  21. package/dist/modules/ui/src/runtime/plugins/motion.js +5 -0
  22. package/dist/modules/ui/src/runtime/plugins/theme-switcher.d.ts +2 -0
  23. package/dist/modules/ui/src/runtime/plugins/theme-switcher.js +27 -0
  24. package/dist/modules/ui/src/runtime/plugins/theme.d.ts +2 -0
  25. package/dist/modules/ui/src/runtime/plugins/theme.js +44 -0
  26. package/dist/modules/ui/src/runtime/plugins/vuetify.d.ts +3 -0
  27. package/dist/modules/ui/src/runtime/plugins/vuetify.js +33 -0
  28. package/dist/modules/ui/src/runtime/search/client.d.ts +2 -0
  29. package/dist/modules/ui/src/runtime/search/client.js +21 -0
  30. package/dist/modules/ui/src/runtime/search/plugin.d.ts +2 -0
  31. package/dist/modules/ui/src/runtime/search/plugin.js +7 -0
  32. package/dist/modules/ui/src/utils/color.d.ts +2 -0
  33. package/dist/modules/ui/src/utils/color.js +11 -0
  34. package/dist/modules/ui/src/utils/fonts.d.ts +5 -0
  35. package/dist/modules/ui/src/utils/fonts.js +18 -0
  36. package/dist/modules/ui/src/utils/formkit.d.ts +12 -0
  37. package/dist/modules/ui/src/utils/formkit.js +59 -0
  38. package/dist/modules/ui/src/utils/icons.d.ts +4 -0
  39. package/dist/modules/ui/src/utils/icons.js +36 -0
  40. package/dist/runtime/assets/config/tailwind.conifg.d.ts +0 -0
  41. package/dist/runtime/assets/config/tailwind.conifg.js +11 -0
  42. package/dist/runtime/components/MButton.d.vue.ts +0 -0
  43. package/dist/runtime/components/MButton.vue +15 -0
  44. package/dist/runtime/components/MButton.vue.d.ts +0 -0
  45. package/dist/runtime/composables/useMToast.d.ts +5 -0
  46. package/dist/runtime/composables/useMToast.js +11 -0
  47. package/dist/runtime/plugins/builder.d.ts +3 -0
  48. package/dist/runtime/plugins/builder.js +311 -0
  49. package/dist/runtime/plugins/fontawesome.d.ts +3 -0
  50. package/dist/runtime/plugins/fontawesome.js +9 -0
  51. package/dist/runtime/plugins/formkit.d.ts +3 -0
  52. package/dist/runtime/plugins/formkit.js +8 -0
  53. package/dist/runtime/plugins/icon-switcher.d.ts +1 -1
  54. package/dist/runtime/plugins/icon-switcher.js +15 -9
  55. package/dist/runtime/plugins/lightgallery.d.ts +6 -0
  56. package/dist/runtime/plugins/lightgallery.js +15 -0
  57. package/dist/runtime/plugins/motion.d.ts +2 -0
  58. package/dist/runtime/plugins/motion.js +5 -0
  59. package/dist/runtime/plugins/theme-switcher.d.ts +2 -0
  60. package/dist/runtime/plugins/theme-switcher.js +27 -0
  61. package/dist/runtime/plugins/theme.d.ts +1 -1
  62. package/dist/runtime/plugins/theme.js +31 -25
  63. package/dist/runtime/plugins/vuetify.d.ts +1 -86
  64. package/dist/runtime/plugins/vuetify.js +28 -55
  65. package/dist/runtime/search/components/MSearch.d.vue.ts +0 -0
  66. package/dist/runtime/search/components/MSearch.vue +19 -0
  67. package/dist/runtime/search/components/MSearch.vue.d.ts +0 -0
  68. package/dist/runtime/styles/index.css +5 -0
  69. package/dist/runtime/styles/tailwind.css +1 -0
  70. package/dist/runtime/styles/vuetify.css +3 -0
  71. package/dist/types.d.mts +9 -0
  72. package/dist/utils/color.d.ts +2 -0
  73. package/dist/utils/color.js +11 -0
  74. package/dist/utils/fonts.d.ts +5 -0
  75. package/dist/utils/fonts.js +18 -0
  76. package/dist/utils/formkit.d.ts +12 -0
  77. package/dist/utils/formkit.js +59 -0
  78. package/dist/utils/icons.d.ts +4 -0
  79. package/dist/utils/icons.js +36 -0
  80. package/package.json +12 -10
  81. package/src/module.ts +105 -0
  82. package/src/runtime/assets/config/tailwind.conifg.js +42 -0
  83. package/src/runtime/components/Gallery.vue +66 -0
  84. package/src/runtime/components/MButton.vue +17 -0
  85. package/src/runtime/composables/useMToast.ts +14 -0
  86. package/src/runtime/design/tokens.ts +22 -0
  87. package/src/runtime/plugins/builder.ts +326 -0
  88. package/src/runtime/plugins/fontawesome.ts +11 -0
  89. package/src/runtime/plugins/formkit.ts +9 -0
  90. package/src/runtime/plugins/lightgallery.js +21 -0
  91. package/src/runtime/plugins/motion.ts +6 -0
  92. package/src/runtime/plugins/theme-switcher.ts +32 -0
  93. package/src/runtime/plugins/theme.ts +57 -0
  94. package/src/runtime/plugins/vuetify.ts +36 -0
  95. package/src/runtime/search/client.ts +25 -0
  96. package/src/runtime/search/components/MSearch.vue +19 -0
  97. package/src/runtime/search/plugin.ts +9 -0
  98. package/src/runtime/styles/index.scss +101 -0
  99. package/src/runtime/styles/tailwind.css +9 -0
  100. package/src/runtime/styles/vuetify.scss +5 -0
  101. package/src/types/runtime-config.d.ts +12 -0
  102. package/src/utils/color.js +11 -0
  103. package/src/utils/color.ts +14 -0
  104. package/src/utils/fonts.js +18 -0
  105. package/src/utils/fonts.ts +24 -0
  106. package/src/utils/formkit.js +59 -0
  107. package/src/utils/formkit.ts +75 -0
  108. package/src/utils/icons.js +36 -0
  109. package/src/utils/icons.ts +62 -0
  110. package/dist/runtime/plugins/icons.d.ts +0 -4
  111. package/dist/runtime/plugins/icons.js +0 -13
@@ -0,0 +1,311 @@
1
+ import { defineNuxtPlugin } from 'nuxt/app';
2
+ import 'grapesjs/dist/css/grapes.min.css';
3
+ import grapesjs from 'grapesjs';
4
+ export default defineNuxtPlugin((nuxtApp) => {
5
+ if (process.server)
6
+ return;
7
+ const mount = () => {
8
+ const el = document.querySelector('#gjs');
9
+ if (!el)
10
+ return null;
11
+ const editor = grapesjs.init({
12
+ container: `${el}`,
13
+ fromElement: true,
14
+ height: '100%',
15
+ width: 'auto',
16
+ storageManager: {
17
+ type: 'local',
18
+ autosave: true,
19
+ autoload: true,
20
+ stepsBeforeSave: 1,
21
+ options: {
22
+ local: {
23
+ key: 'gjsProject'
24
+ }
25
+ }
26
+ },
27
+ // Avoid any default panel
28
+ layerManager: {
29
+ appendTo: '.layers-container',
30
+ },
31
+ mediaCondition: 'min-width', // default is `max-width`
32
+ deviceManager: {
33
+ devices: [{
34
+ name: 'Desktop',
35
+ width: '', // default size
36
+ widthMedia: '1024px', // this value will be used in CSS @media
37
+ },
38
+ {
39
+ name: 'Mobile',
40
+ width: '320px', // this value will be used on canvas width
41
+ widthMedia: '480px', // this value will be used in CSS @media
42
+ },
43
+ ],
44
+ },
45
+ blockManager: {
46
+ appendTo: '#blocks',
47
+ blocks: [{
48
+ id: 'section', // id is mandatory
49
+ label: '<b>Section</b>', // You can use HTML/SVG inside labels
50
+ category: 'Basic',
51
+ attributes: {
52
+ class: 'gjs-block-section'
53
+ },
54
+ content: {
55
+ tagName: 'div',
56
+ draggable: false,
57
+ attributes: {
58
+ 'some-attribute': 'some-value'
59
+ },
60
+ components: [{
61
+ tagName: 'span',
62
+ content: '<b>Some static content</b>',
63
+ },
64
+ {
65
+ tagName: 'div',
66
+ // use `content` for static strings, `components` string will be parsed
67
+ // and transformed in Components
68
+ components: '<span>HTML at some point</span>',
69
+ },
70
+ ],
71
+ },
72
+ },
73
+ {
74
+ id: 'text',
75
+ label: 'Text',
76
+ content: '<div data-gjs-type="text">Insert your text here</div>',
77
+ },
78
+ {
79
+ id: 'image',
80
+ label: 'Image',
81
+ // Select the component once it's dropped
82
+ select: true,
83
+ // You can pass components as a JSON instead of a simple HTML string,
84
+ // in this case we also use a defined component type `image`
85
+ content: {
86
+ type: 'image'
87
+ },
88
+ // This triggers `active` event on dropped components and the `image`
89
+ // reacts by opening the AssetManager
90
+ activate: true,
91
+ },
92
+ ],
93
+ },
94
+ panels: {
95
+ defaults: [{
96
+ id: 'layers',
97
+ el: '.panel__right',
98
+ // Make the panel resizable
99
+ resizable: {
100
+ maxDim: 350,
101
+ minDim: 200,
102
+ tc: false, // Top handler
103
+ cl: true, // Left handler
104
+ cr: false, // Right handler
105
+ bc: false, // Bottom handler
106
+ // Being a flex child we need to change `flex-basis` property
107
+ // instead of the `width` (default)
108
+ keyWidth: 'flex-basis',
109
+ },
110
+ },
111
+ {
112
+ id: 'panel-switcher',
113
+ el: '.panel__switcher',
114
+ buttons: [{
115
+ id: 'show-layers',
116
+ active: true,
117
+ label: 'Layers',
118
+ command: 'show-layers',
119
+ // Once activated disable the possibility to turn it off
120
+ togglable: false,
121
+ },
122
+ {
123
+ id: 'show-style',
124
+ active: true,
125
+ label: 'Styles',
126
+ command: 'show-styles',
127
+ togglable: false,
128
+ },
129
+ {
130
+ id: 'show-traits',
131
+ active: true,
132
+ label: 'Traits',
133
+ command: 'show-traits',
134
+ togglable: false,
135
+ },
136
+ ],
137
+ },
138
+ {
139
+ id: 'panel-devices',
140
+ el: '.panel__devices',
141
+ buttons: [{
142
+ id: 'device-desktop',
143
+ label: 'D',
144
+ command: 'set-device-desktop',
145
+ active: true,
146
+ togglable: false,
147
+ },
148
+ {
149
+ id: 'device-mobile',
150
+ label: 'M',
151
+ command: 'set-device-mobile',
152
+ togglable: false,
153
+ },
154
+ ],
155
+ },
156
+ ],
157
+ },
158
+ // The Selector Manager allows to assign classes and
159
+ // different states (eg. :hover) on components.
160
+ // Generally, it's used in conjunction with Style Manager
161
+ // but it's not mandatory
162
+ selectorManager: {
163
+ appendTo: '.styles-container',
164
+ },
165
+ styleManager: {
166
+ appendTo: '.styles-container',
167
+ sectors: [{
168
+ name: 'Dimension',
169
+ open: false,
170
+ // Use built-in properties
171
+ buildProps: ['width', 'min-height', 'padding'],
172
+ // Use `properties` to define/override single property
173
+ properties: [{
174
+ // Type of the input,
175
+ // options: integer | radio | select | color | slider | file | composite | stack
176
+ type: 'integer',
177
+ name: 'The width', // Label for the property
178
+ property: 'width', // CSS property (if buildProps contains it will be extended)
179
+ units: ['px', '%'], // Units, available only for 'integer' types
180
+ defaults: 'auto', // Default value
181
+ min: 0, // Min value, available only for 'integer' types
182
+ },],
183
+ },
184
+ {
185
+ name: 'Extra',
186
+ open: false,
187
+ buildProps: ['background-color', 'box-shadow', 'custom-prop'],
188
+ properties: [{
189
+ id: 'custom-prop',
190
+ name: 'Custom Label',
191
+ property: 'font-size',
192
+ type: 'select',
193
+ defaults: '32px',
194
+ // List of options, available only for 'select' and 'radio' types
195
+ options: [{
196
+ id: 'tiny',
197
+ value: '12px',
198
+ name: 'Tiny'
199
+ },
200
+ {
201
+ id: 'medium',
202
+ value: '18px',
203
+ name: 'Medium'
204
+ },
205
+ {
206
+ id: 'big',
207
+ value: '32px',
208
+ name: 'Big'
209
+ },
210
+ ],
211
+ },],
212
+ },
213
+ ],
214
+ },
215
+ });
216
+ // Define commands
217
+ editor.Commands.add('show-layers', {
218
+ getRowEl(editor) {
219
+ return editor.getContainer().closest('.editor-row');
220
+ },
221
+ getLayersEl(row) {
222
+ return row.querySelector('.layers-container');
223
+ },
224
+ run(editor, sender) {
225
+ const lmEl = this.getLayersEl(this.getRowEl(editor));
226
+ lmEl.style.display = '';
227
+ },
228
+ stop(editor, sender) {
229
+ const lmEl = this.getLayersEl(this.getRowEl(editor));
230
+ lmEl.style.display = 'none';
231
+ },
232
+ });
233
+ editor.Commands.add('show-styles', {
234
+ getRowEl(editor) {
235
+ return editor.getContainer().closest('.editor-row');
236
+ },
237
+ getStyleEl(row) {
238
+ return row.querySelector('.styles-container');
239
+ },
240
+ run(editor, sender) {
241
+ const smEl = this.getStyleEl(this.getRowEl(editor));
242
+ smEl.style.display = '';
243
+ },
244
+ stop(editor, sender) {
245
+ const smEl = this.getStyleEl(this.getRowEl(editor));
246
+ smEl.style.display = 'none';
247
+ },
248
+ });
249
+ editor.Commands.add('show-traits', {
250
+ getTraitsEl(editor) {
251
+ const row = editor.getContainer().closest('.editor-row');
252
+ return row.querySelector('.traits-container');
253
+ },
254
+ run(editor, sender) {
255
+ this.getTraitsEl(editor).style.display = '';
256
+ },
257
+ stop(editor, sender) {
258
+ this.getTraitsEl(editor).style.display = 'none';
259
+ },
260
+ });
261
+ editor.Panels.addPanel({
262
+ id: 'panel-top',
263
+ el: '.panel__top',
264
+ });
265
+ editor.Panels.addPanel({
266
+ id: 'basic-actions',
267
+ el: '.panel__basic-actions',
268
+ buttons: [{
269
+ id: 'visibility',
270
+ active: true, // active by default
271
+ className: 'btn-toggle-borders',
272
+ label: '<u>B</u>',
273
+ command: 'sw-visibility', // Built-in command
274
+ },
275
+ {
276
+ id: 'export',
277
+ className: 'btn-open-export',
278
+ label: 'Exp',
279
+ command: 'export-template',
280
+ context: 'export-template', // For grouping context of buttons from the same panel
281
+ },
282
+ {
283
+ id: 'show-json',
284
+ className: 'btn-show-json',
285
+ label: 'JSON',
286
+ context: 'show-json',
287
+ command(editor) {
288
+ editor.Modal.setTitle('Components JSON')
289
+ .setContent(`<textarea style="width:100%; height: 250px;">
290
+ ${JSON.stringify(editor.getComponents())}
291
+ </textarea>`)
292
+ .open();
293
+ },
294
+ },
295
+ ],
296
+ });
297
+ editor.Commands.add('set-device-desktop', {
298
+ run: (editor) => editor.setDevice('Desktop'),
299
+ });
300
+ editor.Commands.add('set-device-mobile', {
301
+ run: (editor) => editor.setDevice('Mobile'),
302
+ });
303
+ editor.on('change:device', () => console.log('Current device: ', editor.getDevice()));
304
+ // Set initial device as Mobile
305
+ editor.setDevice('Mobile');
306
+ nuxtApp.provide('grapesStudio', editor);
307
+ return editor;
308
+ };
309
+ // Auto‑mount when page loads
310
+ window.addEventListener('DOMContentLoaded', mount);
311
+ });
@@ -0,0 +1,3 @@
1
+ import '@fortawesome/fontawesome-free/css/all.min.css';
2
+ declare const _default: import("nuxt/app").Plugin<Record<string, unknown>> & import("nuxt/app").ObjectPlugin<Record<string, unknown>>;
3
+ export default _default;
@@ -0,0 +1,9 @@
1
+ import { defineNuxtPlugin } from 'nuxt/app';
2
+ import { library } from '@fortawesome/fontawesome-svg-core';
3
+ import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
4
+ import { fas } from '@fortawesome/free-solid-svg-icons';
5
+ import '@fortawesome/fontawesome-free/css/all.min.css';
6
+ export default defineNuxtPlugin((nuxtApp) => {
7
+ library.add(fas);
8
+ nuxtApp.vueApp.component('Fa', FontAwesomeIcon);
9
+ });
@@ -0,0 +1,3 @@
1
+ import '@formkit/themes/genesis';
2
+ declare const _default: import("nuxt/app").Plugin<Record<string, unknown>> & import("nuxt/app").ObjectPlugin<Record<string, unknown>>;
3
+ export default _default;
@@ -0,0 +1,8 @@
1
+ import { defineNuxtPlugin } from 'nuxt/app';
2
+ import { plugin as formKitPlugin, defaultConfig } from '@formkit/vue';
3
+ import '@formkit/themes/genesis';
4
+ export default defineNuxtPlugin((nuxtApp) => {
5
+ nuxtApp.vueApp.use(formKitPlugin, defaultConfig({
6
+ // You can inject your own inputs, locales, etc. here
7
+ }));
8
+ });
@@ -1,2 +1,2 @@
1
- declare const _default: (nuxtApp: any) => void;
1
+ declare const _default: import("nuxt/app").Plugin<Record<string, unknown>> & import("nuxt/app").ObjectPlugin<Record<string, unknown>>;
2
2
  export default _default;
@@ -1,18 +1,24 @@
1
- import { vuetify } from './vuetify';
2
- export default (nuxtApp) => {
3
- const stored = typeof localStorage !== 'undefined' ? localStorage.getItem('mframework-icon-set') : null;
1
+ import { defineNuxtPlugin } from 'nuxt/app';
2
+ import { useVuetify } from 'vuetify-nuxt-module/runtime';
3
+ export default defineNuxtPlugin((nuxtApp) => {
4
+ const vuetify = useVuetify();
5
+ // If Vuetify isn't ready yet, skip plugin initialization
6
+ if (!vuetify || !vuetify.framework) {
7
+ console.warn('[mframework-ui] Vuetify not ready for icon-switcher plugin');
8
+ return;
9
+ }
10
+ const stored = typeof localStorage !== 'undefined'
11
+ ? localStorage.getItem('mframework-icon-set')
12
+ : null;
4
13
  const initial = stored || 'mdi';
5
- vuetify.framework = vuetify.framework || {};
6
14
  vuetify.framework.icons = vuetify.framework.icons || {};
7
15
  vuetify.framework.icons.defaultSet = initial;
8
16
  const setIconSet = (name) => {
9
- ;
10
17
  vuetify.framework.icons.defaultSet = name;
11
- if (typeof localStorage !== 'undefined')
12
- localStorage.setItem('mframework-icon-set', name);
18
+ localStorage.setItem('mframework-icon-set', name);
13
19
  };
14
20
  nuxtApp.provide('mIcons', {
15
21
  setIconSet,
16
- current: () => vuetify.framework.icons.defaultSet,
22
+ current: () => vuetify.framework.icons.defaultSet
17
23
  });
18
- };
24
+ });
@@ -0,0 +1,6 @@
1
+ import 'lightgallery/css/lightgallery.css';
2
+ import 'lightgallery/css/lg-zoom.css';
3
+ import 'lightgallery/css/lg-thumbnail.css';
4
+ import 'lightgallery/css/lg-video.css';
5
+ declare const _default: import("nuxt/app").Plugin<Record<string, unknown>> & import("nuxt/app").ObjectPlugin<Record<string, unknown>>;
6
+ export default _default;
@@ -0,0 +1,15 @@
1
+ import { defineNuxtPlugin } from 'nuxt/app';
2
+ import lightGallery from 'lightgallery';
3
+ import lgZoom from 'lg-zoom';
4
+ import lgVideo from 'lg-video';
5
+ import lgThumbnail from 'lg-thumbnail';
6
+ import 'lightgallery/css/lightgallery.css';
7
+ import 'lightgallery/css/lg-zoom.css';
8
+ import 'lightgallery/css/lg-thumbnail.css';
9
+ import 'lightgallery/css/lg-video.css';
10
+ export default defineNuxtPlugin(() => {
11
+ // You can expose a composable or directive later if you want.
12
+ // For now, this ensures CSS + plugins are bundled.
13
+ // Example directive could be added here if needed.
14
+ lightGallery([lgZoom, lgVideo, lgThumbnail]);
15
+ });
@@ -0,0 +1,2 @@
1
+ declare const _default: import("nuxt/app").Plugin<Record<string, unknown>> & import("nuxt/app").ObjectPlugin<Record<string, unknown>>;
2
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import { defineNuxtPlugin } from 'nuxt/app';
2
+ import { MotionPlugin } from '@vueuse/motion';
3
+ export default defineNuxtPlugin((nuxtApp) => {
4
+ nuxtApp.vueApp.use(MotionPlugin);
5
+ });
@@ -0,0 +1,2 @@
1
+ declare const _default: import("nuxt/app").Plugin<Record<string, unknown>> & import("nuxt/app").ObjectPlugin<Record<string, unknown>>;
2
+ export default _default;
@@ -0,0 +1,27 @@
1
+ import { defineNuxtPlugin } from 'nuxt/app';
2
+ import { useTheme } from 'vuetify';
3
+ export default defineNuxtPlugin((nuxtApp) => {
4
+ if (process.server)
5
+ return;
6
+ const theme = useTheme();
7
+ const setTheme = (mode) => {
8
+ theme.global.name.value = mode;
9
+ document.documentElement.classList.toggle('dark', mode === 'dark');
10
+ localStorage.setItem('mframework-theme', mode);
11
+ };
12
+ const toggleTheme = () => {
13
+ const current = theme.global.name.value === 'light' ? 'dark' : 'light';
14
+ setTheme(current);
15
+ };
16
+ // Load saved theme
17
+ const saved = localStorage.getItem('mframework-theme');
18
+ if (saved === 'light' || saved === 'dark') {
19
+ setTheme(saved);
20
+ }
21
+ // Expose composable
22
+ nuxtApp.provide('mTheme', {
23
+ setTheme,
24
+ toggleTheme,
25
+ current: () => theme.global.name.value
26
+ });
27
+ });
@@ -1,2 +1,2 @@
1
- declare const _default: (nuxtApp: any) => void;
1
+ declare const _default: import("nuxt/app").Plugin<Record<string, unknown>> & import("nuxt/app").ObjectPlugin<Record<string, unknown>>;
2
2
  export default _default;
@@ -1,28 +1,34 @@
1
+ import { defineNuxtPlugin, useRuntimeConfig } from 'nuxt/app';
1
2
  import { useTheme } from 'vuetify';
2
- export default (nuxtApp) => {
3
+ export default defineNuxtPlugin(() => {
4
+ if (process.server)
5
+ return;
3
6
  const theme = useTheme();
4
- // Attempt to read runtime config from nuxtApp (fallbacks to undefined)
5
- const config = (nuxtApp && nuxtApp.$config && nuxtApp.$config.public && nuxtApp.$config.public.mframeworkUi) || {};
6
- // 1. Load persisted theme
7
- const stored = typeof localStorage !== 'undefined' ? localStorage.getItem('mframework-theme') : null;
8
- const initial = stored || config?.theme?.default || 'light';
9
- theme.global.name.value = initial;
10
- // 2. Expose a global toggle
11
- const toggleTheme = () => {
12
- const newTheme = theme.global.current.value.dark ? 'light' : 'dark';
13
- theme.global.name.value = newTheme;
14
- if (typeof localStorage !== 'undefined')
15
- localStorage.setItem('mframework-theme', newTheme);
16
- };
17
- // 3. Expose to app
18
- nuxtApp.provide('mTheme', {
19
- theme,
20
- toggleTheme,
21
- setTheme: (name) => {
22
- ;
23
- theme.global.name.value = name;
24
- if (typeof localStorage !== 'undefined')
25
- localStorage.setItem('mframework-theme', name);
7
+ const config = useRuntimeConfig();
8
+ const defaultTheme = config.public.mframeworkUi?.theme || 'light';
9
+ theme.global.name.value = defaultTheme;
10
+ theme.themes.value = {
11
+ light: {
12
+ dark: false,
13
+ colors: {
14
+ primary: 'var(--m-primary)',
15
+ secondary: 'var(--m-secondary)',
16
+ accent: 'var(--m-accent)',
17
+ surface: 'var(--m-surface)',
18
+ background: 'var(--m-muted)',
19
+ border: 'var(--m-border)'
20
+ }
21
+ },
22
+ dark: {
23
+ dark: true,
24
+ colors: {
25
+ primary: 'var(--m-primary)',
26
+ secondary: 'var(--m-secondary)',
27
+ accent: 'var(--m-accent)',
28
+ surface: 'var(--m-surface)',
29
+ background: 'var(--m-muted)',
30
+ border: 'var(--m-border)'
31
+ }
26
32
  }
27
- });
28
- };
33
+ };
34
+ });
@@ -1,88 +1,3 @@
1
- import '@mdi/font/css/materialdesignicons.css';
2
1
  import 'vuetify/styles';
3
- export declare const vuetify: {
4
- install: (app: import("vue").App<any>) => void;
5
- unmount: () => void;
6
- defaults: import("vue").Ref<import("vuetify").DefaultsInstance, import("vuetify").DefaultsInstance>;
7
- display: import("vuetify").DisplayInstance;
8
- theme: import("vuetify").ThemeInstance & {
9
- install: (app: import("vue").App<any>) => void;
10
- };
11
- icons: {
12
- defaultSet: string;
13
- aliases: Partial<import("vuetify").IconAliases>;
14
- sets: Record<string, import("vuetify").IconSet>;
15
- };
16
- locale: {
17
- name: string;
18
- decimalSeparator: import("vue").ShallowRef<string>;
19
- messages: import("vue").Ref<import("vuetify").LocaleMessages, import("vuetify").LocaleMessages>;
20
- current: import("vue").Ref<string, string>;
21
- fallback: import("vue").Ref<string, string>;
22
- t: (key: string, ...params: unknown[]) => string;
23
- n: (value: number) => string;
24
- provide: (props: import("vuetify").LocaleOptions) => import("vuetify").LocaleInstance;
25
- isRtl: import("vue").Ref<boolean, boolean>;
26
- rtl: import("vue").Ref<Record<string, boolean>, Record<string, boolean>>;
27
- rtlClasses: import("vue").Ref<string, string>;
28
- };
29
- date: {
30
- options: {
31
- adapter: (new (options: {
32
- locale: any;
33
- formats?: any;
34
- }) => import("vuetify").DateInstance) | import("vuetify").DateInstance;
35
- formats?: Record<string, any>;
36
- locale: Record<string, any>;
37
- };
38
- instance: {
39
- date: (value?: any) => unknown;
40
- format: (date: unknown, formatString: string) => string;
41
- toJsDate: (value: unknown) => Date;
42
- parseISO: (date: string) => unknown;
43
- toISO: (date: unknown) => string;
44
- startOfDay: (date: unknown) => unknown;
45
- endOfDay: (date: unknown) => unknown;
46
- startOfWeek: (date: unknown, firstDayOfWeek?: string | number | undefined) => unknown;
47
- endOfWeek: (date: unknown) => unknown;
48
- startOfMonth: (date: unknown) => unknown;
49
- endOfMonth: (date: unknown) => unknown;
50
- startOfYear: (date: unknown) => unknown;
51
- endOfYear: (date: unknown) => unknown;
52
- isAfter: (date: unknown, comparing: unknown) => boolean;
53
- isAfterDay: (date: unknown, comparing: unknown) => boolean;
54
- isSameDay: (date: unknown, comparing: unknown) => boolean;
55
- isSameMonth: (date: unknown, comparing: unknown) => boolean;
56
- isSameYear: (date: unknown, comparing: unknown) => boolean;
57
- isBefore: (date: unknown, comparing: unknown) => boolean;
58
- isEqual: (date: unknown, comparing: unknown) => boolean;
59
- isValid: (date: any) => boolean;
60
- isWithinRange: (date: unknown, range: [unknown, unknown]) => boolean;
61
- addMinutes: (date: unknown, amount: number) => unknown;
62
- addHours: (date: unknown, amount: number) => unknown;
63
- addDays: (date: unknown, amount: number) => unknown;
64
- addWeeks: (date: unknown, amount: number) => unknown;
65
- addMonths: (date: unknown, amount: number) => unknown;
66
- getYear: (date: unknown) => number;
67
- setYear: (date: unknown, year: number) => unknown;
68
- getDiff: (date: unknown, comparing: unknown, unit?: string | undefined) => number;
69
- getWeekArray: (date: unknown, firstDayOfWeek?: string | number | undefined) => unknown[][];
70
- getWeekdays: (firstDayOfWeek?: string | number | undefined, weekdayFormat?: "long" | "narrow" | "short" | undefined) => string[];
71
- getWeek: (date: unknown, firstDayOfWeek?: string | number | undefined, firstDayOfYear?: string | number | undefined) => number;
72
- getMonth: (date: unknown) => number;
73
- setMonth: (date: unknown, month: number) => unknown;
74
- getDate: (date: unknown) => number;
75
- setDate: (date: unknown, day: number) => unknown;
76
- getNextMonth: (date: unknown) => unknown;
77
- getPreviousMonth: (date: unknown) => unknown;
78
- getHours: (date: unknown) => number;
79
- setHours: (date: unknown, hours: number) => unknown;
80
- getMinutes: (date: unknown) => number;
81
- setMinutes: (date: unknown, minutes: number) => unknown;
82
- locale?: any;
83
- };
84
- };
85
- goTo: import("vuetify").GoToInstance;
86
- };
87
- declare const _default: (nuxtApp: any) => void;
2
+ declare const _default: import("nuxt/app").Plugin<Record<string, unknown>> & import("nuxt/app").ObjectPlugin<Record<string, unknown>>;
88
3
  export default _default;