narrat 2.3.0 → 2.3.3

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 (114) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +128 -128
  3. package/dist/app.vue.d.ts +91 -91
  4. package/dist/components/MainMenu.vue.d.ts +12 -12
  5. package/dist/components/SkillsWindow.vue.d.ts +22 -22
  6. package/dist/components/StartMenu.vue.d.ts +46 -46
  7. package/dist/components/debug/debug-menu.vue.d.ts +48 -48
  8. package/dist/components/dialog-picture.vue.d.ts +11 -11
  9. package/dist/components/engine-splash/engine-splash.vue.d.ts +54 -54
  10. package/dist/components/game-dialog.vue.d.ts +65 -65
  11. package/dist/components/game-splash/game-splash.vue.d.ts +46 -46
  12. package/dist/components/hud.vue.d.ts +14 -14
  13. package/dist/components/in-game.vue.d.ts +46 -46
  14. package/dist/components/inventory-ui.vue.d.ts +30 -30
  15. package/dist/components/loading-bar.vue.d.ts +10 -10
  16. package/dist/components/menu-buttons.vue.d.ts +54 -54
  17. package/dist/components/notification-toast.vue.d.ts +6 -6
  18. package/dist/components/quests-ui.vue.d.ts +20 -20
  19. package/dist/components/save-slots.vue.d.ts +79 -79
  20. package/dist/components/saves/save-slot.vue.d.ts +108 -108
  21. package/dist/components/screen-layer.vue.d.ts +76 -76
  22. package/dist/components/screens.vue.d.ts +46 -46
  23. package/dist/components/transitions/NarratTransition.vue.d.ts +101 -101
  24. package/dist/components/utils/alert-modal.vue.d.ts +82 -82
  25. package/dist/components/utils/modal-window.vue.d.ts +18 -18
  26. package/dist/components/utils/yes-no.vue.d.ts +106 -106
  27. package/dist/components/volume-controls.vue.d.ts +18 -18
  28. package/dist/config.d.ts +211 -194
  29. package/dist/constants.d.ts +10 -10
  30. package/dist/defaultConfig.d.ts +2 -2
  31. package/dist/demo/demo.d.ts +1 -1
  32. package/dist/dialog-box.vue.d.ts +41 -41
  33. package/dist/exports/components.d.ts +2 -2
  34. package/dist/exports/config.d.ts +1 -1
  35. package/dist/exports/display.d.ts +2 -2
  36. package/dist/exports/events.d.ts +1 -1
  37. package/dist/exports/others.d.ts +1 -1
  38. package/dist/exports/plugins.d.ts +38 -38
  39. package/dist/exports/stores.d.ts +11 -11
  40. package/dist/favicon.svg +30 -30
  41. package/dist/lib.d.ts +18 -18
  42. package/dist/main.d.ts +7 -7
  43. package/dist/menu-buttons/menu-buttons.d.ts +4 -4
  44. package/dist/narrat.es.js +11691 -10268
  45. package/dist/narrat.es.js.map +1 -1
  46. package/dist/narrat.umd.js +108 -77
  47. package/dist/narrat.umd.js.map +1 -1
  48. package/dist/plugins/NarratPlugin.d.ts +11 -11
  49. package/dist/stores/audio-store.d.ts +48 -48
  50. package/dist/stores/dialog-store.d.ts +32 -32
  51. package/dist/stores/hud-stats-store.d.ts +22 -22
  52. package/dist/stores/inventory-store.d.ts +37 -37
  53. package/dist/stores/main-store.d.ts +813 -813
  54. package/dist/stores/menu-store.d.ts +36 -36
  55. package/dist/stores/notification-store.d.ts +15 -15
  56. package/dist/stores/quest-log.d.ts +39 -39
  57. package/dist/stores/rendering-store.d.ts +13 -13
  58. package/dist/stores/screens-store.d.ts +35 -35
  59. package/dist/stores/skills.d.ts +40 -40
  60. package/dist/stores/vm-store.d.ts +180 -180
  61. package/dist/types/app-types.d.ts +9 -9
  62. package/dist/types/character-types.d.ts +27 -27
  63. package/dist/types/dialog-box-types.d.ts +11 -11
  64. package/dist/types/game-save.d.ts +36 -36
  65. package/dist/types/parser.d.ts +93 -93
  66. package/dist/types/state.d.ts +3 -3
  67. package/dist/utils/InputsListener.d.ts +9 -9
  68. package/dist/utils/ajax.d.ts +2 -1
  69. package/dist/utils/audio-loader.d.ts +10 -10
  70. package/dist/utils/characters.d.ts +5 -5
  71. package/dist/utils/data-helpers.d.ts +28 -28
  72. package/dist/utils/debounce.d.ts +14 -14
  73. package/dist/utils/error-handling.d.ts +3 -3
  74. package/dist/utils/helpers.d.ts +6 -6
  75. package/dist/utils/images-loader.d.ts +6 -6
  76. package/dist/utils/logger.d.ts +11 -11
  77. package/dist/utils/object-iterators.d.ts +8 -8
  78. package/dist/utils/promises.d.ts +1 -1
  79. package/dist/utils/randomId.d.ts +1 -1
  80. package/dist/utils/save-helpers.d.ts +18 -18
  81. package/dist/utils/skillchecks.d.ts +17 -17
  82. package/dist/utils/string-helpers.d.ts +3 -3
  83. package/dist/utils/time-helpers.d.ts +2 -2
  84. package/dist/utils/transition.d.ts +15 -15
  85. package/dist/utils/type-utils.d.ts +2 -2
  86. package/dist/utils/typed-emitter.d.ts +18 -18
  87. package/dist/vm/commands/arithmetic-commands.d.ts +23 -23
  88. package/dist/vm/commands/audio-commands.d.ts +15 -15
  89. package/dist/vm/commands/choice.d.ts +37 -37
  90. package/dist/vm/commands/clear_dialog.d.ts +2 -2
  91. package/dist/vm/commands/command-helpers.d.ts +3 -3
  92. package/dist/vm/commands/command-plugin.d.ts +43 -43
  93. package/dist/vm/commands/flow-commands.d.ts +24 -24
  94. package/dist/vm/commands/if.d.ts +10 -10
  95. package/dist/vm/commands/index.d.ts +2 -2
  96. package/dist/vm/commands/inventory-commands.d.ts +15 -15
  97. package/dist/vm/commands/logic-command.d.ts +42 -42
  98. package/dist/vm/commands/math-commands.d.ts +30 -30
  99. package/dist/vm/commands/notify.d.ts +6 -6
  100. package/dist/vm/commands/quest-commands.d.ts +30 -30
  101. package/dist/vm/commands/random-commands.d.ts +10 -10
  102. package/dist/vm/commands/screen-commands.d.ts +15 -15
  103. package/dist/vm/commands/set.d.ts +6 -6
  104. package/dist/vm/commands/skill-commands.d.ts +30 -30
  105. package/dist/vm/commands/stats-commands.d.ts +12 -12
  106. package/dist/vm/commands/string-commands.d.ts +9 -9
  107. package/dist/vm/commands/text-field.d.ts +7 -7
  108. package/dist/vm/commands/text.d.ts +14 -14
  109. package/dist/vm/commands/wait.d.ts +4 -4
  110. package/dist/vm/vm-helpers.d.ts +18 -18
  111. package/dist/vm/vm-parser.d.ts +19 -19
  112. package/dist/vm/vm-parser.test.d.ts +1 -1
  113. package/dist/vm/vm.d.ts +21 -21
  114. package/package.json +3 -1
