nuxt-glorious 1.2.0 → 1.2.9-5

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 (151) hide show
  1. package/dist/module.d.mts +38 -1
  2. package/dist/module.d.ts +38 -1
  3. package/dist/module.json +2 -2
  4. package/dist/module.mjs +45 -36
  5. package/dist/runtime/assets/icons/glorious-eye-fill.svg +1 -1
  6. package/dist/runtime/assets/icons/glorious-eye-off-fill.svg +1 -1
  7. package/dist/runtime/assets/icons/glorious-star-fill.svg +3 -0
  8. package/dist/runtime/assets/icons/glorious-star-half.svg +3 -0
  9. package/dist/runtime/assets/icons/glorious-star-line.svg +3 -0
  10. package/dist/runtime/components/G/Alert.vue +16 -0
  11. package/dist/runtime/components/G/Avatar.vue +16 -0
  12. package/dist/runtime/components/G/Breadcrumb.vue +37 -0
  13. package/dist/runtime/components/G/Button.vue +13 -154
  14. package/dist/runtime/components/G/Checkbox.vue +26 -0
  15. package/dist/runtime/components/G/CountDown.vue +33 -43
  16. package/dist/runtime/components/G/Drawer.vue +16 -75
  17. package/dist/runtime/components/G/Dropdown.vue +17 -31
  18. package/dist/runtime/components/G/ErrorText.vue +7 -11
  19. package/dist/runtime/components/G/File.vue +25 -117
  20. package/dist/runtime/components/G/Icon.vue +125 -0
  21. package/dist/runtime/components/G/Input.vue +126 -250
  22. package/dist/runtime/components/G/Loading.vue +4 -21
  23. package/dist/runtime/components/G/Modal.vue +51 -138
  24. package/dist/runtime/components/G/Paginate.vue +24 -57
  25. package/dist/runtime/components/G/Radio.vue +18 -27
  26. package/dist/runtime/components/G/Rating.vue +30 -0
  27. package/dist/runtime/components/G/Select.vue +27 -112
  28. package/dist/runtime/components/G/Switch.vue +28 -0
  29. package/dist/runtime/components/G/Tab.vue +80 -44
  30. package/dist/runtime/components/G/Table.vue +62 -0
  31. package/dist/runtime/components/G/textarea.vue +17 -120
  32. package/dist/runtime/components/G/timeline.vue +28 -0
  33. package/dist/runtime/components/helper.d.ts +3 -0
  34. package/dist/runtime/components/helper.mjs +37 -0
  35. package/dist/runtime/components/props/Alert.d.ts +8 -0
  36. package/dist/runtime/components/props/Alert.mjs +4 -0
  37. package/dist/runtime/components/props/Avatar.d.ts +12 -0
  38. package/dist/runtime/components/props/Avatar.mjs +9 -0
  39. package/dist/runtime/components/props/Breadcrumb.d.ts +26 -0
  40. package/dist/runtime/components/props/Breadcrumb.mjs +11 -0
  41. package/dist/runtime/components/props/Button.d.ts +47 -0
  42. package/dist/runtime/components/props/Button.mjs +14 -0
  43. package/dist/runtime/components/props/CheckBox.d.ts +23 -0
  44. package/dist/runtime/components/props/CheckBox.mjs +7 -0
  45. package/dist/runtime/components/props/CountDown.d.ts +7 -0
  46. package/dist/runtime/components/props/CountDown.mjs +6 -0
  47. package/dist/runtime/components/props/Drawer.d.ts +8 -0
  48. package/dist/runtime/components/props/Drawer.mjs +7 -0
  49. package/dist/runtime/components/props/ErrorText.d.ts +8 -0
  50. package/dist/runtime/components/props/ErrorText.mjs +4 -0
  51. package/dist/runtime/components/props/File.d.ts +28 -0
  52. package/dist/runtime/components/props/File.mjs +9 -0
  53. package/dist/runtime/components/props/Icon.d.ts +23 -0
  54. package/dist/runtime/components/props/Icon.mjs +7 -0
  55. package/dist/runtime/components/props/Input.d.ts +91 -0
  56. package/dist/runtime/components/props/Input.mjs +50 -0
  57. package/dist/runtime/components/props/Loading.d.ts +18 -0
  58. package/dist/runtime/components/props/Loading.mjs +6 -0
  59. package/dist/runtime/components/props/Modal.d.ts +48 -0
  60. package/dist/runtime/components/props/Modal.mjs +38 -0
  61. package/dist/runtime/components/props/Paginate.d.ts +18 -0
  62. package/dist/runtime/components/props/Paginate.mjs +17 -0
  63. package/dist/runtime/components/props/Radio.d.ts +33 -0
  64. package/dist/runtime/components/props/Radio.mjs +9 -0
  65. package/dist/runtime/components/props/Select.d.ts +61 -0
  66. package/dist/runtime/components/props/Select.mjs +23 -0
  67. package/dist/runtime/components/props/Switch.d.ts +13 -0
  68. package/dist/runtime/components/props/Switch.mjs +5 -0
  69. package/dist/runtime/components/props/Tab.d.ts +21 -0
  70. package/dist/runtime/components/props/Tab.mjs +7 -0
  71. package/dist/runtime/components/props/Table.d.ts +49 -0
  72. package/dist/runtime/components/props/Table.mjs +19 -0
  73. package/dist/runtime/components/props/Textarea.d.ts +38 -0
  74. package/dist/runtime/components/props/Textarea.mjs +14 -0
  75. package/dist/runtime/components/props/Timeline.d.ts +11 -0
  76. package/dist/runtime/components/props/Timeline.mjs +7 -0
  77. package/dist/runtime/components/props/common/index.d.ts +161 -0
  78. package/dist/runtime/components/props/common/index.mjs +147 -0
  79. package/dist/runtime/composables/useGloriousCore.d.ts +1 -1
  80. package/dist/runtime/composables/useGloriousCore.mjs +1 -1
  81. package/dist/runtime/composables/useGloriousFetch.d.ts +4 -3
  82. package/dist/runtime/composables/useGloriousFetch.mjs +6 -5
  83. package/dist/runtime/middlewares/AuthStrategy.mjs +2 -6
  84. package/dist/runtime/middlewares/ResponseGloriousStore.mjs +9 -0
  85. package/dist/runtime/plugins/InputComponent.d.ts +2 -0
  86. package/dist/runtime/plugins/InputComponent.mjs +13 -0
  87. package/dist/runtime/plugins/module.d.ts +4 -0
  88. package/dist/runtime/plugins/module.mjs +94 -0
  89. package/dist/runtime/stores/GloriousStore.d.ts +0 -1
  90. package/dist/runtime/stores/GloriousStore.mjs +3 -13
  91. package/dist/runtime/style/components/alert.css +33 -0
  92. package/dist/runtime/style/components/alert.scss +7 -0
  93. package/dist/runtime/style/components/avatar.css +57 -0
  94. package/dist/runtime/style/components/avatar.scss +13 -0
  95. package/dist/runtime/style/components/breadcrumb.css +6 -0
  96. package/dist/runtime/style/components/breadcrumb.scss +6 -0
  97. package/dist/runtime/style/components/button.css +113 -0
  98. package/dist/runtime/style/components/button.scss +30 -0
  99. package/dist/runtime/style/components/checkbox.css +94 -0
  100. package/dist/runtime/style/components/checkbox.scss +52 -0
  101. package/dist/runtime/{assets/style → style}/components/drawer.css +14 -18
  102. package/dist/runtime/style/components/drawer.scss +57 -0
  103. package/dist/runtime/style/components/dropdown.scss +19 -0
  104. package/dist/runtime/style/components/editor.scss +4 -0
  105. package/dist/runtime/style/components/file.css +134 -0
  106. package/dist/runtime/style/components/file.scss +19 -0
  107. package/dist/runtime/style/components/input.css +187 -0
  108. package/dist/runtime/style/components/input.scss +87 -0
  109. package/dist/runtime/style/components/loading.css +43 -0
  110. package/dist/runtime/style/components/loading.scss +92 -0
  111. package/dist/runtime/style/components/modal.css +66 -0
  112. package/dist/runtime/style/components/modal.scss +76 -0
  113. package/dist/runtime/style/components/paginate.scss +18 -0
  114. package/dist/runtime/style/components/radio.css +121 -0
  115. package/dist/runtime/style/components/radio.scss +59 -0
  116. package/dist/runtime/style/components/rating.css +26 -0
  117. package/dist/runtime/style/components/rating.scss +25 -0
  118. package/dist/runtime/style/components/select.css +46 -0
  119. package/dist/runtime/style/components/select.scss +40 -0
  120. package/dist/runtime/style/components/switch.css +61 -0
  121. package/dist/runtime/style/components/switch.scss +74 -0
  122. package/dist/runtime/{assets/style → style}/components/tab.css +3 -3
  123. package/dist/runtime/style/components/tab.scss +11 -0
  124. package/dist/runtime/style/components/table.css +99 -0
  125. package/dist/runtime/style/components/table.scss +41 -0
  126. package/dist/runtime/style/components/textarea.css +64 -0
  127. package/dist/runtime/style/components/textarea.scss +43 -0
  128. package/dist/runtime/style/components/timeline.css +47 -0
  129. package/dist/runtime/style/components/timeline.scss +40 -0
  130. package/dist/runtime/style/mixin.css +0 -0
  131. package/dist/runtime/style/mixin.scss +40 -0
  132. package/dist/runtime/style/variable.css +0 -0
  133. package/dist/runtime/style/variable.scss +19 -0
  134. package/dist/types.d.mts +2 -10
  135. package/dist/types.d.ts +2 -10
  136. package/package.json +9 -7
  137. package/dist/runtime/assets/style/components/buttons.css +0 -107
  138. package/dist/runtime/assets/style/components/file.css +0 -65
  139. package/dist/runtime/assets/style/components/input.css +0 -91
  140. package/dist/runtime/assets/style/components/modal.css +0 -57
  141. package/dist/runtime/assets/style/components/select.css +0 -54
  142. package/dist/runtime/assets/style/components/textarea.css +0 -64
  143. package/dist/runtime/components/G/Breadcrump.vue +0 -46
  144. package/dist/runtime/components/G/Icon/index.vue +0 -143
  145. package/dist/runtime/plugins/Drawer.mjs +0 -35
  146. package/dist/runtime/utils/gTailwindColor.d.ts +0 -1
  147. package/dist/runtime/utils/gTailwindColor.mjs +0 -5
  148. /package/dist/runtime/{plugins/Drawer.d.ts → middlewares/ResponseGloriousStore.d.ts} +0 -0
  149. /package/dist/runtime/{assets/style → style}/components/dropdown.css +0 -0
  150. /package/dist/runtime/{assets/style → style}/components/editor.css +0 -0
  151. /package/dist/runtime/{assets/style → style}/components/paginate.css +0 -0
