narrat 0.11.3 → 0.11.6

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/app.vue.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import { PropType } from 'vue';
2
- import { DialogKey } from './types/vuex';
2
+ import { DialogKey } from './types/state';
3
3
  import { DialogBoxParameters } from './types/dialog-box-types';
4
4
  import { GameConfig } from './types/app-types';
5
5
  import { AppOptions } from '.';
6
+ import { Parser } from './types/parser';
6
7
  declare const _default: import("vue").DefineComponent<{
7
8
  config: PropType<GameConfig>;
8
9
  options: PropType<AppOptions>;
@@ -1,5 +1,5 @@
1
1
  import { SkillData } from '@/config';
2
- import { SkillsState } from '@/types/vuex';
2
+ import { SkillsState } from '@/types/state';
3
3
  declare const _default: import("vue").DefineComponent<{
4
4
  close: any;
5
5
  }, unknown, {
@@ -1,5 +1,5 @@
1
- import { SkillCheckState, SkillsState } from '@/types/vuex';
2
- import { ErrorState } from 'vue';
1
+ import { ErrorState, SkillCheckState, SkillsState } from '@/types/state';
2
+ import { Parser } from '@/types/parser';
3
3
  declare const _default: import("vue").DefineComponent<{}, {}, {
4
4
  showDebug: boolean;
5
5
  jumping: boolean;
@@ -1,5 +1,5 @@
1
1
  import { HudStatConfig } from '@/config';
2
- import { HudStatsState } from 'vue';
2
+ import { HudStatsState } from '@/types/state';
3
3
  declare const _default: import("vue").DefineComponent<{}, {}, void, {
4
4
  statsConfig(): {
5
5
  [key: string]: HudStatConfig;
@@ -1,4 +1,4 @@
1
- import { NotificationState } from 'vue';
1
+ import { NotificationState } from '@/types/state';
2
2
  declare const _default: import("vue").DefineComponent<{}, {}, void, {
3
3
  notifications(): {
4
4
  [key: string]: NotificationState;
@@ -1,7 +1,7 @@
1
1
  import { PropType } from 'vue';
2
2
  import { DialogStyle } from './types/character-types';
3
3
  import { DialogBoxParameters } from './types/dialog-box-types';
4
- import { DialogChoice } from './types/vuex';
4
+ import { DialogChoice } from './types/state';
5
5
  declare const _default: import("vue").DefineComponent<{
6
6
  options: {
7
7
  type: PropType<DialogBoxParameters>;
@@ -1,8 +1,8 @@
1
- import { State } from 'vue';
2
1
  import { ActionContext } from 'vuex';
3
2
  import { NarratPlugin } from '../plugins/NarratPlugin';
4
3
  import { CommandPlugin, generateParser } from '../vm/commands/command-plugin';
5
4
  import type { CommandRunner } from '../vm/commands/command-plugin';
5
+ import { NarratState } from '../types/state';
6
6
  export declare type NarratLifecycleHook = <T extends [...any[]]>(...args: T) => void;
7
7
  declare type NarratPluginObject = {
8
8
  onPageLoaded?: NarratLifecycleHook;
@@ -17,6 +17,6 @@ declare type NarratPluginObject = {
17
17
  };
18
18
  declare function registerPlugin(plugin: NarratPluginObject): void;
19
19
  declare function addCommand(command: CommandPlugin): void;
20
- export declare type NarratActionContext = ActionContext<State, State>;
20
+ export declare type NarratActionContext = ActionContext<NarratState, NarratState>;
21
21
  export { CommandRunner };
22
22
  export { CommandPlugin, NarratPluginObject, NarratPlugin, registerPlugin, addCommand, generateParser, };
package/lib/index.d.ts CHANGED
@@ -1,17 +1,18 @@
1
1
  import 'es6-promise/auto';
2
2
  import './/sass/main.css';
3
- import { App, State } from 'vue';
3
+ import { App } from 'vue';
4
4
  import { GameConfig } from './types/app-types';
5
5
  import { Store } from 'vuex';
6
+ import { NarratState } from './types/state';
6
7
  export interface AppOptions {
7
8
  logging: boolean;
8
9
  debug: boolean;
9
10
  }
10
11
  export declare function startApp(config: GameConfig, options: AppOptions): Promise<void>;
11
12
  export declare type Narrat = {
12
- store: Store<State>;
13
+ store: Store<NarratState>;
13
14
  app: App;
14
- state: State;
15
+ state: NarratState;
15
16
  };
16
17
  declare global {
17
18
  export interface Window {
package/lib/index.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- // Version: 0.11.3 - June 15, 2022 16:22:12
1
+ // Version: 0.11.6 - June 15, 2022 16:58:57
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';
@@ -8000,7 +8000,7 @@ function setupStore(options) {
8000
8000
  mutations: {
8001
8001
  setLoadedData(state, save) {
8002
8002
  state.machine.data = save.data;
8003
- state.skills = cjs(state.skillChecks, save.skills);
8003
+ state.skills = cjs(state.skills, save.skills);
8004
8004
  state.dialog = save.dialog;
8005
8005
  state.buttons = cjs(state.buttons, save.buttons);
8006
8006
  state.lastLabel = save.lastLabel;
@@ -8751,7 +8751,7 @@ async function startApp(config, options) {
8751
8751
  logManager.setupDebugger(options.debug);
8752
8752
  const configFile = await getFile('data/config.json');
8753
8753
  setConfig(JSON.parse(configFile));
8754
- console.log('%c Narrat game engine – 0.11.3 - June 15, 2022 16:22:12', 'background: #222; color: #bada55');
8754
+ console.log('%c Narrat game engine – 0.11.6 - June 15, 2022 16:58:57', 'background: #222; color: #bada55');
8755
8755
  vm$1.callHook('onNarratSetup');
8756
8756
  const storeSetup = setupStore(options);
8757
8757
  store$2 = storeSetup.store;
package/lib/index.js CHANGED
@@ -1,4 +1,4 @@
1
- // Version: 0.11.3 - June 15, 2022 16:22:12
1
+ // Version: 0.11.6 - June 15, 2022 16:58:57
2
2
  'use strict';
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -8004,7 +8004,7 @@ function setupStore(options) {
8004
8004
  mutations: {
8005
8005
  setLoadedData(state, save) {
8006
8006
  state.machine.data = save.data;
8007
- state.skills = cjs(state.skillChecks, save.skills);
8007
+ state.skills = cjs(state.skills, save.skills);
8008
8008
  state.dialog = save.dialog;
8009
8009
  state.buttons = cjs(state.buttons, save.buttons);
8010
8010
  state.lastLabel = save.lastLabel;
@@ -8755,7 +8755,7 @@ async function startApp(config, options) {
8755
8755
  logManager.setupDebugger(options.debug);
8756
8756
  const configFile = await getFile('data/config.json');
8757
8757
  setConfig(JSON.parse(configFile));
8758
- console.log('%c Narrat game engine – 0.11.3 - June 15, 2022 16:22:12', 'background: #222; color: #bada55');
8758
+ console.log('%c Narrat game engine – 0.11.6 - June 15, 2022 16:58:57', 'background: #222; color: #bada55');
8759
8759
  vm$1.callHook('onNarratSetup');
8760
8760
  const storeSetup = setupStore(options);
8761
8761
  store$2 = storeSetup.store;
@@ -1,4 +1,4 @@
1
- import { NarratPluginObject } from '@/exports/plugins';
1
+ import { NarratPluginObject } from '../exports/plugins';
2
2
  export declare class NarratPlugin implements NarratPluginObject {
3
3
  onPageLoaded(): void;
4
4
  onNarratSetup(): void;
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';
4
3
  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>;
@@ -1,4 +1,4 @@
1
- import { DialogChoice } from './vuex';
1
+ import { DialogChoice } from './state';
2
2
  export interface DialogBoxParameters {
3
3
  title: string;
4
4
  text: string;
@@ -1,5 +1,4 @@
1
- import { ButtonsState, HudStatsState } from 'vue';
2
- import { DataState, DialogKey, SkillCheckState, SkillsState } from './vuex';
1
+ import { ButtonsState, HudStatsState, DataState, DialogKey, SkillCheckState, SkillsState } from './state';
3
2
  export interface GameSave {
4
3
  data: DataState;
5
4
  skills: SkillsState;
@@ -1,4 +1,4 @@
1
- declare namespace Parser {
1
+ export declare namespace Parser {
2
2
  interface IfOptions {
3
3
  condition: string;
4
4
  success: Branch;
@@ -43,9 +43,6 @@ declare namespace Parser {
43
43
  interface WaitOptions {
44
44
  duration: number;
45
45
  }
46
- interface IfOptions {
47
- branch: Branch;
48
- }
49
46
  interface TextOptions {
50
47
  text: string;
51
48
  }
@@ -0,0 +1,99 @@
1
+ import { AppOptions } from '..';
2
+ import { Parser } from './parser';
3
+ export declare type DialogCallback = (choice: number) => void;
4
+ export interface MachineStack {
5
+ currentIndex: number;
6
+ branch: Parser.Branch;
7
+ label: string;
8
+ }
9
+ export interface DialogKey {
10
+ speaker: string;
11
+ text: string;
12
+ pose?: string;
13
+ choices?: DialogChoice[];
14
+ interactive: boolean;
15
+ id: string;
16
+ }
17
+ export interface DialogChoice {
18
+ choice: string;
19
+ originalIndex: number;
20
+ allowed: boolean;
21
+ }
22
+ export interface SkillState {
23
+ level: number;
24
+ xp: number;
25
+ }
26
+ export interface SkillsState {
27
+ [key: string]: SkillState;
28
+ }
29
+ export interface DataState {
30
+ [key: string]: any;
31
+ }
32
+ export interface SkillCheckState {
33
+ passed: boolean;
34
+ available: boolean;
35
+ }
36
+ export interface Vue {
37
+ $mq: 'sm' | 'md' | 'lg';
38
+ }
39
+ export interface NarratState {
40
+ machine: {
41
+ stack: MachineStack[];
42
+ script: Parser.ParsedScript;
43
+ data: DataState;
44
+ };
45
+ skillChecks: {
46
+ [key: string]: SkillCheckState;
47
+ };
48
+ buttons: ButtonsState;
49
+ dialog: DialogKey[];
50
+ count: number;
51
+ ready: boolean;
52
+ skills: SkillsState;
53
+ lastLabel: string;
54
+ playing: boolean;
55
+ currentScreen: string;
56
+ rendering: RenderingState;
57
+ hudStats: HudStatsState;
58
+ audio: {
59
+ currentMusic?: string;
60
+ musicHowlId?: number;
61
+ };
62
+ errors: ErrorState[];
63
+ playTime: {
64
+ start: number;
65
+ previousPlaytime: number;
66
+ };
67
+ notifications: {
68
+ [key: string]: NotificationState;
69
+ };
70
+ options: AppOptions;
71
+ flowState: 'menu' | 'playing';
72
+ openModal: string | false;
73
+ paused: boolean;
74
+ }
75
+ export interface HudStatsState {
76
+ [key: string]: HudStat;
77
+ }
78
+ export declare type HudStat = number;
79
+ export interface NotificationState {
80
+ text: string;
81
+ }
82
+ export interface ButtonsState {
83
+ [key: string]: {
84
+ enabled: boolean;
85
+ };
86
+ }
87
+ export interface RenderingState {
88
+ screenWidth: number;
89
+ screenHeight: number;
90
+ canvasWidth: number;
91
+ canvasHeight: number;
92
+ renderRatio: number;
93
+ topOffset: number;
94
+ leftOffset: number;
95
+ layoutMode: 'horizontal' | 'vertical';
96
+ }
97
+ export interface ErrorState {
98
+ text: string;
99
+ }
@@ -3,7 +3,7 @@ export declare function findDataHelper<T>(sourceObj: any, path: string): [T, str
3
3
  export declare function setDataHelper<T>(sourceObj: any, path: string, value: T): void;
4
4
  export declare function addDataHelper<T>(sourceObj: any, path: string, value: T): void;
5
5
  export declare function getModifiableData(state: State): {
6
- data: import("../types/vuex").DataState;
7
- skills: import("../types/vuex").SkillsState;
8
- buttons: import("vue").ButtonsState;
6
+ data: import("../types/state").DataState;
7
+ skills: import("../types/state").SkillsState;
8
+ buttons: import("../types/state").ButtonsState;
9
9
  };
@@ -1,5 +1,5 @@
1
1
  import { SkillCheckParams } from '@/vm/vm-helpers';
2
- import { SkillCheckState } from '@/types/vuex';
2
+ import { SkillCheckState } from '@/types/state';
3
3
  import { State } from 'vue';
4
4
  import { ActionContext } from 'vuex';
5
5
  export declare function createSkillCheckState(): SkillCheckState;
@@ -1,6 +1,7 @@
1
1
  import { State } from 'vue';
2
2
  import { ActionContext } from 'vuex';
3
3
  import { CommandPlugin, CommandRunner } from './command-plugin';
4
+ import { Parser } from '@/types/parser';
4
5
  export declare const choice: CommandRunner;
5
6
  export declare function runChoice(context: ActionContext<State, State>, cmd: Parser.Command): Promise<void>;
6
7
  export declare const choicePlugin: CommandPlugin;
@@ -1,8 +1,8 @@
1
- import { DialogChoice } from '@/types/vuex';
2
- import { State } from 'vue';
1
+ import { Parser } from '../../types/parser';
2
+ import { DialogChoice, NarratState } from '../../types/state';
3
3
  import { ActionContext } from 'vuex';
4
4
  import { ParserContext } from '../vm-parser';
5
- export declare type CommandRunner = (context: ActionContext<State, State>, cmd: Parser.Command, choices?: DialogChoice[]) => Promise<void>;
5
+ export declare type CommandRunner = (context: ActionContext<NarratState, NarratState>, cmd: Parser.Command, choices?: DialogChoice[]) => Promise<void>;
6
6
  export declare type CommandParserFunction = (ctx: CommandParsingContext) => void;
7
7
  export declare type ProcessCommandsFunction = (ctx: ParserContext, lines: Parser.Line[], parentLine: Parser.Line | undefined) => Parser.Branch;
8
8
  export interface CommandParsingContext {
@@ -1,4 +1,5 @@
1
1
  import { AddDialogParams } from '@/store';
2
+ import { Parser } from '@/types/parser';
2
3
  import { State } from 'vue';
3
4
  import { ActionContext, Commit } from 'vuex';
4
5
  export declare function processSkillCheck(ctx: ActionContext<State, State>, skillcheck: Parser.SkillCheckOptions): boolean;
@@ -1,3 +1,4 @@
1
+ import { Parser } from '../types/parser';
1
2
  import { ProcessCommandsFunction } from './commands/command-plugin';
2
3
  export declare type ParserErrorHandler = (ctx: ParserContext, line: number, text: string) => void;
3
4
  export interface ParserContext {
package/lib/vm/vm.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import { ActionContext } from 'vuex';
2
2
  import { State } from 'vue';
3
- import { DialogChoice } from '@/types/vuex';
3
+ import { DialogChoice } from '@/types/state';
4
4
  import { CommandPlugin } from './commands/command-plugin';
5
5
  import { NarratPluginObject } from '@/exports/plugins';
6
+ import { Parser } from '@/types/parser';
6
7
  export declare function runLine(context: ActionContext<State, State>): Promise<void>;
7
8
  export declare class VM {
8
9
  plugins: NarratPluginObject[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "narrat",
3
- "version": "0.11.3",
3
+ "version": "0.11.6",
4
4
  "description": "narrat narrative engine",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.esm.js",