@bobbykim/manguito-theme 0.16.0 → 0.18.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 (35) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/README.md +1 -0
  3. package/index.d.ts +5 -5
  4. package/index.js +9 -21
  5. package/index.ts +11 -28
  6. package/lib/alert/Alert.vue +92 -0
  7. package/lib/alert/Alert.vue.d.ts +65 -0
  8. package/lib/collapse/Collapse.vue +2 -10
  9. package/lib/collapse/Collapse.vue.d.ts +4 -2
  10. package/lib/composables/observeVisible.d.ts +6 -1
  11. package/lib/composables/observeVisible.js +6 -6
  12. package/lib/composables/observeVisible.ts +28 -22
  13. package/lib/dropdown/DropdownContainer.vue.d.ts +5 -2
  14. package/lib/dropdown/DropdownContent.vue.d.ts +6 -2
  15. package/lib/header/HeaderHorizontal.vue.d.ts +8 -2
  16. package/lib/header/HeaderVertical.vue.d.ts +9 -2
  17. package/lib/header/NavDrawer.vue.d.ts +1 -1
  18. package/lib/modal/Modal.vue +3 -17
  19. package/lib/modal/Modal.vue.d.ts +15 -2
  20. package/lib/sidebar/Sidebar.vue +3 -17
  21. package/lib/sidebar/Sidebar.vue.d.ts +16 -3
  22. package/lib/theme/generateClass.d.ts +2 -0
  23. package/lib/theme/generateClass.js +18 -0
  24. package/lib/theme/generateClass.ts +25 -0
  25. package/lib/tooltip/index.d.ts +1 -1
  26. package/package.json +2 -2
  27. /package/{theme → lib/theme}/index.d.ts +0 -0
  28. /package/{theme → lib/theme}/index.js +0 -0
  29. /package/{theme → lib/theme}/index.ts +0 -0
  30. /package/{theme → lib/theme}/theme.d.ts +0 -0
  31. /package/{theme → lib/theme}/theme.js +0 -0
  32. /package/{theme → lib/theme}/theme.ts +0 -0
  33. /package/{theme → lib/theme}/theme.types.d.ts +0 -0
  34. /package/{theme → lib/theme}/theme.types.js +0 -0
  35. /package/{theme → lib/theme}/theme.types.ts +0 -0