@@ -1,30 +1,30 @@
1
- import { CommandPlugin } from './command-plugin';
2
- export interface AddLevelArgs {
3
- skillKey: string;
4
- amount: number;
5
- }
6
- export declare const addLevelPlugin: CommandPlugin<AddLevelArgs, {}>;
7
- export declare const setLevelPlugin: CommandPlugin<{
8
- skill: string;
9
- level: number;
10
- }, {}>;
11
- export interface AddXpArgs {
12
- xpKey: string;
13
- xpToAdd: number;
14
- }
15
- export declare const addXpPlugin: CommandPlugin<AddXpArgs, {}>;
16
- export interface GetLevelArgs {
17
- skillKey: string;
18
- }
19
- export declare const getLevelPlugin: CommandPlugin<GetLevelArgs, {}>;
20
- export interface GetXpArgs {
21
- xpKey: string;
22
- }
23
- export declare const getXpPlugin: CommandPlugin<GetXpArgs, {}>;
24
- export interface RollArgs {
25
- id: string;
26
- skill: string;
27
- value: number;
28
- hideAfterRoll?: boolean;
29
- }
30
- export declare const rollPlugin: CommandPlugin<RollArgs, {}>;
1
+ import { CommandPlugin } from './command-plugin';
2
+ export interface AddLevelArgs {
3
+ skillKey: string;
4
+ amount: number;
5
+ }
6
+ export declare const addLevelPlugin: CommandPlugin<AddLevelArgs, {}>;
7
+ export declare const setLevelPlugin: CommandPlugin<{
8
+ skill: string;
9
+ level: number;
10
+ }, {}>;
11
+ export interface AddXpArgs {
12
+ xpKey: string;
13
+ xpToAdd: number;
14
+ }
15
+ export declare const addXpPlugin: CommandPlugin<AddXpArgs, {}>;
16
+ export interface GetLevelArgs {
17
+ skillKey: string;
18
+ }
19
+ export declare const getLevelPlugin: CommandPlugin<GetLevelArgs, {}>;
20
+ export interface GetXpArgs {
21
+ xpKey: string;
22
+ }
23
+ export declare const getXpPlugin: CommandPlugin<GetXpArgs, {}>;
24
+ export interface RollArgs {
25
+ id: string;
26
+ skill: string;
27
+ value: number;
28
+ hideAfterRoll?: boolean;
29
+ }
30
+ export declare const rollPlugin: CommandPlugin<RollArgs, {}>;
@@ -1,12 +1,12 @@
1
- import { CommandPlugin } from './command-plugin';
2
- export declare const addStatPlugin: CommandPlugin<{
3
- statKey: string;
4
- amountToAdd: number;
5
- }, {}>;
6
- export declare const setStatPlugin: CommandPlugin<{
7
- statKey: string;
8
- value: number;
9
- }, {}>;
10
- export declare const getStatPlugin: CommandPlugin<{
11
- statKey: string;
12
- }, {}>;
1
+ import { CommandPlugin } from './command-plugin';
2
+ export declare const addStatPlugin: CommandPlugin<{
3
+ statKey: string;
4
+ amountToAdd: number;
5
+ }, {}>;
6
+ export declare const setStatPlugin: CommandPlugin<{
7
+ statKey: string;
8
+ value: number;
9
+ }, {}>;
10
+ export declare const getStatPlugin: CommandPlugin<{
11
+ statKey: string;
12
+ }, {}>;
@@ -1,9 +1,9 @@
1
- import { CommandPlugin } from './command-plugin';
2
- export declare const stringConcatPlugin: CommandPlugin<{
3
- a: number;
4
- b: number;
5
- }, {}>;
6
- export declare const stringJoinPlugin: CommandPlugin<{
7
- a: number;
8
- b: number;
9
- }, {}>;
1
+ import { CommandPlugin } from './command-plugin';
2
+ export declare const stringConcatPlugin: CommandPlugin<{
3
+ a: number;
4
+ b: number;
5
+ }, {}>;
6
+ export declare const stringJoinPlugin: CommandPlugin<{
7
+ a: number;
8
+ b: number;
9
+ }, {}>;
@@ -1,7 +1,7 @@
1
- import { CommandPlugin } from './command-plugin';
2
- export declare const textFieldPlugin: CommandPlugin<{
3
- prompt: string;
4
- }, {}>;
5
- export declare const textFieldPromptPlugin: CommandPlugin<{
6
- prompt: string;
7
- }, {}>;
1
+ import { CommandPlugin } from './command-plugin';
2
+ export declare const textFieldPlugin: CommandPlugin<{
3
+ prompt: string;
4
+ }, {}>;
5
+ export declare const textFieldPromptPlugin: CommandPlugin<{
6
+ prompt: string;
7
+ }, {}>;
@@ -1,14 +1,14 @@
1
- import { CommandParserFunction, CommandPlugin } from './command-plugin';
2
- export interface TalkArgs {
3
- speaker: string;
4
- pose: string;
5
- text: string;
6
- }
7
- export declare const talkCommand: CommandPlugin<TalkArgs, {}>;
8
- export declare const thinkCommand: CommandPlugin<TalkArgs, {}>;
9
- export declare const textParser: () => CommandParserFunction<{}, {
10
- text: string;
11
- }>;
12
- export declare const textCommandPlugin: CommandPlugin<{}, {
13
- text: string;
14
- }>;
1
+ import { CommandParserFunction, CommandPlugin } from './command-plugin';
2
+ export interface TalkArgs {
3
+ speaker: string;
4
+ pose: string;
5
+ text: string;
6
+ }
7
+ export declare const talkCommand: CommandPlugin<TalkArgs, {}>;
8
+ export declare const thinkCommand: CommandPlugin<TalkArgs, {}>;
9
+ export declare const textParser: () => CommandParserFunction<{}, {
10
+ text: string;
11
+ }>;
12
+ export declare const textCommandPlugin: CommandPlugin<{}, {
13
+ text: string;
14
+ }>;
@@ -1,4 +1,4 @@
1
- import { CommandPlugin } from './command-plugin';
2
- export declare const waitCommand: CommandPlugin<{
3
- duration: number;
4
- }, {}>;
1
+ import { CommandPlugin } from './command-plugin';
2
+ export declare const waitCommand: CommandPlugin<{
3
+ duration: number;
4
+ }, {}>;
@@ -1,18 +1,18 @@
1
- import { AddDialogParams } from '../stores/dialog-store';
2
- import { SkillCheckState } from '../stores/skills';
3
- import { Parser } from '../types/parser';
4
- import { IfOptions, IfStaticOptions } from './commands/if';
5
- export interface SkillCheckParams {
6
- skill: string;
7
- value: number;
8
- id: string;
9
- hideAfterRoll?: boolean;
10
- }
11
- export declare function runSkillCheck(params: SkillCheckParams): SkillCheckState;
12
- export declare function runConditionCommand(command: Parser.Command<IfOptions, IfStaticOptions>): Parser.Branch | undefined;
13
- export declare function isExpression(arg: Parser.Arg): arg is Parser.ParsedExpression;
14
- export declare type Variable = string | number | boolean | undefined | null;
15
- export declare function isVariable(arg: Parser.Arg): arg is Variable;
16
- export declare function writeText(text: string): void;
17
- export declare function textCommand(dialog: AddDialogParams): Promise<void>;
18
- export declare function getLine(lines: Parser.Line[], index: number): Parser.Line | undefined;
1
+ import { AddDialogParams } from '../stores/dialog-store';
2
+ import { SkillCheckState } from '../stores/skills';
3
+ import { Parser } from '../types/parser';
4
+ import { IfOptions, IfStaticOptions } from './commands/if';
5
+ export interface SkillCheckParams {
6
+ skill: string;
7
+ value: number;
8
+ id: string;
9
+ hideAfterRoll?: boolean;
10
+ }
11
+ export declare function runSkillCheck(params: SkillCheckParams): SkillCheckState;
12
+ export declare function runConditionCommand(command: Parser.Command<IfOptions, IfStaticOptions>): Parser.Branch | undefined;
13
+ export declare function isExpression(arg: Parser.Arg): arg is Parser.ParsedExpression;
14
+ export declare type Variable = string | number | boolean | undefined | null;
15
+ export declare function isVariable(arg: Parser.Arg): arg is Variable;
16
+ export declare function writeText(text: string): void;
17
+ export declare function textCommand(dialog: AddDialogParams): Promise<void>;
18
+ export declare function getLine(lines: Parser.Line[], index: number): Parser.Line | undefined;
@@ -1,19 +1,19 @@
1
- import { Parser } from '../types/parser';
2
- import { ProcessCommandsFunction } from './commands/command-plugin';
3
- export declare type ErrorFunction = (line: number, text: string) => void;
4
- export declare type ParserErrorHandler = (ctx: ParserContext, line: number, text: string) => void;
5
- export interface ParserContext {
6
- fileName: string;
7
- currentLine: number;
8
- error: ErrorFunction;
9
- processCommandsFunction: ProcessCommandsFunction;
10
- indentSize: number;
11
- }
12
- export declare function parseScript(errorHandler: ParserErrorHandler, code: string, fileName: string): Parser.ParsedScript;
13
- export declare function parseCodeLine(ctx: ParserContext, codeToProcess: string): Parser.Expression;
14
- export declare function parseCodeLineIntoTokens(code: string): Parser.Primitive[];
15
- export declare function splitIntoTokens(code: string): Parser.Primitive[];
16
- export declare function tokensToExpression(ctx: ParserContext, tokens: Parser.Primitive[]): [Parser.Expression, number];
17
- export declare function validateExpression(ctx: ParserContext, expression: Parser.Expression): void;
18
- export declare function findExpressionStart(tokens: Parser.Primitive[]): number;
19
- export declare function findExpressionEnd(tokens: Parser.Primitive[]): number;
1
+ import { Parser } from '../types/parser';
2
+ import { ProcessCommandsFunction } from './commands/command-plugin';
3
+ export declare type ErrorFunction = (line: number, text: string) => void;
4
+ export declare type ParserErrorHandler = (ctx: ParserContext, line: number, text: string) => void;
5
+ export interface ParserContext {
6
+ fileName: string;
7
+ currentLine: number;
8
+ error: ErrorFunction;
9
+ processCommandsFunction: ProcessCommandsFunction;
10
+ indentSize: number;
11
+ }
12
+ export declare function parseScript(errorHandler: ParserErrorHandler, code: string, fileName: string): Parser.ParsedScript;
13
+ export declare function parseCodeLine(ctx: ParserContext, codeToProcess: string): Parser.Expression;
14
+ export declare function parseCodeLineIntoTokens(code: string): Parser.Primitive[];
15
+ export declare function splitIntoTokens(code: string): Parser.Primitive[];
16
+ export declare function tokensToExpression(ctx: ParserContext, tokens: Parser.Primitive[]): [Parser.Expression, number];
17
+ export declare function validateExpression(ctx: ParserContext, expression: Parser.Expression): void;
18
+ export declare function findExpressionStart(tokens: Parser.Primitive[]): number;
19
+ export declare function findExpressionEnd(tokens: Parser.Primitive[]): number;
@@ -1 +1 @@
1
- export {};
1
+ export {};
package/dist/vm/vm.d.ts CHANGED
@@ -1,21 +1,21 @@
1
- import { CommandPlugin } from './commands/command-plugin';
2
- import { NarratPluginObject, NarratCustomStoreActions } from '../exports/plugins';
3
- import { Parser } from '../types/parser';
4
- import { DialogChoice } from '../stores/dialog-store';
5
- import { Pinia, Store } from 'pinia';
6
- export declare class VM {
7
- plugins: NarratPluginObject<any>[];
8
- pinia: Pinia;
9
- commands: {
10
- [key: string]: CommandPlugin<any>;
11
- };
12
- addCommand(command: CommandPlugin<any, any>): void;
13
- addPlugin(plugin: NarratPluginObject<any>): void;
14
- callHook(hookName: string, ...args: any[]): void;
15
- customStores(): [string, Store<any, any, any, NarratCustomStoreActions>][];
16
- }
17
- export declare const vm: VM;
18
- export declare function runCommand(expression: Parser.ParsedExpression, choices?: DialogChoice[]): Promise<any>;
19
- export declare function generateCommand(expr: Parser.ParsedExpression, choices?: DialogChoice[]): Promise<Parser.Command>;
20
- export declare function runExpression<ReturnType = any>(expr: Parser.ParsedExpression, choices?: DialogChoice[]): Promise<ReturnType>;
21
- export declare function playerAnswered(choice: string | number): Promise<any>;
1
+ import { CommandPlugin } from './commands/command-plugin';
2
+ import { NarratPluginObject, NarratCustomStoreActions } from '../exports/plugins';
3
+ import { Parser } from '../types/parser';
4
+ import { DialogChoice } from '../stores/dialog-store';
5
+ import { Pinia, Store } from 'pinia';
6
+ export declare class VM {
7
+ plugins: NarratPluginObject<any>[];
8
+ pinia: Pinia;
9
+ commands: {
10
+ [key: string]: CommandPlugin<any>;
11
+ };
12
+ addCommand(command: CommandPlugin<any, any>): void;
13
+ addPlugin(plugin: NarratPluginObject<any>): void;
14
+ callHook(hookName: string, ...args: any[]): void;
15
+ customStores(): [string, Store<any, any, any, NarratCustomStoreActions>][];
16
+ }
17
+ export declare const vm: VM;
18
+ export declare function runCommand(expression: Parser.ParsedExpression, choices?: DialogChoice[]): Promise<any>;
19
+ export declare function generateCommand(expr: Parser.ParsedExpression, choices?: DialogChoice[]): Promise<Parser.Command>;
20
+ export declare function runExpression<ReturnType = any>(expr: Parser.ParsedExpression, choices?: DialogChoice[]): Promise<ReturnType>;
21
+ export declare function playerAnswered(choice: string | number): Promise<any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "narrat",
3
- "version": "2.3.0",
3
+ "version": "2.3.3",
4
4
  "description": "narrat narrative engine",
5
5
  "main": "dist/narrat.umd.js",
6
6
  "module": "dist/narrat.es.js",
@@ -31,11 +31,13 @@
31
31
  "deepmerge": "^4.2.2",
32
32
  "fuse.js": "^6.6.2",
33
33
  "howler": "^2.2.3",
34
+ "js-yaml": "^4.1.0",
34
35
  "svelte-jsoneditor": "^0.3.58",
35
36
  "vue3-mq": "^3.0.0"
36
37
  },
37
38
  "devDependencies": {
38
39
  "@types/howler": "^2.2.3",
40
+ "@types/js-yaml": "^4.0.5",
39
41
  "@typescript-eslint/eslint-plugin": "^5.30.0",
40
42
  "@typescript-eslint/parser": "^5.30.0",
41
43
  "@vitejs/plugin-vue": "^3.0.0",