@tixyel/streamelements 4.6.0 → 4.6.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 CHANGED
@@ -2326,21 +2326,12 @@ interface Theme {
2326
2326
  }
2327
2327
  interface Options {
2328
2328
  enabled?: boolean;
2329
- prefix?: string;
2329
+ prefix?: string | (() => string);
2330
2330
  }
2331
2331
  type LogMethod = (...args: unknown[]) => void;
2332
2332
  declare class Logger {
2333
- private readonly enabled;
2334
- private readonly prefix;
2335
- readonly error: LogMethod;
2336
- readonly warn: LogMethod;
2337
- readonly success: LogMethod;
2338
- readonly info: LogMethod;
2339
- readonly debug: LogMethod;
2340
- readonly alert: LogMethod;
2341
- readonly status: LogMethod;
2342
- readonly received: LogMethod;
2343
- readonly simple: LogMethod;
2333
+ enabled: boolean;
2334
+ prefix: string | (() => string);
2344
2335
  constructor(options?: Options);
2345
2336
  apply(theme: Theme): LogMethod;
2346
2337
  private style;
@@ -2350,6 +2341,15 @@ declare class Logger {
2350
2341
  table(data: unknown): void;
2351
2342
  time(label: string): void;
2352
2343
  timeEnd(label: string): void;
2344
+ readonly error: LogMethod;
2345
+ readonly warn: LogMethod;
2346
+ readonly success: LogMethod;
2347
+ readonly info: LogMethod;
2348
+ readonly debug: LogMethod;
2349
+ readonly alert: LogMethod;
2350
+ readonly status: LogMethod;
2351
+ readonly received: LogMethod;
2352
+ readonly simple: LogMethod;
2353
2353
  }
2354
2354
 
2355
2355
  declare function parseProvider(detail: StreamElements.Event.onEventReceived): ClientEvents$1;
package/dist/index.es.js CHANGED
@@ -7411,6 +7411,46 @@ class q {
7411
7411
  class it {
7412
7412
  enabled;
7413
7413
  prefix;
7414
+ constructor(e = {}) {
7415
+ this.enabled = e.enabled ?? !0, this.prefix = e.prefix ?? "";
7416
+ }
7417
+ apply(e) {
7418
+ const s = this.style(e), n = e.icon ? `${e.icon} ` : "";
7419
+ return (...i) => {
7420
+ if (!this.enabled || typeof console > "u") return;
7421
+ let t = "";
7422
+ typeof this.prefix == "function" ? t = this.prefix() : typeof this.prefix == "string" && (t = this.prefix);
7423
+ const r = [], c = [];
7424
+ if (i.forEach((d) => {
7425
+ typeof d == "string" || typeof d == "number" || typeof d == "boolean" ? r.push(d) : c.push(d);
7426
+ }), r.length > 0) {
7427
+ const d = r.join(" ");
7428
+ console.log(`%c${t.endsWith(" ") ? t : t.trim() + " "}${n}${d}`, s, ...c);
7429
+ } else c.length > 0 && console.log(`%c${t.endsWith(" ") ? t : t.trim() + " "}${n}`, s, ...c);
7430
+ };
7431
+ }
7432
+ style(e) {
7433
+ const s = [];
7434
+ return e.background && e.background !== "transparent" && (s.push(`background: ${e.background}`), s.push("padding: 2px 6px"), s.push("border-radius: 3px")), e.color && s.push(`color: ${e.color}`), e.bold && s.push("font-weight: bold"), e.italic && s.push("font-style: italic"), e.fontSize && s.push(`font-size: ${e.fontSize}px`), s.join("; ");
7435
+ }
7436
+ group(e) {
7437
+ !this.enabled || !console.group || console.group(e);
7438
+ }
7439
+ groupCollapsed(e) {
7440
+ !this.enabled || !console.groupCollapsed || console.groupCollapsed(e);
7441
+ }
7442
+ groupEnd() {
7443
+ !this.enabled || !console.groupEnd || console.groupEnd();
7444
+ }
7445
+ table(e) {
7446
+ !this.enabled || !console.table || console.table(e);
7447
+ }
7448
+ time(e) {
7449
+ !this.enabled || !console.time || console.time(e);
7450
+ }
7451
+ timeEnd(e) {
7452
+ !this.enabled || !console.timeEnd || console.timeEnd(e);
7453
+ }
7414
7454
  error = this.apply({
7415
7455
  color: "#721c24",
7416
7456
  background: "#f8d7da",
@@ -7477,44 +7517,6 @@ class it {
7477
7517
  fontSize: 14,
7478
7518
  icon: "☼"
7479
7519
  });
7480
- constructor(e = {}) {
7481
- this.enabled = e.enabled ?? !0, this.prefix = e.prefix ? `[${e.prefix}]` : "";
7482
- }
7483
- apply(e) {
7484
- const s = this.style(e), n = e.icon ? `${e.icon} ` : "";
7485
- return (...i) => {
7486
- if (!this.enabled || typeof console > "u") return;
7487
- const t = this.prefix ? `${this.prefix} ` : "", r = [], c = [];
7488
- if (i.forEach((d) => {
7489
- typeof d == "string" || typeof d == "number" || typeof d == "boolean" ? r.push(d) : c.push(d);
7490
- }), r.length > 0) {
7491
- const d = r.join(" ");
7492
- console.log(`%c${n}${t}${d}`, s, ...c);
7493
- } else c.length > 0 && console.log(`%c${n}${t}`, s, ...c);
7494
- };
7495
- }
7496
- style(e) {
7497
- const s = [];
7498
- return e.background && e.background !== "transparent" && (s.push(`background: ${e.background}`), s.push("padding: 2px 6px"), s.push("border-radius: 3px")), e.color && s.push(`color: ${e.color}`), e.bold && s.push("font-weight: bold"), e.italic && s.push("font-style: italic"), e.fontSize && s.push(`font-size: ${e.fontSize}px`), s.join("; ");
7499
- }
7500
- group(e) {
7501
- !this.enabled || !console.group || console.group(e);
7502
- }
7503
- groupCollapsed(e) {
7504
- !this.enabled || !console.groupCollapsed || console.groupCollapsed(e);
7505
- }
7506
- groupEnd() {
7507
- !this.enabled || !console.groupEnd || console.groupEnd();
7508
- }
7509
- table(e) {
7510
- !this.enabled || !console.table || console.table(e);
7511
- }
7512
- time(e) {
7513
- !this.enabled || !console.time || console.time(e);
7514
- }
7515
- timeEnd(e) {
7516
- !this.enabled || !console.timeEnd || console.timeEnd(e);
7517
- }
7518
7520
  }
7519
7521
  typeof window !== void 0 && (window.addEventListener("load", () => {
7520
7522
  window.client instanceof x && (C.queue = new st({