narrat 3.3.7 → 3.4.0

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.
Files changed (43) hide show
  1. package/README.md +1 -1
  2. package/dist/components/achievements/achievements-ui.vue.d.ts +2 -1
  3. package/dist/components/dialog-picture.vue.d.ts +18 -2
  4. package/dist/components/quests-ui.vue.d.ts +2 -0
  5. package/dist/components/utils/floating-tooltip.vue.d.ts +35 -0
  6. package/dist/config/achievements-config.d.ts +8 -4
  7. package/dist/config/animations-config.d.ts +64 -0
  8. package/dist/config/characters-config.d.ts +3 -0
  9. package/dist/config/choices-config.d.ts +28 -0
  10. package/dist/config/common-config.d.ts +2 -0
  11. package/dist/config/config-input.d.ts +23 -0
  12. package/dist/config/config-output.d.ts +69 -19
  13. package/dist/config/quests-config.d.ts +26 -0
  14. package/dist/config/tooltips-config.d.ts +16 -0
  15. package/dist/config.d.ts +88 -20
  16. package/dist/exports/others.d.ts +1 -0
  17. package/dist/exports/utils.d.ts +1 -0
  18. package/dist/inputs/Inputs.d.ts +9 -1
  19. package/dist/main.d.ts +2 -0
  20. package/dist/narrat.es.js +19245 -18535
  21. package/dist/narrat.es.js.map +1 -1
  22. package/dist/narrat.umd.js +143 -128
  23. package/dist/narrat.umd.js.map +1 -1
  24. package/dist/stores/choices-tracking-store.d.ts +12 -0
  25. package/dist/stores/dialog-store.d.ts +2 -0
  26. package/dist/stores/inputs-store.d.ts +3 -1
  27. package/dist/stores/inventory-store.d.ts +1 -0
  28. package/dist/stores/main-store.d.ts +5094 -212
  29. package/dist/stores/quest-log.d.ts +9 -1
  30. package/dist/stores/rendering-store.d.ts +13 -0
  31. package/dist/stores/tooltip-store.d.ts +1 -0
  32. package/dist/style.css +1 -1
  33. package/dist/types/app-types.d.ts +5 -0
  34. package/dist/types/game-save.d.ts +4 -0
  35. package/dist/utils/animation.d.ts +8 -0
  36. package/dist/utils/data-helpers.d.ts +332 -2
  37. package/dist/utils/interact-utils.d.ts +15 -0
  38. package/dist/utils/save-helpers.d.ts +1 -1
  39. package/dist/utils/string-helpers.d.ts +2 -1
  40. package/dist/vm/commands/choice.d.ts +5 -0
  41. package/dist/vm/commands/quest-commands.d.ts +14 -1
  42. package/dist/vm/commands/util-commands.d.ts +13 -1
  43. package/package.json +1 -1
@@ -1,15 +1,31 @@
1
1
  import { Static } from '@sinclair/typebox';
2
+ export declare const TooltipStylingSchema: import("@sinclair/typebox").TObject<{
3
+ cssClass: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
4
+ textCssClass: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
5
+ titleCssClass: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
6
+ }>;
7
+ export type TooltipStyling = Static<typeof TooltipStylingSchema>;
2
8
  export declare const TooltipsConfigSchema: import("@sinclair/typebox").TObject<{
3
9
  options: import("@sinclair/typebox").TObject<{
4
10
  delay: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
5
11
  width: import("@sinclair/typebox").TNumber;
6
12
  keywordsPrefix: import("@sinclair/typebox").TString;
7
13
  screenEdgesMinimumMargin: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
14
+ styling: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
15
+ cssClass: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
16
+ textCssClass: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
17
+ titleCssClass: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
18
+ }>>;
8
19
  }>;
9
20
  tooltips: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
10
21
  keywords: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
11
22
  title: import("@sinclair/typebox").TString;
12
23
  description: import("@sinclair/typebox").TString;
