geekin-devtoys 0.3.8 → 0.3.9

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.
Files changed (55) hide show
  1. package/lib/GBubble/index.js +1 -2
  2. package/lib/GBubble/index.mjs +3 -210
  3. package/lib/GBubble-C3cM9Put.mjs +216 -0
  4. package/lib/GBubble-Dph0YDkU.js +2 -0
  5. package/lib/GButton/index.js +1 -1
  6. package/lib/GButton/index.mjs +81 -5
  7. package/lib/GButton/style.css +1 -0
  8. package/lib/GCard/index.js +1 -1
  9. package/lib/GCard/index.mjs +1 -1
  10. package/lib/GDialog/index.js +1 -1
  11. package/lib/GDialog/index.mjs +33 -34
  12. package/lib/GInput/index.js +1 -0
  13. package/lib/GInput/index.mjs +145 -0
  14. package/lib/GInput/style.css +1 -0
  15. package/lib/GInput.d.ts +1 -0
  16. package/lib/GInputTreeTag/index.js +1 -1
  17. package/lib/GInputTreeTag/index.mjs +77 -75
  18. package/lib/GInputTreeTag/style.css +1 -1
  19. package/lib/GPie3D/index.js +1 -1
  20. package/lib/GPie3D/index.mjs +1 -1
  21. package/lib/GProgress/index.js +1 -1
  22. package/lib/GProgress/index.mjs +1 -1
  23. package/lib/GRing/index.js +1 -1
  24. package/lib/GRing/index.mjs +1 -1
  25. package/lib/GScroller/index.js +1 -1
  26. package/lib/GScroller/index.mjs +135 -152
  27. package/lib/GShinyText/index.js +1 -1
  28. package/lib/GShinyText/index.mjs +45 -119
  29. package/lib/GSteps/index.js +1 -1
  30. package/lib/GSteps/index.mjs +89 -43
  31. package/lib/GSteps/style.css +1 -1
  32. package/lib/GTable/index.js +1 -1
  33. package/lib/GTable/index.mjs +1 -1
  34. package/lib/GTag/index.js +1 -0
  35. package/lib/GTag/index.mjs +73 -0
  36. package/lib/GTag.d.ts +1 -0
  37. package/lib/GVideo/index.js +2 -2
  38. package/lib/GVideo/index.mjs +1 -1
  39. package/lib/assets/GTag.css +1 -0
  40. package/lib/components/GInput/index.d.ts +64 -0
  41. package/lib/components/GInputTreeTag/index.d.ts +15 -23
  42. package/lib/components/GTag/index.d.ts +38 -0
  43. package/lib/index/index.js +1 -1
  44. package/lib/index/index.mjs +38 -33
  45. package/lib/index/style.css +25 -1
  46. package/lib/index.d.ts +3 -1
  47. package/package.json +12 -20
  48. package/lib/AnimatePresence-26Wy0TGN.js +0 -9
  49. package/lib/AnimatePresence-nl0c23TZ.mjs +0 -136
  50. package/lib/_plugin-vue_export-helper-BHFhmbuH.js +0 -1
  51. package/lib/_plugin-vue_export-helper-CHgC5LLL.mjs +0 -9
  52. package/lib/index-B8Ap0044.js +0 -1
  53. package/lib/index-Bbr5fWvI.mjs +0 -5158
  54. package/lib/index-CWxEZ_zc.mjs +0 -74
  55. package/lib/index-Q0Ej8RIj.js +0 -1