@@ -1,26 +1,23 @@
1
1
  <script lang="ts" setup>
2
- import { useGloriousAppSetting } from "../../composables/useGloriousAppSetting";
2
+ import { watch } from '#imports'
3
+ import _props from '../props/Drawer'
4
+ import { createBlurDom, removeBlurDom } from '../helper'
3
5
 
4
- const props = defineProps({
5
- id: {
6
- required: false,
7
- default: "drawer",
8
- type: String,
9
- },
10
- dir: {
11
- require: false,
12
- default: null,
13
- type: String as () => "rtl" | "ltr",
14
- },
15
- });
6
+ const props = defineProps(_props)
7
+ const modelValue = defineModel()
8
+
9
+ watch(
10
+ () => modelValue.value,
11
+ () => {
12
+ if (modelValue.value) createBlurDom(() => (modelValue.value = false))
13
+ else removeBlurDom()
14
+ }
15
+ )
16
16
  </script>
17
17
  <template>
18
18
  <div
19
- :id="props.id"
20
- :class="[
21
- props.dir === null ? useGloriousAppSetting.getSetting().dir : props.dir,
22
- ]"
23
- class="drawer close hidden"
19
+ :class="[props.position, modelValue ? 'open' : 'close']"
20
+ class="glorious-drawer close hidden"
24
21
  >
