lazy-bee 1.0.9 → 1.1.0

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.d.ts CHANGED
@@ -171,6 +171,10 @@ declare const LoginPage: {
171
171
  install(app: any): void
172
172
  }
173
173
 
174
+ declare const Turntable: {
175
+ install(app: any): void
176
+ }
177
+
174
178
 
175
179
  declare function share(options: {
176
180
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lazy-bee",
3
- "version": "1.0.9",
3
+ "version": "1.1.0",
4
4
  "description": "lazy bee",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -0,0 +1,60 @@
1
+ import { ref as A, onMounted as W, openBlock as z, createElementBlock as D } from "vue";
2
+ const E = ["width", "height"], _ = { __name: "Turntable", props: ["wheelData", "borderWidth", "borderColor", "wheelColor", "textColor"], emits: ["mounted"], setup(x, { emit: C }) {
3
+ const f = x, v = C, g = A(750);
4
+ return W(() => {
5
+ const u = document.getElementById("lazy-turntable"), t = u.getContext("2d"), m = f.wheelData, k = f.borderWidth || 2, B = f.borderColor || "#ffe4d5", y = f.wheelColor || ["#ffffff", "#fff1e9"], S = f.textColor || "#fd4618", e = g.value / 2, c = u.width / 2, h = u.height / 2, M = m.length, d = 360 / M * Math.PI / 180;
6
+ let w = 0, p = 0, I = 0;
7
+ const b = [];
8
+ async function P() {
9
+ (function() {
10
+ let l = -Math.PI / 2 - d / 2 + w;
11
+ for (let o = 0; o < M; o++) {
12
+ const n = l + d;
13
+ t.fillStyle = y[o % y.length], t.beginPath(), t.moveTo(c, h), t.arc(c, h, e, l, n), t.closePath(), t.fill(), t.strokeStyle = B, t.lineWidth = k, t.stroke();
14
+ const a = (l + n) / 2, i = c + e / 2 * Math.cos(a), r = h + e / 2 * Math.sin(a);
15
+ t.save(), t.translate(i, r), t.rotate(a + Math.PI / 2), t.fillStyle = S, t.font = e / 8 + "px Arial", t.textAlign = "center", t.textBaseline = "middle", t.fillText(m[o].name, 0, -e / 3.2), t.restore(), l = n;
16
+ }
17
+ })(), function() {
18
+ let l = -Math.PI / 2 - d / 2 + w;
19
+ for (let o = 0; o < M; o++) {
20
+ const n = l + d, a = (l + n) / 2, i = c + e / 2 * Math.cos(a), r = h + e / 2 * Math.sin(a);
21
+ t.save(), t.translate(i, r), t.rotate(a + Math.PI / 2);
22
+ const s = b[o];
23
+ s && t.drawImage(s, -e / 7.5, -e / 5, e / 3.6, e / 3.6), t.restore(), l = n;
24
+ }
25
+ }();
26
+ }
27
+ function T(l) {
28
+ const o = performance.now();
29
+ I = l - 1, p = 10 * Math.PI - I * d, setTimeout(() => {
30
+ v("finish");
31
+ }, 3e3), function n(a) {
32
+ const i = a - o;
33
+ let r = Math.min(i / 3e3, 1);
34
+ var s;
35
+ r = (s = r) < 0.5 ? 2 * s * s : (4 - 2 * s) * s - 1, w = r * p, t.clearRect(c - e, h - e, 2 * e, 2 * e), P(), r < 1 ? requestAnimationFrame(n) : (w = p, t.clearRect(c - e, h - e, 2 * e, 2 * e), P());
36
+ }(performance.now());
37
+ }
38
+ (async function() {
39
+ await function() {
40
+ const l = [];
41
+ for (let o = 0; o < m.length; o++) {
42
+ const n = new Image();
43
+ n.src = m[o].pic;
44
+ const a = new Promise((i, r) => {
45
+ n.onload = () => {
46
+ b[o] = n, i(n);
47
+ }, n.onerror = (s) => {
48
+ i(null);
49
+ };
50
+ });
51
+ l.push(a);
52
+ }
53
+ return Promise.allSettled(l);
54
+ }(), P(), v("mounted", T);
55
+ })();
56
+ }), (u, t) => (z(), D("canvas", { id: "lazy-turntable", style: { width: "100%", height: "100%" }, width: g.value, height: g.value }, null, 8, E));
57
+ } };
58
+ export {
59
+ _ as default
60
+ };
@@ -0,0 +1,7 @@
1
+ import n from "./Turntable.vue.js";
2
+ const r = { install(t) {
3
+ t.component("Turntable", n);
4
+ } };
5
+ export {
6
+ r as Turntable
7
+ };
package/src/index.js CHANGED
@@ -2,13 +2,15 @@ import { converToken as e } from "./components/converToken.js";
2
2
  import { share as f } from "./components/share.js";
3
3
  import { showLoginModal as p } from "./components/Login/LoginModal.js";
4
4
  import { LoginPage as a } from "./components/Login/LoginPage.js";
5
- import { PayModal as g } from "./components/PayModal/index.js";
5
+ import { Turntable as g } from "./components/Turntable/index.js";
6
+ import { PayModal as b } from "./components/PayModal/index.js";
6
7
  import { trackEvent as d } from "./components/trackEvent.js";
7
8
  import { Debug as i } from "./components/debug.js";
8
9
  export {
9
10
  i as Debug,
10
11
  a as LoginPage,
11
- g as PayModal,
12
+ b as PayModal,
13
+ g as Turntable,
12
14
  e as converToken,
13
15
  f as share,
14
16
  p as showLoginModal,