nuxt-glorious 1.2.3-2 → 1.2.3-4
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.
Potentially problematic release.
This version of nuxt-glorious might be problematic. Click here for more details.
- package/dist/module.json +1 -1
- package/dist/module.mjs +5 -0
- package/dist/runtime/assets/icons/glorious-star-fill.svg +3 -0
- package/dist/runtime/assets/icons/glorious-star-half.svg +3 -0
- package/dist/runtime/assets/icons/glorious-star-line.svg +3 -0
- package/dist/runtime/assets/style/components/modal.css +4 -4
- package/dist/runtime/assets/style/components/rating.css +26 -0
- package/dist/runtime/assets/style/components/switch.css +18 -9
- package/dist/runtime/assets/style/components/tab.css +3 -3
- package/dist/runtime/assets/style/components/timeline.css +47 -0
- package/dist/runtime/components/G/Modal.vue +64 -40
- package/dist/runtime/components/G/Paginate.vue +22 -19
- package/dist/runtime/components/G/Rating.vue +57 -0
- package/dist/runtime/components/G/Switch.vue +27 -10
- package/dist/runtime/components/G/Tab.vue +84 -24
- package/dist/runtime/components/G/timeline.vue +84 -0
- package/dist/runtime/composables/useGloriousFetch.d.ts +4 -3
- package/dist/runtime/composables/useGloriousFetch.mjs +6 -2
- package/dist/runtime/middlewares/ResponseGloriousStore.d.ts +2 -0
- package/dist/runtime/middlewares/ResponseGloriousStore.mjs +8 -0
- package/dist/runtime/stores/GloriousStore.mjs +3 -1
- package/package.json +1 -1
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
@@ -76,6 +76,11 @@ const module = defineNuxtModule({
|
|
76
76
|
path: resolver.resolve("./runtime/middlewares/AuthStrategy"),
|
77
77
|
global: true
|
78
78
|
});
|
79
|
+
addRouteMiddleware({
|
80
|
+
name: "response-glorious-store",
|
81
|
+
path: resolver.resolve("./runtime/middlewares/ResponseGloriousStore"),
|
82
|
+
global: true
|
83
|
+
});
|
79
84
|
addRouteMiddleware({
|
80
85
|
name: "g-auth",
|
81
86
|
path: resolver.resolve("./runtime/middlewares/Auth")
|
@@ -0,0 +1,3 @@
|
|
1
|
+
<svg width="20" height="19" viewBox="0 0 20 19" fill="none" xmlns="http://www.w3.org/2000/svg">
|
2
|
+
<path d="M9.99999 12.656L12.817 14.376L12.051 11.166L14.558 9.019L11.268 8.755L9.99999 5.708V12.656ZM9.99999 15L4.12199 18.59L5.71999 11.89L0.48999 7.41L7.35499 6.86L9.99999 0.5L12.645 6.86L19.511 7.41L14.28 11.89L15.878 18.59L9.99999 15Z" fill="black"/>
|
3
|
+
</svg>
|
@@ -0,0 +1,3 @@
|
|
1
|
+
<svg width="24" height="23" viewBox="0 0 24 23" fill="none" xmlns="http://www.w3.org/2000/svg">
|
2
|
+
<path d="M11.9999 18.26L4.94691 22.208L6.52191 14.28L0.586914 8.792L8.61391 7.84L11.9999 0.5L15.3859 7.84L23.4129 8.792L17.4779 14.28L19.0529 22.208L11.9999 18.26ZM11.9999 15.968L16.2469 18.345L15.2979 13.572L18.8709 10.267L14.0379 9.694L11.9999 5.275L9.96191 9.695L5.12891 10.267L8.70191 13.572L7.75291 18.345L11.9999 15.968Z" fill="black"/>
|
3
|
+
</svg>
|
@@ -17,16 +17,16 @@
|
|
17
17
|
@apply w-full h-full top-0 rounded-none;
|
18
18
|
}
|
19
19
|
.glorious-scaffold-modal.size-xl {
|
20
|
-
@apply md:w-[70%] w-full md:h-max max-h-[
|
20
|
+
@apply md:w-[70%] w-full md:h-max max-h-[calc(100%-15%)];
|
21
21
|
}
|
22
22
|
.glorious-scaffold-modal.size-lg {
|
23
|
-
@apply md:w-[60%] w-full md:h-max max-h-[
|
23
|
+
@apply md:w-[60%] w-full md:h-max max-h-[calc(100%-15%)];
|
24
24
|
}
|
25
25
|
.glorious-scaffold-modal.size-md {
|
26
|
-
@apply md:w-[50%] w-full md:h-max max-h-[
|
26
|
+
@apply md:w-[50%] w-full md:h-max max-h-[calc(100%-15%)];
|
27
27
|
}
|
28
28
|
.glorious-scaffold-modal.size-sm {
|
29
|
-
@apply lg:w-[25%] md:w-[35%] w-full md:h-max max-h-[
|
29
|
+
@apply lg:w-[25%] md:w-[35%] w-full md:h-max max-h-[calc(100%-15%)];
|
30
30
|
}
|
31
31
|
.glorious-scaffold-modal.close {
|
32
32
|
@apply hidden;
|
@@ -0,0 +1,26 @@
|
|
1
|
+
@charset "UTF-8";
|
2
|
+
.rating {
|
3
|
+
display: inline-block;
|
4
|
+
}
|
5
|
+
|
6
|
+
.rating input {
|
7
|
+
display: none;
|
8
|
+
}
|
9
|
+
|
10
|
+
.rating label {
|
11
|
+
float: right;
|
12
|
+
cursor: pointer;
|
13
|
+
transition: color 0.3s;
|
14
|
+
}
|
15
|
+
|
16
|
+
.rating label:before {
|
17
|
+
content: "★";
|
18
|
+
font-size: 30px;
|
19
|
+
}
|
20
|
+
|
21
|
+
.rating input:checked ~ label,
|
22
|
+
.rating label:hover,
|
23
|
+
.rating label:hover ~ label {
|
24
|
+
color: #ffd700;
|
25
|
+
transition: color 0.3s;
|
26
|
+
}
|
@@ -1,22 +1,19 @@
|
|
1
|
-
/* From Uiverse.io by namecho */
|
2
1
|
.switch {
|
3
2
|
direction: ltr;
|
4
|
-
--button-width:
|
5
|
-
--button-height:
|
6
|
-
--toggle-diameter:
|
3
|
+
--button-width: 3em;
|
4
|
+
--button-height: 1.5em;
|
5
|
+
--toggle-diameter: 1em;
|
7
6
|
--button-toggle-offset: calc(
|
8
7
|
(var(--button-height) - var(--toggle-diameter)) / 2
|
9
8
|
);
|
10
9
|
--toggle-shadow-offset: 10px;
|
11
10
|
--toggle-wider: 3em;
|
12
|
-
--color-grey: #cccccc;
|
13
|
-
--color-green: #4296f4;
|
14
11
|
}
|
15
12
|
.switch-slider {
|
13
|
+
@apply bg-gray-300;
|
16
14
|
display: inline-block;
|
17
15
|
width: var(--button-width);
|
18
16
|
height: var(--button-height);
|
19
|
-
background-color: var(--color-grey);
|
20
17
|
border-radius: calc(var(--button-height) / 2);
|
21
18
|
position: relative;
|
22
19
|
transition: 0.3s all ease-in-out;
|
@@ -34,8 +31,20 @@
|
|
34
31
|
box-shadow: var(--toggle-shadow-offset) 0 calc(var(--toggle-shadow-offset) * 4) rgba(0, 0, 0, 0.1);
|
35
32
|
transition: 0.3s all ease-in-out;
|
36
33
|
}
|
37
|
-
.switch input[type=checkbox]:checked + .switch-slider {
|
38
|
-
background-color:
|
34
|
+
.switch.color-orange input[type=checkbox]:checked + .switch-slider {
|
35
|
+
background-color: theme("colors.orange.500");
|
36
|
+
}
|
37
|
+
.switch.color-blue input[type=checkbox]:checked + .switch-slider {
|
38
|
+
background-color: theme("colors.blue.500");
|
39
|
+
}
|
40
|
+
.switch.color-gray input[type=checkbox]:checked + .switch-slider {
|
41
|
+
background-color: theme("colors.gray.500");
|
42
|
+
}
|
43
|
+
.switch.color-red input[type=checkbox]:checked + .switch-slider {
|
44
|
+
background-color: theme("colors.red.500");
|
45
|
+
}
|
46
|
+
.switch.color-green input[type=checkbox]:checked + .switch-slider {
|
47
|
+
background-color: theme("colors.green.500");
|
39
48
|
}
|
40
49
|
.switch input[type=checkbox]:checked + .switch-slider::after {
|
41
50
|
transform: translateX(calc(var(--button-width) - var(--toggle-diameter) - var(--button-toggle-offset)));
|
@@ -1,9 +1,9 @@
|
|
1
1
|
.glorious-tab {
|
2
|
-
@apply flex justify-between bg-green-100
|
2
|
+
@apply flex justify-between bg-green-100 rounded-lg gap-3 w-max max-w-full shadow-md;
|
3
3
|
}
|
4
|
-
.glorious-tab > div > button {
|
4
|
+
.glorious-tab div > div > button {
|
5
5
|
@apply text-gray-700 text-[14px] hover:bg-green-200 hover:text-gray-800 cursor-pointer px-2 py-1 rounded-lg;
|
6
6
|
}
|
7
|
-
.glorious-tab > div > button.active {
|
7
|
+
.glorious-tab div > div > button.active {
|
8
8
|
@apply font-bold text-white bg-green-700;
|
9
9
|
}
|
@@ -0,0 +1,47 @@
|
|
1
|
+
.glorious-timeline-items {
|
2
|
+
@apply relative;
|
3
|
+
}
|
4
|
+
.glorious-timeline-items div {
|
5
|
+
@apply relative;
|
6
|
+
}
|
7
|
+
.glorious-timeline-items div::before {
|
8
|
+
content: "";
|
9
|
+
@apply absolute w-[2px] right-[-15px];
|
10
|
+
}
|
11
|
+
.glorious-timeline-items div::before:not(:last-child) {
|
12
|
+
@apply h-[calc(100%+20px)];
|
13
|
+
}
|
14
|
+
.glorious-timeline-items-count {
|
15
|
+
@apply absolute w-5 h-5 top-0 right-[-24px] rounded-full !important;
|
16
|
+
@apply text-white flex justify-center items-center font-medium;
|
17
|
+
}
|
18
|
+
.glorious-timeline-items.color-orange > div::before {
|
19
|
+
@apply bg-orange-500;
|
20
|
+
}
|
21
|
+
.glorious-timeline-items.color-blue > div::before {
|
22
|
+
@apply bg-blue-500;
|
23
|
+
}
|
24
|
+
.glorious-timeline-items.color-gray > div::before {
|
25
|
+
@apply bg-gray-500;
|
26
|
+
}
|
27
|
+
.glorious-timeline-items.color-red > div::before {
|
28
|
+
@apply bg-red-500;
|
29
|
+
}
|
30
|
+
.glorious-timeline-items.color-green > div::before {
|
31
|
+
@apply bg-green-500;
|
32
|
+
}
|
33
|
+
.glorious-timeline-items.color-orange .glorious-timeline-items-count {
|
34
|
+
@apply bg-orange-500;
|
35
|
+
}
|
36
|
+
.glorious-timeline-items.color-blue .glorious-timeline-items-count {
|
37
|
+
@apply bg-blue-500;
|
38
|
+
}
|
39
|
+
.glorious-timeline-items.color-gray .glorious-timeline-items-count {
|
40
|
+
@apply bg-gray-500;
|
41
|
+
}
|
42
|
+
.glorious-timeline-items.color-red .glorious-timeline-items-count {
|
43
|
+
@apply bg-red-500;
|
44
|
+
}
|
45
|
+
.glorious-timeline-items.color-green .glorious-timeline-items-count {
|
46
|
+
@apply bg-green-500;
|
47
|
+
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<script lang="ts" setup>
|
2
|
-
import { watch } from
|
3
|
-
|
2
|
+
import { watch } from '#imports'
|
3
|
+
|
4
4
|
const props = defineProps({
|
5
5
|
modelValue: {
|
6
6
|
required: true,
|
@@ -9,17 +9,17 @@ const props = defineProps({
|
|
9
9
|
},
|
10
10
|
size: {
|
11
11
|
required: false,
|
12
|
-
default:
|
13
|
-
type: String as () =>
|
12
|
+
default: 'md',
|
13
|
+
type: String as () => 'xl' | 'lg' | 'md' | 'sm' | 'full',
|
14
14
|
},
|
15
15
|
title: {
|
16
16
|
required: false,
|
17
|
-
default:
|
17
|
+
default: '',
|
18
18
|
type: String,
|
19
19
|
},
|
20
20
|
okBtn: {
|
21
21
|
required: false,
|
22
|
-
default:
|
22
|
+
default: '',
|
23
23
|
type: String,
|
24
24
|
},
|
25
25
|
okBtnLoading: {
|
@@ -29,13 +29,13 @@ const props = defineProps({
|
|
29
29
|
},
|
30
30
|
closeBtn: {
|
31
31
|
required: false,
|
32
|
-
default:
|
32
|
+
default: '',
|
33
33
|
type: String,
|
34
34
|
},
|
35
35
|
rtl: {
|
36
36
|
required: false,
|
37
|
-
default:
|
38
|
-
type: String as () =>
|
37
|
+
default: 'rtl',
|
38
|
+
type: String as () => 'rtl' | 'ltr',
|
39
39
|
},
|
40
40
|
blur: {
|
41
41
|
required: false,
|
@@ -47,45 +47,50 @@ const props = defineProps({
|
|
47
47
|
default: true,
|
48
48
|
type: Boolean,
|
49
49
|
},
|
50
|
-
|
50
|
+
colorBtn: {
|
51
|
+
required: false,
|
52
|
+
default: 'primary',
|
53
|
+
type: String as () => 'orange' | 'blue' | 'gray' | 'red' | 'primary',
|
54
|
+
},
|
55
|
+
})
|
51
56
|
|
52
|
-
const emits = defineEmits([
|
57
|
+
const emits = defineEmits(['ok', 'close', 'update:modelValue'])
|
53
58
|
|
54
59
|
const addBlurBackground = (): void => {
|
55
|
-
const backgroundBlur = document.createElement(
|
56
|
-
backgroundBlur.classList.add(
|
57
|
-
const nuxt: any = document.getElementById(
|
58
|
-
nuxt.appendChild(backgroundBlur)
|
59
|
-
backgroundBlur.addEventListener(
|
60
|
+
const backgroundBlur = document.createElement('div')
|
61
|
+
backgroundBlur.classList.add('glorious-scaffold-modal-bg-blur')
|
62
|
+
const nuxt: any = document.getElementById('__nuxt')
|
63
|
+
nuxt.appendChild(backgroundBlur)
|
64
|
+
backgroundBlur.addEventListener('click', () => {
|
60
65
|
if (props.blurClose) {
|
61
|
-
emits(
|
62
|
-
backgroundBlur.remove()
|
66
|
+
emits('update:modelValue', false)
|
67
|
+
backgroundBlur.remove()
|
63
68
|
}
|
64
|
-
})
|
65
|
-
}
|
69
|
+
})
|
70
|
+
}
|
66
71
|
|
67
72
|
watch(
|
68
73
|
() => props.modelValue,
|
69
74
|
() => {
|
70
|
-
const modals = document.querySelectorAll(
|
75
|
+
const modals = document.querySelectorAll('.glorious-scaffold-modal')
|
71
76
|
if (props.modelValue && props.blur) {
|
72
|
-
addBlurBackground()
|
77
|
+
addBlurBackground()
|
73
78
|
setTimeout(() => {
|
74
79
|
modals.forEach((el: any) => {
|
75
|
-
el.classList.remove(
|
76
|
-
})
|
77
|
-
}, 500)
|
80
|
+
el.classList.remove('animation')
|
81
|
+
})
|
82
|
+
}, 500)
|
78
83
|
} else {
|
79
84
|
const blur: any = document.querySelector(
|
80
|
-
|
81
|
-
)
|
85
|
+
'.glorious-scaffold-modal-bg-blur'
|
86
|
+
)
|
82
87
|
modals.forEach((el: any) => {
|
83
|
-
el.classList.add(
|
84
|
-
})
|
85
|
-
if (blur !== null) blur.remove()
|
88
|
+
el.classList.add('animation')
|
89
|
+
})
|
90
|
+
if (blur !== null) blur.remove()
|
86
91
|
}
|
87
92
|
}
|
88
|
-
)
|
93
|
+
)
|
89
94
|
</script>
|
90
95
|
|
91
96
|
<template>
|
@@ -94,7 +99,10 @@ watch(
|
|
94
99
|
:class="[props.modelValue ? 'open' : 'close', `size-${props.size}`]"
|
95
100
|
>
|
96
101
|
<!-- header -->
|
97
|
-
<div
|
102
|
+
<div
|
103
|
+
v-show="props?.title !== ''"
|
104
|
+
class="glorious-scaffold-modal-header"
|
105
|
+
>
|
98
106
|
<span class="font-medium">{{ props.title }}</span>
|
99
107
|
<GButton
|
100
108
|
class="flex justify-center items-center w-6 h-6"
|
@@ -102,10 +110,17 @@ watch(
|
|
102
110
|
color="red"
|
103
111
|
@click="emits('update:modelValue', false)"
|
104
112
|
>
|
105
|
-
<GIcon
|
113
|
+
<GIcon
|
114
|
+
name="glorious-x"
|
115
|
+
color="#fff"
|
116
|
+
:size="10"
|
117
|
+
/>
|
106
118
|
</GButton>
|
107
119
|
</div>
|
108
|
-
<hr
|
120
|
+
<hr
|
121
|
+
v-show="props.title !== ''"
|
122
|
+
class="my-3"
|
123
|
+
/>
|
109
124
|
<!-- end header -->
|
110
125
|
|
111
126
|
<div class="glorious-scaffold-modal-content">
|
@@ -113,12 +128,21 @@ watch(
|
|
113
128
|
</div>
|
114
129
|
|
115
130
|
<!-- start footer -->
|
116
|
-
<div
|
117
|
-
|
131
|
+
<div
|
132
|
+
v-show="props.okBtn !== ''"
|
133
|
+
class="glorious-scaffold-modal-footer"
|
134
|
+
>
|
135
|
+
<GButton
|
136
|
+
:color="props.colorBtn"
|
137
|
+
:loading="props.okBtnLoading"
|
138
|
+
@click="emits('ok')"
|
139
|
+
>
|
118
140
|
{{ props.okBtn }}
|
119
141
|
</GButton>
|
120
142
|
<GButton
|
143
|
+
:color="props.colorBtn"
|
121
144
|
v-show="props.closeBtn !== ''"
|
145
|
+
outline
|
122
146
|
@click="emits('update:modelValue', false)"
|
123
147
|
>
|
124
148
|
{{ props.closeBtn }}
|
@@ -148,16 +172,16 @@ watch(
|
|
148
172
|
@apply w-full h-full top-0 rounded-none;
|
149
173
|
}
|
150
174
|
.glorious-scaffold-modal.size-xl {
|
151
|
-
@apply md:w-[70%] w-full md:h-max max-h-[
|
175
|
+
@apply md:w-[70%] w-full md:h-max max-h-[calc(100%-15%)];
|
152
176
|
}
|
153
177
|
.glorious-scaffold-modal.size-lg {
|
154
|
-
@apply md:w-[60%] w-full md:h-max max-h-[
|
178
|
+
@apply md:w-[60%] w-full md:h-max max-h-[calc(100%-15%)];
|
155
179
|
}
|
156
180
|
.glorious-scaffold-modal.size-md {
|
157
|
-
@apply md:w-[50%] w-full md:h-max max-h-[
|
181
|
+
@apply md:w-[50%] w-full md:h-max max-h-[calc(100%-15%)];
|
158
182
|
}
|
159
183
|
.glorious-scaffold-modal.size-sm {
|
160
|
-
@apply lg:w-[25%] md:w-[35%] w-full md:h-max max-h-[
|
184
|
+
@apply lg:w-[25%] md:w-[35%] w-full md:h-max max-h-[calc(100%-15%)];
|
161
185
|
}
|
162
186
|
.glorious-scaffold-modal.close {
|
163
187
|
@apply hidden;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<script lang="ts" setup>
|
2
|
-
import { watch, ref } from
|
2
|
+
import { watch, ref } from '#imports'
|
3
3
|
const props = defineProps({
|
4
4
|
currentPage: {
|
5
5
|
required: true,
|
@@ -17,42 +17,45 @@ const props = defineProps({
|
|
17
17
|
default: 3,
|
18
18
|
},
|
19
19
|
modelValue: {
|
20
|
-
required:
|
20
|
+
required: false,
|
21
21
|
type: Number,
|
22
22
|
},
|
23
|
-
})
|
23
|
+
})
|
24
24
|
|
25
|
-
const emits = defineEmits([
|
25
|
+
const emits = defineEmits(['update:modelValue', 'change'])
|
26
26
|
|
27
27
|
const emit = (item: any) => {
|
28
|
-
if (props.currentPage !== item)
|
29
|
-
|
28
|
+
if (props.currentPage !== item) {
|
29
|
+
emits('update:modelValue', item)
|
30
|
+
emits('change', { page: item })
|
31
|
+
}
|
32
|
+
}
|
30
33
|
|
31
|
-
const listPage = ref<Array<Number>>([])
|
34
|
+
const listPage = ref<Array<Number>>([])
|
32
35
|
|
33
36
|
const computeListPage = () => {
|
34
|
-
listPage.value = []
|
35
|
-
let firstPage = props.currentPage - props.numberSugestPage
|
36
|
-
const endPage = props.currentPage + (props.numberSugestPage + 1)
|
37
|
+
listPage.value = []
|
38
|
+
let firstPage = props.currentPage - props.numberSugestPage
|
39
|
+
const endPage = props.currentPage + (props.numberSugestPage + 1)
|
37
40
|
|
38
41
|
while (firstPage <= endPage) {
|
39
42
|
if (firstPage > 0 && firstPage <= props.lastPage)
|
40
|
-
listPage.value.push(firstPage)
|
41
|
-
firstPage
|
43
|
+
listPage.value.push(firstPage)
|
44
|
+
firstPage++
|
42
45
|
}
|
43
|
-
}
|
44
|
-
computeListPage()
|
46
|
+
}
|
47
|
+
computeListPage()
|
45
48
|
watch(
|
46
49
|
() => props.currentPage,
|
47
50
|
() => computeListPage()
|
48
|
-
)
|
51
|
+
)
|
49
52
|
|
50
53
|
const arrowPrevious = () => {
|
51
|
-
if (props.currentPage !== 1) emit(props.currentPage - 1)
|
52
|
-
}
|
54
|
+
if (props.currentPage !== 1) emit(props.currentPage - 1)
|
55
|
+
}
|
53
56
|
const arrowNext = () => {
|
54
|
-
if (props.currentPage !== props.lastPage) emit(props.currentPage + 1)
|
55
|
-
}
|
57
|
+
if (props.currentPage !== props.lastPage) emit(props.currentPage + 1)
|
58
|
+
}
|
56
59
|
</script>
|
57
60
|
|
58
61
|
<template>
|
@@ -0,0 +1,57 @@
|
|
1
|
+
<script lang="ts" setup>
|
2
|
+
const emits = defineEmits(['update:modelValue'])
|
3
|
+
const computeModelValue = (event: Event) => {
|
4
|
+
const target = event.target as HTMLInputElement
|
5
|
+
emits('update:modelValue', target.value)
|
6
|
+
}
|
7
|
+
|
8
|
+
const id = useId()
|
9
|
+
const value = [5, 4, 3, 2, 1]
|
10
|
+
</script>
|
11
|
+
|
12
|
+
<template>
|
13
|
+
<div class="rating">
|
14
|
+
<template
|
15
|
+
v-for="(item, index) in 5"
|
16
|
+
:key="index"
|
17
|
+
>
|
18
|
+
<input
|
19
|
+
type="radio"
|
20
|
+
:id="`star${item}-${id}`"
|
21
|
+
:name="`star-name${id}`"
|
22
|
+
:value="value[index]"
|
23
|
+
@input="computeModelValue"
|
24
|
+
/>
|
25
|
+
<label :for="`star${item}-${id}`"></label>
|
26
|
+
</template>
|
27
|
+
</div>
|
28
|
+
</template>
|
29
|
+
|
30
|
+
<style scoped>
|
31
|
+
@charset "UTF-8";
|
32
|
+
.rating {
|
33
|
+
display: inline-block;
|
34
|
+
}
|
35
|
+
|
36
|
+
.rating input {
|
37
|
+
display: none;
|
38
|
+
}
|
39
|
+
|
40
|
+
.rating label {
|
41
|
+
float: right;
|
42
|
+
cursor: pointer;
|
43
|
+
transition: color 0.3s;
|
44
|
+
}
|
45
|
+
|
46
|
+
.rating label:before {
|
47
|
+
content: "★";
|
48
|
+
font-size: 30px;
|
49
|
+
}
|
50
|
+
|
51
|
+
.rating input:checked ~ label,
|
52
|
+
.rating label:hover,
|
53
|
+
.rating label:hover ~ label {
|
54
|
+
color: #ffd700;
|
55
|
+
transition: color 0.3s;
|
56
|
+
}
|
57
|
+
</style>
|
@@ -10,6 +10,11 @@ const props = defineProps({
|
|
10
10
|
default: false,
|
11
11
|
type: Boolean,
|
12
12
|
},
|
13
|
+
color: {
|
14
|
+
required: false,
|
15
|
+
default: 'green',
|
16
|
+
type: String as () => 'orange' | 'blue' | 'gray' | 'red' | 'green',
|
17
|
+
},
|
13
18
|
})
|
14
19
|
|
15
20
|
const emits = defineEmits(['update:modelValue'])
|
@@ -21,7 +26,10 @@ const input = (e: Event) => {
|
|
21
26
|
|
22
27
|
<template>
|
23
28
|
<div>
|
24
|
-
<label
|
29
|
+
<label
|
30
|
+
class="switch"
|
31
|
+
:class="[`color-${props.color}`]"
|
32
|
+
>
|
25
33
|
<input
|
26
34
|
type="checkbox"
|
27
35
|
@input="input"
|
@@ -33,25 +41,22 @@ const input = (e: Event) => {
|
|
33
41
|
</template>
|
34
42
|
|
35
43
|
<style>
|
36
|
-
/* From Uiverse.io by namecho */
|
37
44
|
.switch {
|
38
45
|
direction: ltr;
|
39
|
-
--button-width:
|
40
|
-
--button-height:
|
41
|
-
--toggle-diameter:
|
46
|
+
--button-width: 3em;
|
47
|
+
--button-height: 1.5em;
|
48
|
+
--toggle-diameter: 1em;
|
42
49
|
--button-toggle-offset: calc(
|
43
50
|
(var(--button-height) - var(--toggle-diameter)) / 2
|
44
51
|
);
|
45
52
|
--toggle-shadow-offset: 10px;
|
46
53
|
--toggle-wider: 3em;
|
47
|
-
--color-grey: #cccccc;
|
48
|
-
--color-green: #4296f4;
|
49
54
|
}
|
50
55
|
.switch-slider {
|
56
|
+
@apply bg-gray-300;
|
51
57
|
display: inline-block;
|
52
58
|
width: var(--button-width);
|
53
59
|
height: var(--button-height);
|
54
|
-
background-color: var(--color-grey);
|
55
60
|
border-radius: calc(var(--button-height) / 2);
|
56
61
|
position: relative;
|
57
62
|
transition: 0.3s all ease-in-out;
|
@@ -69,8 +74,20 @@ const input = (e: Event) => {
|
|
69
74
|
box-shadow: var(--toggle-shadow-offset) 0 calc(var(--toggle-shadow-offset) * 4) rgba(0, 0, 0, 0.1);
|
70
75
|
transition: 0.3s all ease-in-out;
|
71
76
|
}
|
72
|
-
.switch input[type=checkbox]:checked + .switch-slider {
|
73
|
-
background-color:
|
77
|
+
.switch.color-orange input[type=checkbox]:checked + .switch-slider {
|
78
|
+
background-color: theme("colors.orange.500");
|
79
|
+
}
|
80
|
+
.switch.color-blue input[type=checkbox]:checked + .switch-slider {
|
81
|
+
background-color: theme("colors.blue.500");
|
82
|
+
}
|
83
|
+
.switch.color-gray input[type=checkbox]:checked + .switch-slider {
|
84
|
+
background-color: theme("colors.gray.500");
|
85
|
+
}
|
86
|
+
.switch.color-red input[type=checkbox]:checked + .switch-slider {
|
87
|
+
background-color: theme("colors.red.500");
|
88
|
+
}
|
89
|
+
.switch.color-green input[type=checkbox]:checked + .switch-slider {
|
90
|
+
background-color: theme("colors.green.500");
|
74
91
|
}
|
75
92
|
.switch input[type=checkbox]:checked + .switch-slider::after {
|
76
93
|
transform: translateX(calc(var(--button-width) - var(--toggle-diameter) - var(--button-toggle-offset)));
|
@@ -1,10 +1,9 @@
|
|
1
1
|
<script lang="ts" setup>
|
2
2
|
interface itemsType {
|
3
|
-
active: boolean
|
4
|
-
text: string
|
5
|
-
key: string
|
3
|
+
active: boolean
|
4
|
+
text: string
|
5
|
+
key: string
|
6
6
|
}
|
7
|
-
|
8
7
|
const props = defineProps({
|
9
8
|
items: {
|
10
9
|
required: true,
|
@@ -15,43 +14,104 @@ const props = defineProps({
|
|
15
14
|
required: true,
|
16
15
|
type: String,
|
17
16
|
},
|
18
|
-
})
|
19
|
-
const emits = defineEmits([
|
17
|
+
})
|
18
|
+
const emits = defineEmits(['update:modelValue'])
|
20
19
|
const tabClicked: any = (key: string, event: any) => {
|
21
|
-
emits(
|
20
|
+
emits('update:modelValue', key)
|
22
21
|
Array.from(event.currentTarget.parentElement.parentElement.children).map(
|
23
|
-
(item: any) => item.children[0].classList.remove(
|
24
|
-
)
|
25
|
-
event.currentTarget.classList.add(
|
26
|
-
}
|
22
|
+
(item: any) => item.children[0].classList.remove('active')
|
23
|
+
)
|
24
|
+
event.currentTarget.classList.add('active')
|
25
|
+
}
|
26
|
+
|
27
|
+
const setArrow = () => {
|
28
|
+
document.querySelectorAll('.glorious-tab-content').forEach((element) => {
|
29
|
+
if (element.scrollWidth > element.clientWidth) {
|
30
|
+
element.previousElementSibling?.classList.replace('hidden', 'flex')
|
31
|
+
|
32
|
+
element.previousElementSibling?.parentElement?.classList.add('!px-7')
|
33
|
+
element.nextElementSibling?.classList.replace('hidden', 'flex')
|
34
|
+
} else {
|
35
|
+
element.previousElementSibling?.classList.add('hidden')
|
36
|
+
element.previousElementSibling?.parentElement?.classList.remove('!px-7')
|
37
|
+
element.nextElementSibling?.classList.add('hidden')
|
38
|
+
}
|
39
|
+
})
|
40
|
+
}
|
41
|
+
onMounted(() => {
|
42
|
+
window.addEventListener('resize', () => setArrow())
|
43
|
+
setArrow()
|
44
|
+
})
|
45
|
+
|
46
|
+
const scrollNext = (event: Event) => {
|
47
|
+
const currentTarget = event.currentTarget as HTMLDivElement
|
48
|
+
const nextElement = currentTarget.nextElementSibling as HTMLDivElement
|
49
|
+
nextElement.scrollBy({
|
50
|
+
left: 80,
|
51
|
+
behavior: 'smooth',
|
52
|
+
})
|
53
|
+
}
|
54
|
+
const scrollPrevious = (event: Event) => {
|
55
|
+
const currentTarget = event.currentTarget as HTMLDivElement
|
56
|
+
const previousElement = currentTarget.previousElementSibling as HTMLDivElement
|
57
|
+
previousElement.scrollBy({
|
58
|
+
left: -80,
|
59
|
+
behavior: 'smooth',
|
60
|
+
})
|
61
|
+
}
|
27
62
|
</script>
|
28
63
|
|
29
64
|
<template>
|
30
|
-
<div class="glorious-tab">
|
65
|
+
<div class="glorious-tab relative">
|
31
66
|
<div
|
32
|
-
|
33
|
-
|
34
|
-
class="flex justify-center"
|
35
|
-
:style="{ flexBasis: `${100 / props.items.length}%` }"
|
67
|
+
@click="scrollNext($event)"
|
68
|
+
class="bg-green-700 absolute right-0 h-full top-0 w-8 justify-center items-center rounded-r-lg hidden cursor-auto"
|
36
69
|
>
|
37
|
-
<
|
38
|
-
|
39
|
-
|
70
|
+
<GIcon
|
71
|
+
name="glorious-arrow"
|
72
|
+
:size="15"
|
73
|
+
color="#fff"
|
74
|
+
/>
|
75
|
+
</div>
|
76
|
+
|
77
|
+
<div class="flex overflow-auto px-3 py-2 gap-3 glorious-tab-content">
|
78
|
+
<div
|
79
|
+
v-for="(item, index) in props.items"
|
80
|
+
:key="index"
|
81
|
+
class="flex justify-center tab-item"
|
82
|
+
:style="{ flexBasis: `${100 / props.items.length}%` }"
|
40
83
|
>
|
41
|
-
|
42
|
-
|
84
|
+
<button
|
85
|
+
:class="item.active ? `active` : ''"
|
86
|
+
@click="tabClicked(item.key, $event)"
|
87
|
+
>
|
88
|
+
{{ item.text }}
|
89
|
+
</button>
|
90
|
+
</div>
|
91
|
+
</div>
|
92
|
+
|
93
|
+
<div
|
94
|
+
@click="scrollPrevious($event)"
|
95
|
+
class="bg-green-700 absolute left-0 h-full top-0 w-8 justify-center items-center rounded-l-lg hidden cursor-pointer"
|
96
|
+
>
|
97
|
+
<GIcon
|
98
|
+
name="glorious-arrow"
|
99
|
+
class="rotate-180"
|
100
|
+
:size="15"
|
101
|
+
color="#fff"
|
102
|
+
/>
|
43
103
|
</div>
|
44
104
|
</div>
|
45
105
|
</template>
|
46
106
|
|
47
107
|
<style>
|
48
108
|
.glorious-tab {
|
49
|
-
@apply flex justify-between bg-green-100
|
109
|
+
@apply flex justify-between bg-green-100 rounded-lg gap-3 w-max max-w-full shadow-md;
|
50
110
|
}
|
51
|
-
.glorious-tab > div > button {
|
111
|
+
.glorious-tab div > div > button {
|
52
112
|
@apply text-gray-700 text-[14px] hover:bg-green-200 hover:text-gray-800 cursor-pointer px-2 py-1 rounded-lg;
|
53
113
|
}
|
54
|
-
.glorious-tab > div > button.active {
|
114
|
+
.glorious-tab div > div > button.active {
|
55
115
|
@apply font-bold text-white bg-green-700;
|
56
116
|
}
|
57
117
|
</style>
|
@@ -0,0 +1,84 @@
|
|
1
|
+
<script lang="ts" setup>
|
2
|
+
const props = defineProps({
|
3
|
+
items: {
|
4
|
+
required: true,
|
5
|
+
},
|
6
|
+
color: {
|
7
|
+
required: false,
|
8
|
+
default: 'green',
|
9
|
+
type: String as () => 'orange' | 'blue' | 'gray' | 'red' | 'green',
|
10
|
+
},
|
11
|
+
})
|
12
|
+
</script>
|
13
|
+
<template>
|
14
|
+
<div class="flex gap-3 mr-4">
|
15
|
+
<div
|
16
|
+
class="flex flex-col gap-5 glorious-timeline-items"
|
17
|
+
:class="[`color-${props.color}`]"
|
18
|
+
>
|
19
|
+
<div
|
20
|
+
v-for="(item, index) in props.items.reverse()"
|
21
|
+
:key="index"
|
22
|
+
>
|
23
|
+
<div class="glorious-timeline-items-count">
|
24
|
+
{{ props.items.length - index }}
|
25
|
+
</div>
|
26
|
+
<slot
|
27
|
+
name="item"
|
28
|
+
:item="item"
|
29
|
+
>
|
30
|
+
</slot>
|
31
|
+
</div>
|
32
|
+
</div>
|
33
|
+
</div>
|
34
|
+
</template>
|
35
|
+
|
36
|
+
<style scoped>
|
37
|
+
.glorious-timeline-items {
|
38
|
+
@apply relative;
|
39
|
+
}
|
40
|
+
.glorious-timeline-items div {
|
41
|
+
@apply relative;
|
42
|
+
}
|
43
|
+
.glorious-timeline-items div::before {
|
44
|
+
content: "";
|
45
|
+
@apply absolute w-[2px] right-[-15px];
|
46
|
+
}
|
47
|
+
.glorious-timeline-items div::before:not(:last-child) {
|
48
|
+
@apply h-[calc(100%+20px)];
|
49
|
+
}
|
50
|
+
.glorious-timeline-items-count {
|
51
|
+
@apply absolute w-5 h-5 top-0 right-[-24px] rounded-full !important;
|
52
|
+
@apply text-white flex justify-center items-center font-medium;
|
53
|
+
}
|
54
|
+
.glorious-timeline-items.color-orange > div::before {
|
55
|
+
@apply bg-orange-500;
|
56
|
+
}
|
57
|
+
.glorious-timeline-items.color-blue > div::before {
|
58
|
+
@apply bg-blue-500;
|
59
|
+
}
|
60
|
+
.glorious-timeline-items.color-gray > div::before {
|
61
|
+
@apply bg-gray-500;
|
62
|
+
}
|
63
|
+
.glorious-timeline-items.color-red > div::before {
|
64
|
+
@apply bg-red-500;
|
65
|
+
}
|
66
|
+
.glorious-timeline-items.color-green > div::before {
|
67
|
+
@apply bg-green-500;
|
68
|
+
}
|
69
|
+
.glorious-timeline-items.color-orange .glorious-timeline-items-count {
|
70
|
+
@apply bg-orange-500;
|
71
|
+
}
|
72
|
+
.glorious-timeline-items.color-blue .glorious-timeline-items-count {
|
73
|
+
@apply bg-blue-500;
|
74
|
+
}
|
75
|
+
.glorious-timeline-items.color-gray .glorious-timeline-items-count {
|
76
|
+
@apply bg-gray-500;
|
77
|
+
}
|
78
|
+
.glorious-timeline-items.color-red .glorious-timeline-items-count {
|
79
|
+
@apply bg-red-500;
|
80
|
+
}
|
81
|
+
.glorious-timeline-items.color-green .glorious-timeline-items-count {
|
82
|
+
@apply bg-green-500;
|
83
|
+
}
|
84
|
+
</style>
|
@@ -6,9 +6,10 @@ interface gloriousFetchOptions {
|
|
6
6
|
lazy?: Boolean;
|
7
7
|
headers?: Object;
|
8
8
|
body?: Object;
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
keepResponse?: Boolean;
|
10
|
+
bodyType?: 'formData' | 'formDataCustom' | 'normal';
|
11
|
+
method?: 'POST' | 'GET' | 'PATCH' | 'PUT' | 'DELETE' | 'HEAD';
|
12
|
+
credentials?: 'same-origin' | 'include';
|
12
13
|
watch?: Array<Object>;
|
13
14
|
}
|
14
15
|
export default function (url: string, options?: gloriousFetchOptions): Promise<unknown>;
|
@@ -6,6 +6,7 @@ const defaultOptions = {
|
|
6
6
|
method: "GET",
|
7
7
|
lazy: true,
|
8
8
|
is$: true,
|
9
|
+
keepResponse: false,
|
9
10
|
params: {},
|
10
11
|
headers: {
|
11
12
|
Accept: "application/json"
|
@@ -29,7 +30,8 @@ export default function(url, options = defaultOptions) {
|
|
29
30
|
} catch (e) {
|
30
31
|
}
|
31
32
|
},
|
32
|
-
onResponse() {
|
33
|
+
onResponse({ response }) {
|
34
|
+
gs.response[gKey] = response._data;
|
33
35
|
try {
|
34
36
|
gs.loading[gKey] = false;
|
35
37
|
gs.forms[gKey].errors = [];
|
@@ -53,6 +55,8 @@ export default function(url, options = defaultOptions) {
|
|
53
55
|
}
|
54
56
|
}
|
55
57
|
};
|
58
|
+
if (opt.keepResponse && !gs.keepResponse.includes(gKey))
|
59
|
+
gs.keepResponse.push(gKey);
|
56
60
|
if (opt.method === "GET" && typeof opt.body !== "undefined") {
|
57
61
|
opt.method = "POST";
|
58
62
|
return $fetch(url, opt);
|
@@ -83,7 +87,7 @@ function computeFormData(options) {
|
|
83
87
|
Object.entries(options.body).forEach((item) => {
|
84
88
|
console.log(item[1]);
|
85
89
|
if (item[1] === null) return;
|
86
|
-
if (typeof item[1] === "object" && typeof item[1].lastModifiedDate === "undefined" &&
|
90
|
+
if (typeof item[1] === "object" && typeof item[1].lastModifiedDate === "undefined" && typeof item[1].type === "undefined" && typeof item[1].size === "undefined")
|
87
91
|
Object.entries(item[1]).forEach((nestedItem, index) => {
|
88
92
|
form.append(`${item[0]}[${index}]`, nestedItem[1]);
|
89
93
|
});
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { defineNuxtRouteMiddleware } from "#imports";
|
2
|
+
import { GloriousStore } from "../stores/GloriousStore.mjs";
|
3
|
+
export default defineNuxtRouteMiddleware(() => {
|
4
|
+
const gs = GloriousStore();
|
5
|
+
Object.entries(gs.response).forEach((element) => {
|
6
|
+
if (!gs.keepResponse.includes(element[0])) delete gs.response[element[0]];
|
7
|
+
});
|
8
|
+
});
|
package/package.json
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
{
|
2
|
-
"version": "1.2.3-
|
2
|
+
"version": "1.2.3-4",
|
3
3
|
"name": "nuxt-glorious",
|
4
4
|
"description": "This package provides many things needed by a project, including server requests and authentication, SEO and other requirements of a project.",
|
5
5
|
"repository": "sajadhzj/nuxt-glorious",
|