narrat 2.0.7 → 2.0.9
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/README.md +90 -23
- package/dist/app.vue.d.ts +0 -10
- package/dist/audio.7z +0 -0
- package/dist/data/example.rpy +8 -1
- package/dist/lib.css +1 -1
- package/dist/narrat.es.js +255 -226
- package/dist/narrat.es.js.map +1 -1
- package/dist/narrat.umd.js +84 -84
- package/dist/narrat.umd.js.map +1 -1
- package/dist/stores/main-store.d.ts +41 -34
- package/dist/stores/vm-store.d.ts +45 -38
- package/dist/types/parser.d.ts +1 -0
- package/dist/vm/commands/command-plugin.d.ts +14 -1
- package/package.json +1 -1
|
@@ -103,8 +103,8 @@ export declare const useMain: import("pinia").StoreDefinition<"main", MainState,
|
|
|
103
103
|
reset(): void;
|
|
104
104
|
}>;
|
|
105
105
|
vm: import("pinia").Store<"vm", import("./vm-store").VMState, {
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
currentFrame(state: {
|
|
107
|
+
commandsWaitingForPlayerAnswer: {
|
|
108
108
|
args: (import("../types/parser").Parser.Primitive | {
|
|
109
109
|
code: string;
|
|
110
110
|
command: {
|
|
@@ -118,13 +118,14 @@ export declare const useMain: import("pinia").StoreDefinition<"main", MainState,
|
|
|
118
118
|
line: number;
|
|
119
119
|
})[];
|
|
120
120
|
commandType: string;
|
|
121
|
-
options:
|
|
121
|
+
options: any;
|
|
122
122
|
code: string;
|
|
123
|
-
staticOptions:
|
|
123
|
+
staticOptions: any;
|
|
124
124
|
operator: string;
|
|
125
125
|
line: number;
|
|
126
126
|
fileName: string;
|
|
127
|
-
|
|
127
|
+
finishCommand?: ((res: any) => void) | undefined;
|
|
128
|
+
}[];
|
|
128
129
|
stack: {
|
|
129
130
|
currentIndex: number;
|
|
130
131
|
branchData: {
|
|
@@ -155,36 +156,37 @@ export declare const useMain: import("pinia").StoreDefinition<"main", MainState,
|
|
|
155
156
|
currentScope: {
|
|
156
157
|
[key: string]: any;
|
|
157
158
|
};
|
|
158
|
-
} & import("pinia").PiniaCustomStateProperties<import("./vm-store").VMState>):
|
|
159
|
-
currentIndex: number;
|
|
160
|
-
branchData: {
|
|
161
|
-
branch: {
|
|
162
|
-
code: string;
|
|
163
|
-
command: {
|
|
164
|
-
commandType: string;
|
|
165
|
-
operator: string;
|
|
166
|
-
args: (import("../types/parser").Parser.Primitive | any)[];
|
|
167
|
-
options: import("../types/parser").Parser.DefaultArg;
|
|
168
|
-
staticOptions: {};
|
|
169
|
-
};
|
|
170
|
-
fileName: string;
|
|
171
|
-
line: number;
|
|
172
|
-
}[];
|
|
173
|
-
args?: string[] | undefined;
|
|
174
|
-
};
|
|
175
|
-
label: string;
|
|
176
|
-
scope: {
|
|
177
|
-
[key: string]: any;
|
|
178
|
-
};
|
|
179
|
-
onComplete?: ((result: any) => void) | undefined;
|
|
180
|
-
returnValue: any;
|
|
181
|
-
};
|
|
159
|
+
} & import("pinia").PiniaCustomStateProperties<import("./vm-store").VMState>): import("./vm-store").MachineFrame | undefined;
|
|
182
160
|
currentLine(): import("../types/parser").Parser.ParsedExpression<import("../types/parser").Parser.DefaultArg, {}> | undefined;
|
|
161
|
+
commandWaitingForAnswer(): import("../types/parser").Parser.Command<any, any> | undefined;
|
|
183
162
|
}, {
|
|
184
163
|
generateSaveData(): import("./vm-store").VMSave;
|
|
185
164
|
loadSaveData(data: import("./vm-store").VMSave): void;
|
|
186
165
|
resetScope(): void;
|
|
187
166
|
setReturnValue(value: any): void;
|
|
167
|
+
waitForPlayerAnswer(cmd: import("../types/parser").Parser.Command<any, any>): void;
|
|
168
|
+
popAnswerQueue(): {
|
|
169
|
+
args: (import("../types/parser").Parser.Primitive | {
|
|
170
|
+
code: string;
|
|
171
|
+
command: {
|
|
172
|
+
commandType: string;
|
|
173
|
+
operator: string;
|
|
174
|
+
args: (import("../types/parser").Parser.Primitive | any)[];
|
|
175
|
+
options: import("../types/parser").Parser.DefaultArg;
|
|
176
|
+
staticOptions: {};
|
|
177
|
+
};
|
|
178
|
+
fileName: string;
|
|
179
|
+
line: number;
|
|
180
|
+
})[];
|
|
181
|
+
commandType: string;
|
|
182
|
+
options: any;
|
|
183
|
+
code: string;
|
|
184
|
+
staticOptions: any;
|
|
185
|
+
operator: string;
|
|
186
|
+
line: number;
|
|
187
|
+
fileName: string;
|
|
188
|
+
finishCommand?: ((res: any) => void) | undefined;
|
|
189
|
+
} | undefined;
|
|
188
190
|
removeFromScope(vars: string[]): void;
|
|
189
191
|
addScopedVariable(key: string, value: any): void;
|
|
190
192
|
extendScope(scope: {
|
|
@@ -197,16 +199,21 @@ export declare const useMain: import("pinia").StoreDefinition<"main", MainState,
|
|
|
197
199
|
setScript(script: import("../types/parser").Parser.ParsedScript): void;
|
|
198
200
|
overrideData(data: import("./vm-store").DataState): void;
|
|
199
201
|
setStack(stack: import("./vm-store").SetStackOptions): void;
|
|
200
|
-
stackOptionsToStack(stack: import("./vm-store").SetStackOptions): import("./vm-store").
|
|
202
|
+
stackOptionsToStack(stack: import("./vm-store").SetStackOptions): import("./vm-store").MachineFrame;
|
|
201
203
|
setData(path: string, value: any): void;
|
|
202
204
|
addInstruction(path: string, value: any): void;
|
|
203
|
-
|
|
205
|
+
addFrame(newStackOptions: import("./vm-store").AddFrameOptions): void;
|
|
206
|
+
addAndRunFrame(newStackOptions: import("./vm-store").AddFrameOptions): Promise<void>;
|
|
207
|
+
runFrame(): Promise<void>;
|
|
208
|
+
runGame(): Promise<void>;
|
|
209
|
+
nextLineOnly(): Promise<boolean>;
|
|
204
210
|
nextLine(): Promise<any>;
|
|
205
|
-
|
|
206
|
-
|
|
211
|
+
previousFrame(): Promise<any>;
|
|
212
|
+
reachedEndOfScript(): void;
|
|
213
|
+
runLineOnly(): Promise<void>;
|
|
207
214
|
runLine(): Promise<void>;
|
|
208
215
|
runLabelFunction(label: string, ...args: any[]): Promise<unknown>;
|
|
209
|
-
|
|
216
|
+
runCustomFrame(stack: import("./vm-store").AddFrameOptions): void;
|
|
210
217
|
runLabel(label: string, ...args: any[]): void;
|
|
211
218
|
}>;
|
|
212
219
|
hud: import("pinia").Store<"hud", import("./hud-stats-store").HudState, {}, {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Parser } from '../types/parser';
|
|
2
|
-
export declare type
|
|
2
|
+
export declare type AddFrameOptions = Omit<SetStackOptions, 'label'> & {
|
|
3
3
|
label?: string;
|
|
4
4
|
};
|
|
5
|
-
export interface
|
|
5
|
+
export interface MachineFrame {
|
|
6
6
|
currentIndex: number;
|
|
7
7
|
branchData: Parser.ParsedLabel;
|
|
8
8
|
label: string;
|
|
@@ -26,8 +26,8 @@ export interface DataState {
|
|
|
26
26
|
[key: string]: any;
|
|
27
27
|
}
|
|
28
28
|
export interface VMState {
|
|
29
|
-
|
|
30
|
-
stack:
|
|
29
|
+
commandsWaitingForPlayerAnswer: Parser.Command<any, any>[];
|
|
30
|
+
stack: MachineFrame[];
|
|
31
31
|
script: Parser.ParsedScript;
|
|
32
32
|
data: DataState;
|
|
33
33
|
lastLabel: string;
|
|
@@ -40,8 +40,8 @@ export interface VMSave {
|
|
|
40
40
|
data: DataState;
|
|
41
41
|
}
|
|
42
42
|
export declare const useVM: import("pinia").StoreDefinition<"vm", VMState, {
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
currentFrame(state: {
|
|
44
|
+
commandsWaitingForPlayerAnswer: {
|
|
45
45
|
args: (Parser.Primitive | {
|
|
46
46
|
code: string;
|
|
47
47
|
command: {
|
|
@@ -55,13 +55,14 @@ export declare const useVM: import("pinia").StoreDefinition<"vm", VMState, {
|
|
|
55
55
|
line: number;
|
|
56
56
|
})[];
|
|
57
57
|
commandType: string;
|
|
58
|
-
options:
|
|
58
|
+
options: any;
|
|
59
59
|
code: string;
|
|
60
|
-
staticOptions:
|
|
60
|
+
staticOptions: any;
|
|
61
61
|
operator: string;
|
|
62
62
|
line: number;
|
|
63
63
|
fileName: string;
|
|
64
|
-
|
|
64
|
+
finishCommand?: ((res: any) => void) | undefined;
|
|
65
|
+
}[];
|
|
65
66
|
stack: {
|
|
66
67
|
currentIndex: number;
|
|
67
68
|
branchData: {
|
|
@@ -92,36 +93,37 @@ export declare const useVM: import("pinia").StoreDefinition<"vm", VMState, {
|
|
|
92
93
|
currentScope: {
|
|
93
94
|
[key: string]: any;
|
|
94
95
|
};
|
|
95
|
-
} & import("pinia").PiniaCustomStateProperties<VMState>):
|
|
96
|
-
currentIndex: number;
|
|
97
|
-
branchData: {
|
|
98
|
-
branch: {
|
|
99
|
-
code: string;
|
|
100
|
-
command: {
|
|
101
|
-
commandType: string;
|
|
102
|
-
operator: string;
|
|
103
|
-
args: (Parser.Primitive | any)[];
|
|
104
|
-
options: Parser.DefaultArg;
|
|
105
|
-
staticOptions: {};
|
|
106
|
-
};
|
|
107
|
-
fileName: string;
|
|
108
|
-
line: number;
|
|
109
|
-
}[];
|
|
110
|
-
args?: string[] | undefined;
|
|
111
|
-
};
|
|
112
|
-
label: string;
|
|
113
|
-
scope: {
|
|
114
|
-
[key: string]: any;
|
|
115
|
-
};
|
|
116
|
-
onComplete?: ((result: any) => void) | undefined;
|
|
117
|
-
returnValue: any;
|
|
118
|
-
};
|
|
96
|
+
} & import("pinia").PiniaCustomStateProperties<VMState>): MachineFrame | undefined;
|
|
119
97
|
currentLine(): Parser.ParsedExpression<Parser.DefaultArg, {}> | undefined;
|
|
98
|
+
commandWaitingForAnswer(): Parser.Command<any, any> | undefined;
|
|
120
99
|
}, {
|
|
121
100
|
generateSaveData(): VMSave;
|
|
122
101
|
loadSaveData(data: VMSave): void;
|
|
123
102
|
resetScope(): void;
|
|
124
103
|
setReturnValue(value: any): void;
|
|
104
|
+
waitForPlayerAnswer(cmd: Parser.Command<any, any>): void;
|
|
105
|
+
popAnswerQueue(): {
|
|
106
|
+
args: (Parser.Primitive | {
|
|
107
|
+
code: string;
|
|
108
|
+
command: {
|
|
109
|
+
commandType: string;
|
|
110
|
+
operator: string;
|
|
111
|
+
args: (Parser.Primitive | any)[];
|
|
112
|
+
options: Parser.DefaultArg;
|
|
113
|
+
staticOptions: {};
|
|
114
|
+
};
|
|
115
|
+
fileName: string;
|
|
116
|
+
line: number;
|
|
117
|
+
})[];
|
|
118
|
+
commandType: string;
|
|
119
|
+
options: any;
|
|
120
|
+
code: string;
|
|
121
|
+
staticOptions: any;
|
|
122
|
+
operator: string;
|
|
123
|
+
line: number;
|
|
124
|
+
fileName: string;
|
|
125
|
+
finishCommand?: ((res: any) => void) | undefined;
|
|
126
|
+
} | undefined;
|
|
125
127
|
removeFromScope(vars: string[]): void;
|
|
126
128
|
addScopedVariable(key: string, value: any): void;
|
|
127
129
|
extendScope(scope: {
|
|
@@ -134,15 +136,20 @@ export declare const useVM: import("pinia").StoreDefinition<"vm", VMState, {
|
|
|
134
136
|
setScript(script: Parser.ParsedScript): void;
|
|
135
137
|
overrideData(data: DataState): void;
|
|
136
138
|
setStack(stack: SetStackOptions): void;
|
|
137
|
-
stackOptionsToStack(stack: SetStackOptions):
|
|
139
|
+
stackOptionsToStack(stack: SetStackOptions): MachineFrame;
|
|
138
140
|
setData(path: string, value: any): void;
|
|
139
141
|
addInstruction(path: string, value: any): void;
|
|
140
|
-
|
|
142
|
+
addFrame(newStackOptions: AddFrameOptions): void;
|
|
143
|
+
addAndRunFrame(newStackOptions: AddFrameOptions): Promise<void>;
|
|
144
|
+
runFrame(): Promise<void>;
|
|
145
|
+
runGame(): Promise<void>;
|
|
146
|
+
nextLineOnly(): Promise<boolean>;
|
|
141
147
|
nextLine(): Promise<any>;
|
|
142
|
-
|
|
143
|
-
|
|
148
|
+
previousFrame(): Promise<any>;
|
|
149
|
+
reachedEndOfScript(): void;
|
|
150
|
+
runLineOnly(): Promise<void>;
|
|
144
151
|
runLine(): Promise<void>;
|
|
145
152
|
runLabelFunction(label: string, ...args: any[]): Promise<unknown>;
|
|
146
|
-
|
|
153
|
+
runCustomFrame(stack: AddFrameOptions): void;
|
|
147
154
|
runLabel(label: string, ...args: any[]): void;
|
|
148
155
|
}>;
|
package/dist/types/parser.d.ts
CHANGED
|
@@ -13,13 +13,26 @@ export interface CommandParsingContext {
|
|
|
13
13
|
lines: Parser.Line[];
|
|
14
14
|
currentLine: number;
|
|
15
15
|
}
|
|
16
|
+
export declare type OnPlayerAnswered<Options, StaticOptions> = (cmd: Parser.Command<Options, StaticOptions>, choice: number | string) => Promise<any>;
|
|
17
|
+
export interface CommandPluginOptions<Options, StaticOptions = {}> {
|
|
18
|
+
keyword: string;
|
|
19
|
+
argTypes: ArgTypes;
|
|
20
|
+
runner: CommandRunner<Options, StaticOptions>;
|
|
21
|
+
parser?: CommandParserFunction<Options, StaticOptions>;
|
|
22
|
+
onPlayerAnswered?: OnPlayerAnswered<Options, StaticOptions>;
|
|
23
|
+
returnAfterPlayerAnswer?: boolean;
|
|
24
|
+
}
|
|
16
25
|
export declare class CommandPlugin<Options, StaticOptions = {}> {
|
|
17
26
|
keyword: string;
|
|
18
27
|
runner: CommandRunner<Options, StaticOptions>;
|
|
19
28
|
argTypes: ArgTypes;
|
|
20
29
|
parser: CommandParserFunction<Options, StaticOptions>;
|
|
21
|
-
onPlayerAnswered?:
|
|
30
|
+
onPlayerAnswered?: OnPlayerAnswered<Options, StaticOptions>;
|
|
31
|
+
returnAfterPlayerAnswer: boolean;
|
|
22
32
|
constructor(keyword: string, argTypes: ArgTypes, runner: CommandRunner<Options, StaticOptions>, parser?: CommandParserFunction<Options, StaticOptions>);
|
|
33
|
+
run(cmd: Parser.Command<Options, StaticOptions>, choices?: DialogChoice[]): Promise<any>;
|
|
34
|
+
processPlayerAnswer(cmd: Parser.Command<Options, StaticOptions>, choice: number | string): Promise<any>;
|
|
35
|
+
static FromOptions<Options, StaticOptions = {}>(options: CommandPluginOptions<Options, StaticOptions>): CommandPlugin<Options, StaticOptions>;
|
|
23
36
|
}
|
|
24
37
|
export declare type ArgTypes = ArgumentDescription[] | 'any';
|
|
25
38
|
export interface ArgumentDescription {
|