@novely/core 0.45.0 → 0.45.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/index.d.ts +9 -3
- package/dist/index.global.js +10 -7
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +10 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -101,7 +101,7 @@ type Context = {
|
|
|
101
101
|
character: (character: string) => CharacterHandle;
|
|
102
102
|
background: (background: Record<string, string>) => void;
|
|
103
103
|
dialog: (content: string, name: string, character: string | undefined, emotion: string | undefined, resolve: () => void) => void;
|
|
104
|
-
choices: (question: string, choices: [name: string, active: Stored<boolean>, visible: Stored<boolean>, onselect:
|
|
104
|
+
choices: (question: string, choices: [name: string, active: Stored<boolean>, visible: Stored<boolean>, onselect: () => void, image: string][], resolve: (selected: number) => void) => void;
|
|
105
105
|
input: (question: string, onInput: (meta: ActionInputOnInputMeta<Lang, State>) => void, setup: ActionInputSetup, resolve: () => void) => void;
|
|
106
106
|
clear: (keep: Set<keyof DefaultActionProxy>, keepCharacters: Set<string>, keepAudio: {
|
|
107
107
|
music: Set<string>;
|
|
@@ -730,8 +730,14 @@ type ChoiceCheckFunctionProps<L extends Lang, S extends State> = {
|
|
|
730
730
|
*/
|
|
731
731
|
state: S;
|
|
732
732
|
};
|
|
733
|
+
type ChoiceOnSelectFunctionProps = {
|
|
734
|
+
/**
|
|
735
|
+
* Triggers `active` and `visible` properties computation
|
|
736
|
+
*/
|
|
737
|
+
recompute: () => void;
|
|
738
|
+
};
|
|
733
739
|
type ChoiceCheckFunction<L extends Lang, S extends State> = (props: ChoiceCheckFunctionProps<L, S>) => boolean;
|
|
734
|
-
type ChoiceOnSelectFunction = () =>
|
|
740
|
+
type ChoiceOnSelectFunction = (props: ChoiceOnSelectFunctionProps) => void;
|
|
735
741
|
type ConditionCheckFunction<S extends State, R extends string | true | false> = (state: S) => R;
|
|
736
742
|
type FunctionAction<L extends string, S extends State> = (props: FunctionActionProps<L, S>) => Thenable<void>;
|
|
737
743
|
type ActionInputSetupCleanup = () => void;
|
|
@@ -977,4 +983,4 @@ declare const extendAction: <Part0 extends Record<string, (...args: any[]) => Va
|
|
|
977
983
|
*/
|
|
978
984
|
declare const asset: (...variants: string[]) => NovelyAsset;
|
|
979
985
|
|
|
980
|
-
export { type ActionChoiceChoice, type ActionChoiceChoiceObject, type ActionInputOnInputMeta, type ActionInputSetup, type ActionInputSetupCleanup, type ActionProxy, type AllowedContent, type AudioHandle, type BackgroundImage, type BaseTranslationStrings, type Character, type CharacterAssetSizes, type CharacterHandle, type CharactersData, type ChoiceCheckFunction, type ChoiceCheckFunctionProps, type ChoiceOnSelectFunction, type ChoiceParams, type ConditionCheckFunction, type ConditionParams, type Context, type CoreData, type CustomActionHandle, type CustomHandler, type CustomHandlerFunction, type CustomHandlerFunctionGetFn, type CustomHandlerFunctionParameters, type CustomHandlerGetResult, type CustomHandlerGetResultDataFunction, type CustomHandlerInfo, type Data, type DeepPartial, type DefaultActionProxy, EN, type Emotions, type FunctionParams, type FunctionableValue, type GetActionParameters, type InputHandler, JP, KK, type Lang, type NovelyInit, type NovelyScreen, type NovelyStorage, type Path, type PluralType, type Pluralization, RU, type Renderer, type RendererInit, type RendererInitPreviewReturn, type Save, type Stack, type StackHolder, type State, type StateFunction, type StorageData, type StorageMeta, type Stored, type Story, type TextContent, type Thenable, type TranslationActions, type TypeEssentials, type TypewriterSpeed, type ValidAction, asset, extendAction, localStorageStorage, novely };
|
|
986
|
+
export { type ActionChoiceChoice, type ActionChoiceChoiceObject, type ActionInputOnInputMeta, type ActionInputSetup, type ActionInputSetupCleanup, type ActionProxy, type AllowedContent, type AudioHandle, type BackgroundImage, type BaseTranslationStrings, type Character, type CharacterAssetSizes, type CharacterHandle, type CharactersData, type ChoiceCheckFunction, type ChoiceCheckFunctionProps, type ChoiceOnSelectFunction, type ChoiceOnSelectFunctionProps, type ChoiceParams, type ConditionCheckFunction, type ConditionParams, type Context, type CoreData, type CustomActionHandle, type CustomHandler, type CustomHandlerFunction, type CustomHandlerFunctionGetFn, type CustomHandlerFunctionParameters, type CustomHandlerGetResult, type CustomHandlerGetResultDataFunction, type CustomHandlerInfo, type Data, type DeepPartial, type DefaultActionProxy, EN, type Emotions, type FunctionParams, type FunctionableValue, type GetActionParameters, type InputHandler, JP, KK, type Lang, type NovelyInit, type NovelyScreen, type NovelyStorage, type Path, type PluralType, type Pluralization, RU, type Renderer, type RendererInit, type RendererInitPreviewReturn, type Save, type Stack, type StackHolder, type State, type StateFunction, type StorageData, type StorageMeta, type Stored, type Story, type TextContent, type Thenable, type TranslationActions, type TypeEssentials, type TypewriterSpeed, type ValidAction, asset, extendAction, localStorageStorage, novely };
|
package/dist/index.global.js
CHANGED
|
@@ -1983,22 +1983,25 @@ var Novely = (() => {
|
|
|
1983
1983
|
const active$ = store(false);
|
|
1984
1984
|
const visible$ = store(false);
|
|
1985
1985
|
const update = () => {
|
|
1986
|
+
const lang = getLanguageFromStore(storageData);
|
|
1987
|
+
const state = getStateAtCtx(ctx);
|
|
1986
1988
|
const activeValue = !active || active({
|
|
1987
|
-
lang
|
|
1988
|
-
state
|
|
1989
|
+
lang,
|
|
1990
|
+
state
|
|
1989
1991
|
});
|
|
1990
1992
|
const visibleValue = !visible || visible({
|
|
1991
|
-
lang
|
|
1992
|
-
state
|
|
1993
|
+
lang,
|
|
1994
|
+
state
|
|
1993
1995
|
});
|
|
1994
1996
|
active$.set(activeValue);
|
|
1995
1997
|
visible$.set(visibleValue);
|
|
1996
1998
|
};
|
|
1997
1999
|
update();
|
|
1998
2000
|
const onSelectGuarded = onSelect || noop;
|
|
1999
|
-
const onSelectWrapped =
|
|
2000
|
-
|
|
2001
|
-
|
|
2001
|
+
const onSelectWrapped = () => {
|
|
2002
|
+
onSelectGuarded({
|
|
2003
|
+
recompute: update
|
|
2004
|
+
});
|
|
2002
2005
|
};
|
|
2003
2006
|
const imageValue = image ? handleImageAsset(image) : "";
|
|
2004
2007
|
return [templateReplace(content, data2), active$, visible$, onSelectWrapped, imageValue];
|