@open-slot-ui/core 0.13.2 → 0.13.4
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 +17 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -2
- package/dist/index.d.ts +9 -2
- package/dist/index.js +17 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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
|
|
@@ -2032,7 +2042,6 @@ var OpenUI = class {
|
|
|
2032
2042
|
* opts out. */
|
|
2033
2043
|
autoplayInsufficientNotice = true;
|
|
2034
2044
|
sessionNet = 0;
|
|
2035
|
-
prevVolumes = null;
|
|
2036
2045
|
/** The frozen UISpec `createUI` built this from, if any — authored = run = tested. */
|
|
2037
2046
|
spec;
|
|
2038
2047
|
/** Typed convenience handles for the controls. */
|
|
@@ -2237,18 +2246,14 @@ var OpenUI = class {
|
|
|
2237
2246
|
toggleMute() {
|
|
2238
2247
|
this.setMuted(!this.muted.get());
|
|
2239
2248
|
}
|
|
2240
|
-
/**
|
|
2249
|
+
/**
|
|
2250
|
+
* Master mute/unmute. This ONLY flips the `muted` signal — the host silences audio off it
|
|
2251
|
+
* (and may grey the volume sliders). It does NOT drive the Music/Sound sliders to 0: doing so
|
|
2252
|
+
* would fire `valueChanged` and let a persistence layer save the transient 0, wiping the real
|
|
2253
|
+
* volume. The sliders keep showing the actual volume, just muted.
|
|
2254
|
+
*/
|
|
2241
2255
|
setMuted(m) {
|
|
2242
2256
|
if (m === this.muted.get()) return;
|
|
2243
|
-
if (m) {
|
|
2244
|
-
this.prevVolumes = { music: this.musicSlider.value.get(), sfx: this.sfxSlider.value.get() };
|
|
2245
|
-
this.musicSlider.setNormalized(0);
|
|
2246
|
-
this.sfxSlider.setNormalized(0);
|
|
2247
|
-
} else if (this.prevVolumes) {
|
|
2248
|
-
this.musicSlider.setNormalized(this.prevVolumes.music);
|
|
2249
|
-
this.sfxSlider.setNormalized(this.prevVolumes.sfx);
|
|
2250
|
-
this.prevVolumes = null;
|
|
2251
|
-
}
|
|
2252
2257
|
this.muted.set(m);
|
|
2253
2258
|
}
|
|
2254
2259
|
/**
|