25
22
  <div class="w-full">
26
23
  <slot></slot>
@@ -28,60 +25,4 @@ const props = defineProps({
28
25
  </div>
29
26
  </template>
30
27
 
31
- <style>
32
- .bg-blur-drawer {
33
- @apply fixed top-0 right-0 backdrop-blur-sm bg-gray-500 bg-opacity-50 h-full w-full z-[40];
34
- }
35
-
36
- .drawer {
37
- @apply fixed top-0 bg-white h-full w-[300px] z-[50];
38
- }
39
- .drawer.close.rtl {
40
- animation: drawer-close-right 250ms normal forwards;
41
- }
42
- .drawer.close.ltr {
43
- animation: drawer-close-left 250ms normal forwards;
44
- }
45
- .drawer.open {
46
- @apply flex;
47
- }
48
- .drawer.open.rtl {
49
- animation: drawer-open-right 100ms normal forwards;
50
- }
51
- .drawer.open.ltr {
52
- animation: drawer-open-left 100ms normal forwards;
53
- }
54
-
55
- @keyframes drawer-open-left {
56
- from {
57
- @apply left-[-300px];
58
- }
59
- to {
60
- @apply left-0;
61
- }
62
- }
63
- @keyframes drawer-open-right {
64
- from {
65
- @apply right-[-300px];
66
- }
67
- to {
68
- @apply right-0;
69
- }
70
- }
71
- @keyframes drawer-close-right {
72
- from {
73
- @apply right-0;
74
- }
75
- to {
76
- @apply right-[-300px] hidden;
77
- }
78
- }
79
- @keyframes drawer-close-left {
80
- from {
81
- @apply left-0;
82
- }
83
- to {
84
- @apply left-[-300px] hidden;
85
- }
86
- }
87
- </style>
28
+ <style lang="scss" src="../../style/components/drawer.scss" />
@@ -1,30 +1,32 @@
1
1
  <script lang="ts" setup>
2
- import { onMounted } from "#imports";
2
+ //SHOULD DEPRICATED
3
+ import { onMounted } from '#imports'
3
4
 
4
5
  const props = defineProps({
5
6
  icon: {
6
7
  required: false,
7
- default: "",
8
+ default: '',
8
9
  type: String,
9
10
  },
10
- });
11
+ })
11
12
 
