vueless 0.0.66 → 0.0.68
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 +11 -2
- package/package.json +3 -2
- package/ui.button-link/composables/attrs.composable.js +9 -2
- package/ui.button-link/index.vue +19 -3
- package/ui.loader-rendering/composables/useLoaderRendering.js +10 -2
- package/ui.loader-rendering/index.stories.js +1 -1
- package/ui.loader-rendering/index.vue +3 -4
- package/ui.loader-top/Docs.mdx +2 -2
- package/ui.loader-top/composables/useLoaderTop.js +10 -2
- package/ui.loader-top/index.stories.js +1 -1
- package/ui.loader-top/index.vue +1 -1
- package/web-types.json +19 -1
package/index.js
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { createLocale, LocaleSymbol } from "./composable.locale";
|
|
2
|
+
import {
|
|
3
|
+
createLoaderRendering,
|
|
4
|
+
LoaderRenderingSymbol,
|
|
5
|
+
} from "./ui.loader-rendering/composables/useLoaderRendering";
|
|
6
|
+
import { createLoaderTop, LoaderTopSymbol } from "./ui.loader-top/composables/useLoaderTop";
|
|
2
7
|
|
|
3
8
|
export { default as createVueI18nAdapter } from "./adatper.locale/vue-i18n";
|
|
4
9
|
export { default as defaultEnLocale } from "./adatper.locale/locales/en";
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
10
|
+
export { useLoaderRendering } from "./ui.loader-rendering/composables/useLoaderRendering";
|
|
11
|
+
export { useLoaderTop } from "./ui.loader-top/composables/useLoaderTop";
|
|
7
12
|
export { useLocale } from "./composable.locale";
|
|
8
13
|
export {
|
|
9
14
|
notify,
|
|
@@ -17,9 +22,13 @@ export {
|
|
|
17
22
|
|
|
18
23
|
export function createVueless(options = {}) {
|
|
19
24
|
const i18n = createLocale(options.i18n);
|
|
25
|
+
const loaderRenderingState = createLoaderRendering();
|
|
26
|
+
const loaderTopState = createLoaderTop();
|
|
20
27
|
|
|
21
28
|
const install = (app) => {
|
|
22
29
|
app.provide(LocaleSymbol, i18n);
|
|
30
|
+
app.provide(LoaderRenderingSymbol, loaderRenderingState);
|
|
31
|
+
app.provide(LoaderTopSymbol, loaderTopState);
|
|
23
32
|
};
|
|
24
33
|
|
|
25
34
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vueless",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.68",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Vue Styleless Component Framework.",
|
|
6
6
|
"homepage": "https://vueless.com",
|
|
@@ -58,7 +58,8 @@
|
|
|
58
58
|
"vite": "^5.2.10",
|
|
59
59
|
"vite-plugin-compression": "^0.5.1",
|
|
60
60
|
"vite-plugin-eslint": "^1.8.1",
|
|
61
|
-
"vue": "^3.4.25"
|
|
61
|
+
"vue": "^3.4.25",
|
|
62
|
+
"vue-router": "^4.3.2"
|
|
62
63
|
},
|
|
63
64
|
"resolutions": {
|
|
64
65
|
"jackspeak": "2.3.6"
|
|
@@ -5,7 +5,7 @@ import { cva, cx } from "../../service.ui";
|
|
|
5
5
|
|
|
6
6
|
import defaultConfig from "../configs/default.config";
|
|
7
7
|
|
|
8
|
-
export function useAttrs(props) {
|
|
8
|
+
export function useAttrs(props, { isActive, isExactActive }) {
|
|
9
9
|
const slots = useSlots();
|
|
10
10
|
|
|
11
11
|
const { config, getAttrs, hasSlotContent, setColor } = useUI(defaultConfig, () => props.config);
|
|
@@ -88,6 +88,8 @@ export function useAttrs(props) {
|
|
|
88
88
|
class: cx([
|
|
89
89
|
wrapperAttrsRaw.value.class,
|
|
90
90
|
(hasDefaultSlot || hasLeftSlot || hasRightSlot) && config.value.withSlots,
|
|
91
|
+
isActive.value && props.wrapperActiveClass,
|
|
92
|
+
isExactActive.value && props.wrapperExactActiveClass,
|
|
91
93
|
]),
|
|
92
94
|
};
|
|
93
95
|
});
|
|
@@ -99,7 +101,12 @@ export function useAttrs(props) {
|
|
|
99
101
|
|
|
100
102
|
return {
|
|
101
103
|
...linkAttrsRaw.value,
|
|
102
|
-
class: cx([
|
|
104
|
+
class: cx([
|
|
105
|
+
linkAttrsRaw.value.class,
|
|
106
|
+
hasDefaultSlot && config.value.withSlots,
|
|
107
|
+
isActive.value && props.activeClass,
|
|
108
|
+
isExactActive.value && props.exactActiveClass,
|
|
109
|
+
]),
|
|
103
110
|
};
|
|
104
111
|
});
|
|
105
112
|
|
package/ui.button-link/index.vue
CHANGED
|
@@ -10,8 +10,6 @@
|
|
|
10
10
|
:to="route"
|
|
11
11
|
:target="targetValue"
|
|
12
12
|
:data-cy="dataCy"
|
|
13
|
-
:active-class="activeClass"
|
|
14
|
-
:exact-active-class="exactActiveClass"
|
|
15
13
|
v-bind="linkAttrs"
|
|
16
14
|
@blur="onBlur"
|
|
17
15
|
@click="onClick"
|
|
@@ -52,6 +50,7 @@
|
|
|
52
50
|
|
|
53
51
|
<script setup>
|
|
54
52
|
import { computed, useSlots, ref } from "vue";
|
|
53
|
+
import { RouterLink, useLink } from "vue-router";
|
|
55
54
|
import UIService from "../service.ui";
|
|
56
55
|
|
|
57
56
|
import { useAttrs } from "./composables/attrs.composable";
|
|
@@ -139,6 +138,22 @@ const props = defineProps({
|
|
|
139
138
|
default: UIService.get(defaultConfig, ULink).default.exactActiveClass,
|
|
140
139
|
},
|
|
141
140
|
|
|
141
|
+
/**
|
|
142
|
+
* Apply classes to the wrapper div when link route is active or when it matches any parent route.
|
|
143
|
+
*/
|
|
144
|
+
wrapperActiveClass: {
|
|
145
|
+
type: Boolean,
|
|
146
|
+
default: UIService.get(defaultConfig, ULink).default.wrapperActiveClass,
|
|
147
|
+
},
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Apply classes to the wrapper div when link route is active.
|
|
151
|
+
*/
|
|
152
|
+
wrapperExactActiveClass: {
|
|
153
|
+
type: Boolean,
|
|
154
|
+
default: UIService.get(defaultConfig, ULink).default.wrapperExactActiveClass,
|
|
155
|
+
},
|
|
156
|
+
|
|
142
157
|
/**
|
|
143
158
|
* Show underline.
|
|
144
159
|
*/
|
|
@@ -197,13 +212,14 @@ const props = defineProps({
|
|
|
197
212
|
});
|
|
198
213
|
|
|
199
214
|
const slots = useSlots();
|
|
215
|
+
const { route, isActive, isExactActive } = useLink({ to: props.route });
|
|
200
216
|
|
|
201
217
|
const wrapperRef = ref(null);
|
|
202
218
|
|
|
203
219
|
defineExpose({ wrapperRef });
|
|
204
220
|
|
|
205
221
|
const { wrapperAttrs, linkAttrs, rightSlotAttrs, leftSlotAttrs, textAttrs, hasSlotContent } =
|
|
206
|
-
useAttrs(props);
|
|
222
|
+
useAttrs(props, { isActive, isExactActive });
|
|
207
223
|
|
|
208
224
|
const targetValue = computed(() => {
|
|
209
225
|
return props.targetBlank ? "_blank" : "_self";
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { readonly, ref } from "vue";
|
|
1
|
+
import { readonly, ref, inject } from "vue";
|
|
2
|
+
|
|
3
|
+
export const LoaderRenderingSymbol = Symbol.for("vueless:loader-rendering");
|
|
2
4
|
|
|
3
5
|
const isRenderingPage = ref(true);
|
|
4
6
|
|
|
@@ -10,10 +12,16 @@ function setRenderingFinished() {
|
|
|
10
12
|
isRenderingPage.value = false;
|
|
11
13
|
}
|
|
12
14
|
|
|
13
|
-
export
|
|
15
|
+
export function createLoaderRendering() {
|
|
14
16
|
return {
|
|
15
17
|
isRenderingPage: readonly(isRenderingPage),
|
|
16
18
|
setRenderingStarted,
|
|
17
19
|
setRenderingFinished,
|
|
18
20
|
};
|
|
19
21
|
}
|
|
22
|
+
|
|
23
|
+
export function useLoaderRendering() {
|
|
24
|
+
const loaderRenderingState = inject(LoaderRenderingSymbol);
|
|
25
|
+
|
|
26
|
+
return loaderRenderingState;
|
|
27
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import ULoaderRendering from "../ui.loader-rendering";
|
|
2
2
|
import UButton from "../ui.button";
|
|
3
3
|
|
|
4
|
-
import useLoaderRendering from "./composables/useLoaderRendering";
|
|
4
|
+
import { useLoaderRendering } from "./composables/useLoaderRendering";
|
|
5
5
|
|
|
6
6
|
import { getArgTypes } from "../service.storybook";
|
|
7
7
|
|
|
@@ -13,8 +13,7 @@
|
|
|
13
13
|
import { computed } from "vue";
|
|
14
14
|
|
|
15
15
|
import { useAttrs } from "./composables/attrs.composable";
|
|
16
|
-
|
|
17
|
-
// import useLoaderRendering from "./composables/useLoaderRendering";
|
|
16
|
+
import { useLoaderRendering } from "./composables/useLoaderRendering";
|
|
18
17
|
|
|
19
18
|
/* Should be a string for correct web-types gen */
|
|
20
19
|
defineOptions({ name: "ULoaderRendering", inheritAttrs: false });
|
|
@@ -27,10 +26,10 @@ const props = defineProps({
|
|
|
27
26
|
});
|
|
28
27
|
|
|
29
28
|
const { wrapperAttrs, loaderAttrs, rippleAttrs, rippleElementAttrs, config } = useAttrs(props);
|
|
30
|
-
|
|
29
|
+
const { isRenderingPage } = useLoaderRendering();
|
|
31
30
|
|
|
32
31
|
const showLoader = computed(() => {
|
|
33
|
-
return props.loading
|
|
32
|
+
return props.loading || isRenderingPage.value;
|
|
34
33
|
});
|
|
35
34
|
</script>
|
|
36
35
|
|
package/ui.loader-top/Docs.mdx
CHANGED
|
@@ -19,7 +19,7 @@ import defaultConfig from "./configs/default.config?raw"
|
|
|
19
19
|
You can control loader state using *useLoaderRendering* composable.
|
|
20
20
|
|
|
21
21
|
<Source code={`
|
|
22
|
-
import {
|
|
22
|
+
import { useLoaderTop } from "vueless";
|
|
23
23
|
|
|
24
24
|
const {
|
|
25
25
|
setLoadingOn,
|
|
@@ -28,5 +28,5 @@ const {
|
|
|
28
28
|
removeRequestUrl,
|
|
29
29
|
setComponentRequestQueue,
|
|
30
30
|
removeComponentRequestQueue,
|
|
31
|
-
} =
|
|
31
|
+
} = useLoaderTop();
|
|
32
32
|
`} language="jsx" dark />
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { ref, readonly } from "vue";
|
|
1
|
+
import { ref, readonly, inject } from "vue";
|
|
2
|
+
|
|
3
|
+
export const LoaderTopSymbol = Symbol.for("vueless:loader-top");
|
|
2
4
|
|
|
3
5
|
const isLoading = ref(true);
|
|
4
6
|
const requestQueue = ref([]);
|
|
@@ -40,7 +42,7 @@ function removeComponentRequestQueue() {
|
|
|
40
42
|
componentLoaderRequestQueue.value = [];
|
|
41
43
|
}
|
|
42
44
|
|
|
43
|
-
export
|
|
45
|
+
export function createLoaderTop() {
|
|
44
46
|
return {
|
|
45
47
|
isLoading: readonly(isLoading),
|
|
46
48
|
requestQueue: readonly(requestQueue),
|
|
@@ -55,3 +57,9 @@ export default function useLoaderTop() {
|
|
|
55
57
|
removeComponentRequestQueue,
|
|
56
58
|
};
|
|
57
59
|
}
|
|
60
|
+
|
|
61
|
+
export function useLoaderTop() {
|
|
62
|
+
const loaderTopState = inject(LoaderTopSymbol);
|
|
63
|
+
|
|
64
|
+
return loaderTopState;
|
|
65
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import ULoaderTop from "../ui.loader-top";
|
|
2
2
|
import UButton from "../ui.button";
|
|
3
3
|
|
|
4
|
-
import useLoaderTop from "../ui.loader-top/composables/useLoaderTop";
|
|
4
|
+
import { useLoaderTop } from "../ui.loader-top/composables/useLoaderTop";
|
|
5
5
|
|
|
6
6
|
import { getArgTypes } from "../service.storybook";
|
|
7
7
|
|
package/ui.loader-top/index.vue
CHANGED
|
@@ -9,7 +9,7 @@ import { computed, onBeforeUnmount, watch, ref } from "vue";
|
|
|
9
9
|
|
|
10
10
|
import UIService, { isMobileApp } from "../service.ui";
|
|
11
11
|
import { clamp, queue } from "./services/loaderTop.service";
|
|
12
|
-
import useLoaderTop from "./composables/useLoaderTop";
|
|
12
|
+
import { useLoaderTop } from "./composables/useLoaderTop";
|
|
13
13
|
|
|
14
14
|
import { ULoaderTop, MAXIMUM, SPEED } from "./constants";
|
|
15
15
|
import defaultConfig from "./configs/default.config";
|
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.68",
|
|
5
5
|
"contributions": {
|
|
6
6
|
"html": {
|
|
7
7
|
"description-markup": "markdown",
|
|
@@ -4302,6 +4302,24 @@
|
|
|
4302
4302
|
},
|
|
4303
4303
|
"default": "group/router-link-exact-active"
|
|
4304
4304
|
},
|
|
4305
|
+
{
|
|
4306
|
+
"name": "wrapperActiveClass",
|
|
4307
|
+
"description": "Apply classes to the wrapper div when link route is active or when it matches any parent route.",
|
|
4308
|
+
"value": {
|
|
4309
|
+
"kind": "expression",
|
|
4310
|
+
"type": "boolean"
|
|
4311
|
+
},
|
|
4312
|
+
"default": "UIService.get(defaultConfig, ULink).default.wrapperActiveClass"
|
|
4313
|
+
},
|
|
4314
|
+
{
|
|
4315
|
+
"name": "wrapperExactActiveClass",
|
|
4316
|
+
"description": "Apply classes to the wrapper div when link route is active.",
|
|
4317
|
+
"value": {
|
|
4318
|
+
"kind": "expression",
|
|
4319
|
+
"type": "boolean"
|
|
4320
|
+
},
|
|
4321
|
+
"default": "UIService.get(defaultConfig, ULink).default.wrapperExactActiveClass"
|
|
4322
|
+
},
|
|
4305
4323
|
{
|
|
4306
4324
|
"name": "underlined",
|
|
4307
4325
|
"description": "Show underline.",
|