@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.cjs CHANGED
@@ -670,7 +670,8 @@ var SliderControl = class extends Control {
670
670
  bus;
671
671
  states = {
672
672
  idle: { interactable: true },
673
- dragging: { interactable: true }
673
+ dragging: { interactable: true },
674
+ disabled: { interactable: false }
674
675
  };
675
676
  value = new Signal(0.5);
676
677
  label;
@@ -682,11 +683,20 @@ var SliderControl = class extends Control {
682
683
  this.bus?.emit("valueChanged", { id: this.id, value: c });
683
684
  }
684
685
  beginDrag() {
686
+ if (this.current === "disabled") return;
685
687
  this.setState("dragging");
686
688
  }
687
689
  endDrag() {
690
+ if (this.current === "disabled") return;
688
691
  this.setState("idle");
689
692
  }
693
+ /** Grey the slider out + block interaction (e.g. the volume sliders while sound is off). */
694
+ disable() {
695
+ this.setState("disabled");
696
+ }
697
+ enable() {
698
+ if (this.current === "disabled") this.setState("idle");
699
+ }
690
700
  };
691
701
 
692
702
  // src/controls/PanelControl.ts
@@ -2810,8 +2820,9 @@ function composeMenu(menu, opts = {}) {
2810
2820
  out.push({ kind: "image", id: "menu-banner", src: menu.banner.src, width: menu.banner.width, height: menu.banner.height });
2811
2821
  }
2812
2822
  out.push({ kind: "heading", id: "menu-sec-settings", text: titles.settings });
2813
- out.push({ kind: "slider", id: "music", label: "Music" });
2814
- out.push({ kind: "slider", id: "sfx", label: "Sound" });
2823
+ if (menu?.settings?.length) out.push(...menu.settings);
2824
+ out.push({ kind: "slider", id: "music", label: "Music", hint: "Background music volume." });
2825
+ out.push({ kind: "slider", id: "sfx", label: "Effects", hint: "Sound effect volume." });
2815
2826
  const locales = opts.locales ?? [];
2816
2827
  if (locales.length >= 2) {
2817
2828
  out.push({
@@ -2821,7 +2832,6 @@ function composeMenu(menu, opts = {}) {
2821
2832
  options: locales.map((code) => ({ value: code, label: LOCALE_LABELS[code] ?? code.toUpperCase() }))
2822
2833
  });
2823
2834
  }
2824
- if (menu?.settings?.length) out.push(...menu.settings);
2825
2835
  if (menu?.paytable?.length) {
2826
2836
  out.push({ kind: "heading", id: "menu-sec-paytable", text: titles.paytable });
2827
2837
  out.push(...menu.paytable);