narrat 1.2.1 → 1.3.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.
package/lib/store.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { InjectionKey, State } from 'vue';
2
2
  import { Store } from 'vuex';
3
+ import { DialogKey, MachineStack } from './types/vuex';
3
4
  import { AppOptions } from '.';
4
- import { DialogKey, MachineStack } from './types/state';
5
5
  export declare type AddDialogParams = Omit<DialogKey, 'id'>;
6
6
  export interface SetupStoreResult {
7
7
  store: Store<State>;
@@ -18,7 +18,9 @@ declare type DialogState = {
18
18
  dialog: DialogKey[];
19
19
  };
20
20
  export declare type DialogSave = DialogState;
21
- export declare const useDialogStore: import("pinia").StoreDefinition<"dialog", DialogState, {}, {
21
+ export declare const useDialogStore: import("pinia").StoreDefinition<"dialog", DialogState, {
22
+ currentDialog(): DialogKey;
23
+ }, {
22
24
  generateSaveData(): DialogSave;
23
25
  loadSaveData(data: DialogSave): void;
24
26
  addDialog(dialog: AddDialogParams): void;
@@ -10,6 +10,11 @@ export interface InventoryState {
10
10
  items: {
11
11
  [key: string]: ItemState;
12
12
  };
13
+ interactionTags: {
14
+ [key: string]: {
15
+ blockedInteraction: boolean;
16
+ };
17
+ };
13
18
  }
14
19
  export declare type InventorySave = InventoryState;
15
20
  export declare const useInventory: import("pinia").StoreDefinition<"inventory", InventoryState, {}, {
@@ -21,6 +26,11 @@ export declare const useInventory: import("pinia").StoreDefinition<"inventory",
21
26
  getExistingItem(id: string): ItemState | undefined;
22
27
  getItemAmount(id: string): number;
23
28
  add(item: ItemState): void;
29
+ enableInteraction(tag?: string): void;
30
+ disableInteraction(tag?: string): void;
31
+ onScriptStart(): void;
32
+ onScriptEnd(): void;
33
+ isInteractionTagBlocked(tag?: string): boolean;
24
34
  remove(item: ItemState): void;
25
35
  deleteItem(id: string): void;
26
36
  }>;
@@ -87,7 +87,9 @@ export declare const useMain: import("pinia").StoreDefinition<"main", MainState,
87
87
  }>;
88
88
  dialog: import("pinia").Store<"dialog", {
89
89
  dialog: import("./dialog-store").DialogKey[];
90
- }, {}, {
90
+ }, {
91
+ currentDialog(): import("./dialog-store").DialogKey;
92
+ }, {
91
93
  generateSaveData(): {
92
94
  dialog: import("./dialog-store").DialogKey[];
93
95
  };
@@ -222,11 +224,12 @@ export declare const useMain: import("pinia").StoreDefinition<"main", MainState,
222
224
  setStack(stack: import("./vm-store").MachineStack): void;
223
225
  setData(path: string, value: any): void;
224
226
  addInstruction(path: string, value: any): void;
225
- addStack(newStack: Partial<import("./vm-store").MachineStack>): void;
227
+ addStack(newStack: Partial<import("./vm-store").MachineStack>): Promise<void>;
226
228
  nextLine(): Promise<any>;
227
229
  previousStack(): void;
228
230
  finishGame(): void;
229
231
  runLine(): Promise<void>;
232
+ runLabelFunction(label: string, comeBackToSameLine?: boolean): Promise<void>;
230
233
  runLabel(label: string): void;
231
234
  }>;
232
235
  hud: import("pinia").Store<"hud", import("./hud-stats-store").HudState, {}, {
@@ -261,6 +264,11 @@ export declare const useMain: import("pinia").StoreDefinition<"main", MainState,
261
264
  getExistingItem(id: string): import("./inventory-store").ItemState;
262
265
  getItemAmount(id: string): number;
263
266
  add(item: import("./inventory-store").ItemState): void;
267
+ enableInteraction(tag?: string): void;
268
+ disableInteraction(tag?: string): void;
269
+ onScriptStart(): void;
270
+ onScriptEnd(): void;
271
+ isInteractionTagBlocked(tag?: string): boolean;
264
272
  remove(item: import("./inventory-store").ItemState): void;
265
273
  deleteItem(id: string): void;
266
274
  }>;
@@ -142,10 +142,11 @@ export declare const useVM: import("pinia").StoreDefinition<"vm", VMState, {
142
142
  setStack(stack: MachineStack): void;
143
143
  setData(path: string, value: any): void;
144
144
  addInstruction(path: string, value: any): void;
145
- addStack(newStack: AddStackOptions): void;
145
+ addStack(newStack: AddStackOptions): Promise<void>;
146
146
  nextLine(): Promise<any>;
147
147
  previousStack(): void;
148
148
  finishGame(): void;
149
149
  runLine(): Promise<void>;
150
+ runLabelFunction(label: string, comeBackToSameLine?: boolean): Promise<void>;
150
151
  runLabel(label: string): void;
151
152
  }>;
@@ -0,0 +1,5 @@
1
+ import { CommandPlugin } from './command-plugin';
2
+ export declare const addItemPlugin: CommandPlugin;
3
+ export declare const removeItemPlugin: CommandPlugin;
4
+ export declare const enableInteractionPlugin: CommandPlugin;
5
+ export declare const disableInteractionPlugin: CommandPlugin;
@@ -0,0 +1,2 @@
1
+ import { CommandPlugin } from './command-plugin';
2
+ export declare const runLabelPlugin: CommandPlugin;
package/package.json CHANGED
@@ -1,85 +1,85 @@
1
- {
2
- "name": "narrat",
3
- "version": "1.2.1",
4
- "description": "narrat narrative engine",
5
- "main": "lib/index.js",
6
- "module": "lib/index.esm.js",
7
- "files": [
8
- "lib/"
9
- ],
10
- "scripts": {
11
- "test": "echo \"Error: no test specified\" && exit 1",
12
- "start": "snowpack dev",
13
- "version": "npm run build",
14
- "build": "cross-env NODE_ENV=production rollup -c",
15
- "build-demo": "snowpack build",
16
- "lint": "eslint src --ext=.js,.jsx,.ts,.tsx",
17
- "preversion": "npm run build && npm run lint",
18
- "postversion": "git push && git push --tags"
19
- },
20
- "keywords": [
21
- "game"
22
- ],
23
- "author": "Liana Pigeot <liana.pigeot@protonmail.com>",
24
- "license": "MIT",
25
- "devDependencies": {
26
- "@babel/core": "^7.12.10",
27
- "@babel/preset-env": "^7.12.11",
28
- "@rollup/plugin-commonjs": "^16.0.0",
29
- "@rollup/plugin-node-resolve": "^10.0.0",
30
- "@rollup/plugin-typescript": "^8.2.5",
31
- "@snowpack/plugin-postcss": "^1.4.3",
32
- "@snowpack/plugin-sass": "^1.4.0",
33
- "@snowpack/plugin-typescript": "^1.2.1",
34
- "@snowpack/plugin-vue": "^2.6.2",
35
- "@types/howler": "^2.2.3",
36
- "@typescript-eslint/eslint-plugin": "^4.28.3",
37
- "@typescript-eslint/parser": "^4.28.3",
38
- "@vue/compiler-sfc": "^3.0.4",
39
- "babel-loader": "^8.2.2",
40
- "babel-plugin-syntax-dynamic-import": "^6.18.0",
41
- "babel-preset-vue": "^2.0.2",
42
- "cross-env": "^7.0.3",
43
- "css-loader": "^5.0.1",
44
- "es6-promise": "^4.2.8",
45
- "eslint": "^7.30.0",
46
- "eslint-config-airbnb-base": "^14.2.1",
47
- "eslint-config-prettier": "^8.3.0",
48
- "eslint-config-standard": "^16.0.3",
49
- "eslint-import-resolver-typescript": "^2.4.0",
50
- "eslint-plugin-import": "^2.23.4",
51
- "eslint-plugin-node": "^11.1.0",
52
- "eslint-plugin-promise": "^5.1.0",
53
- "eslint-plugin-vue": "^7.13.0",
54
- "postcss": "^8.2.1",
55
- "postcss-cli": "^8.3.1",
56
- "prettier": "2.3.2",
57
- "rollup": "^2.35.1",
58
- "rollup-plugin-analyzer": "^4.0.0",
59
- "rollup-plugin-inject-process-env": "^1.3.1",
60
- "rollup-plugin-paths": "^0.0.4",
61
- "rollup-plugin-peer-deps-external": "^2.2.4",
62
- "rollup-plugin-postcss": "^4.0.0",
63
- "rollup-plugin-typescript2": "^0.30.0",
64
- "rollup-plugin-version-injector": "^1.3.0",
65
- "rollup-plugin-vue": "^6.0.0-beta.11",
66
- "snowpack": "^3.8.6",
67
- "tailwindcss": "^2.0.2",
68
- "typescript": "^4.2.3",
69
- "vue": "^3.2.37",
70
- "pinia": "^2.0.14"
71
- },
72
- "peerDependencies": {
73
- "es6-promise": "^4.2.8",
74
- "vue": "^3.2.37",
75
- "pinia": "^2.0.14"
76
- },
77
- "dependencies": {
78
- "autoprefixer": "^10.2.6",
79
- "deepmerge": "^4.2.2",
80
- "fuse.js": "^6.6.2",
81
- "howler": "^2.2.3",
82
- "svelte-jsoneditor": "^0.3.58",
83
- "vue3-mq": "^3.0.0"
84
- }
85
- }
1
+ {
2
+ "name": "narrat",
3
+ "version": "1.3.2",
4
+ "description": "narrat narrative engine",
5
+ "main": "lib/index.js",
6
+ "module": "lib/index.esm.js",
7
+ "files": [
8
+ "lib/"
9
+ ],
10
+ "scripts": {
11
+ "test": "echo \"Error: no test specified\" && exit 1",
12
+ "start": "snowpack dev",
13
+ "version": "npm run build",
14
+ "build": "cross-env NODE_ENV=production rollup -c",
15
+ "build-demo": "snowpack build",
16
+ "lint": "eslint src --ext=.js,.jsx,.ts,.tsx",
17
+ "preversion": "npm run build && npm run lint",
18
+ "postversion": "git push && git push --tags"
19
+ },
20
+ "keywords": [
21
+ "game"
22
+ ],
23
+ "author": "Liana Pigeot <liana.pigeot@protonmail.com>",
24
+ "license": "MIT",
25
+ "devDependencies": {
26
+ "@babel/core": "^7.12.10",
27
+ "@babel/preset-env": "^7.12.11",
28
+ "@rollup/plugin-commonjs": "^16.0.0",
29
+ "@rollup/plugin-node-resolve": "^10.0.0",
30
+ "@rollup/plugin-typescript": "^8.2.5",
31
+ "@snowpack/plugin-postcss": "^1.4.3",
32
+ "@snowpack/plugin-sass": "^1.4.0",
33
+ "@snowpack/plugin-typescript": "^1.2.1",
34
+ "@snowpack/plugin-vue": "^2.6.2",
35
+ "@types/howler": "^2.2.3",
36
+ "@typescript-eslint/eslint-plugin": "^4.28.3",
37
+ "@typescript-eslint/parser": "^4.28.3",
38
+ "@vue/compiler-sfc": "^3.0.4",
39
+ "babel-loader": "^8.2.2",
40
+ "babel-plugin-syntax-dynamic-import": "^6.18.0",
41
+ "babel-preset-vue": "^2.0.2",
42
+ "cross-env": "^7.0.3",
43
+ "css-loader": "^5.0.1",
44
+ "es6-promise": "^4.2.8",
45
+ "eslint": "^7.30.0",
46
+ "eslint-config-airbnb-base": "^14.2.1",
47
+ "eslint-config-prettier": "^8.3.0",
48
+ "eslint-config-standard": "^16.0.3",
49
+ "eslint-import-resolver-typescript": "^2.4.0",
50
+ "eslint-plugin-import": "^2.23.4",
51
+ "eslint-plugin-node": "^11.1.0",
52
+ "eslint-plugin-promise": "^5.1.0",
53
+ "eslint-plugin-vue": "^7.13.0",
54
+ "postcss": "^8.2.1",
55
+ "postcss-cli": "^8.3.1",
56
+ "prettier": "2.3.2",
57
+ "rollup": "^2.35.1",
58
+ "rollup-plugin-analyzer": "^4.0.0",
59
+ "rollup-plugin-inject-process-env": "^1.3.1",
60
+ "rollup-plugin-paths": "^0.0.4",
61
+ "rollup-plugin-peer-deps-external": "^2.2.4",
62
+ "rollup-plugin-postcss": "^4.0.0",
63
+ "rollup-plugin-typescript2": "^0.30.0",
64
+ "rollup-plugin-version-injector": "^1.3.0",
65
+ "rollup-plugin-vue": "^6.0.0-beta.11",
66
+ "snowpack": "^3.8.6",
67
+ "tailwindcss": "^2.0.2",
68
+ "typescript": "^4.2.3",
69
+ "vue": "^3.2.37",
70
+ "pinia": "^2.0.14"
71
+ },
72
+ "peerDependencies": {
73
+ "es6-promise": "^4.2.8",
74
+ "vue": "^3.2.37",
75
+ "pinia": "^2.0.14"
76
+ },
77
+ "dependencies": {
78
+ "autoprefixer": "^10.2.6",
79
+ "deepmerge": "^4.2.2",
80
+ "fuse.js": "^6.6.2",
81
+ "howler": "^2.2.3",
82
+ "svelte-jsoneditor": "^0.3.58",
83
+ "vue3-mq": "^3.0.0"
84
+ }
85
+ }
@@ -1,27 +0,0 @@
1
- import { NarratPlugin } from '@/index';
2
- import { CommandPlugin } from '@/vm/commands/command-plugin';
3
- import { State } from 'vue';
4
- import { ActionContext } from 'vuex';
5
- declare global {
6
- interface Window {
7
- defaultFontName: string;
8
- attachCanvas: (canvas: HTMLCanvasElement) => void;
9
- loadGame: (gameData: any, defaultFontData: any) => void;
10
- }
11
- }
12
- export declare function bitsyHacks(): void;
13
- export declare function attachBitsyGameToNarrat(): HTMLCanvasElement;
14
- export interface BitsyPluginOptions {
15
- showOnGameStart?: boolean;
16
- }
17
- export declare class BitsyPlugin extends NarratPlugin {
18
- canvas: HTMLCanvasElement;
19
- customCommands: CommandPlugin[];
20
- options: BitsyPluginOptions;
21
- oldInputs: any;
22
- onGameMounted(): void;
23
- constructor(options?: BitsyPluginOptions);
24
- showBitsyCommand({ dispatch, commit }: ActionContext<State, State>): Promise<void>;
25
- hideBitsyCommand({ dispatch, commit }: ActionContext<State, State>): Promise<any>;
26
- hideBitsy(): void;
27
- }
package/lib/display.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import { aspectRatioFit } from './utils/helpers';
2
- export { aspectRatioFit };
package/lib/plugins.d.ts DELETED
@@ -1,22 +0,0 @@
1
- import { State } from 'vue';
2
- import { ActionContext } from 'vuex';
3
- import { NarratPlugin } from './plugins/NarratPlugin';
4
- import { CommandPlugin, generateParser } from './vm/commands/command-plugin';
5
- import type { CommandRunner } from './vm/commands/command-plugin';
6
- export declare type NarratLifecycleHook = <T extends [...any[]]>(...args: T) => void;
7
- declare type NarratPluginObject = {
8
- onPageLoaded?: NarratLifecycleHook;
9
- onNarratSetup?: NarratLifecycleHook;
10
- onAppMounted?: NarratLifecycleHook;
11
- onAssetsLoaded?: NarratLifecycleHook;
12
- onGameSetup?: NarratLifecycleHook;
13
- onGameStart?: NarratLifecycleHook;
14
- onGameMounted?: NarratLifecycleHook;
15
- onGameUnmounted?: NarratLifecycleHook;
16
- customCommands?: CommandPlugin[];
17
- };
18
- declare function registerPlugin(plugin: NarratPluginObject): void;
19
- declare function addCommand(command: CommandPlugin): void;
20
- export declare type NarratActionContext = ActionContext<State, State>;
21
- export { CommandRunner };
22
- export { CommandPlugin, NarratPluginObject, NarratPlugin, registerPlugin, addCommand, generateParser, };