@unicom-cloud/ui 0.8.97 → 0.8.98
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/liquid-fill/LiquidFill.js +146 -109
- package/package.json +1 -1
- package/style.css +1 -1
- package/types/pc/config-provider/interface.d.ts +6 -0
- package/types/pc/liquid-fill/LiquidFill.d.ts +99 -14
- package/types/pc/liquid-fill/index.d.ts +0 -2
- package/types/pc/tour/index.d.ts +2 -2
- package/version/index.js +1 -1
- package/liquid-fill/interface.js +0 -1
- package/types/pc/liquid-fill/interface.d.ts +0 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useRef as
|
|
1
|
+
import { jsx as a, jsxs as x } from "react/jsx-runtime";
|
|
2
|
+
import { useContext as nt, useRef as P, useState as O, useEffect as j } from "react";
|
|
3
|
+
import "../config-provider/ConfigProvider.js";
|
|
3
4
|
import "@unicom-cloud/utils/case-name";
|
|
4
|
-
import
|
|
5
|
+
import at from "@unicom-cloud/utils/class-name";
|
|
5
6
|
import "../dist/tinycolor/chunk/BOzCVdr0.js";
|
|
6
7
|
import "@unicom-cloud/utils/constant/ui";
|
|
7
8
|
import "../utils/contextHolder.js";
|
|
@@ -24,7 +25,7 @@ import "lodash/debounce";
|
|
|
24
25
|
import "lodash/get";
|
|
25
26
|
import "lodash/has";
|
|
26
27
|
import "lodash/kebabCase";
|
|
27
|
-
import "lodash/merge";
|
|
28
|
+
import st from "lodash/merge";
|
|
28
29
|
import "lodash/mergeWith";
|
|
29
30
|
import "lodash/set";
|
|
30
31
|
import "lodash/setWith";
|
|
@@ -44,138 +45,174 @@ import "@unicom-cloud/utils/file/saveAs";
|
|
|
44
45
|
import "@unicom-cloud/utils/screenfull";
|
|
45
46
|
import "@unicom-cloud/utils/constant/ui.js";
|
|
46
47
|
import "@unicom-cloud/utils/tree";
|
|
47
|
-
import
|
|
48
|
-
import { v4 as
|
|
48
|
+
import "@unicom-cloud/utils/is";
|
|
49
|
+
import { v4 as b } from "uuid";
|
|
49
50
|
import "../dist/validate/src/index.js";
|
|
50
51
|
import "@unicom-cloud/utils/constant/keyboardCode";
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
))
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
52
|
+
import mt from "../config-provider/context.js";
|
|
53
|
+
const se = (D) => {
|
|
54
|
+
const { getPrefixCls: I, componentConfig: V } = nt(mt), {
|
|
55
|
+
style: _,
|
|
56
|
+
className: E,
|
|
57
|
+
value: A = 0.5,
|
|
58
|
+
size: i = 200,
|
|
59
|
+
fontSize: h,
|
|
60
|
+
waveColor: F = "rgb(var(--pqb-blue-6))",
|
|
61
|
+
backgroundColor: N = "var(--pqb-color-neutral-1)",
|
|
62
|
+
textColor: H = "var(--pqb-color-neutral-8)",
|
|
63
|
+
showPercent: Y = !0,
|
|
64
|
+
duration: y = 2e3,
|
|
65
|
+
waveCount: c = 3,
|
|
66
|
+
waveAmplitude: J = 10,
|
|
67
|
+
borderColor: q = "var(--pqb-color-neutral-4)",
|
|
68
|
+
borderWidth: g = 2,
|
|
69
|
+
outerBorderColor: K = q,
|
|
70
|
+
outerBorderWidth: w = 0,
|
|
71
|
+
borderGap: Q = 2,
|
|
72
|
+
decimalPlaces: U = 0,
|
|
73
|
+
percentFontScale: X = 0.5,
|
|
74
|
+
waveSpeedVariation: Z = 0.5
|
|
75
|
+
} = st({}, V?.LiquidFill, D), n = I?.("liquid-fill"), d = P({
|
|
76
|
+
clipPath: b(),
|
|
77
|
+
// 裁剪路径ID
|
|
78
|
+
waveGradient: b(),
|
|
79
|
+
// 波浪渐变ID
|
|
80
|
+
bgGradient: b()
|
|
81
|
+
// 背景渐变ID
|
|
82
|
+
}).current, tt = P(null), o = P({
|
|
83
|
+
fill: 0,
|
|
84
|
+
// 填充动画ID
|
|
85
|
+
wave: 0,
|
|
86
|
+
// 波浪动画ID
|
|
87
|
+
startTime: 0
|
|
88
|
+
// 动画开始时间
|
|
89
|
+
}).current, [$, G] = O(0), [et, z] = O([]), M = i / 2 - w / 2, W = M - Q - g / 2, m = W - g / 2, e = i / 2, S = m * 2, rt = S * ($ / 100) + g / 2, k = (r, t) => {
|
|
90
|
+
if (typeof t == "string") return null;
|
|
91
|
+
const { from: s, to: l, direction: p = "vertical" } = t;
|
|
92
|
+
return /* @__PURE__ */ x("linearGradient", { id: r, x1: "0%", y1: "0%", x2: p === "horizontal" ? "100%" : "0%", y2: p === "horizontal" ? "0%" : "100%", children: [
|
|
93
|
+
/* @__PURE__ */ a("stop", { offset: "0%", stopColor: s }),
|
|
94
|
+
/* @__PURE__ */ a("stop", { offset: "100%", stopColor: l })
|
|
95
|
+
] });
|
|
96
|
+
}, B = (r, t) => typeof r == "string" ? r : `url(#${t})`, ot = (r, t, s) => {
|
|
97
|
+
const l = [], v = e - m, L = e + m;
|
|
88
98
|
for (let f = 0; f <= 30; f++) {
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
r -
|
|
99
|
+
const u = v + f / 30 * S, C = Math.min(
|
|
100
|
+
e + m - rt + // 这里原来是减去 waterHeight,现在直接使用 waterHeight
|
|
101
|
+
r * Math.sin((u - v) * t + s),
|
|
102
|
+
e + m
|
|
92
103
|
);
|
|
93
|
-
|
|
104
|
+
l.push([u, C]);
|
|
94
105
|
}
|
|
95
|
-
return
|
|
96
|
-
},
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
), u.current = requestAnimationFrame(G);
|
|
100
|
-
}, j = (n) => {
|
|
101
|
-
h.current || (h.current = n);
|
|
102
|
-
const t = n - h.current, o = Math.min(t / g, 1) * q;
|
|
103
|
-
_(o), t < g ? l.current = requestAnimationFrame(j) : cancelAnimationFrame(l.current);
|
|
104
|
-
};
|
|
105
|
-
F(() => (h.current = 0, l.current = requestAnimationFrame(j), u.current = requestAnimationFrame(G), () => {
|
|
106
|
-
cancelAnimationFrame(l.current), cancelAnimationFrame(u.current);
|
|
107
|
-
}), [q, g, i]), F(() => () => {
|
|
108
|
-
cancelAnimationFrame(l.current), cancelAnimationFrame(u.current);
|
|
109
|
-
}, []);
|
|
110
|
-
const J = () => Array.from({ length: i }).map((n, t) => {
|
|
111
|
-
const o = E * (i - t) / i, c = 0.02 * (t + 1), k = T[t] || 0;
|
|
112
|
-
return /* @__PURE__ */ e(
|
|
106
|
+
return l.push([L, e + m]), l.push([v, e + m]), l.map(([f, u], C) => `${C === 0 ? "M" : "L"}${f} ${u}`).join(" ");
|
|
107
|
+
}, it = () => Array.from({ length: c }).map((r, t) => {
|
|
108
|
+
const s = J * (c - t) / c, l = 0.02 * (t + 1), p = et[t] || 0;
|
|
109
|
+
return /* @__PURE__ */ a(
|
|
113
110
|
"path",
|
|
114
111
|
{
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
112
|
+
className: `${n}-path`,
|
|
113
|
+
d: ot(s, l, p),
|
|
114
|
+
fill: B(F, d.waveGradient),
|
|
115
|
+
fillOpacity: 0.3 + 0.7 / c * t
|
|
118
116
|
},
|
|
119
117
|
t
|
|
120
118
|
);
|
|
121
|
-
})
|
|
122
|
-
|
|
119
|
+
}), R = () => {
|
|
120
|
+
z(
|
|
121
|
+
(r) => r.map(
|
|
122
|
+
(t, s) => t + 0.02 * (s + 1) * (1 + Z * Math.random())
|
|
123
|
+
)
|
|
124
|
+
), $ < 100 && (o.wave = requestAnimationFrame(R));
|
|
125
|
+
}, T = (r) => {
|
|
126
|
+
o.startTime || (o.startTime = r);
|
|
127
|
+
const t = r - o.startTime, s = Math.min(t / y, 1) * A * 100;
|
|
128
|
+
G(s), t < y && (o.fill = requestAnimationFrame(T));
|
|
129
|
+
};
|
|
130
|
+
return j(() => {
|
|
131
|
+
z(Array.from({ length: c }, (r, t) => t * Math.PI));
|
|
132
|
+
}, [c]), j(() => (cancelAnimationFrame(o.fill), cancelAnimationFrame(o.wave), o.startTime = 0, G(0), o.fill = requestAnimationFrame(T), o.wave = requestAnimationFrame(R), () => {
|
|
133
|
+
cancelAnimationFrame(o.fill), cancelAnimationFrame(o.wave);
|
|
134
|
+
}), [A, y, c]), /* @__PURE__ */ a(
|
|
123
135
|
"div",
|
|
124
136
|
{
|
|
125
|
-
className:
|
|
137
|
+
className: at(n, E),
|
|
126
138
|
style: {
|
|
127
|
-
width:
|
|
128
|
-
height:
|
|
129
|
-
|
|
130
|
-
lineHeight: 0,
|
|
131
|
-
...O
|
|
139
|
+
width: i,
|
|
140
|
+
height: i,
|
|
141
|
+
..._
|
|
132
142
|
},
|
|
133
143
|
children: /* @__PURE__ */ x(
|
|
134
144
|
"svg",
|
|
135
145
|
{
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
146
|
+
className: `${n}-svg`,
|
|
147
|
+
ref: tt,
|
|
148
|
+
width: i,
|
|
149
|
+
height: i,
|
|
150
|
+
viewBox: `0 0 ${i} ${i}`,
|
|
140
151
|
preserveAspectRatio: "xMidYMid meet",
|
|
141
152
|
children: [
|
|
142
|
-
/* @__PURE__ */ e(
|
|
143
|
-
"circle",
|
|
144
|
-
{
|
|
145
|
-
cx: m,
|
|
146
|
-
cy: m,
|
|
147
|
-
r: A,
|
|
148
|
-
fill: b,
|
|
149
|
-
stroke: H,
|
|
150
|
-
strokeWidth: a
|
|
151
|
-
}
|
|
152
|
-
),
|
|
153
153
|
/* @__PURE__ */ x("defs", { children: [
|
|
154
|
-
|
|
154
|
+
k(d.waveGradient, F),
|
|
155
|
+
k(d.bgGradient, N),
|
|
156
|
+
/* @__PURE__ */ a("clipPath", { id: d.clipPath, className: `${n}-clipPath`, children: /* @__PURE__ */ a(
|
|
155
157
|
"circle",
|
|
156
158
|
{
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
159
|
+
className: `${n}-clipPath-circle`,
|
|
160
|
+
cx: e,
|
|
161
|
+
cy: e,
|
|
162
|
+
r: m
|
|
160
163
|
}
|
|
161
|
-
) })
|
|
162
|
-
S
|
|
164
|
+
) })
|
|
163
165
|
] }),
|
|
164
|
-
/* @__PURE__ */
|
|
165
|
-
|
|
166
|
+
w > 0 && /* @__PURE__ */ a(
|
|
167
|
+
"circle",
|
|
168
|
+
{
|
|
169
|
+
className: `${n}-outerBorder`,
|
|
170
|
+
cx: e,
|
|
171
|
+
cy: e,
|
|
172
|
+
r: M,
|
|
173
|
+
fill: "none",
|
|
174
|
+
stroke: K,
|
|
175
|
+
strokeWidth: w,
|
|
176
|
+
strokeOpacity: 0.5
|
|
177
|
+
}
|
|
178
|
+
),
|
|
179
|
+
/* @__PURE__ */ a(
|
|
180
|
+
"circle",
|
|
181
|
+
{
|
|
182
|
+
className: `${n}-border`,
|
|
183
|
+
cx: e,
|
|
184
|
+
cy: e,
|
|
185
|
+
r: W,
|
|
186
|
+
fill: B(N, d.bgGradient),
|
|
187
|
+
stroke: q,
|
|
188
|
+
strokeWidth: g
|
|
189
|
+
}
|
|
190
|
+
),
|
|
191
|
+
/* @__PURE__ */ a("g", { className: `${n}-g`, clipPath: `url(#${d.clipPath})`, children: it() }),
|
|
192
|
+
Y && /* @__PURE__ */ x(
|
|
166
193
|
"text",
|
|
167
194
|
{
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
195
|
+
className: `${n}-text`,
|
|
196
|
+
x: e,
|
|
197
|
+
y: e,
|
|
198
|
+
fill: H,
|
|
199
|
+
fontSize: typeof h == "string" ? h : i * 0.15,
|
|
172
200
|
textAnchor: "middle",
|
|
173
201
|
dominantBaseline: "middle",
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
202
|
+
children: [
|
|
203
|
+
$.toFixed(U),
|
|
204
|
+
/* @__PURE__ */ a(
|
|
205
|
+
"tspan",
|
|
206
|
+
{
|
|
207
|
+
style: {
|
|
208
|
+
fontSize: `calc(${typeof h == "string" ? h : `${i * 0.15}px`} * ${X})`
|
|
209
|
+
},
|
|
210
|
+
className: `${n}-text-tspan`,
|
|
211
|
+
alignmentBaseline: "mathematical",
|
|
212
|
+
children: "%"
|
|
213
|
+
}
|
|
214
|
+
)
|
|
215
|
+
]
|
|
179
216
|
}
|
|
180
217
|
)
|
|
181
218
|
]
|
|
@@ -185,5 +222,5 @@ const Vr = ({
|
|
|
185
222
|
);
|
|
186
223
|
};
|
|
187
224
|
export {
|
|
188
|
-
|
|
225
|
+
se as default
|
|
189
226
|
};
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@unicom-cloud/ui","version":"0.8.
|
|
1
|
+
{"name":"@unicom-cloud/ui","version":"0.8.98","dependencies":{"@unicom-cloud/icons":"latest"},"peerDependencies":{"dayjs":"^1.11.10","lodash":"^4.17.21","react":"^18.3.1","react-dom":"^18.3.1"},"peerDependenciesMeta":{},"type":"module","types":"types/pc/index.d.ts","main":"./index.js","publishConfig":{"registry":"https://registry.npmjs.org/","access":"public"}}
|