@novely/solid-renderer 0.42.0 → 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/components/Select copy.d.ts +14 -0
- package/dist/components/ShadowRoot.d.ts +3 -0
- package/dist/custom-actions/mood.d.ts +2 -2
- package/dist/custom-actions/show-arbitrary-character.d.ts +10 -0
- package/dist/custom-actions.d.ts +24 -0
- package/dist/index.jsx +7 -13
- package/dist/renderer.d.ts +1 -1
- package/dist/types.d.ts +8 -2
- package/package.json +2 -2
- package/dist/icons/index.d.ts +0 -14
- package/dist/icons.d.ts +0 -0
|
@@ -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 };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { FlowComponent, JSX } from 'solid-js';
|
|
2
|
+
type NativeSelectProps = Omit<JSX.SelectHTMLAttributes<HTMLSelectElement>, 'class' | 'id'>;
|
|
3
|
+
type SelectProps = NativeSelectProps & {
|
|
4
|
+
/**
|
|
5
|
+
* Icon HTML string
|
|
6
|
+
*/
|
|
7
|
+
icon: string;
|
|
8
|
+
/**
|
|
9
|
+
* Label
|
|
10
|
+
*/
|
|
11
|
+
label: string;
|
|
12
|
+
};
|
|
13
|
+
declare const Select: FlowComponent<SelectProps>;
|
|
14
|
+
export { Select };
|
|
@@ -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 };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Character, CharactersData, Lang, ValidAction } from "@novely/core";
|
|
2
|
+
type ShowArbitraryCharacterParams<$Characters extends CharactersData<Record<string, Character<Lang>>>, $Character extends keyof $Characters> = {
|
|
3
|
+
id: $Character & string;
|
|
4
|
+
emotion: $Characters[$Character]['emotions'][number] & string;
|
|
5
|
+
extendWith: () => string | string[];
|
|
6
|
+
classes?: string;
|
|
7
|
+
style?: string;
|
|
8
|
+
};
|
|
9
|
+
declare const createShowArbitraryCharacterAction: <$Characters extends CharactersData<Record<string, Character>>>() => <$Character extends keyof $Characters>(params: ShowArbitraryCharacterParams<$Characters, $Character>) => ValidAction;
|
|
10
|
+
export { createShowArbitraryCharacterAction };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Character, Lang, ValidAction } from "@novely/core";
|
|
2
|
+
type ShowArbitraryCharacterParams<$Characters extends Record<string, Character<Lang>>, $Character extends keyof $Characters> = {
|
|
3
|
+
id: $Character & string;
|
|
4
|
+
emotion: keyof $Characters[$Character]['emotions'] & string;
|
|
5
|
+
extendWith: () => string | string[];
|
|
6
|
+
classes?: string;
|
|
7
|
+
style?: string;
|
|
8
|
+
};
|
|
9
|
+
declare const createShowArbitraryCharacterAction: <$Characters extends Record<string, Character>>(_: $Characters) => <$Character extends keyof $Characters>(params: ShowArbitraryCharacterParams<$Characters, $Character>) => ValidAction;
|
|
10
|
+
type ShowImageParams = {
|
|
11
|
+
z?: number;
|
|
12
|
+
in?: string;
|
|
13
|
+
class?: string;
|
|
14
|
+
style?: string;
|
|
15
|
+
position?: string;
|
|
16
|
+
await?: boolean;
|
|
17
|
+
};
|
|
18
|
+
declare const showImage: (source: string, params?: ShowImageParams) => ValidAction;
|
|
19
|
+
type HideImageParams = {
|
|
20
|
+
out?: string;
|
|
21
|
+
await?: boolean;
|
|
22
|
+
};
|
|
23
|
+
declare const hideImage: (source: string, params?: HideImageParams) => ValidAction;
|
|
24
|
+
export { createShowArbitraryCharacterAction, showImage, hideImage };
|
package/dist/index.jsx
CHANGED
|
@@ -3070,9 +3070,7 @@ var clickOutside = (node, handler) => {
|
|
|
3070
3070
|
|
|
3071
3071
|
// src/components/Character.tsx
|
|
3072
3072
|
var Character = (props) => {
|
|
3073
|
-
|
|
3074
|
-
createRenderEffect(() => setAttribute(canvas(), "style", props.data.style || ""));
|
|
3075
|
-
return createMemo(canvas);
|
|
3073
|
+
return props.characters[props.character].canvas;
|
|
3076
3074
|
};
|
|
3077
3075
|
|
|
3078
3076
|
// src/components/Icon.tsx
|
|
@@ -4245,7 +4243,6 @@ var Game = (props) => {
|
|
|
4245
4243
|
get children() {
|
|
4246
4244
|
return createComponent(Character, {
|
|
4247
4245
|
character,
|
|
4248
|
-
data: data2,
|
|
4249
4246
|
get characters() {
|
|
4250
4247
|
return store.characters;
|
|
4251
4248
|
}
|
|
@@ -5145,10 +5142,10 @@ var hideImage = (source, params = {}) => {
|
|
|
5145
5142
|
// src/custom-actions/mood.ts
|
|
5146
5143
|
var SET_MOOD = Symbol();
|
|
5147
5144
|
var setMood = (mood) => {
|
|
5148
|
-
const handler = ({ contextKey, clear }) => {
|
|
5145
|
+
const handler = ({ contextKey, lang, clear }) => {
|
|
5149
5146
|
const ctx = useContextState(contextKey);
|
|
5150
5147
|
if (mood === "''" || mood === '""') ctx.setKey("mood", "");
|
|
5151
|
-
else ctx.setKey("mood", mood);
|
|
5148
|
+
else ctx.setKey("mood", typeof mood === "object" ? mood[lang] : mood);
|
|
5152
5149
|
clear(() => {
|
|
5153
5150
|
ctx.setKey("mood", "");
|
|
5154
5151
|
});
|
|
@@ -5260,7 +5257,6 @@ var createSolidRenderer = ({
|
|
|
5260
5257
|
const canvasContext = canvas.getContext("2d");
|
|
5261
5258
|
const characterHandle = {
|
|
5262
5259
|
canvas,
|
|
5263
|
-
ctx: canvasContext,
|
|
5264
5260
|
emotions: {},
|
|
5265
5261
|
emotion(emotion, shouldRender) {
|
|
5266
5262
|
let stored = this.emotions[emotion];
|
|
@@ -5343,14 +5339,12 @@ var createSolidRenderer = ({
|
|
|
5343
5339
|
});
|
|
5344
5340
|
},
|
|
5345
5341
|
animate(classes) {
|
|
5346
|
-
const
|
|
5347
|
-
|
|
5348
|
-
const classNames = classes.filter((className2) => !target2.classList.contains(className2));
|
|
5349
|
-
target2.classList.add(...classNames);
|
|
5342
|
+
const classNames = classes.filter((className2) => !canvas.classList.contains(className2));
|
|
5343
|
+
canvas.classList.add(...classNames);
|
|
5350
5344
|
const onAnimationEnd = () => {
|
|
5351
|
-
|
|
5345
|
+
canvas.classList.remove(...classNames);
|
|
5352
5346
|
};
|
|
5353
|
-
|
|
5347
|
+
canvas.addEventListener("animationend", onAnimationEnd, {
|
|
5354
5348
|
once: true
|
|
5355
5349
|
});
|
|
5356
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,7 +20,7 @@
|
|
|
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
|
},
|
package/dist/icons/index.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
declare const iconStore: {
|
|
2
|
-
SkipBack: import("solid-js").JSX.Element;
|
|
3
|
-
BookOpen: import("solid-js").JSX.Element;
|
|
4
|
-
FloppyDisk: import("solid-js").JSX.Element;
|
|
5
|
-
GearSix: import("solid-js").JSX.Element;
|
|
6
|
-
SignOut: import("solid-js").JSX.Element;
|
|
7
|
-
List: import("solid-js").JSX.Element;
|
|
8
|
-
X: import("solid-js").JSX.Element;
|
|
9
|
-
Play: import("solid-js").JSX.Element;
|
|
10
|
-
Stop: import("solid-js").JSX.Element;
|
|
11
|
-
ArrowSquareRight: import("solid-js").JSX.Element;
|
|
12
|
-
FilePlus: import("solid-js").JSX.Element;
|
|
13
|
-
Files: import("solid-js").JSX.Element;
|
|
14
|
-
};
|
package/dist/icons.d.ts
DELETED
|
File without changes
|