narrat 3.1.2 → 3.2.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/dist/config.d.ts +1 -1
- package/dist/constants.d.ts +3 -0
- package/dist/dialog-box.vue.d.ts +14 -54
- package/dist/inputs/Inputs.d.ts +41 -6
- package/dist/inputs/useNavigation.d.ts +30 -0
- package/dist/narrat.es.js +12605 -12279
- package/dist/narrat.es.js.map +1 -1
- package/dist/narrat.umd.js +106 -106
- package/dist/narrat.umd.js.map +1 -1
- package/dist/stores/gamepad-store.d.ts +11 -0
- package/dist/stores/inputs-store.d.ts +17 -8
- package/dist/style.css +1 -1
- package/package.json +3 -3
- package/dist/gamepad/gamepad.d.ts +0 -1
package/dist/config.d.ts
CHANGED
|
@@ -154,6 +154,7 @@ export declare function charactersConfig(): {
|
|
|
154
154
|
name: string;
|
|
155
155
|
}>;
|
|
156
156
|
};
|
|
157
|
+
export declare function getScreenConfig(screen: string): ScreenConfig;
|
|
157
158
|
export declare function getTooltipConfig(keyword: string): {
|
|
158
159
|
title: string;
|
|
159
160
|
description: string;
|
|
@@ -179,7 +180,6 @@ export declare function getAssetUrl(assetPath: string): string;
|
|
|
179
180
|
export declare function getSplitConfigUrl(basePath: string, url: string): string;
|
|
180
181
|
export declare function getDataUrl(dataPath: string): string;
|
|
181
182
|
export declare function getButtonConfig(button: string): ButtonConfig;
|
|
182
|
-
export declare function getScreenConfig(screen: string): ScreenConfig;
|
|
183
183
|
export declare function getItemConfig(id: string): {
|
|
184
184
|
category?: string | undefined;
|
|
185
185
|
onUse?: {
|
package/dist/constants.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ScreenConfig } from './config/screens-config';
|
|
1
2
|
export declare const PRE_SIGNAL = "###_--_~=:;";
|
|
2
3
|
export declare const JUMP_SIGNAL = "###_--_~=:;_JUMP";
|
|
3
4
|
export declare const RETURN_SIGNAL = "###_--_~=:;_RETURN";
|
|
@@ -9,3 +10,5 @@ export declare const VERSION: string;
|
|
|
9
10
|
export declare const BUILD_DATE: Date;
|
|
10
11
|
export declare const DEFAULT_DIALOG_WIDTH = 400;
|
|
11
12
|
export declare const DEFAULT_TEXT_SPEED = 20;
|
|
13
|
+
export declare const EMPTY_SCREEN = "@empty";
|
|
14
|
+
export declare const defaultScreenConfig: ScreenConfig;
|
package/dist/dialog-box.vue.d.ts
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { PropType } from 'vue';
|
|
3
|
-
import { DialogStyleConfig } from './config/characters-config';
|
|
4
|
-
import { DialogChoice } from './stores/dialog-store';
|
|
5
2
|
import { DialogBoxParameters } from './types/dialog-box-types';
|
|
6
3
|
export interface TextAnimation {
|
|
7
4
|
text: string;
|
|
@@ -12,63 +9,26 @@ export interface TextAnimation {
|
|
|
12
9
|
tags: RegExpExecArray[];
|
|
13
10
|
finished: boolean;
|
|
14
11
|
}
|
|
12
|
+
declare function keyboardEvent(e: KeyboardEvent): void;
|
|
15
13
|
declare const _default: import("vue").DefineComponent<{
|
|
16
14
|
options: {
|
|
17
|
-
type: PropType<DialogBoxParameters>;
|
|
15
|
+
type: import("vue").PropType<DialogBoxParameters>;
|
|
16
|
+
required: true;
|
|
17
|
+
};
|
|
18
|
+
active: {
|
|
19
|
+
type: import("vue").PropType<boolean>;
|
|
18
20
|
required: true;
|
|
19
21
|
};
|
|
20
|
-
active: BooleanConstructor;
|
|
21
|
-
}, unknown, {
|
|
22
|
-
playerText: string;
|
|
23
|
-
passed: boolean;
|
|
24
|
-
timeout: any;
|
|
25
|
-
textAnimation: TextAnimation | null;
|
|
26
|
-
mounted: boolean;
|
|
27
|
-
autoTimer: NodeJS.Timer | null;
|
|
28
|
-
skipTimer: NodeJS.Timer | null;
|
|
29
|
-
nextLineTimer: NodeJS.Timer | null;
|
|
30
|
-
}, {
|
|
31
|
-
preText(): string;
|
|
32
|
-
style(): DialogStyleConfig;
|
|
33
|
-
dialogBoxStyle(): any;
|
|
34
|
-
isBasicChoice(): boolean;
|
|
35
|
-
dialogBoxClass(): false | "dialog-box-followup";
|
|
36
|
-
titleStyle(): any;
|
|
37
|
-
textStyle(): any;
|
|
38
|
-
text(): string;
|
|
39
|
-
choices(): DialogChoice[] | undefined;
|
|
40
|
-
skipping(): boolean;
|
|
41
|
-
autoPlay(): boolean;
|
|
42
|
-
canInteract(): boolean;
|
|
43
|
-
paused: () => boolean;
|
|
44
22
|
}, {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
dialogClick(): void;
|
|
48
|
-
next(): void;
|
|
49
|
-
chooseOption(choice: DialogChoice | number): void;
|
|
50
|
-
finishLine(): void;
|
|
51
|
-
dialogStyle(choice: DialogChoice): any;
|
|
52
|
-
dialogClass(choice: DialogChoice): "strike-anim" | undefined;
|
|
53
|
-
submitText(): void;
|
|
54
|
-
addTextSection(start: number, end: number): number;
|
|
55
|
-
addHtmlTag(tag: RegExpExecArray): number;
|
|
56
|
-
startTextAnimation(): void;
|
|
57
|
-
startSkip(): void;
|
|
58
|
-
startAutoPlay(): void;
|
|
59
|
-
updateTextAnimation(): void;
|
|
60
|
-
endTextAnimation({ unmounted, pressedSpace, }?: {
|
|
61
|
-
unmounted?: boolean | undefined;
|
|
62
|
-
pressedSpace?: boolean | undefined;
|
|
63
|
-
}): void;
|
|
64
|
-
registerKeyboardShortcuts(): void;
|
|
65
|
-
}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
23
|
+
keyboardEvent: typeof keyboardEvent;
|
|
24
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
66
25
|
options: {
|
|
67
|
-
type: PropType<DialogBoxParameters>;
|
|
26
|
+
type: import("vue").PropType<DialogBoxParameters>;
|
|
27
|
+
required: true;
|
|
28
|
+
};
|
|
29
|
+
active: {
|
|
30
|
+
type: import("vue").PropType<boolean>;
|
|
68
31
|
required: true;
|
|
69
32
|
};
|
|
70
|
-
|
|
71
|
-
}>>, {
|
|
72
|
-
active: boolean;
|
|
73
|
-
}>;
|
|
33
|
+
}>>, {}>;
|
|
74
34
|
export default _default;
|
package/dist/inputs/Inputs.d.ts
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
import { Vector2 } from '../utils/Vector2';
|
|
2
|
+
export type NarratGamepadButton = {
|
|
3
|
+
index: number;
|
|
4
|
+
state: GamepadButton;
|
|
5
|
+
previous: GamepadButton;
|
|
6
|
+
};
|
|
7
|
+
export type NarratGamepad = {
|
|
8
|
+
id: string;
|
|
9
|
+
gamepad: Gamepad;
|
|
10
|
+
buttons: NarratGamepadButton[];
|
|
11
|
+
};
|
|
12
|
+
export type ButtonEvent = (action: ButtonAction, state: ButtonActionState, previousState: ButtonActionState) => void;
|
|
13
|
+
export type AnalogEvent = (action: AnalogAction, state: AnalogActionState, previousState: AnalogActionState) => void;
|
|
2
14
|
export interface ButtonKeybind {
|
|
3
|
-
keyboardKey
|
|
15
|
+
keyboardKey?: string;
|
|
16
|
+
gamepadButton?: number;
|
|
4
17
|
}
|
|
5
18
|
export interface AnalogKeybind {
|
|
6
19
|
left: string;
|
|
@@ -20,8 +33,10 @@ export interface AnalogAction {
|
|
|
20
33
|
keybinds: AnalogKeybind[];
|
|
21
34
|
}
|
|
22
35
|
export interface ButtonActionState {
|
|
36
|
+
config: ButtonAction;
|
|
23
37
|
active: boolean;
|
|
24
|
-
|
|
38
|
+
justPressed: boolean;
|
|
39
|
+
justReleased: boolean;
|
|
25
40
|
}
|
|
26
41
|
export interface AnalogDirectionState {
|
|
27
42
|
left: number;
|
|
@@ -30,12 +45,21 @@ export interface AnalogDirectionState {
|
|
|
30
45
|
down: number;
|
|
31
46
|
}
|
|
32
47
|
export interface AnalogActionState {
|
|
48
|
+
config: AnalogAction;
|
|
33
49
|
value: Vector2;
|
|
34
|
-
previous: Vector2;
|
|
35
50
|
fullState: AnalogDirectionState;
|
|
36
|
-
previousFullState: AnalogDirectionState;
|
|
37
51
|
}
|
|
38
52
|
export type Action = ButtonAction | AnalogAction;
|
|
53
|
+
export type ActionState = ButtonActionState | AnalogActionState;
|
|
54
|
+
export type ButtonActionStatus = {
|
|
55
|
+
state: ButtonActionState;
|
|
56
|
+
previous: ButtonActionState;
|
|
57
|
+
};
|
|
58
|
+
export type AnalogActionStatus = {
|
|
59
|
+
state: AnalogActionState;
|
|
60
|
+
previous: AnalogActionState;
|
|
61
|
+
};
|
|
62
|
+
export type ActionStatus = ButtonActionStatus | AnalogActionStatus;
|
|
39
63
|
export declare class Inputs {
|
|
40
64
|
gameActions: {
|
|
41
65
|
[key: string]: Action;
|
|
@@ -47,15 +71,26 @@ export declare class Inputs {
|
|
|
47
71
|
};
|
|
48
72
|
};
|
|
49
73
|
actions: {
|
|
50
|
-
[key: string]:
|
|
74
|
+
[key: string]: ActionStatus;
|
|
51
75
|
};
|
|
76
|
+
gamepad: NarratGamepad | null;
|
|
52
77
|
startListening(): void;
|
|
78
|
+
updateGamepad(): void;
|
|
79
|
+
setupNarratGamepad(gamepad: Gamepad): NarratGamepad;
|
|
80
|
+
updateAllNarratButtons(gamepad: Gamepad, narratGamepad: NarratGamepad): void;
|
|
81
|
+
getNarratButtonFromGamepad(previous: GamepadButton, gamepadButton: GamepadButton, index: number): NarratGamepadButton;
|
|
53
82
|
addAction(action: Action): void;
|
|
54
83
|
getAnalog(actionId: string): AnalogActionState;
|
|
55
84
|
getButton(actionId: string): ButtonActionState;
|
|
56
|
-
|
|
85
|
+
getKeyboardState(key: string): {
|
|
57
86
|
current: boolean;
|
|
58
87
|
previous: boolean;
|
|
59
88
|
};
|
|
89
|
+
getGamepadState(key: number): {
|
|
90
|
+
current: GamepadButton;
|
|
91
|
+
previous: GamepadButton;
|
|
92
|
+
} | null;
|
|
93
|
+
debugGamepad(): void;
|
|
60
94
|
update(): void;
|
|
61
95
|
}
|
|
96
|
+
export declare const inputs: Inputs;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { InputListener } from '../stores/inputs-store';
|
|
2
|
+
import { Ref } from 'vue';
|
|
3
|
+
export type GridNavigationOptions = {
|
|
4
|
+
mode: 'grid';
|
|
5
|
+
columns: number;
|
|
6
|
+
};
|
|
7
|
+
export type ListNavigationOptions = {
|
|
8
|
+
mode: 'list';
|
|
9
|
+
};
|
|
10
|
+
export type NavigationOptions = {
|
|
11
|
+
mode: 'grid' | 'list';
|
|
12
|
+
container: Ref<HTMLElement | null>;
|
|
13
|
+
listener: InputListener;
|
|
14
|
+
loopForbidden?: boolean;
|
|
15
|
+
onSelected?: (index: number) => void;
|
|
16
|
+
} & (GridNavigationOptions | ListNavigationOptions);
|
|
17
|
+
export declare function useNavigation(options: NavigationOptions): {
|
|
18
|
+
selectedIndex: Ref<number>;
|
|
19
|
+
selectedElement: import("vue").ComputedRef<Element | null>;
|
|
20
|
+
currentColumn: import("vue").ComputedRef<number>;
|
|
21
|
+
buttonDown: () => void;
|
|
22
|
+
buttonUp: () => void;
|
|
23
|
+
buttonLeft: () => void;
|
|
24
|
+
buttonRight: () => void;
|
|
25
|
+
selectUp: () => void;
|
|
26
|
+
selectDown: () => void;
|
|
27
|
+
selectPrevious: () => void;
|
|
28
|
+
selectNext: () => void;
|
|
29
|
+
select: (index: number) => void;
|
|
30
|
+
};
|