@mframework/ui 0.0.6-beta6 → 0.1.0-beta.1

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 (245) hide show
  1. package/dist/adapters/adapter-directus/src/types/ui.d.ts +21 -0
  2. package/dist/module.d.mts +9 -0
  3. package/dist/module.d.ts +6 -0
  4. package/dist/module.js +68 -0
  5. package/dist/module.json +9 -0
  6. package/dist/module.mjs +38 -0
  7. package/dist/modules/ui/src/module.d.ts +8 -0
  8. package/dist/modules/ui/src/module.js +75 -0
  9. package/dist/modules/ui/src/runtime/composables/useMToast.d.ts +5 -0
  10. package/dist/modules/ui/src/runtime/composables/useMToast.js +11 -0
  11. package/dist/modules/ui/src/runtime/design/tokens.d.ts +22 -0
  12. package/dist/modules/ui/src/runtime/design/tokens.js +22 -0
  13. package/dist/modules/ui/src/runtime/plugins/builder.d.ts +3 -0
  14. package/dist/modules/ui/src/runtime/plugins/builder.js +311 -0
  15. package/dist/modules/ui/src/runtime/plugins/fontawesome.d.ts +3 -0
  16. package/dist/modules/ui/src/runtime/plugins/fontawesome.js +9 -0
  17. package/dist/modules/ui/src/runtime/plugins/formkit.d.ts +3 -0
  18. package/dist/modules/ui/src/runtime/plugins/formkit.js +8 -0
  19. package/dist/modules/ui/src/runtime/plugins/motion.d.ts +2 -0
  20. package/dist/modules/ui/src/runtime/plugins/motion.js +5 -0
  21. package/dist/modules/ui/src/runtime/plugins/theme-switcher.d.ts +2 -0
  22. package/dist/modules/ui/src/runtime/plugins/theme-switcher.js +27 -0
  23. package/dist/modules/ui/src/runtime/plugins/theme.d.ts +2 -0
  24. package/dist/modules/ui/src/runtime/plugins/theme.js +44 -0
  25. package/dist/modules/ui/src/runtime/plugins/vuetify.d.ts +3 -0
  26. package/dist/modules/ui/src/runtime/plugins/vuetify.js +33 -0
  27. package/dist/modules/ui/src/runtime/search/client.d.ts +2 -0
  28. package/dist/modules/ui/src/runtime/search/client.js +21 -0
  29. package/dist/modules/ui/src/runtime/search/plugin.d.ts +2 -0
  30. package/dist/modules/ui/src/runtime/search/plugin.js +7 -0
  31. package/dist/modules/ui/src/utils/color.d.ts +2 -0
  32. package/dist/modules/ui/src/utils/fonts.d.ts +5 -0
  33. package/dist/modules/ui/src/utils/formkit.d.ts +12 -0
  34. package/dist/modules/ui/src/utils/icons.d.ts +4 -0
  35. package/dist/runtime/assets/config/tailwind.conifg.d.ts +0 -0
  36. package/dist/runtime/components/MButton.d.vue.ts +0 -0
  37. package/dist/runtime/components/MButton.vue +15 -0
  38. package/dist/runtime/components/MButton.vue.d.ts +0 -0
  39. package/dist/runtime/composables/useMToast.d.ts +5 -0
  40. package/dist/runtime/composables/useMToast.js +11 -0
  41. package/dist/runtime/plugins/builder.d.ts +3 -0
  42. package/dist/runtime/plugins/builder.js +311 -0
  43. package/dist/runtime/plugins/fontawesome.d.ts +3 -0
  44. package/dist/runtime/plugins/fontawesome.js +9 -0
  45. package/dist/runtime/plugins/formkit.d.ts +3 -0
  46. package/dist/runtime/plugins/formkit.js +8 -0
  47. package/dist/runtime/plugins/icon-switcher.d.ts +1 -1
  48. package/dist/runtime/plugins/icon-switcher.js +15 -9
  49. package/dist/runtime/plugins/lightgallery.d.ts +6 -0
  50. package/dist/runtime/plugins/lightgallery.js +15 -0
  51. package/dist/runtime/plugins/motion.d.ts +2 -0
  52. package/dist/runtime/plugins/motion.js +5 -0
  53. package/dist/runtime/plugins/theme-switcher.d.ts +2 -0
  54. package/dist/runtime/plugins/theme-switcher.js +27 -0
  55. package/dist/runtime/plugins/theme.d.ts +1 -1
  56. package/dist/runtime/plugins/theme.js +31 -25
  57. package/dist/runtime/plugins/vuetify.d.ts +1 -86
  58. package/dist/runtime/plugins/vuetify.js +28 -55
  59. package/dist/runtime/search/components/MSearch.d.vue.ts +0 -0
  60. package/dist/runtime/search/components/MSearch.vue +19 -0
  61. package/dist/runtime/search/components/MSearch.vue.d.ts +0 -0
  62. package/dist/runtime/styles/index.css +5 -0
  63. package/dist/runtime/styles/tailwind.css +1 -0
  64. package/dist/runtime/styles/vuetify.css +3 -0
  65. package/dist/types.d.mts +9 -0
  66. package/dist/utils/color.d.ts +2 -0
  67. package/dist/utils/color.js +11 -0
  68. package/dist/utils/fonts.d.ts +5 -0
  69. package/dist/utils/fonts.js +18 -0
  70. package/dist/utils/formkit.d.ts +12 -0
  71. package/dist/utils/formkit.js +59 -0
  72. package/dist/utils/icons.d.ts +4 -0
  73. package/dist/utils/icons.js +36 -0
  74. package/package.json +32 -20
  75. package/src/module.ts +105 -0
  76. package/src/runtime/assets/config/tailwind.conifg.js +42 -0
  77. package/src/runtime/components/Gallery.vue +66 -0
  78. package/src/runtime/components/MButton.vue +17 -0
  79. package/src/runtime/composables/useMToast.ts +14 -0
  80. package/src/runtime/plugins/builder.ts +326 -0
  81. package/src/runtime/plugins/fontawesome.ts +11 -0
  82. package/src/runtime/plugins/formkit.ts +9 -0
  83. package/src/runtime/plugins/lightgallery.js +21 -0
  84. package/src/runtime/plugins/motion.ts +6 -0
  85. package/src/runtime/plugins/theme-switcher.ts +32 -0
  86. package/src/runtime/plugins/theme.ts +57 -0
  87. package/src/runtime/plugins/vuetify.ts +36 -0
  88. package/src/runtime/styles/index.scss +101 -0
  89. package/{runtime/assets/css → src/runtime/styles}/tailwind.css +1 -3
  90. package/src/runtime/styles/vuetify.scss +5 -0
  91. package/src/types/runtime-config.d.ts +12 -0
  92. package/src/utils/color.js +11 -0
  93. package/src/utils/fonts.js +18 -0
  94. package/src/utils/formkit.js +59 -0
  95. package/src/utils/icons.js +36 -0
  96. package/dist/runtime/plugins/icons.d.ts +0 -4
  97. package/dist/runtime/plugins/icons.js +0 -13
  98. package/module.ts +0 -72
  99. package/runtime/plugins/icon-switcher.ts +0 -32
  100. package/runtime/plugins/theme.ts +0 -29
  101. package/runtime/plugins/vuetify.js +0 -12
  102. package/runtime/plugins/vuetify.ts +0 -64
  103. package/tsconfig.json +0 -16
  104. package/type.d.ts +0 -5
  105. package/types/ui/api/global-search.js +0 -1
  106. package/types/ui/api/global-search.ts +0 -8
  107. package/types/ui/blocks/block-button-group.js +0 -1
  108. package/types/ui/blocks/block-button-group.ts +0 -7
  109. package/types/ui/blocks/block-button.js +0 -1
  110. package/types/ui/blocks/block-button.ts +0 -14
  111. package/types/ui/blocks/block-column.js +0 -1
  112. package/types/ui/blocks/block-column.ts +0 -20
  113. package/types/ui/blocks/block-cta.js +0 -1
  114. package/types/ui/blocks/block-cta.ts +0 -10
  115. package/types/ui/blocks/block-divider.js +0 -1
  116. package/types/ui/blocks/block-divider.ts +0 -4
  117. package/types/ui/blocks/block-faq.js +0 -1
  118. package/types/ui/blocks/block-faq.ts +0 -12
  119. package/types/ui/blocks/block-form.js +0 -1
  120. package/types/ui/blocks/block-form.ts +0 -8
  121. package/types/ui/blocks/block-gallery.js +0 -1
  122. package/types/ui/blocks/block-gallery.ts +0 -14
  123. package/types/ui/blocks/block-hero.js +0 -1
  124. package/types/ui/blocks/block-hero.ts +0 -12
  125. package/types/ui/blocks/block-html.js +0 -1
  126. package/types/ui/blocks/block-html.ts +0 -4
  127. package/types/ui/blocks/block-logocloud.js +0 -1
  128. package/types/ui/blocks/block-logocloud.ts +0 -14
  129. package/types/ui/blocks/block-quote.js +0 -1
  130. package/types/ui/blocks/block-quote.ts +0 -11
  131. package/types/ui/blocks/block-richtext.js +0 -1
  132. package/types/ui/blocks/block-richtext.ts +0 -7
  133. package/types/ui/blocks/block-steps.js +0 -1
  134. package/types/ui/blocks/block-steps.ts +0 -22
  135. package/types/ui/blocks/block-team.js +0 -1
  136. package/types/ui/blocks/block-team.ts +0 -6
  137. package/types/ui/blocks/block-testimonial.js +0 -1
  138. package/types/ui/blocks/block-testimonial.ts +0 -14
  139. package/types/ui/blocks/block-video.js +0 -1
  140. package/types/ui/blocks/block-video.ts +0 -10
  141. package/types/ui/blocks/block.js +0 -1
  142. package/types/ui/blocks/block.ts +0 -49
  143. package/types/ui/blocks/index.js +0 -1
  144. package/types/ui/blocks/index.ts +0 -18
  145. package/types/ui/component.js +0 -1
  146. package/types/ui/component.ts +0 -7
  147. package/types/ui/content/category.js +0 -1
  148. package/types/ui/content/category.ts +0 -11
  149. package/types/ui/content/form.js +0 -1
  150. package/types/ui/content/form.ts +0 -20
  151. package/types/ui/content/index.js +0 -1
  152. package/types/ui/content/index.ts +0 -6
  153. package/types/ui/content/page.js +0 -1
  154. package/types/ui/content/page.ts +0 -76
  155. package/types/ui/content/post.js +0 -1
  156. package/types/ui/content/post.ts +0 -39
  157. package/types/ui/content/team.js +0 -1
  158. package/types/ui/content/team.ts +0 -16
  159. package/types/ui/content/testimonial.js +0 -1
  160. package/types/ui/content/testimonial.ts +0 -19
  161. package/types/ui/env.d.ts +0 -8
  162. package/types/ui/form.js +0 -1
  163. package/types/ui/form.ts +0 -17
  164. package/types/ui/help/index.js +0 -1
  165. package/types/ui/help/index.ts +0 -53
  166. package/types/ui/meta/analytics.js +0 -1
  167. package/types/ui/meta/analytics.ts +0 -18
  168. package/types/ui/meta/config.js +0 -1
  169. package/types/ui/meta/config.ts +0 -21
  170. package/types/ui/meta/globals.js +0 -1
  171. package/types/ui/meta/globals.ts +0 -30
  172. package/types/ui/meta/index.js +0 -1
  173. package/types/ui/meta/index.ts +0 -6
  174. package/types/ui/meta/navigation.js +0 -1
  175. package/types/ui/meta/navigation.ts +0 -32
  176. package/types/ui/meta/redirect.js +0 -1
  177. package/types/ui/meta/redirect.ts +0 -13
  178. package/types/ui/meta/seo.js +0 -1
  179. package/types/ui/meta/seo.ts +0 -19
  180. package/types/ui/os/contact.js +0 -1
  181. package/types/ui/os/contact.ts +0 -23
  182. package/types/ui/os/conversation.js +0 -1
  183. package/types/ui/os/conversation.ts +0 -25
  184. package/types/ui/os/index.js +0 -1
  185. package/types/ui/os/index.ts +0 -16
  186. package/types/ui/os/organization.js +0 -1
  187. package/types/ui/os/organization.ts +0 -54
  188. package/types/ui/os/os-activity.js +0 -1
  189. package/types/ui/os/os-activity.ts +0 -28
  190. package/types/ui/os/os-deal.js +0 -1
  191. package/types/ui/os/os-deal.ts +0 -45
  192. package/types/ui/os/os-expense.js +0 -1
  193. package/types/ui/os/os-expense.ts +0 -22
  194. package/types/ui/os/os-invoice.js +0 -1
  195. package/types/ui/os/os-invoice.ts +0 -48
  196. package/types/ui/os/os-item.js +0 -1
  197. package/types/ui/os/os-item.ts +0 -18
  198. package/types/ui/os/os-payment.js +0 -1
  199. package/types/ui/os/os-payment.ts +0 -29
  200. package/types/ui/os/os-project.js +0 -1
  201. package/types/ui/os/os-project.ts +0 -47
  202. package/types/ui/os/os-proposal.js +0 -1
  203. package/types/ui/os/os-proposal.ts +0 -84
  204. package/types/ui/os/os-settings.js +0 -1
  205. package/types/ui/os/os-settings.ts +0 -19
  206. package/types/ui/os/os-subscription.js +0 -1
  207. package/types/ui/os/os-subscription.ts +0 -12
  208. package/types/ui/os/os-task.js +0 -1
  209. package/types/ui/os/os-task.ts +0 -34
  210. package/types/ui/os/os-tax-rate.js +0 -1
  211. package/types/ui/os/os-tax-rate.ts +0 -13
  212. package/types/ui/pageComponentMap.js +0 -7
  213. package/types/ui/pageComponentMap.ts +0 -8
  214. package/types/ui/pagination.js +0 -1
  215. package/types/ui/pagination.ts +0 -6
  216. package/types/ui/schema.d.ts +0 -39
  217. package/types/ui/schema.js +0 -1
  218. package/types/ui/schema.ts +0 -151
  219. package/types/ui/state.js +0 -1
  220. package/types/ui/state.ts +0 -5
  221. package/types/ui/system/file.js +0 -1
  222. package/types/ui/system/file.ts +0 -46
  223. package/types/ui/system/folder.js +0 -1
  224. package/types/ui/system/folder.ts +0 -8
  225. package/types/ui/system/index.js +0 -1
  226. package/types/ui/system/index.ts +0 -4
  227. package/types/ui/system/role.js +0 -1
  228. package/types/ui/system/role.ts +0 -21
  229. package/types/ui/system/user.js +0 -1
  230. package/types/ui/system/user.ts +0 -56
  231. package/types/ui.ts +0 -23
  232. /package/{types → dist/adapters/adapter-directus/src/types}/ui.js +0 -0
  233. /package/{utils → dist/modules/ui/src/utils}/color.js +0 -0
  234. /package/{utils → dist/modules/ui/src/utils}/fonts.js +0 -0
  235. /package/{utils → dist/modules/ui/src/utils}/formkit.js +0 -0
  236. /package/{utils → dist/modules/ui/src/utils}/icons.js +0 -0
  237. /package/{runtime → dist/runtime}/assets/config/tailwind.conifg.js +0 -0
  238. /package/{runtime → src/runtime}/design/tokens.ts +0 -0
  239. /package/{runtime → src/runtime}/search/client.ts +0 -0
  240. /package/{runtime → src/runtime}/search/components/MSearch.vue +0 -0
  241. /package/{runtime → src/runtime}/search/plugin.ts +0 -0
  242. /package/{utils → src/utils}/color.ts +0 -0
  243. /package/{utils → src/utils}/fonts.ts +0 -0
  244. /package/{utils → src/utils}/formkit.ts +0 -0
  245. /package/{utils → src/utils}/icons.ts +0 -0
