cos-design 3.7.9 → 3.7.10
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/CHANGELOG.md +23 -0
- package/dist/index.cjs +2 -2
- package/dist/index.js +45 -38
- package/dist/src/components/nineGrid/index.d.ts +2 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -275,24 +275,25 @@ import './index.css';var p = {
|
|
|
275
275
|
"#60efff",
|
|
276
276
|
"#7b2ff7",
|
|
277
277
|
"#f107a3"
|
|
278
|
-
], A = ({ width: e, height: t, fill: n = !1, colors:
|
|
279
|
-
let { hostRef:
|
|
278
|
+
], A = ({ width: e, height: t, fill: n = !1, colors: i = k }) => {
|
|
279
|
+
let { hostRef: a, hostStyle: o } = D({
|
|
280
280
|
fill: n,
|
|
281
281
|
width: e,
|
|
282
282
|
height: t,
|
|
283
283
|
defaultWidth: 800,
|
|
284
284
|
defaultHeight: 500
|
|
285
|
-
}),
|
|
286
|
-
return /* @__PURE__ */ u("div", {
|
|
287
|
-
ref:
|
|
285
|
+
}), s = i.length >= 2 ? i : k, [l, d] = c(() => typeof document < "u" && document.hidden);
|
|
286
|
+
return r(() => b(d), []), /* @__PURE__ */ u("div", {
|
|
287
|
+
ref: a,
|
|
288
288
|
className: O.aurora,
|
|
289
|
-
style:
|
|
290
|
-
children:
|
|
289
|
+
style: o,
|
|
290
|
+
children: s.map((e, t) => /* @__PURE__ */ u("div", {
|
|
291
291
|
className: O.band,
|
|
292
292
|
style: {
|
|
293
293
|
"--aurora-color": e,
|
|
294
294
|
"--aurora-delay": `${t * -3}s`,
|
|
295
|
-
"--aurora-duration": `${12 + t * 2}s
|
|
295
|
+
"--aurora-duration": `${12 + t * 2}s`,
|
|
296
|
+
animationPlayState: l ? "paused" : "running"
|
|
296
297
|
}
|
|
297
298
|
}, e + t))
|
|
298
299
|
});
|
|
@@ -2883,48 +2884,48 @@ var Ae = {
|
|
|
2883
2884
|
let t = [...e?.length ? e : Dt];
|
|
2884
2885
|
for (; t.length < 9;) t.push({ label: `奖品 ${t.length + 1}` });
|
|
2885
2886
|
return t.slice(0, 9);
|
|
2886
|
-
}, kt = t(({ items: e = Dt, targetIndex: t, buttonText: i = "开始抽奖",
|
|
2887
|
-
let
|
|
2887
|
+
}, kt = t(({ items: e = Dt, targetIndex: t, buttonText: i = "开始抽奖", spinningText: o = "抽奖中…", onDrawEnd: l, disabled: f = !1 }, p) => {
|
|
2888
|
+
let m = Ot(e), [h, g] = c(null), [_, v] = c(null), [y, b] = c(!1), x = s([]), S = s(l), C = s(t);
|
|
2888
2889
|
r(() => {
|
|
2889
|
-
|
|
2890
|
-
}, [
|
|
2891
|
-
|
|
2890
|
+
S.current = l;
|
|
2891
|
+
}, [l]), r(() => {
|
|
2892
|
+
C.current = t;
|
|
2892
2893
|
}, [t]);
|
|
2893
|
-
let C = n(() => {
|
|
2894
|
-
b.current.forEach((e) => window.clearTimeout(e)), b.current = [];
|
|
2895
|
-
}, []);
|
|
2896
|
-
r(() => C, [C]);
|
|
2897
2894
|
let w = n(() => {
|
|
2898
|
-
|
|
2899
|
-
}, [
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2895
|
+
x.current.forEach((e) => window.clearTimeout(e)), x.current = [];
|
|
2896
|
+
}, []);
|
|
2897
|
+
r(() => w, [w]);
|
|
2898
|
+
let T = n(() => {
|
|
2899
|
+
w(), b(!1), g(null), v(null);
|
|
2900
|
+
}, [w]), E = n((e) => {
|
|
2901
|
+
if (y || f) return;
|
|
2902
|
+
w(), v(null), b(!0);
|
|
2903
|
+
let t = ((typeof e == "number" ? e : typeof C.current == "number" ? C.current : Math.floor(Math.random() * 9)) % 9 + 9) % 9, n = 18 + t, r = 0, i = () => {
|
|
2904
|
+
if (g(r % 9), r += 1, r > n) {
|
|
2905
|
+
g(t), v(t), b(!1), S.current?.(m[t], t);
|
|
2905
2906
|
return;
|
|
2906
2907
|
}
|
|
2907
2908
|
let e = 60 + Math.floor(r * 12);
|
|
2908
|
-
|
|
2909
|
+
x.current.push(window.setTimeout(i, e));
|
|
2909
2910
|
};
|
|
2910
2911
|
i();
|
|
2911
2912
|
}, [
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2913
|
+
m,
|
|
2914
|
+
w,
|
|
2915
|
+
f,
|
|
2916
|
+
y
|
|
2916
2917
|
]);
|
|
2917
|
-
return a(
|
|
2918
|
-
draw:
|
|
2919
|
-
reset:
|
|
2920
|
-
}), [
|
|
2918
|
+
return a(p, () => ({
|
|
2919
|
+
draw: E,
|
|
2920
|
+
reset: T
|
|
2921
|
+
}), [E, T]), /* @__PURE__ */ d("div", {
|
|
2921
2922
|
className: Et.nineGrid,
|
|
2922
2923
|
children: [/* @__PURE__ */ u("div", {
|
|
2923
2924
|
className: Et.board,
|
|
2924
2925
|
role: "grid",
|
|
2925
2926
|
"aria-label": "九宫格抽奖",
|
|
2926
|
-
children:
|
|
2927
|
-
let n =
|
|
2927
|
+
children: m.map((e, t) => {
|
|
2928
|
+
let n = h === t, r = _ === t;
|
|
2928
2929
|
return /* @__PURE__ */ d("div", {
|
|
2929
2930
|
role: "gridcell",
|
|
2930
2931
|
className: `${Et.cell} ${n ? Et.active : ""} ${r ? Et.winner : ""}`,
|
|
@@ -2940,9 +2941,11 @@ var Ae = {
|
|
|
2940
2941
|
}), /* @__PURE__ */ u("button", {
|
|
2941
2942
|
type: "button",
|
|
2942
2943
|
className: Et.button,
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2944
|
+
"data-testid": "nine-grid-draw",
|
|
2945
|
+
onClick: () => E(),
|
|
2946
|
+
disabled: y || f,
|
|
2947
|
+
"aria-busy": y,
|
|
2948
|
+
children: y ? o : i
|
|
2946
2949
|
})]
|
|
2947
2950
|
});
|
|
2948
2951
|
});
|
|
@@ -9138,8 +9141,10 @@ var fs = {
|
|
|
9138
9141
|
/* @__PURE__ */ u("button", {
|
|
9139
9142
|
type: "button",
|
|
9140
9143
|
className: fs.spinBtn,
|
|
9144
|
+
"data-testid": "slot-machine-spin",
|
|
9141
9145
|
onClick: () => F(),
|
|
9142
9146
|
disabled: v,
|
|
9147
|
+
"aria-busy": v,
|
|
9143
9148
|
children: v ? p : _
|
|
9144
9149
|
}),
|
|
9145
9150
|
S.length > 0 && !v && /* @__PURE__ */ u("p", {
|
|
@@ -9675,8 +9680,10 @@ var bs = {
|
|
|
9675
9680
|
/* @__PURE__ */ u("button", {
|
|
9676
9681
|
type: "button",
|
|
9677
9682
|
className: Ps.spinBtn,
|
|
9683
|
+
"data-testid": "turntable-spin",
|
|
9678
9684
|
onClick: () => N(),
|
|
9679
9685
|
disabled: S,
|
|
9686
|
+
"aria-busy": S,
|
|
9680
9687
|
children: S ? p : f
|
|
9681
9688
|
})
|
|
9682
9689
|
]
|
package/package.json
CHANGED