@tixyel/streamelements 4.5.1 → 4.5.3

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 CHANGED
@@ -2288,6 +2288,12 @@ declare namespace Simulation {
2288
2288
  export {};
2289
2289
  }
2290
2290
 
2291
+ type JSONValue = string | number | boolean | null | JSON | JSONArray;
2292
+ type JSONArray = JSONValue[];
2293
+ type JSON = {
2294
+ [key: string]: JSONValue;
2295
+ };
2296
+
2291
2297
  type UseStorageEvents<T> = {
2292
2298
  load: [T | null];
2293
2299
  update: [T];
@@ -2296,7 +2302,7 @@ type UseStorageOptions<T> = {
2296
2302
  id?: string;
2297
2303
  data: T;
2298
2304
  };
2299
- declare class useStorage<T extends Record<string, any>> extends EventProvider<UseStorageEvents<T>> {
2305
+ declare class useStorage<T extends JSON> extends EventProvider<UseStorageEvents<T>> {
2300
2306
  /**
2301
2307
  * The unique identifier for the storage instance.
2302
2308
  */
@@ -2585,5 +2591,5 @@ declare global {
2585
2591
  const SE_API: StreamElements.SE_API;
2586
2592
  }
2587
2593
 
2588
- export { Alejo, StreamElements, StreamElementsEvents, Tixyel, Twitch, TwitchEvents, USE_SE_API, YoutubeEvents, logger };
2589
- export type { BttvEmote, ClientEvents$1 as ClientEvents, Provider$1 as Provider, SeventvEmote, TwitchEmote };
2594
+ export { Alejo, Button, Command, EventProvider, Logger, StreamElements, StreamElementsEvents, Tixyel, Twitch, TwitchEvents, USE_SE_API, YoutubeEvents, findEmotesInText, generateBadges, logger, replaceEmotesWithHTML, replaceYoutubeEmotesWithHTML, useComfyJs, useQueue, useStorage };
2595
+ export type { BadgeOptions, BttvEmote, ClientEvents$1 as ClientEvents, Emote, Provider$1 as Provider, SeventvEmote, TwitchEmote };
package/dist/index.es.js CHANGED
@@ -5457,9 +5457,9 @@ var x;
5457
5457
  let I = null;
5458
5458
  if (h[u] === ":") {
5459
5459
  u++;
5460
- const S = u;
5460
+ const V = u;
5461
5461
  for (; u < y && h[u] !== "="; ) u++;
5462
- I = h.slice(S, u);
5462
+ I = h.slice(V, u);
5463
5463
  }
5464
5464
  h[u] === "=" && u++;
5465
5465
  const T = U("]");
@@ -6407,11 +6407,11 @@ var x;
6407
6407
  case "mute":
6408
6408
  case "unmute":
6409
6409
  case "alertService:toggleSound": {
6410
- var S = r?.muted ?? !client.details.overlay.muted;
6410
+ var V = r?.muted ?? !client.details.overlay.muted;
6411
6411
  return {
6412
6412
  listener: "alertService:toggleSound",
6413
6413
  event: {
6414
- muted: S,
6414
+ muted: V,
6415
6415
  provider: t
6416
6416
  }
6417
6417
  };
@@ -6905,14 +6905,17 @@ class q extends N {
6905
6905
  * @param data Data to save (defaults to current)
6906
6906
  */
6907
6907
  save(e = this.data) {
6908
- this.loaded && this.SE_API && (this.data = e, this.SE_API.store.set(this.id, this.data), this.emit("update", this.data));
6908
+ this.loaded && this.SE_API && JSON.stringify(this.data) !== JSON.stringify(e) && (this.data = e, this.SE_API.store.set(this.id, this.data), this.emit("update", this.data));
6909
6909
  }
6910
6910
  /**
6911
6911
  * Updates the storage data and emits an update event
6912
6912
  * @param data Data to update (defaults to current)
6913
6913
  */
6914
6914
  update(e = this.data) {
6915
- this.loaded && JSON.stringify(this.data) !== JSON.stringify(e) && (this.data = { ...this.data, ...e }, this.save(this.data));
6915
+ if (this.loaded && JSON.stringify(this.data) !== JSON.stringify(e)) {
6916
+ const a = { ...this.data, ...e };
6917
+ this.save(a);
6918
+ }
6916
6919
  }
6917
6920
  /**
6918
6921
  * Adds a value to the storage at the specified path.
@@ -7298,7 +7301,7 @@ class Z extends N {
7298
7301
  return e === "load" && this.loaded ? (a.apply(this), this) : (super.on(e, a), this);
7299
7302
  }
7300
7303
  }
7301
- class V {
7304
+ class S {
7302
7305
  field = "button";
7303
7306
  template = "button";
7304
7307
  run;
@@ -7324,7 +7327,7 @@ class V {
7324
7327
  if (!(window.client instanceof J)) return !1;
7325
7328
  if (window.client.actions.buttons.length) {
7326
7329
  const o = window.client.actions.buttons.filter((i) => typeof i.field == "string" ? i.field === e : typeof i.field == "function" ? i.field(e, a) : !1);
7327
- if (o.length && o.every((i) => i instanceof V))
7330
+ if (o.length && o.every((i) => i instanceof S))
7328
7331
  return o.forEach((i) => {
7329
7332
  try {
7330
7333
  i.parse(e, a), window.client.emit("action", i, "executed"), j.received(`Button executed: ${e}${a ? ` with value: ${a}` : ""}`);
@@ -7537,7 +7540,7 @@ window.addEventListener("onEventReceived", ({ detail: s }) => {
7537
7540
  switch (i.event.listener) {
7538
7541
  case "widget-button": {
7539
7542
  const t = i.event;
7540
- V.execute(t.field, t.value);
7543
+ S.execute(t.field, t.value);
7541
7544
  break;
7542
7545
  }
7543
7546
  case "subscriber-latest": {
@@ -7660,7 +7663,7 @@ const tt = typeof SE_API < "u" ? Promise.resolve(SE_API) : Promise.resolve(ft())
7660
7663
  parseProvider: X
7661
7664
  },
7662
7665
  modules: {
7663
- Button: V,
7666
+ Button: S,
7664
7667
  Command: R,
7665
7668
  EventProvider: N,
7666
7669
  useComfyJs: bt,