@mythpe/quasar-ui-qui 0.4.103 → 0.5.0

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 (226) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +71 -129
  3. package/package.json +58 -68
  4. package/rREADME.md +147 -0
  5. package/src/components/MBtn/MBtn.ts +38 -0
  6. package/src/components/MBtn/MBtn.vue +142 -0
  7. package/src/components/grid/MColumn/MColumn.ts +15 -0
  8. package/src/components/grid/MColumn/MColumn.vue +28 -0
  9. package/src/components/grid/MContainer/MContainer.ts +39 -0
  10. package/src/components/grid/MContainer/MContainer.vue +66 -0
  11. package/src/components/grid/MGrid.ts +16 -0
  12. package/src/components/grid/MGrid.vue +47 -0
  13. package/src/components/grid/MRow/MRow.ts +15 -0
  14. package/src/components/grid/{MColumn.vue → MRow/MRow.vue} +12 -10
  15. package/src/components/index.ts +28 -18
  16. package/src/composables/useMyth.ts +93 -0
  17. package/src/composables/useMythMeta.ts +40 -0
  18. package/src/config/config.ts +16 -0
  19. package/src/config/grid.ts +10 -0
  20. package/src/config/index.ts +2 -0
  21. package/src/css/components/m-btn.scss +13 -0
  22. package/src/css/index.scss +9 -0
  23. package/src/env.d.ts +14 -0
  24. package/src/index.common.js +1 -15
  25. package/src/index.ts +4 -0
  26. package/src/index.umd.js +2 -15
  27. package/src/shims-myth.d.ts +6 -0
  28. package/src/shims-vue.d.ts +22 -0
  29. package/src/types/config.ts +136 -0
  30. package/src/types/helpers.ts +21 -0
  31. package/src/types/index.ts +9 -0
  32. package/src/types/vue-prop-types.ts +13 -0
  33. package/src/utils/helpers.ts +446 -0
  34. package/src/{icons/config.ts → utils/icons.ts} +0 -9
  35. package/src/utils/index.ts +74 -11
  36. package/src/utils/str.ts +237 -0
  37. package/src/utils/vee-rules.ts +8 -4
  38. package/src/vue-plugin.ts +76 -0
  39. package/index.d.ts +0 -17
  40. package/jsconfig.json +0 -10
  41. package/src/boot/register.ts +0 -14
  42. package/src/components/datatable/MDatatable.vue +0 -1812
  43. package/src/components/datatable/MDtAvatar.vue +0 -49
  44. package/src/components/datatable/MDtBtn.vue +0 -171
  45. package/src/components/datatable/MDtColorColumn.vue +0 -55
  46. package/src/components/datatable/MDtContextmenuItems.vue +0 -69
  47. package/src/components/datatable/MDtCopyColumn.vue +0 -87
  48. package/src/components/datatable/MDtDescColumn.vue +0 -60
  49. package/src/components/datatable/MDtImageColumn.vue +0 -76
  50. package/src/components/datatable/MDtSarColumn.vue +0 -76
  51. package/src/components/datatable/MDtUrlColumn.vue +0 -70
  52. package/src/components/datatable/index.ts +0 -21
  53. package/src/components/form/MAvatarViewer.vue +0 -408
  54. package/src/components/form/MAxios.vue +0 -219
  55. package/src/components/form/MBtn.vue +0 -240
  56. package/src/components/form/MCheckbox.vue +0 -204
  57. package/src/components/form/MCkeditor.vue +0 -860
  58. package/src/components/form/MColor.vue +0 -118
  59. package/src/components/form/MDate.vue +0 -51
  60. package/src/components/form/MEditor.vue +0 -272
  61. package/src/components/form/MEmail.vue +0 -46
  62. package/src/components/form/MField.vue +0 -149
  63. package/src/components/form/MFile.vue +0 -221
  64. package/src/components/form/MForm.vue +0 -89
  65. package/src/components/form/MHidden.vue +0 -89
  66. package/src/components/form/MHiddenInput.vue +0 -61
  67. package/src/components/form/MInput.vue +0 -289
  68. package/src/components/form/MInputFieldControl.vue +0 -27
  69. package/src/components/form/MInputLabel.vue +0 -42
  70. package/src/components/form/MMobile.vue +0 -67
  71. package/src/components/form/MOptions.vue +0 -402
  72. package/src/components/form/MOtp.vue +0 -296
  73. package/src/components/form/MPassword.vue +0 -77
  74. package/src/components/form/MPhone.vue +0 -184
  75. package/src/components/form/MPicker.vue +0 -378
  76. package/src/components/form/MRadio.vue +0 -188
  77. package/src/components/form/MSelect.vue +0 -461
  78. package/src/components/form/MSignaturePad.vue +0 -301
  79. package/src/components/form/MTime.vue +0 -48
  80. package/src/components/form/MToggle.vue +0 -244
  81. package/src/components/form/MUploader.vue +0 -544
  82. package/src/components/form/__MCkeditor.vue +0 -403
  83. package/src/components/form/__MOptions.vue +0 -289
  84. package/src/components/form/index.ts +0 -71
  85. package/src/components/form/useCkeditor.ts +0 -26
  86. package/src/components/grid/MBlock.vue +0 -69
  87. package/src/components/grid/MCol.vue +0 -60
  88. package/src/components/grid/MContainer.vue +0 -60
  89. package/src/components/grid/MHelpRow.vue +0 -60
  90. package/src/components/grid/MInnerLoading.vue +0 -45
  91. package/src/components/grid/MRow.vue +0 -57
  92. package/src/components/grid/index.ts +0 -19
  93. package/src/components/map/MMap.vue +0 -69
  94. package/src/components/map/index.ts +0 -12
  95. package/src/components/modal/MDialog.vue +0 -59
  96. package/src/components/modal/MDialogFile.vue +0 -111
  97. package/src/components/modal/MFrameDialog.vue +0 -126
  98. package/src/components/modal/MModalMenu.vue +0 -77
  99. package/src/components/modal/MTooltip.vue +0 -39
  100. package/src/components/modal/index.ts +0 -9
  101. package/src/components/parials/MUploaderItem.vue +0 -350
  102. package/src/components/parials/index.ts +0 -5
  103. package/src/components/sar/MSarIcon.vue +0 -24
  104. package/src/components/sar/MSarString.vue +0 -58
  105. package/src/components/sar/index.ts +0 -14
  106. package/src/components/transition/MTransition.vue +0 -28
  107. package/src/components/transition/MTransitionGroup.vue +0 -28
  108. package/src/components/transition/index.ts +0 -14
  109. package/src/components/transition/useTransition.ts +0 -98
  110. package/src/components/typography/MTypingString.vue +0 -86
  111. package/src/components/typography/index.ts +0 -13
  112. package/src/composable/index.ts +0 -13
  113. package/src/composable/useBindInput.ts +0 -273
  114. package/src/composable/useDtHelpers.ts +0 -1105
  115. package/src/composable/useError.ts +0 -12
  116. package/src/composable/useMyth.ts +0 -364
  117. package/src/composable/useValue.ts +0 -13
  118. package/src/fonts/Almarai/Almarai-Bold.ttf +0 -0
  119. package/src/fonts/Almarai/Almarai-ExtraBold.ttf +0 -0
  120. package/src/fonts/Almarai/Almarai-Light.ttf +0 -0
  121. package/src/fonts/Almarai/Almarai-Regular.ttf +0 -0
  122. package/src/fonts/Almarai/index.sass +0 -68
  123. package/src/fonts/Noto_Kufi/NotoKufiArabic-Black.ttf +0 -0
  124. package/src/fonts/Noto_Kufi/NotoKufiArabic-Bold.ttf +0 -0
  125. package/src/fonts/Noto_Kufi/NotoKufiArabic-ExtraBold.ttf +0 -0
  126. package/src/fonts/Noto_Kufi/NotoKufiArabic-ExtraLight.ttf +0 -0
  127. package/src/fonts/Noto_Kufi/NotoKufiArabic-Light.ttf +0 -0
  128. package/src/fonts/Noto_Kufi/NotoKufiArabic-Medium.ttf +0 -0
  129. package/src/fonts/Noto_Kufi/NotoKufiArabic-Regular.ttf +0 -0
  130. package/src/fonts/Noto_Kufi/NotoKufiArabic-SemiBold.ttf +0 -0
  131. package/src/fonts/Noto_Kufi/NotoKufiArabic-Thin.ttf +0 -0
  132. package/src/fonts/Noto_Kufi/NotoKufiArabic-VariableFont_wght.ttf +0 -0
  133. package/src/fonts/Noto_Kufi/index.sass +0 -149
  134. package/src/fonts/Tajawal/Tajawal-Black.ttf +0 -0
  135. package/src/fonts/Tajawal/Tajawal-Bold.ttf +0 -0
  136. package/src/fonts/Tajawal/Tajawal-ExtraBold.ttf +0 -0
  137. package/src/fonts/Tajawal/Tajawal-ExtraLight.ttf +0 -0
  138. package/src/fonts/Tajawal/Tajawal-Light.ttf +0 -0
  139. package/src/fonts/Tajawal/Tajawal-Medium.ttf +0 -0
  140. package/src/fonts/Tajawal/Tajawal-Regular.ttf +0 -0
  141. package/src/fonts/Tajawal/index.sass +0 -79
  142. package/src/fonts/index.sass +0 -10
  143. package/src/global.d.ts +0 -16
  144. package/src/icons/index.ts +0 -10
  145. package/src/index.esm.js +0 -15
  146. package/src/index.js +0 -15
  147. package/src/index.sass +0 -24
  148. package/src/plugin/defineAsyncComponents.ts +0 -75
  149. package/src/plugin/defineComponents.ts +0 -8
  150. package/src/style/brands.sass +0 -47
  151. package/src/style/ckeditor5.sass +0 -20
  152. package/src/style/effect.sass +0 -143
  153. package/src/style/fonts.sass +0 -37
  154. package/src/style/m-container.sass +0 -20
  155. package/src/style/m-datatable.sass +0 -114
  156. package/src/style/m-help-row.sass +0 -12
  157. package/src/style/m-input.sass +0 -74
  158. package/src/style/m-picker.sass +0 -15
  159. package/src/style/m-select.sass +0 -12
  160. package/src/style/m-toggle.sass +0 -11
  161. package/src/style/main.sass +0 -117
  162. package/src/style/print.sass +0 -22
  163. package/src/style/sar-font.sass +0 -27
  164. package/src/style/scrollbar.sass +0 -37
  165. package/src/style/transition.sass +0 -48
  166. package/src/style/typography.sass +0 -39
  167. package/src/types/api/MAvatarViewer.d.ts +0 -110
  168. package/src/types/api/MAxios.d.ts +0 -52
  169. package/src/types/api/MBlock.d.ts +0 -29
  170. package/src/types/api/MBtn.d.ts +0 -25
  171. package/src/types/api/MCheckbox.d.ts +0 -45
  172. package/src/types/api/MCkeditor.d.ts +0 -40
  173. package/src/types/api/MCol.d.ts +0 -55
  174. package/src/types/api/MColumn.d.ts +0 -16
  175. package/src/types/api/MContainer.d.ts +0 -19
  176. package/src/types/api/MDate.d.ts +0 -15
  177. package/src/types/api/MDialog.d.ts +0 -18
  178. package/src/types/api/MDialogFile.d.ts +0 -19
  179. package/src/types/api/MEditor.d.ts +0 -13
  180. package/src/types/api/MField.d.ts +0 -12
  181. package/src/types/api/MFile.d.ts +0 -21
  182. package/src/types/api/MForm.d.ts +0 -55
  183. package/src/types/api/MFrameDialog.d.ts +0 -21
  184. package/src/types/api/MHelpRow.d.ts +0 -19
  185. package/src/types/api/MHidden.d.ts +0 -20
  186. package/src/types/api/MHiddenInput.d.ts +0 -26
  187. package/src/types/api/MInnerLoading.d.ts +0 -17
  188. package/src/types/api/MInput.d.ts +0 -180
  189. package/src/types/api/MInputFieldControl.d.ts +0 -16
  190. package/src/types/api/MInputLabel.d.ts +0 -17
  191. package/src/types/api/MMap.d.ts +0 -24
  192. package/src/types/api/MModalMenu.d.ts +0 -17
  193. package/src/types/api/MOptions.d.ts +0 -72
  194. package/src/types/api/MOtp.d.ts +0 -52
  195. package/src/types/api/MPassword.d.ts +0 -20
  196. package/src/types/api/MPhone.d.ts +0 -21
  197. package/src/types/api/MPicker.d.ts +0 -49
  198. package/src/types/api/MRadio.d.ts +0 -13
  199. package/src/types/api/MRow.d.ts +0 -24
  200. package/src/types/api/MSar.d.ts +0 -28
  201. package/src/types/api/MSelect.d.ts +0 -200
  202. package/src/types/api/MSignaturePad.d.ts +0 -185
  203. package/src/types/api/MTime.d.ts +0 -12
  204. package/src/types/api/MToggle.d.ts +0 -39
  205. package/src/types/api/MTooltip.d.ts +0 -136
  206. package/src/types/api/MTransition.d.ts +0 -143
  207. package/src/types/api/MTypingString.d.ts +0 -24
  208. package/src/types/api/MUploader.d.ts +0 -189
  209. package/src/types/api-helpers.d.ts +0 -66
  210. package/src/types/components.d.ts +0 -150
  211. package/src/types/google.d.ts +0 -19
  212. package/src/types/index.d.ts +0 -110
  213. package/src/types/m-datatable.d.ts +0 -498
  214. package/src/types/m-helpers.d.ts +0 -99
  215. package/src/types/myth-api.d.ts +0 -51
  216. package/src/types/plugin-props-option.d.ts +0 -313
  217. package/src/types/quasar-helpers.d.ts +0 -7
  218. package/src/types/theme.d.ts +0 -162
  219. package/src/utils/Helpers.ts +0 -406
  220. package/src/utils/Str.ts +0 -246
  221. package/src/utils/__pluralize.js +0 -493
  222. package/src/utils/const.ts +0 -1
  223. package/src/utils/createMyth.ts +0 -49
  224. package/src/utils/vue-plugin.ts +0 -66
  225. package/tsconfig.json +0 -35
  226. package/types.d.ts +0 -17
