@novely/solid-renderer 0.37.0-experemental → 0.37.0
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.jsx +10 -42
- package/package.json +3 -3
package/dist/index.jsx
CHANGED
|
@@ -2393,10 +2393,7 @@ var createAudio2 = (storageData) => {
|
|
|
2393
2393
|
resource.pause();
|
|
2394
2394
|
},
|
|
2395
2395
|
play(loop) {
|
|
2396
|
-
|
|
2397
|
-
resource.loop = loop;
|
|
2398
|
-
} catch {
|
|
2399
|
-
}
|
|
2396
|
+
resource.loop = loop;
|
|
2400
2397
|
resource.play();
|
|
2401
2398
|
},
|
|
2402
2399
|
stop() {
|
|
@@ -2423,20 +2420,11 @@ var createAudio2 = (storageData) => {
|
|
|
2423
2420
|
if (type === "music" || type === "sound") {
|
|
2424
2421
|
for (const audio of Object.values(store[type])) {
|
|
2425
2422
|
if (!audio) continue;
|
|
2426
|
-
|
|
2427
|
-
audio.volume = volume;
|
|
2428
|
-
} catch {
|
|
2429
|
-
}
|
|
2423
|
+
audio.volume = volume;
|
|
2430
2424
|
}
|
|
2431
2425
|
}
|
|
2432
|
-
if (type === "voice") {
|
|
2433
|
-
|
|
2434
|
-
if (audio) {
|
|
2435
|
-
try {
|
|
2436
|
-
audio.volume = volume;
|
|
2437
|
-
} catch {
|
|
2438
|
-
}
|
|
2439
|
-
}
|
|
2426
|
+
if (type === "voice" && store.voice) {
|
|
2427
|
+
store.voice.volume = volume;
|
|
2440
2428
|
}
|
|
2441
2429
|
}
|
|
2442
2430
|
});
|
|
@@ -2457,8 +2445,8 @@ var createAudio2 = (storageData) => {
|
|
|
2457
2445
|
};
|
|
2458
2446
|
const clear = (keepAudio) => {
|
|
2459
2447
|
context.voiceStop();
|
|
2460
|
-
const musics = Object.entries(store.music).filter(([name]) =>
|
|
2461
|
-
const sounds = Object.entries(store.sound).filter(([name]) =>
|
|
2448
|
+
const musics = Object.entries(store.music).filter(([name]) => !keepAudio.music.has(name)).map(([_, a]) => a);
|
|
2449
|
+
const sounds = Object.entries(store.sound).filter(([name]) => !keepAudio.sounds.has(name)).map(([_, a]) => a);
|
|
2462
2450
|
for (const music of [...musics, ...sounds]) {
|
|
2463
2451
|
if (!music) continue;
|
|
2464
2452
|
music.stop();
|
|
@@ -2605,19 +2593,8 @@ var allEmpty = (target) => {
|
|
|
2605
2593
|
}
|
|
2606
2594
|
return true;
|
|
2607
2595
|
};
|
|
2608
|
-
var handleBackgroundAction = ($contextState, background
|
|
2609
|
-
|
|
2610
|
-
clear && clear();
|
|
2611
|
-
if (typeof background === "string") {
|
|
2612
|
-
$contextState.mutate((s) => s.background, (prev) => {
|
|
2613
|
-
return {
|
|
2614
|
-
...prev,
|
|
2615
|
-
background
|
|
2616
|
-
};
|
|
2617
|
-
});
|
|
2618
|
-
onChange?.(background);
|
|
2619
|
-
return;
|
|
2620
|
-
}
|
|
2596
|
+
var handleBackgroundAction = ($contextState, background) => {
|
|
2597
|
+
$contextState.get().background.clear?.();
|
|
2621
2598
|
const { dispose: dispose2 } = useBackground(background, (value) => {
|
|
2622
2599
|
$contextState.mutate((s) => s.background, (prev) => {
|
|
2623
2600
|
return {
|
|
@@ -2625,14 +2602,8 @@ var handleBackgroundAction = ($contextState, background, onChange) => {
|
|
|
2625
2602
|
background: value
|
|
2626
2603
|
};
|
|
2627
2604
|
});
|
|
2628
|
-
onChange?.(value);
|
|
2629
|
-
});
|
|
2630
|
-
$contextState.mutate((s) => s.background, (prev) => {
|
|
2631
|
-
return {
|
|
2632
|
-
...prev,
|
|
2633
|
-
clear: dispose2
|
|
2634
|
-
};
|
|
2635
2605
|
});
|
|
2606
|
+
$contextState.mutate((s) => s.background.clear, () => dispose2);
|
|
2636
2607
|
};
|
|
2637
2608
|
var handleDialogAction = ($contextState, content, name, character, emotion, resolve) => {
|
|
2638
2609
|
$contextState.mutate(
|
|
@@ -5082,10 +5053,7 @@ var createSolidRenderer = ({
|
|
|
5082
5053
|
id: name,
|
|
5083
5054
|
root: root(),
|
|
5084
5055
|
background(background) {
|
|
5085
|
-
handleBackgroundAction($contextState, background
|
|
5086
|
-
if (!isCSSImage(bg)) return;
|
|
5087
|
-
renderer.misc.preloadImage(bg);
|
|
5088
|
-
});
|
|
5056
|
+
handleBackgroundAction($contextState, background);
|
|
5089
5057
|
},
|
|
5090
5058
|
character(character) {
|
|
5091
5059
|
const chars = useShared(name).characters;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@novely/solid-renderer",
|
|
3
|
-
"version": "0.37.0
|
|
3
|
+
"version": "0.37.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"retrieved": "^0.1.0",
|
|
20
20
|
"solid-js": "1.8.19",
|
|
21
21
|
"solid-transition-group": "^0.2.3",
|
|
22
|
-
"@novely/core": "0.39.0
|
|
23
|
-
"@novely/renderer-toolkit": "0.
|
|
22
|
+
"@novely/core": "0.39.0",
|
|
23
|
+
"@novely/renderer-toolkit": "0.9.0",
|
|
24
24
|
"@novely/typewriter": "0.5.1"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|