@supermousejs/utils 2.3.1 → 2.4.1
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 +35 -0
- package/README.md +613 -8
- package/dist/css.d.ts +14 -0
- package/dist/css.d.ts.map +1 -1
- package/dist/doctor.d.ts +7 -4
- package/dist/doctor.d.ts.map +1 -1
- package/dist/dom.d.ts +24 -14
- package/dist/dom.d.ts.map +1 -1
- package/dist/index.d.ts +10 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +425 -131
- package/dist/index.umd.js +5 -1
- package/dist/math.d.ts +1 -0
- package/dist/math.d.ts.map +1 -1
- package/dist/options.d.ts +30 -0
- package/dist/options.d.ts.map +1 -1
- package/dist/plugin.d.ts +99 -22
- package/dist/plugin.d.ts.map +1 -1
- package/dist/svg.d.ts +36 -0
- package/dist/svg.d.ts.map +1 -0
- package/package.json +6 -4
- package/src/css.ts +18 -0
- package/src/doctor.ts +285 -32
- package/src/dom.ts +53 -31
- package/src/index.ts +15 -11
- package/src/math.ts +4 -0
- package/src/options.ts +65 -22
- package/src/plugin.ts +183 -119
- package/src/svg.ts +119 -0
- package/dist/layers.d.ts +0 -15
- package/dist/layers.d.ts.map +0 -1
- package/src/layers.ts +0 -17
package/dist/index.mjs
CHANGED
|
@@ -1,67 +1,78 @@
|
|
|
1
1
|
function y(e, t, n) {
|
|
2
2
|
return e + (t - e) * n;
|
|
3
3
|
}
|
|
4
|
-
function
|
|
4
|
+
function E(e, t, n, r) {
|
|
5
5
|
return y(e, t, 1 - Math.exp(-n * r));
|
|
6
6
|
}
|
|
7
|
-
function
|
|
7
|
+
function $(e, t, n) {
|
|
8
8
|
const r = ((t - e) % 360 + 540) % 360 - 180;
|
|
9
9
|
return e + r * n;
|
|
10
10
|
}
|
|
11
11
|
function O(e, t) {
|
|
12
12
|
return Math.random() * (t - e) + e;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function g(e, t, n) {
|
|
15
15
|
return Math.min(Math.max(e, t), n);
|
|
16
16
|
}
|
|
17
17
|
function b(e, t, n = 0, r = 0) {
|
|
18
|
-
const o = e - n,
|
|
19
|
-
return Math.sqrt(o * o +
|
|
18
|
+
const o = e - n, s = t - r;
|
|
19
|
+
return Math.sqrt(o * o + s * s);
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function S(e, t) {
|
|
22
22
|
return Math.atan2(t, e) * (180 / Math.PI);
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
function I(e) {
|
|
25
|
+
return 2 * Math.PI * e;
|
|
26
|
+
}
|
|
27
|
+
const se = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
25
28
|
__proto__: null,
|
|
26
|
-
angle:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
angle: S,
|
|
30
|
+
circumference: I,
|
|
31
|
+
clamp: g,
|
|
32
|
+
damp: E,
|
|
29
33
|
dist: b,
|
|
30
34
|
lerp: y,
|
|
31
|
-
lerpAngle:
|
|
35
|
+
lerpAngle: $,
|
|
32
36
|
random: O
|
|
33
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
37
|
+
}, Symbol.toStringTag, { value: "Module" })), M = (e, t) => {
|
|
34
38
|
if (typeof document > "u" || document.getElementById(e)) return;
|
|
35
39
|
const n = document.createElement("style");
|
|
36
40
|
n.id = e, n.innerHTML = t, document.head.appendChild(n);
|
|
37
|
-
},
|
|
38
|
-
function
|
|
41
|
+
}, m = /* @__PURE__ */ new WeakMap();
|
|
42
|
+
function C(e) {
|
|
43
|
+
return e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
44
|
+
}
|
|
45
|
+
function l(e, t) {
|
|
39
46
|
if (typeof document > "u" || !e) return;
|
|
40
|
-
let n =
|
|
41
|
-
n || (n = {},
|
|
42
|
-
for (const r
|
|
43
|
-
|
|
44
|
-
|
|
47
|
+
let n = m.get(e);
|
|
48
|
+
n || (n = {}, m.set(e, n));
|
|
49
|
+
for (const [r, o] of Object.entries(t)) {
|
|
50
|
+
if (o === void 0) continue;
|
|
51
|
+
const s = String(o), c = C(r);
|
|
52
|
+
n[c] !== s && (e.style.setProperty(c, s), n[c] = s);
|
|
45
53
|
}
|
|
46
54
|
}
|
|
47
|
-
function
|
|
48
|
-
|
|
55
|
+
function _(e, t, n) {
|
|
56
|
+
l(e, { [t]: n });
|
|
57
|
+
}
|
|
58
|
+
function T(e, t) {
|
|
59
|
+
l(e, t);
|
|
49
60
|
}
|
|
50
|
-
function
|
|
51
|
-
const
|
|
52
|
-
|
|
61
|
+
function x(e, t, n, r = 0, o = 1, s = 1, c = 0, i = 0) {
|
|
62
|
+
const f = `translate3d(${t}px, ${n}px, 0) translate(-50%, -50%) rotate(${r}deg) skew(${c}deg, ${i}deg) scale(${o}, ${s})`;
|
|
63
|
+
l(e, { transform: f });
|
|
53
64
|
}
|
|
54
|
-
function
|
|
65
|
+
function P(e, t = document.body) {
|
|
55
66
|
const n = e.getBoundingClientRect();
|
|
56
67
|
if (t !== document.body) {
|
|
57
|
-
const r = t.getBoundingClientRect(), o = n.left - r.left,
|
|
58
|
-
return new DOMRect(o,
|
|
68
|
+
const r = t.getBoundingClientRect(), o = n.left - r.left, s = n.top - r.top;
|
|
69
|
+
return new DOMRect(o, s, n.width, n.height);
|
|
59
70
|
}
|
|
60
71
|
return n;
|
|
61
72
|
}
|
|
62
|
-
function
|
|
73
|
+
function p(e = "div") {
|
|
63
74
|
const t = document.createElement(e);
|
|
64
|
-
return
|
|
75
|
+
return l(t, {
|
|
65
76
|
position: "absolute",
|
|
66
77
|
top: "0",
|
|
67
78
|
left: "0",
|
|
@@ -72,134 +83,417 @@ function d(e = "div") {
|
|
|
72
83
|
}), t;
|
|
73
84
|
}
|
|
74
85
|
function R(e, t) {
|
|
75
|
-
const n =
|
|
76
|
-
return
|
|
86
|
+
const n = p("div");
|
|
87
|
+
return l(n, {
|
|
77
88
|
width: `${e}px`,
|
|
78
89
|
height: `${e}px`,
|
|
79
90
|
borderRadius: "50%",
|
|
80
91
|
backgroundColor: t
|
|
81
92
|
}), n;
|
|
82
93
|
}
|
|
83
|
-
function
|
|
84
|
-
return
|
|
94
|
+
function A() {
|
|
95
|
+
return p("div");
|
|
85
96
|
}
|
|
86
|
-
const
|
|
97
|
+
const ce = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
87
98
|
__proto__: null,
|
|
88
|
-
applyStyles:
|
|
89
|
-
createActor:
|
|
99
|
+
applyStyles: T,
|
|
100
|
+
createActor: p,
|
|
90
101
|
createCircle: R,
|
|
91
|
-
createDiv:
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
102
|
+
createDiv: A,
|
|
103
|
+
css: l,
|
|
104
|
+
injectStyles: M,
|
|
105
|
+
projectRect: P,
|
|
106
|
+
setStyle: _,
|
|
107
|
+
setTransform: x
|
|
96
108
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
97
|
-
function
|
|
109
|
+
function k(e, t, n = 4e-3, r = 0.5) {
|
|
98
110
|
const o = b(e, t);
|
|
99
111
|
if (o < 0.1)
|
|
100
112
|
return { rotation: 0, scaleX: 1, scaleY: 1 };
|
|
101
|
-
const
|
|
113
|
+
const s = S(e, t), c = g(o * n, 0, r), i = 1 + c, f = 1 - c * 0.5;
|
|
102
114
|
return {
|
|
103
|
-
rotation:
|
|
104
|
-
scaleX:
|
|
105
|
-
scaleY:
|
|
115
|
+
rotation: s,
|
|
116
|
+
scaleX: i,
|
|
117
|
+
scaleY: f
|
|
106
118
|
};
|
|
107
119
|
}
|
|
108
|
-
const
|
|
120
|
+
const ue = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
109
121
|
__proto__: null,
|
|
110
|
-
getVelocityDistortion:
|
|
111
|
-
}, Symbol.toStringTag, { value: "Module" }))
|
|
112
|
-
|
|
113
|
-
OVERLAY: "400",
|
|
114
|
-
/** The main cursor layer. For the primary Dot/Pointer. */
|
|
115
|
-
CURSOR: "300",
|
|
116
|
-
/** The secondary layer. For Rings, brackets, or followers. */
|
|
117
|
-
FOLLOWER: "200",
|
|
118
|
-
/** The background layer. For trails, sparkles, and particles. */
|
|
119
|
-
TRACE: "100"
|
|
120
|
-
}, L = {
|
|
121
|
-
/** Good for entrance animations (starts fast, slows down) */
|
|
122
|
-
EASE_OUT_EXPO: "cubic-bezier(0.16, 1, 0.3, 1)",
|
|
123
|
-
/** Good for elastic/bouncy UI elements */
|
|
124
|
-
ELASTIC_OUT: "cubic-bezier(0.34, 1.56, 0.64, 1)",
|
|
125
|
-
/** Standard smooth movement */
|
|
126
|
-
SMOOTH: "ease-out"
|
|
127
|
-
};
|
|
128
|
-
function A(e, t) {
|
|
122
|
+
getVelocityDistortion: k
|
|
123
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
124
|
+
function N(e, t) {
|
|
129
125
|
return e === void 0 ? () => t : typeof e == "function" ? e : () => e;
|
|
130
126
|
}
|
|
131
|
-
function
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
127
|
+
function ae(e, t) {
|
|
128
|
+
const n = {};
|
|
129
|
+
for (const r of Object.keys(t))
|
|
130
|
+
n[r] = N(
|
|
131
|
+
e[r],
|
|
132
|
+
t[r]
|
|
133
|
+
);
|
|
134
|
+
return n;
|
|
135
|
+
}
|
|
136
|
+
const le = () => typeof window < "u" && window.matchMedia("(pointer: fine)").matches, h = "[supermouse] doctor", a = {
|
|
137
|
+
brand: "color: #ffffff; background: #42b883; padding: 2px 4px; border-radius: 2px; font-weight: 700;",
|
|
138
|
+
error: "color: #ffffff; background: #f43f5e; padding: 2px 4px; border-radius: 2px; font-weight: 700;",
|
|
139
|
+
warn: "color: #1f2937; background: #f59e0b; padding: 2px 4px; border-radius: 2px; font-weight: 700;",
|
|
140
|
+
info: "color: #ffffff; background: #3b82f6; padding: 2px 4px; border-radius: 2px; font-weight: 700;",
|
|
141
|
+
dim: "color: #6b7280;",
|
|
142
|
+
code: "color: #a1a1aa; font-weight: 500;",
|
|
143
|
+
hint: "color: #10b981; font-weight: 600;"
|
|
144
|
+
};
|
|
145
|
+
function fe(e) {
|
|
146
|
+
const t = e ? D(e) : w();
|
|
147
|
+
H(t);
|
|
148
|
+
}
|
|
149
|
+
function D(e) {
|
|
150
|
+
const t = e.plugins ?? [], n = e.options ?? {};
|
|
151
|
+
return [
|
|
152
|
+
...j(t),
|
|
153
|
+
...z(t),
|
|
154
|
+
...V(t),
|
|
155
|
+
...B(n),
|
|
156
|
+
...U(n),
|
|
157
|
+
...G(n, e.state),
|
|
158
|
+
...w(e)
|
|
159
|
+
];
|
|
160
|
+
}
|
|
161
|
+
function v(e) {
|
|
162
|
+
return e.element !== void 0 || typeof e.update == "function" && e.update.length >= 3;
|
|
163
|
+
}
|
|
164
|
+
function L(e) {
|
|
165
|
+
return e.element !== void 0 ? !1 : typeof e.update == "function" && e.update.length === 2;
|
|
166
|
+
}
|
|
167
|
+
function j(e) {
|
|
168
|
+
const t = [];
|
|
169
|
+
for (const n of e) {
|
|
170
|
+
const r = n.name ?? "unknown", o = n.priority ?? 0;
|
|
171
|
+
L(n) && o >= 0 && t.push({
|
|
172
|
+
severity: "warn",
|
|
173
|
+
code: "PRIORITY_LOGIC",
|
|
174
|
+
message: `Plugin "${r}" has priority ${o} but appears to be a logic plugin (should run before physics).`,
|
|
175
|
+
hint: `Set priority to a negative value (e.g. -10) on "${r}"`
|
|
176
|
+
}), v(n) && o < 0 && t.push({
|
|
177
|
+
severity: "warn",
|
|
178
|
+
code: "PRIORITY_VISUAL",
|
|
179
|
+
message: `Plugin "${r}" has priority ${o} but appears to be a visual plugin (should run after physics).`,
|
|
180
|
+
hint: "Remove priority or use a positive value"
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
return t;
|
|
184
|
+
}
|
|
185
|
+
function z(e) {
|
|
186
|
+
const t = e.find((r) => r.name === "states");
|
|
187
|
+
if (!t) return [];
|
|
188
|
+
const n = t.priority ?? 0;
|
|
189
|
+
return n >= 0 ? [
|
|
190
|
+
{
|
|
191
|
+
severity: "error",
|
|
192
|
+
code: "STATES_PRIORITY",
|
|
193
|
+
message: `States plugin has priority ${n}. It must run before all visual plugins.`,
|
|
194
|
+
hint: "Set priority: -999 on the States plugin"
|
|
195
|
+
}
|
|
196
|
+
] : [];
|
|
197
|
+
}
|
|
198
|
+
function V(e) {
|
|
199
|
+
const t = [];
|
|
200
|
+
for (const n of e) {
|
|
201
|
+
const r = n.name ?? "unknown";
|
|
202
|
+
v(n) && !n.element && t.push({
|
|
203
|
+
severity: "warn",
|
|
204
|
+
code: "MISSING_ELEMENT",
|
|
205
|
+
message: `Plugin "${r}" has no 'element' property — disablePlugin() will not hide its DOM.`,
|
|
206
|
+
hint: "Assign plugin.element = el in install(), or use definePlugin()"
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
return t;
|
|
210
|
+
}
|
|
211
|
+
function B(e) {
|
|
212
|
+
const t = document.querySelectorAll('[class*="supermouse-scope-"]');
|
|
213
|
+
return t.length <= 1 ? [] : e.container !== document.body ? [] : [
|
|
214
|
+
{
|
|
215
|
+
severity: "warn",
|
|
216
|
+
code: "MULTI_INSTANCE",
|
|
217
|
+
message: `Detected ${t.length} Supermouse instances. The body instance may conflict with scoped ones.`,
|
|
218
|
+
hint: "Use suspend() / resume() or scope instances to different containers"
|
|
219
|
+
}
|
|
220
|
+
];
|
|
221
|
+
}
|
|
222
|
+
function U(e) {
|
|
223
|
+
const t = e.container;
|
|
224
|
+
return !t || t === document.body ? [] : window.getComputedStyle(t).position !== "static" ? [] : [
|
|
225
|
+
{
|
|
226
|
+
severity: "info",
|
|
227
|
+
code: "CONTAINER_POSITION",
|
|
228
|
+
message: "Container has position:static. Supermouse will mutate it to relative.",
|
|
229
|
+
hint: "Set position: relative in your CSS to avoid the mutation"
|
|
230
|
+
}
|
|
231
|
+
];
|
|
232
|
+
}
|
|
233
|
+
function G(e, t) {
|
|
234
|
+
const n = e.cursor;
|
|
235
|
+
if (n === void 0) return [];
|
|
236
|
+
const r = ["auto", "custom", "native", "both"];
|
|
237
|
+
return typeof n == "string" && !r.includes(n) ? [
|
|
238
|
+
{
|
|
239
|
+
severity: "error",
|
|
240
|
+
code: "INVALID_CURSOR_MODE",
|
|
241
|
+
message: `Invalid cursor mode "${n}". Expected one of: ${r.join(", ")}.`,
|
|
242
|
+
hint: `Set cursor to one of: ${r.join(", ")}`
|
|
243
|
+
}
|
|
244
|
+
] : n === "both" && e.container !== document.body && t?.cursorMode === "both" ? [
|
|
245
|
+
{
|
|
246
|
+
severity: "warn",
|
|
247
|
+
code: "NESTED_BOTH_MODE",
|
|
248
|
+
message: "Scoped instance uses cursor: 'both'. In nested scopes, the native cursor may be hidden by the outer instance's cursor suppression.",
|
|
249
|
+
hint: "Offset the custom cursor when cursorMode === 'both' or consider a single-instance scope architecture"
|
|
250
|
+
}
|
|
251
|
+
] : [];
|
|
252
|
+
}
|
|
253
|
+
function w(e) {
|
|
254
|
+
const t = [];
|
|
255
|
+
if (!Array.from(document.querySelectorAll("style")).some(
|
|
256
|
+
(o) => o.id.startsWith("supermouse-style-")
|
|
257
|
+
))
|
|
258
|
+
return [
|
|
259
|
+
{
|
|
260
|
+
severity: "error",
|
|
261
|
+
code: "NOT_INITIALIZED",
|
|
262
|
+
message: "Supermouse has not been initialized yet.",
|
|
263
|
+
hint: "Call doctor() after new Supermouse() has run"
|
|
168
264
|
}
|
|
169
|
-
|
|
170
|
-
|
|
265
|
+
];
|
|
266
|
+
document.querySelectorAll('[style*="cursor"]').forEach((o) => {
|
|
267
|
+
const s = o.getAttribute("style") ?? "";
|
|
268
|
+
s.includes("cursor: none") || s.includes("cursor") && t.push({
|
|
269
|
+
severity: "warn",
|
|
270
|
+
code: "INLINE_CURSOR",
|
|
271
|
+
message: "Element has an inline cursor style that may override Supermouse.",
|
|
272
|
+
hint: "Remove inline cursor styles"
|
|
273
|
+
});
|
|
274
|
+
});
|
|
275
|
+
const r = document.querySelector(".supermouse-scope-0");
|
|
276
|
+
if (r) {
|
|
277
|
+
const o = r.classList.contains("supermouse-hide-0"), s = e?.state?.cursorMode ?? "auto", c = e?.state?.hasReceivedInput ?? !0, i = e?.input?.isEnabled ?? !0;
|
|
278
|
+
s === "custom" && i && c && !o && t.push({
|
|
279
|
+
severity: "warn",
|
|
280
|
+
code: "BODY_CURSOR_LEAK",
|
|
281
|
+
message: "Body instance has cursor: 'custom' but native cursor suppression class is not applied.",
|
|
282
|
+
hint: "Check that the animation loop is running and setCursor('custom') was called"
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
return t;
|
|
286
|
+
}
|
|
287
|
+
function H(e) {
|
|
288
|
+
if (e.length === 0) {
|
|
289
|
+
console.log(`%c${h}%c No issues found`, a.brand, a.dim);
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
const t = [
|
|
293
|
+
d(e, "error", "error"),
|
|
294
|
+
d(e, "warn", "warning"),
|
|
295
|
+
d(e, "info", "note")
|
|
296
|
+
].filter((n) => n !== null).join(" · ");
|
|
297
|
+
console.log(`%c${h}%c ${t}`, a.brand, a.dim);
|
|
298
|
+
for (const n of e)
|
|
299
|
+
Y(n);
|
|
300
|
+
}
|
|
301
|
+
function d(e, t, n) {
|
|
302
|
+
const r = e.filter((o) => o.severity === t).length;
|
|
303
|
+
return r > 0 ? `${r} ${n}${r > 1 ? "s" : ""}` : null;
|
|
304
|
+
}
|
|
305
|
+
function Y(e) {
|
|
306
|
+
console.log(
|
|
307
|
+
`%c${e.severity.toUpperCase()}%c %c${e.code}%c ${e.message}`,
|
|
308
|
+
a[e.severity],
|
|
309
|
+
a.dim,
|
|
310
|
+
a.code,
|
|
311
|
+
"color: inherit;"
|
|
312
|
+
), e.hint && console.log(` %c→%c ${e.hint}`, a.hint, a.dim);
|
|
313
|
+
}
|
|
314
|
+
function q(e) {
|
|
315
|
+
return typeof e.create == "function";
|
|
316
|
+
}
|
|
317
|
+
function de(e, t = {}) {
|
|
318
|
+
const n = t.name ?? e.name, r = t.isEnabled ?? !0;
|
|
319
|
+
if (!q(e))
|
|
171
320
|
return {
|
|
172
321
|
...e,
|
|
173
322
|
name: n,
|
|
174
323
|
isEnabled: r
|
|
175
324
|
};
|
|
325
|
+
let o = null, s = !1;
|
|
326
|
+
const c = (i) => {
|
|
327
|
+
if (o)
|
|
328
|
+
return e.beforeDisable?.(i, o);
|
|
329
|
+
};
|
|
330
|
+
return {
|
|
331
|
+
name: n,
|
|
332
|
+
isEnabled: r,
|
|
333
|
+
priority: e.priority,
|
|
334
|
+
install(i) {
|
|
335
|
+
if (o = e.create(i), !(o instanceof HTMLElement) && !(o instanceof SVGElement)) {
|
|
336
|
+
console.warn(
|
|
337
|
+
`[supermouse] Plugin "${n}" create() did not return an HTMLElement or SVGElement.`
|
|
338
|
+
);
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
341
|
+
this.element = i.stage.appendChild(o), s = !0, e.selector && i.registerHoverTarget(e.selector), r || (o.style.display = "none"), e.install?.(i);
|
|
342
|
+
},
|
|
343
|
+
update(i, f) {
|
|
344
|
+
!o || !s || e.update?.(i, o, f);
|
|
345
|
+
},
|
|
346
|
+
onEnable(i) {
|
|
347
|
+
o && (o.style.display = "", e.onEnable?.(i, o));
|
|
348
|
+
},
|
|
349
|
+
async onBeforeDisable(i) {
|
|
350
|
+
await c(i);
|
|
351
|
+
},
|
|
352
|
+
onDisable(i) {
|
|
353
|
+
o && e.onDisable?.(i, o);
|
|
354
|
+
},
|
|
355
|
+
destroy(i) {
|
|
356
|
+
o && (e.cleanup?.(i, o), o.remove(), o = null, s = !1), e.destroy?.(i);
|
|
357
|
+
}
|
|
358
|
+
};
|
|
176
359
|
}
|
|
177
|
-
function
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
const
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
360
|
+
function u(e, t = {}) {
|
|
361
|
+
const n = document.createElementNS("http://www.w3.org/2000/svg", e);
|
|
362
|
+
for (const [r, o] of Object.entries(t))
|
|
363
|
+
n.setAttribute(r, String(o));
|
|
364
|
+
return n;
|
|
365
|
+
}
|
|
366
|
+
function F(e, t) {
|
|
367
|
+
for (const [n, r] of Object.entries(t))
|
|
368
|
+
e.setAttribute(n, String(r));
|
|
369
|
+
}
|
|
370
|
+
function W(e = {}) {
|
|
371
|
+
return u("g", e);
|
|
372
|
+
}
|
|
373
|
+
function X(e = {}) {
|
|
374
|
+
return u("circle", e);
|
|
375
|
+
}
|
|
376
|
+
function K(e = {}) {
|
|
377
|
+
return u("rect", e);
|
|
378
|
+
}
|
|
379
|
+
function Z(e, t = {}) {
|
|
380
|
+
const n = u("path", t);
|
|
381
|
+
return e !== void 0 && n.setAttribute("d", e), n;
|
|
382
|
+
}
|
|
383
|
+
function J(e = {}, t) {
|
|
384
|
+
const n = u("text", e);
|
|
385
|
+
return t !== void 0 && (n.textContent = t), n;
|
|
386
|
+
}
|
|
387
|
+
function Q(e, t = {}) {
|
|
388
|
+
const n = u("textPath", { ...t, href: e });
|
|
389
|
+
return n.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", e), n;
|
|
195
390
|
}
|
|
391
|
+
function ee(e, t = {}, n = []) {
|
|
392
|
+
const r = u("filter", { id: e, ...t });
|
|
393
|
+
return n.forEach((o) => r.appendChild(o)), r;
|
|
394
|
+
}
|
|
395
|
+
function te(e = 0, t = {}) {
|
|
396
|
+
return u("feGaussianBlur", {
|
|
397
|
+
stdDeviation: String(e),
|
|
398
|
+
...t
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
function ne(e = 0.1, t = {}) {
|
|
402
|
+
return u("feTurbulence", {
|
|
403
|
+
baseFrequency: String(e),
|
|
404
|
+
...t
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
function re(e) {
|
|
408
|
+
return u("feMergeNode", e ? { in: e } : {});
|
|
409
|
+
}
|
|
410
|
+
function oe(e = []) {
|
|
411
|
+
const t = u("feMerge");
|
|
412
|
+
return e.forEach((n) => t.appendChild(n)), t;
|
|
413
|
+
}
|
|
414
|
+
function ie(e) {
|
|
415
|
+
const t = Math.round(e * 100) / 100;
|
|
416
|
+
return `
|
|
417
|
+
M 0, -${t}
|
|
418
|
+
A ${t},${t} 0 1,1 0,${t}
|
|
419
|
+
A ${t},${t} 0 1,1 0,-${t}
|
|
420
|
+
`.replace(/\s+/g, " ").trim();
|
|
421
|
+
}
|
|
422
|
+
const pe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
423
|
+
__proto__: null,
|
|
424
|
+
circle: X,
|
|
425
|
+
circlePath: ie,
|
|
426
|
+
createSVGElement: u,
|
|
427
|
+
filter: ee,
|
|
428
|
+
gaussianBlur: te,
|
|
429
|
+
group: W,
|
|
430
|
+
merge: oe,
|
|
431
|
+
mergeNode: re,
|
|
432
|
+
path: Z,
|
|
433
|
+
rect: K,
|
|
434
|
+
setSVGAttrs: F,
|
|
435
|
+
text: J,
|
|
436
|
+
textPath: Q,
|
|
437
|
+
turbulence: ne
|
|
438
|
+
}, Symbol.toStringTag, { value: "Module" })), me = {
|
|
439
|
+
/** Good for entrance animations (starts fast, slows down) */
|
|
440
|
+
EASE_OUT_EXPO: "cubic-bezier(0.16, 1, 0.3, 1)",
|
|
441
|
+
/** Good for elastic/bouncy UI elements */
|
|
442
|
+
ELASTIC_OUT: "cubic-bezier(0.34, 1.56, 0.64, 1)",
|
|
443
|
+
/** Standard smooth movement */
|
|
444
|
+
SMOOTH: "ease-out"
|
|
445
|
+
}, he = {
|
|
446
|
+
/** The top-most layer. For text, tooltips, and crucial UI. */
|
|
447
|
+
OVERLAY: "400",
|
|
448
|
+
/** The main cursor layer. For the primary Dot/Pointer. */
|
|
449
|
+
CURSOR: "300",
|
|
450
|
+
/** The secondary layer. For Rings, brackets, or followers. */
|
|
451
|
+
FOLLOWER: "200",
|
|
452
|
+
/** The background layer. For trails, sparkles, and particles. */
|
|
453
|
+
TRACE: "100"
|
|
454
|
+
};
|
|
196
455
|
export {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
456
|
+
me as Easings,
|
|
457
|
+
he as Layers,
|
|
458
|
+
S as angle,
|
|
459
|
+
T as applyStyles,
|
|
460
|
+
X as circle,
|
|
461
|
+
ie as circlePath,
|
|
462
|
+
I as circumference,
|
|
463
|
+
g as clamp,
|
|
464
|
+
p as createActor,
|
|
465
|
+
R as createCircle,
|
|
466
|
+
A as createDiv,
|
|
467
|
+
u as createSVGElement,
|
|
468
|
+
l as css,
|
|
469
|
+
E as damp,
|
|
470
|
+
de as definePlugin,
|
|
471
|
+
b as dist,
|
|
472
|
+
fe as doctor,
|
|
473
|
+
ce as dom,
|
|
474
|
+
ue as effects,
|
|
475
|
+
ee as filter,
|
|
476
|
+
te as gaussianBlur,
|
|
477
|
+
k as getVelocityDistortion,
|
|
478
|
+
W as group,
|
|
479
|
+
le as hasFinePointer,
|
|
480
|
+
M as injectStyles,
|
|
481
|
+
y as lerp,
|
|
482
|
+
$ as lerpAngle,
|
|
483
|
+
se as math,
|
|
484
|
+
oe as merge,
|
|
485
|
+
re as mergeNode,
|
|
486
|
+
N as normalize,
|
|
487
|
+
ae as normalizeAll,
|
|
488
|
+
Z as path,
|
|
489
|
+
P as projectRect,
|
|
490
|
+
O as random,
|
|
491
|
+
K as rect,
|
|
492
|
+
F as setSVGAttrs,
|
|
493
|
+
_ as setStyle,
|
|
494
|
+
x as setTransform,
|
|
495
|
+
pe as svg,
|
|
496
|
+
J as text,
|
|
497
|
+
Q as textPath,
|
|
498
|
+
ne as turbulence
|
|
205
499
|
};
|