@@ -0,0 +1,142 @@
1
+ <script lang="ts" setup>
2
+ import {
3
+ QBtn,
4
+ QSpinner,
5
+ QSpinnerAudio,
6
+ QSpinnerBall,
7
+ QSpinnerBars,
8
+ QSpinnerBox,
9
+ QSpinnerClock,
10
+ QSpinnerComment,
11
+ QSpinnerCube,
12
+ QSpinnerDots,
13
+ QSpinnerFacebook,
14
+ QSpinnerGears,
15
+ QSpinnerGrid,
16
+ QSpinnerHearts,
17
+ QSpinnerHourglass,
18
+ QSpinnerInfinity,
19
+ QSpinnerIos,
20
+ QSpinnerOrbit,
21
+ QSpinnerOval,
22
+ QSpinnerPie,
23
+ QSpinnerPuff,
24
+ QSpinnerRadio,
25
+ QSpinnerRings,
26
+ QSpinnerTail
27
+ } from 'quasar'
28
+ import { computed } from 'vue'
29
+ import type { MBtnProps } from './MBtn'
30
+ import { useMyth } from '../../vue-plugin'
31
+ import { pascalCase } from 'change-case'
32
+
33
+ interface Props {
34
+ label?: MBtnProps['label']
35
+ spinner?: MBtnProps['spinner']
36
+ loading?: boolean
37
+ nativeLabel?: boolean
38
+ noStyle?: boolean
39
+ }
40
+
41
+ const spinners = {
42
+ QSpinner,
43
+ QSpinnerAudio,
44
+ QSpinnerBall,
45
+ QSpinnerBars,
46
+ QSpinnerBox,
47
+ QSpinnerClock,
48
+ QSpinnerComment,
49
+ QSpinnerCube,
50
+ QSpinnerDots,
51
+ QSpinnerFacebook,
52
+ QSpinnerGears,
53
+ QSpinnerGrid,
54
+ QSpinnerHearts,
55
+ QSpinnerHourglass,
56
+ QSpinnerInfinity,
57
+ QSpinnerIos,
58
+ QSpinnerOrbit,
59
+ QSpinnerOval,
60
+ QSpinnerPie,
61
+ QSpinnerPuff,
62
+ QSpinnerRadio,
63
+ QSpinnerRings,
64
+ QSpinnerTail
65
+ }
66
+ const {
67
+ noStyle = !1,
68
+ label = undefined,
69
+ loading = false,
70
+ nativeLabel = false,
71
+ spinner = undefined
72
+ } = defineProps<Props>()
73
+ const { __, loadingOptions, componentProps, btnStyle } = useMyth()
74
+ const loadingType = computed(() => {
75
+ if (spinner !== undefined) {
76
+ return spinner
77
+ }
78
+ return loadingOptions.value?.type
79
+ })
80
+ const spinnerComponent = computed(() => {
81
+ if (!loadingType.value) {
82
+ return undefined
83
+ }
84
+ if (loadingType.value === 'spinner') {
85
+ return spinners.QSpinner
86
+ }
87
+ const k = pascalCase(`q-spinner-${loadingType.value}`) as keyof typeof spinners
88
+ return spinners[k]
89
+ })
90
+ const loadingSize = computed(() => loadingOptions.value?.size)
91
+ const loadingColor = computed(() => loadingOptions.value?.color)
92
+ const DEFAULT_LABEL = undefined
93
+ const computedLabel = computed<string | undefined>(() => {
94
+ if (nativeLabel === !0) {
95
+ return label === null || label === undefined ? DEFAULT_LABEL : String(label)
96
+ }
97
+ if (label === undefined || label === null) {
98
+ return DEFAULT_LABEL
99
+ }
100
+ return __(label)
101
+ })
102
+ const computedAttrs = computed(() => ({
103
+ ...(noStyle ? {} : btnStyle.value),
104
+ ...(componentProps.value.btn || {}),
105
+ ariaLabel: computedLabel.value
106
+ }))
107
+ defineOptions({
108
+ name: 'MBtn'
109
+ })
110
+ </script>
111
+
112
+ <template>
113
+ <q-btn
114
+ :loading="loading"
115
+ :label="computedLabel"
116
+ v-bind="computedAttrs"
117
+ >
118
+ <template
119
+ v-if="!!$slots.loading"
120
+ #loading
121
+ >
122
+ <slot name="loading" />
123
+ </template>
124
+ <template
125
+ v-else-if="!!loadingType && spinnerComponent"
126
+ #loading
127
+ >
128
+ <component
129
+ :is="spinnerComponent"
130
+ :color="loadingColor"
131
+ :size="loadingSize"
132
+ />
133
+ </template>
134
+
135
+ <template
136
+ v-if="!!$slots.default"
137
+ #default
138
+ >
139
+ <slot />
140
+ </template>
141
+ </q-btn>
142
+ </template>
@@ -0,0 +1,15 @@
1
+ import type { ComponentPublicInstance, VNode } from 'vue'
2
+ import type { MGridProps } from '../MGrid'
3
+
4
+ export interface MColumnProps {
5
+ size?: MGridProps['size']
6
+ type?: MGridProps['type']
7
+ }
8
+
9
+ export interface MColumnSlots {
10
+ default?: () => VNode[]
11
+ }
12
+
13
+ export interface MColumn extends ComponentPublicInstance<MColumnProps> {
14
+ //
15
+ }
@@ -0,0 +1,28 @@
1
+ <!--
2
+ - MyTh Ahmed Faiz Copyright © 2016-2024 All rights reserved.
3
+ - Email: mythpe@gmail.com
4
+ - Mobile: +966590470092
5
+ - Website: https://www.4myth.com
6
+ - Github: https://github.com/mythpe
7
+ -->
8
+
9
+ <script lang="ts" setup>
10
+ import MGrid from '../MGrid.vue'
11
+ import type { MColumnProps } from './MColumn'
12
+
13
+ const { size = undefined, type = undefined } = defineProps<MColumnProps>()
14
+
15
+ defineOptions({
16
+ name: 'MColumn'
17
+ })
18
+ </script>
19
+
20
+ <template>
21
+ <MGrid
22
+ grid-type="column"
23
+ :size="size"
24
+ :type="type"
25
+ >
26
+ <slot />
27
+ </MGrid>
28
+ </template>
@@ -0,0 +1,39 @@
1
+ import type { ComponentPublicInstance, VNode } from 'vue'
2
+ import type { MGridProps } from '../MGrid'
3
+
4
+ export type MContainerProps = {
5
+ /**
6
+ * Defines the spacing size (gutter) between rows and columns.
7
+ * Matches the design system global theme sizes.
8
+ * @default 'md'
9
+ */
10
+ size?: MGridProps['size']
11
+
12
+ /**
13
+ * Determines the Quasar gutter implementation behavior.
14
+ * - 'col': Uses 'q-col-gutter' (adds negative margins, ideal for layout grids).
15
+ * - 'gutter': Uses 'q-gutter' (adds standard margins between direct children).
16
+ * @default 'gutter'
17
+ */
18
+ type?: MGridProps['type']
19
+
20
+ /**
21
+ * Reduces the inner padding or vertical spacing of the container for a more compact layout.
22
+ * @default false
23
+ */
24
+ dense?: boolean | undefined
25
+
26
+ /**
27
+ * If true, the container spans the full width of the viewport, removing maximum width constraints.
28
+ * @default false
29
+ */
30
+ fluid?: boolean | undefined
31
+ }
32
+
33
+ export type MContainerSlots = {
34
+ default?: () => VNode[]
35
+ }
36
+
37
+ export interface MContainer extends ComponentPublicInstance<MContainerProps> {
38
+ //
39
+ }
@@ -0,0 +1,66 @@
1
+ <!--
2
+ - MyTh Ahmed Faiz Copyright © 2016-2024 All rights reserved.
3
+ - Email: mythpe@gmail.com
4
+ - Mobile: +966590470092
5
+ - Website: https://www.4myth.com
6
+ - Github: https://github.com/mythpe
7
+ -->
8
+
9
+ <script lang="ts" setup>
10
+ import { computed, provide, reactive } from 'vue'
11
+ import type { MContainerProps } from './MContainer'
12
+ import useMyth from '../../../composables/useMyth'
13
+ import { DEFAULT_GRID_SIZE, DEFAULT_GRID_TYPE, MContainerInjectionKey } from '../../../config'
14
+
15
+ const {
16
+ size = DEFAULT_GRID_SIZE,
17
+ type = DEFAULT_GRID_TYPE,
18
+ dense = undefined,
19
+ fluid = undefined
20
+ } = defineProps<MContainerProps>()
21
+
22
+ const { theme } = useMyth()
23
+
24
+ const computedGutterSize = computed(() => {
25
+ return size !== DEFAULT_GRID_SIZE ? size : (theme.gutterSize ?? DEFAULT_GRID_SIZE)
26
+ })
27
+ const computedGutterType = computed(() => {
28
+ return type !== DEFAULT_GRID_TYPE ? type : (theme.gutterType ?? DEFAULT_GRID_TYPE)
29
+ })
30
+ const computedDense = computed(() => dense ?? theme.dense ?? false)
31
+ const computedFluid = computed(() => fluid ?? theme.fluid ?? false)
32
+ provide(
33
+ MContainerInjectionKey,
34
+ reactive({
35
+ gutterSize: computedGutterSize,
36
+ gutterType: computedGutterType,
37
+ dense: computedDense,
38
+ fluid: computedFluid
39
+ })
40
+ )
41
+ defineOptions({
42
+ name: 'MContainer'
43
+ })
44
+ </script>
45
+
46
+ <template>
47
+ <div
48
+ :class="{
49
+ 'm-container__fluid': !!computedFluid,
50
+ 'm-container__dense': !!computedDense,
51
+ 'q-pa-none': computedGutterSize === 'none',
52
+ [`q-pa-${computedGutterSize || ''}`]: computedGutterSize && computedGutterSize !== 'none'
53
+ }"
54
+ class="m-container"
55
+ >
56
+ <slot />
57
+ </div>
58
+ </template>
59
+
60
+ <style lang="scss" scoped>
61
+ .m-container {
62
+ width: 100%;
63
+ min-height: 400px;
64
+ background-color: red;
65
+ }
66
+ </style>
@@ -0,0 +1,16 @@
1
+ import type { ComponentPublicInstance, VNode } from 'vue'
2
+ import type { GridGutterSize, GridGutterType, GridType } from '../../types/config'
3
+
4
+ export interface MGridProps {
5
+ gridType: GridType
6
+ size?: GridGutterSize
7
+ type?: GridGutterType
8
+ }
9
+
10
+ export interface MGridSlots {
11
+ default?: () => VNode[]
12
+ }
13
+
14
+ export interface MGrid extends ComponentPublicInstance<MGridProps> {
15
+ //
16
+ }
@@ -0,0 +1,47 @@
1
+ <!--
2
+ - MyTh Ahmed Faiz Copyright © 2016-2024 All rights reserved.
3
+ - Email: mythpe@gmail.com
4
+ - Mobile: +966590470092
5
+ - Website: https://www.4myth.com
6
+ - Github: https://github.com/mythpe
7
+ -->
8
+
9
+ <script lang="ts" setup>
10
+ import { computed, inject } from 'vue'
11
+ import useMyth from '../../composables/useMyth'
12
+ import { DEFAULT_GRID_SIZE, DEFAULT_GRID_TYPE, MContainerInjectionKey } from '../../config'
13
+ import type { MGridProps } from './MGrid'
14
+
15
+ const { size = undefined, type = undefined, gridType = 'row' } = defineProps<MGridProps>()
16
+ const parent = inject(MContainerInjectionKey)
17
+ const { theme } = useMyth()
18
+
19
+ const computedGutterSize = computed<string>(() => {
20
+ if (size !== undefined) {
21
+ return size
22
+ }
23
+ return parent?.size ?? theme.gutterSize ?? DEFAULT_GRID_SIZE
24
+ })
25
+ const computedGutterType = computed<string>(() => {
26
+ if (type !== undefined) {
27
+ return type
28
+ }
29
+ return parent?.type ?? theme.gutterType ?? DEFAULT_GRID_TYPE
30
+ })
31
+ const gutterKey = computed(() => `q${type === 'col' ? '-col' : ''}-gutter`)
32
+ defineOptions({
33
+ name: 'MGrid'
34
+ })
35
+ </script>
36
+
37
+ <template>
38
+ <div
39
+ :class="{
40
+ 'm-row row': gridType === 'row',
41
+ 'm-column column': gridType === 'column',
42
+ [`${gutterKey}-${computedGutterSize}`]: !!computedGutterType && computedGutterType !== 'none'
43
+ }"
44
+ >
45
+ <slot />
46
+ </div>
47
+ </template>
@@ -0,0 +1,15 @@
1
+ import type { ComponentPublicInstance, VNode } from 'vue'
2
+ import type { MGridProps } from '../MGrid'
3
+
4
+ export interface MRowProps {
5
+ size?: MGridProps['size']
6
+ type?: MGridProps['type']
7
+ }
8
+
9
+ export interface MRowSlots {
10
+ default?: () => VNode[]
11
+ }
12
+
13
+ export interface MRow extends ComponentPublicInstance<MRowProps> {
14
+ //
15
+ }
@@ -6,21 +6,23 @@
6
6
  - Github: https://github.com/mythpe