package/CHANGELOG.md CHANGED
@@ -3,6 +3,42 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [0.18.0](https://github.com/bobbykim89/manguito-component-library/compare/@bobbykim/manguito-theme@0.17.0...@bobbykim/manguito-theme@0.18.0) (2024-04-01)
7
+
8
+
9
+ ### Features
10
+
11
+ * **manguito-theme:** update alert component event, update readme files, update story files ([99d4a7e](https://github.com/bobbykim89/manguito-component-library/commit/99d4a7ef192dfb628cf5b37b1cce34bb33aeb4c1))
12
+ * **manguito-theme:** update observeVisibleAttr composable, add alert component ([1629762](https://github.com/bobbykim89/manguito-component-library/commit/16297624b667066bd7076b02001f0ca8db65630d))
13
+ * ready for production ([4e2fc04](https://github.com/bobbykim89/manguito-component-library/commit/4e2fc048edd67791b4e917e0a764f301d4c610cb))
14
+
15
+
16
+
17
+
18
+
19
+ # [0.17.0](https://github.com/bobbykim89/manguito-component-library/compare/@bobbykim/manguito-theme@0.15.0...@bobbykim/manguito-theme@0.17.0) (2024-03-24)
20
+
21
+
22
+ ### Features
23
+
24
+ * build and release ([a372086](https://github.com/bobbykim89/manguito-component-library/commit/a3720861fb40dd6ec1d0e3dda1f06e2479967432))
25
+ * code refactor ([8a025e7](https://github.com/bobbykim89/manguito-component-library/commit/8a025e7cf870ff3dd0cb35878a08793e99ec5cef))
26
+ * **components/*:** prepublish build ([c8eb95a](https://github.com/bobbykim89/manguito-component-library/commit/c8eb95a0ede6727bf183d2e9ad634ae64af1411d))
27
+ * **manguito-theme:** add header-vertical component ([05c339d](https://github.com/bobbykim89/manguito-component-library/commit/05c339d77cdded35d2e45a5c22c3833329e41532))
28
+ * **manguito-theme:** add new base component header-horizontal ([d3826ee](https://github.com/bobbykim89/manguito-component-library/commit/d3826ee1da15ea0edd2fa7f959269704f22008b3))
29
+ * **manguito-theme:** code refactor ([d310131](https://github.com/bobbykim89/manguito-component-library/commit/d31013189fa5e1c4f8085de63a08ee2932652f55))
30
+ * **mcl-header-a:** wip) update mcl-header-a ([344a13f](https://github.com/bobbykim89/manguito-component-library/commit/344a13f3cd25c6b02fc99866f19ae65bc89d9ec5))
31
+ * **mcl-header-b:** add mobile layout for mcl-header-b ([ca961ec](https://github.com/bobbykim89/manguito-component-library/commit/ca961ecbaecab1d2e879cb62e905e713878539c0))
32
+ * **mcl-header-b:** add more layouts for desktop screen ([bfd1c7e](https://github.com/bobbykim89/manguito-component-library/commit/bfd1c7e8ed3d9b839bea0dd1a7c3b5740a345c41))
33
+ * **mcl-header-b:** fix minor issues with mcl closing collapses in menu item click, update text color of menu items ([1ecfcf3](https://github.com/bobbykim89/manguito-component-library/commit/1ecfcf3ec474e6a6097a34bb9861cbb680280530))
34
+ * **mcl-header-b:** wip) adding story file for mcl-header-b ([2a80675](https://github.com/bobbykim89/manguito-component-library/commit/2a8067553df9a138398aef2a898ebdf3b4a9a268))
35
+ * **mcl-header:** move deprecated items to deprecated folder in root dir, update configs, init mcl-header-b component ([19aa842](https://github.com/bobbykim89/manguito-component-library/commit/19aa842faa7f1594f7be030b97d5093014efe7cb))
36
+ * tsconfig update, slots and emits update ([c30ff80](https://github.com/bobbykim89/manguito-component-library/commit/c30ff804c961d205ac097e20cd51285a15ca8966))
37
+
38
+
39
+
40
+
41
+
6
42
  # [0.16.0](https://github.com/bobbykim89/manguito-component-library/compare/@bobbykim/manguito-theme@0.15.0...@bobbykim/manguito-theme@0.16.0) (2024-03-21)
7
43
 
8
44
 
package/README.md CHANGED
@@ -8,6 +8,7 @@ manguito-theme includes basic config for MCL, including type definitions for the
8
8
 
9
9
  - [Installation](https://manguito-component-library.vercel.app/?path=/docs/introduction-installation--docs)
10
10
  - Base Components
11
+ - [Alert](https://manguito-component-library.vercel.app/?path=/docs/base-base-component-alert-component--alert)
11
12
  - [Collapse](https://manguito-component-library.vercel.app/?path=/docs/base-base-component-collapse-component--collapse)
12
13
  - [Dropdown](https://manguito-component-library.vercel.app/?path=/docs/base-base-component-dropdown-component--dropdown)
13
14
  - [Modal](https://manguito-component-library.vercel.app/?path=/docs/base-base-component-modal-component--modal)
package/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import type { ClassType, InputType } from './theme';
1
+ import { generateClass } from './lib/theme/generateClass';
2
+ import Alert from './lib/alert/Alert.vue';
2
3
  import Collapse from './lib/collapse/Collapse.vue';
3
4
  import DropdownContainer from './lib/dropdown/DropdownContainer.vue';
4
5
  import DropdownContent from './lib/dropdown/DropdownContent.vue';
@@ -6,9 +7,8 @@ import HeaderHorizontal from './lib/header/HeaderHorizontal.vue';
6
7
  import HeaderVertical from './lib/header/HeaderVertical.vue';
7
8
  import Modal from './lib/modal/Modal.vue';
8
9
  import Sidebar from './lib/sidebar/Sidebar.vue';
9
- declare const generateClass: (type: ClassType, value: InputType) => string;
10
- export default generateClass;
11
10
  export * from './lib/directives';
12
11
  export * from './lib/header/index.types';
13
- export * from './theme/theme.types';
14
- export { Collapse, DropdownContainer, DropdownContent, HeaderHorizontal, HeaderVertical, Modal, Sidebar, };
12
+ export * from './lib/theme/theme.types';
13
+ export { Alert, Collapse, DropdownContainer, DropdownContent, HeaderHorizontal, HeaderVertical, Modal, Sidebar, };
14
+ export default generateClass;
package/index.js CHANGED
@@ -1,5 +1,7 @@
1
- import GenerateMCLClass, { borderWidthType, colorType, scaleType, textType, } from './theme';
1
+ // generate class function
2
+ import { generateClass } from './lib/theme/generateClass';
2
3
  // base components
4
+ import Alert from './lib/alert/Alert.vue';
3
5
  import Collapse from './lib/collapse/Collapse.vue';
4
6
  import DropdownContainer from './lib/dropdown/DropdownContainer.vue';
5
7
  import DropdownContent from './lib/dropdown/DropdownContent.vue';
@@ -7,25 +9,11 @@ import HeaderHorizontal from './lib/header/HeaderHorizontal.vue';
7
9
  import HeaderVertical from './lib/header/HeaderVertical.vue';
8
10
  import Modal from './lib/modal/Modal.vue';
9
11
  import Sidebar from './lib/sidebar/Sidebar.vue';
10
- const generateClass = (type, value) => {
11
- const mclGenerate = new GenerateMCLClass(type, value);
12
- if (colorType.includes(type)) {
13
- return mclGenerate.generateColorClass();
14
- }
15
- if (textType.includes(type)) {
16
- return mclGenerate.generateTextClass();
17
- }
18
- if (borderWidthType.includes(type)) {
19
- return mclGenerate.generateBorderWidthClass();
20
- }
21
- if (scaleType.includes(type)) {
22
- return mclGenerate.generateScaleClass();
23
- }
24
- // return spacing type if all of above is false
25
- return mclGenerate.generateSpacingClass();
26
- };
27
- export default generateClass;
12
+ // directives
28
13
  export * from './lib/directives';
14
+ // types
29
15
  export * from './lib/header/index.types';
30
- export * from './theme/theme.types';
31
- export { Collapse, DropdownContainer, DropdownContent, HeaderHorizontal, HeaderVertical, Modal, Sidebar, };
16
+ export * from './lib/theme/theme.types';
17
+ // export components
18
+ export { Alert, Collapse, DropdownContainer, DropdownContent, HeaderHorizontal, HeaderVertical, Modal, Sidebar, };
19
+ export default generateClass;
package/index.ts CHANGED
@@ -1,11 +1,7 @@
1
- import type { ClassType, InputType } from './theme'
2
- import GenerateMCLClass, {
3
- borderWidthType,
4
- colorType,
5
- scaleType,
6
- textType,
7
- } from './theme'
1
+ // generate class function
2
+ import { generateClass } from './lib/theme/generateClass'
8
3
  // base components
4
+ import Alert from './lib/alert/Alert.vue'
9
5
  import Collapse from './lib/collapse/Collapse.vue'
10
6
  import DropdownContainer from './lib/dropdown/DropdownContainer.vue'
11
7
  import DropdownContent from './lib/dropdown/DropdownContent.vue'
@@ -14,30 +10,15 @@ import HeaderVertical from './lib/header/HeaderVertical.vue'
14
10
  import Modal from './lib/modal/Modal.vue'
15
11
  import Sidebar from './lib/sidebar/Sidebar.vue'
16
12
 
17
- const generateClass = (type: ClassType, value: InputType): string => {
18
- const mclGenerate = new GenerateMCLClass(type, value)
19
- if ((<string[]>(<unknown>colorType)).includes(type)) {
20
- return mclGenerate.generateColorClass()
21
- }
22
- if ((<string[]>(<unknown>textType)).includes(type)) {
23
- return mclGenerate.generateTextClass()
24
- }
25
- if ((<string[]>(<unknown>borderWidthType)).includes(type)) {
26
- return mclGenerate.generateBorderWidthClass()
27
- }
28
- if ((<string[]>(<unknown>scaleType)).includes(type)) {
29
- return mclGenerate.generateScaleClass()
30
- }
31
- // return spacing type if all of above is false
32
- return mclGenerate.generateSpacingClass()
33
- }
34
-
35
- export default generateClass
36
-
13
+ // directives
37
14
  export * from './lib/directives'
15
+ // types
38
16
  export * from './lib/header/index.types'
39
- export * from './theme/theme.types'
17
+ export * from './lib/theme/theme.types'
18
+
19
+ // export components
40
20
  export {
21
+ Alert,
41
22
  Collapse,
42
23
  DropdownContainer,
43
24
  DropdownContent,
@@ -46,3 +27,5 @@ export {
46
27
  Modal,
47
28
  Sidebar,
48
29
  }
30
+
31
+ export default generateClass
@@ -0,0 +1,92 @@
1
+ <script setup lang="ts">
2
+ import { computed, ref, watch } from 'vue'
3
+ import type { ColorPalette } from '../../'
4
+ import generateClass from '../../'
5
+ const props = withDefaults(
6
+ defineProps<{
7
+ color?: ColorPalette
8
+ rounded?: boolean
9
+ shadow?: boolean
10
+ show?: boolean
11
+ dismissible?: boolean
12
+ }>(),
13
+ {
14
+ color: 'danger',
15
+ rounded: true,
16
+ shadow: true,
17
+ show: false,
18
+ dismissible: false,
19
+ }
20
+ )
21
+
22
+ const slots = defineSlots<{
23
+ default: any
24
+ }>()
25
+
26
+ const emit = defineEmits<{
27
+ (e: 'close', event: Event): void
28
+ }>()
29
+
30
+ const showAlert = ref<boolean>(props.show)
31
+ const componentClass = computed<string>(() => {
32
+ const { color, rounded, shadow } = props
33
+ const classArray: string[] = [generateClass('BGCOLOR', color)]
34
+ if (rounded) {
35
+ classArray.push('rounded-md')
36
+ }
37
+ if (shadow) {
38
+ classArray.push('drop-shadow-md')
39
+ }
40
+ return classArray.join(' ')
41
+ })
42
+ const handleClose = (e: Event) => {
43
+ showAlert.value = false
44
+ emit('close', e)
45
+ }
46
+ const closeAlert = () => {
47
+ showAlert.value = false
48
+ }
49
+ watch(
50
+ () => props.show,
51
+ (newValue) => {
52
+ showAlert.value = newValue
53
+ }
54
+ )
55
+ defineExpose({
56
+ close: closeAlert,
57
+ })
58
+ </script>
59
+
60
+ <template>
61
+ <div
62
+ v-if="showAlert"
63
+ role="alert"
64
+ aria-live="polite"
65
+ aria-atomic="true"
66
+ class="py-[0.75rem] px-[1.25rem] relative"
67
+ :class="[componentClass]"
68
+ >
69
+ <div class="w-full flex justify-between gap-2xs">
70
+ <div class="w-full">
71
+ <slot></slot>
72
+ </div>
73
+ <button
74
+ v-if="dismissible"
75
+ @click="handleClose"
76
+ class="flex items-center opacity-60 hover:opacity-40 transition-opacity duration-300 ease-linear"
77
+ >
78
+ <svg
79
+ xmlns="http://www.w3.org/2000/svg"
80
+ viewBox="0 0 384 512"
81
+ fill="currentColor"
82
+ class="h-xs"
83
+ >
84
+ <!-- !Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc. -->
85
+ <path
86
+ d="M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3 297.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256 342.6 150.6z"
87
+ />
88
+ </svg>
89
+ </button>
90
+ </div>
91
+ </div>
92
+ </template>
@@ -0,0 +1,65 @@
1
+ import type { ColorPalette } from '../../';
2
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
3
+ color?: ColorPalette | undefined;
4
+ rounded?: boolean | undefined;
5
+ shadow?: boolean | undefined;
6
+ show?: boolean | undefined;
7
+ dismissible?: boolean | undefined;
8
+ }>, {
9
+ color: string;
10
+ rounded: boolean;
11
+ shadow: boolean;
12
+ show: boolean;
13
+ dismissible: boolean;
14
+ }>, {
15
+ close: () => void;
16
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
17
+ close: (event: Event) => void;
18
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
19
+ color?: ColorPalette | undefined;
20
+ rounded?: boolean | undefined;
21
+ shadow?: boolean | undefined;
22
+ show?: boolean | undefined;
23
+ dismissible?: boolean | undefined;
24
+ }>, {
25
+ color: string;
26
+ rounded: boolean;
27
+ shadow: boolean;
28
+ show: boolean;
29
+ dismissible: boolean;
30
+ }>>> & {
31
+ onClose?: ((event: Event) => any) | undefined;
32
+ }, {
33
+ color: ColorPalette;
34
+ shadow: boolean;
35
+ rounded: boolean;
36
+ show: boolean;
37
+ dismissible: boolean;
38
+ }, {}>, Readonly<{
39
+ default: any;
40
+ }> & {
41
+ default: any;
42
+ }>;
43
+ export default _default;
44
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
45
+ type __VLS_TypePropsToRuntimeProps<T> = {
46
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
47
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
48
+ } : {
49
+ type: import('vue').PropType<T[K]>;
50
+ required: true;
51
+ };
52
+ };
53
+ type __VLS_WithDefaults<P, D> = {
54
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
55
+ default: D[K];
56
+ }> : P[K];
57
+ };
58
+ type __VLS_Prettify<T> = {
59
+ [K in keyof T]: T[K];
60
+ } & {};
61
+ type __VLS_WithTemplateSlots<T, S> = T & {
62
+ new (): {
63
+ $slots: S;
64
+ };
65
+ };
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { Transition, onBeforeUnmount, onMounted, ref, watch } from 'vue'
2
+ import { Transition, ref, watch } from 'vue'
3
3
  import { observeVisibleAttr } from '../composables'
4
4
 
5
5
  const props = withDefaults(
@@ -67,7 +67,7 @@ const onLeave = (el: any) => {
67
67
  const handleVisibility = (visible: boolean = false) => {
68
68
  toggle.value = visible
69
69
  }
70
- const observer = observeVisibleAttr(handleVisibility)
70
+ observeVisibleAttr(collapseRef, handleVisibility)
71
71
 
72
72
  watch(
73
73
  () => props.visible,
@@ -87,14 +87,6 @@ defineExpose({
87
87
  close: closeCollapse,
88
88
  open: openCollapse,
89
89
  })
90
- onMounted(() => {
91
- if (collapseRef.value) {
92
- observer.observe(collapseRef.value, { attributes: true })
93
- }
94
- })
95
- onBeforeUnmount(() => {
96
- observer.disconnect()
97
- })
98
90
  </script>
99
91
 
100
92
  <template>
@@ -12,7 +12,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
12
12
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
13
13
  open: (visible: boolean) => void;
14
14
  close: (visible: boolean) => void;
15
- }, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
15
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
16
16
  accordion?: string | undefined;
17
17
  className?: string | undefined;
18
18
  visible?: boolean | undefined;
@@ -27,7 +27,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
27
27
  className: string;
28
28
  }, {}>, Readonly<{
29
29
  default: any;
30
- }>>;
30
+ }> & {
31
+ default: any;
32
+ }>;
31
33
  export default _default;
32
34
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
33
35
  type __VLS_TypePropsToRuntimeProps<T> = {
@@ -1 +1,6 @@
1
- export declare const observeVisibleAttr: (fn: (...args: any[]) => void) => MutationObserver;
1
+ import type { Ref } from 'vue';
2
+ export declare const observeVisibleAttr: (el: Ref, fn: (...args: any[]) => void) => {
3
+ isSupported: import("vue").ComputedRef<boolean>;
4
+ stop: () => void;
5
+ takeRecords: () => MutationRecord[] | undefined;
6
+ };
@@ -1,15 +1,16 @@
1
- export const observeVisibleAttr = (fn) => {
2
- const observer = new MutationObserver((mutations) => {
1
+ import { useMutationObserver } from '@vueuse/core';
2
+ export const observeVisibleAttr = (el, fn) => {
3
+ return useMutationObserver(el, (mutations) => {
3
4
  let changed = false;
4
5
  for (let i = 0; i < mutations.length && !changed; i++) {
5
6
  const mutation = mutations[i];
6
7
  const mutationType = mutation.type;
7
- const mutationAttribute = mutation.attributeName;
8
+ const mutationAttr = mutation.attributeName;
8
9
  const mutationTarget = mutation.target;
9
10
  if (mutationType === 'attributes') {
10
11
  changed = true;
11
12
  }
12
- else if (mutationAttribute === 'visible') {
13
+ else if (mutationAttr === 'visible') {
13
14
  changed = true;
14
15
  }
15
16
  if (changed) {
@@ -19,6 +20,5 @@ export const observeVisibleAttr = (fn) => {
19
20
  fn(visibleAttr);
20
21
  }
21
22
  }
22
- });
23
- return observer;
23
+ }, { attributes: true });
24
24
  };
@@ -1,24 +1,30 @@
1
- export const observeVisibleAttr = (fn: (...args: any[]) => void) => {
2
- const observer = new MutationObserver((mutations) => {
3
- let changed = false
4
- for (let i = 0; i < mutations.length && !changed; i++) {
5
- const mutation = mutations[i]
6
- const mutationType = mutation.type
7
- const mutationAttribute = mutation.attributeName
8
- const mutationTarget = mutation.target
9
- if (mutationType === 'attributes') {
10
- changed = true
11
- } else if (mutationAttribute === 'visible') {
12
- changed = true
1
+ import { useMutationObserver } from '@vueuse/core'
2
+ import type { Ref } from 'vue'
3
+
4
+ export const observeVisibleAttr = (el: Ref, fn: (...args: any[]) => void) => {
5
+ return useMutationObserver(
6
+ el,
7
+ (mutations) => {
8
+ let changed: boolean = false
9
+ for (let i = 0; i < mutations.length && !changed; i++) {
10
+ const mutation = mutations[i]
11
+ const mutationType = mutation.type
12
+ const mutationAttr = mutation.attributeName
13
+ const mutationTarget = mutation.target
14
+ if (mutationType === 'attributes') {
15
+ changed = true
16
+ } else if (mutationAttr === 'visible') {
17
+ changed = true
18
+ }
19
+ if (changed) {
20
+ const visibleAttr =
21
+ (mutationTarget as HTMLElement).getAttribute('visible') === 'true'
22
+ ? true
23
+ : false
24
+ fn(visibleAttr)
25
+ }
13
26
  }
14
- if (changed) {
15
- const visibleAttr =
16
- (mutationTarget as HTMLElement).getAttribute('visible') === 'true'
17
- ? true
18
- : false
19
- fn(visibleAttr)
20
- }
21
- }
22
- })
23
- return observer
27
+ },
28
+ { attributes: true }
29
+ )
24
30
  }
@@ -1,13 +1,16 @@
1
1
  declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
2
2
  "click-outside": (event: Event) => void;
3
3
  toggle: (event: Event) => void;
4
- }, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>> & {
4
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{}>> & {
5
5
  onToggle?: ((event: Event) => any) | undefined;
6
6
  "onClick-outside"?: ((event: Event) => any) | undefined;
7
7
  }, {}, {}>, Readonly<{
8
8
  default: any;
9
9
  toggler: any;
10
- }>>;
10
+ }> & {
11
+ default: any;
12
+ toggler: any;
13
+ }>;
11
14
  export default _default;
12
15
  type __VLS_WithTemplateSlots<T, S> = T & {
13
16
  new (): {
@@ -2,7 +2,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
2
2
  className?: string | undefined;
3
3
  }>, {
4
4
  className: string;
5
- }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
5
+ }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
6
6
  className?: string | undefined;
7
7
  }>, {
8
8
  className: string;
@@ -12,7 +12,11 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
12
12
  default(props: {
13
13
  itemClick: () => void;
14
14
  }): any;
15
- }>>;
15
+ }> & {
16
+ default(props: {
17
+ itemClick: () => void;
18
+ }): any;
19
+ }>;
16
20
  export default _default;
17
21
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
18
22
  type __VLS_TypePropsToRuntimeProps<T> = {
@@ -20,7 +20,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
20
20
  headerClose: () => void;
21
21
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
22
22
  "toggle-drawer": (event: Event, open: boolean) => void;
23
- }, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
23
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
24
24
  bgColor?: ColorPalette | undefined;
25
25
  mobileMenuBgColor?: ColorPalette | undefined;
26
26
  drawerBtnColor?: ColorPalette | undefined;
@@ -52,7 +52,13 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
52
52
  'mobile-content'(props: {
53
53
  headerClose: () => void;
54
54
  }): any;
55
- }>>;
55
+ }> & {
56
+ content: any;
57
+ 'content-right': any;
58
+ 'mobile-content'(props: {
59
+ headerClose: () => void;
60
+ }): any;
61
+ }>;
56
62
  export default _default;
57
63
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
58
64
  type __VLS_TypePropsToRuntimeProps<T> = {
@@ -13,7 +13,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
13
13
  headerClose: () => void;
14
14
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
15
15
  "toggle-drawer": (event: Event, open: boolean) => void;
16
- }, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
16
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
17
17
  bgColor?: ColorPalette | undefined;
18
18
  drawerBtnColor?: ColorPalette | undefined;
19
19
  drawerBtnBorder?: boolean | undefined;
@@ -37,7 +37,14 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
37
37
  'mobile-content'(props: {
38
38
  headerClose: () => void;
39
39
  }): any;
40
- }>>;
40
+ }> & {
41
+ default: any;
42
+ content: any;
43
+ 'content-bottom': any;
44
+ 'mobile-content'(props: {
45
+ headerClose: () => void;
46
+ }): any;
47
+ }>;
41
48
  export default _default;
42
49
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
43
50
  type __VLS_TypePropsToRuntimeProps<T> = {
@@ -9,7 +9,7 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
9
9
  displayBorder: boolean;
10
10
  }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
11
11
  "hbg-click": (...args: any[]) => void;
12
- }, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
12
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
13
13
  color?: ColorPalette | undefined;
14
14
  displayBorder?: boolean | undefined;
15
15
  toggle: boolean;
@@ -1,12 +1,5 @@
1
1
  <script setup lang="ts">
2
- import {
3
- Transition,
4
- computed,
5
- onBeforeUnmount,
6
- onMounted,
7
- ref,
8
- watch,
9
- } from 'vue'
2
+ import { Transition, computed, ref, watch } from 'vue'
10
3
  import type { ColorPalette, VerticalAlignment } from '../../'
11
4
  import generateClass, { vClickOutside } from '../../'
12
5
  import { observeVisibleAttr } from '../composables'
@@ -92,7 +85,8 @@ const onAfterLeave = () => {
92
85
  const handleVisibility = (visible: boolean = false) => {
93
86
  toggle.value = visible
94
87
  }
95
- const observer = observeVisibleAttr(handleVisibility)
88
+
89
+ observeVisibleAttr(modalRef, handleVisibility)
96
90
 
97
91
  watch(
98
92
  () => props.visible,
@@ -112,14 +106,6 @@ defineExpose({
112
106
  close: closeModal,
113
107
  open: openModal,
114
108
  })
115
- onMounted(() => {
116
- if (modalRef.value) {
117
- observer.observe(modalRef.value, { attributes: true })
118
- }
119
- })
120
- onBeforeUnmount(() => {
121
- observer.disconnect()
122
- })
123
109
  </script>
124
110
 
125
111
  <template>
@@ -25,7 +25,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
25
25
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
26
26
  open: (visible: boolean) => void;
27
27
  close: (visible: boolean) => void;
28
- }, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
28
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
29
29
  title?: string | undefined;
30
30
  titleColor?: ColorPalette | undefined;
31
31
  className?: string | undefined;
@@ -69,7 +69,20 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
69
69
  close: () => void;
70
70
  status: boolean;
71
71
  }): any;
72
- }>>;
72
+ }> & {
73
+ header(props: {
74
+ close: () => void;
75
+ status: boolean;
76
+ }): any;
77
+ body(props: {
78
+ close: () => void;
79
+ status: boolean;
80
+ }): any;
81
+ footer(props: {
82
+ close: () => void;
83
+ status: boolean;
84
+ }): any;
85
+ }>;
73
86
  export default _default;
74
87
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
75
88
  type __VLS_TypePropsToRuntimeProps<T> = {
@@ -1,12 +1,5 @@
1
1
  <script setup lang="ts">
2
- import {
3
- Transition,
4
- computed,
5
- onBeforeUnmount,
6
- onMounted,
7
- ref,
8
- watch,
9
- } from 'vue'
2
+ import { Transition, computed, ref, watch } from 'vue'
10
3
  import type { ColorPalette, DirectionX } from '../../'
11
4
  import generateClass, { vClickOutside } from '../../'
12
5
  import { observeVisibleAttr } from '../composables'
@@ -101,7 +94,8 @@ const onAfterLeave = () => {
101
94
  const handleVisibility = (visible: boolean = false) => {
102
95
  toggle.value = visible
103
96
  }
104
- const observer = observeVisibleAttr(handleVisibility)
97
+
98
+ observeVisibleAttr(sidebarRef, handleVisibility)
105
99
 
106
100
  watch(
107
101
  () => props.visible,
@@ -121,14 +115,6 @@ defineExpose({
121
115
  open: openSidebar,
122
116
  close: closeSidebar,
123
117
  })
124
- onMounted(() => {
125
- if (sidebarRef.value) {
126
- observer.observe(sidebarRef.value, { attributes: true })
127
- }
128
- })
129
- onBeforeUnmount(() => {
130
- observer.disconnect()
131
- })
132
118
  </script>
133
119
 
134
120
  <template>
@@ -27,7 +27,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
27
27
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
28
28
  open: (visible: boolean) => void;
29
29
  close: (visible: boolean) => void;
30
- }, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
30
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
31
31
  title?: string | undefined;
32
32
  titleColor?: ColorPalette | undefined;
33
33
  className?: string | undefined;
@@ -55,12 +55,12 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
55
55
  visible: boolean;
56
56
  className: string;
57
57
  color: ColorPalette;
58
+ width: string | number;
58
59
  titleColor: ColorPalette;
59
60
  noBackdrop: boolean;
60
61
  noHeader: boolean;
61
62
  backdropColor: ColorPalette;
62
63
  placement: DirectionX;
63
- width: string | number;
64
64
  }, {}>, Readonly<{
65
65
  header(props: {
66
66
  close: () => void;
@@ -74,7 +74,20 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
74
74
  close: () => void;
75
75
  status: boolean;
76
76
  }): any;
77
- }>>;
77
+ }> & {
78
+ header(props: {
79
+ close: () => void;
80
+ status: boolean;
81
+ }): any;
82
+ body(props: {
83
+ close: () => void;
84
+ status: boolean;
85
+ }): any;
86
+ footer(props: {
87
+ close: () => void;
88
+ status: boolean;
89
+ }): any;
90
+ }>;
78
91
  export default _default;
79
92
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
80
93
  type __VLS_TypePropsToRuntimeProps<T> = {
@@ -0,0 +1,2 @@
1
+ import type { ClassType, InputType } from '.';
2
+ export declare const generateClass: (type: ClassType, value: InputType) => string;
@@ -0,0 +1,18 @@
1
+ import GenerateMCLClass, { borderWidthType, colorType, scaleType, textType, } from '.';
2
+ export const generateClass = (type, value) => {
3
+ const mclGenerate = new GenerateMCLClass(type, value);
4
+ if (colorType.includes(type)) {
5
+ return mclGenerate.generateColorClass();
6
+ }
7
+ if (textType.includes(type)) {
8
+ return mclGenerate.generateTextClass();
9
+ }
10
+ if (borderWidthType.includes(type)) {
11
+ return mclGenerate.generateBorderWidthClass();
12
+ }
13
+ if (scaleType.includes(type)) {
14
+ return mclGenerate.generateScaleClass();
15
+ }
16
+ // return spacing type if all of above is false
17
+ return mclGenerate.generateSpacingClass();
18
+ };
@@ -0,0 +1,25 @@
1
+ import type { ClassType, InputType } from '.'
2
+ import GenerateMCLClass, {
3
+ borderWidthType,
4
+ colorType,
5
+ scaleType,
6
+ textType,
7
+ } from '.'
8
+
9
+ export const generateClass = (type: ClassType, value: InputType): string => {
10
+ const mclGenerate = new GenerateMCLClass(type, value)
11
+ if ((<string[]>(<unknown>colorType)).includes(type)) {
12
+ return mclGenerate.generateColorClass()
13
+ }
14
+ if ((<string[]>(<unknown>textType)).includes(type)) {
15
+ return mclGenerate.generateTextClass()
16
+ }
17
+ if ((<string[]>(<unknown>borderWidthType)).includes(type)) {
18
+ return mclGenerate.generateBorderWidthClass()
19
+ }
20
+ if ((<string[]>(<unknown>scaleType)).includes(type)) {
21
+ return mclGenerate.generateScaleClass()
22
+ }
23
+ // return spacing type if all of above is false
24
+ return mclGenerate.generateSpacingClass()
25
+ }
@@ -27,7 +27,7 @@ declare const _default: import("vue").DefineComponent<{
27
27
  };
28
28
  }, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
29
29
  [key: string]: any;
30
- }>, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
30
+ }>, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
31
31
  direction: {
32
32
  type: PropType<Direction>;
33
33
  default: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bobbykim/manguito-theme",
3
- "version": "0.16.0",
3
+ "version": "0.18.0",
4
4
  "description": "main theme file for manguito components library. Other MCL components will need to import this file to run.",
5
5
  "type": "module",
6
6
  "main": "index.ts",
@@ -30,5 +30,5 @@
30
30
  "url": "https://github.com/bobbykim89/manguito-component-library.git"
31
31
  },
32
32
  "license": "MIT",
33
- "gitHead": "5b81953e5108fd166c0b89ebc6a24e6de9499635"
33
+ "gitHead": "969800695a9a902bc9d0c19ad6ab002caace8061"
34
34
  }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes