@tixyel/streamelements 3.0.0 → 3.1.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/README.md CHANGED
@@ -1,40 +1,40 @@
1
- # @tixyel/streamelements
2
-
3
- TypeScript/JavaScript helper library for building custom widgets for [StreamElements](https://streamelements.com/), focused on productivity, type safety, and local development. Designed for browser usage via CDN, with TypeScript types for IDE autocompletion.
4
-
5
- ## Features
6
-
7
- - **Typed event helpers** for Twitch, YouTube, and Kick (in development)
8
- - **Utility functions** for common widget tasks
9
- - **TypeScript types** for all major StreamElements events
10
- - **Local development support**: Test your widget locally without uploading to StreamElements
11
- - **Easy integration**: Use directly in the browser via CDN
12
-
13
- ## Usage
14
-
15
- Add the following to your HTML:
16
-
17
- ```html
18
- <script src="https://cdn.jsdelivr.net/npm/@tixyel/streamelements"></script>
19
- <script>
20
- const { Client, Simulation, logger } = window.Tixyel;
21
-
22
- new Client({ id: 'my-widget' }).on('load', (event) => {
23
- logger.received('Widget loaded!', event);
24
- });
25
- </script>
26
- ```
27
-
28
- > **Note:** This package is designed for browser usage via CDN only.
29
- > TypeScript is used only to provide type definitions and autocompletion in your IDE when working with `window.Tixyel`.
30
-
31
- ## API Overview
32
-
33
- - **Client**: Manages events and integration with StreamElements.
34
- - **Simulation**: Simulates events for local testing.
35
- - **Logger**: Utility for formatted logs.
36
- - **Button/Command**: Helpers for custom actions.
37
-
38
- ## License
39
-
40
- Apache-2.0
1
+ # @tixyel/streamelements
2
+
3
+ TypeScript/JavaScript helper library for building custom widgets for [StreamElements](https://streamelements.com/), focused on productivity, type safety, and local development. Designed for browser usage via CDN, with TypeScript types for IDE autocompletion.
4
+
5
+ ## Features
6
+
7
+ - **Typed event helpers** for Twitch, YouTube, and Kick (in development)
8
+ - **Utility functions** for common widget tasks
9
+ - **TypeScript types** for all major StreamElements events
10
+ - **Local development support**: Test your widget locally without uploading to StreamElements
11
+ - **Easy integration**: Use directly in the browser via CDN
12
+
13
+ ## Usage
14
+
15
+ Add the following to your HTML:
16
+
17
+ ```html
18
+ <script src="https://cdn.jsdelivr.net/npm/@tixyel/streamelements"></script>
19
+ <script>
20
+ const { Client, Simulation, logger } = window.Tixyel;
21
+
22
+ new Client({ id: 'my-widget' }).on('load', (event) => {
23
+ logger.received('Widget loaded!', event);
24
+ });
25
+ </script>
26
+ ```
27
+
28
+ > **Note:** This package is designed for browser usage via CDN only.
29
+ > TypeScript is used only to provide type definitions and autocompletion in your IDE when working with `window.Tixyel`.
30
+
31
+ ## API Overview
32
+
33
+ - **Client**: Manages events and integration with StreamElements.
34
+ - **Simulation**: Simulates events for local testing.
35
+ - **Logger**: Utility for formatted logs.
36
+ - **Button/Command**: Helpers for custom actions.
37
+
38
+ ## License
39
+
40
+ Apache-2.0
package/dist/index.d.ts CHANGED
@@ -654,7 +654,7 @@ declare class useStorage<T extends object = Record<string, any>> extends EventPr
654
654
  * @returns The updated object
655
655
  */
656
656
  static setByPath<P extends string, T extends object>(obj: T, path: P, value: PathValue<T, P>): void;
657
- on<K extends keyof UseStorageEvents<T>>(eventName: K, callback: (...args: UseStorageEvents<T>[K]) => void): this;
657
+ on<K extends keyof UseStorageEvents<T>>(eventName: K, callback: (this: useStorage<T>, ...args: UseStorageEvents<T>[K]) => void): this;
658
658
  }
659
659
 
660
660
  type StreamElements$AlertService = {
@@ -1297,7 +1297,7 @@ interface CommandOptions {
1297
1297
  name: string;
1298
1298
  description?: string;
1299
1299
  arguments?: boolean;
1300
- run: () => void;
1300
+ run: (this: Client, args: string[], event: CommandEvent) => void;
1301
1301
  test?: string;
1302
1302
  aliases?: string[];
1303
1303
  permissions?: string[];
@@ -1344,10 +1344,10 @@ declare class Button {
1344
1344
  }
1345
1345
 
1346
1346
  type ClientEvents = {
1347
- load: [this: Client, event: onWidgetLoad];
1348
- action: [this: Client, action: Button | Command, type: 'created' | 'executed'];
1349
- session: [this: Client, session: Session$1];
1350
- event: [this: Client, event: ClientEvents$1];
1347
+ load: [event: onWidgetLoad];
1348
+ action: [action: Button | Command, type: 'created' | 'executed'];
1349
+ session: [session: Session$1];
1350
+ event: [event: ClientEvents$1];
1351
1351
  };
1352
1352
  type ClientOptions = {
1353
1353
  id?: string;
@@ -1385,7 +1385,7 @@ declare class Client extends EventProvider<ClientEvents> {
1385
1385
  pronoun: number;
1386
1386
  emote: number;
1387
1387
  };
1388
- on<K extends keyof ClientEvents>(eventName: K, callback: (...args: ClientEvents[K]) => void): this;
1388
+ on<K extends keyof ClientEvents>(eventName: K, callback: (this: Client, ...args: ClientEvents[K]) => void): this;
1389
1389
  }
1390
1390
 
1391
1391
  type TwitchBadge = {