@mythpe/quasar-ui-qui 0.2.15 → 0.2.16

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mythpe/quasar-ui-qui",
3
- "version": "0.2.15",
3
+ "version": "0.2.16",
4
4
  "description": "MyTh Quasar UI Kit App Extension",
5
5
  "author": {
6
6
  "name": "MyTh Ahmed Faiz",
@@ -11,20 +11,11 @@
11
11
  setup
12
12
  >
13
13
  import type { MTransitionProps as Props } from '../../types'
14
+ import { useTransition } from './useTransition'
14
15
 
15
- interface P {
16
- enterIn?: Props['enterIn'];
17
- enterOut?: Props['enterOut'];
18
- slowIn?: Props['slowIn'];
19
- slowOut?: Props['slowIn'];
20
- }
16
+ const props = defineProps<Props>()
17
+ const { getClasses } = useTransition(props)
21
18
 
22
- withDefaults(defineProps<P>(), {
23
- enterIn: () => 'fadeIn',
24
- enterOut: () => 'fadeOut',
25
- slowIn: () => !1,
26
- slowOut: () => !1
27
- })
28
19
  defineOptions({
29
20
  name: 'MTransition',
30
21
  inheritAttrs: !1
@@ -32,13 +23,16 @@ defineOptions({
32
23
  </script>
33
24
 
34
25
  <template>
35
- <TransitionGroup
36
- :enter-active-class="`animated ${enterIn} ${slowIn ? 'slow' : ''}`"
37
- :leave-active-class="`animated ${enterOut} ${slowOut ? 'slow' : ''}`"
38
- appear
39
- name="m__transition__fade"
40
- v-bind="$attrs"
26
+ <transition
27
+ v-bind="{
28
+ ...$props,
29
+ ...$attrs,
30
+ enterActiveClass: getClasses('in'),
31
+ leaveActiveClass: getClasses('out'),
32
+ appear: !noAppear,
33
+ css: !noCss
34
+ }"
41
35
  >
42
36
  <slot />
43
- </TransitionGroup>
37
+ </transition>
44
38
  </template>
@@ -0,0 +1,38 @@
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
10
+ lang="ts"
11
+ setup
12
+ >
13
+ import type { MTransitionGroupProps as Props } from '../../types'
14
+ import { useTransition } from './useTransition'
15
+
16
+ const props = defineProps<Props>()
17
+ const { getClasses } = useTransition(props)
18
+
19
+ defineOptions({
20
+ name: 'MTransitionGroup',
21
+ inheritAttrs: !1
22
+ })
23
+ </script>
24
+
25
+ <template>
26
+ <transition-group
27
+ v-bind="{
28
+ ...$props,
29
+ ...$attrs,
30
+ enterActiveClass: getClasses('in'),
31
+ leaveActiveClass: getClasses('out'),
32
+ appear: !noAppear,
33
+ css: !noCss
34
+ }"
35
+ >
36
+ <slot />
37
+ </transition-group>
38
+ </template>
@@ -6,10 +6,9 @@
6
6
  * Github: https://github.com/mythpe
7
7
  */
8
8
 
9
- import MFadeTransition from './MFadeTransition.vue'
10
- import MFadeXTransition from './MFadeXTransition.vue'
11
9
  import MTransition from './MTransition.vue'
10
+ import MTransitionGroup from './MTransitionGroup.vue'
12
11
 
13
- export { MFadeTransition, MFadeXTransition, MTransition }
12
+ export { MTransitionGroup, MTransition }
14
13
 
15
14
  export default {}
@@ -0,0 +1,50 @@
1
+ /*
2
+ * MyTh Ahmed Faiz Copyright © 2016-2025 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
+ import { useMyth } from '../../composable'
10
+
11
+ export function useTransition (props: any) {
12
+ const { theme } = useMyth()
13
+ const getClasses = (mode: 'in' | 'out') => {
14
+ const classes: string[] = ['animated']
15
+ const defMode = mode === 'in' ? theme.value.inTransition : theme.value.outTransition
16
+ const activeClass = mode === 'in' ? props.enterActiveClass : props.leaveActiveClass
17
+ classes.push(activeClass || defMode)
18
+ const keys = [
19
+ `${mode}Slower`,
20
+ `${mode}Slow`,
21
+ `${mode}Fast`,
22
+ `${mode}Faster`
23
+ ]
24
+ for (const k of keys) {
25
+ if (props[k]) {
26
+ classes.push(k.replace(mode, '').toLowerCase())
27
+ }
28
+ }
29
+ const delay = props[`${mode}Delay`] || false
30
+ if (delay) {
31
+ if (delay === !0) {
32
+ classes.push('delay-1s')
33
+ }
34
+ if (typeof delay === 'number' || typeof delay === 'string') {
35
+ classes.push(`delay-${delay}s`)
36
+ }
37
+ }
38
+ const repeat = props[`${mode}Repeat`] || false
39
+ if (repeat) {
40
+ if (repeat === !0) {
41
+ classes.push('repeat')
42
+ }
43
+ if (typeof repeat === 'number' || typeof repeat === 'string') {
44
+ classes.push(`repeat-${repeat}`)
45
+ }
46
+ }
47
+ return classes.join(' ')
48
+ }
49
+ return { getClasses }
50
+ }
@@ -44,8 +44,7 @@ export const defineAsyncComponents = function (app: App) {
44
44
 
45
45
  // Transitions.
46
46
  app.component('MTransition', defineAsyncComponent(() => import('../components/transition/MTransition.vue')))
47
- app.component('MFadeTransition', defineAsyncComponent(() => import('../components/transition/MFadeTransition.vue')))
48
- app.component('MFadeXTransition', defineAsyncComponent(() => import('../components/transition/MFadeXTransition.vue')))
47
+ app.component('MTransitionGroup', defineAsyncComponent(() => import('../components/transition/MTransitionGroup.vue')))
49
48
 
50
49
  // Modals.
51
50
  app.component('MDialog', defineAsyncComponent(() => import('../components/modal/MDialog.vue')))
@@ -1,12 +1,136 @@
1
- import type { TransitionGroupProps, VNode } from 'vue'
1
+ import type { TransitionGroupProps, TransitionProps, VNode } from 'vue'
2
2
 
3
- export interface MTransitionProps extends TransitionGroupProps {
4
- enterIn?: string;
5
- enterOut?: string;
6
- slowIn?: boolean;
7
- slowOut?: boolean;
3
+ export type GeneralTransitionClasses =
4
+ 'bounce' |
5
+ 'flash' |
6
+ 'flip' |
7
+ 'headShake' |
8
+ 'heartBeat' |
9
+ 'hinge' |
10
+ 'jello' |
11
+ 'pulse' |
12
+ 'rubberBand' |
13
+ 'shake' |
14
+ 'shakeX' |
15
+ 'shakeY' |
16
+ 'swing' |
17
+ 'tada' |
18
+ 'wobble';
19
+
20
+ export type InTransitionClasses =
21
+ 'backInDown' |
22
+ 'backInLeft' |
23
+ 'backInRight' |
24
+ 'backInUp' |
25
+ 'bounceIn' |
26
+ 'bounceInDown' |
27
+ 'bounceInLeft' |
28
+ 'bounceInRight' |
29
+ 'bounceInUp' |
30
+ 'fadeIn' |
31
+ 'fadeInBottomLeft' |
32
+ 'fadeInBottomRight' |
33
+ 'fadeInDown' |
34
+ 'fadeInDownBig' |
35
+ 'fadeInLeft' |
36
+ 'fadeInLeftBig' |
37
+ 'fadeInRight' |
38
+ 'fadeInRightBig' |
39
+ 'fadeInTopLeft' |
40
+ 'fadeInTopRight' |
41
+ 'fadeInUp' |
42
+ 'fadeInUpBig' |
43
+ 'flipInX' |
44
+ 'flipInY' |
45
+ 'jackInTheBox' |
46
+ 'lightSpeedInLeft' |
47
+ 'lightSpeedInRight' |
48
+ 'rollIn' |
49
+ 'rotateIn' |
50
+ 'rotateInDownLeft' |
51
+ 'rotateInDownRight' |
52
+ 'rotateInUpLeft' |
53
+ 'rotateInUpRight' |
54
+ 'slideInDown' |
55
+ 'slideInLeft' |
56
+ 'slideInRight' |
57
+ 'slideInUp' |
58
+ 'zoomIn' |
59
+ 'zoomInDown' |
60
+ 'zoomInLeft' |
61
+ 'zoomInRight' |
62
+ 'zoomInUp';
63
+ type OutTransitionClasses =
64
+ 'backOutDown' |
65
+ 'backOutLeft' |
66
+ 'backOutRight' |
67
+ 'backOutUp' |
68
+ 'bounceOut' |
69
+ 'bounceOutDown' |
70
+ 'bounceOutLeft' |
71
+ 'bounceOutRight' |
72
+ 'bounceOutUp' |
73
+ 'fadeOut' |
74
+ 'fadeOutBottomLeft' |
75
+ 'fadeOutBottomRight' |
76
+ 'fadeOutDown' |
77
+ 'fadeOutDownBig' |
78
+ 'fadeOutLeft' |
79
+ 'fadeOutLeftBig' |
80
+ 'fadeOutRight' |
81
+ 'fadeOutRightBig' |
82
+ 'fadeOutTopLeft' |
83
+ 'fadeOutTopRight' |
84
+ 'fadeOutUp' |
85
+ 'fadeOutUpBig' |
86
+ 'flipOutX' |
87
+ 'flipOutY' |
88
+ 'lightSpeedOutLeft' |
89
+ 'lightSpeedOutRight' |
90
+ 'rollOut' |
91
+ 'rotateOut' |
92
+ 'rotateOutDownLeft' |
93
+ 'rotateOutDownRight' |
94
+ 'rotateOutUpLeft' |
95
+ 'rotateOutUpRight' |
96
+ 'slideOutDown' |
97
+ 'slideOutLeft' |
98
+ 'slideOutRight' |
99
+ 'slideOutUp' |
100
+ 'zoomOut' |
101
+ 'zoomOutDown' |
102
+ 'zoomOutLeft' |
103
+ 'zoomOutRight' |
104
+ 'zoomOutUp';
105
+
106
+ export type TransitionClass = GeneralTransitionClasses | InTransitionClasses | OutTransitionClasses;
107
+
108
+ export type TransitionDelay = boolean | string | number;
109
+ export type TransitionRepeat = boolean | string | number;
110
+
111
+ interface BaseTransitionProps {
112
+ in?: TransitionClass;
113
+ inSlower?: boolean;
114
+ inSlow?: boolean;
115
+ inFast?: boolean;
116
+ inFaster?: boolean;
117
+ inDelay?: TransitionDelay;
118
+ inRepeat?: TransitionRepeat;
119
+ out?: TransitionClass;
120
+ outSlower?: boolean;
121
+ outSlow?: boolean;
122
+ outFast?: boolean;
123
+ outFaster?: boolean;
124
+ outDelay?: TransitionDelay;
125
+ outRepeat?: TransitionRepeat;
126
+ noAppear?: boolean;
127
+ noCss?: boolean;
8
128
  }
9
129
 
130
+ export type MTransitionGroupProps = BaseTransitionProps & Omit<TransitionGroupProps, 'appear'>;
131
+
132
+ export type MTransitionProps = BaseTransitionProps & Omit<TransitionProps, 'appear'>;
133
+
10
134
  export interface MTransitionsSlots {
11
135
  default: () => VNode[];
12
136
  }
@@ -33,7 +33,7 @@ import type {
33
33
  QUploaderProps,
34
34
  QUploaderSlots
35
35
  } from 'quasar'
36
- import type { MaybeRefOrGetter, TransitionProps, UnwrapNestedRefs, VNode } from 'vue'
36
+ import type { MaybeRefOrGetter, UnwrapNestedRefs, VNode } from 'vue'
37
37
  import type { TypedOptions } from 'typed.js'
38
38
  import type { FieldContext, FieldOptions, FormContext, FormOptions, FormState } from 'vee-validate'
39
39
  import type { ThemeShadow, ThemeSize } from './theme'
@@ -41,7 +41,7 @@ import type { ApiInterface, HelpersStubSchema } from './api-helpers'
41
41
  import type { MDatatableProps, MDatatableSlots, MDtAvatarProps, MDtAvatarSlots, MDtBtnProps, MDtBtnSlots, MDtContextmenuItemsProps, MDtContextmenuItemsSlots } from './m-datatable'
42
42
  import type { EditorConfig } from 'ckeditor5'
43
43
  import type { MAvatarViewerProps, MAvatarViewerSlots } from './api/MAvatarViewer'
44
- import type { MTransitionProps, MTransitionsSlots } from './api/MTransition'
44
+ import type { MTransitionGroupProps, MTransitionProps, MTransitionsSlots } from './api/MTransition'
45
45
  import type { MAxiosProps, MAxiosSlots } from './api/MAxios'
46
46
  import type { MSelectProps, MSelectSlots } from './api/MSelect'
47
47
  import type { MSignaturePadProps, MSignaturePadSlots } from './api/MSignaturePad'
@@ -1046,8 +1046,8 @@ declare module '@vue/runtime-core' {
1046
1046
 
1047
1047
  // Transitions.
1048
1048
  MTransition: GlobalComponentConstructor<MTransitionProps, MTransitionsSlots>;
1049
- MFadeTransition: GlobalComponentConstructor<TransitionProps, MTransitionsSlots>;
1050
- MFadeXTransition: GlobalComponentConstructor<TransitionProps, MTransitionsSlots>;
1049
+ MTransitionGroup: GlobalComponentConstructor<MTransitionGroupProps, MTransitionsSlots>;
1050
+
1051
1051
  // Modals.
1052
1052
  MDialog: GlobalComponentConstructor<MDialogProps, MDialogSlots>;
1053
1053
  MModalMenu: GlobalComponentConstructor<MModalMenuProps, MModalMenuSlots>;
@@ -1,11 +1,33 @@
1
1
  import type { NamedColor, QBtnProps, QInputProps } from 'quasar'
2
+ import type { TransitionClass } from './api/MTransition'
2
3
 
3
- export type ThemeSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'none' | string;
4
- export type ThemeShadow = string | number | 'transition' | 'none';
5
- export type ThemeRounded = boolean;
6
- export type ThemeFluid = boolean;
7
- export type ThemeInput =
8
- Partial<Pick<QInputProps, 'standout'
4
+ /**
5
+ * Standard size options with string extension capability
6
+ */
7
+ export type ThemeSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'none' | string
8
+
9
+ /**
10
+ * Shadow configuration options
11
+ */
12
+ export type ThemeShadow = string | number | 'transition' | 'none'
13
+
14
+ /**
15
+ * Rounded corners configuration
16
+ */
17
+ export type ThemeRounded = boolean
18
+
19
+ /**
20
+ * Fluid layout behavior
21
+ */
22
+ export type ThemeFluid = boolean
23
+
24
+ /**
25
+ * Input styling properties based on QInput with additional topLabel option
26
+ */
27
+ export type ThemeInput = Partial<
28
+ Pick<
29
+ QInputProps,
30
+ | 'standout'
9
31
  | 'dense'
10
32
  | 'filled'
11
33
  | 'outlined'
@@ -21,68 +43,118 @@ export type ThemeInput =
21
43
  | 'stackLabel'
22
44
  | 'color'
23
45
  | 'textColor'
24
- >>
25
- & {
26
- topLabel?: boolean;
46
+ >
47
+ > & {
48
+ /** Displays label above the input field */
49
+ topLabel?: boolean
27
50
  }
28
- export type ThemeBtn = Partial<Pick<QBtnProps, 'flat'
29
- | 'outline'
30
- | 'push'
31
- | 'unelevated'
32
- | 'noCaps'
33
- | 'rounded'
34
- | 'glossy'
35
- | 'square'
36
- | 'padding'
37
- | 'ripple'
38
- | 'dense'
39
- | 'color'
40
- | 'textColor'
41
- >>
42
-
43
- export type Theme = {
44
- size: ThemeSize;
45
- rounded: ThemeRounded;
46
- shadow: ThemeShadow;
47
- fluid: ThemeFluid;
48
- button: ThemeBtn;
49
- input: ThemeInput;
50
- };
51
51
 
52
+ /**
53
+ * Button styling properties based on QBtn
54
+ */
55
+ export type ThemeBtn = Partial<
56
+ Pick<
57
+ QBtnProps,
58
+ | 'flat'
59
+ | 'outline'
60
+ | 'push'
61
+ | 'unelevated'
62
+ | 'noCaps'
63
+ | 'rounded'
64
+ | 'glossy'
65
+ | 'square'
66
+ | 'padding'
67
+ | 'ripple'
68
+ | 'dense'
69
+ | 'color'
70
+ | 'textColor'
71
+ >
72
+ >
73
+
74
+ /**
75
+ * Loading animation configuration for buttons
76
+ */
52
77
  export type ButtonLoadingOptions = {
53
- type: 'audio' | 'ball' | 'bars' | 'box' | 'clock' | 'comment' | 'cube' | 'dots' | 'facebook' | 'gears' | 'grid' | 'hearts' | 'hourglass' | 'infinity' | 'ios' | 'orbit' | 'oval' | 'pie' | 'puff' | 'radio' | 'rings' | 'tail' | 'spinner';
54
- color?: NamedColor | undefined;
55
- size?: string | undefined;
56
- label?: boolean;
78
+ /** Type of loading indicator */
79
+ type:
80
+ | 'audio' | 'ball' | 'bars' | 'box'
81
+ | 'clock' | 'comment' | 'cube' | 'dots'
82
+ | 'facebook' | 'gears' | 'grid' | 'hearts'
83
+ | 'hourglass' | 'infinity' | 'ios' | 'orbit'
84
+ | 'oval' | 'pie' | 'puff' | 'radio'
85
+ | 'rings' | 'tail' | 'spinner'
86
+ /** Color of the loading indicator */
87
+ color?: NamedColor | undefined
88
+ /** Size of the loading indicator */
89
+ size?: string | undefined
90
+ /** Whether to show loading text */
91
+ label?: boolean
92
+ }
93
+
94
+ /**
95
+ * Complete theme configuration
96
+ */
97
+ export interface Theme {
98
+ /** Base size for components */
99
+ size: ThemeSize
100
+ /** Rounded corners setting */
101
+ rounded: ThemeRounded
102
+ /** Shadow configuration */
103
+ shadow: ThemeShadow
104
+ /** Fluid layout behavior */
105
+ fluid: ThemeFluid
106
+ /** Default button styles */
107
+ button: ThemeBtn
108
+ /** Default input styles */
109
+ input: ThemeInput
57
110
  }
58
111
 
112
+ /**
113
+ * Theme context with default values
114
+ */
59
115
  export interface ThemeContext {
60
116
  /**
61
- * Default size of theme.
117
+ * Default transition for "in" state
62
118
  */
63
- size: ThemeSize;
119
+ inTransition: TransitionClass
64
120
  /**
65
- * Theme rounded.
121
+ * Default transition for "out" state
66
122
  */
67
- rounded: ThemeRounded;
123
+ outTransition: TransitionClass
124
+
68
125
  /**
69
- * Theme shadow.
126
+ * Base size for all components
70
127
  */
71
- shadow: ThemeShadow;
128
+ size: ThemeSize
129
+
72
130
  /**
73
- * Theme fluid.
131
+ * Global rounded corners setting
74
132
  */
75
- fluid: ThemeFluid;
133
+ rounded: ThemeRounded
134
+
76
135
  /**
77
- * Default buttons style.
136
+ * Global shadow setting
78
137
  */
79
- buttons: ThemeBtn;
138
+ shadow: ThemeShadow
139
+
80
140
  /**
81
- * Default inputs style.
141
+ * Fluid layout behavior
82
142
  */
83
- inputs: ThemeInput;
143
+ fluid: ThemeFluid
144
+
145
+ /**
146
+ * Default button styles
147
+ */
148
+ buttons: ThemeBtn
149
+
150
+ /**
151
+ * Default input styles
152
+ */
153
+ inputs: ThemeInput
154
+
84
155
  /**
85
- * Default of loading slot of q-btn.
156
+ * Default loading configuration for buttons
157
+ * Set to false to disable
86
158
  */
87
- buttonLoading: ButtonLoadingOptions | false;
159
+ buttonLoading: ButtonLoadingOptions | false
88
160
  }
@@ -4,7 +4,7 @@ import type { AxiosInstance } from 'axios'
4
4
  import { extend } from 'quasar'
5
5
 
6
6
  export const createMyth = (options: InstallOptions) => {
7
- const defaultOptions: MythApi = {
7
+ const defaultOptions = {
8
8
  asyncComponents: !1,
9
9
  api: {
10
10
  url: '',
@@ -12,6 +12,8 @@ export const createMyth = (options: InstallOptions) => {
12
12
  axios: {} as AxiosInstance
13
13
  },
14
14
  theme: {
15
+ inTransition: 'fadeIn',
16
+ outTransition: 'fadeOut',
15
17
  size: 'md',
16
18
  rounded: !0,
17
19
  shadow: 2,
@@ -1,27 +0,0 @@
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
10
- lang="ts"
11
- setup
12
- >
13
- defineOptions({
14
- name: 'MFadeTransition',
15
- inheritAttrs: !1
16
- })
17
- </script>
18
-
19
- <template>
20
- <Transition
21
- appear
22
- name="myth-transition__fade"
23
- v-bind="$attrs"
24
- >
25
- <slot />
26
- </Transition>
27
- </template>
@@ -1,26 +0,0 @@
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
- <script
9
- lang="ts"
10
- setup
11
- >
12
- defineOptions({
13
- name: 'MFadeXTransition',
14
- inheritAttrs: !1
15
- })
16
- </script>
17
-
18
- <template>
19
- <Transition
20
- appear
21
- name="myth-transition__fade-x"
22
- v-bind="$attrs"
23
- >
24
- <slot />
25
- </Transition>
26
- </template>