7
7
  -->
8
8
 
9
- <script
10
- lang="ts"
11
- setup
12
- >
9
+ <script lang="ts" setup>
10
+ import MGrid from '../MGrid.vue'
11
+ import type { MRowProps } from './MRow'
12
+
13
+ const { size = undefined, type = undefined } = defineProps<MRowProps>()
14
+
13
15
  defineOptions({
14
- name: 'MColumn',
15
- inheritAttrs: !1
16
+ name: 'MRow'
16
17
  })
17
18
  </script>
18
19
 
19
20
  <template>
20
- <div
21
- class="m-column column"
22
- v-bind="$attrs"
21
+ <MGrid
22
+ grid-type="row"
23
+ :size="size"
24
+ :type="type"
23
25
  >
24
26
  <slot />
25
- </div>
27
+ </MGrid>
26
28
  </template>
@@ -1,20 +1,30 @@
1
- /*
2
- * MyTh Ahmed Faiz Copyright © 2016-2024 All rights reserved.
3
- * Email: mythpe@gmail.com
4
- * Mobile: +966590470092
5
- * Website: https://www.4myth.com
6
- * Github: https://github.com/mythpe
7
- */
1
+ import MBtn from './MBtn/MBtn.vue'
2
+ import MContainer from './grid/MContainer/MContainer.vue'
3
+ import MGrid from './grid/MGrid.vue'
4
+ import MColumn from './grid/MColumn/MColumn.vue'
5
+ import MRow from './grid/MRow/MRow.vue'
6
+ import type { GlobalComponentConstructor } from 'quasar'
7
+ import type { MContainerProps, MContainerSlots } from './grid/MContainer/MContainer'
8
+ import type { MGridProps, MGridSlots } from './grid/MGrid'
9
+ import type { MColumnProps, MColumnSlots } from './grid/MColumn/MColumn'
10
+ import type { MRowProps, MRowSlots } from './grid/MRow/MRow'
11
+ import type { MBtnProps, MBtnSlots } from './MBtn/MBtn'
8
12
 
