narrat 2.0.0-test-4 → 2.0.2

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 (99) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +38 -38
  3. package/dist/app.vue.d.ts +106 -0
  4. package/dist/components/MainMenu.vue.d.ts +12 -0
  5. package/dist/components/Skills.vue.d.ts +22 -0
  6. package/dist/components/debug/debug-menu.vue.d.ts +48 -0
  7. package/dist/components/dialog-picture.vue.d.ts +9 -0
  8. package/dist/components/game-dialog.vue.d.ts +65 -0
  9. package/dist/components/hud.vue.d.ts +12 -0
  10. package/dist/components/inventory-ui.vue.d.ts +30 -0
  11. package/dist/components/loading-bar.vue.d.ts +10 -0
  12. package/dist/components/menu-buttons.vue.d.ts +26 -0
  13. package/dist/components/notification-toast.vue.d.ts +6 -0
  14. package/dist/components/quests-ui.vue.d.ts +20 -0
  15. package/dist/components/utils/modal.vue.d.ts +6 -0
  16. package/dist/components/volume-controls.vue.d.ts +7 -0
  17. package/dist/config.d.ts +151 -0
  18. package/dist/constants.d.ts +1 -0
  19. package/dist/data/characters.json +62 -62
  20. package/dist/data/config.json +182 -176
  21. package/dist/data/example.rpy +360 -356
  22. package/dist/data/refactor.rpy +30 -30
  23. package/dist/defaultConfig.d.ts +2 -0
  24. package/dist/demo/demo.d.ts +1 -0
  25. package/dist/dialog-box.vue.d.ts +37 -0
  26. package/dist/exports/config.d.ts +1 -0
  27. package/dist/exports/display.d.ts +2 -0
  28. package/dist/exports/plugins.d.ts +20 -0
  29. package/dist/fonts/OpenDyslexic.ttf.svg +2326 -2326
  30. package/dist/gameloop.d.ts +3 -0
  31. package/dist/lib/lib.d.ts +15 -0
  32. package/dist/lib.css +1 -1
  33. package/dist/main.d.ts +5 -0
  34. package/dist/narrat.es.js +19015 -21676
  35. package/dist/narrat.umd.js +112 -112
  36. package/dist/plugins/NarratPlugin.d.ts +11 -0
  37. package/dist/stores/audio-store.d.ts +12 -0
  38. package/dist/stores/dialog-store.d.ts +31 -0
  39. package/dist/stores/hud-stats-store.d.ts +22 -0
  40. package/dist/stores/inventory-store.d.ts +37 -0
  41. package/dist/stores/main-store.d.ts +276 -0
  42. package/dist/stores/notification-store.d.ts +12 -0
  43. package/dist/stores/quest-log.d.ts +39 -0
  44. package/dist/stores/rendering-store.d.ts +13 -0
  45. package/dist/stores/screens-store.d.ts +23 -0
  46. package/dist/stores/skills.d.ts +36 -0
  47. package/dist/stores/vm-store.d.ts +148 -0
  48. package/dist/types/app-types.d.ts +4 -0
  49. package/dist/types/character-types.d.ts +27 -0
  50. package/dist/types/dialog-box-types.d.ts +10 -0
  51. package/dist/types/game-save.d.ts +21 -0
  52. package/dist/types/parser.d.ts +92 -0
  53. package/dist/types/state.d.ts +3 -0
  54. package/dist/utils/ajax.d.ts +1 -0
  55. package/dist/utils/audio-loader.d.ts +13 -0
  56. package/dist/utils/characters.d.ts +5 -0
  57. package/dist/utils/data-helpers.d.ts +19 -0
  58. package/dist/utils/debounce.d.ts +14 -0
  59. package/dist/utils/error-handling.d.ts +3 -0
  60. package/dist/utils/helpers.d.ts +6 -0
  61. package/dist/utils/images-loader.d.ts +6 -0
  62. package/dist/utils/logger.d.ts +11 -0
  63. package/dist/utils/object-iterators.d.ts +8 -0
  64. package/dist/utils/promises.d.ts +1 -0
  65. package/dist/utils/randomId.d.ts +1 -0
  66. package/dist/utils/skillchecks.d.ts +17 -0
  67. package/dist/utils/string-helpers.d.ts +3 -0
  68. package/dist/utils/time-helpers.d.ts +2 -0
  69. package/dist/vm/commands/arithmetic-commands.d.ts +17 -0
  70. package/dist/vm/commands/audio-commands.d.ts +8 -0
  71. package/dist/vm/commands/choice.d.ts +37 -0
  72. package/dist/vm/commands/clear_dialog.d.ts +2 -0
  73. package/dist/vm/commands/command-helpers.d.ts +2 -0
  74. package/dist/vm/commands/command-plugin.d.ts +30 -0
  75. package/dist/vm/commands/flow-commands.d.ts +14 -0
  76. package/dist/vm/commands/if.d.ts +10 -0
  77. package/dist/vm/commands/index.d.ts +2 -0
  78. package/dist/vm/commands/inventory-commands.d.ts +15 -0
  79. package/dist/vm/commands/logic-command.d.ts +42 -0
  80. package/dist/vm/commands/notify.d.ts +4 -0
  81. package/dist/vm/commands/quest-commands.d.ts +30 -0
  82. package/dist/vm/commands/screen-commands.d.ts +8 -0
  83. package/dist/vm/commands/set.d.ts +6 -0
  84. package/dist/vm/commands/skill-commands.d.ts +33 -0
  85. package/dist/vm/commands/stats-commands.d.ts +12 -0
  86. package/dist/vm/commands/string-commands.d.ts +9 -0
  87. package/dist/vm/commands/text-field.d.ts +7 -0
  88. package/dist/vm/commands/text.d.ts +13 -0
  89. package/dist/vm/commands/wait.d.ts +4 -0
  90. package/dist/vm/vm-helpers.d.ts +16 -0
  91. package/dist/vm/vm-parser.d.ts +19 -0
  92. package/dist/vm/vm-parser.test.d.ts +1 -0
  93. package/dist/vm/vm.d.ts +19 -0
  94. package/package.json +79 -73
  95. package/CHANGELOG.md +0 -730
  96. package/dist/.DS_Store +0 -0
  97. package/dist/img/.DS_Store +0 -0
  98. package/dist/music/.DS_Store +0 -0
  99. package/dist/sounds/.DS_Store +0 -0
