nuxt-glorious 1.2.3-9 → 1.2.4
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/module.d.mts +38 -1
- package/dist/module.d.ts +38 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +37 -33
- package/dist/runtime/assets/style/components/alert.css +20 -5
- package/dist/runtime/assets/style/components/avatar.css +21 -18
- package/dist/runtime/assets/style/components/button.css +198 -0
- package/dist/runtime/assets/style/components/checkbox.css +24 -24
- package/dist/runtime/assets/style/components/drawer.css +14 -18
- package/dist/runtime/assets/style/components/file.css +102 -33
- package/dist/runtime/assets/style/components/input.css +103 -23
- package/dist/runtime/assets/style/components/loading.css +43 -0
- package/dist/runtime/assets/style/components/radio.css +27 -27
- package/dist/runtime/assets/style/components/select.css +24 -19
- package/dist/runtime/assets/style/components/textarea.css +35 -35
- package/dist/runtime/assets/style/mixin.css +0 -0
- package/dist/runtime/components/G/Alert.vue +8 -28
- package/dist/runtime/components/G/Avatar.vue +5 -73
- package/dist/runtime/components/G/Breadcrumb.vue +7 -25
- package/dist/runtime/components/G/Button.vue +10 -152
- package/dist/runtime/components/G/Checkbox.vue +8 -124
- package/dist/runtime/components/G/CountDown.vue +33 -44
- package/dist/runtime/components/G/Drawer.vue +12 -101
- package/dist/runtime/components/G/Dropdown.vue +16 -11
- package/dist/runtime/components/G/ErrorText.vue +6 -11
- package/dist/runtime/components/G/File.vue +25 -117
- package/dist/runtime/components/G/Icon.vue +125 -0
- package/dist/runtime/components/G/Input.vue +28 -229
- package/dist/runtime/components/G/Loading.vue +4 -21
- package/dist/runtime/components/G/Modal.vue +13 -145
- package/dist/runtime/components/G/Paginate.vue +8 -44
- package/dist/runtime/components/G/Radio.vue +12 -163
- package/dist/runtime/components/G/Rating.vue +3 -30
- package/dist/runtime/components/G/Select.vue +7 -110
- package/dist/runtime/components/G/Switch.vue +5 -82
- package/dist/runtime/components/G/Tab.vue +6 -30
- package/dist/runtime/components/G/Table.vue +11 -131
- package/dist/runtime/components/G/textarea.vue +14 -119
- package/dist/runtime/components/G/timeline.vue +3 -59
- package/dist/runtime/components/helper.d.ts +2 -0
- package/dist/runtime/components/helper.mjs +25 -0
- package/dist/runtime/components/props/Alert.d.ts +8 -0
- package/dist/runtime/components/props/Alert.mjs +4 -0
- package/dist/runtime/components/props/Avatar.d.ts +12 -0
- package/dist/runtime/components/props/Avatar.mjs +9 -0
- package/dist/runtime/components/props/Breadcrumb.d.ts +26 -0
- package/dist/runtime/components/props/Breadcrumb.mjs +11 -0
- package/dist/runtime/components/props/Button.d.ts +47 -0
- package/dist/runtime/components/props/Button.mjs +14 -0
- package/dist/runtime/components/props/CheckBox.d.ts +23 -0
- package/dist/runtime/components/props/CheckBox.mjs +7 -0
- package/dist/runtime/components/props/CountDown.d.ts +7 -0
- package/dist/runtime/components/props/CountDown.mjs +6 -0
- package/dist/runtime/components/props/Drawer.d.ts +8 -0
- package/dist/runtime/components/props/Drawer.mjs +7 -0
- package/dist/runtime/components/props/ErrorText.d.ts +8 -0
- package/dist/runtime/components/props/ErrorText.mjs +4 -0
- package/dist/runtime/components/props/File.d.ts +28 -0
- package/dist/runtime/components/props/File.mjs +9 -0
- package/dist/runtime/components/props/Icon.d.ts +23 -0
- package/dist/runtime/components/props/Icon.mjs +7 -0
- package/dist/runtime/components/props/Input.d.ts +91 -0
- package/dist/runtime/components/props/Input.mjs +50 -0
- package/dist/runtime/components/props/Loading.d.ts +18 -0
- package/dist/runtime/components/props/Loading.mjs +6 -0
- package/dist/runtime/components/props/Modal.d.ts +48 -0
- package/dist/runtime/components/props/Modal.mjs +38 -0
- package/dist/runtime/components/props/Paginate.d.ts +18 -0
- package/dist/runtime/components/props/Paginate.mjs +17 -0
- package/dist/runtime/components/props/Radio.d.ts +33 -0
- package/dist/runtime/components/props/Radio.mjs +9 -0
- package/dist/runtime/components/props/Select.d.ts +61 -0
- package/dist/runtime/components/props/Select.mjs +23 -0
- package/dist/runtime/components/props/Switch.d.ts +13 -0
- package/dist/runtime/components/props/Switch.mjs +5 -0
- package/dist/runtime/components/props/Tab.d.ts +21 -0
- package/dist/runtime/components/props/Tab.mjs +7 -0
- package/dist/runtime/components/props/Table.d.ts +49 -0
- package/dist/runtime/components/props/Table.mjs +19 -0
- package/dist/runtime/components/props/Textarea.d.ts +38 -0
- package/dist/runtime/components/props/Textarea.mjs +14 -0
- package/dist/runtime/components/props/Timeline.d.ts +11 -0
- package/dist/runtime/components/props/Timeline.mjs +7 -0
- package/dist/runtime/components/props/common/index.d.ts +161 -0
- package/dist/runtime/components/props/common/index.mjs +147 -0
- package/dist/runtime/composables/useGloriousCore.d.ts +1 -1
- package/dist/runtime/composables/useGloriousCore.mjs +1 -1
- package/dist/runtime/composables/useGloriousFetch.mjs +0 -1
- package/dist/runtime/middlewares/AuthStrategy.mjs +1 -5
- package/dist/runtime/stores/GloriousStore.d.ts +0 -2
- package/dist/runtime/stores/GloriousStore.mjs +0 -20
- package/dist/types.d.mts +2 -10
- package/dist/types.d.ts +2 -10
- package/package.json +1 -1
- package/dist/runtime/assets/style/components/buttons.css +0 -107
- package/dist/runtime/components/G/BottomNavigation.vue +0 -3
- package/dist/runtime/components/G/Icon/index.vue +0 -143
@@ -1,56 +1,23 @@
|
|
1
1
|
<script lang="ts" setup>
|
2
|
-
import {
|
3
|
-
import
|
2
|
+
import { watch } from '#imports'
|
3
|
+
import _props from '../props/Drawer'
|
4
|
+
import { createBlurDom, removeBlurDom } from '../helper'
|
4
5
|
|
5
|
-
const props = defineProps(
|
6
|
-
|
7
|
-
required: true,
|
8
|
-
default: false,
|
9
|
-
type: Boolean,
|
10
|
-
},
|
11
|
-
dir: {
|
12
|
-
require: false,
|
13
|
-
default: null,
|
14
|
-
type: String as () => "rtl" | "ltr",
|
15
|
-
},
|
16
|
-
});
|
17
|
-
|
18
|
-
const emits = defineEmits(["update:modelValue"]);
|
19
|
-
|
20
|
-
const addBlurBackground = (): void => {
|
21
|
-
const backgroundBlur = document.createElement("div");
|
22
|
-
backgroundBlur.classList.add("glorious-scaffold-drawer-bg-blur");
|
23
|
-
const nuxt: any = document.getElementById("__nuxt");
|
24
|
-
nuxt.appendChild(backgroundBlur);
|
25
|
-
backgroundBlur.addEventListener("click", () => {
|
26
|
-
console.log("here");
|
27
|
-
|
28
|
-
emits("update:modelValue", false);
|
29
|
-
backgroundBlur.remove();
|
30
|
-
});
|
31
|
-
};
|
6
|
+
const props = defineProps(_props)
|
7
|
+
const modelValue = defineModel()
|
32
8
|
|
33
9
|
watch(
|
34
|
-
() =>
|
10
|
+
() => modelValue.value,
|
35
11
|
() => {
|
36
|
-
if (
|
37
|
-
|
38
|
-
} else {
|
39
|
-
const blur: any = document.querySelector(
|
40
|
-
".glorious-scaffold-drawer-bg-blur"
|
41
|
-
);
|
42
|
-
if (blur !== null) blur.remove();
|
43
|
-
}
|
12
|
+
if (modelValue.value) createBlurDom(() => (modelValue.value = false))
|
13
|
+
else removeBlurDom()
|
44
14
|
}
|
45
|
-
)
|
15
|
+
)
|
46
16
|
</script>
|
47
17
|
<template>
|
48
18
|
<div
|
49
|
-
:class="[
|
50
|
-
|
51
|
-
props.modelValue ? 'open' : 'close',
|
52
|
-
]"
|
53
|
-
class="drawer close hidden"
|
19
|
+
:class="[props.position, modelValue ? 'open' : 'close']"
|
20
|
+
class="glorious-drawer close hidden"
|
54
21
|
>
|
55
22
|
<div class="w-full">
|
56
23
|
<slot></slot>
|
@@ -58,60 +25,4 @@ watch(
|
|
58
25
|
</div>
|
59
26
|
</template>
|
60
27
|
|
61
|
-
<style
|
62
|
-
.glorious-scaffold-drawer-bg-blur {
|
63
|
-
@apply fixed top-0 right-0 backdrop-blur-sm bg-gray-500 bg-opacity-50 h-full w-full z-[40];
|
64
|
-
}
|
65
|
-
|
66
|
-
.drawer {
|
67
|
-
@apply fixed top-0 bg-white h-full w-[300px] z-[50];
|
68
|
-
}
|
69
|
-
.drawer.close.rtl {
|
70
|
-
animation: drawer-close-right 250ms normal forwards;
|
71
|
-
}
|
72
|
-
.drawer.close.ltr {
|
73
|
-
animation: drawer-close-left 250ms normal forwards;
|
74
|
-
}
|
75
|
-
.drawer.open {
|
76
|
-
@apply flex;
|
77
|
-
}
|
78
|
-
.drawer.open.rtl {
|
79
|
-
animation: drawer-open-right 100ms normal forwards;
|
80
|
-
}
|
81
|
-
.drawer.open.ltr {
|
82
|
-
animation: drawer-open-left 100ms normal forwards;
|
83
|
-
}
|
84
|
-
|
85
|
-
@keyframes drawer-open-left {
|
86
|
-
from {
|
87
|
-
@apply left-[-300px];
|
88
|
-
}
|
89
|
-
to {
|
90
|
-
@apply left-0;
|
91
|
-
}
|
92
|
-
}
|
93
|
-
@keyframes drawer-open-right {
|
94
|
-
from {
|
95
|
-
@apply right-[-300px];
|
96
|
-
}
|
97
|
-
to {
|
98
|
-
@apply right-0;
|
99
|
-
}
|
100
|
-
}
|
101
|
-
@keyframes drawer-close-right {
|
102
|
-
from {
|
103
|
-
@apply right-0;
|
104
|
-
}
|
105
|
-
to {
|
106
|
-
@apply right-[-300px] hidden;
|
107
|
-
}
|
108
|
-
}
|
109
|
-
@keyframes drawer-close-left {
|
110
|
-
from {
|
111
|
-
@apply left-0;
|
112
|
-
}
|
113
|
-
to {
|
114
|
-
@apply left-[-300px] hidden;
|
115
|
-
}
|
116
|
-
}
|
117
|
-
</style>
|
28
|
+
<style lang="scss" src="../../assets/style/components/drawer.scss" />
|
@@ -1,30 +1,32 @@
|
|
1
1
|
<script lang="ts" setup>
|
2
|
-
|
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(
|
14
|
+
event.currentTarget.parentElement.parentElement.classList.toggle('open')
|
14
15
|
|
15
16
|
onMounted(() => {
|
16
17
|
window.onclick = (event: any) => {
|
17
|
-
if (!event.target.matches(
|
18
|
-
const allDropdown = document.querySelectorAll(
|
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(
|
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
|
|
35
37
|
</button>
|
36
|
-
<GIcon
|
38
|
+
<GIcon
|
39
|
+
:name="props.icon"
|
40
|
+
color="#000"
|
41
|
+
/>
|
37
42
|
</div>
|
38
43
|
<div>
|
39
44
|
<slot />
|
@@ -1,20 +1,15 @@
|
|
1
1
|
<script lang="ts" setup>
|
2
|
-
import { GloriousStore } from
|
2
|
+
import { GloriousStore } from '../../stores/GloriousStore'
|
3
|
+
import _props from '../props/ErrorText'
|
3
4
|
|
4
|
-
const props = defineProps(
|
5
|
-
|
6
|
-
|
7
|
-
default: "|",
|
8
|
-
type: String,
|
9
|
-
},
|
10
|
-
});
|
11
|
-
const gs = GloriousStore();
|
12
|
-
const error: any = props.error.split("|");
|
5
|
+
const props = defineProps(_props)
|
6
|
+
const gs = GloriousStore()
|
7
|
+
const error: any = props.error.split('|')
|
13
8
|
</script>
|
14
9
|
<template>
|
15
10
|
<span
|
16
11
|
v-if="gs.forms[error[0]]?.errors[error[1]]"
|
17
|
-
class="text-red-500 text-
|
12
|
+
class="text-red-500 text-sm"
|
18
13
|
>
|
19
14
|
{{ gs.forms[error[0]].errors[error[1]][0] }}
|
20
15
|
</span>
|
@@ -1,66 +1,40 @@
|
|
1
1
|
<script lang="ts" setup>
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
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
|
-
|
43
|
-
event.target.nextElementSibling.innerText = event.target.files[0].name
|
44
|
-
event.target.nextElementSibling.nextElementSibling.style.display =
|
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 =
|
48
|
-
event.currentTarget.previousElementSibling.innerText = props.text
|
49
|
-
|
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-
|
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
|
26
|
+
<div
|
27
|
+
class="placeholder"
|
28
|
+
:class="[`size-${props.size}`]"
|
29
|
+
>
|
60
30
|
<span>{{ props.placeholder }}</span>
|
61
31
|
</div>
|
62
|
-
<input
|
63
|
-
|
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="../../assets/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>
|