@vrojs/base 0.0.5 → 0.0.7
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/dist/style/index.css +1 -1
- package/dist/vro-circle-progress/index.d.ts +19 -9
- package/dist/vro-circle-progress/style/index.css +1 -1
- package/dist/vro-circle-progress/types.d.ts +4 -1
- package/dist/vro-circle-progress/types.js +3 -3
- package/dist/vro-circle-progress/vro-circle-progress.vue.d.ts +9 -5
- package/dist/vro-circle-progress/vro-circle-progress.vue.js +63 -52
- package/package.json +1 -1
package/dist/style/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@charset "UTF-8";.vro-aspect-ratio{position:relative}.vro-aspect-ratio-inner{position:relative;width:100%}.vro-aspect-ratio-content{position:absolute;top:0;left:0;width:100%;height:100%}:root,:host{--vro-circle-progress-size: 100px;--vro-circle-progress-color: currentColor;--vro-circle-progress-background-color: rgba(0, 0, 0, .08);--vro-circle-progress-duration: .3s;--vro-circle-progress-curve: ease;--vro-circle-progress-content-color: currentColor;--vro-circle-progress-content-font-size: 16px}.vro-circle-progress{position:relative;display:inline-flex;align-items:center;justify-content:center;width:var(--size);height:var(--size);color:var(--vro-circle-progress-content-color);font-size:var(--vro-circle-progress-content-font-size);line-height:1;vertical-align:middle}.vro-circle-progress-svg{
|
|
1
|
+
@charset "UTF-8";.vro-aspect-ratio{position:relative}.vro-aspect-ratio-inner{position:relative;width:100%}.vro-aspect-ratio-content{position:absolute;top:0;left:0;width:100%;height:100%}:root,:host{--vro-circle-progress-size: 100px;--vro-circle-progress-color: currentColor;--vro-circle-progress-background-color: rgba(0, 0, 0, .08);--vro-circle-progress-duration: .3s;--vro-circle-progress-curve: ease;--vro-circle-progress-content-color: currentColor;--vro-circle-progress-content-font-size: 16px}.vro-circle-progress{position:relative;display:inline-flex;align-items:center;justify-content:center;width:var(--size);height:var(--size);color:var(--vro-circle-progress-content-color);font-size:var(--vro-circle-progress-content-font-size);line-height:1;vertical-align:middle}.vro-circle-progress-svg{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}.vro-circle-progress-track{stroke:var(--background-color)}.vro-circle-progress-line{stroke:var(--color);transition:stroke-dashoffset var(--duration) var(--curve),stroke var(--duration) var(--curve);transform:rotate(-90deg);transform-origin:50% 50%}:root,:host{--vro-icon-duration: 2s;--vro-icon-size: inherit;--vro-icon-color: inherit}.vro-icon{display:inline-flex;justify-content:center;align-items:center;position:relative;fill:currentColor;line-height:1em;font-size:var(--size);color:var(--color);text-rendering:auto;-webkit-font-smoothing:antialiased}.vro-icon img{display:block;width:1em;height:1em;object-fit:contain}.vro-icon svg{height:1em;width:1em;fill:currentColor;stroke:currentColor}.vro-icon.is-loading{animation:rotating var(--duration) linear infinite}@keyframes rotating{0%{transform:rotate(0)}to{transform:rotate(360deg)}}:root,:host{--vro-loading-size: 24px;--vro-loading-color: currentColor;--vro-loading-circular-duration: 1.6s;--vro-loading-spinner-duration: 1.2s;--vro-loading-dots-duration: 1s;--vro-loading-image-duration: 1.2s}.vro-loading{display:inline-flex;align-items:center;justify-content:center;color:var(--color);line-height:1;vertical-align:middle}.vro-loading-circular{width:var(--size);height:var(--size);animation:vro-loading-rotate var(--duration) linear infinite}.vro-loading-circular circle{stroke:currentColor;stroke-width:4;stroke-linecap:round;stroke-dasharray:90,150;stroke-dashoffset:0;animation:vro-loading-circular var(--duration) ease-in-out infinite}.vro-loading-spinner{width:var(--size);height:var(--size);animation:vro-loading-fade var(--duration) linear infinite}.vro-loading-dots{display:inline-flex;align-items:center;justify-content:center;gap:calc(var(--size) * .12);width:var(--size);height:var(--size)}.vro-loading-dots i{width:calc(var(--size) * .18);height:calc(var(--size) * .18);background:currentColor;border-radius:50%;animation:vro-loading-dot var(--duration) ease-in-out infinite}.vro-loading-dots i:nth-child(2){animation-delay:.15s}.vro-loading-dots i:nth-child(3){animation-delay:.3s}.vro-loading-image{display:grid;grid-template-columns:repeat(2,1fr);grid-template-rows:repeat(2,1fr);gap:max(1px,var(--size) * .14);width:var(--size);height:var(--size)}.vro-loading-image i{background:currentColor;opacity:.16}.vro-loading-image i:nth-child(1){animation:vro-loading-image-1 var(--duration) linear infinite}.vro-loading-image i:nth-child(2){animation:vro-loading-image-2 var(--duration) linear infinite}.vro-loading-image i:nth-child(3){animation:vro-loading-image-4 var(--duration) linear infinite}.vro-loading-image i:nth-child(4){animation:vro-loading-image-3 var(--duration) linear infinite}@keyframes vro-loading-rotate{to{transform:rotate(360deg)}}@keyframes vro-loading-circular{0%{stroke-dasharray:1,200;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-40}to{stroke-dasharray:90,150;stroke-dashoffset:-120}}@keyframes vro-loading-fade{to{transform:rotate(360deg)}}@keyframes vro-loading-dot{0%,80%,to{opacity:.35;transform:scale(.72)}40%{opacity:1;transform:scale(1)}}@keyframes vro-loading-image-1{0%,12.5%,to{opacity:.86}25%,87.5%{opacity:.16}}@keyframes vro-loading-image-2{0%,to{opacity:.16}12.5%,37.5%{opacity:.86}50%{opacity:.16}}@keyframes vro-loading-image-3{0%,25%,to{opacity:.16}37.5%,62.5%{opacity:.86}75%{opacity:.16}}@keyframes vro-loading-image-4{0%,50%,to{opacity:.16}62.5%,87.5%{opacity:.86}}
|
|
@@ -10,7 +10,7 @@ export declare const VroCircleProgress: import('..').WithInstall<{
|
|
|
10
10
|
default: number;
|
|
11
11
|
};
|
|
12
12
|
strokeWidth: {
|
|
13
|
-
type:
|
|
13
|
+
type: import('vue').PropType<string | number>;
|
|
14
14
|
default: number;
|
|
15
15
|
};
|
|
16
16
|
strokeLinecap: {
|
|
@@ -24,10 +24,14 @@ export declare const VroCircleProgress: import('..').WithInstall<{
|
|
|
24
24
|
color: StringConstructor;
|
|
25
25
|
backgroundColor: StringConstructor;
|
|
26
26
|
curve: StringConstructor;
|
|
27
|
-
}>> & Readonly<{
|
|
27
|
+
}>> & Readonly<{
|
|
28
|
+
onFinish?: ((value: number) => any) | undefined;
|
|
29
|
+
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
30
|
+
finish: (value: number) => any;
|
|
31
|
+
}, import('vue').PublicProps, {
|
|
28
32
|
size: string | number;
|
|
29
33
|
modelValue: number;
|
|
30
|
-
strokeWidth: number;
|
|
34
|
+
strokeWidth: string | number;
|
|
31
35
|
strokeLinecap: import('./types').VroCircleProgressStrokeLinecap;
|
|
32
36
|
duration: string | number;
|
|
33
37
|
}, true, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, HTMLDivElement, import('vue').ComponentProvideOptions, {
|
|
@@ -47,7 +51,7 @@ export declare const VroCircleProgress: import('..').WithInstall<{
|
|
|
47
51
|
default: number;
|
|
48
52
|
};
|
|
49
53
|
strokeWidth: {
|
|
50
|
-
type:
|
|
54
|
+
type: import('vue').PropType<string | number>;
|
|
51
55
|
default: number;
|
|
52
56
|
};
|
|
53
57
|
strokeLinecap: {
|
|
@@ -61,10 +65,12 @@ export declare const VroCircleProgress: import('..').WithInstall<{
|
|
|
61
65
|
color: StringConstructor;
|
|
62
66
|
backgroundColor: StringConstructor;
|
|
63
67
|
curve: StringConstructor;
|
|
64
|
-
}>> & Readonly<{
|
|
68
|
+
}>> & Readonly<{
|
|
69
|
+
onFinish?: ((value: number) => any) | undefined;
|
|
70
|
+
}>, {}, {}, {}, {}, {
|
|
65
71
|
size: string | number;
|
|
66
72
|
modelValue: number;
|
|
67
|
-
strokeWidth: number;
|
|
73
|
+
strokeWidth: string | number;
|
|
68
74
|
strokeLinecap: import('./types').VroCircleProgressStrokeLinecap;
|
|
69
75
|
duration: string | number;
|
|
70
76
|
}>;
|
|
@@ -81,7 +87,7 @@ export declare const VroCircleProgress: import('..').WithInstall<{
|
|
|
81
87
|
default: number;
|
|
82
88
|
};
|
|
83
89
|
strokeWidth: {
|
|
84
|
-
type:
|
|
90
|
+
type: import('vue').PropType<string | number>;
|
|
85
91
|
default: number;
|
|
86
92
|
};
|
|
87
93
|
strokeLinecap: {
|
|
@@ -95,10 +101,14 @@ export declare const VroCircleProgress: import('..').WithInstall<{
|
|
|
95
101
|
color: StringConstructor;
|
|
96
102
|
backgroundColor: StringConstructor;
|
|
97
103
|
curve: StringConstructor;
|
|
98
|
-
}>> & Readonly<{
|
|
104
|
+
}>> & Readonly<{
|
|
105
|
+
onFinish?: ((value: number) => any) | undefined;
|
|
106
|
+
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
107
|
+
finish: (value: number) => any;
|
|
108
|
+
}, string, {
|
|
99
109
|
size: string | number;
|
|
100
110
|
modelValue: number;
|
|
101
|
-
strokeWidth: number;
|
|
111
|
+
strokeWidth: string | number;
|
|
102
112
|
strokeLinecap: import('./types').VroCircleProgressStrokeLinecap;
|
|
103
113
|
duration: string | number;
|
|
104
114
|
}, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & (new () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
:root,:host{--vro-circle-progress-size: 100px;--vro-circle-progress-color: currentColor;--vro-circle-progress-background-color: rgba(0, 0, 0, .08);--vro-circle-progress-duration: .3s;--vro-circle-progress-curve: ease;--vro-circle-progress-content-color: currentColor;--vro-circle-progress-content-font-size: 16px}.vro-circle-progress{position:relative;display:inline-flex;align-items:center;justify-content:center;width:var(--size);height:var(--size);color:var(--vro-circle-progress-content-color);font-size:var(--vro-circle-progress-content-font-size);line-height:1;vertical-align:middle}.vro-circle-progress-svg{
|
|
1
|
+
:root,:host{--vro-circle-progress-size: 100px;--vro-circle-progress-color: currentColor;--vro-circle-progress-background-color: rgba(0, 0, 0, .08);--vro-circle-progress-duration: .3s;--vro-circle-progress-curve: ease;--vro-circle-progress-content-color: currentColor;--vro-circle-progress-content-font-size: 16px}.vro-circle-progress{position:relative;display:inline-flex;align-items:center;justify-content:center;width:var(--size);height:var(--size);color:var(--vro-circle-progress-content-color);font-size:var(--vro-circle-progress-content-font-size);line-height:1;vertical-align:middle}.vro-circle-progress-svg{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}.vro-circle-progress-track{stroke:var(--background-color)}.vro-circle-progress-line{stroke:var(--color);transition:stroke-dashoffset var(--duration) var(--curve),stroke var(--duration) var(--curve);transform:rotate(-90deg);transform-origin:50% 50%}
|
|
@@ -19,7 +19,7 @@ export declare const vroCircleProgressProps: {
|
|
|
19
19
|
* 进度条宽度。
|
|
20
20
|
*/
|
|
21
21
|
strokeWidth: {
|
|
22
|
-
type:
|
|
22
|
+
type: PropType<string | number>;
|
|
23
23
|
default: number;
|
|
24
24
|
};
|
|
25
25
|
/**
|
|
@@ -54,4 +54,7 @@ export interface VroCircleProgressSlots {
|
|
|
54
54
|
value: number;
|
|
55
55
|
}) => any;
|
|
56
56
|
}
|
|
57
|
+
export interface VroCircleProgressEmits {
|
|
58
|
+
finish: [value: number];
|
|
59
|
+
}
|
|
57
60
|
export type VroCircleProgressProps = ExtractPropTypes<typeof vroCircleProgressProps>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const r = {
|
|
2
2
|
/**
|
|
3
3
|
* 当前进度,取值范围为 0 ~ 100。
|
|
4
4
|
*/
|
|
@@ -17,7 +17,7 @@ const e = {
|
|
|
17
17
|
* 进度条宽度。
|
|
18
18
|
*/
|
|
19
19
|
strokeWidth: {
|
|
20
|
-
type: Number,
|
|
20
|
+
type: [Number, String],
|
|
21
21
|
default: 10
|
|
22
22
|
},
|
|
23
23
|
/**
|
|
@@ -48,5 +48,5 @@ const e = {
|
|
|
48
48
|
curve: String
|
|
49
49
|
};
|
|
50
50
|
export {
|
|
51
|
-
|
|
51
|
+
r as vroCircleProgressProps
|
|
52
52
|
};
|
|
@@ -16,7 +16,7 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
16
16
|
default: number;
|
|
17
17
|
};
|
|
18
18
|
strokeWidth: {
|
|
19
|
-
type:
|
|
19
|
+
type: import('vue').PropType<string | number>;
|
|
20
20
|
default: number;
|
|
21
21
|
};
|
|
22
22
|
strokeLinecap: {
|
|
@@ -30,7 +30,9 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
30
30
|
color: StringConstructor;
|
|
31
31
|
backgroundColor: StringConstructor;
|
|
32
32
|
curve: StringConstructor;
|
|
33
|
-
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
33
|
+
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
34
|
+
finish: (value: number) => any;
|
|
35
|
+
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
34
36
|
modelValue: {
|
|
35
37
|
type: NumberConstructor;
|
|
36
38
|
default: number;
|
|
@@ -40,7 +42,7 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
40
42
|
default: number;
|
|
41
43
|
};
|
|
42
44
|
strokeWidth: {
|
|
43
|
-
type:
|
|
45
|
+
type: import('vue').PropType<string | number>;
|
|
44
46
|
default: number;
|
|
45
47
|
};
|
|
46
48
|
strokeLinecap: {
|
|
@@ -54,10 +56,12 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
54
56
|
color: StringConstructor;
|
|
55
57
|
backgroundColor: StringConstructor;
|
|
56
58
|
curve: StringConstructor;
|
|
57
|
-
}>> & Readonly<{
|
|
59
|
+
}>> & Readonly<{
|
|
60
|
+
onFinish?: ((value: number) => any) | undefined;
|
|
61
|
+
}>, {
|
|
58
62
|
size: string | number;
|
|
59
63
|
modelValue: number;
|
|
60
|
-
strokeWidth: number;
|
|
64
|
+
strokeWidth: string | number;
|
|
61
65
|
strokeLinecap: import('./types').VroCircleProgressStrokeLinecap;
|
|
62
66
|
duration: string | number;
|
|
63
67
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
|
|
@@ -1,72 +1,83 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { clamp as
|
|
3
|
-
import { addUnit as
|
|
4
|
-
import { vroCircleProgressProps as
|
|
5
|
-
const
|
|
6
|
-
class: "vro-circle-progress-svg",
|
|
7
|
-
viewBox: "0 0 100 100"
|
|
8
|
-
}, x = ["r", "stroke-width"], b = ["r", "stroke-width", "stroke-linecap", "stroke-dasharray", "stroke-dashoffset"], z = { class: "vro-circle-progress-content" }, s = 50, B = /* @__PURE__ */ p({
|
|
1
|
+
import { defineComponent as y, computed as x, createElementBlock as l, openBlock as u, normalizeStyle as _, renderSlot as b, createElementVNode as v, createTextVNode as w, toDisplayString as N } from "vue";
|
|
2
|
+
import { clamp as d } from "@daysnap/utils";
|
|
3
|
+
import { addUnit as m } from "../utils/addUnit.js";
|
|
4
|
+
import { vroCircleProgressProps as z } from "./types.js";
|
|
5
|
+
const B = ["aria-valuenow"], V = ["viewBox"], W = ["cx", "cy", "r", "stroke-width"], C = ["cx", "cy", "r", "stroke-width", "stroke-linecap", "stroke-dasharray", "stroke-dashoffset"], F = /* @__PURE__ */ y({
|
|
9
6
|
name: "VroCircleProgress",
|
|
10
7
|
__name: "vro-circle-progress",
|
|
11
|
-
props:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
props: z,
|
|
9
|
+
emits: ["finish"],
|
|
10
|
+
setup(p, { emit: f }) {
|
|
11
|
+
const s = p, h = f, a = (r) => {
|
|
12
|
+
const o = Number(r);
|
|
13
|
+
return Number.isFinite(o) ? o : void 0;
|
|
14
|
+
}, k = (r) => {
|
|
15
|
+
if (typeof r == "number") return r;
|
|
16
|
+
const o = Number.parseFloat(r);
|
|
17
|
+
return Number.isFinite(o) ? r.trim().endsWith("ms") ? o : o * 1e3 : 0;
|
|
18
|
+
}, e = x(() => {
|
|
19
|
+
const r = a(s.size) || 100, o = r / 2, t = d(0, s.modelValue, 100), c = d(0, a(s.strokeWidth) || 0, r), i = o - c / 2, n = 2 * Math.PI * i;
|
|
15
20
|
return {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
center: o,
|
|
22
|
+
value: t,
|
|
23
|
+
strokeWidth: c,
|
|
24
|
+
radius: i,
|
|
25
|
+
circumference: n,
|
|
26
|
+
viewBox: `0 0 ${r} ${r}`,
|
|
27
|
+
strokeDashoffset: n * (1 - t / 100),
|
|
28
|
+
text: `${Math.round(t)}%`,
|
|
22
29
|
style: {
|
|
23
|
-
"--size":
|
|
24
|
-
"--color":
|
|
25
|
-
"--background-color":
|
|
26
|
-
"--duration":
|
|
27
|
-
"--curve":
|
|
30
|
+
"--size": m(s.size) || "var(--vro-circle-progress-size)",
|
|
31
|
+
"--color": s.color || "var(--vro-circle-progress-color)",
|
|
32
|
+
"--background-color": s.backgroundColor || "var(--vro-circle-progress-background-color)",
|
|
33
|
+
"--duration": m(s.duration, "ms") || "var(--vro-circle-progress-duration)",
|
|
34
|
+
"--curve": s.curve || "var(--vro-circle-progress-curve)"
|
|
28
35
|
}
|
|
29
36
|
};
|
|
30
|
-
})
|
|
31
|
-
|
|
37
|
+
}), g = (r) => {
|
|
38
|
+
r.propertyName !== "stroke-dashoffset" || k(s.duration) <= 0 || h("finish", e.value.value);
|
|
39
|
+
};
|
|
40
|
+
return (r, o) => (u(), l("div", {
|
|
32
41
|
class: "vro-circle-progress",
|
|
33
|
-
style:
|
|
42
|
+
style: _(e.value.style),
|
|
34
43
|
role: "progressbar",
|
|
35
|
-
"aria-valuenow":
|
|
44
|
+
"aria-valuenow": e.value.value,
|
|
36
45
|
"aria-valuemin": "0",
|
|
37
46
|
"aria-valuemax": "100"
|
|
38
47
|
}, [
|
|
39
|
-
(
|
|
40
|
-
|
|
48
|
+
(u(), l("svg", {
|
|
49
|
+
class: "vro-circle-progress-svg",
|
|
50
|
+
viewBox: e.value.viewBox
|
|
51
|
+
}, [
|
|
52
|
+
v("circle", {
|
|
41
53
|
class: "vro-circle-progress-track",
|
|
42
|
-
cx:
|
|
43
|
-
cy:
|
|
44
|
-
r:
|
|
54
|
+
cx: e.value.center,
|
|
55
|
+
cy: e.value.center,
|
|
56
|
+
r: e.value.radius,
|
|
45
57
|
fill: "none",
|
|
46
|
-
"stroke-width":
|
|
47
|
-
}, null, 8,
|
|
48
|
-
|
|
58
|
+
"stroke-width": e.value.strokeWidth
|
|
59
|
+
}, null, 8, W),
|
|
60
|
+
v("circle", {
|
|
49
61
|
class: "vro-circle-progress-line",
|
|
50
|
-
cx:
|
|
51
|
-
cy:
|
|
52
|
-
r:
|
|
62
|
+
cx: e.value.center,
|
|
63
|
+
cy: e.value.center,
|
|
64
|
+
r: e.value.radius,
|
|
53
65
|
fill: "none",
|
|
54
|
-
"stroke-width":
|
|
55
|
-
"stroke-linecap":
|
|
56
|
-
"stroke-dasharray":
|
|
57
|
-
"stroke-dashoffset":
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
])
|
|
66
|
+
"stroke-width": e.value.strokeWidth,
|
|
67
|
+
"stroke-linecap": r.strokeLinecap,
|
|
68
|
+
"stroke-dasharray": e.value.circumference,
|
|
69
|
+
"stroke-dashoffset": e.value.strokeDashoffset,
|
|
70
|
+
onTransitionend: g
|
|
71
|
+
}, null, 40, C)
|
|
72
|
+
], 8, V)),
|
|
73
|
+
b(r.$slots, "default", {
|
|
74
|
+
value: e.value.value
|
|
75
|
+
}, () => [
|
|
76
|
+
w(N(e.value.text), 1)
|
|
66
77
|
])
|
|
67
|
-
], 12,
|
|
78
|
+
], 12, B));
|
|
68
79
|
}
|
|
69
80
|
});
|
|
70
81
|
export {
|
|
71
|
-
|
|
82
|
+
F as default
|
|
72
83
|
};
|