@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.
- package/LICENSE +20 -0
- package/README.md +71 -129
- package/package.json +58 -68
- package/rREADME.md +147 -0
- package/src/components/MBtn/MBtn.ts +38 -0
- package/src/components/MBtn/MBtn.vue +142 -0
- package/src/components/grid/MColumn/MColumn.ts +15 -0
- package/src/components/grid/MColumn/MColumn.vue +28 -0
- package/src/components/grid/MContainer/MContainer.ts +39 -0
- package/src/components/grid/MContainer/MContainer.vue +66 -0
- package/src/components/grid/MGrid.ts +16 -0
- package/src/components/grid/MGrid.vue +47 -0
- package/src/components/grid/MRow/MRow.ts +15 -0
- package/src/components/grid/{MColumn.vue → MRow/MRow.vue} +12 -10
- package/src/components/index.ts +28 -18
- package/src/composables/useMyth.ts +93 -0
- package/src/composables/useMythMeta.ts +40 -0
- package/src/config/config.ts +16 -0
- package/src/config/grid.ts +10 -0
- package/src/config/index.ts +2 -0
- package/src/css/components/m-btn.scss +13 -0
- package/src/css/index.scss +9 -0
- package/src/env.d.ts +14 -0
- package/src/index.common.js +1 -15
- package/src/index.ts +4 -0
- package/src/index.umd.js +2 -15
- package/src/shims-myth.d.ts +6 -0
- package/src/shims-vue.d.ts +22 -0
- package/src/types/config.ts +136 -0
- package/src/types/helpers.ts +21 -0
- package/src/types/index.ts +9 -0
- package/src/types/vue-prop-types.ts +13 -0
- package/src/utils/helpers.ts +446 -0
- package/src/{icons/config.ts → utils/icons.ts} +0 -9
- package/src/utils/index.ts +74 -11
- package/src/utils/str.ts +237 -0
- package/src/utils/vee-rules.ts +8 -4
- package/src/vue-plugin.ts +76 -0
- package/index.d.ts +0 -17
- package/jsconfig.json +0 -10
- package/src/boot/register.ts +0 -14
- package/src/components/datatable/MDatatable.vue +0 -1812
- package/src/components/datatable/MDtAvatar.vue +0 -49
- package/src/components/datatable/MDtBtn.vue +0 -171
- package/src/components/datatable/MDtColorColumn.vue +0 -55
- package/src/components/datatable/MDtContextmenuItems.vue +0 -69
- package/src/components/datatable/MDtCopyColumn.vue +0 -87
- package/src/components/datatable/MDtDescColumn.vue +0 -60
- package/src/components/datatable/MDtImageColumn.vue +0 -76
- package/src/components/datatable/MDtSarColumn.vue +0 -76
- package/src/components/datatable/MDtUrlColumn.vue +0 -70
- package/src/components/datatable/index.ts +0 -21
- package/src/components/form/MAvatarViewer.vue +0 -408
- package/src/components/form/MAxios.vue +0 -219
- package/src/components/form/MBtn.vue +0 -240
- package/src/components/form/MCheckbox.vue +0 -204
- package/src/components/form/MCkeditor.vue +0 -860
- package/src/components/form/MColor.vue +0 -118
- package/src/components/form/MDate.vue +0 -51
- package/src/components/form/MEditor.vue +0 -272
- package/src/components/form/MEmail.vue +0 -46
- package/src/components/form/MField.vue +0 -149
- package/src/components/form/MFile.vue +0 -221
- package/src/components/form/MForm.vue +0 -89
- package/src/components/form/MHidden.vue +0 -89
- package/src/components/form/MHiddenInput.vue +0 -61
- package/src/components/form/MInput.vue +0 -289
- package/src/components/form/MInputFieldControl.vue +0 -27
- package/src/components/form/MInputLabel.vue +0 -42
- package/src/components/form/MMobile.vue +0 -67
- package/src/components/form/MOptions.vue +0 -402
- package/src/components/form/MOtp.vue +0 -296
- package/src/components/form/MPassword.vue +0 -77
- package/src/components/form/MPhone.vue +0 -184
- package/src/components/form/MPicker.vue +0 -378
- package/src/components/form/MRadio.vue +0 -188
- package/src/components/form/MSelect.vue +0 -461
- package/src/components/form/MSignaturePad.vue +0 -301
- package/src/components/form/MTime.vue +0 -48
- package/src/components/form/MToggle.vue +0 -244
- package/src/components/form/MUploader.vue +0 -544
- package/src/components/form/__MCkeditor.vue +0 -403
- package/src/components/form/__MOptions.vue +0 -289
- package/src/components/form/index.ts +0 -71
- package/src/components/form/useCkeditor.ts +0 -26
- package/src/components/grid/MBlock.vue +0 -69
- package/src/components/grid/MCol.vue +0 -60
- package/src/components/grid/MContainer.vue +0 -60
- package/src/components/grid/MHelpRow.vue +0 -60
- package/src/components/grid/MInnerLoading.vue +0 -45
- package/src/components/grid/MRow.vue +0 -57
- package/src/components/grid/index.ts +0 -19
- package/src/components/map/MMap.vue +0 -69
- package/src/components/map/index.ts +0 -12
- package/src/components/modal/MDialog.vue +0 -59
- package/src/components/modal/MDialogFile.vue +0 -111
- package/src/components/modal/MFrameDialog.vue +0 -126
- package/src/components/modal/MModalMenu.vue +0 -77
- package/src/components/modal/MTooltip.vue +0 -39
- package/src/components/modal/index.ts +0 -9
- package/src/components/parials/MUploaderItem.vue +0 -350
- package/src/components/parials/index.ts +0 -5
- package/src/components/sar/MSarIcon.vue +0 -24
- package/src/components/sar/MSarString.vue +0 -58
- package/src/components/sar/index.ts +0 -14
- package/src/components/transition/MTransition.vue +0 -28
- package/src/components/transition/MTransitionGroup.vue +0 -28
- package/src/components/transition/index.ts +0 -14
- package/src/components/transition/useTransition.ts +0 -98
- package/src/components/typography/MTypingString.vue +0 -86
- package/src/components/typography/index.ts +0 -13
- package/src/composable/index.ts +0 -13
- package/src/composable/useBindInput.ts +0 -273
- package/src/composable/useDtHelpers.ts +0 -1105
- package/src/composable/useError.ts +0 -12
- package/src/composable/useMyth.ts +0 -364
- package/src/composable/useValue.ts +0 -13
- package/src/fonts/Almarai/Almarai-Bold.ttf +0 -0
- package/src/fonts/Almarai/Almarai-ExtraBold.ttf +0 -0
- package/src/fonts/Almarai/Almarai-Light.ttf +0 -0
- package/src/fonts/Almarai/Almarai-Regular.ttf +0 -0
- package/src/fonts/Almarai/index.sass +0 -68
- package/src/fonts/Noto_Kufi/NotoKufiArabic-Black.ttf +0 -0
- package/src/fonts/Noto_Kufi/NotoKufiArabic-Bold.ttf +0 -0
- package/src/fonts/Noto_Kufi/NotoKufiArabic-ExtraBold.ttf +0 -0
- package/src/fonts/Noto_Kufi/NotoKufiArabic-ExtraLight.ttf +0 -0
- package/src/fonts/Noto_Kufi/NotoKufiArabic-Light.ttf +0 -0
- package/src/fonts/Noto_Kufi/NotoKufiArabic-Medium.ttf +0 -0
- package/src/fonts/Noto_Kufi/NotoKufiArabic-Regular.ttf +0 -0
- package/src/fonts/Noto_Kufi/NotoKufiArabic-SemiBold.ttf +0 -0
- package/src/fonts/Noto_Kufi/NotoKufiArabic-Thin.ttf +0 -0
- package/src/fonts/Noto_Kufi/NotoKufiArabic-VariableFont_wght.ttf +0 -0
- package/src/fonts/Noto_Kufi/index.sass +0 -149
- package/src/fonts/Tajawal/Tajawal-Black.ttf +0 -0
- package/src/fonts/Tajawal/Tajawal-Bold.ttf +0 -0
- package/src/fonts/Tajawal/Tajawal-ExtraBold.ttf +0 -0
- package/src/fonts/Tajawal/Tajawal-ExtraLight.ttf +0 -0
- package/src/fonts/Tajawal/Tajawal-Light.ttf +0 -0
- package/src/fonts/Tajawal/Tajawal-Medium.ttf +0 -0
- package/src/fonts/Tajawal/Tajawal-Regular.ttf +0 -0
- package/src/fonts/Tajawal/index.sass +0 -79
- package/src/fonts/index.sass +0 -10
- package/src/global.d.ts +0 -16
- package/src/icons/index.ts +0 -10
- package/src/index.esm.js +0 -15
- package/src/index.js +0 -15
- package/src/index.sass +0 -24
- package/src/plugin/defineAsyncComponents.ts +0 -75
- package/src/plugin/defineComponents.ts +0 -8
- package/src/style/brands.sass +0 -47
- package/src/style/ckeditor5.sass +0 -20
- package/src/style/effect.sass +0 -143
- package/src/style/fonts.sass +0 -37
- package/src/style/m-container.sass +0 -20
- package/src/style/m-datatable.sass +0 -114
- package/src/style/m-help-row.sass +0 -12
- package/src/style/m-input.sass +0 -74
- package/src/style/m-picker.sass +0 -15
- package/src/style/m-select.sass +0 -12
- package/src/style/m-toggle.sass +0 -11
- package/src/style/main.sass +0 -117
- package/src/style/print.sass +0 -22
- package/src/style/sar-font.sass +0 -27
- package/src/style/scrollbar.sass +0 -37
- package/src/style/transition.sass +0 -48
- package/src/style/typography.sass +0 -39
- package/src/types/api/MAvatarViewer.d.ts +0 -110
- package/src/types/api/MAxios.d.ts +0 -52
- package/src/types/api/MBlock.d.ts +0 -29
- package/src/types/api/MBtn.d.ts +0 -25
- package/src/types/api/MCheckbox.d.ts +0 -45
- package/src/types/api/MCkeditor.d.ts +0 -40
- package/src/types/api/MCol.d.ts +0 -55
- package/src/types/api/MColumn.d.ts +0 -16
- package/src/types/api/MContainer.d.ts +0 -19
- package/src/types/api/MDate.d.ts +0 -15
- package/src/types/api/MDialog.d.ts +0 -18
- package/src/types/api/MDialogFile.d.ts +0 -19
- package/src/types/api/MEditor.d.ts +0 -13
- package/src/types/api/MField.d.ts +0 -12
- package/src/types/api/MFile.d.ts +0 -21
- package/src/types/api/MForm.d.ts +0 -55
- package/src/types/api/MFrameDialog.d.ts +0 -21
- package/src/types/api/MHelpRow.d.ts +0 -19
- package/src/types/api/MHidden.d.ts +0 -20
- package/src/types/api/MHiddenInput.d.ts +0 -26
- package/src/types/api/MInnerLoading.d.ts +0 -17
- package/src/types/api/MInput.d.ts +0 -180
- package/src/types/api/MInputFieldControl.d.ts +0 -16
- package/src/types/api/MInputLabel.d.ts +0 -17
- package/src/types/api/MMap.d.ts +0 -24
- package/src/types/api/MModalMenu.d.ts +0 -17
- package/src/types/api/MOptions.d.ts +0 -72
- package/src/types/api/MOtp.d.ts +0 -52
- package/src/types/api/MPassword.d.ts +0 -20
- package/src/types/api/MPhone.d.ts +0 -21
- package/src/types/api/MPicker.d.ts +0 -49
- package/src/types/api/MRadio.d.ts +0 -13
- package/src/types/api/MRow.d.ts +0 -24
- package/src/types/api/MSar.d.ts +0 -28
- package/src/types/api/MSelect.d.ts +0 -200
- package/src/types/api/MSignaturePad.d.ts +0 -185
- package/src/types/api/MTime.d.ts +0 -12
- package/src/types/api/MToggle.d.ts +0 -39
- package/src/types/api/MTooltip.d.ts +0 -136
- package/src/types/api/MTransition.d.ts +0 -143
- package/src/types/api/MTypingString.d.ts +0 -24
- package/src/types/api/MUploader.d.ts +0 -189
- package/src/types/api-helpers.d.ts +0 -66
- package/src/types/components.d.ts +0 -150
- package/src/types/google.d.ts +0 -19
- package/src/types/index.d.ts +0 -110
- package/src/types/m-datatable.d.ts +0 -498
- package/src/types/m-helpers.d.ts +0 -99
- package/src/types/myth-api.d.ts +0 -51
- package/src/types/plugin-props-option.d.ts +0 -313
- package/src/types/quasar-helpers.d.ts +0 -7
- package/src/types/theme.d.ts +0 -162
- package/src/utils/Helpers.ts +0 -406
- package/src/utils/Str.ts +0 -246
- package/src/utils/__pluralize.js +0 -493
- package/src/utils/const.ts +0 -1
- package/src/utils/createMyth.ts +0 -49
- package/src/utils/vue-plugin.ts +0 -66
- package/tsconfig.json +0 -35
- 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
|
-
|
|
11
|
-
|
|
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: '
|
|
15
|
-
inheritAttrs: !1
|
|
16
|
+
name: 'MRow'
|
|
16
17
|
})
|
|
17
18
|
</script>
|
|
18
19
|
|
|
19
20
|
<template>
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
<MGrid
|
|
22
|
+
grid-type="row"
|
|
23
|
+
:size="size"
|
|
24
|
+
:type="type"
|
|
23
25
|
>
|
|
24
26
|
<slot />
|
|
25
|
-
</
|
|
27
|
+
</MGrid>
|
|
26
28
|
</template>
|
package/src/components/index.ts
CHANGED
|
@@ -1,20 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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 './
|
|
10
|
-
export * from './
|
|
11
|
-
export * from './grid'
|
|
12
|
-
export * from './
|
|
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
|
|
20
|
-
|
|
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'
|
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
|
+
}
|
package/src/index.common.js
CHANGED
|
@@ -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'
|