narrat 0.11.0 → 0.11.1

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/index.d.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  import 'es6-promise/auto';
2
2
  import './/sass/main.css';
3
+ import { App, State } from 'vue';
3
4
  import './lib';
4
5
  import { GameConfig } from './types/app-types';
6
+ import { Store } from 'vuex';
5
7
  import * as plugins from './plugins';
6
8
  import * as display from './display';
7
9
  import * as config from './config';
@@ -10,6 +12,16 @@ export interface AppOptions {
10
12
  debug: boolean;
11
13
  }
12
14
  export declare function startApp(config: GameConfig, options: AppOptions): Promise<void>;
15
+ export declare type Narrat = {
16
+ store: Store<State>;
17
+ app: App;
18
+ state: State;
19
+ };
20
+ declare global {
21
+ export interface Window {
22
+ narrat: Narrat;
23
+ }
24
+ }
13
25
  export { plugins, config, display };
14
26
  declare const _default: {
15
27
  startApp: typeof startApp;
package/lib/index.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- // Version: 0.11.0 - June 15, 2022 15:25:13
1
+ // Version: 0.11.1 - June 15, 2022 15:34:03
2
2
  import 'es6-promise/auto';
3
3
  import { ref, reactive, readonly, defineComponent, openBlock, createElementBlock, normalizeStyle, createElementVNode, createCommentVNode, Fragment, renderList, normalizeClass, createBlock, Transition, withCtx, renderSlot, createTextVNode, resolveComponent, withDirectives, vModelText, toDisplayString, TransitionGroup, createVNode, createApp } from 'vue';
4
4
  import { createLogger, createStore } from 'vuex';
@@ -8772,7 +8772,7 @@ async function startApp(config, options) {
8772
8772
  logManager.setupDebugger(options.debug);
8773
8773
  const configFile = await getFile('data/config.json');
8774
8774
  setConfig(JSON.parse(configFile));
8775
- console.log('%c Narrat game engine – 0.11.0 - June 15, 2022 15:25:13', 'background: #222; color: #bada55');
8775
+ console.log('%c Narrat game engine – 0.11.1 - June 15, 2022 15:34:03', 'background: #222; color: #bada55');
8776
8776
  vm$1.callHook('onNarratSetup');
8777
8777
  const storeSetup = setupStore(options);
8778
8778
  store$2 = storeSetup.store;
package/lib/index.js CHANGED
@@ -1,4 +1,4 @@
1
- // Version: 0.11.0 - June 15, 2022 15:25:13
1
+ // Version: 0.11.1 - June 15, 2022 15:34:03
2
2
  'use strict';
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -8776,7 +8776,7 @@ async function startApp(config, options) {
8776
8776
  logManager.setupDebugger(options.debug);
8777
8777
  const configFile = await getFile('data/config.json');
8778
8778
  setConfig(JSON.parse(configFile));
8779
- console.log('%c Narrat game engine – 0.11.0 - June 15, 2022 15:25:13', 'background: #222; color: #bada55');
8779
+ console.log('%c Narrat game engine – 0.11.1 - June 15, 2022 15:34:03', 'background: #222; color: #bada55');
8780
8780
  vm$1.callHook('onNarratSetup');
8781
8781
  const storeSetup = setupStore(options);
8782
8782
  store$2 = storeSetup.store;
@@ -1,4 +1,4 @@
1
- import { NarratPluginObject } from '@/types/narrat';
1
+ import { NarratPluginObject } from '@/plugins';
2
2
  export declare class NarratPlugin implements NarratPluginObject {
3
3
  onPageLoaded(): void;
4
4
  onNarratSetup(): void;
package/lib/plugins.d.ts CHANGED
@@ -1,9 +1,22 @@
1
1
  import { State } from 'vue';
2
2
  import { ActionContext } from 'vuex';
3
3
  import { NarratPlugin } from './plugins/NarratPlugin';
4
- import { NarratPluginObject } from './types/narrat';
5
- import { CommandPlugin, CommandRunner, generateParser } from './vm/commands/command-plugin';
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
+ };
6
18
  declare function registerPlugin(plugin: NarratPluginObject): void;
7
19
  declare function addCommand(command: CommandPlugin): void;
8
20
  export declare type NarratActionContext = ActionContext<State, State>;
9
- export { CommandPlugin, CommandRunner, NarratPluginObject, NarratPlugin, registerPlugin, addCommand, generateParser, };
21
+ export { CommandRunner };
22
+ export { CommandPlugin, NarratPluginObject, NarratPlugin, registerPlugin, addCommand, generateParser, };
package/lib/vm/vm.d.ts CHANGED
@@ -2,7 +2,7 @@ import { ActionContext } from 'vuex';
2
2
  import { State } from 'vue';
3
3
  import { DialogChoice } from '@/types/vuex';
4
4
  import { CommandPlugin } from './commands/command-plugin';
5
- import { NarratPluginObject } from '@/types/narrat';
5
+ import { NarratPluginObject } from '@/plugins';
6
6
  export declare function runLine(context: ActionContext<State, State>): Promise<void>;
7
7
  export declare class VM {
8
8
  plugins: NarratPluginObject[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "narrat",
3
- "version": "0.11.0",
3
+ "version": "0.11.1",
4
4
  "description": "narrat narrative engine",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.esm.js",