@novely/core 0.0.0-beta.2 → 0.0.0-beta.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/index.d.ts CHANGED
@@ -14,7 +14,7 @@ type Character<LanguageKeys extends string = string> = {
14
14
  };
15
15
 
16
16
  type Thenable<T> = T | Promise<T>;
17
- type PathItem = [null, number | string] | ['choice' & Record<never, never>, number] | ['condition' & Record<never, never>, string];
17
+ type PathItem = [null, number | string] | ['choice' & Record<never, never>, number] | ['condition' & Record<never, never>, string] | ['exit' & Record<never, never>];
18
18
  type Path = PathItem[];
19
19
  type State = Record<string, any>;
20
20
  type SaveDate = number;
@@ -80,9 +80,13 @@ type CustomHandler = CustomHandlerFunction & {
80
80
  skipClearOnGoingBack?: boolean;
81
81
  };
82
82
  type ActionProxyProvider<Characters extends Record<string, Character>> = {
83
- choice: (...choices: ([ChoiceContent, ValidAction[]] | [ChoiceContent, ValidAction[], () => boolean])[]) => ValidAction;
83
+ choice: {
84
+ (...choices: ([ChoiceContent, ValidAction[]] | [ChoiceContent, ValidAction[], () => boolean])[]): ValidAction;
85
+ (question: string, ...choices: ([ChoiceContent, ValidAction[]] | [ChoiceContent, ValidAction[], () => boolean])[]): ValidAction;
86
+ };
84
87
  clear: () => ValidAction;
85
88
  condition: <T extends string>(condition: () => T, variants: Record<T, ValidAction[]>) => ValidAction;
89
+ exit: () => ValidAction;
86
90
  dialog: {
87
91
  <C extends keyof Characters>(person: C, content: DialogContent, emotion?: keyof Characters[C]['emotions']): ValidAction;
88
92
  (person: undefined, content: DialogContent, emotion?: undefined): ValidAction;
@@ -146,8 +150,8 @@ interface RendererStore {
146
150
  type Renderer = {
147
151
  character: (character: string) => CharacterHandle;
148
152
  background: (background: string) => void;
149
- dialog: (content: string, character?: string, emotion?: string) => (resolve: () => void) => void;
150
- choices: (choices: ([string, ValidAction[]] | [string, ValidAction[], () => boolean])[]) => (resolve: (selected: number) => void) => void;
153
+ dialog: (content: string, name: string, character?: string, emotion?: string) => (resolve: () => void) => void;
154
+ choices: (question: string, choices: ([string, ValidAction[]] | [string, ValidAction[], () => boolean])[]) => (resolve: (selected: number) => void) => void;
151
155
  input: (question: string, onInput: Parameters<DefaultActionProxyProvider['input']>[1], setup?: Parameters<DefaultActionProxyProvider['input']>[2]) => (resolve: () => void) => void;
152
156
  music: (source: string, method: keyof RendererStore['audio']) => AudioHandle;
153
157
  clear: (goingBack: boolean) => (resolve: () => void) => void;