@@ -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;
@@ -1,60 +1,33 @@
1
- // plugins/vuetify.ts
2
- import '@mdi/font/css/materialdesignicons.css';
3
- import 'vuetify/styles';
1
+ import { defineNuxtPlugin, useRuntimeConfig } from 'nuxt/app';
4
2
  import { createVuetify } from 'vuetify';
5
- import { aliases, fa } from 'vuetify/iconsets/fa-svg';
6
- import { library } from '@fortawesome/fontawesome-svg-core';
7
- import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
8
- import { fas } from '@fortawesome/free-solid-svg-icons';
9
3
  import * as components from 'vuetify/components';
10
- import * as labsComponents from 'vuetify/labs/components';
11
4
  import * as directives from 'vuetify/directives';
12
- import { mdi } from 'vuetify/iconsets/mdi';
13
- // Register fontawesome icons at module scope
14
- library.add(fas);
15
- // Create Vuetify instance at module scope so other runtime plugins can import it
16
- export const vuetify = createVuetify({
17
- ssr: true,
18
- directives,
19
- icons: {
20
- defaultSet: 'fa',
21
- aliases,
22
- sets: {
23
- fa,
24
- mdi,
25
- },
26
- },
27
- components: {
28
- ...components,
29
- ...labsComponents,
30
- },
31
- theme: {
32
- defaultTheme: 'light',
33
- themes: {
34
- light: {
35
- dark: false,
36
- variables: {}, // required to avoid Vuetify crash
37
- colors: {
38
- primary: '#6200EE',
39
- 'primary-darken-1': '#3700B3',
40
- secondary: '#03DAC6',
41
- 'secondary-darken-1': '#018786',
42
- error: '#B00020',
43
- info: '#2196F3',
44
- success: '#4CAF50',
45
- warning: '#FB8C00',
5
+ import 'vuetify/styles';
6
+ export default defineNuxtPlugin((nuxtApp) => {
7
+ const config = useRuntimeConfig();
8
+ const theme = config.public.mframeworkUi?.theme || 'light';
9
+ const vuetify = createVuetify({
10
+ components,
11
+ directives,
12
+ theme: {
13
+ defaultTheme: theme,
14
+ themes: {
15
+ light: {
16
+ dark: false,
17
+ colors: {
18
+ primary: '#3b82f6',
19
+ secondary: '#64748b'
20
+ }
46
21
  },
47
- },
48
- dark: {
49
- dark: true,
50
- variables: {},
51
- colors: {},
52
- },
53
- },
54
- },
55
- });
56
- export default (nuxtApp) => {
57
- // Register FontAwesome component on the actual Vue app instance
58
- nuxtApp.vueApp.component('font-awesome-icon', FontAwesomeIcon);
22
+ dark: {
23
+ dark: true,
24
+ colors: {
25
+ primary: '#3b82f6',
26
+ secondary: '#64748b'
27
+ }
28
+ }
29
+ }
30
+ }
31
+ });
59
32
  nuxtApp.vueApp.use(vuetify);
60
- };
33
+ });
@@ -0,0 +1,19 @@
1
+ <template>
2
+ <ais-instant-search :search-client="client" :index-name="index">
3
+ <ais-search-box />
4
+ <ais-hits>
5
+ <template #item="{ item }">
6
+ <slot name="hit" :item="item">
7
+ <div class="p-2 border rounded">
8
+ <ais-highlight attribute="title" :hit="item" />
9
+ </div>
10
+ </slot>
11
+ </template>
12
+ </ais-hits>
13
+ </ais-instant-search>
14
+ </template>
15
+
16
+ <script setup>
17
+ const client = inject("mSearchClient");
18
+ const index = inject("mSearchIndex");
19
+ </script>
@@ -0,0 +1,5 @@
1
+ @import './tailwind.css';
2
+ :root {
3
+ --m-primary: #3b82f6;
4
+ --m-secondary: #64748b;
5
+ }
@@ -0,0 +1 @@
1
+ @tailwind base;@tailwind components;@tailwind utilities;
@@ -0,0 +1,3 @@
1
+ body {
2
+ font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
3
+ }
@@ -0,0 +1,9 @@
1
+ import type { NuxtModule } from '@nuxt/schema'
2
+
3
+ import type { default as Module } from './module.mjs'
4
+
5
+ export type ModuleOptions = typeof Module extends NuxtModule<infer O> ? Partial<O> : Record<string, any>
6
+
7
+ export { default } from './module.mjs'
8
+
9
+ export { type MFrameworkUiOptions } from './module.mjs'
@@ -0,0 +1,2 @@
1
+ declare function getContrastColor(hexColor: string): "#ffffff" | "#000000";
2
+ export { getContrastColor };
@@ -0,0 +1,11 @@
1
+ function getContrastColor(hexColor) {
2
+ // Convert hex color to RGB format
3
+ const red = parseInt(hexColor.slice(1, 3), 16);
4
+ const green = parseInt(hexColor.slice(3, 5), 16);
5
+ const blue = parseInt(hexColor.slice(5, 7), 16);
6
+ // Calculate relative luminance of the color
7
+ const luminance = (0.2126 * red + 0.7152 * green + 0.0722 * blue) / 255;
8
+ // Return black or white depending on the luminance value
9
+ return luminance > 0.5 ? '#000000' : '#ffffff';
10
+ }
11
+ export { getContrastColor };
@@ -0,0 +1,5 @@
1
+ type FontFamilies = {
2
+ [font: string]: boolean | number[];
3
+ };
4
+ export declare const formatFonts: (families: FontFamilies, defaultWeights?: number[]) => string[];
5
+ export {};
@@ -0,0 +1,18 @@
1
+ export const formatFonts = (families, defaultWeights = [400]) => {
2
+ const formatted = [];
3
+ for (const font in families) {
4
+ const formattedFont = font.replace(/ /g, '+'); // Replace spaces with '+'
5
+ const weights = families[font];
6
+ if (weights === true) {
7
+ for (const weight of defaultWeights) {
8
+ formatted.push(`${formattedFont}:${weight}`);
9
+ }
10
+ }
11
+ else if (Array.isArray(weights)) {
12
+ for (const weight of weights) {
13
+ formatted.push(`${formattedFont}:${weight}`);
14
+ }
15
+ }
16
+ }
17
+ return formatted;
18
+ };
@@ -0,0 +1,12 @@
1
+ export interface Condition {
2
+ field: string;
3
+ action: 'show' | 'hide';
4
+ condition: 'is_empty' | 'is_filled' | 'contains' | 'not_contains' | 'equals' | 'not_equal';
5
+ value: string;
6
+ }
7
+ export declare function mapConditions(conditions: Condition[]): void;
8
+ export declare function transformSchema(schema: Array<object>): {
9
+ $cmp: any;
10
+ children: any;
11
+ props: any;
12
+ }[];
@@ -0,0 +1,59 @@
1
+ import { unref } from 'vue';
2
+ function convertBoolean(value) {
3
+ if (value === 'true' || value === 'false') {
4
+ return value === 'true';
5
+ }
6
+ else {
7
+ return value;
8
+ }
9
+ }
10
+ function mapCondition(condition, target) {
11
+ switch (condition) {
12
+ case 'is_empty':
13
+ return `!$get(${target}).value)`;
14
+ case 'is_filled':
15
+ return `$get(${target}).value)`;
16
+ default:
17
+ return undefined;
18
+ }
19
+ }
20
+ export function mapConditions(conditions) {
21
+ // Both $el and $cmp schema nodes can leverage an if property that roughly equates to a v-if in Vue. If the expression assigned to the if property is truthy, the node is rendered, otherwise it is not:
22
+ }
23
+ export function transformSchema(schema) {
24
+ // Loop through the form schema from Directus
25
+ // This is required for FormKit to work
26
+ const items = unref(schema);
27
+ return items.map((item) => {
28
+ const { conditions, field, name, children, ...props } = item;
29
+ // console.log('conditions', conditions);
30
+ // console.log('mapCondition', mapCondition(conditions[0].condition, field));
31
+ const cmpSchema = {
32
+ $cmp: item.$el ? item.$el : 'FormKit',
33
+ children: children,
34
+ // if: conditions ? mapCondition(conditions[0].condition, field) : undefined,
35
+ props: {
36
+ id: name,
37
+ ...props,
38
+ },
39
+ };
40
+ // Switch statement to handle item widths
41
+ switch (item.width) {
42
+ case '33':
43
+ cmpSchema.props.outerClass = 'md:col-span-2';
44
+ break;
45
+ case '50':
46
+ cmpSchema.props.outerClass = 'md:col-span-3';
47
+ break;
48
+ case '67':
49
+ cmpSchema.props.outerClass = 'md:col-span-4';
50
+ break;
51
+ case '100':
52
+ cmpSchema.props.outerClass = 'md:col-span-6';
53
+ break;
54
+ default:
55
+ cmpSchema.props.outerClass = 'md:col-span-6';
56
+ }
57
+ return cmpSchema;
58
+ });
59
+ }
@@ -0,0 +1,4 @@
1
+ type FileType = 'folder' | 'image/jpeg' | 'image/png' | 'image/gif' | 'image/svg+xml' | 'image/webp' | 'video/mp4' | 'video/quicktime' | 'audio/mp3' | 'audio/aac' | 'audio/wav' | 'audio/ogg' | 'text/csv' | 'text/plain' | 'application/pdf' | 'application/vnd.ms-excel' | 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' | 'application/msword' | 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' | 'application/vnd.ms-powerpoint' | 'application/vnd.openxmlformats-officedocument.presentationml.presentation';
2
+ export declare const fileIconMap: Record<FileType, string>;
3
+ export declare function getFileIcon(filetype: FileType | string | null | undefined): string;
4
+ export {};
@@ -0,0 +1,36 @@
1
+ export const fileIconMap = {
2
+ folder: 'material-symbols:folder',
3
+ // Images
4
+ 'image/jpeg': 'material-symbols:image',
5
+ 'image/png': 'material-symbols:image',
6
+ 'image/gif': 'material-symbols:image',
7
+ 'image/svg+xml': 'material-symbols:image',
8
+ 'image/webp': 'material-symbols:image',
9
+ // Videos
10
+ 'video/mp4': 'material-symbols:smart-display',
11
+ 'video/quicktime': 'material-symbols:smart-display',
12
+ // Audio
13
+ 'audio/mp3': 'material-symbols:audio-file',
14
+ 'audio/aac': 'material-symbols:audio-file',
15
+ 'audio/wav': 'material-symbols:audio-file',
16
+ 'audio/ogg': 'material-symbols:audio-file',
17
+ // Text
18
+ 'text/csv': 'material-symbols:csv',
19
+ 'text/plain': 'material-symbols:text-snippet',
20
+ // Files
21
+ 'application/pdf': 'material-symbols:picture-as-pdf-sharp',
22
+ 'application/vnd.ms-excel': 'material-symbols:sheets',
23
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': 'material-symbols:sheets',
24
+ 'application/msword': 'material-symbols:docs',
25
+ 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': 'material-symbols:docs',
26
+ 'application/vnd.ms-powerpoint': 'material-symbols:slides',
27
+ 'application/vnd.openxmlformats-officedocument.presentationml.presentation': 'material-symbols:slides',
28
+ };
29
+ export function getFileIcon(filetype) {
30
+ if (!filetype)
31
+ return 'material-symbols:attachment';
32
+ if (typeof filetype === 'string' && !(filetype in fileIconMap)) {
33
+ return 'material-symbols:attachment';
34
+ }
35
+ return fileIconMap[filetype];
36
+ }
package/package.json CHANGED
@@ -1,24 +1,29 @@
1
1
  {
2
2
  "name": "@mframework/ui",
3
- "version": "0.0.6-beta6",
4
- "description": "Official opinionated UI module for the M Framework.",
3
+ "version": "0.1.0-beta.1",
4
+ "type": "module",
5
+ "description": "Opiniated UI module for the M Framework.",
5
6
  "keywords": [
7
+ "vue",
8
+ "nuxt",
6
9
  "ui",
7
- "vuetify",
8
- "fontawesome",
9
- "m-framework",
10
+ "components",
11
+ "mframework",
10
12
  "meeovi"
11
13
  ],
12
- "license": "MIT",
13
- "author": "M Framework",
14
- "type": "module",
15
- "main": "module.ts",
16
- "exports": {
17
- "./module": "./module.ts"
18
- },
19
- "types": "./types.d.ts",
14
+ "main": "dist/src/module.cjs",
15
+ "module": "dist/src/module.mjs",
16
+ "files": [
17
+ "dist",
18
+ "src"
19
+ ],
20
20
  "scripts": {
21
- "build": "tsc -p tsconfig.json"
21
+ "build": "tsc -p tsconfig.json",
22
+ "dev": "nuxt-module-dev"
23
+ },
24
+ "peerDependencies": {
25
+ "nuxt": "^3.13.0",
26
+ "vue": "^3.5.0"
22
27
  },
23
28
  "dependencies": {
24
29
  "@formkit/nuxt": "^1.7.2",
@@ -27,16 +32,23 @@
27
32
  "@fortawesome/free-solid-svg-icons": "^7.1.0",
28
33
  "@fortawesome/vue-fontawesome": "^3.1.2",
29
34
  "@mdi/font": "^7.4.47",
30
- "@nuxt/fonts": "^0.13.0",
31
- "@nuxt/kit": "^4.3.1",
35
+ "@nuxt/image": "^2.0.0",
32
36
  "@vueuse/motion": "^3.0.3",
37
+ "grapesjs": "^0.22.14",
38
+ "izitoast": "^1.4.0",
39
+ "lg-thumbnail": "^1.2.1",
40
+ "lg-video": "^1.4.0",
41
+ "lg-zoom": "^1.3.0",
42
+ "lightgallery": "^2.9.0",
33
43
  "tailwindcss": "^4.1.18",
34
- "vue": "^3.5.28",
35
- "vuetify": "^3.11.8",
36
- "vuetify-nuxt-module": "^0.19.5"
44
+ "vue-tsc": "^3.2.4",
45
+ "vuetify": "^3.7.0",
46
+ "vuetify-nuxt-module": "^0.18.8"
37
47
  },
38
48
  "devDependencies": {
49
+ "@nuxt/module-builder": "^1.0.2",
39
50
  "sass": "^1.94.2",
40
- "sass-embedded": "^1.93.3"
51
+ "sass-embedded": "^1.93.3",
52
+ "typescript": "^5.7.0"
41
53
  }
42
54
  }