@novely/solid-renderer 0.42.0-next.5 → 0.42.1
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/components/Character.d.ts +4 -6
- package/dist/custom-actions/mood.d.ts +2 -2
- package/dist/index.jsx +17 -16
- package/dist/renderer.d.ts +1 -1
- package/dist/types.d.ts +8 -2
- package/package.json +4 -4
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import type { CharacterHandle } from '@novely/core';
|
|
2
|
-
import type { ContextStateCharacter } from '@novely/renderer-toolkit';
|
|
3
1
|
import type { VoidComponent } from 'solid-js';
|
|
4
|
-
|
|
2
|
+
import type { CustomCharacterHandle } from '../types';
|
|
3
|
+
type CharacterProps = {
|
|
5
4
|
character: string;
|
|
6
|
-
characters: Record<string,
|
|
7
|
-
|
|
8
|
-
}
|
|
5
|
+
characters: Record<string, CustomCharacterHandle>;
|
|
6
|
+
};
|
|
9
7
|
declare const Character: VoidComponent<CharacterProps>;
|
|
10
8
|
export { Character };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { ValidAction } from '@novely/core';
|
|
2
|
-
declare const setMood: (mood: string) => ValidAction;
|
|
1
|
+
import type { Lang, ValidAction } from '@novely/core';
|
|
2
|
+
declare const setMood: (mood: string | Record<Lang, string>) => ValidAction;
|
|
3
3
|
export { setMood };
|
package/dist/index.jsx
CHANGED
|
@@ -2420,6 +2420,7 @@ var createAudio2 = (storageData) => {
|
|
|
2420
2420
|
resource.pause();
|
|
2421
2421
|
},
|
|
2422
2422
|
play(loop) {
|
|
2423
|
+
resource.volume = getVolume(method);
|
|
2423
2424
|
resource.loop = loop;
|
|
2424
2425
|
resource.play();
|
|
2425
2426
|
},
|
|
@@ -2432,6 +2433,7 @@ var createAudio2 = (storageData) => {
|
|
|
2432
2433
|
this.start();
|
|
2433
2434
|
this.voiceStop();
|
|
2434
2435
|
const resource = store.voice = getAudio("voice", source);
|
|
2436
|
+
resource.volume = getVolume("voice");
|
|
2435
2437
|
resource.play();
|
|
2436
2438
|
},
|
|
2437
2439
|
voiceStop() {
|
|
@@ -2472,9 +2474,14 @@ var createAudio2 = (storageData) => {
|
|
|
2472
2474
|
};
|
|
2473
2475
|
const clear = (keepAudio) => {
|
|
2474
2476
|
context.voiceStop();
|
|
2475
|
-
const
|
|
2476
|
-
|
|
2477
|
-
|
|
2477
|
+
const entries2 = [
|
|
2478
|
+
[store.music, keepAudio.music],
|
|
2479
|
+
[store.sound, keepAudio.sounds]
|
|
2480
|
+
];
|
|
2481
|
+
const clearEntries = entries2.flatMap(([incoming, keep]) => {
|
|
2482
|
+
return Object.entries(incoming).filter(([name]) => !keep.has(name)).map(([_, a]) => a);
|
|
2483
|
+
});
|
|
2484
|
+
for (const music of clearEntries) {
|
|
2478
2485
|
if (!music) continue;
|
|
2479
2486
|
music.stop();
|
|
2480
2487
|
}
|
|
@@ -3063,9 +3070,7 @@ var clickOutside = (node, handler) => {
|
|
|
3063
3070
|
|
|
3064
3071
|
// src/components/Character.tsx
|
|
3065
3072
|
var Character = (props) => {
|
|
3066
|
-
|
|
3067
|
-
createRenderEffect(() => setAttribute(canvas(), "style", props.data.style || ""));
|
|
3068
|
-
return createMemo(canvas);
|
|
3073
|
+
return props.characters[props.character].canvas;
|
|
3069
3074
|
};
|
|
3070
3075
|
|
|
3071
3076
|
// src/components/Icon.tsx
|
|
@@ -4238,7 +4243,6 @@ var Game = (props) => {
|
|
|
4238
4243
|
get children() {
|
|
4239
4244
|
return createComponent(Character, {
|
|
4240
4245
|
character,
|
|
4241
|
-
data: data2,
|
|
4242
4246
|
get characters() {
|
|
4243
4247
|
return store.characters;
|
|
4244
4248
|
}
|
|
@@ -5138,10 +5142,10 @@ var hideImage = (source, params = {}) => {
|
|
|
5138
5142
|
// src/custom-actions/mood.ts
|
|
5139
5143
|
var SET_MOOD = Symbol();
|
|
5140
5144
|
var setMood = (mood) => {
|
|
5141
|
-
const handler = ({ contextKey, clear }) => {
|
|
5145
|
+
const handler = ({ contextKey, lang, clear }) => {
|
|
5142
5146
|
const ctx = useContextState(contextKey);
|
|
5143
5147
|
if (mood === "''" || mood === '""') ctx.setKey("mood", "");
|
|
5144
|
-
else ctx.setKey("mood", mood);
|
|
5148
|
+
else ctx.setKey("mood", typeof mood === "object" ? mood[lang] : mood);
|
|
5145
5149
|
clear(() => {
|
|
5146
5150
|
ctx.setKey("mood", "");
|
|
5147
5151
|
});
|
|
@@ -5253,7 +5257,6 @@ var createSolidRenderer = ({
|
|
|
5253
5257
|
const canvasContext = canvas.getContext("2d");
|
|
5254
5258
|
const characterHandle = {
|
|
5255
5259
|
canvas,
|
|
5256
|
-
ctx: canvasContext,
|
|
5257
5260
|
emotions: {},
|
|
5258
5261
|
emotion(emotion, shouldRender) {
|
|
5259
5262
|
let stored = this.emotions[emotion];
|
|
@@ -5336,14 +5339,12 @@ var createSolidRenderer = ({
|
|
|
5336
5339
|
});
|
|
5337
5340
|
},
|
|
5338
5341
|
animate(classes) {
|
|
5339
|
-
const
|
|
5340
|
-
|
|
5341
|
-
const classNames = classes.filter((className2) => !target2.classList.contains(className2));
|
|
5342
|
-
target2.classList.add(...classNames);
|
|
5342
|
+
const classNames = classes.filter((className2) => !canvas.classList.contains(className2));
|
|
5343
|
+
canvas.classList.add(...classNames);
|
|
5343
5344
|
const onAnimationEnd = () => {
|
|
5344
|
-
|
|
5345
|
+
canvas.classList.remove(...classNames);
|
|
5345
5346
|
};
|
|
5346
|
-
|
|
5347
|
+
canvas.addEventListener("animationend", onAnimationEnd, {
|
|
5347
5348
|
once: true
|
|
5348
5349
|
});
|
|
5349
5350
|
}
|
package/dist/renderer.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ declare const createSolidRenderer: ({ fullscreen, controls, skipTypewriterWhenGo
|
|
|
32
32
|
out?: string;
|
|
33
33
|
await?: boolean;
|
|
34
34
|
}) => import("@novely/core").ValidAction;
|
|
35
|
-
setMood: (mood: string) => import("@novely/core").ValidAction;
|
|
35
|
+
setMood: (mood: string | Record<Lang, string>) => import("@novely/core").ValidAction;
|
|
36
36
|
};
|
|
37
37
|
};
|
|
38
38
|
registerScreen(name: string, screen: StateScreen): void;
|
package/dist/types.d.ts
CHANGED
|
@@ -9,8 +9,14 @@ type StateScreens = Record<string, StateScreen>;
|
|
|
9
9
|
type PossibleScreen = NovelyScreen | (string & Record<never, never>);
|
|
10
10
|
type StateMainmenuItem = (goto: (name: PossibleScreen) => void) => JSX.ButtonHTMLAttributes<HTMLButtonElement>;
|
|
11
11
|
type StateMainmenuItems = StateMainmenuItem[];
|
|
12
|
+
type CustomCharacterHandle = CharacterHandle & {
|
|
13
|
+
/**
|
|
14
|
+
* Node in which character is rendered
|
|
15
|
+
*/
|
|
16
|
+
canvas: HTMLCanvasElement;
|
|
17
|
+
};
|
|
12
18
|
type SolidRendererStore = {
|
|
13
|
-
characters: Record<string,
|
|
19
|
+
characters: Record<string, CustomCharacterHandle>;
|
|
14
20
|
};
|
|
15
21
|
type CreateSolidRendererOptions = {
|
|
16
22
|
/**
|
|
@@ -46,4 +52,4 @@ type RendererStoreExtension = {
|
|
|
46
52
|
screens: Record<string, StateScreen>;
|
|
47
53
|
mainmenu: StateMainmenuItems;
|
|
48
54
|
};
|
|
49
|
-
export type { EmitterEventsMap, StateScreen, StateScreens, PossibleScreen, StateMainmenuItem, StateMainmenuItems, SolidRendererStore, CreateSolidRendererOptions, RendererStoreExtension, };
|
|
55
|
+
export type { EmitterEventsMap, StateScreen, StateScreens, PossibleScreen, StateMainmenuItem, StateMainmenuItems, SolidRendererStore, CreateSolidRendererOptions, RendererStoreExtension, CustomCharacterHandle, };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@novely/solid-renderer",
|
|
3
|
-
"version": "0.42.
|
|
3
|
+
"version": "0.42.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -20,13 +20,13 @@
|
|
|
20
20
|
"es-toolkit": "^1.23.0",
|
|
21
21
|
"solid-js": "~1.9.3",
|
|
22
22
|
"solid-transition-group": "^0.2.3",
|
|
23
|
-
"@novely/core": "0.46.
|
|
23
|
+
"@novely/core": "0.46.2",
|
|
24
24
|
"@novely/renderer-toolkit": "0.12.0",
|
|
25
25
|
"@novely/typewriter": "0.5.1"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"
|
|
29
|
-
"
|
|
28
|
+
"@novely/core": "*",
|
|
29
|
+
"solid-js": "*"
|
|
30
30
|
},
|
|
31
31
|
"license": "ISC",
|
|
32
32
|
"bugs": {
|