@vnejs/contracts.views.scenario.interface 0.1.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.
@@ -0,0 +1,22 @@
1
+ export declare const SUBSCRIBE_EVENTS: {
2
+ readonly SHOW: "vne:interface:show";
3
+ readonly HIDE: "vne:interface:hide";
4
+ readonly SHOW_CHANGED: "vne:interface:show_changed";
5
+ readonly VIEW_SHOW: "vne:interface:view_show";
6
+ readonly VIEW_HIDE: "vne:interface:view_hide";
7
+ readonly VIEW_UPDATE: "vne:interface:view_update";
8
+ readonly TEXT: "vne:interface:text";
9
+ readonly TEXT_HIDE: "vne:interface:text_hide";
10
+ readonly TEXT_CHANGED: "vne:interface:text_changed";
11
+ readonly SPEAKER_CHANGED: "vne:interface:speaker_changed";
12
+ readonly VISIBLE: "vne:interface:visible";
13
+ readonly VISIBLE_CHANGED: "vne:interface:visible_changed";
14
+ readonly VIEW: "vne:interface:view";
15
+ readonly VIEW_CHANGED: "vne:interface:view_changed";
16
+ readonly HISTORY: "vne:interface:history";
17
+ readonly HISTORY_BACK: "vne:interface:history_back";
18
+ readonly GAMEMENU: "vne:interface:gamemenu";
19
+ readonly INTERACT: "vne:interface:interact";
20
+ readonly STATE_CHANGED: "vne:interface:state_changed";
21
+ };
22
+ export type SubscribeEvents = typeof SUBSCRIBE_EVENTS;
package/dist/events.js ADDED
@@ -0,0 +1,21 @@
1
+ export const SUBSCRIBE_EVENTS = {
2
+ SHOW: "vne:interface:show",
3
+ HIDE: "vne:interface:hide",
4
+ SHOW_CHANGED: "vne:interface:show_changed",
5
+ VIEW_SHOW: "vne:interface:view_show",
6
+ VIEW_HIDE: "vne:interface:view_hide",
7
+ VIEW_UPDATE: "vne:interface:view_update",
8
+ TEXT: "vne:interface:text",
9
+ TEXT_HIDE: "vne:interface:text_hide",
10
+ TEXT_CHANGED: "vne:interface:text_changed",
11
+ SPEAKER_CHANGED: "vne:interface:speaker_changed",
12
+ VISIBLE: "vne:interface:visible",
13
+ VISIBLE_CHANGED: "vne:interface:visible_changed",
14
+ VIEW: "vne:interface:view",
15
+ VIEW_CHANGED: "vne:interface:view_changed",
16
+ HISTORY: "vne:interface:history",
17
+ HISTORY_BACK: "vne:interface:history_back",
18
+ GAMEMENU: "vne:interface:gamemenu",
19
+ INTERACT: "vne:interface:interact",
20
+ STATE_CHANGED: "vne:interface:state_changed",
21
+ };
@@ -0,0 +1,23 @@
1
+ import "@vnejs/module";
2
+ import "@vnejs/shared";
3
+ import { SUBSCRIBE_EVENTS } from "./events.js";
4
+ import type { InterfaceModuleState } from "./module-global-state.js";
5
+ import { PARAMS } from "./params.js";
6
+ export declare const PLUGIN_NAME: "INTERFACE";
7
+ export type PluginName = typeof PLUGIN_NAME;
8
+ export { SUBSCRIBE_EVENTS };
9
+ export type { SubscribeEvents } from "./events.js";
10
+ export { PARAMS };
11
+ export type { Params } from "./params.js";
12
+ export type { InterfaceModuleState } from "./module-global-state.js";
13
+ declare module "@vnejs/module" {
14
+ interface ModuleGlobalState {
15
+ interface: InterfaceModuleState;
16
+ }
17
+ }
18
+ declare module "@vnejs/shared" {
19
+ interface VnePluginEventsMap extends Record<typeof PLUGIN_NAME, typeof SUBSCRIBE_EVENTS> {
20
+ }
21
+ interface VnePluginParamsMap extends Record<typeof PLUGIN_NAME, typeof PARAMS> {
22
+ }
23
+ }
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ import "@vnejs/module";
2
+ import "@vnejs/shared";
3
+ import { SUBSCRIBE_EVENTS } from "./events.js";
4
+ import { PARAMS } from "./params.js";
5
+ export const PLUGIN_NAME = "INTERFACE";
6
+ export { SUBSCRIBE_EVENTS };
7
+ export { PARAMS };
@@ -0,0 +1,12 @@
1
+ import type { TokenizedChar, WallElement } from "@vnejs/contracts.text";
2
+ export type InterfaceModuleState = {
3
+ tokens: TokenizedChar[];
4
+ wall: WallElement[];
5
+ uid: string;
6
+ tokensVisible: number;
7
+ speaker: string;
8
+ meet: number;
9
+ isShow: boolean;
10
+ isVisible: boolean;
11
+ view: string;
12
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,206 @@
1
+ import type { PositionBoxProps, WidenViewProps } from "@vnejs/uis.react.position-box";
2
+ export declare const DEFAULT_VIEW: string;
3
+ export declare const LOC_LABEL: string;
4
+ export declare const TRANSITION: number;
5
+ export declare const ZINDEX: number;
6
+ declare const VIEW_PROPS_DEFAULT: {
7
+ readonly adv: {
8
+ readonly backdrop: {
9
+ readonly props: {
10
+ type: "bottom";
11
+ size: number;
12
+ transition: number;
13
+ opacity: number;
14
+ };
15
+ readonly flatPosition: PositionBoxProps;
16
+ readonly flatStyle: {
17
+ background: string;
18
+ borderRadius: string | number;
19
+ transition: string;
20
+ };
21
+ };
22
+ readonly position: PositionBoxProps;
23
+ readonly flex: {
24
+ readonly direction: "column";
25
+ readonly gap: 24;
26
+ };
27
+ readonly speaker: {
28
+ readonly size: 72;
29
+ readonly weight: "bold";
30
+ };
31
+ readonly text: {
32
+ readonly size: 60;
33
+ readonly height: 300;
34
+ };
35
+ };
36
+ readonly wall: {
37
+ readonly backdrop: {
38
+ readonly props: {
39
+ type: "bottom";
40
+ size: number;
41
+ transition: number;
42
+ opacity: number;
43
+ };
44
+ readonly flatPosition: PositionBoxProps;
45
+ readonly flatStyle: {
46
+ background: string;
47
+ borderRadius: string | number;
48
+ transition: string;
49
+ };
50
+ };
51
+ readonly position: PositionBoxProps;
52
+ readonly flex: {
53
+ readonly direction: "column";
54
+ readonly gap: 24;
55
+ };
56
+ readonly scrollBar: {
57
+ readonly height: 1680;
58
+ readonly scrollToEnd: true;
59
+ readonly hideScrolbars: true;
60
+ readonly disableScroll: true;
61
+ };
62
+ readonly speaker: {
63
+ readonly size: 72;
64
+ readonly weight: "bold";
65
+ };
66
+ readonly text: {
67
+ readonly size: 60;
68
+ };
69
+ };
70
+ readonly line: {
71
+ readonly backdrop: {
72
+ readonly props: {
73
+ type: "bottom";
74
+ size: number;
75
+ transition: number;
76
+ opacity: number;
77
+ };
78
+ readonly flatPosition: PositionBoxProps;
79
+ readonly flatStyle: {
80
+ background: string;
81
+ borderRadius: string | number;
82
+ transition: string;
83
+ };
84
+ };
85
+ readonly position: PositionBoxProps;
86
+ readonly flex: {
87
+ readonly direction: "column";
88
+ readonly gap: 60;
89
+ };
90
+ readonly speaker: {
91
+ readonly size: 72;
92
+ readonly weight: "bold";
93
+ };
94
+ readonly text: {
95
+ readonly isCentered: true;
96
+ readonly size: 60;
97
+ readonly width: 3120;
98
+ };
99
+ };
100
+ };
101
+ export type ViewProps = WidenViewProps<typeof VIEW_PROPS_DEFAULT>;
102
+ export declare const VIEW_PROPS: ViewProps;
103
+ declare const PARAMS_DEFAULT: {
104
+ DEFAULT_VIEW: string;
105
+ LOC_LABEL: string;
106
+ TRANSITION: number;
107
+ ZINDEX: number;
108
+ VIEW_PROPS: {
109
+ adv: {
110
+ backdrop: {
111
+ props: {
112
+ type: "bottom";
113
+ size: number;
114
+ transition: number;
115
+ opacity: number;
116
+ };
117
+ flatPosition: PositionBoxProps<unknown>;
118
+ flatStyle: {
119
+ background: string;
120
+ borderRadius: string | number;
121
+ transition: string;
122
+ };
123
+ };
124
+ position: PositionBoxProps<unknown>;
125
+ flex: {
126
+ direction: "column";
127
+ gap: number;
128
+ };
129
+ speaker: {
130
+ size: number;
131
+ weight: "bold";
132
+ };
133
+ text: {
134
+ size: number;
135
+ height: number;
136
+ };
137
+ };
138
+ wall: {
139
+ backdrop: {
140
+ props: {
141
+ type: "bottom";
142
+ size: number;
143
+ transition: number;
144
+ opacity: number;
145
+ };
146
+ flatPosition: PositionBoxProps<unknown>;
147
+ flatStyle: {
148
+ background: string;
149
+ borderRadius: string | number;
150
+ transition: string;
151
+ };
152
+ };
153
+ position: PositionBoxProps<unknown>;
154
+ flex: {
155
+ direction: "column";
156
+ gap: number;
157
+ };
158
+ scrollBar: {
159
+ height: number;
160
+ scrollToEnd: boolean;
161
+ hideScrolbars: boolean;
162
+ disableScroll: boolean;
163
+ };
164
+ speaker: {
165
+ size: number;
166
+ weight: "bold";
167
+ };
168
+ text: {
169
+ size: number;
170
+ };
171
+ };
172
+ line: {
173
+ backdrop: {
174
+ props: {
175
+ type: "bottom";
176
+ size: number;
177
+ transition: number;
178
+ opacity: number;
179
+ };
180
+ flatPosition: PositionBoxProps<unknown>;
181
+ flatStyle: {
182
+ background: string;
183
+ borderRadius: string | number;
184
+ transition: string;
185
+ };
186
+ };
187
+ position: PositionBoxProps<unknown>;
188
+ flex: {
189
+ direction: "column";
190
+ gap: number;
191
+ };
192
+ speaker: {
193
+ size: number;
194
+ weight: "bold";
195
+ };
196
+ text: {
197
+ isCentered: boolean;
198
+ size: number;
199
+ width: number;
200
+ };
201
+ };
202
+ };
203
+ };
204
+ export type Params = WidenViewProps<typeof PARAMS_DEFAULT>;
205
+ export declare const PARAMS: Params;
206
+ export {};
package/dist/params.js ADDED
@@ -0,0 +1,56 @@
1
+ import { getVneLength } from "@vnejs/uis.utils";
2
+ export const DEFAULT_VIEW = "line";
3
+ export const LOC_LABEL = "interface";
4
+ export const TRANSITION = 500;
5
+ export const ZINDEX = 1000;
6
+ const createBackdropProps = (opacity) => ({ type: "bottom", size: 600, transition: TRANSITION, opacity });
7
+ const createFlatBackdropPosition = (margin, opacity) => ({
8
+ top: margin,
9
+ left: margin,
10
+ right: margin,
11
+ bottom: margin,
12
+ transition: TRANSITION,
13
+ opacity,
14
+ });
15
+ const createFlatBackdropStyle = (borderRadius) => ({
16
+ background: "rgba(0, 0, 0, 0.6)",
17
+ borderRadius,
18
+ transition: `${TRANSITION}ms`,
19
+ });
20
+ const VIEW_PROPS_DEFAULT = {
21
+ adv: {
22
+ backdrop: { props: createBackdropProps(1), flatPosition: createFlatBackdropPosition(0, 0), flatStyle: createFlatBackdropStyle(0) },
23
+ position: { bottom: 144, left: 600, right: 600 },
24
+ flex: { direction: "column", gap: 24 },
25
+ speaker: { size: 72, weight: "bold" },
26
+ text: { size: 60, height: 300 },
27
+ },
28
+ wall: {
29
+ backdrop: {
30
+ props: createBackdropProps(0),
31
+ flatPosition: createFlatBackdropPosition(120, 1),
32
+ flatStyle: createFlatBackdropStyle(getVneLength(48)),
33
+ },
34
+ position: { top: 180, left: 180, right: 180, bottom: 264 },
35
+ flex: { direction: "column", gap: 24 },
36
+ scrollBar: { height: 1680, scrollToEnd: true, hideScrolbars: true, disableScroll: true },
37
+ speaker: { size: 72, weight: "bold" },
38
+ text: { size: 60 },
39
+ },
40
+ line: {
41
+ backdrop: { props: createBackdropProps(0), flatPosition: createFlatBackdropPosition(0, 1), flatStyle: createFlatBackdropStyle(0) },
42
+ position: { isCentered: true },
43
+ flex: { direction: "column", gap: 60 },
44
+ speaker: { size: 72, weight: "bold" },
45
+ text: { isCentered: true, size: 60, width: 3120 },
46
+ },
47
+ };
48
+ export const VIEW_PROPS = VIEW_PROPS_DEFAULT;
49
+ const PARAMS_DEFAULT = {
50
+ DEFAULT_VIEW,
51
+ LOC_LABEL,
52
+ TRANSITION,
53
+ ZINDEX,
54
+ VIEW_PROPS,
55
+ };
56
+ export const PARAMS = PARAMS_DEFAULT;
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "@vnejs/contracts.views.scenario.interface",
3
+ "version": "0.1.1",
4
+ "description": "Contracts for @vnejs/plugins.views.scenario.interface",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "import": "./dist/index.js",
11
+ "require": "./dist/index.js",
12
+ "default": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "src",
18
+ "tsconfig.json"
19
+ ],
20
+ "scripts": {
21
+ "build": "npx @vnejs/monorepo package",
22
+ "publish:major": "npx @vnejs/monorepo publish major --access public",
23
+ "publish:minor": "npx @vnejs/monorepo publish minor --access public",
24
+ "publish:patch": "npx @vnejs/monorepo publish patch --access public"
25
+ },
26
+ "author": "",
27
+ "license": "ISC",
28
+ "peerDependencies": {
29
+ "@vnejs/module": "~0.1.0",
30
+ "@vnejs/contracts.text": "~0.1.0",
31
+ "@vnejs/shared": "~0.1.0",
32
+ "@vnejs/uis.react.position-box": "~0.1.0",
33
+ "@vnejs/uis.utils": "~0.1.0"
34
+ },
35
+ "devDependencies": {
36
+ "@vnejs/configs.ts-common": "~0.1.0"
37
+ }
38
+ }
package/src/events.ts ADDED
@@ -0,0 +1,33 @@
1
+ export const SUBSCRIBE_EVENTS = {
2
+ SHOW: "vne:interface:show",
3
+ HIDE: "vne:interface:hide",
4
+
5
+ SHOW_CHANGED: "vne:interface:show_changed",
6
+
7
+ VIEW_SHOW: "vne:interface:view_show",
8
+ VIEW_HIDE: "vne:interface:view_hide",
9
+ VIEW_UPDATE: "vne:interface:view_update",
10
+
11
+ TEXT: "vne:interface:text",
12
+ TEXT_HIDE: "vne:interface:text_hide",
13
+ TEXT_CHANGED: "vne:interface:text_changed",
14
+
15
+ SPEAKER_CHANGED: "vne:interface:speaker_changed",
16
+
17
+ VISIBLE: "vne:interface:visible",
18
+ VISIBLE_CHANGED: "vne:interface:visible_changed",
19
+
20
+ VIEW: "vne:interface:view",
21
+ VIEW_CHANGED: "vne:interface:view_changed",
22
+
23
+ HISTORY: "vne:interface:history",
24
+ HISTORY_BACK: "vne:interface:history_back",
25
+
26
+ GAMEMENU: "vne:interface:gamemenu",
27
+
28
+ INTERACT: "vne:interface:interact",
29
+
30
+ STATE_CHANGED: "vne:interface:state_changed",
31
+ } as const;
32
+
33
+ export type SubscribeEvents = typeof SUBSCRIBE_EVENTS;
package/src/index.ts ADDED
@@ -0,0 +1,27 @@
1
+ import "@vnejs/module";
2
+ import "@vnejs/shared";
3
+
4
+ import { SUBSCRIBE_EVENTS } from "./events.js";
5
+ import type { InterfaceModuleState } from "./module-global-state.js";
6
+ import { PARAMS } from "./params.js";
7
+
8
+ export const PLUGIN_NAME = "INTERFACE" as const;
9
+ export type PluginName = typeof PLUGIN_NAME;
10
+
11
+ export { SUBSCRIBE_EVENTS };
12
+ export type { SubscribeEvents } from "./events.js";
13
+ export { PARAMS };
14
+ export type { Params } from "./params.js";
15
+ export type { InterfaceModuleState } from "./module-global-state.js";
16
+
17
+ declare module "@vnejs/module" {
18
+ interface ModuleGlobalState {
19
+ interface: InterfaceModuleState;
20
+ }
21
+ }
22
+
23
+ declare module "@vnejs/shared" {
24
+ interface VnePluginEventsMap extends Record<typeof PLUGIN_NAME, typeof SUBSCRIBE_EVENTS> {}
25
+
26
+ interface VnePluginParamsMap extends Record<typeof PLUGIN_NAME, typeof PARAMS> {}
27
+ }
@@ -0,0 +1,13 @@
1
+ import type { TokenizedChar, WallElement } from "@vnejs/contracts.text";
2
+
3
+ export type InterfaceModuleState = {
4
+ tokens: TokenizedChar[];
5
+ wall: WallElement[];
6
+ uid: string;
7
+ tokensVisible: number;
8
+ speaker: string;
9
+ meet: number;
10
+ isShow: boolean;
11
+ isVisible: boolean;
12
+ view: string;
13
+ };
package/src/params.ts ADDED
@@ -0,0 +1,65 @@
1
+ import type { PositionBoxProps, WidenViewProps } from "@vnejs/uis.react.position-box";
2
+ import { getVneLength } from "@vnejs/uis.utils";
3
+
4
+ export const DEFAULT_VIEW: string = "line";
5
+ export const LOC_LABEL: string = "interface";
6
+ export const TRANSITION: number = 500;
7
+ export const ZINDEX: number = 1000;
8
+
9
+ const createBackdropProps = (opacity: number) => ({ type: "bottom" as const, size: 600, transition: TRANSITION, opacity });
10
+ const createFlatBackdropPosition = (margin: number, opacity: number): PositionBoxProps => ({
11
+ top: margin,
12
+ left: margin,
13
+ right: margin,
14
+ bottom: margin,
15
+ transition: TRANSITION,
16
+ opacity,
17
+ });
18
+ const createFlatBackdropStyle = (borderRadius: number | string) => ({
19
+ background: "rgba(0, 0, 0, 0.6)",
20
+ borderRadius,
21
+ transition: `${TRANSITION}ms`,
22
+ });
23
+
24
+ const VIEW_PROPS_DEFAULT = {
25
+ adv: {
26
+ backdrop: { props: createBackdropProps(1), flatPosition: createFlatBackdropPosition(0, 0), flatStyle: createFlatBackdropStyle(0) },
27
+ position: { bottom: 144, left: 600, right: 600 } as PositionBoxProps,
28
+ flex: { direction: "column" as const, gap: 24 },
29
+ speaker: { size: 72, weight: "bold" as const },
30
+ text: { size: 60, height: 300 },
31
+ },
32
+ wall: {
33
+ backdrop: {
34
+ props: createBackdropProps(0),
35
+ flatPosition: createFlatBackdropPosition(120, 1),
36
+ flatStyle: createFlatBackdropStyle(getVneLength(48)),
37
+ },
38
+ position: { top: 180, left: 180, right: 180, bottom: 264 } as PositionBoxProps,
39
+ flex: { direction: "column" as const, gap: 24 },
40
+ scrollBar: { height: 1680, scrollToEnd: true, hideScrolbars: true, disableScroll: true },
41
+ speaker: { size: 72, weight: "bold" as const },
42
+ text: { size: 60 },
43
+ },
44
+ line: {
45
+ backdrop: { props: createBackdropProps(0), flatPosition: createFlatBackdropPosition(0, 1), flatStyle: createFlatBackdropStyle(0) },
46
+ position: { isCentered: true } as PositionBoxProps,
47
+ flex: { direction: "column" as const, gap: 60 },
48
+ speaker: { size: 72, weight: "bold" as const },
49
+ text: { isCentered: true, size: 60, width: 3120 },
50
+ },
51
+ } as const;
52
+
53
+ export type ViewProps = WidenViewProps<typeof VIEW_PROPS_DEFAULT>;
54
+ export const VIEW_PROPS: ViewProps = VIEW_PROPS_DEFAULT;
55
+
56
+ const PARAMS_DEFAULT = {
57
+ DEFAULT_VIEW,
58
+ LOC_LABEL,
59
+ TRANSITION,
60
+ ZINDEX,
61
+ VIEW_PROPS,
62
+ };
63
+
64
+ export type Params = WidenViewProps<typeof PARAMS_DEFAULT>;
65
+ export const PARAMS: Params = PARAMS_DEFAULT;
package/tsconfig.json ADDED
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "@vnejs/configs.ts-common/tsconfig.json",
3
+ "compilerOptions": {
4
+ "rootDir": "src",
5
+ "outDir": "dist"
6
+ },
7
+ "include": ["src/**/*.ts"],
8
+ "exclude": ["dist", "node_modules"]
9
+ }