@tixyel/streamelements 4.2.3 → 4.3.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/dist/index.d.ts +82 -4
- package/dist/index.es.js +14 -13
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -473,6 +473,7 @@ declare namespace StreamElementsEvents {
|
|
|
473
473
|
updatedAt: string;
|
|
474
474
|
activityId: string;
|
|
475
475
|
sessionEventsCount: number;
|
|
476
|
+
isMock?: boolean;
|
|
476
477
|
}
|
|
477
478
|
namespace Event {
|
|
478
479
|
type Data = {
|
|
@@ -486,7 +487,6 @@ declare namespace StreamElementsEvents {
|
|
|
486
487
|
amount: string;
|
|
487
488
|
currency: string;
|
|
488
489
|
username: string;
|
|
489
|
-
tipId: string;
|
|
490
490
|
message: string;
|
|
491
491
|
avatar: string;
|
|
492
492
|
};
|
|
@@ -630,12 +630,86 @@ declare namespace YoutubeEvents {
|
|
|
630
630
|
isCommunityGift: true;
|
|
631
631
|
};
|
|
632
632
|
}
|
|
633
|
+
interface BaseEvent {
|
|
634
|
+
provider: 'youtube';
|
|
635
|
+
flagged: boolean;
|
|
636
|
+
channel: string;
|
|
637
|
+
createdAt: string;
|
|
638
|
+
_id: string;
|
|
639
|
+
expiresAt: string;
|
|
640
|
+
updatedAt: string;
|
|
641
|
+
activityId: string;
|
|
642
|
+
sessionEventsCount: number;
|
|
643
|
+
isMock?: boolean;
|
|
644
|
+
}
|
|
645
|
+
namespace Event {
|
|
646
|
+
type Data = {
|
|
647
|
+
listener: 'event';
|
|
648
|
+
event: Event;
|
|
649
|
+
};
|
|
650
|
+
type Event = Superchat;
|
|
651
|
+
interface Superchat extends BaseEvent {
|
|
652
|
+
type: 'superchat';
|
|
653
|
+
data: {
|
|
654
|
+
amount: string;
|
|
655
|
+
username: string;
|
|
656
|
+
message: string;
|
|
657
|
+
avatar: string;
|
|
658
|
+
providerId: string;
|
|
659
|
+
};
|
|
660
|
+
}
|
|
661
|
+
interface Subscriber extends BaseEvent {
|
|
662
|
+
type: 'subscriber';
|
|
663
|
+
data: {
|
|
664
|
+
avatar: string;
|
|
665
|
+
displayName: string;
|
|
666
|
+
username: string;
|
|
667
|
+
providerId: string;
|
|
668
|
+
};
|
|
669
|
+
}
|
|
670
|
+
interface Sponsor extends BaseEvent {
|
|
671
|
+
type: 'sponsor';
|
|
672
|
+
data: FirstTimeSponsor | Resubscribe | GiftedSponsor;
|
|
673
|
+
}
|
|
674
|
+
type FirstTimeSponsor = {
|
|
675
|
+
amount: number;
|
|
676
|
+
username: string;
|
|
677
|
+
displayName: string;
|
|
678
|
+
providerId: string;
|
|
679
|
+
avatar: string;
|
|
680
|
+
};
|
|
681
|
+
type Resubscribe = {
|
|
682
|
+
amount: number;
|
|
683
|
+
username: string;
|
|
684
|
+
displayName: string;
|
|
685
|
+
providerId: string;
|
|
686
|
+
avatar: string;
|
|
687
|
+
};
|
|
688
|
+
type GiftedSponsor = {
|
|
689
|
+
amount: number;
|
|
690
|
+
username: string;
|
|
691
|
+
displayName: string;
|
|
692
|
+
providerId: string;
|
|
693
|
+
sender: string;
|
|
694
|
+
gifted: true;
|
|
695
|
+
avatar: string;
|
|
696
|
+
};
|
|
697
|
+
interface CommunityGiftedSponsor extends BaseEvent {
|
|
698
|
+
type: 'communityGiftPurchase';
|
|
699
|
+
data: {
|
|
700
|
+
amount: number;
|
|
701
|
+
username: string;
|
|
702
|
+
displayName: string;
|
|
703
|
+
providerId: string;
|
|
704
|
+
avatar: string;
|
|
705
|
+
};
|
|
706
|
+
}
|
|
707
|
+
}
|
|
633
708
|
}
|
|
634
709
|
|
|
635
710
|
type PathValue<T, P extends string> = P extends `${infer K}.${infer Rest}` ? K extends keyof T ? PathValue<T[K], Rest> : never : P extends keyof T ? T[P] : never;
|
|
636
|
-
type NumberAsString<T extends number | bigint | string> = ReturnType<T['toString']>;
|
|
637
711
|
type MapNumberValuesToString<T> = {
|
|
638
|
-
[K in keyof T]: T[K] extends number ?
|
|
712
|
+
[K in keyof T]: T[K] extends number ? `${T[K]}` | ReturnType<T[K]['toString']> : T[K];
|
|
639
713
|
};
|
|
640
714
|
|
|
641
715
|
declare namespace TwitchEvents {
|
|
@@ -820,6 +894,7 @@ declare namespace TwitchEvents {
|
|
|
820
894
|
updatedAt: string;
|
|
821
895
|
activityId: string;
|
|
822
896
|
sessionEventsCount: number;
|
|
897
|
+
isMock?: boolean;
|
|
823
898
|
}
|
|
824
899
|
namespace Event {
|
|
825
900
|
type Data = {
|
|
@@ -2383,6 +2458,8 @@ declare class Logger {
|
|
|
2383
2458
|
timeEnd(label: string): void;
|
|
2384
2459
|
}
|
|
2385
2460
|
|
|
2461
|
+
declare function parseProvider(detail: StreamElements.Event.onEventReceived): ClientEvents$1;
|
|
2462
|
+
|
|
2386
2463
|
declare const USE_SE_API: Promise<StreamElements.SE_API>;
|
|
2387
2464
|
declare const logger: Logger;
|
|
2388
2465
|
declare const Tixyel: {
|
|
@@ -2396,6 +2473,7 @@ declare const Tixyel: {
|
|
|
2396
2473
|
readonly replaceEmotesWithHTML: typeof replaceEmotesWithHTML;
|
|
2397
2474
|
readonly replaceYoutubeEmotesWithHTML: typeof replaceYoutubeEmotesWithHTML;
|
|
2398
2475
|
readonly generateBadges: typeof generateBadges;
|
|
2476
|
+
readonly parseProvider: typeof parseProvider;
|
|
2399
2477
|
};
|
|
2400
2478
|
readonly modules: {
|
|
2401
2479
|
readonly Button: typeof Button;
|
|
@@ -2427,5 +2505,5 @@ declare global {
|
|
|
2427
2505
|
const SE_API: StreamElements.SE_API;
|
|
2428
2506
|
}
|
|
2429
2507
|
|
|
2430
|
-
export { Alejo, StreamElements, StreamElementsEvents, Tixyel, TwitchEvents, USE_SE_API, YoutubeEvents, logger };
|
|
2508
|
+
export { Alejo, StreamElements, StreamElementsEvents, Tixyel, Twitch, TwitchEvents, USE_SE_API, YoutubeEvents, logger };
|
|
2431
2509
|
export type { BttvEmote, ClientEvents$1 as ClientEvents, Provider$1 as Provider, SeventvEmote, TwitchEmote };
|
package/dist/index.es.js
CHANGED
|
@@ -4998,7 +4998,7 @@ function mt(s, e = !0) {
|
|
|
4998
4998
|
let o = `#${a(s.r)}${a(s.g)}${a(s.b)}`;
|
|
4999
4999
|
return e && s.a < 1 && (o += a(s.a * 255)), o;
|
|
5000
5000
|
}
|
|
5001
|
-
function
|
|
5001
|
+
function Q(s, e, a) {
|
|
5002
5002
|
s /= 255, e /= 255, a /= 255;
|
|
5003
5003
|
const o = Math.max(s, e, a), i = Math.min(s, e, a), t = o - i;
|
|
5004
5004
|
let n = 0, c = 0;
|
|
@@ -5128,11 +5128,11 @@ var x;
|
|
|
5128
5128
|
case "rgba":
|
|
5129
5129
|
return `rgba(${r.r}, ${r.g}, ${r.b}, ${r.a})`;
|
|
5130
5130
|
case "hsl": {
|
|
5131
|
-
const d =
|
|
5131
|
+
const d = Q(r.r, r.g, r.b);
|
|
5132
5132
|
return `hsl(${d.h}, ${d.s}%, ${d.l}%)`;
|
|
5133
5133
|
}
|
|
5134
5134
|
case "hsla": {
|
|
5135
|
-
const d =
|
|
5135
|
+
const d = Q(r.r, r.g, r.b);
|
|
5136
5136
|
return `hsla(${d.h}, ${d.s}%, ${d.l}%, ${r.a})`;
|
|
5137
5137
|
}
|
|
5138
5138
|
case "css-color-name":
|
|
@@ -7210,7 +7210,7 @@ class R {
|
|
|
7210
7210
|
}
|
|
7211
7211
|
}
|
|
7212
7212
|
}
|
|
7213
|
-
class
|
|
7213
|
+
class Z extends O {
|
|
7214
7214
|
queue = [];
|
|
7215
7215
|
priorityQueue = [];
|
|
7216
7216
|
history = [];
|
|
@@ -7318,7 +7318,7 @@ class q {
|
|
|
7318
7318
|
}
|
|
7319
7319
|
}
|
|
7320
7320
|
}
|
|
7321
|
-
class
|
|
7321
|
+
class $ {
|
|
7322
7322
|
enabled;
|
|
7323
7323
|
prefix;
|
|
7324
7324
|
error = this.apply({
|
|
@@ -7427,11 +7427,11 @@ class Z {
|
|
|
7427
7427
|
}
|
|
7428
7428
|
}
|
|
7429
7429
|
window.addEventListener("load", () => {
|
|
7430
|
-
window.client instanceof J && (x.queue = new
|
|
7430
|
+
window.client instanceof J && (x.queue = new Z({
|
|
7431
7431
|
duration: "client",
|
|
7432
7432
|
processor: async function(e) {
|
|
7433
7433
|
if (window.dispatchEvent(new CustomEvent(e.listener, { detail: e.data })), e.listener === "onEventReceived" && e.session) {
|
|
7434
|
-
const a = await x.generate.event.onSessionUpdate(client.session,
|
|
7434
|
+
const a = await x.generate.event.onSessionUpdate(client.session, X(e.data));
|
|
7435
7435
|
window.dispatchEvent(new CustomEvent("onSessionUpdate", { detail: a }));
|
|
7436
7436
|
}
|
|
7437
7437
|
}
|
|
@@ -7485,7 +7485,7 @@ window.addEventListener("onSessionUpdate", (s) => {
|
|
|
7485
7485
|
a.session = e.session, a.emit("session", e.session), a.debug && k.debug("[Client]", "Session updated", e.session);
|
|
7486
7486
|
}
|
|
7487
7487
|
});
|
|
7488
|
-
function
|
|
7488
|
+
function X(s) {
|
|
7489
7489
|
var e = s.event?.provider || s.event?.service || s.event?.data?.provider || window.client.details.provider;
|
|
7490
7490
|
return [
|
|
7491
7491
|
"kvstore:update",
|
|
@@ -7498,7 +7498,7 @@ function $(s) {
|
|
|
7498
7498
|
}
|
|
7499
7499
|
window.addEventListener("onEventReceived", ({ detail: s }) => {
|
|
7500
7500
|
if (window.client instanceof J) {
|
|
7501
|
-
const a =
|
|
7501
|
+
const a = X(s);
|
|
7502
7502
|
switch (a.provider) {
|
|
7503
7503
|
case "streamelements": {
|
|
7504
7504
|
const i = a.data;
|
|
@@ -7624,7 +7624,7 @@ window.addEventListener("onEventReceived", ({ detail: s }) => {
|
|
|
7624
7624
|
client.debug && !o.some((i) => i === a.data.listener) && k.received("[Client]", `Event ${a.data.listener} received from ${a.provider}`, a.data.event);
|
|
7625
7625
|
}
|
|
7626
7626
|
});
|
|
7627
|
-
const tt = typeof SE_API < "u" ? Promise.resolve(SE_API) : Promise.resolve(ft()), k = new
|
|
7627
|
+
const tt = typeof SE_API < "u" ? Promise.resolve(SE_API) : Promise.resolve(ft()), k = new $(), yt = {
|
|
7628
7628
|
Client: J,
|
|
7629
7629
|
USE_SE_API: tt,
|
|
7630
7630
|
Simulation: x,
|
|
@@ -7634,7 +7634,8 @@ const tt = typeof SE_API < "u" ? Promise.resolve(SE_API) : Promise.resolve(ft())
|
|
|
7634
7634
|
findEmotesInText: F,
|
|
7635
7635
|
replaceEmotesWithHTML: B,
|
|
7636
7636
|
replaceYoutubeEmotesWithHTML: pt,
|
|
7637
|
-
generateBadges: K
|
|
7637
|
+
generateBadges: K,
|
|
7638
|
+
parseProvider: X
|
|
7638
7639
|
},
|
|
7639
7640
|
modules: {
|
|
7640
7641
|
Button: q,
|
|
@@ -7642,8 +7643,8 @@ const tt = typeof SE_API < "u" ? Promise.resolve(SE_API) : Promise.resolve(ft())
|
|
|
7642
7643
|
EventProvider: O,
|
|
7643
7644
|
useComfyJs: bt,
|
|
7644
7645
|
useStorage: S,
|
|
7645
|
-
useQueue:
|
|
7646
|
-
Logger:
|
|
7646
|
+
useQueue: Z,
|
|
7647
|
+
Logger: $
|
|
7647
7648
|
},
|
|
7648
7649
|
data: {
|
|
7649
7650
|
usedStorages: _
|