@@ -1,24 +1,7 @@
1
- import { ref as n, watchEffect as de, unref as W, defineComponent as ee, h as ve, useSlots as ge, computed as B, onMounted as pe, onUnmounted as he, watch as G, nextTick as P, createElementBlock as c, openBlock as r, normalizeStyle as C, normalizeClass as y, createElementVNode as m, createCommentVNode as le, Fragment as k, renderList as V, renderSlot as te, toDisplayString as se, createBlock as _e, withCtx as ye } from "vue";
2
- import { unrefElement as ke } from "@vueuse/core";
3
- import { i as Se, m as Te } from "../index-Bbr5fWvI.mjs";
4
- import { _ as we } from "../_plugin-vue_export-helper-CHgC5LLL.mjs";
5
- function Me(S, E) {
6
- const p = n(!1);
7
- return de((l) => {
8
- const T = W(E) || {}, { once: H } = T, w = ke(S);
9
- if (!w || H && p.value) return;
10
- const g = Se(w, () => (p.value = !0, H ? void 0 : () => {
11
- p.value = !1;
12
- }), {
13
- ...T,
14
- root: W(T.root)
15
- });
16
- l(() => {
17
- g();
18
- });
19
- }, { flush: "post" }), p;
20
- }
21
- const Ce = ["onMouseenter", "onClick"], He = { class: "g-scroller__item-text" }, be = { class: "g-scroller__item-text" }, ae = 80, Ie = 10, $e = /* @__PURE__ */ ee({
1
+ import { defineComponent as j, ref as n, h as de, useSlots as fe, computed as H, onMounted as ve, onUnmounted as ge, watch as D, nextTick as L, createElementBlock as c, openBlock as r, normalizeStyle as S, normalizeClass as h, createElementVNode as m, createCommentVNode as J, Fragment as _, renderList as N, renderSlot as Q, toDisplayString as Z, createBlock as pe, unref as he, withCtx as _e } from "vue";
2
+ import { useInView as ye, motion as ke } from "motion-v";
3
+ import { _ as Se } from "../GBubble-C3cM9Put.mjs";
4
+ const Te = ["onMouseenter", "onClick"], Me = { class: "g-scroller__item-text" }, we = { class: "g-scroller__item-text" }, x = 80, Ce = 10, He = /* @__PURE__ */ j({
22
5
  __name: "index",
23
6
  props: {
24
7
  items: { default: () => [] },
@@ -37,8 +20,8 @@ const Ce = ["onMouseenter", "onClick"], He = { class: "g-scroller__item-text" },
37
20
  seamlessPauseOnHover: { type: Boolean, default: !0 }
38
21
  },
39
22
  emits: ["itemSelected"],
40
- setup(S, { emit: E }) {
41
- const p = ee({
23
+ setup(b, { emit: ee }) {
24
+ const le = j({
42
25
  name: "AnimatedItem",
43
26
  props: {
44
27
  index: { type: Number, required: !0 },
@@ -47,12 +30,12 @@ const Ce = ["onMouseenter", "onClick"], He = { class: "g-scroller__item-text" },
47
30
  instant: { type: Boolean, default: !1 }
48
31
  },
49
32
  emits: ["mouseenter", "click"],
50
- setup(e, { slots: a, emit: t }) {
51
- const s = n(null), u = Me(s, { amount: 0.5, once: !1 });
52
- return () => ve(
53
- Te.div,
33
+ setup(e, { slots: a, emit: s }) {
34
+ const t = n(null), u = ye(t, { amount: 0.5, once: !1 });
35
+ return () => de(
36
+ ke.div,
54
37
  {
55
- ref: s,
38
+ ref: t,
56
39
  "data-index": e.index,
57
40
  style: { marginBottom: "1rem", cursor: "pointer" },
58
41
  initial: { x: -24, opacity: 0 },
@@ -62,197 +45,197 @@ const Ce = ["onMouseenter", "onClick"], He = { class: "g-scroller__item-text" },
62
45
  delay: Math.min(e.index * e.stagger, 0.3),
63
46
  ease: "easeOut"
64
47
  },
65
- onMouseenter: (v) => t("mouseenter", v),
66
- onClick: (v) => t("click", v)
48
+ onMouseenter: (v) => s("mouseenter", v),
49
+ onClick: (v) => s("click", v)
67
50
  },
68
51
  a.default?.()
69
52
  );
70
53
  }
71
- }), l = S, T = E, H = ge(), w = B(() => !!H.default), R = n(null), g = n(l.initialSelectedIndex), q = n(0), z = n(1), U = n(0), M = n(0), b = n(!1);
72
- let f = null;
73
- const I = n(!1);
74
- let K = 0, D = 0, d = null;
75
- const X = n(null), j = n(null), ne = B(
54
+ }), l = b, se = ee, te = fe(), F = H(() => !!te.default), E = n(null), y = n(l.initialSelectedIndex), G = n(0), P = n(1), Y = n(0), k = n(0), T = n(!1);
55
+ let d = null;
56
+ const M = n(!1);
57
+ let V = 0, $ = 0, f = null;
58
+ const W = n(null), q = n(null), ae = H(
76
59
  () => l.seamless && l.items.length > 0 ? [...l.items, ...l.items] : l.items
77
- ), o = n(0), $ = n(!1), i = n(0), L = n(!1);
78
- let h = null, _ = 0;
79
- const oe = B(() => {
60
+ ), o = n(0), w = n(!1), i = n(0), I = n(!1);
61
+ let g = null, p = 0;
62
+ const ne = H(() => {
80
63
  const e = {};
81
64
  return l.height != null && l.height !== "" && (e.height = typeof l.height == "number" ? `${l.height}px` : String(l.height)), e;
82
- }), re = B(() => ({
65
+ }), oe = H(() => ({
83
66
  transform: `translateY(${o.value}px)`
84
67
  }));
85
- function ie(e, a, t) {
86
- return Math.min(Math.max(e, a), t);
68
+ function re(e, a, s) {
69
+ return Math.min(Math.max(e, a), s);
87
70
  }
88
- const J = (e) => {
89
- g.value = e;
90
- }, Q = (e, a) => {
91
- g.value = a, T("itemSelected", e, a);
92
- }, ue = (e) => {
93
- const a = e.target, { scrollTop: t, scrollHeight: s, clientHeight: u } = a, v = performance.now();
94
- D > 0 && Math.abs(t - K) / (v - D) > Ie && (I.value = !0), K = t, D = v, d && clearTimeout(d), d = setTimeout(() => {
95
- I.value = !1;
96
- }, 150), q.value = Math.min(t / 50, 1);
97
- const F = s - (t + u);
98
- z.value = s <= u ? 0 : Math.min(F / 50, 1);
71
+ const z = (e) => {
72
+ y.value = e;
73
+ }, U = (e, a) => {
74
+ y.value = a, se("itemSelected", e, a);
75
+ }, ie = (e) => {
76
+ const a = e.target, { scrollTop: s, scrollHeight: t, clientHeight: u } = a, v = performance.now();
77
+ $ > 0 && Math.abs(s - V) / (v - $) > Ce && (M.value = !0), V = s, $ = v, f && clearTimeout(f), f = setTimeout(() => {
78
+ M.value = !1;
79
+ }, 150), G.value = Math.min(s / 50, 1);
80
+ const R = t - (s + u);
81
+ P.value = t <= u ? 0 : Math.min(R / 50, 1);
99
82
  };
100
- function ce(e) {
101
- const a = R.value;
83
+ function ue(e) {
84
+ const a = E.value;
102
85
  if (!a) return;
103
- const { scrollTop: t, scrollHeight: s, clientHeight: u } = a;
104
- if (s <= u) return;
105
- const v = t <= 0, F = t + u >= s - 1;
106
- if (v && e.deltaY < 0 || F && e.deltaY > 0) {
107
- const x = ie(M.value - e.deltaY * 0.3, -ae, ae);
108
- M.value = x, b.value = !0, f && clearTimeout(f), f = setTimeout(() => {
109
- M.value = 0, b.value = !1;
86
+ const { scrollTop: s, scrollHeight: t, clientHeight: u } = a;
87
+ if (t <= u) return;
88
+ const v = s <= 0, R = s + u >= t - 1;
89
+ if (v && e.deltaY < 0 || R && e.deltaY > 0) {
90
+ const X = re(k.value - e.deltaY * 0.3, -x, x);
91
+ k.value = X, T.value = !0, d && clearTimeout(d), d = setTimeout(() => {
92
+ k.value = 0, T.value = !1;
110
93
  }, 150);
111
94
  }
112
95
  }
113
- function O() {
114
- const e = j.value;
96
+ function C() {
97
+ const e = q.value;
115
98
  if (!e || l.items.length === 0) {
116
- i.value = 0, L.value = !1;
99
+ i.value = 0, I.value = !1;
117
100
  return;
118
101
  }
119
- const a = l.items.length, t = e.children[a];
120
- i.value = t ? t.offsetTop : e.scrollHeight / 2;
121
- const s = X.value;
122
- L.value = s ? i.value > s.clientHeight : !0;
102
+ const a = l.items.length, s = e.children[a];
103
+ i.value = s ? s.offsetTop : e.scrollHeight / 2;
104
+ const t = W.value;
105
+ I.value = t ? i.value > t.clientHeight : !0;
123
106
  }
124
- function Z(e) {
125
- _ === 0 && (_ = e);
126
- const a = e - _;
127
- if (_ = e, !$.value && i.value > 0 && l.items.length > 0) {
128
- const t = l.seamlessSpeed * a / 1e3;
129
- l.seamlessDirection === "down" ? (o.value += t, o.value >= 0 && (o.value -= i.value)) : (o.value -= t, o.value <= -i.value && (o.value += i.value));
107
+ function K(e) {
108
+ p === 0 && (p = e);
109
+ const a = e - p;
110
+ if (p = e, !w.value && i.value > 0 && l.items.length > 0) {
111
+ const s = l.seamlessSpeed * a / 1e3;
112
+ l.seamlessDirection === "down" ? (o.value += s, o.value >= 0 && (o.value -= i.value)) : (o.value -= s, o.value <= -i.value && (o.value += i.value));
130
113
  }
131
- h = requestAnimationFrame(Z);
114
+ g = requestAnimationFrame(K);
115
+ }
116
+ function B() {
117
+ g == null && (p = 0, g = requestAnimationFrame(K));
132
118
  }
133
- function N() {
134
- h == null && (_ = 0, h = requestAnimationFrame(Z));
119
+ function O() {
120
+ g != null && (cancelAnimationFrame(g), g = null), p = 0;
135
121
  }
136
- function A() {
137
- h != null && (cancelAnimationFrame(h), h = null), _ = 0;
122
+ function ce() {
123
+ l.seamlessPauseOnHover && (w.value = !0);
138
124
  }
139
125
  function me() {
140
- l.seamlessPauseOnHover && ($.value = !0);
141
- }
142
- function fe() {
143
- l.seamlessPauseOnHover && ($.value = !1);
126
+ l.seamlessPauseOnHover && (w.value = !1);
144
127
  }
145
- return pe(() => {
146
- l.seamless && !l.loading && (O(), o.value = l.seamlessDirection === "down" ? -i.value : 0, N());
147
- }), he(() => {
148
- A(), f && (clearTimeout(f), f = null), d && (clearTimeout(d), d = null);
149
- }), G(
128
+ return ve(() => {
129
+ l.seamless && !l.loading && (C(), o.value = l.seamlessDirection === "down" ? -i.value : 0, B());
130
+ }), ge(() => {
131
+ O(), d && (clearTimeout(d), d = null), f && (clearTimeout(f), f = null);
132
+ }), D(
150
133
  () => l.items,
151
134
  () => {
152
- l.seamless && P(() => {
153
- O(), o.value = l.seamlessDirection === "down" ? -i.value : 0;
154
- }), U.value++, g.value = -1;
135
+ l.seamless && L(() => {
136
+ C(), o.value = l.seamlessDirection === "down" ? -i.value : 0;
137
+ }), Y.value++, y.value = -1;
155
138
  }
156
- ), G(
139
+ ), D(
157
140
  () => l.seamless,
158
141
  (e) => {
159
- e && !l.loading ? P(() => {
160
- O(), o.value = l.seamlessDirection === "down" ? -i.value : 0, N();
161
- }) : (A(), o.value = 0, $.value = !1);
142
+ e && !l.loading ? L(() => {
143
+ C(), o.value = l.seamlessDirection === "down" ? -i.value : 0, B();
144
+ }) : (O(), o.value = 0, w.value = !1);
162
145
  }
163
- ), G(
146
+ ), D(
164
147
  () => l.loading,
165
148
  (e) => {
166
- e ? (M.value = 0, b.value = !1, I.value = !1, A(), f && (clearTimeout(f), f = null), d && (clearTimeout(d), d = null)) : l.seamless && P(() => {
167
- O(), o.value = l.seamlessDirection === "down" ? -i.value : 0, N();
149
+ e ? (k.value = 0, T.value = !1, M.value = !1, O(), d && (clearTimeout(d), d = null), f && (clearTimeout(f), f = null)) : l.seamless && L(() => {
150
+ C(), o.value = l.seamlessDirection === "down" ? -i.value : 0, B();
168
151
  });
169
152
  }
170
153
  ), (e, a) => (r(), c("div", {
171
- class: y(["g-scroller", e.className]),
172
- style: C(oe.value)
154
+ class: h(["g-scroller", e.className]),
155
+ style: S(ne.value)
173
156
  }, [
174
157
  e.seamless && !e.loading ? (r(), c("div", {
175
158
  key: 0,
176
159
  ref_key: "seamlessWrapRef",
177
- ref: X,
160
+ ref: W,
178
161
  class: "g-scroller__seamless",
179
- onMouseenter: me,
180
- onMouseleave: fe
162
+ onMouseenter: ce,
163
+ onMouseleave: me
181
164
  }, [
182
165
  m("div", {
183
166
  ref_key: "seamlessTrackRef",
184
- ref: j,
167
+ ref: q,
185
168
  class: "g-scroller__seamless-track",
186
- style: C(re.value)
169
+ style: S(oe.value)
187
170
  }, [
188
- (r(!0), c(k, null, V(ne.value, (t, s) => (r(), c("div", {
189
- key: `seamless-${s}`,
190
- class: y([
171
+ (r(!0), c(_, null, N(ae.value, (s, t) => (r(), c("div", {
172
+ key: `seamless-${t}`,
173
+ class: h([
191
174
  "g-scroller__item",
192
175
  "g-scroller__item--seamless",
193
- !w.value && "g-scroller__item--default",
194
- g.value === s % e.items.length && "g-scroller__item--active",
176
+ !F.value && "g-scroller__item--default",
177
+ y.value === t % e.items.length && "g-scroller__item--active",
195
178
  e.itemClassName
196
179
  ]),
197
- onMouseenter: (u) => J(s % e.items.length),
198
- onClick: (u) => Q(t, s % e.items.length)
180
+ onMouseenter: (u) => z(t % e.items.length),
181
+ onClick: (u) => U(s, t % e.items.length)
199
182
  }, [
200
- te(e.$slots, "default", {
201
- item: t,
202
- index: s % e.items.length
183
+ Q(e.$slots, "default", {
184
+ item: s,
185
+ index: t % e.items.length
203
186
  }, () => [
204
- m("p", He, se(t), 1)
187
+ m("p", Me, Z(s), 1)
205
188
  ], !0)
206
- ], 42, Ce))), 128))
189
+ ], 42, Te))), 128))
207
190
  ], 4),
208
- e.showGradients && L.value ? (r(), c(k, { key: 0 }, [
191
+ e.showGradients && I.value ? (r(), c(_, { key: 0 }, [
209
192
  a[0] || (a[0] = m("div", { class: "g-scroller__gradient g-scroller__gradient--top" }, null, -1)),
210
193
  a[1] || (a[1] = m("div", { class: "g-scroller__gradient g-scroller__gradient--bottom" }, null, -1))
211
- ], 64)) : le("", !0)
194
+ ], 64)) : J("", !0)
212
195
  ], 544)) : e.loading ? (r(), c("div", {
213
196
  key: 1,
214
- class: y(["g-scroller__list", !e.displayScrollbar && "g-scroller__list--hidden-scrollbar"])
197
+ class: h(["g-scroller__list", !e.displayScrollbar && "g-scroller__list--hidden-scrollbar"])
215
198
  }, [
216
- (r(!0), c(k, null, V(e.skeletonCount, (t) => (r(), c("div", {
217
- key: `skeleton-${t}`,
199
+ (r(!0), c(_, null, N(e.skeletonCount, (s) => (r(), c("div", {
200
+ key: `skeleton-${s}`,
218
201
  class: "g-scroller__skeleton"
219
202
  }, a[2] || (a[2] = [
220
203
  m("div", { class: "g-scroller__skeleton-line" }, null, -1)
221
204
  ])))), 128))
222
- ], 2)) : (r(), c(k, { key: 2 }, [
205
+ ], 2)) : (r(), c(_, { key: 2 }, [
223
206
  m("div", {
224
207
  ref_key: "listRef",
225
- ref: R,
226
- class: y(["g-scroller__list", !e.displayScrollbar && "g-scroller__list--hidden-scrollbar"]),
227
- onScroll: ue,
228
- onWheel: ce
208
+ ref: E,
209
+ class: h(["g-scroller__list", !e.displayScrollbar && "g-scroller__list--hidden-scrollbar"]),
210
+ onScroll: ie,
211
+ onWheel: ue
229
212
  }, [
230
213
  m("div", {
231
- class: y(["g-scroller__content", { "g-scroller__content--pulling": b.value }]),
232
- style: C({ transform: `translateY(${M.value}px)` })
214
+ class: h(["g-scroller__content", { "g-scroller__content--pulling": T.value }]),
215
+ style: S({ transform: `translateY(${k.value}px)` })
233
216
  }, [
234
- (r(!0), c(k, null, V(e.items, (t, s) => (r(), _e(W(p), {
235
- key: `${U.value}-${s}`,
236
- index: s,
217
+ (r(!0), c(_, null, N(e.items, (s, t) => (r(), pe(he(le), {
218
+ key: `${Y.value}-${t}`,
219
+ index: t,
237
220
  stagger: e.stagger,
238
- instant: I.value,
239
- onMouseenter: (u) => J(s),
240
- onClick: (u) => Q(t, s)
221
+ instant: M.value,
222
+ onMouseenter: (u) => z(t),
223
+ onClick: (u) => U(s, t)
241
224
  }, {
242
- default: ye(() => [
225
+ default: _e(() => [
243
226
  m("div", {
244
- class: y([
227
+ class: h([
245
228
  "g-scroller__item",
246
- !w.value && "g-scroller__item--default",
247
- g.value === s && "g-scroller__item--active",
229
+ !F.value && "g-scroller__item--default",
230
+ y.value === t && "g-scroller__item--active",
248
231
  e.itemClassName
249
232
  ])
250
233
  }, [
251
- te(e.$slots, "default", {
252
- item: t,
253
- index: s
234
+ Q(e.$slots, "default", {
235
+ item: s,
236
+ index: t
254
237
  }, () => [
255
- m("p", be, se(t), 1)
238
+ m("p", we, Z(s), 1)
256
239
  ], !0)
257
240
  ], 2)
258
241
  ]),
@@ -260,24 +243,24 @@ const Ce = ["onMouseenter", "onClick"], He = { class: "g-scroller__item-text" },
260
243
  }, 1032, ["index", "stagger", "instant", "onMouseenter", "onClick"]))), 128))
261
244
  ], 6)
262
245
  ], 34),
263
- e.showGradients ? (r(), c(k, { key: 0 }, [
246
+ e.showGradients ? (r(), c(_, { key: 0 }, [
264
247
  m("div", {
265
248
  class: "g-scroller__gradient g-scroller__gradient--top",
266
- style: C({ opacity: q.value })
249
+ style: S({ opacity: G.value })
267
250
  }, null, 4),
268
251
  m("div", {
269
252
  class: "g-scroller__gradient g-scroller__gradient--bottom",
270
- style: C({ opacity: z.value })
253
+ style: S({ opacity: P.value })
271
254
  }, null, 4)
272
- ], 64)) : le("", !0)
255
+ ], 64)) : J("", !0)
273
256
  ], 64))
274
257
  ], 6));
275
258
  }
276
- }), Y = /* @__PURE__ */ we($e, [["__scopeId", "data-v-972060e6"]]);
277
- Y.install = (S) => {
278
- S.component(Y.name, Y);
259
+ }), A = /* @__PURE__ */ Se(He, [["__scopeId", "data-v-972060e6"]]);
260
+ A.install = (b) => {
261
+ b.component(A.name, A);
279
262
  };
280
263
  export {
281
- Y as GScroller,
282
- Y as default
264
+ A as GScroller,
265
+ A as default
283
266
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("vue"),u=require("../index-B8Ap0044.js");function A(...t){const e=!Array.isArray(t[0]),l=e?0:-1,n=t[0+l],s=t[1+l],r=t[2+l],c=t[3+l],o=u.interpolate(s,r,c);return e?o(n):o}function S(t){let e=0;const l=({timestamp:s,delta:r})=>{e||(e=s),t(s-e,r)},n=()=>u.cancelFrame(l);a.onBeforeUpdate(()=>{n(),u.frame.update(l,!0)}),a.onUnmounted(()=>n()),u.frame.update(l,!0)}function k(t){const e=u.motionValue(t()),l=()=>e.set(t()),n=()=>u.frame.preRender(l,!1,!0);let s;const r=o=>{s=o.map(i=>i.on("change",n))},c=()=>{s.forEach(o=>o()),u.cancelFrame(l)};return a.getCurrentInstance()&&a.onUnmounted(()=>{c()}),{subscribe:r,unsubscribe:c,value:e,updateValue:l}}function T(t){u.collectMotionValues.current=[];const{value:e,subscribe:l,unsubscribe:n,updateValue:s}=k(t);return l(u.collectMotionValues.current),u.collectMotionValues.current=void 0,a.watchEffect(()=>{n(),u.collectMotionValues.current=[],s(),l(u.collectMotionValues.current),u.collectMotionValues.current=void 0}),e}function B(t,e,l,n){if(typeof t=="function")return T(t);let s,r;if(typeof e=="function")r=e,s=Array.isArray(t)?t:[t];else if(a.isRef(e)){const o=u.motionValue(0);let i=A(e.value,l,n);a.watch(e,v=>{i=A(v,l,n),o.set(o.get()+1)},{flush:"sync"}),r=v=>Array.isArray(v)?i(v[0]):i(v),s=Array.isArray(t)?[...t,o]:[t,o]}else r=A(e,l,n),s=Array.isArray(t)?t:[t];const c=Array.isArray(t)?M(s,r):M(s,o=>r(o[0]));if(!Array.isArray(t)){const o=t.accelerate;if(o&&!o.isTransformed&&typeof e!="function"&&Array.isArray(l)&&n?.clamp!==!1){const i=a.isRef(e)?e.value:e;c.accelerate={...o,times:i,keyframes:l,isTransformed:!0}}}return c}function M(t,e){const l=[],n=()=>{l.length=0;const c=t.length;for(let o=0;o<c;o++)l[o]=t[o].get();return e(l)},{value:s,subscribe:r}=k(n);return r(t),s}const m=a.defineComponent({__name:"index",props:{text:{},disabled:{type:Boolean,default:!1},speed:{default:2},className:{default:""},color:{default:"#b5b5b5"},shineColor:{default:"#ffffff"},spread:{default:120},yoyo:{type:Boolean,default:!1},pauseOnHover:{type:Boolean,default:!1},direction:{default:"left"},delay:{default:0}},setup(t){const e=t,l=a.ref(!1),n=u.motionValue(0),s=a.ref(0),r=a.ref(null),c=a.ref(e.direction==="left"?1:-1),o=a.computed(()=>e.speed*1e3),i=a.computed(()=>e.delay*1e3);S(f=>{if(e.disabled||l.value){r.value=null;return}if(r.value===null){r.value=f;return}const V=f-r.value;if(r.value=f,s.value+=V,e.yoyo){const y=o.value+i.value,b=y*2,d=s.value%b;if(d<o.value){const p=d/o.value*100;n.set(c.value===1?p:100-p)}else if(d<y)n.set(c.value===1?100:0);else if(d<y+o.value){const h=100-(d-y)/o.value*100;n.set(c.value===1?h:100-h)}else n.set(c.value===1?0:100)}else{const y=o.value+i.value,b=s.value%y;if(b<o.value){const d=b/o.value*100;n.set(c.value===1?d:100-d)}else n.set(c.value===1?100:0)}}),a.watch(()=>e.direction,()=>{c.value=e.direction==="left"?1:-1,s.value=0,n.set(0)},{immediate:!0});const v=B(n,f=>`${150-f*2}% center`),C=()=>{e.pauseOnHover&&(l.value=!0)},g=()=>{e.pauseOnHover&&(l.value=!1)},x=a.computed(()=>({backgroundImage:`linear-gradient(${e.spread}deg, ${e.color} 0%, ${e.color} 35%, ${e.shineColor} 50%, ${e.color} 65%, ${e.color} 100%)`,backgroundSize:"200% auto",WebkitBackgroundClip:"text",backgroundClip:"text",WebkitTextFillColor:"transparent"}));return(f,V)=>(a.openBlock(),a.createBlock(a.unref(u.Motion),{tag:"span",class:a.normalizeClass(["inline-block",f.className]),style:a.normalizeStyle({...x.value,backgroundPosition:a.unref(v)}),onMouseenter:C,onMouseleave:g},{default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(f.text),1)]),_:1},8,["class","style"]))}});m.install=t=>{t.component(m.name,m)};exports.GShinyText=m;exports.default=m;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),f=require("motion-v"),i=e.defineComponent({__name:"index",props:{text:{},disabled:{type:Boolean,default:!1},speed:{default:2},className:{default:""},color:{default:"#b5b5b5"},shineColor:{default:"#ffffff"},spread:{default:120},yoyo:{type:Boolean,default:!1},pauseOnHover:{type:Boolean,default:!1},direction:{default:"left"},delay:{default:0}},setup(v){const l=v,p=e.ref(!1),t=f.useMotionValue(0),c=e.ref(0),r=e.ref(null),s=e.ref(l.direction==="left"?1:-1),a=e.computed(()=>l.speed*1e3),y=e.computed(()=>l.delay*1e3);f.useAnimationFrame(o=>{if(l.disabled||p.value){r.value=null;return}if(r.value===null){r.value=o;return}const b=o-r.value;if(r.value=o,c.value+=b,l.yoyo){const u=a.value+y.value,d=u*2,n=c.value%d;if(n<a.value){const m=n/a.value*100;t.set(s.value===1?m:100-m)}else if(n<u)t.set(s.value===1?100:0);else if(n<u+a.value){const g=100-(n-u)/a.value*100;t.set(s.value===1?g:100-g)}else t.set(s.value===1?0:100)}else{const u=a.value+y.value,d=c.value%u;if(d<a.value){const n=d/a.value*100;t.set(s.value===1?n:100-n)}else t.set(s.value===1?100:0)}}),e.watch(()=>l.direction,()=>{s.value=l.direction==="left"?1:-1,c.value=0,t.set(0)},{immediate:!0});const k=f.useTransform(t,o=>`${150-o*2}% center`),T=()=>{l.pauseOnHover&&(p.value=!0)},C=()=>{l.pauseOnHover&&(p.value=!1)},h=e.computed(()=>({backgroundImage:`linear-gradient(${l.spread}deg, ${l.color} 0%, ${l.color} 35%, ${l.shineColor} 50%, ${l.color} 65%, ${l.color} 100%)`,backgroundSize:"200% auto",WebkitBackgroundClip:"text",backgroundClip:"text",WebkitTextFillColor:"transparent"}));return(o,b)=>(e.openBlock(),e.createBlock(e.unref(f.Motion),{tag:"span",class:e.normalizeClass(["inline-block",o.className]),style:e.normalizeStyle({...h.value,backgroundPosition:e.unref(k)}),onMouseenter:T,onMouseleave:C},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.text),1)]),_:1},8,["class","style"]))}});i.install=v=>{v.component(i.name,i)};exports.GShinyText=i;exports.default=i;
@@ -1,80 +1,6 @@
1
- import { onBeforeUpdate as z, onUnmounted as S, getCurrentInstance as E, watchEffect as F, isRef as M, watch as T, defineComponent as H, ref as m, computed as b, createBlock as N, openBlock as P, unref as g, normalizeStyle as U, normalizeClass as L, withCtx as W, createTextVNode as G, toDisplayString as j } from "vue";
2
- import { c as q, d as $, f as k, e as C, g as v, M as J } from "../index-Bbr5fWvI.mjs";
3
- function A(...t) {
4
- const e = !Array.isArray(t[0]), s = e ? 0 : -1, o = t[0 + s], l = t[1 + s], n = t[2 + s], r = t[3 + s], a = q(l, n, r);
5
- return e ? a(o) : a;
6
- }
7
- function K(t) {
8
- let e = 0;
9
- const s = ({ timestamp: l, delta: n }) => {
10
- e || (e = l), t(l - e, n);
11
- }, o = () => $(s);
12
- z(() => {
13
- o(), k.update(s, !0);
14
- }), S(() => o()), k.update(s, !0);
15
- }
16
- function D(t) {
17
- const e = C(t()), s = () => e.set(t()), o = () => k.preRender(s, !1, !0);
18
- let l;
19
- const n = (a) => {
20
- l = a.map((c) => c.on("change", o));
21
- }, r = () => {
22
- l.forEach((a) => a()), $(s);
23
- };
24
- return E() && S(() => {
25
- r();
26
- }), {
27
- subscribe: n,
28
- unsubscribe: r,
29
- value: e,
30
- updateValue: s
31
- };
32
- }
33
- function Q(t) {
34
- v.current = [];
35
- const { value: e, subscribe: s, unsubscribe: o, updateValue: l } = D(t);
36
- return s(v.current), v.current = void 0, F(() => {
37
- o(), v.current = [], l(), s(v.current), v.current = void 0;
38
- }), e;
39
- }
40
- function X(t, e, s, o) {
41
- if (typeof t == "function") return Q(t);
42
- let l, n;
43
- if (typeof e == "function")
44
- n = e, l = Array.isArray(t) ? t : [t];
45
- else if (M(e)) {
46
- const a = C(0);
47
- let c = A(e.value, s, o);
48
- T(e, (f) => {
49
- c = A(f, s, o), a.set(a.get() + 1);
50
- }, { flush: "sync" }), n = (f) => Array.isArray(f) ? c(f[0]) : c(f), l = Array.isArray(t) ? [...t, a] : [t, a];
51
- } else
52
- n = A(e, s, o), l = Array.isArray(t) ? t : [t];
53
- const r = Array.isArray(t) ? B(l, n) : B(l, (a) => n(a[0]));
54
- if (!Array.isArray(t)) {
55
- const a = t.accelerate;
56
- if (a && !a.isTransformed && typeof e != "function" && Array.isArray(s) && o?.clamp !== !1) {
57
- const c = M(e) ? e.value : e;
58
- r.accelerate = {
59
- ...a,
60
- times: c,
61
- keyframes: s,
62
- isTransformed: !0
63
- };
64
- }
65
- }
66
- return r;
67
- }
68
- function B(t, e) {
69
- const s = [], o = () => {
70
- s.length = 0;
71
- const r = t.length;
72
- for (let a = 0; a < r; a++) s[a] = t[a].get();
73
- return e(s);
74
- }, { value: l, subscribe: n } = D(o);
75
- return n(t), l;
76
- }
77
- const h = /* @__PURE__ */ H({
1
+ import { defineComponent as $, ref as c, computed as p, watch as B, createBlock as M, openBlock as D, unref as k, normalizeStyle as S, normalizeClass as _, withCtx as z, createTextVNode as H, toDisplayString as N } from "vue";
2
+ import { useMotionValue as O, useAnimationFrame as P, useTransform as R, Motion as w } from "motion-v";
3
+ const m = /* @__PURE__ */ $({
78
4
  __name: "index",
79
5
  props: {
80
6
  text: {},
@@ -89,76 +15,76 @@ const h = /* @__PURE__ */ H({
89
15
  direction: { default: "left" },
90
16
  delay: { default: 0 }
91
17
  },
92
- setup(t) {
93
- const e = t, s = m(!1), o = C(0), l = m(0), n = m(null), r = m(e.direction === "left" ? 1 : -1), a = b(() => e.speed * 1e3), c = b(() => e.delay * 1e3);
94
- K((u) => {
95
- if (e.disabled || s.value) {
96
- n.value = null;
18
+ setup(d) {
19
+ const e = d, f = c(!1), a = O(0), r = c(0), u = c(null), n = c(e.direction === "left" ? 1 : -1), l = p(() => e.speed * 1e3), y = p(() => e.delay * 1e3);
20
+ P((t) => {
21
+ if (e.disabled || f.value) {
22
+ u.value = null;
97
23
  return;
98
24
  }
99
- if (n.value === null) {
100
- n.value = u;
25
+ if (u.value === null) {
26
+ u.value = t;
101
27
  return;
102
28
  }
103
- const V = u - n.value;
104
- if (n.value = u, l.value += V, e.yoyo) {
105
- const d = a.value + c.value, y = d * 2, i = l.value % y;
106
- if (i < a.value) {
107
- const p = i / a.value * 100;
108
- o.set(r.value === 1 ? p : 100 - p);
109
- } else if (i < d)
110
- o.set(r.value === 1 ? 100 : 0);
111
- else if (i < d + a.value) {
112
- const x = 100 - (i - d) / a.value * 100;
113
- o.set(r.value === 1 ? x : 100 - x);
29
+ const b = t - u.value;
30
+ if (u.value = t, r.value += b, e.yoyo) {
31
+ const s = l.value + y.value, i = s * 2, o = r.value % i;
32
+ if (o < l.value) {
33
+ const v = o / l.value * 100;
34
+ a.set(n.value === 1 ? v : 100 - v);
35
+ } else if (o < s)
36
+ a.set(n.value === 1 ? 100 : 0);
37
+ else if (o < s + l.value) {
38
+ const g = 100 - (o - s) / l.value * 100;
39
+ a.set(n.value === 1 ? g : 100 - g);
114
40
  } else
115
- o.set(r.value === 1 ? 0 : 100);
41
+ a.set(n.value === 1 ? 0 : 100);
116
42
  } else {
117
- const d = a.value + c.value, y = l.value % d;
118
- if (y < a.value) {
119
- const i = y / a.value * 100;
120
- o.set(r.value === 1 ? i : 100 - i);
43
+ const s = l.value + y.value, i = r.value % s;
44
+ if (i < l.value) {
45
+ const o = i / l.value * 100;
46
+ a.set(n.value === 1 ? o : 100 - o);
121
47
  } else
122
- o.set(r.value === 1 ? 100 : 0);
48
+ a.set(n.value === 1 ? 100 : 0);
123
49
  }
124
- }), T(
50
+ }), B(
125
51
  () => e.direction,
126
52
  () => {
127
- r.value = e.direction === "left" ? 1 : -1, l.value = 0, o.set(0);
53
+ n.value = e.direction === "left" ? 1 : -1, r.value = 0, a.set(0);
128
54
  },
129
55
  {
130
56
  immediate: !0
131
57
  }
132
58
  );
133
- const f = X(o, (u) => `${150 - u * 2}% center`), _ = () => {
134
- e.pauseOnHover && (s.value = !0);
135
- }, I = () => {
136
- e.pauseOnHover && (s.value = !1);
137
- }, w = b(() => ({
59
+ const T = R(a, (t) => `${150 - t * 2}% center`), x = () => {
60
+ e.pauseOnHover && (f.value = !0);
61
+ }, C = () => {
62
+ e.pauseOnHover && (f.value = !1);
63
+ }, h = p(() => ({
138
64
  backgroundImage: `linear-gradient(${e.spread}deg, ${e.color} 0%, ${e.color} 35%, ${e.shineColor} 50%, ${e.color} 65%, ${e.color} 100%)`,
139
65
  backgroundSize: "200% auto",
140
66
  WebkitBackgroundClip: "text",
141
67
  backgroundClip: "text",
142
68
  WebkitTextFillColor: "transparent"
143
69
  }));
144
- return (u, V) => (P(), N(g(J), {
70
+ return (t, b) => (D(), M(k(w), {
145
71
  tag: "span",
146
- class: L(["inline-block", u.className]),
147
- style: U({ ...w.value, backgroundPosition: g(f) }),
148
- onMouseenter: _,
149
- onMouseleave: I
72
+ class: _(["inline-block", t.className]),
73
+ style: S({ ...h.value, backgroundPosition: k(T) }),
74
+ onMouseenter: x,
75
+ onMouseleave: C
150
76
  }, {
151
- default: W(() => [
152
- G(j(u.text), 1)
77
+ default: z(() => [
78
+ H(N(t.text), 1)
153
79
  ]),
154
80
  _: 1
155
81
  }, 8, ["class", "style"]));
156
82
  }
157
83
  });
158
- h.install = (t) => {
159
- t.component(h.name, h);
84
+ m.install = (d) => {
85
+ d.component(m.name, m);
160
86
  };
161
87
  export {
162
- h as GShinyText,
163
- h as default
88
+ m as GShinyText,
89
+ m as default
164
90
  };