@open-slot-ui/core 0.13.1 → 0.13.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.cts CHANGED
@@ -595,6 +595,9 @@ declare class SliderControl extends Control {
595
595
  setNormalized(v: number): void;
596
596
  beginDrag(): void;
597
597
  endDrag(): void;
598
+ /** Grey the slider out + block interaction (e.g. the volume sliders while sound is off). */
599
+ disable(): void;
600
+ enable(): void;
598
601
  }
599
602
 
600
603
  type PanelVariant = 'modal' | 'popover';
package/dist/index.d.ts CHANGED
@@ -595,6 +595,9 @@ declare class SliderControl extends Control {
595
595
  setNormalized(v: number): void;
596
596
  beginDrag(): void;
597
597
  endDrag(): void;
598
+ /** Grey the slider out + block interaction (e.g. the volume sliders while sound is off). */
599
+ disable(): void;
600
+ enable(): void;
598
601
  }
599
602
 
600
603
  type PanelVariant = 'modal' | 'popover';
package/dist/index.js CHANGED
@@ -668,7 +668,8 @@ var SliderControl = class extends Control {
668
668
  bus;
669
669
  states = {
670
670
  idle: { interactable: true },
671
- dragging: { interactable: true }
671
+ dragging: { interactable: true },
672
+ disabled: { interactable: false }
672
673
  };
673
674
  value = new Signal(0.5);
674
675
  label;
@@ -680,11 +681,20 @@ var SliderControl = class extends Control {
680
681
  this.bus?.emit("valueChanged", { id: this.id, value: c });
681
682
  }
682
683
  beginDrag() {
684
+ if (this.current === "disabled") return;
683
685
  this.setState("dragging");
684
686
  }
685
687
  endDrag() {
688
+ if (this.current === "disabled") return;
686
689
  this.setState("idle");
687
690
  }
691
+ /** Grey the slider out + block interaction (e.g. the volume sliders while sound is off). */
692
+ disable() {
693
+ this.setState("disabled");
694
+ }
695
+ enable() {
696
+ if (this.current === "disabled") this.setState("idle");
697
+ }
688
698
  };
689
699
 
690
700
  // src/controls/PanelControl.ts
@@ -2808,8 +2818,9 @@ function composeMenu(menu, opts = {}) {
2808
2818
  out.push({ kind: "image", id: "menu-banner", src: menu.banner.src, width: menu.banner.width, height: menu.banner.height });
2809
2819
  }
2810
2820
  out.push({ kind: "heading", id: "menu-sec-settings", text: titles.settings });
2811
- out.push({ kind: "slider", id: "music", label: "Music" });
2812
- out.push({ kind: "slider", id: "sfx", label: "Sound" });
2821
+ if (menu?.settings?.length) out.push(...menu.settings);
2822
+ out.push({ kind: "slider", id: "music", label: "Music", hint: "Background music volume." });
2823
+ out.push({ kind: "slider", id: "sfx", label: "Effects", hint: "Sound effect volume." });
2813
2824
  const locales = opts.locales ?? [];
2814
2825
  if (locales.length >= 2) {
2815
2826
  out.push({
@@ -2819,7 +2830,6 @@ function composeMenu(menu, opts = {}) {
2819
2830
  options: locales.map((code) => ({ value: code, label: LOCALE_LABELS[code] ?? code.toUpperCase() }))
2820
2831
  });
2821
2832
  }
2822
- if (menu?.settings?.length) out.push(...menu.settings);
2823
2833
  if (menu?.paytable?.length) {
2824
2834
  out.push({ kind: "heading", id: "menu-sec-paytable", text: titles.paytable });
2825
2835
  out.push(...menu.paytable);