@tixyel/streamelements 3.5.0 → 3.7.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 +116 -12
- package/dist/index.es.js +4447 -920
- 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
|
@@ -224,6 +224,25 @@ declare function findEmotesInText(text: string, emotes?: Emote[]): Emote[];
|
|
|
224
224
|
* @returns The text with emotes replaced by HTML image tags.
|
|
225
225
|
*/
|
|
226
226
|
declare function replaceEmotesWithHTML(text: string, emotes: Emote[]): string;
|
|
227
|
+
declare function replaceYoutubeEmotesWithHTML(text: string, emotes?: {
|
|
228
|
+
emojiId: string;
|
|
229
|
+
shortcuts: string[];
|
|
230
|
+
searchTerms: string[];
|
|
231
|
+
image: {
|
|
232
|
+
thumbnails: {
|
|
233
|
+
url: string;
|
|
234
|
+
width: number;
|
|
235
|
+
height: number;
|
|
236
|
+
}[];
|
|
237
|
+
accessibility: {
|
|
238
|
+
accessibilityData: {
|
|
239
|
+
label: string;
|
|
240
|
+
};
|
|
241
|
+
};
|
|
242
|
+
};
|
|
243
|
+
isCustomEmoji: boolean;
|
|
244
|
+
index: number;
|
|
245
|
+
}[]): string;
|
|
227
246
|
type TwitchResult = {
|
|
228
247
|
keys: Twitch.roles[];
|
|
229
248
|
badges: Twitch.badge[];
|
|
@@ -1351,16 +1370,18 @@ declare namespace StreamElements {
|
|
|
1351
1370
|
* @example
|
|
1352
1371
|
* ```typescript
|
|
1353
1372
|
* interface TestEvents {
|
|
1354
|
-
* load: [{ type: 'load' }];
|
|
1355
|
-
* event: [{ type: 'event' }];
|
|
1356
|
-
* }
|
|
1373
|
+
* load: [event: { type: 'load' }];
|
|
1374
|
+
* event: [event: { type: 'event' }];
|
|
1375
|
+
* };
|
|
1357
1376
|
*
|
|
1358
1377
|
* class Test extends EventProvider<TestEvents> {}
|
|
1359
1378
|
*
|
|
1360
1379
|
* const test = new Test();
|
|
1361
|
-
* test.
|
|
1362
|
-
* test.once('event', (data) => {})
|
|
1380
|
+
* test.once('load', (data) => {});
|
|
1363
1381
|
* test.emit('load', { type: 'load' });
|
|
1382
|
+
*
|
|
1383
|
+
* test.on('event', (data) => {});
|
|
1384
|
+
* test.emit('event', { type: 'event' });
|
|
1364
1385
|
* ```
|
|
1365
1386
|
*/
|
|
1366
1387
|
declare class EventProvider<EventMap extends Record<string, any[]> = Record<string, any[]>> {
|
|
@@ -1439,11 +1460,13 @@ declare namespace Alejo {
|
|
|
1439
1460
|
itits = "It/Its"
|
|
1440
1461
|
}
|
|
1441
1462
|
}
|
|
1463
|
+
function list(): Promise<typeof Pronouns.map>;
|
|
1442
1464
|
type user = {
|
|
1443
1465
|
id: string;
|
|
1444
1466
|
login: string;
|
|
1445
|
-
|
|
1467
|
+
pronoun_id: Pronouns.name;
|
|
1446
1468
|
};
|
|
1469
|
+
function get(username: string): Promise<Pronouns.name | undefined>;
|
|
1447
1470
|
}
|
|
1448
1471
|
|
|
1449
1472
|
declare namespace Simulation {
|
|
@@ -1453,6 +1476,25 @@ declare namespace Simulation {
|
|
|
1453
1476
|
tiers: string[];
|
|
1454
1477
|
avatars: string[];
|
|
1455
1478
|
emotes: (TwitchEmote | BttvEmote | SeventvEmote)[];
|
|
1479
|
+
youtube_emotes: {
|
|
1480
|
+
emojiId: string;
|
|
1481
|
+
shortcuts: string[];
|
|
1482
|
+
searchTerms: string[];
|
|
1483
|
+
image: {
|
|
1484
|
+
thumbnails: {
|
|
1485
|
+
url: string;
|
|
1486
|
+
width: number;
|
|
1487
|
+
height: number;
|
|
1488
|
+
}[];
|
|
1489
|
+
accessibility: {
|
|
1490
|
+
accessibilityData: {
|
|
1491
|
+
label: string;
|
|
1492
|
+
};
|
|
1493
|
+
};
|
|
1494
|
+
};
|
|
1495
|
+
isCustomEmoji: boolean;
|
|
1496
|
+
index: number;
|
|
1497
|
+
}[];
|
|
1456
1498
|
badges: Record<Twitch.roles, Twitch.badge>;
|
|
1457
1499
|
items: any[];
|
|
1458
1500
|
tts: string[];
|
|
@@ -1477,6 +1519,20 @@ declare namespace Simulation {
|
|
|
1477
1519
|
opacity: number;
|
|
1478
1520
|
};
|
|
1479
1521
|
validate(str: string): false | "hex" | "rgb" | "rgba" | "hsl" | "hsla" | "css-color-name";
|
|
1522
|
+
/**
|
|
1523
|
+
* Convert color to different format
|
|
1524
|
+
* @param str - Color string to convert (e.g. "#FF5733", "rgb(255, 87, 51)")
|
|
1525
|
+
* @param format - Target format
|
|
1526
|
+
* @returns - Converted color string
|
|
1527
|
+
* @example
|
|
1528
|
+
* ```javascript
|
|
1529
|
+
* const hexColor = Simulation.color.convert("rgb(255, 87, 51)", "hex"); // "#FF5733"
|
|
1530
|
+
* const rgbColor = Simulation.color.convert("#FF5733", "rgb"); // "rgb(255, 87, 51)"
|
|
1531
|
+
* const hslColor = Simulation.color.convert("#FF5733", "hsl"); // "hsl(14, 100%, 60%)"
|
|
1532
|
+
* const colorName = Simulation.color.convert("#FF5733", "css-color-name"); // "orangered"
|
|
1533
|
+
* ```
|
|
1534
|
+
*/
|
|
1535
|
+
convert(str: string, format: "hex" | "rgb" | "rgba" | "hsl" | "hsla" | "css-color-name"): string | null;
|
|
1480
1536
|
};
|
|
1481
1537
|
export const rand: {
|
|
1482
1538
|
/**
|
|
@@ -1632,6 +1688,33 @@ declare namespace Simulation {
|
|
|
1632
1688
|
aliases?: Record<string, string[]>;
|
|
1633
1689
|
}): string;
|
|
1634
1690
|
};
|
|
1691
|
+
export const number: {
|
|
1692
|
+
/**
|
|
1693
|
+
* Translate number to words
|
|
1694
|
+
* @param num - Number to translate
|
|
1695
|
+
* @param type - Translation type
|
|
1696
|
+
* @returns - Number in words
|
|
1697
|
+
* @example
|
|
1698
|
+
* ```javascript
|
|
1699
|
+
* const cardinal = Simulation.number.translate(42, 'cardinal');
|
|
1700
|
+
* console.log(cardinal); // "forty-two"
|
|
1701
|
+
* ```
|
|
1702
|
+
*/
|
|
1703
|
+
translate(num: number, type?: "cardinal" | "ordinal" | "suffix"): string;
|
|
1704
|
+
/**
|
|
1705
|
+
* Balances a number within a specified range
|
|
1706
|
+
* @param amount - Number to balance
|
|
1707
|
+
* @param min - Minimum value
|
|
1708
|
+
* @param max - Maximum value
|
|
1709
|
+
* @returns - Balanced number
|
|
1710
|
+
* @example
|
|
1711
|
+
* ```javascript
|
|
1712
|
+
* const balancedValue = Simulation.number.balance(150, 0, 100);
|
|
1713
|
+
* console.log(balancedValue); // 100
|
|
1714
|
+
* ```
|
|
1715
|
+
*/
|
|
1716
|
+
balance(amount: number, min?: number, max?: number): number;
|
|
1717
|
+
};
|
|
1635
1718
|
export const element: {
|
|
1636
1719
|
/**
|
|
1637
1720
|
* Merges outer span styles with inner span styles in the provided HTML string.
|
|
@@ -1761,6 +1844,13 @@ declare namespace Simulation {
|
|
|
1761
1844
|
facebook: {};
|
|
1762
1845
|
send<T extends "onEventReceived" | "onSessionUpdate" | "onWidgetLoad">(listener: T, event: T extends "onEventReceived" ? StreamElements.Event.onEventReceived : T extends "onSessionUpdate" ? StreamElements.Event.onSessionUpdate : StreamElements.Event.onWidgetLoad): void;
|
|
1763
1846
|
};
|
|
1847
|
+
/**
|
|
1848
|
+
* Delays execution for a specified number of milliseconds.
|
|
1849
|
+
* @param ms - The number of milliseconds to delay.
|
|
1850
|
+
* @returns A Promise that resolves after the specified delay.
|
|
1851
|
+
*/
|
|
1852
|
+
export function delay(ms: number): Promise<void>;
|
|
1853
|
+
export function probability(items: Record<string, number>): string | undefined;
|
|
1764
1854
|
export function start(fieldsFile?: string[], dataFiles?: string[]): Promise<void>;
|
|
1765
1855
|
export {};
|
|
1766
1856
|
}
|
|
@@ -1773,7 +1863,7 @@ type UseStorageOptions<T> = {
|
|
|
1773
1863
|
id?: string;
|
|
1774
1864
|
data: T;
|
|
1775
1865
|
};
|
|
1776
|
-
declare class useStorage<T extends
|
|
1866
|
+
declare class useStorage<T extends Record<string, any>> extends EventProvider<UseStorageEvents<T>> {
|
|
1777
1867
|
/**
|
|
1778
1868
|
* The unique identifier for the storage instance.
|
|
1779
1869
|
*/
|
|
@@ -1833,10 +1923,7 @@ type ClientEvents = {
|
|
|
1833
1923
|
load: [event: StreamElements.Event.onWidgetLoad];
|
|
1834
1924
|
action: [action: Button | Command, type: 'created' | 'executed' | 'removed'];
|
|
1835
1925
|
session: [session: StreamElements.Session.Data];
|
|
1836
|
-
event: [event:
|
|
1837
|
-
};
|
|
1838
|
-
type ClientOptions = {
|
|
1839
|
-
id?: string;
|
|
1926
|
+
event: [provider: 'streamelements', event: StreamElements.Event.Provider.StreamElements.Events] | [provider: 'twitch', event: StreamElements.Event.Provider.Twitch.Events] | [provider: 'youtube', event: StreamElements.Event.Provider.YouTube.Events] | [provider: 'kick', event: StreamElements.Event.Provider.Kick.Events] | [provider: 'facebook', event: StreamElements.Event.Provider.Facebook.Events];
|
|
1840
1927
|
};
|
|
1841
1928
|
type ClientStorageOptions<T> = {
|
|
1842
1929
|
value: T;
|
|
@@ -1849,6 +1936,9 @@ type ClientStorage = {
|
|
|
1849
1936
|
pronoun: Record<string, ClientStorageOptions<Alejo.Pronouns.name>>;
|
|
1850
1937
|
emote: Record<string, ClientStorageOptions<string>>;
|
|
1851
1938
|
};
|
|
1939
|
+
type ClientOptions = {
|
|
1940
|
+
id?: string;
|
|
1941
|
+
};
|
|
1852
1942
|
declare class Client extends EventProvider<ClientEvents> {
|
|
1853
1943
|
id: string;
|
|
1854
1944
|
storage: useStorage<ClientStorage>;
|
|
@@ -1867,8 +1957,17 @@ declare class Client extends EventProvider<ClientEvents> {
|
|
|
1867
1957
|
overlay: StreamElements.Event.onWidgetLoad['overlay'];
|
|
1868
1958
|
};
|
|
1869
1959
|
cache: {
|
|
1960
|
+
/**
|
|
1961
|
+
* Avatar cache duration in minutes.
|
|
1962
|
+
*/
|
|
1870
1963
|
avatar: number;
|
|
1964
|
+
/**
|
|
1965
|
+
* Pronoun cache duration in minutes.
|
|
1966
|
+
*/
|
|
1871
1967
|
pronoun: number;
|
|
1968
|
+
/**
|
|
1969
|
+
* Emote cache duration in minutes.
|
|
1970
|
+
*/
|
|
1872
1971
|
emote: number;
|
|
1873
1972
|
};
|
|
1874
1973
|
on<K extends keyof ClientEvents>(eventName: K, callback: (this: Client, ...args: ClientEvents[K]) => void): this;
|
|
@@ -1998,13 +2097,15 @@ declare class Logger {
|
|
|
1998
2097
|
declare const USE_SE_API: Promise<StreamElements.SE_API>;
|
|
1999
2098
|
declare const logger: Logger;
|
|
2000
2099
|
declare const Tixyel: {
|
|
2100
|
+
readonly Client: typeof Client;
|
|
2001
2101
|
readonly USE_SE_API: Promise<StreamElements.SE_API>;
|
|
2002
2102
|
readonly Simulation: typeof Simulation;
|
|
2003
|
-
readonly Client: typeof Client;
|
|
2004
2103
|
readonly logger: Logger;
|
|
2104
|
+
readonly Alejo: typeof Alejo;
|
|
2005
2105
|
readonly utils: {
|
|
2006
2106
|
readonly findEmotesInText: typeof findEmotesInText;
|
|
2007
2107
|
readonly replaceEmotesWithHTML: typeof replaceEmotesWithHTML;
|
|
2108
|
+
readonly replaceYoutubeEmotesWithHTML: typeof replaceYoutubeEmotesWithHTML;
|
|
2008
2109
|
readonly generateBadges: typeof generateBadges;
|
|
2009
2110
|
};
|
|
2010
2111
|
readonly modules: {
|
|
@@ -2015,6 +2116,9 @@ declare const Tixyel: {
|
|
|
2015
2116
|
readonly useQueue: typeof useQueue;
|
|
2016
2117
|
readonly Logger: typeof Logger;
|
|
2017
2118
|
};
|
|
2119
|
+
readonly data: {
|
|
2120
|
+
readonly usedStorages: useStorage<any>[];
|
|
2121
|
+
};
|
|
2018
2122
|
};
|
|
2019
2123
|
type Main = typeof Tixyel;
|
|
2020
2124
|
declare global {
|