narrat 0.8.4 → 0.8.5
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.esm.js +8 -4
- package/lib/index.js +8 -4
- package/lib/store.d.ts +2 -1
- package/lib/utils/randomId.d.ts +1 -0
- package/lib/vm/renpy-vm.d.ts +3 -2
- package/package.json +1 -1
package/lib/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Version: 0.8.
|
|
1
|
+
// Version: 0.8.5 - June 4, 2022 20:05:21
|
|
2
2
|
import 'es6-promise/auto';
|
|
3
3
|
import { ref, reactive, readonly, defineComponent, openBlock, createElementBlock, normalizeStyle, createElementVNode, createCommentVNode, Fragment, renderList, createBlock, Transition, withCtx, renderSlot, createTextVNode, resolveComponent, toDisplayString, TransitionGroup, createVNode, createApp } from 'vue';
|
|
4
4
|
import { createLogger, createStore } from 'vuex';
|
|
@@ -4748,7 +4748,7 @@ function render$9(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
4748
4748
|
default: withCtx(() => [
|
|
4749
4749
|
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.dialog, (dialog, i) => {
|
|
4750
4750
|
return (openBlock(), createBlock(_component_DialogBox, {
|
|
4751
|
-
key:
|
|
4751
|
+
key: dialog.id,
|
|
4752
4752
|
options: _ctx.getDialogBoxOptions(dialog, i),
|
|
4753
4753
|
active: _ctx.isDialogActive(i)
|
|
4754
4754
|
}, null, 8, ["options", "active"]))
|
|
@@ -5611,6 +5611,10 @@ function detectIndentation(ctx, script) {
|
|
|
5611
5611
|
return result[1].length;
|
|
5612
5612
|
}
|
|
5613
5613
|
|
|
5614
|
+
function randomId() {
|
|
5615
|
+
return `${Date.now() - Math.floor(Math.random() * 99999999)}`;
|
|
5616
|
+
}
|
|
5617
|
+
|
|
5614
5618
|
let key = Symbol('Store Injection Key');
|
|
5615
5619
|
let store;
|
|
5616
5620
|
function setupStore(options) {
|
|
@@ -5824,7 +5828,7 @@ function setupStore(options) {
|
|
|
5824
5828
|
state.hudStats[stat] += amount;
|
|
5825
5829
|
},
|
|
5826
5830
|
addDialog(state, payload) {
|
|
5827
|
-
state.dialog.push(payload.dialog);
|
|
5831
|
+
state.dialog.push({ ...payload.dialog, id: randomId() });
|
|
5828
5832
|
},
|
|
5829
5833
|
nextLine(state) {
|
|
5830
5834
|
state.machine.stack[state.machine.stack.length - 1].currentIndex += 1;
|
|
@@ -5926,7 +5930,7 @@ async function startApp(config, options) {
|
|
|
5926
5930
|
mousePos.x = e.clientX;
|
|
5927
5931
|
mousePos.y = e.clientY;
|
|
5928
5932
|
});
|
|
5929
|
-
console.log('%c Narrat game engine – 0.8.
|
|
5933
|
+
console.log('%c Narrat game engine – 0.8.5 - June 4, 2022 20:05:21', 'background: #222; color: #bada55');
|
|
5930
5934
|
const storeSetup = setupStore(options);
|
|
5931
5935
|
store$1 = storeSetup.store;
|
|
5932
5936
|
app = createApp(script$9, {
|
package/lib/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Version: 0.8.
|
|
1
|
+
// Version: 0.8.5 - June 4, 2022 20:05:21
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
@@ -4752,7 +4752,7 @@ function render$9(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
4752
4752
|
default: vue.withCtx(() => [
|
|
4753
4753
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.dialog, (dialog, i) => {
|
|
4754
4754
|
return (vue.openBlock(), vue.createBlock(_component_DialogBox, {
|
|
4755
|
-
key:
|
|
4755
|
+
key: dialog.id,
|
|
4756
4756
|
options: _ctx.getDialogBoxOptions(dialog, i),
|
|
4757
4757
|
active: _ctx.isDialogActive(i)
|
|
4758
4758
|
}, null, 8, ["options", "active"]))
|
|
@@ -5615,6 +5615,10 @@ function detectIndentation(ctx, script) {
|
|
|
5615
5615
|
return result[1].length;
|
|
5616
5616
|
}
|
|
5617
5617
|
|
|
5618
|
+
function randomId() {
|
|
5619
|
+
return `${Date.now() - Math.floor(Math.random() * 99999999)}`;
|
|
5620
|
+
}
|
|
5621
|
+
|
|
5618
5622
|
let key = Symbol('Store Injection Key');
|
|
5619
5623
|
let store;
|
|
5620
5624
|
function setupStore(options) {
|
|
@@ -5828,7 +5832,7 @@ function setupStore(options) {
|
|
|
5828
5832
|
state.hudStats[stat] += amount;
|
|
5829
5833
|
},
|
|
5830
5834
|
addDialog(state, payload) {
|
|
5831
|
-
state.dialog.push(payload.dialog);
|
|
5835
|
+
state.dialog.push({ ...payload.dialog, id: randomId() });
|
|
5832
5836
|
},
|
|
5833
5837
|
nextLine(state) {
|
|
5834
5838
|
state.machine.stack[state.machine.stack.length - 1].currentIndex += 1;
|
|
@@ -5930,7 +5934,7 @@ async function startApp(config, options) {
|
|
|
5930
5934
|
mousePos.x = e.clientX;
|
|
5931
5935
|
mousePos.y = e.clientY;
|
|
5932
5936
|
});
|
|
5933
|
-
console.log('%c Narrat game engine – 0.8.
|
|
5937
|
+
console.log('%c Narrat game engine – 0.8.5 - June 4, 2022 20:05:21', 'background: #222; color: #bada55');
|
|
5934
5938
|
const storeSetup = setupStore(options);
|
|
5935
5939
|
store$1 = storeSetup.store;
|
|
5936
5940
|
app = vue.createApp(script$9, {
|
package/lib/store.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { InjectionKey, State } from 'vue';
|
|
2
2
|
import { Store } from 'vuex';
|
|
3
|
-
import { MachineStack } from './types/vuex';
|
|
3
|
+
import { DialogKey, MachineStack } from './types/vuex';
|
|
4
4
|
import { AppOptions } from '.';
|
|
5
|
+
export declare type AddDialogParams = Omit<DialogKey, 'id'>;
|
|
5
6
|
export interface SetupStoreResult {
|
|
6
7
|
store: Store<State>;
|
|
7
8
|
key: InjectionKey<Store<State>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function randomId(): string;
|
package/lib/vm/renpy-vm.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { ActionContext, Commit } from 'vuex';
|
|
2
2
|
import { State } from 'vue';
|
|
3
|
-
import {
|
|
3
|
+
import { DialogChoice } from '@/types/vuex';
|
|
4
|
+
import { AddDialogParams } from '@/store';
|
|
4
5
|
export declare function runLine(context: ActionContext<State, State>): Promise<void>;
|
|
5
6
|
export declare function runCommand(context: ActionContext<State, State>, cmd: Parser.Command, choices?: DialogChoice[]): Promise<any>;
|
|
6
7
|
export declare function playerAnswered(context: ActionContext<State, State>, choiceIndex: number): Promise<void>;
|
|
7
8
|
export declare function runChoice(context: ActionContext<State, State>, cmd: Parser.Command): Promise<void>;
|
|
8
|
-
export declare function textCommand(commit: Commit, dialog:
|
|
9
|
+
export declare function textCommand(commit: Commit, dialog: AddDialogParams): Promise<void>;
|
|
9
10
|
export declare function nextLine(ctx: ActionContext<State, State>): Promise<any>;
|
|
10
11
|
export declare function finishGame({ commit, state }: ActionContext<State, State>): void;
|