@tixyel/streamelements 7.0.5 → 7.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/dist/index.d.ts +224 -1
- package/dist/index.es.js +138 -40
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2414,15 +2414,28 @@ declare class ElementHelper {
|
|
|
2414
2414
|
* Adds 'container' class and data-index to all parent elements, and wraps each character in a span with class 'char' and data-index.
|
|
2415
2415
|
* @param htmlString - The input HTML string containing formatted text elements (span, strong, em, etc).
|
|
2416
2416
|
* @param startIndex - The starting index for the data-index attribute (default is 0).
|
|
2417
|
+
* @param preserveInterElementWhitespace - Whether to preserve whitespace between elements (default is false).
|
|
2418
|
+
* @param options - Optional settings for splitting text, including skipWhitespaceIndex to control index incrementing for whitespace characters.
|
|
2417
2419
|
* @returns - A new HTML string with containers and character-level indexing.
|
|
2418
2420
|
* @example
|
|
2419
2421
|
* ```javascript
|
|
2420
2422
|
* const result = splitTextToChars('<span>TesTe</span> <strong>bold</strong>', 0);
|
|
2421
2423
|
* console.log(result);
|
|
2422
2424
|
* // Output: '<span class="container" data-index="0"><span class="char" data-index="0">T</span><span class="char" data-index="1">e</span>...'
|
|
2425
|
+
*
|
|
2426
|
+
* // Example with skipWhitespaceIndex
|
|
2427
|
+
* const resultSkipWhitespace = splitTextToChars('<span>Hello World</span>', 0, false, { skipWhitespaceIndex: true });
|
|
2428
|
+
* // The space character will have data-index but won't increment index for subsequent characters
|
|
2423
2429
|
* ```
|
|
2424
2430
|
*/
|
|
2425
|
-
splitTextToChars(htmlString: string, startIndex?: number, preserveInterElementWhitespace?: boolean
|
|
2431
|
+
splitTextToChars(htmlString: string, startIndex?: number, preserveInterElementWhitespace?: boolean, options?: {
|
|
2432
|
+
/**
|
|
2433
|
+
* If true, skips incrementing the index for whitespace characters (space, newline, tab).
|
|
2434
|
+
* These characters will still have a data-index, but it won't be incremented for subsequent characters.
|
|
2435
|
+
* Default is true.
|
|
2436
|
+
*/
|
|
2437
|
+
skipWhitespaceIndex?: boolean;
|
|
2438
|
+
}): string;
|
|
2426
2439
|
}
|
|
2427
2440
|
|
|
2428
2441
|
declare class ObjectHelper {
|
|
@@ -3093,7 +3106,217 @@ type IdentifyYouTubeResult = {
|
|
|
3093
3106
|
top: TopType;
|
|
3094
3107
|
};
|
|
3095
3108
|
|
|
3109
|
+
type Point = {
|
|
3110
|
+
x: number;
|
|
3111
|
+
y: number;
|
|
3112
|
+
};
|
|
3113
|
+
type AnimOptions = {
|
|
3114
|
+
/** Duration in seconds. Default: `1` */
|
|
3115
|
+
duration?: number;
|
|
3116
|
+
fps?: number;
|
|
3117
|
+
easing?: (t: number) => number;
|
|
3118
|
+
};
|
|
3119
|
+
type AnimResult = {
|
|
3120
|
+
x: number[];
|
|
3121
|
+
y: number[];
|
|
3122
|
+
};
|
|
3123
|
+
type QuadraticParams = AnimOptions & {
|
|
3124
|
+
from: Point;
|
|
3125
|
+
to: Point;
|
|
3126
|
+
control: Point;
|
|
3127
|
+
};
|
|
3128
|
+
type CubicParams = AnimOptions & {
|
|
3129
|
+
from: Point & {
|
|
3130
|
+
control: Point;
|
|
3131
|
+
};
|
|
3132
|
+
to: Point & {
|
|
3133
|
+
control: Point;
|
|
3134
|
+
};
|
|
3135
|
+
};
|
|
3136
|
+
type MultiCubicPoint = Point & {
|
|
3137
|
+
control?: Point;
|
|
3138
|
+
controlIn?: Point;
|
|
3139
|
+
controlOut?: Point;
|
|
3140
|
+
};
|
|
3141
|
+
type MultiCubicParams = AnimOptions & {
|
|
3142
|
+
points: [MultiCubicPoint, MultiCubicPoint, MultiCubicPoint, ...MultiCubicPoint[]];
|
|
3143
|
+
};
|
|
3144
|
+
type CircleParams = AnimOptions & {
|
|
3145
|
+
center: Point;
|
|
3146
|
+
radius: number;
|
|
3147
|
+
from?: number;
|
|
3148
|
+
to?: number;
|
|
3149
|
+
};
|
|
3150
|
+
type SpiralParams = AnimOptions & {
|
|
3151
|
+
center: Point;
|
|
3152
|
+
radius: {
|
|
3153
|
+
from: number;
|
|
3154
|
+
to: number;
|
|
3155
|
+
};
|
|
3156
|
+
turns?: number;
|
|
3157
|
+
};
|
|
3158
|
+
declare class AnimateHelper {
|
|
3159
|
+
/**
|
|
3160
|
+
* Interpolate a number from start to end
|
|
3161
|
+
* @example
|
|
3162
|
+
* ```ts
|
|
3163
|
+
* const value = animate.lerp(0, 100, 0.5);
|
|
3164
|
+
* console.log(value); // 50
|
|
3165
|
+
* // Clamped between 0 and 1
|
|
3166
|
+
* const clamped = animate.lerp(0, 100, 1.5);
|
|
3167
|
+
* console.log(clamped); // 100
|
|
3168
|
+
* const clamped2 = animate.lerp(0, 100, -0.5);
|
|
3169
|
+
* console.log(clamped2); // 0
|
|
3170
|
+
* const easeIn = animate.lerp(0, 100, (t) => t * t);
|
|
3171
|
+
* console.log(easeIn); // 25 at t=0.5
|
|
3172
|
+
* const linear = animate.lerp(0, 100, 0.5);
|
|
3173
|
+
* console.log(linear); // 50 at t=0.5
|
|
3174
|
+
* // Ease-in should be less than linear at t=0.5
|
|
3175
|
+
* console.log(easeIn < linear); // true
|
|
3176
|
+
* ```
|
|
3177
|
+
*/
|
|
3178
|
+
lerp(start: number, end: number, t: number): number;
|
|
3179
|
+
/**
|
|
3180
|
+
* Create a quadratic Bezier path between two positions using a control point.
|
|
3181
|
+
* Returns sampled x/y coordinates for the animation timeline.
|
|
3182
|
+
* @example
|
|
3183
|
+
* ```ts
|
|
3184
|
+
* const { x, y } = animate.quadratic({
|
|
3185
|
+
* from: { x: 0, y: 0 },
|
|
3186
|
+
* to: { x: 100, y: 0 },
|
|
3187
|
+
* control: { x: 50, y: 50 },
|
|
3188
|
+
* duration: 1,
|
|
3189
|
+
* fps: 60,
|
|
3190
|
+
* easing: Motion.easeInOut,
|
|
3191
|
+
* });
|
|
3192
|
+
*
|
|
3193
|
+
* // Use with Motion.animate
|
|
3194
|
+
* Motion.animate(element, { x, y }, { duration: 1 });
|
|
3195
|
+
* ```
|
|
3196
|
+
*/
|
|
3197
|
+
quadratic({ from, to, control, duration, fps, easing, }: QuadraticParams): AnimResult;
|
|
3198
|
+
/**
|
|
3199
|
+
* Create a cubic Bezier path between two positions using two control points.
|
|
3200
|
+
* Returns sampled x/y coordinates for the animation timeline.
|
|
3201
|
+
* @example
|
|
3202
|
+
* ```ts
|
|
3203
|
+
* const { x, y } = animate.cubic({
|
|
3204
|
+
* from: { x: 0, y: 0, control: { x: 50, y: 100 } },
|
|
3205
|
+
* to: { x: 200, y: 0, control: { x: 150, y: 100 } },
|
|
3206
|
+
* duration: 2,
|
|
3207
|
+
* fps: 60,
|
|
3208
|
+
* easing: Motion.easeInOut,
|
|
3209
|
+
* });
|
|
3210
|
+
* ```
|
|
3211
|
+
*/
|
|
3212
|
+
cubic({ from, to, duration, fps, easing }: CubicParams): AnimResult;
|
|
3213
|
+
private getMultiCubicOutgoingControl;
|
|
3214
|
+
private getMultiCubicIncomingControl;
|
|
3215
|
+
/**
|
|
3216
|
+
* Create a chained cubic Bezier path using 3 or more points.
|
|
3217
|
+
* First and last points use a single control handle.
|
|
3218
|
+
* Middle points can use separate incoming and outgoing handles.
|
|
3219
|
+
*
|
|
3220
|
+
* Every consecutive pair creates one cubic segment:
|
|
3221
|
+
* `P0 = points[i]`, `P1 = points[i].controlOut`, `P2 = points[i + 1].controlIn`, `P3 = points[i + 1]`.
|
|
3222
|
+
*
|
|
3223
|
+
* For compatibility, `control` is treated as a shared handle when `controlIn` or `controlOut`
|
|
3224
|
+
* are not provided.
|
|
3225
|
+
* @example
|
|
3226
|
+
* ```ts
|
|
3227
|
+
* const { x, y } = animate.multiCubic({
|
|
3228
|
+
* points: [
|
|
3229
|
+
* { x: 0, y: 0, control: { x: 20, y: 40 } },
|
|
3230
|
+
* {
|
|
3231
|
+
* x: 100,
|
|
3232
|
+
* y: 0,
|
|
3233
|
+
* controlIn: { x: 80, y: 60 },
|
|
3234
|
+
* controlOut: { x: 120, y: -20 },
|
|
3235
|
+
* },
|
|
3236
|
+
* { x: 200, y: 50, control: { x: 160, y: 120 } },
|
|
3237
|
+
* ],
|
|
3238
|
+
* duration: 2,
|
|
3239
|
+
* fps: 60,
|
|
3240
|
+
* easing: Motion.easeInOut,
|
|
3241
|
+
* });
|
|
3242
|
+
* ```
|
|
3243
|
+
*/
|
|
3244
|
+
multiCubic({ points, duration, fps, easing }: MultiCubicParams): AnimResult;
|
|
3245
|
+
/**
|
|
3246
|
+
* Create a circular path around a center point.
|
|
3247
|
+
* Angles in degrees. Default: `from: 0`, `to: 360`.
|
|
3248
|
+
* @example
|
|
3249
|
+
* ```ts
|
|
3250
|
+
* const { x, y } = animate.circle({
|
|
3251
|
+
* center: { x: 100, y: 100 },
|
|
3252
|
+
* radius: 50,
|
|
3253
|
+
* from: 0,
|
|
3254
|
+
* to: 360,
|
|
3255
|
+
* duration: 3,
|
|
3256
|
+
* fps: 60,
|
|
3257
|
+
* });
|
|
3258
|
+
* ```
|
|
3259
|
+
*/
|
|
3260
|
+
circle({ center, radius, from, to, duration, fps, easing, }: CircleParams): AnimResult;
|
|
3261
|
+
/**
|
|
3262
|
+
* Create a spiral path around a center point.
|
|
3263
|
+
* @example
|
|
3264
|
+
* ```ts
|
|
3265
|
+
* const { x, y } = animate.spiral({
|
|
3266
|
+
* center: { x: 0, y: 0 },
|
|
3267
|
+
* radius: { from: 10, to: 100 },
|
|
3268
|
+
* turns: 3,
|
|
3269
|
+
* duration: 2,
|
|
3270
|
+
* fps: 60,
|
|
3271
|
+
* easing: (t) => 1 - (1 - t) * (1 - t),
|
|
3272
|
+
* });
|
|
3273
|
+
*
|
|
3274
|
+
* // This will create a spiral that starts at radius 10 and expands to radius 100 over 3 turns.
|
|
3275
|
+
* ```
|
|
3276
|
+
*/
|
|
3277
|
+
spiral({ center, radius, turns, duration, fps, easing, }: SpiralParams): AnimResult;
|
|
3278
|
+
/**
|
|
3279
|
+
* Chain multiple animation paths together sequentially.
|
|
3280
|
+
* @example
|
|
3281
|
+
* ```ts
|
|
3282
|
+
* const path1 = animate.quadratic({
|
|
3283
|
+
* from: { x: 0, y: 0 },
|
|
3284
|
+
* to: { x: 100, y: 0 },
|
|
3285
|
+
* control: { x: 50, y: 50 },
|
|
3286
|
+
* duration: 1,
|
|
3287
|
+
* fps: 60,
|
|
3288
|
+
* });
|
|
3289
|
+
*
|
|
3290
|
+
* const path2 = animate.circle({
|
|
3291
|
+
* center: { x: 100, y: 0 },
|
|
3292
|
+
* radius: 30,
|
|
3293
|
+
* from: 0,
|
|
3294
|
+
* to: 180,
|
|
3295
|
+
* duration: 1,
|
|
3296
|
+
* fps: 60,
|
|
3297
|
+
* });
|
|
3298
|
+
*
|
|
3299
|
+
* const combined = animate.chain(path1, path2);
|
|
3300
|
+
* ```
|
|
3301
|
+
*/
|
|
3302
|
+
chain(...animations: AnimResult[]): AnimResult;
|
|
3303
|
+
/**
|
|
3304
|
+
* Execute multiple animations in sequence with optional delays between them.
|
|
3305
|
+
* Each animation will be sampled and delays will add repeating the last coordinate.
|
|
3306
|
+
* @example
|
|
3307
|
+
* ```ts
|
|
3308
|
+
* const path1 = animate.quadratic({ from: { x: 0, y: 0 }, to: { x: 50, y: 0 }, control: { x: 25, y: 25 }, duration: 0.5, fps: 30 });
|
|
3309
|
+
* const path2 = animate.quadratic({ from: { x: 50, y: 0 }, to: { x: 100, y: 0 }, control: { x: 75, y: 25 }, duration: 0.5, fps: 30 });
|
|
3310
|
+
*
|
|
3311
|
+
* // 30 frames delay between animations
|
|
3312
|
+
* const sequenced = animate.sequence([path1, path2], 30);
|
|
3313
|
+
* ```
|
|
3314
|
+
*/
|
|
3315
|
+
sequence(animations: AnimResult[], delayFrames?: number | number[]): AnimResult;
|
|
3316
|
+
}
|
|
3317
|
+
|
|
3096
3318
|
declare namespace Helper {
|
|
3319
|
+
const animate: AnimateHelper;
|
|
3097
3320
|
const number: NumberHelper;
|
|
3098
3321
|
const element: ElementHelper;
|
|
3099
3322
|
const object: ObjectHelper;
|
package/dist/index.es.js
CHANGED
|
@@ -262,8 +262,8 @@ var e = class {
|
|
|
262
262
|
if (l === 0 || u === 0) throw Error("Element has zero width or height, cannot scale");
|
|
263
263
|
let d = c.width * n / l, f = c.height * n / u, p = o === "width" ? d : o === "height" ? f : Math.min(d, f);
|
|
264
264
|
if (t > 0) {
|
|
265
|
-
let e = c.width * t / l, n = c.height * t / u
|
|
266
|
-
p = Math.max(
|
|
265
|
+
let e = c.width * t / l, n = c.height * t / u;
|
|
266
|
+
p = Math.max(Math.max(e, n), p);
|
|
267
267
|
}
|
|
268
268
|
let m = {
|
|
269
269
|
width: l * p,
|
|
@@ -275,10 +275,10 @@ var e = class {
|
|
|
275
275
|
scalev2(e, t = {}) {
|
|
276
276
|
let { parent: n = e.parentElement, prefer: r = "auto", min: i = 0, max: a = 1, apply: o = () => {} } = t;
|
|
277
277
|
if (!n) throw Error("No parent element found for scaling");
|
|
278
|
-
let s = n.getBoundingClientRect(), c = e.getBoundingClientRect(), l = s.width, u = s.height, d = c.width, f = c.height, p = l * i / d, m = u * i / f, h = l * a / d, g = u * a / f, _ = Math.min(h, g)
|
|
279
|
-
_ = Math.max(_,
|
|
280
|
-
let
|
|
281
|
-
return r === "width" ? _ = Math.max(p, Math.min(h, l / d)) : r === "height" ? _ = Math.max(m, Math.min(g, u / f)) :
|
|
278
|
+
let s = n.getBoundingClientRect(), c = e.getBoundingClientRect(), l = s.width, u = s.height, d = c.width, f = c.height, p = l * i / d, m = u * i / f, h = l * a / d, g = u * a / f, _ = Math.min(h, g);
|
|
279
|
+
_ = Math.max(_, Math.max(p, m));
|
|
280
|
+
let v = d * _, y = f * _;
|
|
281
|
+
return r === "width" ? _ = Math.max(p, Math.min(h, l / d)) : r === "height" ? _ = Math.max(m, Math.min(g, u / f)) : v > l ? _ = Math.max(p, Math.min(h, l / d)) : y > u && (_ = Math.max(m, Math.min(g, u / f))), o.apply(e, [_, e]), _;
|
|
282
282
|
}
|
|
283
283
|
fitText(e, t = 1, n = {}) {
|
|
284
284
|
let r = parseFloat(getComputedStyle(e).getPropertyValue("font-size")), a = {
|
|
@@ -289,33 +289,35 @@ var e = class {
|
|
|
289
289
|
let s = r * (o.clientWidth * t / e.offsetWidth), c = new i().balance(s, a.minFontSize, a.maxFontSize);
|
|
290
290
|
return e.style.fontSize = c + "px", e;
|
|
291
291
|
}
|
|
292
|
-
splitTextToChars(e, t = 0, n = !1) {
|
|
293
|
-
let r = new DOMParser(),
|
|
294
|
-
function
|
|
292
|
+
splitTextToChars(e, t = 0, n = !1, r = {}) {
|
|
293
|
+
let { skipWhitespaceIndex: i = !0 } = r, a = new DOMParser(), o = document.createElement("div"), s = t;
|
|
294
|
+
function c(e) {
|
|
295
295
|
if (e.nodeType === Node.TEXT_NODE) {
|
|
296
|
-
let t =
|
|
297
|
-
let
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
296
|
+
let t = e.textContent || "", n = 0, r = t.split("").map((e) => {
|
|
297
|
+
let t = document.createElement("span");
|
|
298
|
+
t.classList.add("char"), t.dataset.index = String(s), t.dataset.exclusivityIndex = String(n), t.dataset.type = "char", t.style.setProperty("--char-index", String(s)), t.style.setProperty("--exclusivity-index", String(n));
|
|
299
|
+
let r = e === " " || e === "\n" || e === " ";
|
|
300
|
+
return r && (t.style.whiteSpace = "pre-wrap", t.classList.remove("char"), t.classList.add("whitespace"), t.dataset.type = "whitespace"), (!r || !i) && (s++, n++), t.textContent = e, t;
|
|
301
|
+
}), a = document.createDocumentFragment();
|
|
302
|
+
return r.forEach((e) => a.appendChild(e)), a;
|
|
301
303
|
} else if (e.nodeType === Node.ELEMENT_NODE) {
|
|
302
304
|
let t = e.cloneNode(!1);
|
|
303
|
-
return t.classList.add("container"), t.dataset.index = String(
|
|
304
|
-
let n =
|
|
305
|
+
return t.classList.add("container"), t.dataset.index = String(s), t.dataset.type = "container", t.style.setProperty("--char-index", String(s)), t.style.setProperty("--exclusivity-index", String(s)), s++, e.childNodes.forEach((e) => {
|
|
306
|
+
let n = c(e);
|
|
305
307
|
t.appendChild(n);
|
|
306
308
|
}), t;
|
|
307
309
|
}
|
|
308
310
|
return e.cloneNode(!0);
|
|
309
311
|
}
|
|
310
|
-
|
|
312
|
+
a.parseFromString(e, "text/html").body.childNodes.forEach((e) => {
|
|
311
313
|
if (!n && e.nodeType === Node.TEXT_NODE && !e.textContent?.trim()) return;
|
|
312
|
-
let t =
|
|
313
|
-
|
|
314
|
+
let t = c(e);
|
|
315
|
+
o.appendChild(t);
|
|
314
316
|
});
|
|
315
|
-
let
|
|
316
|
-
return Array.from(
|
|
317
|
-
e.nodeType === Node.TEXT_NODE ?
|
|
318
|
-
}),
|
|
317
|
+
let l = "";
|
|
318
|
+
return Array.from(o.childNodes).forEach((e) => {
|
|
319
|
+
e.nodeType === Node.TEXT_NODE ? l += e.textContent : l += e.outerHTML;
|
|
320
|
+
}), l;
|
|
319
321
|
}
|
|
320
322
|
}, o = class {
|
|
321
323
|
flatten(e, t = !0, n = "") {
|
|
@@ -9702,8 +9704,8 @@ var M = class {
|
|
|
9702
9704
|
function m(e, t) {
|
|
9703
9705
|
let n = e?.trim?.() ?? "";
|
|
9704
9706
|
if (!n.length) return null;
|
|
9705
|
-
let r = t[n], i = r === void 0 ? n : r
|
|
9706
|
-
return isNaN(
|
|
9707
|
+
let r = t[n], i = parseFloat(String(r === void 0 ? n : r).replace(/\s/g, ""));
|
|
9708
|
+
return isNaN(i) ? null : i;
|
|
9707
9709
|
}
|
|
9708
9710
|
function h(e, t, n) {
|
|
9709
9711
|
let r = isNaN(Number(t)) ? 0 : Math.max(0, parseInt(String(t))), i = m(e, n);
|
|
@@ -9718,8 +9720,8 @@ var M = class {
|
|
|
9718
9720
|
}
|
|
9719
9721
|
}
|
|
9720
9722
|
function g(e, t = /* @__PURE__ */ new Date()) {
|
|
9721
|
-
let n = t.getTime() - e.getTime(), r = n >= 0, i = Math.abs(n), a = Math.floor(i /
|
|
9722
|
-
return
|
|
9723
|
+
let n = t.getTime() - e.getTime(), r = n >= 0, i = Math.floor(Math.abs(n) / 1e3), a = Math.floor(i / 60), o = Math.floor(a / 60), s = Math.floor(o / 24), c = Math.floor(s / 30), l = Math.floor(s / 365), u = r ? "ago" : "from now";
|
|
9724
|
+
return l > 0 ? `${l}y ${u}` : c > 0 ? `${c}mo ${u}` : s > 0 ? `${s}d ${u}` : o > 0 ? `${o}h ${u}` : a > 0 ? `${a}m ${u}` : `${Math.max(i, 0)}s ${u}`;
|
|
9723
9725
|
}
|
|
9724
9726
|
function _(e, t, n) {
|
|
9725
9727
|
let r = e?.trim?.() ?? "";
|
|
@@ -10309,7 +10311,7 @@ var M = class {
|
|
|
10309
10311
|
message: new T().array(e)[0]
|
|
10310
10312
|
};
|
|
10311
10313
|
}
|
|
10312
|
-
}, z = class {
|
|
10314
|
+
}, z = class e {
|
|
10313
10315
|
delay(e, t) {
|
|
10314
10316
|
return new Promise((n) => setTimeout(() => {
|
|
10315
10317
|
n(t ? t() ?? null : null);
|
|
@@ -10356,9 +10358,9 @@ var M = class {
|
|
|
10356
10358
|
isSameMoment: i === 0
|
|
10357
10359
|
};
|
|
10358
10360
|
}
|
|
10359
|
-
probability(
|
|
10360
|
-
let
|
|
10361
|
-
for (let [e, t] of
|
|
10361
|
+
probability(t) {
|
|
10362
|
+
let n = Object.values(t).reduce((e, t) => e + t, 0), r = new e().typedEntries(t).sort((e, t) => t[1] - e[1]), i = Math.random() * n, a = 0;
|
|
10363
|
+
for (let [e, t] of r) if (a += t, i < a) return e;
|
|
10362
10364
|
}
|
|
10363
10365
|
async findSubscriptionTier({ userId: e, name: t, broadcasterId: n }, r, i = !1) {
|
|
10364
10366
|
let a = (e) => e === "prime" || e === "1000" || e === 1e3 || e === 1 || e === "1" ? 1 : e === "2000" || e === 2e3 || e === 2 || e === "2" ? 2 : e === "3000" || e === 3e3 || e === 3 || e === "3" ? 3 : 1;
|
|
@@ -10472,9 +10474,105 @@ var M = class {
|
|
|
10472
10474
|
}
|
|
10473
10475
|
}
|
|
10474
10476
|
}
|
|
10477
|
+
}, ne = class {
|
|
10478
|
+
lerp(e, t, n) {
|
|
10479
|
+
let r = Math.max(0, Math.min(1, n));
|
|
10480
|
+
return e + (t - e) * r;
|
|
10481
|
+
}
|
|
10482
|
+
quadratic({ from: e, to: t, control: n, duration: r = 1, fps: i = 60, easing: a = (e) => e }) {
|
|
10483
|
+
let o = Math.max(2, Math.round(r * i)), s = [], c = [];
|
|
10484
|
+
for (let r = 0; r <= o; r++) {
|
|
10485
|
+
let i = a(r / o);
|
|
10486
|
+
s.push((1 - i) * (1 - i) * e.x + 2 * (1 - i) * i * n.x + i * i * t.x), c.push((1 - i) * (1 - i) * e.y + 2 * (1 - i) * i * n.y + i * i * t.y);
|
|
10487
|
+
}
|
|
10488
|
+
return {
|
|
10489
|
+
x: s,
|
|
10490
|
+
y: c
|
|
10491
|
+
};
|
|
10492
|
+
}
|
|
10493
|
+
cubic({ from: e, to: t, duration: n = 1, fps: r = 60, easing: i = (e) => e }) {
|
|
10494
|
+
let a = Math.max(2, Math.round(n * r)), o = [], s = [];
|
|
10495
|
+
for (let n = 0; n <= a; n++) {
|
|
10496
|
+
let r = i(n / a), c = 1 - r;
|
|
10497
|
+
o.push(c * c * c * e.x + 3 * c * c * r * e.control.x + 3 * c * r * r * t.control.x + r * r * r * t.x), s.push(c * c * c * e.y + 3 * c * c * r * e.control.y + 3 * c * r * r * t.control.y + r * r * r * t.y);
|
|
10498
|
+
}
|
|
10499
|
+
return {
|
|
10500
|
+
x: o,
|
|
10501
|
+
y: s
|
|
10502
|
+
};
|
|
10503
|
+
}
|
|
10504
|
+
getMultiCubicOutgoingControl(e, t) {
|
|
10505
|
+
let n = e.controlOut ?? e.control;
|
|
10506
|
+
if (n) return n;
|
|
10507
|
+
throw Error(t === 0 ? "The first multiCubic point requires `control` or `controlOut`." : `The multiCubic point at index ${t} requires \`controlOut\` or a shared \`control\`.`);
|
|
10508
|
+
}
|
|
10509
|
+
getMultiCubicIncomingControl(e, t, n) {
|
|
10510
|
+
let r = e.controlIn ?? e.control;
|
|
10511
|
+
if (r) return r;
|
|
10512
|
+
throw Error(t === n ? "The last multiCubic point requires `control` or `controlIn`." : `The multiCubic point at index ${t} requires \`controlIn\` or a shared \`control\`.`);
|
|
10513
|
+
}
|
|
10514
|
+
multiCubic({ points: e, duration: t = 1, fps: n = 60, easing: r = (e) => e }) {
|
|
10515
|
+
if (e.length < 3) throw Error("multiCubic requires at least 3 points.");
|
|
10516
|
+
let i = e.length - 1, a = e.length - 1, o = Math.max(2, Math.round(t * n)), s = Math.max(1, Math.floor(o / i)), c = o % i, l = [], u = [];
|
|
10517
|
+
for (let t = 0; t < i; t++) {
|
|
10518
|
+
let n = e[t], i = e[t + 1], o = this.getMultiCubicOutgoingControl(n, t), d = this.getMultiCubicIncomingControl(i, t + 1, a), f = s + (c > 0 ? 1 : 0);
|
|
10519
|
+
c > 0 && c--;
|
|
10520
|
+
let p = t === 0 ? 0 : 1;
|
|
10521
|
+
for (let e = p; e <= f; e++) {
|
|
10522
|
+
let t = r(e / f), a = 1 - t;
|
|
10523
|
+
l.push(a * a * a * n.x + 3 * a * a * t * o.x + 3 * a * t * t * d.x + t * t * t * i.x), u.push(a * a * a * n.y + 3 * a * a * t * o.y + 3 * a * t * t * d.y + t * t * t * i.y);
|
|
10524
|
+
}
|
|
10525
|
+
}
|
|
10526
|
+
return {
|
|
10527
|
+
x: l,
|
|
10528
|
+
y: u
|
|
10529
|
+
};
|
|
10530
|
+
}
|
|
10531
|
+
circle({ center: e, radius: t, from: n = 0, to: r = 360, duration: i = 1, fps: a = 60, easing: o = (e) => e }) {
|
|
10532
|
+
let s = Math.max(2, Math.round(i * a)), c = [], l = [];
|
|
10533
|
+
for (let i = 0; i <= s; i++) {
|
|
10534
|
+
let a = o(i / s), u = (n + (r - n) * a) * Math.PI / 180;
|
|
10535
|
+
c.push(e.x + t * Math.cos(u)), l.push(e.y + t * Math.sin(u));
|
|
10536
|
+
}
|
|
10537
|
+
return {
|
|
10538
|
+
x: c,
|
|
10539
|
+
y: l
|
|
10540
|
+
};
|
|
10541
|
+
}
|
|
10542
|
+
spiral({ center: e, radius: t, turns: n = 1, duration: r = 1, fps: i = 60, easing: a = (e) => e }) {
|
|
10543
|
+
let o = Math.max(2, Math.round(r * i)), s = [], c = [];
|
|
10544
|
+
for (let r = 0; r <= o; r++) {
|
|
10545
|
+
let i = a(r / o), l = this.lerp(t.from, t.to, i), u = i * n * 360 * Math.PI / 180;
|
|
10546
|
+
s.push(e.x + l * Math.cos(u)), c.push(e.y + l * Math.sin(u));
|
|
10547
|
+
}
|
|
10548
|
+
return {
|
|
10549
|
+
x: s,
|
|
10550
|
+
y: c
|
|
10551
|
+
};
|
|
10552
|
+
}
|
|
10553
|
+
chain(...e) {
|
|
10554
|
+
let t = [], n = [];
|
|
10555
|
+
for (let r of e) t.push(...r.x), n.push(...r.y);
|
|
10556
|
+
return {
|
|
10557
|
+
x: t,
|
|
10558
|
+
y: n
|
|
10559
|
+
};
|
|
10560
|
+
}
|
|
10561
|
+
sequence(e, t = 0) {
|
|
10562
|
+
let n = [], r = [], i = Array.isArray(t) ? t : e.map(() => t);
|
|
10563
|
+
for (let t = 0; t < e.length; t++) {
|
|
10564
|
+
let a = e[t], o = i[t] ?? 0;
|
|
10565
|
+
for (let e = 0; e < o; e++) n.push(a.x[0]), r.push(a.y[0]);
|
|
10566
|
+
n.push(...a.x), r.push(...a.y);
|
|
10567
|
+
}
|
|
10568
|
+
return {
|
|
10569
|
+
x: n,
|
|
10570
|
+
y: r
|
|
10571
|
+
};
|
|
10572
|
+
}
|
|
10475
10573
|
}, B;
|
|
10476
10574
|
(function(e) {
|
|
10477
|
-
e.number = new i(), e.element = new a(), e.object = new o(), e.message = new E(), e.event = new D(), e.string = new N(), e.sound = new P(), e.color = new M(), e.random = new T(), e.fn = new F(), e.utils = new z();
|
|
10575
|
+
e.animate = new ne(), e.number = new i(), e.element = new a(), e.object = new o(), e.message = new E(), e.event = new D(), e.string = new N(), e.sound = new P(), e.color = new M(), e.random = new T(), e.fn = new F(), e.utils = new z();
|
|
10478
10576
|
})(B ||= {});
|
|
10479
10577
|
//#endregion
|
|
10480
10578
|
//#region src/actions/button.ts
|
|
@@ -10595,7 +10693,7 @@ var V = [], H = class e {
|
|
|
10595
10693
|
return !1;
|
|
10596
10694
|
}
|
|
10597
10695
|
}
|
|
10598
|
-
}, G = [],
|
|
10696
|
+
}, G = [], re = class extends e {
|
|
10599
10697
|
constructor(e = {}) {
|
|
10600
10698
|
super(), this.SE_API = null, this.id = "widget communications", this.loaded = !1, this.history = [], this.detected = /* @__PURE__ */ new Set(), this.id = e.id || this.id, G.push(this), Z?.then(async (e) => {
|
|
10601
10699
|
this.loaded = !0, this.SE_API = e, Promise.all([async () => {
|
|
@@ -12664,7 +12762,7 @@ var J = class {
|
|
|
12664
12762
|
timeEnd(e) {
|
|
12665
12763
|
!this.enabled || !console.timeEnd || console.timeEnd(e);
|
|
12666
12764
|
}
|
|
12667
|
-
},
|
|
12765
|
+
}, ie = class extends e {
|
|
12668
12766
|
constructor(e, t) {
|
|
12669
12767
|
super(), this.isDebug = !1, this.init = !1, this.emulate = !1, this.username = e.username, this.password = e.password, this.channels = e.channels, this.isDebug = !!e.isDebug, this.init = !!e.init, this.emulate = t, this.load().then((e) => {
|
|
12670
12768
|
this.instance = e, this.emit("load", e), this.connect();
|
|
@@ -12836,7 +12934,7 @@ var J = class {
|
|
|
12836
12934
|
list: {}
|
|
12837
12935
|
}
|
|
12838
12936
|
};
|
|
12839
|
-
async function
|
|
12937
|
+
async function ae() {
|
|
12840
12938
|
let e = localStorage.getItem("SE_API-STORE") ?? "", t = e ? JSON.parse(e) : {};
|
|
12841
12939
|
return Y.store.list = t, Y;
|
|
12842
12940
|
}
|
|
@@ -12891,7 +12989,7 @@ var X;
|
|
|
12891
12989
|
})(X ||= {});
|
|
12892
12990
|
//#endregion
|
|
12893
12991
|
//#region src/main.ts
|
|
12894
|
-
var Z = typeof SE_API < "u" ? Promise.resolve(SE_API) : Promise.resolve(
|
|
12992
|
+
var Z = typeof SE_API < "u" ? Promise.resolve(SE_API) : Promise.resolve(ae()), Q = new J(), $ = {
|
|
12895
12993
|
SeAPI: Z,
|
|
12896
12994
|
Client: r,
|
|
12897
12995
|
Helper: B,
|
|
@@ -12903,14 +13001,14 @@ var Z = typeof SE_API < "u" ? Promise.resolve(SE_API) : Promise.resolve(ie()), Q
|
|
|
12903
13001
|
useStorage: n,
|
|
12904
13002
|
useQueue: K,
|
|
12905
13003
|
useLogger: J,
|
|
12906
|
-
useComms:
|
|
13004
|
+
useComms: re,
|
|
12907
13005
|
FakeUserPool: te
|
|
12908
13006
|
},
|
|
12909
13007
|
actions: {
|
|
12910
13008
|
Button: H,
|
|
12911
13009
|
Command: W
|
|
12912
13010
|
},
|
|
12913
|
-
multistream: { useComfyJs:
|
|
13011
|
+
multistream: { useComfyJs: ie },
|
|
12914
13012
|
internal: {
|
|
12915
13013
|
usedStorages: t,
|
|
12916
13014
|
usedComms: G,
|
|
@@ -12923,8 +13021,8 @@ var Z = typeof SE_API < "u" ? Promise.resolve(SE_API) : Promise.resolve(ie()), Q
|
|
|
12923
13021
|
typeof window < "u" ? window.Tixyel = $ : globalThis.Tixyel = $;
|
|
12924
13022
|
//#endregion
|
|
12925
13023
|
//#region src/index.ts
|
|
12926
|
-
var
|
|
13024
|
+
var oe = $;
|
|
12927
13025
|
//#endregion
|
|
12928
|
-
export {
|
|
13026
|
+
export { oe as default };
|
|
12929
13027
|
|
|
12930
13028
|
//# sourceMappingURL=index.es.js.map
|