9
- export * from './datatable'
10
- export * from './form'
11
- export * from './grid'
12
- export * from './map'
13
- export * from './modal'
14
- export * from './parials'
15
- export * from './sar'
16
- export * from './transition'
17
- export * from './typography'
13
+ export * from './grid/MGrid'
14
+ export * from './grid/MColumn/MColumn'
15
+ export * from './grid/MContainer/MContainer'
16
+ export * from './grid/MRow/MRow'
18
17
 
19
- export default {}
20
- export {}
18
+ export * from './MBtn/MBtn'
19
+
20
+ export { MBtn, MContainer, MGrid, MColumn, MRow }
21
+
22
+ export interface MythGlobalComponents {
23
+ // Grid.
24
+ MContainer: GlobalComponentConstructor<MContainerProps, MContainerSlots>
25
+ MGrid: GlobalComponentConstructor<MGridProps, MGridSlots>
26
+ MColumn: GlobalComponentConstructor<MColumnProps, MColumnSlots>
27
+ MRow: GlobalComponentConstructor<MRowProps, MRowSlots>
28
+
29
+ MBtn: GlobalComponentConstructor<MBtnProps, MBtnSlots>
30
+ }
@@ -0,0 +1,93 @@
1
+ import { computed, inject, reactive, readonly, ref } from 'vue'
2
+ import { mythConfig, MythInjectionKey } from '../config/config'
3
+ import { useI18n } from 'vue-i18n'
4
+ import type { MythConfig } from '../types/config'
5
+ import * as str from '../utils/str'
6
+ import * as helpers from '../utils/helpers'
7
+
8
+ export function useMyth() {
9
+ const { t, te } = useI18n({ useScope: 'global' })
10
+ const MythConfig = inject<MythConfig>(MythInjectionKey, mythConfig)
11
+ const config = readonly(MythConfig)
12
+ const name = ref('MyTh')
13
+ const version = computed(() => MythConfig.version)
14
+ const loadingOptions = computed(() => MythConfig.loadingOptions)
15
+
16
+ const theme = reactive(MythConfig.theme)
17
+ const btnStyle = computed(() => MythConfig.theme.btn)
18
+ const inputStyle = computed(() => MythConfig.theme.input)
19
+ const componentProps = computed(() => MythConfig.component)
20
+ const __ = (key: any, ...rest: any[]): string => {
21
+ key = key ?? ''
22
+ const m1 = key.startsWith(':') && key.endsWith(':')
23
+ const m2 = key.startsWith("{'") && key.endsWith("'}")
24
+ if ((m1 || m2) && key.length > 2) {
25
+ if (m1) {
26
+ return key.slice(1, -1)
27
+ }
28
+ return key.slice(2, -2)
29
+ }
30
+ const attrKey = `attributes.${key}`
31
+ if (te(attrKey)) {
32
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
33
+ // @ts-ignore
34
+ return t(attrKey, ...rest)
35
+ }
36
+ if (te(key)) {
37
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
38
+ // @ts-ignore
39
+ return t(key, ...rest)
40
+ }
41
+ return t(key)
42
+ }
43
+ const pageTitle = (name: string, num?: number) => {
44
+ num ??= 2
45
+ const singular = str.singular(name)
46
+ const pascalSingular = str.pascalCase(name)
47
+ const snakeSingular = str.snakeCase(name)
48
+ const camelSingular = str.camelCase(name)
49
+ const kebabSingular = str.kebabCase(name)
50
+ const plural = str.plural(name)
51
+ const pascalPlural = str.pascalCase(plural)
52
+ const snakePlural = str.snakeCase(plural)
53
+ const camelPlural = str.camelCase(plural)
54
+ const kebabPlural = str.kebabCase(plural)
55
+ const names = helpers.uniq<string>([
56
+ name,
57
+ singular,
58
+ pascalSingular,
59
+ snakeSingular,
60
+ camelSingular,
61
+ kebabSingular,
62
+ plural,
63
+ pascalPlural,
64
+ snakePlural,
65
+ camelPlural,
66
+ kebabPlural
67
+ ])
68
+ const keys = helpers.uniq<string>(['routes', 'attributes'])
69
+ for (const k of keys) {
70
+ for (const n of names) {
71
+ if (te(`${k}.${n}`)) {
72
+ return __(`${k}.${n}`, num)
73
+ }
74
+ }
75
+ }
76
+ return __(name)
77
+ }
78
+
79
+ return {
80
+ config,
81
+ name,
82
+ version,
83
+ loadingOptions,
84
+ theme,
85
+ btnStyle,
86
+ inputStyle,
87
+ componentProps,
88
+ __,
89
+ pageTitle
90
+ }
91
+ }
92
+
93
+ export default useMyth
@@ -0,0 +1,40 @@
1
+ import { useMeta } from 'quasar'
2
+ import type { MaybeRefOrGetter } from 'vue'
3
+ import { toValue } from 'vue'
4
+
5
+ type MetaTagOptions = Record<string, any> & {
6
+ template?: (attributeValue: string) => string
7
+ }
8
+ export interface MetaOptions {
9
+ meta?: { [name: string]: MetaTagOptions }
10
+ link?: { [name: string]: Record<string, string> }
11
+ script?: { [name: string]: Record<string, string> }
12
+ htmlAttr?: { [name: string]: string | undefined }
13
+ bodyAttr?: { [name: string]: string | undefined }
14
+ noscript?: { [name: string]: string }
15
+ }
16
+ /**
17
+ * Initializes global meta tags that bind dynamically to your mythConfig state.
18
+ * Use all the variables and store them in one place for the application.
19
+ */
20
+ export function useMythMeta(
21
+ appName?: MaybeRefOrGetter<string>,
22
+ pageTitle?: MaybeRefOrGetter<string>,
23
+ metaOptions?: MaybeRefOrGetter<MetaOptions>
24
+ ): void {
25
+ useMeta(() => {
26
+ const rawAppName = toValue(appName) || 'MyTh'
27
+ const rawPageTitle = toValue(pageTitle) || ''
28
+ const rawOptions = toValue(metaOptions) || {}
29
+ return {
30
+ title: rawPageTitle,
31
+ titleTemplate: (title: string) => {
32
+ if (!title || title === rawAppName) {
33
+ return rawAppName
34
+ }
35
+ return `${rawAppName} | ${title}`
36
+ },
37
+ ...rawOptions
38
+ }
39
+ })
40
+ }
@@ -0,0 +1,16 @@
1
+ import { type InjectionKey, reactive } from 'vue'
2
+ import { version } from '../../package.json'
3
+ import type { MythConfig } from '../types/config'
4
+
5
+ export const mythConfig = reactive<MythConfig>({
6
+ version,
7
+ theme: {
8
+ btn: {
9
+ noCaps: true
10
+ },
11
+ input: {}
12
+ },
13
+ component: {},
14
+ loadingOptions: undefined
15
+ })
16
+ export const MythInjectionKey = Symbol.for('_m_') as unknown as InjectionKey<MythConfig>
@@ -0,0 +1,10 @@
1
+ import type { InjectionKey } from 'vue'
2
+ import type { MContainerProps } from '../components/grid/MContainer/MContainer'
3
+ import type { GridGutterSize, GridGutterType } from '../types/config'
4
+
5
+ export const MContainerInjectionKey = Symbol.for(
6
+ '_m__m-container'
7
+ ) as unknown as InjectionKey<MContainerProps>
8
+
9
+ export const DEFAULT_GRID_SIZE: GridGutterSize = 'md'
10
+ export const DEFAULT_GRID_TYPE: GridGutterType = 'gutter'
@@ -0,0 +1,2 @@
1
+ export * from './grid'
2
+ export * from './config'
@@ -0,0 +1,13 @@
1
+ .m-btn {
2
+ display: inline-flex;
3
+ align-items: center;
4
+ justify-content: center;
5
+ border-radius: 8px;
6
+ font-weight: 500;
7
+ transition: all 0.3s ease;
8
+
9
+ &--primary {
10
+ background-color: var(--q-primary);
11
+ color: white;
12
+ }
13
+ }
@@ -0,0 +1,9 @@
1
+ :root {
2
+ --myth-border-radius: 12px;
3
+ --myth-transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
4
+ }
5
+
6
+ .myth-disabled {
7
+ pointer-events: none;
8
+ opacity: 0.6;
9
+ }
package/src/env.d.ts ADDED
@@ -0,0 +1,14 @@
1
+ declare namespace NodeJS {
2
+ interface ProcessEnv {
3
+ DEV: boolean
4
+ PROD: boolean
5
+ DEBUGGING: boolean
6
+ CLIENT: boolean
7
+ SERVER: boolean
8
+ MODE: 'spa' | 'ssr' | 'pwa' | 'cordova' | 'capacitor'
9
+ NODE_ENV: 'development' | 'production'
10
+ TARGET: 'ios' | 'android' | 'chrome' | 'firefox' | undefined
11
+ VUE_ROUTER_MODE: 'hash' | 'history' | 'abstract' | undefined
12
+ VUE_ROUTER_BASE: string | undefined
13
+ }
14
+ }
@@ -1,15 +1 @@
1
- /*
2
- * MyTh Ahmed Faiz Copyright © 2016-2024 All rights reserved.
3
- * Email: mythpe@gmail.com
4
- * Mobile: +966590470092
5
- * Website: https://www.4myth.com
6
- * Github: https://github.com/mythpe
7
- */
8
-
9
- export * from './components'
10
- export * from './composable'
11
- export * from './utils'
12
-
13
- import * as Plugin from './utils'
14
-
15
- export default Plugin
1
+ export * from './vue-plugin'