@supermousejs/labs 2.1.1 → 2.2.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/CHANGELOG.md CHANGED
@@ -1,75 +1,94 @@
1
- # @supermousejs/labs
2
-
3
- ## 2.1.1
4
-
5
- ### Patch Changes
6
-
7
- - 67f771b: Add relevant npm metadata to package.json file
8
- - Updated dependencies [67f771b]
9
- - @supermousejs/zoetrope@2.1.1
10
- - @supermousejs/utils@2.1.1
11
- - @supermousejs/core@2.0.5
12
-
13
- ## 2.1.0
14
-
15
- ### Minor Changes
16
-
17
- - 0a1652d: fixed build architecture and updated plugin metadata
18
-
19
- ### Patch Changes
20
-
21
- - Updated dependencies [0a1652d]
22
- - @supermousejs/zoetrope@2.1.0
23
- - @supermousejs/utils@2.1.0
24
-
25
- ## 2.0.4
26
-
27
- ### Patch Changes
28
-
29
- - 993dc67: Updated supemousejs packages with proper author, license and url descriptors to repo
30
- - Updated dependencies [993dc67]
31
- - @supermousejs/zoetrope@2.0.4
32
- - @supermousejs/utils@2.0.4
33
- - @supermousejs/core@2.0.4
34
-
35
- ## 2.0.3
36
-
37
- ### Patch Changes
38
-
39
- - Updated dependencies
40
- - @supermousejs/core@2.0.3
41
- - @supermousejs/utils@2.0.3
42
- - @supermousejs/zoetrope@2.0.3
43
-
44
- ## 2.0.2
45
-
46
- ### Patch Changes
47
-
48
- - ae219a0: Update READMEs with correct link to documentation
49
- - Updated dependencies [ae219a0]
50
- - @supermousejs/zoetrope@2.0.2
51
- - @supermousejs/utils@2.0.2
52
- - @supermousejs/core@2.0.2
53
-
54
- ## 2.0.1
55
-
56
- ### Patch Changes
57
-
58
- - Add minimal README.md files to packages
59
- - Updated dependencies
60
- - @supermousejs/zoetrope@2.0.1
61
- - @supermousejs/utils@2.0.1
62
- - @supermousejs/core@2.0.1
63
-
64
- ## 2.0.0
65
-
66
- ### Major Changes
67
-
68
- - Initial v2.0.0 release
69
-
70
- ### Patch Changes
71
-
72
- - Updated dependencies
73
- - @supermousejs/zoetrope@2.0.0
74
- - @supermousejs/utils@2.0.0
75
- - @supermousejs/core@2.0.0
1
+ # @supermousejs/labs
2
+
3
+ ## 2.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 9fa6ece: Add `injectStyles` to safely handle injecting global CSS styles into the document head
8
+
9
+ ### Patch Changes
10
+
11
+ - 6d70c18: remove legacy package and update supermouse domain in readme
12
+ - 14fb5b6: Updated tsconfig to be reference-compliant with core, utils and zoetrope when required
13
+ - Updated dependencies [6d70c18]
14
+ - Updated dependencies [2590af3]
15
+ - Updated dependencies [14fb5b6]
16
+ - Updated dependencies [9fe1a7b]
17
+ - Updated dependencies [9fa6ece]
18
+ - @supermousejs/core@2.1.0
19
+ - @supermousejs/utils@2.2.0
20
+ - @supermousejs/zoetrope@2.2.0
21
+
22
+ ## 2.1.1
23
+
24
+ ### Patch Changes
25
+
26
+ - 67f771b: Add relevant npm metadata to package.json file
27
+ - Updated dependencies [67f771b]
28
+ - @supermousejs/zoetrope@2.1.1
29
+ - @supermousejs/utils@2.1.1
30
+ - @supermousejs/core@2.0.5
31
+
32
+ ## 2.1.0
33
+
34
+ ### Minor Changes
35
+
36
+ - 0a1652d: fixed build architecture and updated plugin metadata
37
+
38
+ ### Patch Changes
39
+
40
+ - Updated dependencies [0a1652d]
41
+ - @supermousejs/zoetrope@2.1.0
42
+ - @supermousejs/utils@2.1.0
43
+
44
+ ## 2.0.4
45
+
46
+ ### Patch Changes
47
+
48
+ - 993dc67: Updated supemousejs packages with proper author, license and url descriptors to repo
49
+ - Updated dependencies [993dc67]
50
+ - @supermousejs/zoetrope@2.0.4
51
+ - @supermousejs/utils@2.0.4
52
+ - @supermousejs/core@2.0.4
53
+
54
+ ## 2.0.3
55
+
56
+ ### Patch Changes
57
+
58
+ - Updated dependencies
59
+ - @supermousejs/core@2.0.3
60
+ - @supermousejs/utils@2.0.3
61
+ - @supermousejs/zoetrope@2.0.3
62
+
63
+ ## 2.0.2
64
+
65
+ ### Patch Changes
66
+
67
+ - ae219a0: Update READMEs with correct link to documentation
68
+ - Updated dependencies [ae219a0]
69
+ - @supermousejs/zoetrope@2.0.2
70
+ - @supermousejs/utils@2.0.2
71
+ - @supermousejs/core@2.0.2
72
+
73
+ ## 2.0.1
74
+
75
+ ### Patch Changes
76
+
77
+ - Add minimal README.md files to packages
78
+ - Updated dependencies
79
+ - @supermousejs/zoetrope@2.0.1
80
+ - @supermousejs/utils@2.0.1
81
+ - @supermousejs/core@2.0.1
82
+
83
+ ## 2.0.0
84
+
85
+ ### Major Changes
86
+
87
+ - Initial v2.0.0 release
88
+
89
+ ### Patch Changes
90
+
91
+ - Updated dependencies
92
+ - @supermousejs/zoetrope@2.0.0
93
+ - @supermousejs/utils@2.0.0
94
+ - @supermousejs/core@2.0.0
package/LICENSE.md CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Sijibomi Olusunmbola
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Sijibomi Olusunmbola
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,42 +1,45 @@
1
-
2
- # @supermousejs/labs
3
-
4
- Experimental and advanced plugins for Supermouse.
5
-
6
- ## Included Plugins
7
-
8
- ### SmartIcon
9
- Morphs SVG icons based on semantic tags (links, inputs) or context.
10
-
11
- ```ts
12
- import { SmartIcon } from '@supermousejs/labs';
13
- app.use(SmartIcon({ icons: { default: '...', pointer: '...' } }));
14
- ```
15
-
16
- ### SmartRing
17
- A reactive ring that distorts with velocity and adapts to stuck elements.
18
-
19
- ```ts
20
- import { SmartRing } from '@supermousejs/labs';
21
- app.use(SmartRing({ enableSkew: true }));
22
- ```
23
-
24
- ### Sparkles
25
- Emits particle trails based on movement velocity.
26
-
27
- ```ts
28
- import { Sparkles } from '@supermousejs/labs';
29
- app.use(Sparkles({ color: 'gold' }));
30
- ```
31
-
32
- ### TextRing
33
- Rotates text around the cursor position.
34
-
35
- ```ts
36
- import { TextRing } from '@supermousejs/labs';
37
- app.use(TextRing({ text: 'LOADING • ' }));
38
- ```
39
-
40
- ## Documentation
41
-
42
- Full documentation and interactive playground available at [supermouse](https://supermouse.vercel.app) or [check out the repo](https://github.com/Whitestar14/supermouse-js).
1
+ # @supermousejs/labs
2
+
3
+ Experimental and advanced plugins for Supermouse.
4
+
5
+ ## Included Plugins
6
+
7
+ ### SmartIcon
8
+
9
+ Morphs SVG icons based on semantic tags (links, inputs) or context.
10
+
11
+ ```ts
12
+ import { SmartIcon } from "@supermousejs/labs";
13
+ app.use(SmartIcon({ icons: { default: "...", pointer: "..." } }));
14
+ ```
15
+
16
+ ### SmartRing
17
+
18
+ A reactive ring that distorts with velocity and adapts to stuck elements.
19
+
20
+ ```ts
21
+ import { SmartRing } from "@supermousejs/labs";
22
+ app.use(SmartRing({ enableSkew: true }));
23
+ ```
24
+
25
+ ### Sparkles
26
+
27
+ Emits particle trails based on movement velocity.
28
+
29
+ ```ts
30
+ import { Sparkles } from "@supermousejs/labs";
31
+ app.use(Sparkles({ color: "gold" }));
32
+ ```
33
+
34
+ ### TextRing
35
+
36
+ Rotates text around the cursor position.
37
+
38
+ ```ts
39
+ import { TextRing } from "@supermousejs/labs";
40
+ app.use(TextRing({ text: "LOADING • " }));
41
+ ```
42
+
43
+ ## Documentation
44
+
45
+ Full documentation and interactive playground available at [supermouse](https://supermouse.js.org) or [check out the repo](https://github.com/Whitestar14/supermouse-js).
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { SupermousePlugin } from '../../core/src/index.ts';
2
- import { ValueOrGetter } from '../../core/src/index.ts';
1
+ import { SupermousePlugin } from '../../core/src';
2
+ import { ValueOrGetter } from '../../core/src';
3
3
 
4
4
  export declare const SmartIcon: (options: SmartIconOptions) => SupermousePlugin;
5
5
 
package/dist/index.mjs CHANGED
@@ -1,29 +1,27 @@
1
- import { normalize as A, definePlugin as N, dom as n, math as w, Layers as k, effects as F } from "@supermousejs/utils";
1
+ import { normalize as p, definePlugin as N, dom as n, math as w, Layers as k, effects as F } from "@supermousejs/utils";
2
2
  import { getCirclePath as H, getCircumference as X, formatLoopText as Y } from "@supermousejs/zoetrope";
3
- function U(t, l) {
3
+ function j(t, a) {
4
4
  const o = t.tagName.toLowerCase();
5
5
  if (o === "input" || o === "textarea" || t.isContentEditable) {
6
6
  const i = t.type;
7
- if (["button", "submit", "checkbox", "radio", "range", "color"].includes(
8
- i
9
- )) {
10
- if (l.pointer)
7
+ if (["button", "submit", "checkbox", "radio", "range", "color"].includes(i)) {
8
+ if (a.pointer)
11
9
  return "pointer";
12
- } else if (l.text) return "text";
13
- } else if ((o === "a" || o === "button" || t.closest("a") || t.closest("button")) && l.pointer)
10
+ } else if (a.text) return "text";
11
+ } else if ((o === "a" || o === "button" || t.closest("a") || t.closest("button")) && a.pointer)
14
12
  return "pointer";
15
13
  return null;
16
14
  }
17
15
  const q = (t) => {
18
- let l, o = t.defaultState || "default", i = t.defaultState || "default", d = null, T = null, C = !1, x, h = 0, p = 0;
19
- const E = A(t.size, 24), r = A(t.followStrategy, "smooth"), S = A(t.anchor, "center"), v = A(t.rotateWithVelocity, !1), y = t.useSemanticTags ?? !0, c = t.transitionDuration ?? 200, s = t.offset ? t.offset[0] : 0, R = t.offset ? t.offset[1] : 0;
16
+ let a, o = t.defaultState || "default", i = t.defaultState || "default", d = null, T = null, A = !1, x, h = 0, C = 0;
17
+ const E = p(t.size, 24), r = p(t.followStrategy, "smooth"), S = p(t.anchor, "center"), v = p(t.rotateWithVelocity, !1), m = t.useSemanticTags ?? !0, c = t.transitionDuration ?? 200, s = t.offset ? t.offset[0] : 0, R = t.offset ? t.offset[1] : 0;
20
18
  return N(
21
19
  {
22
20
  name: t.name || "smart-icon",
23
21
  selector: "[data-supermouse-icon]",
24
22
  create: () => {
25
- const a = n.createActor("div");
26
- return a.style.zIndex = k.CURSOR, l = n.createActor("div"), n.applyStyles(l, {
23
+ const l = n.createActor("div");
24
+ return l.style.zIndex = k.CURSOR, a = n.createActor("div"), n.applyStyles(a, {
27
25
  width: "100%",
28
26
  height: "100%",
29
27
  display: "flex",
@@ -31,45 +29,51 @@ const q = (t) => {
31
29
  justifyContent: "center",
32
30
  transformOrigin: "center center",
33
31
  transform: "scale(1)",
34
- // Pre-baked ease. Note: If duration changes dynamically, this won't update.
35
32
  transition: `transform ${c / 2}ms cubic-bezier(0.16, 1, 0.3, 1)`
36
- }), l.innerHTML = t.icons[o] || "", a.appendChild(l), a;
33
+ }), a.innerHTML = t.icons[o] || "", n.injectStyles(
34
+ "supermouse-smart-icon-styles",
35
+ `
36
+ @keyframes sm {
37
+ 0% { transform: rotate(0deg); }
38
+ 100% { transform: rotate(360deg); }
39
+ }
40
+ .supermouse-spin {
41
+ animation: sm 1s linear infinite;
42
+ }
43
+ `
44
+ ), l.appendChild(a), l;
37
45
  },
38
46
  styles: {
39
47
  color: "color"
40
48
  },
41
- update: (a, g) => {
42
- const e = t.icons, m = a.state.hoverTarget;
49
+ update: (l, y) => {
50
+ const e = t.icons, g = l.state.hoverTarget;
43
51
  let f = t.defaultState || "default";
44
- if (m) {
45
- m !== d && (d = m, T = y ? U(m, e) : null);
46
- const L = a.state.interaction?.icon;
52
+ if (g) {
53
+ g !== d && (d = g, T = m ? j(g, e) : null);
54
+ const L = l.state.interaction?.icon;
47
55
  L && e[L] ? f = L : T && (f = T);
48
56
  } else
49
57
  d = null, T = null;
50
- f !== o && !C && (e[f] || f === (t.defaultState || "default")) && (i = f, C = !0, clearTimeout(x), l.style.transform = "scale(0)", x = setTimeout(() => {
51
- o = i, l.innerHTML = e[o] || "", l.style.transform = "scale(1)", x = setTimeout(() => {
52
- C = !1;
58
+ f !== o && !A && (e[f] || f === (t.defaultState || "default")) && (i = f, A = !0, clearTimeout(x), a.style.transform = "scale(0)", x = setTimeout(() => {
59
+ o = i, a.innerHTML = e[o] || "", a.style.transform = "scale(1)", x = setTimeout(() => {
60
+ A = !1;
53
61
  }, c / 2);
54
62
  }, c / 2));
55
- const b = E(a.state);
56
- n.setStyle(g, "width", `${b}px`), n.setStyle(g, "height", `${b}px`);
63
+ const b = E(l.state);
64
+ n.setStyle(y, "width", `${b}px`), n.setStyle(y, "height", `${b}px`);
57
65
  let u = 0, z = 0;
58
- const $ = b / 2, O = S(a.state);
66
+ const $ = b / 2, O = S(l.state);
59
67
  O !== "center" && (O.includes("left") && (u = $), O.includes("right") && (u = -$), O.includes("top") && (z = $), O.includes("bottom") && (z = -$));
60
68
  const P = o === "pointer" || o === "text";
61
- if (v(a.state) && !P && !a.state.reducedMotion) {
62
- const { x: L, y: I } = a.state.velocity;
63
- w.dist(L, I) > 1 && (p = w.angle(L, I)), h = w.lerpAngle(
64
- h,
65
- p,
66
- 0.15
67
- );
69
+ if (v(l.state) && !P && !l.state.reducedMotion) {
70
+ const { x: L, y: I } = l.state.velocity;
71
+ w.dist(L, I) > 1 && (C = w.angle(L, I)), h = w.lerpAngle(h, C, 0.15);
68
72
  } else
69
73
  h = w.lerpAngle(h, 0, 0.15);
70
- const M = r(a.state) === "raw" ? a.state.pointer : a.state.smooth;
74
+ const M = r(l.state) === "raw" ? l.state.pointer : l.state.smooth;
71
75
  n.setTransform(
72
- g,
76
+ y,
73
77
  M.x + s + u,
74
78
  M.y + R + z,
75
79
  h
@@ -82,14 +86,14 @@ const q = (t) => {
82
86
  t
83
87
  );
84
88
  }, V = (t = {}) => {
85
- const l = A(t.size, 20), o = A(t.hoverSize, 40), i = A(t.color, "#ffffff"), d = A(t.borderWidth, 2), T = A(t.fill, "transparent");
86
- let C = 20, x = 20, h = 0, p = 1, E = 1;
89
+ const a = p(t.size, 20), o = p(t.hoverSize, 40), i = p(t.color, "#ffffff"), d = p(t.borderWidth, 2), T = p(t.fill, "transparent");
90
+ let A = 20, x = 20, h = 0, C = 1, E = 1;
87
91
  return N(
88
92
  {
89
93
  name: t.name || "smart-ring",
90
94
  selector: "[data-supermouse-color]",
91
95
  create: (r) => {
92
- const S = n.createCircle(l(r.state), T(r.state));
96
+ const S = n.createCircle(a(r.state), T(r.state));
93
97
  return n.applyStyles(S, {
94
98
  zIndex: k.FOLLOWER,
95
99
  mixBlendMode: t.mixBlendMode || "difference",
@@ -98,39 +102,39 @@ const q = (t) => {
98
102
  }), S;
99
103
  },
100
104
  update: (r, S) => {
101
- const v = l(r.state), y = r.state.shape;
102
- let c = v, s = v, R = "50%", a = i(r.state);
103
- y ? (c = y.width, s = y.height, R = `${y.borderRadius}px`) : (r.state.isHover && (c = o(r.state), s = o(r.state)), r.state.isDown && (c *= 0.9, s *= 0.9)), r.state.interaction.color && (a = r.state.interaction.color), C = w.lerp(C, c, 0.2), x = w.lerp(x, s, 0.2), n.setStyle(S, "width", `${C}px`), n.setStyle(S, "height", `${x}px`), n.setStyle(S, "borderRadius", R), n.setStyle(S, "borderColor", a), n.setStyle(S, "backgroundColor", T(r.state)), n.setStyle(S, "borderWidth", `${d(r.state)}px`);
104
- let g = 0, e = 1, m = 1;
105
- if (!y && t.enableSkew && !r.state.reducedMotion) {
105
+ const v = a(r.state), m = r.state.shape;
106
+ let c = v, s = v, R = "50%", l = i(r.state);
107
+ m ? (c = m.width, s = m.height, R = `${m.borderRadius}px`) : (r.state.isHover && (c = o(r.state), s = o(r.state)), r.state.isDown && (c *= 0.9, s *= 0.9)), r.state.interaction.color && (l = r.state.interaction.color), A = w.lerp(A, c, 0.2), x = w.lerp(x, s, 0.2), n.setStyle(S, "width", `${A}px`), n.setStyle(S, "height", `${x}px`), n.setStyle(S, "borderRadius", R), n.setStyle(S, "borderColor", l), n.setStyle(S, "backgroundColor", T(r.state)), n.setStyle(S, "borderWidth", `${d(r.state)}px`);
108
+ let y = 0, e = 1, g = 1;
109
+ if (!m && t.enableSkew && !r.state.reducedMotion) {
106
110
  const { velocity: u } = r.state, z = F.getVelocityDistortion(u.x, u.y);
107
- g = z.rotation, e = z.scaleX, m = z.scaleY, h = w.lerpAngle(h, g, 0.15);
111
+ y = z.rotation, e = z.scaleX, g = z.scaleY, h = w.lerpAngle(h, y, 0.15);
108
112
  } else
109
113
  h = 0;
110
- p = w.lerp(p, e, 0.15), E = w.lerp(E, m, 0.15);
114
+ C = w.lerp(C, e, 0.15), E = w.lerp(E, g, 0.15);
111
115
  const { x: f, y: b } = r.state.smooth;
112
- n.setTransform(S, f, b, h, p, E);
116
+ n.setTransform(S, f, b, h, C, E);
113
117
  }
114
118
  },
115
119
  t
116
120
  );
117
121
  }, G = (t = {}) => {
118
- const l = t.count || 30, o = t.decay || 0.05, i = t.frequency || 10, d = t.scatter || 5, C = A(t.color, "#ff00ff"), x = [];
119
- let h = 0, p = 0, E = !1, r = 0;
120
- const S = (v, y, c) => {
122
+ const a = t.count || 30, o = t.decay || 0.05, i = t.frequency || 10, d = t.scatter || 5, A = p(t.color, "#ff00ff"), x = [];
123
+ let h = 0, C = 0, E = !1, r = 0;
124
+ const S = (v, m, c) => {
121
125
  const s = x.find((e) => !e.isActive);
122
126
  if (!s) return;
123
- s.isActive = !0, s.life = 1, s.x = v + w.random(-d, d), s.y = y + w.random(-d, d);
124
- const R = w.random(0, Math.PI * 2), a = w.random(0.5, 1.5);
125
- s.vx = Math.cos(R) * a, s.vy = Math.sin(R) * a, s.scale = w.random(0.5, 1.2), s.color = c;
126
- const g = w.random(2, 5);
127
- n.setStyle(s.el, "width", `${g}px`), n.setStyle(s.el, "height", `${g}px`), n.setStyle(s.el, "backgroundColor", c), n.setStyle(s.el, "opacity", "1"), n.setTransform(s.el, s.x, s.y, 0, s.scale, s.scale);
127
+ s.isActive = !0, s.life = 1, s.x = v + w.random(-d, d), s.y = m + w.random(-d, d);
128
+ const R = w.random(0, Math.PI * 2), l = w.random(0.5, 1.5);
129
+ s.vx = Math.cos(R) * l, s.vy = Math.sin(R) * l, s.scale = w.random(0.5, 1.2), s.color = c;
130
+ const y = w.random(2, 5);
131
+ n.setStyle(s.el, "width", `${y}px`), n.setStyle(s.el, "height", `${y}px`), n.setStyle(s.el, "backgroundColor", c), n.setStyle(s.el, "opacity", "1"), n.setTransform(s.el, s.x, s.y, 0, s.scale, s.scale);
128
132
  };
129
133
  return N(
130
134
  {
131
135
  name: t.name || "sparkles",
132
136
  install(v) {
133
- for (let y = 0; y < l; y++) {
137
+ for (let m = 0; m < a; m++) {
134
138
  const c = n.createCircle(0, "transparent");
135
139
  n.applyStyles(c, {
136
140
  zIndex: k.TRACE,
@@ -151,27 +155,27 @@ const q = (t) => {
151
155
  }
152
156
  },
153
157
  update(v) {
154
- const { x: y, y: c } = v.state.pointer;
155
- E || (h = y, p = c, E = !0);
156
- const s = y - h, R = c - p, a = Math.hypot(s, R);
157
- if (r += a, r > i) {
158
- const g = C(v.state), e = Math.floor(r / i);
159
- for (let m = 0; m < e; m++) {
160
- const f = m / e, b = h + s * f, u = p + R * f;
161
- S(b, u, g);
158
+ const { x: m, y: c } = v.state.pointer;
159
+ E || (h = m, C = c, E = !0);
160
+ const s = m - h, R = c - C, l = Math.hypot(s, R);
161
+ if (r += l, r > i) {
162
+ const y = A(v.state), e = Math.floor(r / i);
163
+ for (let g = 0; g < e; g++) {
164
+ const f = g / e, b = h + s * f, u = C + R * f;
165
+ S(b, u, y);
162
166
  }
163
167
  r = r % i;
164
168
  }
165
- h = y, p = c;
166
- for (let g = 0; g < l; g++) {
167
- const e = x[g];
169
+ h = m, C = c;
170
+ for (let y = 0; y < a; y++) {
171
+ const e = x[y];
168
172
  if (e.isActive)
169
173
  if (e.x += e.vx, e.y += e.vy, e.life -= o, e.life <= 0)
170
174
  e.isActive = !1, e.el.style.opacity = "0";
171
175
  else {
172
176
  e.el.style.opacity = String(e.life);
173
- const m = e.scale * e.life;
174
- n.setTransform(e.el, e.x, e.y, 0, m, m);
177
+ const g = e.scale * e.life;
178
+ n.setTransform(e.el, e.x, e.y, 0, g, g);
175
179
  }
176
180
  }
177
181
  },
@@ -182,48 +186,51 @@ const q = (t) => {
182
186
  t
183
187
  );
184
188
  };
185
- let j = 0;
189
+ let U = 0;
186
190
  const J = (t = {}) => {
187
- let l, o, i, d, T;
188
- const C = `supermouse-text-ring-path-${j++}`, x = "SUPERMOUSE • SUPERMOUSE • ", h = 60, p = 12, E = 0.5, r = t.className || "", S = t.spread ?? !1, v = A(t.text, x), y = A(t.radius, h), c = A(t.fontSize, p), s = A(t.speed, E), R = A(t.opacity, 1);
189
- let a = 0, g = "", e = 0, m = 0;
190
- return N({
191
- name: "text-ring",
192
- selector: "[data-supermouse-text-ring]",
193
- create: (f) => {
194
- const b = n.createActor("div");
195
- n.applyStyles(b, {
196
- zIndex: k.FOLLOWER,
197
- transition: "opacity 0.2s ease",
198
- opacity: "1",
199
- width: "0px",
200
- height: "0px",
201
- overflow: "visible",
202
- display: "flex",
203
- alignItems: "center",
204
- justifyContent: "center"
205
- }), r && b.classList.add(...r.split(" ").filter(Boolean)), l = document.createElementNS("http://www.w3.org/2000/svg", "svg"), l.style.overflow = "visible", l.style.position = "absolute", l.style.left = "0", l.style.top = "0", o = document.createElementNS("http://www.w3.org/2000/svg", "path"), o.setAttribute("id", C), o.setAttribute("fill", "none"), d = document.createElementNS("http://www.w3.org/2000/svg", "text");
206
- const u = c(f.state);
207
- return d.setAttribute("font-size", `${u}px`), m = u, d.setAttribute("fill", "currentColor"), d.style.textTransform = "uppercase", d.style.letterSpacing = "2px", i = document.createElementNS("http://www.w3.org/2000/svg", "textPath"), i.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", `#${C}`), i.setAttribute("href", `#${C}`), i.setAttribute("startOffset", "0%"), T = document.createTextNode(""), i.appendChild(T), d.appendChild(i), l.appendChild(o), l.appendChild(d), b.appendChild(l), b;
208
- },
209
- styles: {
210
- color: "color"
191
+ let a, o, i, d, T;
192
+ const A = `supermouse-text-ring-path-${U++}`, x = "SUPERMOUSE • SUPERMOUSE • ", h = 60, C = 12, E = 0.5, r = t.className || "", S = t.spread ?? !1, v = p(t.text, x), m = p(t.radius, h), c = p(t.fontSize, C), s = p(t.speed, E), R = p(t.opacity, 1);
193
+ let l = 0, y = "", e = 0, g = 0;
194
+ return N(
195
+ {
196
+ name: "text-ring",
197
+ selector: "[data-supermouse-text-ring]",
198
+ create: (f) => {
199
+ const b = n.createActor("div");
200
+ n.applyStyles(b, {
201
+ zIndex: k.FOLLOWER,
202
+ transition: "opacity 0.2s ease",
203
+ opacity: "1",
204
+ width: "0px",
205
+ height: "0px",
206
+ overflow: "visible",
207
+ display: "flex",
208
+ alignItems: "center",
209
+ justifyContent: "center"
210
+ }), r && b.classList.add(...r.split(" ").filter(Boolean)), a = document.createElementNS("http://www.w3.org/2000/svg", "svg"), a.style.overflow = "visible", a.style.position = "absolute", a.style.left = "0", a.style.top = "0", o = document.createElementNS("http://www.w3.org/2000/svg", "path"), o.setAttribute("id", A), o.setAttribute("fill", "none"), d = document.createElementNS("http://www.w3.org/2000/svg", "text");
211
+ const u = c(f.state);
212
+ return d.setAttribute("font-size", `${u}px`), g = u, d.setAttribute("fill", "currentColor"), d.style.textTransform = "uppercase", d.style.letterSpacing = "2px", i = document.createElementNS("http://www.w3.org/2000/svg", "textPath"), i.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", `#${A}`), i.setAttribute("href", `#${A}`), i.setAttribute("startOffset", "0%"), T = document.createTextNode(""), i.appendChild(T), d.appendChild(i), a.appendChild(o), a.appendChild(d), b.appendChild(a), b;
213
+ },
214
+ styles: {
215
+ color: "color"
216
+ },
217
+ update: (f, b) => {
218
+ let u = v(f.state);
219
+ const z = m(f.state), $ = c(f.state), O = s(f.state), P = R(f.state);
220
+ n.setStyle(b, "opacity", String(P));
221
+ const M = f.state.interaction;
222
+ if (M.textRing && typeof M.textRing == "string" ? u = M.textRing : M.text && typeof M.text == "string" && (u = M.text), z !== e && (o.setAttribute("d", H(z)), e = z), S) {
223
+ const W = X(z);
224
+ i.setAttribute("textLength", String(W)), i.setAttribute("lengthAdjust", "spacing"), u = Y(u, !0);
225
+ } else
226
+ i.removeAttribute("textLength"), i.removeAttribute("lengthAdjust");
227
+ $ !== g && (d.setAttribute("font-size", `${$}px`), g = $), u !== y && (T.textContent = u, y = u), l += O;
228
+ const { x: L, y: I } = f.state.smooth;
229
+ n.setTransform(b, L, I, l);
230
+ }
211
231
  },
212
- update: (f, b) => {
213
- let u = v(f.state);
214
- const z = y(f.state), $ = c(f.state), O = s(f.state), P = R(f.state);
215
- n.setStyle(b, "opacity", String(P));
216
- const M = f.state.interaction;
217
- if (M.textRing && typeof M.textRing == "string" ? u = M.textRing : M.text && typeof M.text == "string" && (u = M.text), z !== e && (o.setAttribute("d", H(z)), e = z), S) {
218
- const W = X(z);
219
- i.setAttribute("textLength", String(W)), i.setAttribute("lengthAdjust", "spacing"), u = Y(u, !0);
220
- } else
221
- i.removeAttribute("textLength"), i.removeAttribute("lengthAdjust");
222
- $ !== m && (d.setAttribute("font-size", `${$}px`), m = $), u !== g && (T.textContent = u, g = u), a += O;
223
- const { x: L, y: I } = f.state.smooth;
224
- n.setTransform(b, L, I, a);
225
- }
226
- }, t);
232
+ t
233
+ );
227
234
  };
228
235
  export {
229
236
  q as SmartIcon,