@@ -0,0 +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;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,19 @@
1
+ import { CommandPlugin } from './commands/command-plugin';
2
+ import { NarratPluginObject } from '../exports/plugins';
3
+ import { Parser } from '../types/parser';
4
+ import { DialogChoice } from '../stores/dialog-store';
5
+ export declare class VM {
6
+ plugins: NarratPluginObject<any>[];
7
+ commands: {
8
+ [key: string]: CommandPlugin<any>;
9
+ };
10
+ addCommand(command: CommandPlugin<any, any>): void;
11
+ addPlugin(plugin: NarratPluginObject<any>): void;
12
+ callHook(hookName: string, ...args: any[]): void;
13
+ }
14
+ export declare const vm: VM;
15
+ export declare function runCommand(expression: Parser.ParsedExpression, choices?: DialogChoice[]): Promise<any>;
16
+ export declare function generateCommand(expr: Parser.ParsedExpression, choices?: DialogChoice[]): Promise<Parser.Command>;
17
+ export declare function runExpression<ReturnType = any>(expr: Parser.ParsedExpression, choices?: DialogChoice[]): Promise<ReturnType>;
18
+ export declare function playerAnswered(choice: string | number): Promise<any>;
19
+ export declare function finishGame(): void;
package/package.json CHANGED
@@ -1,73 +1,79 @@
1
- {
2
- "name": "narrat",
3
- "description": "narrat narrative engine",
4
- "version": "2.0.0-test-4",
5
- "main": "dist/narrat.umd.js",
6
- "module": "dist/narrat.es.js",
7
- "repository": {
8
- "type": "git",
9
- "url": "git@github.com:liana-pigeot/narrat.git"
10
- },
11
- "homepage": "https://get-narrat.com",
12
- "files": [
13
- "dist/"
14
- ],
15
- "scripts": {
16
- "test": "cross-env NODE_OPTIONS=--experimental-vm-modules npx jest",
17
- "start": "npm run dev",
18
- "dev": "vite",
19
- "build": "vue-tsc --noEmit && vite build",
20
- "preview": "vite preview",
21
- "lint": "eslint src --ext=.js,.jsx,.ts,.tsx",
22
- "preversion": "npm run build && npm run lint",
23
- "postversion": "git push && git push --tags",
24
- "check-types": "tsc --noEmit"
25
- },
26
- "keywords": [
27
- "game"
28
- ],
29
- "author": "Liana Pigeot",
30
- "license": "MIT",
31
- "peerDependencies": {
32
- "es6-promise": "^4.2.8",
33
- "pinia": "^2.0.14",
34
- "vue": "^3.2.37"
35
- },
36
- "dependencies": {
37
- "deepmerge": "^4.2.2",
38
- "fuse.js": "^6.6.2",
39
- "howler": "^2.2.3",
40
- "svelte-jsoneditor": "^0.3.58",
41
- "vue3-mq": "^3.0.0"
42
- },
43
- "devDependencies": {
44
- "@types/howler": "^2.2.3",
45
- "@types/jest": "^28.1.3",
46
- "@typescript-eslint/eslint-plugin": "^5.30.0",
47
- "@typescript-eslint/parser": "^5.30.0",
48
- "@vitejs/plugin-vue": "^2.3.3",
49
- "autoprefixer": "^10.4.7",
50
- "cross-env": "^7.0.3",
51
- "es6-promise": "^4.2.8",
52
- "eslint": "^8.18.0",
53
- "eslint-config-prettier": "^8.5.0",
54
- "eslint-config-standard": "^17.0.0",
55
- "eslint-import-resolver-typescript": "^3.1.1",
56
- "eslint-plugin-import": "^2.26.0",
57
- "eslint-plugin-n": "^15.2.3",
58
- "eslint-plugin-node": "^11.1.0",
59
- "eslint-plugin-promise": "^6.0.0",
60
- "eslint-plugin-vue": "^9.1.1",
61
- "jest": "^28.1.2",
62
- "pinia": "^2.0.14",
63
- "postcss": "^8.4.14",
64
- "prettier": "^2.7.1",
65
- "tailwindcss": "^3.1.4",
66
- "ts-jest": "^28.0.5",
67
- "typescript": "^4.5.4",
68
- "vite": "^2.9.9",
69
- "vite-plugin-eslint": "^1.6.1",
70
- "vue": "^3.2.37",
71
- "vue-tsc": "^0.34.7"
72
- }
73
- }
1
+ {
2
+ "name": "narrat",
3
+ "version": "2.0.2",
4
+ "description": "narrat narrative engine",
5
+ "main": "dist/narrat.umd.js",
6
+ "module": "dist/narrat.es.js",
7
+ "types": "dist/lib/lib.d.ts",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git@github.com:liana-pigeot/narrat.git"
11
+ },
12
+ "homepage": "https://get-narrat.com",
13
+ "files": [
14
+ "dist/"
15
+ ],
16
+ "scripts": {
17
+ "test": "cross-env NODE_OPTIONS=--experimental-vm-modules npx jest",
18
+ "start": "npm run dev",
19
+ "dev": "vite",
20
+ "generate-types": "vue-tsc --emitDeclarationOnly --outDir dist && npm run fix-type-aliases",
21
+ "fix-type-aliases": "tsc-alias -p tsconfig.json",
22
+ "build": "vue-tsc --noEmit && vite build && npm run generate-types",
23
+ "preview": "vite preview",
24
+ "lint": "eslint src --ext=.js,.jsx,.ts,.tsx",
25
+ "preversion": "npm run build && npm run lint",
26
+ "postversion": "git push && git push --tags",
27
+ "check-types": "tsc --noEmit"
28
+ },
29
+ "keywords": [
30
+ "game"
31
+ ],
32
+ "author": "Liana Pigeot",
33
+ "license": "MIT",
34
+ "peerDependencies": {
35
+ "es6-promise": "^4.2.8",
36
+ "pinia": "^2.0.14",
37
+ "vue": "^3.2.37"
38
+ },
39
+ "dependencies": {
40
+ "deepmerge": "^4.2.2",
41
+ "fuse.js": "^6.6.2",
42
+ "howler": "^2.2.3",
43
+ "svelte-jsoneditor": "^0.3.58",
44
+ "vue3-mq": "^3.0.0"
45
+ },
46
+ "devDependencies": {
47
+ "@types/howler": "^2.2.3",
48
+ "@types/jest": "^28.1.3",
49
+ "@typescript-eslint/eslint-plugin": "^5.30.0",
50
+ "@typescript-eslint/parser": "^5.30.0",
51
+ "@vitejs/plugin-vue": "^2.3.3",
52
+ "autoprefixer": "^10.4.7",
53
+ "cross-env": "^7.0.3",
54
+ "es6-promise": "^4.2.8",
55
+ "eslint": "^8.18.0",
56
+ "eslint-config-prettier": "^8.5.0",
57
+ "eslint-config-standard": "^17.0.0",
58
+ "eslint-import-resolver-typescript": "^3.1.1",
59
+ "eslint-plugin-import": "^2.26.0",
60
+ "eslint-plugin-n": "^15.2.3",
61
+ "eslint-plugin-node": "^11.1.0",
62
+ "eslint-plugin-promise": "^6.0.0",
63
+ "eslint-plugin-vue": "^9.1.1",
64
+ "jest": "^28.1.2",
65
+ "pinia": "^2.0.14",
66
+ "postcss": "^8.4.14",
67
+ "prettier": "^2.7.1",
68
+ "rollup-plugin-typescript2": "^0.32.1",
69
+ "tailwindcss": "^3.1.4",
70
+ "ts-jest": "^28.0.5",
71
+ "tsc-alias": "^1.6.11",
72
+ "tslib": "^2.4.0",
73
+ "typescript": "^4.7.4",
74
+ "vite": "^2.9.9",
75
+ "vite-plugin-eslint": "^1.6.1",
76
+ "vue": "^3.2.37",
77
+ "vue-tsc": "^0.38.2"
78
+ }
79
+ }