12
13
  const openDropdown = (event: any) =>
13
- event.currentTarget.parentElement.parentElement.classList.toggle("open");
14
+ event.currentTarget.parentElement.parentElement.classList.toggle('open')
14
15
 
15
16
  onMounted(() => {
16
17
  window.onclick = (event: any) => {
17
- if (!event.target.matches(".glorious-dropdown-button")) {
18
- const allDropdown = document.querySelectorAll(".glorious-dropdown");
18
+ if (!event.target.matches('.glorious-dropdown-button')) {
19
+ const allDropdown = document.querySelectorAll('.glorious-dropdown')
19
20
  allDropdown.forEach((item: any) => {
20
- item.classList.remove("open");
21
- });
21
+ item.classList.remove('open')
22
+ })
22
23
  }
23
- };
24
- });
24
+ }
25
+ })
25
26
  </script>
26
27
  <template>
27
28
  <div class="glorious-dropdown">
29
+ {{ props.icon }}
28
30
  <div>
29
31
  <button
30
32
  aria-label="dots"
@@ -33,7 +35,10 @@ onMounted(() => {
33
35
  >
34
36
  &nbsp;
35
37
  </button>
36
- <GIcon :name="props.icon" color="#000" />
38
+ <GIcon
39
+ :name="props.icon"
40
+ color="#000"
41
+ />
37
42
  </div>
38
43
  <div>
39
44
  <slot />
@@ -41,23 +46,4 @@ onMounted(() => {
41
46
  </div>
42
47
  </template>
43
48
 
44
- <style>
45
- .glorious-dropdown {
46
- @apply relative;
47
- }
48
- .glorious-dropdown > div:last-child {
49
- @apply hidden;
50
- }
51
- .glorious-dropdown > div:first-child {
52
- @apply relative;
53
- }
54
- .glorious-dropdown > div:first-child > button {
55
- @apply z-[30] w-5 relative;
56
- }
57
- .glorious-dropdown > div:first-child > div:nth-child(2) {
58
- @apply absolute top-0 bottom-0 my-auto z-[20];
59
- }
60
- .glorious-dropdown.open > div:last-child {
61
- @apply bg-white px-2 py-2 rounded-md shadow absolute z-[41] left-[16px] top-5 flex;
62
- }
63
- </style>
49
+ <style lang="scss" src="../../style/components/dropdown.scss" />
@@ -1,19 +1,15 @@
1
1
  <script lang="ts" setup>
2
- import { GloriousStore } from "#imports";
3
- const props = defineProps({
4
- error: {
5
- required: false,
6
- default: "|",
7
- type: String,
8
- },
9
- });
10
- const gs = GloriousStore();
11
- const error: any = props.error.split("|");
2
+ import { GloriousStore } from '../../stores/GloriousStore'
3
+ import _props from '../props/ErrorText'
4
+
5
+ const props = defineProps(_props)
6
+ const gs = GloriousStore()
7
+ const error: any = props.error.split('|')
12
8
  </script>
13
9
  <template>
14
10
  <span
15
11
  v-if="gs.forms[error[0]]?.errors[error[1]]"
16
- class="text-red-500 text-[14px]"
12
+ class="validation-error-text text-red-500 text-sm"
17
13
  >
18
14
  {{ gs.forms[error[0]].errors[error[1]][0] }}
19
15
  </span>
@@ -1,66 +1,40 @@
1
1
  <script lang="ts" setup>
2
- const props = defineProps({
3
- modelValue: {
4
- required: true,
5
- type: null,
6
- },
7
- color: {
8
- required: false,
9
- default: "primary",
10
- type: String as () => "orange" | "blue" | "gray" | "red" | "primary",
11
- },
12
- placeholder: {
13
- required: false,
14
- default: "choose file",
15
- type: String,
16
- },
17
- title: {
18
- required: false,
19
- default: "file",
20
- type: String,
21
- },
22
- text: {
23
- required: false,
24
- default: "No file has been selected",
25
- type: String,
26
- },
27
- size: {
28
- required: false,
29
- default: "md",
30
- type: String as () => "xl" | "lg" | "md" | "sm" | "xsm",
31
- },
32
- error: {
33
- required: false,
34
- default: "|",
35
- type: String,
36
- },
37
- });
38
- const emits = defineEmits(["update:modelValue"]);
2
+ import _props from '../props/File'
3
+
4
+ const props: any = defineProps(_props)
5
+ const modelValue = defineModel()
39
6
 
40
7
  const changeInput = (event: any) => {
41
- if (!event.target.files[0]) return;
42
- emits("update:modelValue", event.target.files[0]);
43
- event.target.nextElementSibling.innerText = event.target.files[0].name;
44
- event.target.nextElementSibling.nextElementSibling.style.display = "flex";
45
- };
8
+ if (!event.target.files[0]) return
9
+ modelValue.value = event.target.files[0]
10
+ event.target.nextElementSibling.innerText = event.target.files[0].name
11
+ event.target.nextElementSibling.nextElementSibling.style.display = 'flex'
12
+ }
46
13
  const deleteFile = (event: any) => {
47
- event.currentTarget.style.display = "none";
48
- event.currentTarget.previousElementSibling.innerText = props.text;
49
- emits("update:modelValue", null);
50
- };
14
+ event.currentTarget.style.display = 'none'
15
+ event.currentTarget.previousElementSibling.innerText = props.text
16
+ modelValue.value = null
17
+ }
51
18
  </script>
52
19
  <template>
53
20
  <div class="flex flex-col">
54
- <span class="text-[14px] font-medium text-gray-500">{{ props.title }}</span>
21
+ <span class="text-sm font-medium text-gray-500">{{ props.title }}</span>
55
22
  <label
56
23
  :class="[`glorious-file-${props.color}`]"
57
24
  class="flex items-center gap-3 text-gray-500"
58
25
  >
59
- <div class="placeholder" :class="[props.size]">
26
+ <div
27
+ class="placeholder"
28
+ :class="[`size-${props.size}`]"
29
+ >
60
30
  <span>{{ props.placeholder }}</span>
61
31
  </div>
62
- <input type="file" class="hidden" @change="changeInput($event)" />
63
- <span class="text-[12px]">{{ props.text }}</span>
32
+ <input
33
+ type="file"
34
+ class="hidden"
35
+ @change="changeInput($event)"
36
+ />
37
+ <span class="text-xs">{{ props.text }}</span>
64
38
  <GIcon
65
39
  name="glorious-x"
66
40
  color="#ff0000"
@@ -71,70 +45,4 @@ const deleteFile = (event: any) => {
71
45
  </div>
72
46
  </template>
73
47
 
74
- <style>
75
- .glorious-file-orange > div.xl.placeholder, .glorious-file-blue > div.xl.placeholder, .glorious-file-gray > div.xl.placeholder, .glorious-file-red > div.xl.placeholder, .glorious-file-primary > div.xl.placeholder {
76
- @apply py-2.5;
77
- }
78
- .glorious-file-orange > div.lg.placeholder, .glorious-file-blue > div.lg.placeholder, .glorious-file-gray > div.lg.placeholder, .glorious-file-red > div.lg.placeholder, .glorious-file-primary > div.lg.placeholder {
79
- @apply py-2;
80
- }
81
- .glorious-file-orange > div.md.placeholder, .glorious-file-blue > div.md.placeholder, .glorious-file-gray > div.md.placeholder, .glorious-file-red > div.md.placeholder, .glorious-file-primary > div.md.placeholder {
82
- @apply py-1.5;
83
- }
84
- .glorious-file-orange > div.sm.placeholder, .glorious-file-blue > div.sm.placeholder, .glorious-file-gray > div.sm.placeholder, .glorious-file-red > div.sm.placeholder, .glorious-file-primary > div.sm.placeholder {
85
- @apply py-1;
86
- }
87
- .glorious-file-orange > div.xsm.placeholder, .glorious-file-blue > div.xsm.placeholder, .glorious-file-gray > div.xsm.placeholder, .glorious-file-red > div.xsm.placeholder, .glorious-file-primary > div.xsm.placeholder {
88
- @apply py-0.5;
89
- }
90
-
91
- .glorious-file-primary {
92
- @apply rounded-md ring-1 ring-green-500 overflow-hidden cursor-pointer relative;
93
- }
94
- .glorious-file-primary > div.placeholder {
95
- @apply bg-green-500 text-white px-3 w-max;
96
- }
97
- .glorious-file-primary > div:last-child {
98
- @apply absolute left-3 hidden;
99
- }
100
-
101
- .glorious-file-red {
102
- @apply rounded-md ring-1 ring-red-500 px-3 cursor-pointer relative;
103
- }
104
- .glorious-file-red > div.placeholder {
105
- @apply bg-green-500 text-white px-3 w-max;
106
- }
107
- .glorious-file-red > div:last-child {
108
- @apply absolute left-3;
109
- }
110
-
111
- .glorious-file-gray {
112
- @apply rounded-md ring-1 ring-gray-500 px-3 cursor-pointer relative;
113
- }
114
- .glorious-file-gray > div.placeholder {
115
- @apply bg-green-500 text-white px-3 w-max;
116
- }
117
- .glorious-file-gray > div:last-child {
118
- @apply absolute left-3;
119
- }
120
-
121
- .glorious-file-blue {
122
- @apply rounded-md ring-1 ring-blue-500 px-3 cursor-pointer relative;
123
- }
124
- .glorious-file-blue > div.placeholder {
125
- @apply bg-green-500 text-white px-3 w-max;
126
- }
127
- .glorious-file-blue > div:last-child {
128
- @apply absolute left-3;
129
- }
130
-
131
- .glorious-file-orange {
132
- @apply rounded-md ring-1 ring-orange-500 px-3 cursor-pointer relative;
133
- }
134
- .glorious-file-orange > div.placeholder {
135
- @apply bg-green-500 text-white px-3 w-max;
136
- }
137
- .glorious-file-orange > div:last-child {
138
- @apply absolute left-3;
139
- }
140
- </style>
48
+ <style lang="scss" src="../../style/components/file.scss" />
@@ -0,0 +1,125 @@
1
+ <script lang="ts" setup>
2
+ import { ref, watch } from '#imports'
3
+ import _props from '../props/Icon'
4
+ const props = defineProps(_props)
5
+
6
+ const icon = ref('')
7
+
8
+ const methods = {
9
+ computeProps: (icon: any) => {
10
+ //color
11
+ icon = icon.replaceAll('\n', ' ')
12
+ //stroke
13
+ icon = icon
14
+ .split(' ')
15
+ .map((item: any) =>
16
+ item.includes('stroke="') && typeof props.color !== 'undefined'
17
+ ? 'stroke="' + props.color + '"'
18
+ : item
19
+ )
20
+ .join(' ')
21
+
22
+ //fill
23
+ if (typeof props.color !== 'undefined') {
24
+ icon = icon
25
+ .split(' ')
26
+ .map((item: any) => {
27
+ if (!item.includes('fill="none"')) {
28
+ if (item.includes('fill="') && !item.includes('"/>'))
29
+ return `fill="${props.color}"`
30
+ else if (item.includes('fill="') && item.includes('"/>'))
31
+ return `fill="${props.color}"/>`
32
+ else return item
33
+ } else return item
34
+ })
35
+ .join(' ')
36
+ }
37
+
38
+ //size
39
+ icon = icon.replaceAll('\n', ' ')
40
+
41
+ //width
42
+ icon = icon
43
+ .split(' ')
44
+ .map((item: any) =>
45
+ item.includes('width="') &&
46
+ !item.includes('stroke-width') &&
47
+ typeof props.size !== 'undefined'
48
+ ? 'width="' + props.size + '"'
49
+ : item
50
+ )
51
+ .join(' ')
52
+
53
+ icon = icon
54
+ .split(' ')
55
+ .map((item: any) =>
56
+ item.includes('height="') && typeof props.size !== 'undefined'
57
+ ? 'height="' + props.size + '"'
58
+ : item
59
+ )
60
+ .join(' ')
61
+
62
+ //stroke
63
+ if (props.stroke !== null) {
64
+ icon = icon.replaceAll('\n', ' ')
65
+ icon = icon
66
+ .split(' ')
67
+ .map((item: any) =>
68
+ item.includes('stroke-width') && typeof props.stroke !== 'undefined'
69
+ ? 'stroke-width="' + props.stroke + '"'
70
+ : item
71
+ )
72
+ .join(' ')
73
+ }
74
+
75
+ return icon
76
+ },
77
+ }
78
+
79
+ async function getIcon() {
80
+ try {
81
+ const iconsImport = import.meta.glob('assets/icons/**/**.svg', {
82
+ query: '?raw',
83
+ eager: false,
84
+ })
85
+
86
+ let rawIcon = ''
87
+ if (typeof iconsImport[`/assets/icons/${props.name}.svg`] !== 'undefined') {
88
+ const icon: any = await iconsImport[`/assets/icons/${props.name}.svg`]()
89
+ rawIcon = icon.default
90
+ } else {
91
+ const staticAssets = import.meta.glob('../../assets/icons/**/**.svg', {
92
+ query: '?raw',
93
+ eager: false,
94
+ })
95
+
96
+ const icon: any = await staticAssets[
97
+ `../../assets/icons/${props.name}.svg`
98
+ ]()
99
+ rawIcon = icon.default
100
+ }
101
+
102
+ icon.value = methods.computeProps(rawIcon)
103
+ } catch (e) {
104
+ console.error(
105
+ `glorious error -> Icon '${props.name}' doesn't exist in 'assets/icons'`
106
+ )
107
+ }
108
+ }
109
+
110
+ await getIcon()
111
+
112
+ watch(
113
+ () => props,
114
+ () => getIcon(),
115
+ {
116
+ deep: true,
117
+ }
118
+ )
119
+ </script>
120
+ <template>
121
+ <div
122
+ class="w-max h-max"
123
+ v-html="icon"
124
+ />
125
+ </template>