vueless 0.0.143 → 0.0.145
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +5 -9
- package/package.json +1 -1
- package/ui.loader-rendering/Docs.mdx +20 -5
- package/ui.loader-rendering/composables/attrs.composable.js +20 -8
- package/ui.loader-rendering/composables/useLoaderRendering.js +10 -12
- package/ui.loader-rendering/configs/default.config.js +18 -7
- package/ui.loader-rendering/index.vue +27 -41
- package/ui.loader-top/Docs.mdx +4 -7
- package/ui.loader-top/composables/useLoaderTop.js +6 -9
- package/ui.loader-top/index.stories.js +2 -2
- package/ui.loader-top/index.vue +4 -4
- package/ui.text-notify/configs/default.config.js +5 -5
- package/web-types.json +11 -1
package/index.js
CHANGED
|
@@ -1,20 +1,15 @@
|
|
|
1
|
+
/* eslint-disable vue/max-len, prettier/prettier */
|
|
1
2
|
import { createLocale, LocaleSymbol } from "./composable.locale";
|
|
2
|
-
import {
|
|
3
|
-
createLoaderRendering,
|
|
4
|
-
LoaderRenderingSymbol,
|
|
5
|
-
} from "./ui.loader-rendering/composables/useLoaderRendering";
|
|
3
|
+
import { createLoaderRendering, LoaderRenderingSymbol } from "./ui.loader-rendering/composables/useLoaderRendering";
|
|
6
4
|
import { createLoaderTop, LoaderTopSymbol } from "./ui.loader-top/composables/useLoaderTop";
|
|
7
5
|
|
|
8
6
|
export { default as createVueI18nAdapter } from "./adatper.locale/vue-i18n";
|
|
9
7
|
export { default as defaultEnLocale } from "./adatper.locale/locales/en";
|
|
10
8
|
export { useLocale } from "./composable.locale";
|
|
11
|
-
export { useLoaderRendering } from "./ui.loader-rendering/composables/useLoaderRendering";
|
|
12
9
|
export { useLoaderTop } from "./ui.loader-top/composables/useLoaderTop";
|
|
13
|
-
export {
|
|
14
|
-
loaderRenderingOn,
|
|
15
|
-
loaderRenderingOff,
|
|
16
|
-
} from "./ui.loader-rendering/services/loaderRedering.service";
|
|
17
10
|
export { loaderTopOn, loaderTopOff } from "./ui.loader-top/services/loaderTop.service";
|
|
11
|
+
export { useLoaderRendering } from "./ui.loader-rendering/composables/useLoaderRendering";
|
|
12
|
+
export { loaderRenderingOn, loaderRenderingOff } from "./ui.loader-rendering/services/loaderRedering.service";
|
|
18
13
|
export {
|
|
19
14
|
notify,
|
|
20
15
|
notifySuccess,
|
|
@@ -24,6 +19,7 @@ export {
|
|
|
24
19
|
setDelayedNotify,
|
|
25
20
|
getDelayedNotify,
|
|
26
21
|
} from "./ui.text-notify/services";
|
|
22
|
+
/* eslint-enable vue/max-len, prettier/prettier */
|
|
27
23
|
|
|
28
24
|
export function createVueless(options = {}) {
|
|
29
25
|
const i18n = createLocale(options.i18n);
|
package/package.json
CHANGED
|
@@ -11,18 +11,33 @@ import * as stories from "./index.stories";
|
|
|
11
11
|
<Controls of={stories.Default} />
|
|
12
12
|
<Stories of={stories} />
|
|
13
13
|
|
|
14
|
-
##
|
|
15
|
-
|
|
14
|
+
## Using loader
|
|
15
|
+
To control the loader state in Vue components use `useLoaderRendering` composable.
|
|
16
16
|
|
|
17
17
|
<Source code={`
|
|
18
18
|
import { useLoaderRendering } from "vueless";
|
|
19
19
|
|
|
20
|
-
const {
|
|
20
|
+
const { isLoading, loaderRenderingOn, loaderRenderingOff } = useLoaderRendering();
|
|
21
|
+
|
|
22
|
+
// get loader state
|
|
23
|
+
console.log(isLoading.value);
|
|
24
|
+
|
|
25
|
+
// show loader
|
|
26
|
+
loaderRenderingOn();
|
|
27
|
+
|
|
28
|
+
// hide loader
|
|
29
|
+
loaderRenderingOff();
|
|
21
30
|
`} language="jsx" dark />
|
|
22
31
|
|
|
23
|
-
##
|
|
24
|
-
|
|
32
|
+
## Using loader outside Vue components
|
|
33
|
+
To control the loader state outside Vue components, use the following methods.
|
|
25
34
|
|
|
26
35
|
<Source code={`
|
|
27
36
|
import { loaderRenderingOn, loaderRenderingOff } from "vueless";
|
|
37
|
+
|
|
38
|
+
// show loader
|
|
39
|
+
loaderRenderingOn();
|
|
40
|
+
|
|
41
|
+
// hide loader
|
|
42
|
+
loaderRenderingOff();
|
|
28
43
|
`} language="jsx" dark />
|
|
@@ -1,20 +1,32 @@
|
|
|
1
|
+
import { computed } from "vue";
|
|
1
2
|
import useUI from "../../composable.ui";
|
|
3
|
+
import { cva } from "../../service.ui";
|
|
2
4
|
|
|
3
5
|
import defaultConfig from "../configs/default.config";
|
|
4
6
|
|
|
5
7
|
export function useAttrs(props) {
|
|
6
|
-
const { getAttrs, config } = useUI(defaultConfig, () => props.config);
|
|
8
|
+
const { getAttrs, setColor, config } = useUI(defaultConfig, () => props.config);
|
|
9
|
+
const { wrapper } = config.value;
|
|
7
10
|
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
const cvaWrapper = cva({
|
|
12
|
+
base: wrapper.base,
|
|
13
|
+
variants: wrapper.variants,
|
|
14
|
+
compoundVariants: wrapper.compoundVariants,
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const wrapperClasses = computed(() =>
|
|
18
|
+
setColor(
|
|
19
|
+
cvaWrapper({
|
|
20
|
+
color: props.color,
|
|
21
|
+
}),
|
|
22
|
+
props.color,
|
|
23
|
+
),
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
const wrapperAttrs = getAttrs("wrapper", { classes: wrapperClasses });
|
|
12
27
|
|
|
13
28
|
return {
|
|
14
29
|
wrapperAttrs,
|
|
15
|
-
loaderAttrs,
|
|
16
|
-
rippleAttrs,
|
|
17
|
-
rippleElementAttrs,
|
|
18
30
|
config,
|
|
19
31
|
};
|
|
20
32
|
}
|
|
@@ -1,27 +1,25 @@
|
|
|
1
|
-
import { readonly, ref
|
|
1
|
+
import { inject, readonly, ref } from "vue";
|
|
2
2
|
|
|
3
3
|
export const LoaderRenderingSymbol = Symbol.for("vueless:loader-rendering");
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const isLoading = ref(true);
|
|
6
6
|
|
|
7
|
-
function
|
|
8
|
-
|
|
7
|
+
function loaderRenderingOn() {
|
|
8
|
+
isLoading.value = true;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
function
|
|
12
|
-
|
|
11
|
+
function loaderRenderingOff() {
|
|
12
|
+
isLoading.value = false;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export function createLoaderRendering() {
|
|
16
16
|
return {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
isLoading: readonly(isLoading),
|
|
18
|
+
loaderRenderingOn,
|
|
19
|
+
loaderRenderingOff,
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
export function useLoaderRendering() {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return loaderRenderingState;
|
|
24
|
+
return inject(LoaderRenderingSymbol);
|
|
27
25
|
}
|
|
@@ -1,13 +1,24 @@
|
|
|
1
1
|
export default /*tw*/ {
|
|
2
|
-
wrapper:
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
wrapper: {
|
|
3
|
+
base: `
|
|
4
|
+
bg-{color}-600
|
|
5
|
+
h-screen w-screen
|
|
6
|
+
flex justify-center items-center
|
|
7
|
+
fixed left-0 top-0 z-[9999]
|
|
8
|
+
transition-all duration-300
|
|
9
|
+
`,
|
|
10
|
+
variants: {
|
|
11
|
+
color: {
|
|
12
|
+
white: "bg-white",
|
|
13
|
+
grayscale: "bg-gray-800",
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
},
|
|
9
17
|
transition: {
|
|
10
18
|
enterFromClass: "scale-110 transform",
|
|
11
19
|
leaveActiveClass: "scale-110 transform",
|
|
12
20
|
},
|
|
21
|
+
defaultVariants: {
|
|
22
|
+
color: "brand",
|
|
23
|
+
},
|
|
13
24
|
};
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<Transition
|
|
3
|
-
<div v-if="showLoader" v-bind="
|
|
4
|
-
<
|
|
5
|
-
<div v-bind="rippleElementAttrs" class="ripple-element" />
|
|
6
|
-
<div v-bind="rippleElementAttrs" class="ripple-element" />
|
|
7
|
-
</div>
|
|
2
|
+
<Transition v-bind="config.transition">
|
|
3
|
+
<div v-if="showLoader" v-bind="wrapperAttrs">
|
|
4
|
+
<ULoader size="lg" :color="color === 'white' ? 'grayscale' : 'white'" />
|
|
8
5
|
</div>
|
|
9
6
|
</Transition>
|
|
10
7
|
</template>
|
|
11
8
|
|
|
12
9
|
<script setup>
|
|
13
10
|
import { computed, onMounted, onUnmounted } from "vue";
|
|
11
|
+
import UIService from "../service.ui";
|
|
14
12
|
|
|
13
|
+
import ULoader from "../ui.loader";
|
|
14
|
+
|
|
15
|
+
import { ULoaderRendering } from "./constants";
|
|
16
|
+
import defaultConfig from "./configs/default.config";
|
|
15
17
|
import { useAttrs } from "./composables/attrs.composable";
|
|
16
18
|
import { useLoaderRendering } from "./composables/useLoaderRendering";
|
|
17
19
|
|
|
@@ -19,54 +21,38 @@ import { useLoaderRendering } from "./composables/useLoaderRendering";
|
|
|
19
21
|
defineOptions({ name: "ULoaderRendering", inheritAttrs: false });
|
|
20
22
|
|
|
21
23
|
const props = defineProps({
|
|
24
|
+
/**
|
|
25
|
+
* Set loader on.
|
|
26
|
+
*/
|
|
22
27
|
loading: {
|
|
23
28
|
type: Boolean,
|
|
24
29
|
default: false,
|
|
25
30
|
},
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Loader color.
|
|
34
|
+
* @values brand, grayscale, gray, red, orange, amber, yellow, lime, green, emerald, teal, cyan, sky, blue, indigo, violet, purple, fuchsia, pink, rose, white
|
|
35
|
+
*/
|
|
36
|
+
color: {
|
|
37
|
+
type: String,
|
|
38
|
+
default: UIService.get(defaultConfig, ULoaderRendering).default.color,
|
|
39
|
+
},
|
|
26
40
|
});
|
|
27
41
|
|
|
28
|
-
const { wrapperAttrs,
|
|
29
|
-
const {
|
|
42
|
+
const { wrapperAttrs, config } = useAttrs(props);
|
|
43
|
+
const { isLoading, loaderRenderingOn, loaderRenderingOff } = useLoaderRendering();
|
|
30
44
|
|
|
31
45
|
onMounted(() => {
|
|
32
|
-
window.addEventListener("setRenderingStarted",
|
|
33
|
-
window.addEventListener("setRenderingFinished",
|
|
46
|
+
window.addEventListener("setRenderingStarted", loaderRenderingOn);
|
|
47
|
+
window.addEventListener("setRenderingFinished", loaderRenderingOff);
|
|
34
48
|
});
|
|
35
49
|
|
|
36
50
|
onUnmounted(() => {
|
|
37
|
-
window.removeEventListener("setRenderingStarted",
|
|
38
|
-
window.removeEventListener("setRenderingFinished",
|
|
51
|
+
window.removeEventListener("setRenderingStarted", loaderRenderingOn);
|
|
52
|
+
window.removeEventListener("setRenderingFinished", loaderRenderingOff);
|
|
39
53
|
});
|
|
40
54
|
|
|
41
55
|
const showLoader = computed(() => {
|
|
42
|
-
return props.loading ||
|
|
56
|
+
return props.loading || isLoading.value;
|
|
43
57
|
});
|
|
44
58
|
</script>
|
|
45
|
-
|
|
46
|
-
<style lang="postcss" scoped>
|
|
47
|
-
.ripple-element {
|
|
48
|
-
animation: ripple 1s cubic-bezier(0, 0.2, 0.8, 1) infinite;
|
|
49
|
-
|
|
50
|
-
&:nth-child(2) {
|
|
51
|
-
animation-delay: -0.5s;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
@keyframes ripple {
|
|
56
|
-
0% {
|
|
57
|
-
left: 5rem;
|
|
58
|
-
top: 5rem;
|
|
59
|
-
height: 0px;
|
|
60
|
-
width: 0px;
|
|
61
|
-
opacity: 1;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
100% {
|
|
65
|
-
left: 0px;
|
|
66
|
-
top: 0px;
|
|
67
|
-
height: 10rem;
|
|
68
|
-
width: 10rem;
|
|
69
|
-
opacity: 0;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
</style>
|
package/ui.loader-top/Docs.mdx
CHANGED
|
@@ -21,9 +21,9 @@ You can control loader state using *useLoaderRendering* composable.
|
|
|
21
21
|
<Source code={`
|
|
22
22
|
import { useLoaderTop } from "vueless";
|
|
23
23
|
|
|
24
|
-
const {
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
const {
|
|
25
|
+
loaderTopOn,
|
|
26
|
+
loaderTopOff,
|
|
27
27
|
addRequestUrl,
|
|
28
28
|
removeRequestUrl
|
|
29
29
|
} = useLoaderTop();
|
|
@@ -33,8 +33,5 @@ const {
|
|
|
33
33
|
You can control loader state outside of vue components using following methods.
|
|
34
34
|
|
|
35
35
|
<Source code={`
|
|
36
|
-
import {
|
|
37
|
-
loaderTopOn,
|
|
38
|
-
loaderTopOff,
|
|
39
|
-
} from "vueless";
|
|
36
|
+
import { loaderTopOn, loaderTopOff } from "vueless";
|
|
40
37
|
`} language="jsx" dark />
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { inject, readonly, ref } from "vue";
|
|
2
2
|
|
|
3
3
|
export const LoaderTopSymbol = Symbol.for("vueless:loader-top");
|
|
4
4
|
|
|
@@ -8,15 +8,14 @@ const loaderRequestQueue = ref([]);
|
|
|
8
8
|
const loaderRequestTimeout = ref(0);
|
|
9
9
|
const componentLoaderRequestQueue = ref([]);
|
|
10
10
|
|
|
11
|
-
function
|
|
11
|
+
function loaderTopOn(url) {
|
|
12
12
|
loaderRequestQueue.value.push(url);
|
|
13
|
-
|
|
14
13
|
isLoading.value = true;
|
|
15
14
|
|
|
16
15
|
clearTimeout(loaderRequestTimeout.value);
|
|
17
16
|
}
|
|
18
17
|
|
|
19
|
-
function
|
|
18
|
+
function loaderTopOff(url) {
|
|
20
19
|
loaderRequestQueue.value = url ? loaderRequestQueue.value.filter((item) => item !== url) : [];
|
|
21
20
|
|
|
22
21
|
loaderRequestTimeout.value = setTimeout(() => {
|
|
@@ -49,8 +48,8 @@ export function createLoaderTop() {
|
|
|
49
48
|
loaderRequestQueue: readonly(loaderRequestQueue),
|
|
50
49
|
loaderRequestTimeout: readonly(loaderRequestTimeout),
|
|
51
50
|
componentLoaderRequestQueue: readonly(componentLoaderRequestQueue),
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
loaderTopOn,
|
|
52
|
+
loaderTopOff,
|
|
54
53
|
addRequestUrl,
|
|
55
54
|
removeRequestUrl,
|
|
56
55
|
setComponentRequestQueue,
|
|
@@ -59,7 +58,5 @@ export function createLoaderTop() {
|
|
|
59
58
|
}
|
|
60
59
|
|
|
61
60
|
export function useLoaderTop() {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
return loaderTopState;
|
|
61
|
+
return inject(LoaderTopSymbol);
|
|
65
62
|
}
|
|
@@ -21,9 +21,9 @@ export default {
|
|
|
21
21
|
const DefaultTemplate = (args) => ({
|
|
22
22
|
components: { ULoaderTop, UButton },
|
|
23
23
|
setup() {
|
|
24
|
-
const {
|
|
24
|
+
const { loaderTopOn, loaderTopOff } = useLoaderTop();
|
|
25
25
|
|
|
26
|
-
return { args,
|
|
26
|
+
return { args, loaderTopOn, loaderTopOff };
|
|
27
27
|
},
|
|
28
28
|
template: `
|
|
29
29
|
<div>
|
package/ui.loader-top/index.vue
CHANGED
|
@@ -49,8 +49,8 @@ const {
|
|
|
49
49
|
componentLoaderRequestQueue,
|
|
50
50
|
setComponentRequestQueue,
|
|
51
51
|
removeComponentRequestQueue,
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
loaderTopOff,
|
|
53
|
+
loaderTopOn,
|
|
54
54
|
} = useLoaderTop();
|
|
55
55
|
const { progressAttrs } = useAttrs(props, { error, isMobileApp });
|
|
56
56
|
|
|
@@ -93,11 +93,11 @@ onUnmounted(() => {
|
|
|
93
93
|
});
|
|
94
94
|
|
|
95
95
|
function setLoaderOnHandler(event) {
|
|
96
|
-
|
|
96
|
+
loaderTopOn(event.detail.resource);
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
function setLoaderOffHandler(event) {
|
|
100
|
-
|
|
100
|
+
loaderTopOff(event.detail.resource);
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
function requestWithoutQuery(request) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export default /*tw*/ {
|
|
2
|
+
wrapper: "absolute overflow-visible md:w-[22rem]",
|
|
2
3
|
transitionGroup: {
|
|
3
4
|
moveClass: "transition-all duration-500",
|
|
4
5
|
enterActiveClass: "transition-all duration-500",
|
|
@@ -6,7 +7,6 @@ export default /*tw*/ {
|
|
|
6
7
|
enterFromClass: "opacity-0",
|
|
7
8
|
leaveToClass: "opacity-0",
|
|
8
9
|
},
|
|
9
|
-
wrapper: "absolute overflow-visible md:w-[22rem]",
|
|
10
10
|
body: `
|
|
11
11
|
mb-3 flex w-full items-center justify-center gap-3 rounded-2xl bg-gray-900/90
|
|
12
12
|
p-4 shadow-[0_4px_16px_rgba(17,24,39,0.5)] backdrop-blur-md md:shadow-[0_0px_12px_rgba(0,0,0,0.25)]
|
|
@@ -25,6 +25,10 @@ export default /*tw*/ {
|
|
|
25
25
|
errorIconName: "error",
|
|
26
26
|
closeIcon: "",
|
|
27
27
|
closeIconName: "close",
|
|
28
|
+
positionClasses: {
|
|
29
|
+
page: "UNotifyPage",
|
|
30
|
+
aside: "UNotifyAside",
|
|
31
|
+
},
|
|
28
32
|
duration: {
|
|
29
33
|
short: 4000,
|
|
30
34
|
medium: 8000,
|
|
@@ -41,10 +45,6 @@ export default /*tw*/ {
|
|
|
41
45
|
default: "Operation error.",
|
|
42
46
|
},
|
|
43
47
|
},
|
|
44
|
-
positionClasses: {
|
|
45
|
-
page: "UNotifyPage",
|
|
46
|
-
aside: "UNotifyAside",
|
|
47
|
-
},
|
|
48
48
|
defaultVariants: {
|
|
49
49
|
xPosition: "center",
|
|
50
50
|
yPosition: "top",
|
package/web-types.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"framework": "vue",
|
|
3
3
|
"name": "vueless",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.145",
|
|
5
5
|
"contributions": {
|
|
6
6
|
"html": {
|
|
7
7
|
"description-markup": "markdown",
|
|
@@ -4508,11 +4508,21 @@
|
|
|
4508
4508
|
"attributes": [
|
|
4509
4509
|
{
|
|
4510
4510
|
"name": "loading",
|
|
4511
|
+
"description": "Set loader on.",
|
|
4511
4512
|
"value": {
|
|
4512
4513
|
"kind": "expression",
|
|
4513
4514
|
"type": "boolean"
|
|
4514
4515
|
},
|
|
4515
4516
|
"default": "false"
|
|
4517
|
+
},
|
|
4518
|
+
{
|
|
4519
|
+
"name": "color",
|
|
4520
|
+
"description": "Loader color.",
|
|
4521
|
+
"value": {
|
|
4522
|
+
"kind": "expression",
|
|
4523
|
+
"type": "'brand' | 'grayscale' | 'gray' | 'red' | 'orange' | 'amber' | 'yellow' | 'lime' | 'green' | 'emerald' | 'teal' | 'cyan' | 'sky' | 'blue' | 'indigo' | 'violet' | 'purple' | 'fuchsia' | 'pink' | 'rose' | 'white'"
|
|
4524
|
+
},
|
|
4525
|
+
"default": "brand"
|
|
4516
4526
|
}
|
|
4517
4527
|
],
|
|
4518
4528
|
"source": {
|