@novely/core 0.44.1 → 0.44.3
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/index.d.ts +3 -3
- package/dist/index.global.js +9 -9
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +9 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -812,9 +812,9 @@ type ActionProxy<Characters extends Record<string, Character>, Languages extends
|
|
|
812
812
|
};
|
|
813
813
|
type DefaultActionProxy = ActionProxy<Record<string, Character>, Lang, State>;
|
|
814
814
|
type GetActionParameters<T extends Capitalize<keyof DefaultActionProxy>> = Parameters<DefaultActionProxy[Uncapitalize<T>]>;
|
|
815
|
-
type VirtualActions
|
|
816
|
-
choice: (question: TextContent
|
|
817
|
-
say: (character: keyof Characters, content: TextContent
|
|
815
|
+
type VirtualActions<$Characters extends Record<string, Character>, $Lang extends Lang, $State extends State> = {
|
|
816
|
+
choice: (question: TextContent<$Lang, $State>, ...choices: ActionChoiceChoiceObject<$Lang, $State>[]) => ValidAction;
|
|
817
|
+
say: (character: keyof $Characters, content: TextContent<$Lang, $State>) => ValidAction;
|
|
818
818
|
};
|
|
819
819
|
|
|
820
820
|
type ConditionParams<T> = T extends TypeEssentials<any, infer $State, any, any> ? $State : never;
|
package/dist/index.global.js
CHANGED
|
@@ -364,16 +364,16 @@ var Novely = (() => {
|
|
|
364
364
|
var isAction = (element) => {
|
|
365
365
|
return Array.isArray(element) && isString(element[0]);
|
|
366
366
|
};
|
|
367
|
+
var flatActions = (item) => {
|
|
368
|
+
return item.flatMap((data) => {
|
|
369
|
+
const type = data[0];
|
|
370
|
+
if (Array.isArray(type)) return flatActions(data);
|
|
371
|
+
return [data];
|
|
372
|
+
});
|
|
373
|
+
};
|
|
367
374
|
var flattenStory = (story) => {
|
|
368
375
|
const entries = Object.entries(story).map(([name, items]) => {
|
|
369
|
-
|
|
370
|
-
return item.flatMap((data) => {
|
|
371
|
-
const type = data[0];
|
|
372
|
-
if (Array.isArray(type)) return flat(data);
|
|
373
|
-
return [data];
|
|
374
|
-
});
|
|
375
|
-
};
|
|
376
|
-
return [name, flat(items)];
|
|
376
|
+
return [name, flatActions(items)];
|
|
377
377
|
});
|
|
378
378
|
return Object.fromEntries(entries);
|
|
379
379
|
};
|
|
@@ -1441,7 +1441,7 @@ var Novely = (() => {
|
|
|
1441
1441
|
const choice = props[i];
|
|
1442
1442
|
props[i] = [
|
|
1443
1443
|
choice.title,
|
|
1444
|
-
choice.children,
|
|
1444
|
+
flatActions(choice.children),
|
|
1445
1445
|
choice.active,
|
|
1446
1446
|
choice.visible,
|
|
1447
1447
|
choice.image
|