24
+ styling: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
25
+ cssClass: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
26
+ textCssClass: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
27
+ titleCssClass: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
28
+ }>>;
13
29
  }>>;
14
30
  }>;
15
31
  export type TooltipsConfig = Static<typeof TooltipsConfigSchema>;
package/dist/config.d.ts CHANGED
@@ -60,37 +60,45 @@ export declare function skillChecksConfig(): {
60
60
  }>;
61
61
  };
62
62
  export declare function itemsConfig(): {
63
+ categories: {
64
+ title: string;
65
+ id: string;
66
+ }[];
63
67
  items: Record<string, {
64
- category?: string | undefined;
68
+ tag?: string | undefined;
65
69
  onUse?: {
66
70
  label: string;
67
71
  action: string;
68
72
  } | undefined;
69
- tag?: string | undefined;
73
+ category?: string | undefined;
70
74
  showIfEmpty?: boolean | undefined;
71
75
  name: string;
72
76
  description: string;
73
77
  icon: string;
74
78
  }>;
79
+ };
80
+ export declare function questsConfig(): {
75
81
  categories: {
76
82
  title: string;
77
83
  id: string;
78
84
  }[];
79
- };
80
- export declare function questsConfig(): {
81
85
  quests: Record<string, {
82
86
  category?: string | undefined;
87
+ succeededDescription?: string | undefined;
88
+ failedDescription?: string | undefined;
89
+ endings?: Record<string, {
90
+ description: string;
91
+ success: boolean;
92
+ }> | undefined;
83
93
  title: string;
84
94
  description: string;
85
95
  objectives: Record<string, {
86
96
  hidden?: boolean | undefined;
97
+ succeededDescription?: string | undefined;
98
+ failedDescription?: string | undefined;
87
99
  description: string;
88
100
  }>;
89
101
  }>;
90
- categories: {
91
- title: string;
92
- id: string;
93
- }[];
94
102
  };
