narrat 1.3.0 → 1.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.
@@ -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,12 +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>;
230
- runLabelFunction(label: string): Promise<void>;
232
+ runLabelFunction(label: string, comeBackToSameLine?: boolean): Promise<void>;
231
233
  runLabel(label: string): void;
232
234
  }>;
233
235
  hud: import("pinia").Store<"hud", import("./hud-stats-store").HudState, {}, {
@@ -262,6 +264,11 @@ export declare const useMain: import("pinia").StoreDefinition<"main", MainState,
262
264
  getExistingItem(id: string): import("./inventory-store").ItemState;
263
265
  getItemAmount(id: string): number;
264
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;
265
272
  remove(item: import("./inventory-store").ItemState): void;
266
273
  deleteItem(id: string): void;
267
274
  }>;
@@ -142,11 +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): Promise<void>;
150
+ runLabelFunction(label: string, comeBackToSameLine?: boolean): Promise<void>;
151
151
  runLabel(label: string): void;
152
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "narrat",
3
- "version": "1.3.0",
3
+ "version": "1.3.3",
4
4
  "description": "narrat narrative engine",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.esm.js",
@@ -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/lib.d.ts DELETED
@@ -1,6 +0,0 @@
1
- /// <reference types="@/types/character-types" />
2
- /// <reference types="@/types/config" />
3
- /// <reference types="@/types/dialog-box-types" />
4
- /// <reference types="@/types/parser" />
5
- /// <reference types="@/types/vuex" />
6
- export declare const lib: {};
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, };
@@ -1,14 +0,0 @@
1
- import { ParserContext } from './renpy-parser';
2
- export declare type CommandParserFunction = (ctx: CommandParsingContext) => void;
3
- export declare type ProcessCommandsFunction = (ctx: ParserContext, lines: Parser.Line[], parentLine: Parser.Line | undefined) => Parser.Branch;
4
- export interface CommandParsingContext {
5
- parserContext: ParserContext;
6
- processCommandsFunction: ProcessCommandsFunction;
7
- line: Parser.Line;
8
- command: Partial<Parser.Command>;
9
- lines: Parser.Line[];
10
- currentLine: number;
11
- }
12
- export declare const parserFunctions: {
13
- [key: string]: CommandParserFunction;
14
- };
@@ -1,14 +0,0 @@
1
- import { State } from 'vue';
2
- import { ActionContext } from 'vuex';
3
- export declare function processSkillCheck(ctx: ActionContext<State, State>, skillcheck: Parser.SkillCheckOptions): boolean;
4
- export interface SkillCheckParams {
5
- skill: string;
6
- value: number;
7
- id: string;
8
- success?: string;
9
- failure?: string;
10
- }
11
- export declare function runSkillCheck(ctx: ActionContext<State, State>, params: SkillCheckParams): boolean;
12
- export declare function runConditionCommand(ctx: ActionContext<State, State>, command: Parser.Command): Parser.Branch | undefined;
13
- export declare function writeText(ctx: ActionContext<State, State>, text: string): void;
14
- export declare function runCondition(ctx: ActionContext<State, State>, condition: string): boolean;
@@ -1,9 +0,0 @@
1
- import { ProcessCommandsFunction } from './command-parser-functions';
2
- export declare type ParserErrorHandler = (ctx: ParserContext, line: number, text: string) => void;
3
- export interface ParserContext {
4
- fileName: string;
5
- error: (line: number, text: string) => void;
6
- processCommandsFunction: ProcessCommandsFunction;
7
- indentSize: number;
8
- }
9
- export declare function parseRenpyScript(errorHandler: ParserErrorHandler, code: string, fileName: string): Parser.ParsedScript;
package/lib/store.d.ts DELETED
@@ -1,12 +0,0 @@
1
- import { InjectionKey, State } from 'vue';
2
- import { Store } from 'vuex';
3
- import { AppOptions } from '.';
4
- import { DialogKey, MachineStack } from './types/state';
5
- export declare type AddDialogParams = Omit<DialogKey, 'id'>;
6
- export interface SetupStoreResult {
7
- store: Store<State>;
8
- key: InjectionKey<Store<State>>;
9
- }
10
- export declare type AddStackOptions = Partial<MachineStack>;
11
- export declare function setupStore(options: AppOptions): SetupStoreResult;
12
- export declare function useStore(): Store<State>;
@@ -1,2 +0,0 @@
1
- import { CommandPlugin } from './command-plugin';
2
- export declare const addItemPlugin: CommandPlugin;
@@ -1,2 +0,0 @@
1
- import { CommandPlugin } from './command-plugin';
2
- export declare const removeItemPlugin: CommandPlugin;
@@ -1,11 +0,0 @@
1
- import { ActionContext, Commit } from 'vuex';
2
- import { State } from 'vue';
3
- import { DialogChoice } from '@/types/vuex';
4
- import { AddDialogParams } from '@/store';
5
- export declare function runLine(context: ActionContext<State, State>): Promise<void>;
6
- export declare function runCommand(context: ActionContext<State, State>, cmd: Parser.Command, choices?: DialogChoice[]): Promise<any>;
7
- export declare function playerAnswered(context: ActionContext<State, State>, choiceIndex: number): Promise<void>;
8
- export declare function runChoice(context: ActionContext<State, State>, cmd: Parser.Command): Promise<void>;
9
- export declare function textCommand(commit: Commit, dialog: AddDialogParams): Promise<void>;
10
- export declare function nextLine(ctx: ActionContext<State, State>): Promise<any>;
11
- export declare function finishGame({ commit, state }: ActionContext<State, State>): void;