narrat 1.3.0 → 2.0.0-rc1

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.
Files changed (43) hide show
  1. package/lib/app.vue.d.ts +13 -46
  2. package/lib/components/MainMenu.vue.d.ts +6 -9
  3. package/lib/components/Skills.vue.d.ts +3 -5
  4. package/lib/components/debug/debug-menu.vue.d.ts +1 -1
  5. package/lib/components/inventory.vue.d.ts +8 -5
  6. package/lib/components/quests.vue.d.ts +3 -5
  7. package/lib/config.d.ts +14 -0
  8. package/lib/exports/plugins.d.ts +4 -4
  9. package/lib/index.d.ts +1 -4
  10. package/lib/index.esm.js +1189 -728
  11. package/lib/index.js +1189 -728
  12. package/lib/plugins/NarratPlugin.d.ts +1 -1
  13. package/lib/stores/dialog-store.d.ts +3 -1
  14. package/lib/stores/inventory-store.d.ts +11 -1
  15. package/lib/stores/main-store.d.ts +51 -98
  16. package/lib/stores/quest-log.d.ts +1 -1
  17. package/lib/stores/skills.d.ts +6 -4
  18. package/lib/stores/vm-store.d.ts +35 -89
  19. package/lib/types/parser.d.ts +27 -17
  20. package/lib/utils/data-helpers.d.ts +1 -0
  21. package/lib/utils/string-helpers.d.ts +2 -0
  22. package/lib/vm/commands/add.d.ts +5 -3
  23. package/lib/vm/commands/arithmetic-commands.d.ts +5 -0
  24. package/lib/vm/commands/audio-commands.d.ts +8 -0
  25. package/lib/vm/commands/choice.d.ts +36 -4
  26. package/lib/vm/commands/clear_dialog.d.ts +2 -3
  27. package/lib/vm/commands/command-plugin.d.ts +17 -8
  28. package/lib/vm/commands/if.d.ts +9 -1
  29. package/lib/vm/commands/inventory-commands.d.ts +13 -0
  30. package/lib/vm/commands/jump.d.ts +6 -1
  31. package/lib/vm/commands/logic-command.d.ts +42 -0
  32. package/lib/vm/commands/notify.d.ts +3 -1
  33. package/lib/vm/commands/quest-commands.d.ts +15 -4
  34. package/lib/vm/commands/screen-commands.d.ts +8 -0
  35. package/lib/vm/commands/set.d.ts +5 -1
  36. package/lib/vm/commands/skill-commands.d.ts +33 -0
  37. package/lib/vm/commands/stats-commands.d.ts +9 -0
  38. package/lib/vm/commands/text.d.ts +13 -2
  39. package/lib/vm/commands/wait.d.ts +3 -1
  40. package/lib/vm/vm-helpers.d.ts +6 -6
  41. package/lib/vm/vm-parser.d.ts +10 -1
  42. package/lib/vm/vm.d.ts +8 -6
  43. package/package.json +11 -7
package/lib/app.vue.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { PropType } from 'vue';
2
2
  import { DialogBoxParameters } from './types/dialog-box-types';
3
3
  import { GameConfig } from './types/app-types';
4
- import { AppOptions } from '.';
4
+ import { AppOptions } from './config';
5
5
  import { Parser } from './types/parser';
6
6
  import { DialogKey } from './stores/dialog-store';