95
103
  export declare function screensConfig(): {
96
104
  screens: Record<string, {
@@ -100,16 +108,16 @@ export declare function screensConfig(): {
100
108
  } | undefined;
101
109
  buttons?: (string | ({
102
110
  text?: string | undefined;
103
- cssClass?: string | undefined;
104
- action?: string | undefined;
105
- tag?: string | undefined;
106
111
  background?: string | undefined;
112
+ cssClass?: string | undefined;
107
113
  anchor?: {
108
114
  x: number;
109
115
  y: number;
110
116
  } | undefined;
117
+ action?: string | undefined;
111
118
  actionType?: string | undefined;
112
119
  scriptClickable?: boolean | undefined;
120
+ tag?: string | undefined;
113
121
  enabled: boolean;
114
122
  position: {
115
123
  width?: number | undefined;
@@ -127,16 +135,16 @@ export declare function buttonsConfig(): {
127
135
  clickableDuringScriptsByDefault?: boolean | undefined;
128
136
  buttons: Record<string, {
129
137
  text?: string | undefined;
130
- cssClass?: string | undefined;
131
- action?: string | undefined;
132
- tag?: string | undefined;
133
138
  background?: string | undefined;
139
+ cssClass?: string | undefined;
134
140
  anchor?: {
135
141
  x: number;
136
142
  y: number;
137
143
  } | undefined;
144
+ action?: string | undefined;
138
145
  actionType?: string | undefined;
139
146
  scriptClickable?: boolean | undefined;
147
+ tag?: string | undefined;
140
148
  enabled: boolean;
141
149
  position: {
142
150
  width?: number | undefined;
@@ -150,10 +158,20 @@ export declare function tooltipsConfig(): {
150
158
  options: {
151
159
  delay?: number | undefined;
152
160
  screenEdgesMinimumMargin?: number | undefined;
161
+ styling?: {
162
+ cssClass?: string | undefined;
163
+ textCssClass?: string | undefined;
164
+ titleCssClass?: string | undefined;
165
+ } | undefined;
153
166
  width: number;
154
167
  keywordsPrefix: string;
155
168
  };
156
169
  tooltips: {
170
+ styling?: {
171
+ cssClass?: string | undefined;
172
+ textCssClass?: string | undefined;
173
+ titleCssClass?: string | undefined;
174
+ } | undefined;
157
175
  title: string;
158
176
  description: string;
159
177
  keywords: string[];
@@ -167,6 +185,7 @@ export declare function charactersConfig(): {
167
185
  };
168
186
  characters: Record<string, {
169
187
  style?: {
188
+ portraitCssClass?: string | undefined;
170
189
  color?: string | undefined;
171
190
  boxCss?: Record<string, any> | undefined;
172
191
  nameCss?: Record<string, any> | undefined;
@@ -176,8 +195,8 @@ export declare function charactersConfig(): {
176
195
  loop?: boolean | undefined;
177
196
  width?: number | undefined;
178
197
  height?: number | undefined;
179
- muted?: boolean | undefined;
180
198
  autoplay?: boolean | undefined;
199
+ muted?: boolean | undefined;
181
200
  video: string;
182
201
  } | {
183
202
  width?: number | undefined;
@@ -187,8 +206,41 @@ export declare function charactersConfig(): {
187
206
  name: string;
188
207
  }>;
189
208
  };
209
+ export declare function choicesConfig(): {
210
+ choiceTextTemplate: string;
211
+ choicePrompts: Record<string, {
212
+ cssClass?: string | undefined;
213
+ textTemplate?: string | undefined;
214
+ }>;
215
+ };
216
+ export declare function animationsConfig(): {
217
+ animations: Record<string, {
218
+ options?: {
219
+ fill?: string | undefined;
220
+ delay?: number | undefined;
221
+ duration?: number | undefined;
222
+ direction?: string | undefined;
223
+ easing?: string | undefined;
224
+ endDelay?: number | undefined;
225
+ iterationStart?: number | undefined;
226
+ iterations?: number | undefined;
227
+ keyframes?: any;
228
+ } | undefined;
229
+ keyframes: string | any[];
230
+ }>;
231
+ keyframes: Record<string, any[]>;
232
+ };
233
+ export declare function getChoicePromptConfig(flag: string): {
234
+ cssClass?: string | undefined;
235
+ textTemplate?: string | undefined;
236
+ };
190
237
  export declare function getScreenConfig(screen: string): ScreenConfig;
191
238
  export declare function getTooltipConfig(keyword: string): {
239
+ styling?: {
240
+ cssClass?: string | undefined;
241
+ textCssClass?: string | undefined;
242
+ titleCssClass?: string | undefined;
243
+ } | undefined;
192
244
  title: string;
193
245
  description: string;
194
246
  keywords: string[];
@@ -214,12 +266,12 @@ export declare function getSplitConfigUrl(basePath: string, url: string): string
214
266
  export declare function getDataUrl(dataPath: string): string;
215
267
  export declare function getButtonConfig(button: string): ButtonConfig;
216
268
  export declare function getItemConfig(id: string): {
217
- category?: string | undefined;
269
+ tag?: string | undefined;
218
270
  onUse?: {
219
271
  label: string;
220
272
  action: string;
221
273
  } | undefined;
222
- tag?: string | undefined;
274
+ category?: string | undefined;
223
275
  showIfEmpty?: boolean | undefined;
224
276
  name: string;
225
277
  description: string;
@@ -235,34 +287,50 @@ export declare function getAchievementsConfig(): {
235
287
  title: string;
236
288
  id: string;
237
289
  }[];
238
- defaultAchievementIcon: string;
239
290
  achievements: Record<string, {
291
+ icon?: string | undefined;
240
292
  category?: string | undefined;
293
+ lockedIcon?: string | undefined;
241
294
  secret?: boolean | undefined;
242
295
  name: string;
243
296
  description: string;
244
- icon: string;
245
297
  }>;
298
+ defaultAchievementIcon: string;
246
299
  notifyNewAchievements: boolean;
247
300
  };
248
301
  export declare function getAchievementConfig(id: string): {
302
+ icon?: string | undefined;
249
303
  category?: string | undefined;
304
+ lockedIcon?: string | undefined;
250
305
  secret?: boolean | undefined;
251
306
  name: string;
252
307
  description: string;
253
- icon: string;
254
308
  };
255
309
  export declare function getQuestConfig(questId: string): {
256
310
  category?: string | undefined;
311
+ succeededDescription?: string | undefined;
312
+ failedDescription?: string | undefined;
313
+ endings?: Record<string, {
314
+ description: string;
315
+ success: boolean;
316
+ }> | undefined;
257
317
  title: string;
258
318
  description: string;
259
319
  objectives: Record<string, {
260
320
  hidden?: boolean | undefined;
321
+ succeededDescription?: string | undefined;
322
+ failedDescription?: string | undefined;
261
323
  description: string;
262
324
  }>;
263
325
  };
326
+ export declare function getQuestEndingConfig(questId: string, ending: string): {
327
+ description: string;
328
+ success: boolean;
329
+ };
264
330
  export declare function getObjectiveConfig(quest: string, objectiveId: string): {
265
331
  hidden?: boolean | undefined;
332
+ succeededDescription?: string | undefined;
333
+ failedDescription?: string | undefined;
266
334
  description: string;
267
335
  };
268
336
  export declare function getDialogPanelWidth(): number;
@@ -1 +1,2 @@
1
1
  export { registerMenuButton } from '../menu-buttons/menu-buttons';
2
+ export * from '../hmr/hmr';
@@ -10,4 +10,5 @@ export { randomId } from '../utils/randomId';
10
10
  export { Vec2 } from '../utils/Vector2';
11
11
  export type { Vector2 } from '../utils/Vector2';
12
12
  export { gameloop } from '../utils/gameloop';
13
+ export { debounce } from '../utils/debounce';
13
14
  export * from '../utils/construct-narrat';
@@ -1,4 +1,5 @@
1
1
  import { Vector2 } from '../utils/Vector2';
2
+ export type InputMode = 'km' | 'gamepad';
2
3
  export type NarratGamepadButton = {
3
4
  index: number;
4
5
  state: GamepadButton;
@@ -60,7 +61,8 @@ export type AnalogActionStatus = {
60
61
  previous: AnalogActionState;
61
62
  };
62
63
  export type ActionStatus = ButtonActionStatus | AnalogActionStatus;
63
- export declare class Inputs {
64
+ export declare class Inputs extends EventTarget {
65
+ gamepadAvailable: boolean;
64
66
  gameActions: {
65
67
  [key: string]: Action;
66
68
  };
@@ -73,7 +75,13 @@ export declare class Inputs {
73
75
  actions: {
74
76
  [key: string]: ActionStatus;
75
77
  };
78
+ lastInputMethodUsed: InputMode;
76
79
  gamepad: NarratGamepad | null;
80
+ kbEvent(): void;
81
+ getGamepads(): (Gamepad | null)[];
82
+ gamepadEvent(): void;
83
+ mouseEvent(): void;
84
+ changeLastInput(inputMode: InputMode): void;
77
85
  getGamepad(): Gamepad | undefined;
78
86
  startListening(): void;
79
87
  updateGamepad(): void;
package/dist/main.d.ts CHANGED
@@ -6,4 +6,6 @@ import { AppOptionsInput } from './types/app-types';
6
6
  import { ModuleNamespace } from 'vite/types/hot';
7
7
  export type HMRCallback = (mod: ModuleNamespace | undefined) => void;
8
8
  export declare function startApp(optionsInput: AppOptionsInput): Promise<any>;
9
+ export declare function stopApp(): Promise<void>;
10
+ export declare function restartApp(): Promise<any>;
9
11
  export declare function registerComponent(name: string, component: any): void;