@adea-ai/audio 0.69.2 → 0.69.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/sound.js +19 -23
- package/package.json +1 -1
- package/src/sound.tsx +5 -3
package/dist/sound.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { soundController } from "./controller.js";
|
|
2
2
|
import { musicForScene } from "./scene-music.js";
|
|
3
|
-
import {
|
|
3
|
+
import { createComponent, memo } from "solid-js/web";
|
|
4
4
|
import { Music, Music2 } from "lucide-solid";
|
|
5
5
|
import { createContext, createEffect, createMemo, createSignal, on, onCleanup, onMount, useContext } from "solid-js";
|
|
6
|
+
import { Button } from "@adea-ai/ui/components/ui/button";
|
|
6
7
|
//#region src/sound.tsx
|
|
7
|
-
var _tmpl$ = /*#__PURE__*/ template(`<button type=button>`);
|
|
8
8
|
var SoundContext = createContext(null);
|
|
9
9
|
function SoundProvider(props) {
|
|
10
10
|
const [musicMuted, setMusicMuted] = createSignal(false);
|
|
@@ -60,32 +60,29 @@ function useSceneMusic(sceneId) {
|
|
|
60
60
|
}));
|
|
61
61
|
}
|
|
62
62
|
function MusicButton(props) {
|
|
63
|
-
return (
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
63
|
+
return createComponent(Button, {
|
|
64
|
+
type: "button",
|
|
65
|
+
get ["aria-label"]() {
|
|
66
|
+
return props.muted ? "Unmute music" : "Mute music";
|
|
67
|
+
},
|
|
68
|
+
get ["aria-pressed"]() {
|
|
69
|
+
return props.muted;
|
|
70
|
+
},
|
|
71
|
+
onClick: () => props.onToggle(),
|
|
72
|
+
get variant() {
|
|
73
|
+
return props.muted ? "outline" : "default";
|
|
74
|
+
},
|
|
75
|
+
size: "icon-lg",
|
|
76
|
+
get children() {
|
|
77
|
+
return memo(() => !!props.muted)() ? createComponent(Music, {
|
|
69
78
|
"class": "size-5",
|
|
70
79
|
"aria-hidden": "true"
|
|
71
80
|
}) : createComponent(Music2, {
|
|
72
81
|
"class": "size-5",
|
|
73
82
|
"aria-hidden": "true"
|
|
74
83
|
});
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
var _v$ = props.muted ? "Unmute music" : "Mute music", _v$2 = props.muted, _v$3 = `inline-flex size-9 items-center justify-center rounded-lg border border-input bg-background transition-colors ${props.muted ? "text-muted-foreground hover:text-foreground" : "bg-primary text-primary-foreground"}`;
|
|
78
|
-
_v$ !== _p$.e && setAttribute(_el$, "aria-label", _p$.e = _v$);
|
|
79
|
-
_v$2 !== _p$.t && setAttribute(_el$, "aria-pressed", _p$.t = _v$2);
|
|
80
|
-
_v$3 !== _p$.a && className(_el$, _p$.a = _v$3);
|
|
81
|
-
return _p$;
|
|
82
|
-
}, {
|
|
83
|
-
e: void 0,
|
|
84
|
-
t: void 0,
|
|
85
|
-
a: void 0
|
|
86
|
-
});
|
|
87
|
-
return _el$;
|
|
88
|
-
})();
|
|
84
|
+
}
|
|
85
|
+
});
|
|
89
86
|
}
|
|
90
87
|
function MusicToggle() {
|
|
91
88
|
const { musicMuted, toggleMusicMute } = useSound();
|
|
@@ -94,6 +91,5 @@ function MusicToggle() {
|
|
|
94
91
|
onToggle: toggleMusicMute
|
|
95
92
|
});
|
|
96
93
|
}
|
|
97
|
-
delegateEvents(["click"]);
|
|
98
94
|
//#endregion
|
|
99
95
|
export { MusicToggle, SoundProvider, useSceneMusic, useSound };
|
package/package.json
CHANGED
package/src/sound.tsx
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
import { soundController, type MusicOptions } from './controller'
|
|
14
14
|
import { musicForScene } from './scene-music'
|
|
15
15
|
import type { MusicId } from './config'
|
|
16
|
+
import { Button } from '@adea-ai/ui/components/ui/button'
|
|
16
17
|
|
|
17
18
|
export type SoundContextValue = {
|
|
18
19
|
controller: typeof soundController
|
|
@@ -87,19 +88,20 @@ export function useSceneMusic(sceneId: string | null | undefined): void {
|
|
|
87
88
|
|
|
88
89
|
function MusicButton(props: { muted: boolean; onToggle: () => void }) {
|
|
89
90
|
return (
|
|
90
|
-
<
|
|
91
|
+
<Button
|
|
91
92
|
type="button"
|
|
92
93
|
aria-label={props.muted ? 'Unmute music' : 'Mute music'}
|
|
93
94
|
aria-pressed={props.muted}
|
|
94
95
|
onClick={() => props.onToggle()}
|
|
95
|
-
|
|
96
|
+
variant={props.muted ? 'outline' : 'default'}
|
|
97
|
+
size="icon-lg"
|
|
96
98
|
>
|
|
97
99
|
{props.muted ? (
|
|
98
100
|
<Music class="size-5" aria-hidden="true" />
|
|
99
101
|
) : (
|
|
100
102
|
<Music2 class="size-5" aria-hidden="true" />
|
|
101
103
|
)}
|
|
102
|
-
</
|
|
104
|
+
</Button>
|
|
103
105
|
)
|
|
104
106
|
}
|
|
105
107
|
|