7
7
  declare const _default: import("vue").DefineComponent<{
@@ -24,49 +24,17 @@ declare const _default: import("vue").DefineComponent<{
24
24
  currentIndex: number;
25
25
  branch: {
26
26
  code: string;
27
- args: string[];
28
- operator: string;
29
- commandType: string;
30
- options: Parser.EmptyOptions | {
31
- condition: string;
32
- success: any[];
33
- failure?: any[];
34
- } | {
35
- label: string;
36
- } | {
37
- text: string;
38
- } | {
39
- prompt: any;
40
- choices: {
41
- choice: string;
42
- branch: any[];
43
- condition?: string;
44
- skillCheck?: {
45
- id: string;
46
- skill: string;
47
- value: number;
48
- hideAfterRoll: boolean;
49
- success: {
50
- text: string;
51
- branch: any[];
52
- };
53
- failure: {
54
- text: string;
55
- branch?: any[];
56
- };
57
- };
58
- index: number;
59
- }[];
60
- } | {
61
- screen: string;
62
- } | {
63
- mode: "sound" | "music";
64
- audio: string;
65
- } | {
66
- mode: "sound" | "music";
67
- audio?: string;
68
- } | {
69
- duration: number;
27
+ command: {
28
+ commandType: string;
29
+ operator: string;
30
+ args: (Parser.Primitive | {
31
+ code: string;
32
+ command: any;
33
+ fileName: string;
34
+ line: number;
35
+ })[];
36
+ options: Parser.DefaultArg;
37
+ staticOptions?: unknown;
70
38
  };
71
39
  fileName: string;
72
40
  line: number;
@@ -85,7 +53,6 @@ declare const _default: import("vue").DefineComponent<{
85
53
  }, {
86
54
  dialogLength(): number;
87
55
  lastDialog(): DialogKey | undefined;
88
- command(): Parser.Command;
89
56
  picture(): string | undefined;
90
57
  backgroundStyle(): any;
91
58
  layoutWidth(): number;
@@ -106,7 +73,7 @@ declare const _default: import("vue").DefineComponent<{
106
73
  gameStyle(): any;
107
74
  screenRatio(): number;
108
75
  dialogContainerStyle(): any;
109
- currentLine: () => Parser.Command;
76
+ currentLine: () => Parser.ParsedExpression<Parser.DefaultArg, undefined>;
110
77
  screenWidth: () => number;
111
78
  screenHeight: () => number;
112
79
  canvasWidth: () => number;
@@ -1,18 +1,15 @@
1
- declare const _default: import("vue").DefineComponent<Readonly<import("vue").ComponentPropsOptions<{
2
- [x: string]: unknown;
3
- }>>, unknown, void, {
1
+ declare const _default: import("vue").DefineComponent<{
2
+ close: FunctionConstructor;
3
+ }, unknown, void, {
4
4
  playTime: () => {
5
5
  start: number;
6
6
  previousPlaytime: number;
7
7
  };
8
8
  }, {
9
9
  quit(): void;
10
- close(): void;
11
10
  mainMenu(): void;
12
11
  getPlayTimeString(): string;
13
- }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, readonly string[] | Readonly<import("vue").ExtractPropTypes<Readonly<import("vue").ComponentObjectPropsOptions<{
14
- [x: string]: unknown;
15
- }>>>>, {
16
- [x: number]: string;
17
- } | {}>;
12
+ }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
13
+ close: FunctionConstructor;
14
+ }>>, {}>;
18
15
  export default _default;
@@ -1,7 +1,7 @@
1
1
  import { SkillData } from '@/config';
2
2
  import { SkillsState } from '@/stores/skills';
3
3
  declare const _default: import("vue").DefineComponent<{
4
- close: any;
4
+ close: FunctionConstructor;
5
5
  }, {
6
6
  skills: import("vue").ComputedRef<SkillsState>;
7
7
  }, {
@@ -21,8 +21,6 @@ declare const _default: import("vue").DefineComponent<{
21
21
  width: string;
22
22
  };
23
23
  }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
24
- close: any;
25
- }>>, {
26
- close: any;
27
- }>;
24
+ close: FunctionConstructor;
25
+ }>>, {}>;
28
26
  export default _default;
@@ -40,7 +40,7 @@ declare const _default: import("vue").DefineComponent<{}, {
40
40
  onSearchInput(): void;
41
41
  save(): void;
42
42
  wordCount(): void;
43
- countWordsInScriptLine(scriptLine: Parser.Command): number;
43
+ countWordsInScriptLine(scriptLine: Parser.ParsedExpression): number;
44
44
  countWordsInString(string: string): number;
45
45
  countWordsInScriptBranch(branch: Parser.Branch): number;
46
46
  getPlayTimeString(): string;
@@ -1,11 +1,12 @@
1
1
  import { ItemData } from '@/config';
2
2
  import { ItemState } from '@/stores/inventory-store';
3
3
  declare const _default: import("vue").DefineComponent<{
4
- close: any;
4
+ close: FunctionConstructor;
5
5
  }, {
6
6
  items: import("vue").ComputedRef<{
7
7
  [key: string]: ItemState;
8
8
  }>;
9
+ currentlyChoosing: import("vue").ComputedRef<import("@/stores/dialog-store").DialogChoice[]>;
9
10
  }, {
10
11
  chosenId: string | false;
11
12
  }, {
@@ -13,6 +14,7 @@ declare const _default: import("vue").DefineComponent<{
13
14
  [key: string]: ItemState;
14
15
  };
15
16
  chosenItem(): null | ItemState;
17
+ canUseChosenItem(): boolean;
16
18
  chosenItemConf(): null | ItemData;
17
19
  itemConf(): {
18
20
  [key: string]: ItemData;
@@ -20,11 +22,12 @@ declare const _default: import("vue").DefineComponent<{
20
22
  }, {
21
23
  getItemStyle(item: string): any;
22
24
  getItemName(item: string): string;
25
+ getItemConf(item: string): ItemData;
23
26
  clickItem(item: string): void;
24
27
  closeItem(): void;
28
+ useItem(): void;
29
+ canUseItem(item: ItemState): boolean;
25
30
  }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
26
- close: any;
27
- }>>, {
28
- close: any;
29
- }>;
31
+ close: FunctionConstructor;
32
+ }>>, {}>;
30
33
  export default _default;
@@ -1,6 +1,6 @@
1
1
  import { QuestState, ObjectiveState } from '../stores/quest-log';
2
2
  declare const _default: import("vue").DefineComponent<{
3
- close: any;
3
+ close: FunctionConstructor;
4
4
  }, {
5
5
  quests: import("vue").ComputedRef<{
6
6
  [key: string]: QuestState;
@@ -18,8 +18,6 @@ declare const _default: import("vue").DefineComponent<{
18
18
  [key: string]: ObjectiveState;
19
19
  };
20
20
  }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
21
- close: any;
22
- }>>, {
23
- close: any;
24
- }>;
21
+ close: FunctionConstructor;
22
+ }>>, {}>;
25
23
  export default _default;
package/lib/config.d.ts CHANGED
@@ -4,6 +4,10 @@ export declare function getSkillConfig(id: string): SkillData;
4
4
  export declare function getItemConfig(id: string): ItemData;
5
5
  export declare function getQuestConfig(questId: string): QuestData;
6
6
  export declare function getObjectiveConfig(quest: string, objectiveId: string): ObjectiveData;
7
+ export interface AppOptions {
8
+ logging: boolean;
9
+ debug: boolean;
10
+ }
7
11
  export interface Config {
8
12
  gameTitle: string;
9
13
  images: {
@@ -71,6 +75,11 @@ export interface Config {
71
75
  items: {
72
76
  [key: string]: ItemData;
73
77
  };
78
+ interactionTags: {
79
+ [key: string]: {
80
+ onlyInteractOutsideOfScripts: boolean;
81
+ };
82
+ };
74
83
  quests: {
75
84
  [key: string]: QuestData;
76
85
  };
@@ -90,6 +99,11 @@ export interface ItemData {
90
99
  name: string;
91
100
  description: string;
92
101
  icon: string;
102
+ onUse?: {
103
+ action: 'jump' | 'run_label';
104
+ label: string;
105
+ };
106
+ tag?: string;
93
107
  }
94
108
  export interface HudStatConfig {
95
109
  name: string;
@@ -2,7 +2,7 @@ import { NarratPlugin } from '../plugins/NarratPlugin';
2
2
  import { CommandPlugin, generateParser } from '../vm/commands/command-plugin';
3
3
  import type { CommandRunner } from '../vm/commands/command-plugin';
4
4
  export declare type NarratLifecycleHook = <T extends [...any[]]>(...args: T) => void;
5
- declare type NarratPluginObject = {
5
+ declare type NarratPluginObject<T> = {
6
6
  onPageLoaded?: NarratLifecycleHook;
7
7
  onNarratSetup?: NarratLifecycleHook;
8
8
  onAppMounted?: NarratLifecycleHook;
@@ -11,9 +11,9 @@ declare type NarratPluginObject = {
11
11
  onGameStart?: NarratLifecycleHook;
12
12
  onGameMounted?: NarratLifecycleHook;
13
13
  onGameUnmounted?: NarratLifecycleHook;
14
- customCommands?: CommandPlugin[];
14
+ customCommands?: CommandPlugin<T>[];
15
15
  };
16
- declare function registerPlugin(plugin: NarratPluginObject): void;
17
- declare function addCommand(command: CommandPlugin): void;
16
+ declare function registerPlugin<T>(plugin: NarratPluginObject<T>): void;
17
+ declare function addCommand<T>(command: CommandPlugin<T>): void;
18
18
  export { CommandRunner };
19
19
  export { CommandPlugin, NarratPluginObject, NarratPlugin, registerPlugin, addCommand, generateParser, };
package/lib/index.d.ts CHANGED
@@ -2,10 +2,7 @@ import 'es6-promise/auto';
2
2
  import './/sass/main.css';
3
3
  import { App } from 'vue';
4
4
  import { GameConfig } from './types/app-types';
5
- export interface AppOptions {
6
- logging: boolean;
7
- debug: boolean;
8
- }
5
+ import { AppOptions } from './config';
9
6
  export declare function startApp(config: GameConfig, options: AppOptions): Promise<void>;
10
7
  export declare type Narrat = {
11
8
  app: App;