@novely/core 0.42.0 → 0.44.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.
- package/dist/index.d.ts +5 -1
- package/dist/index.global.js +19 -21
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +19 -21
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -602,6 +602,10 @@ type CustomHandlerFunctionParameters<L extends string, S extends State> = {
|
|
|
602
602
|
* Renderer Context
|
|
603
603
|
*/
|
|
604
604
|
rendererContext: Context;
|
|
605
|
+
/**
|
|
606
|
+
* Context key in which action is running
|
|
607
|
+
*/
|
|
608
|
+
contextKey: string;
|
|
605
609
|
/**
|
|
606
610
|
* Function to work with custom action's state
|
|
607
611
|
*/
|
|
@@ -809,7 +813,7 @@ type ActionProxy<Characters extends Record<string, Character>, Languages extends
|
|
|
809
813
|
type DefaultActionProxy = ActionProxy<Record<string, Character>, Lang, State>;
|
|
810
814
|
type GetActionParameters<T extends Capitalize<keyof DefaultActionProxy>> = Parameters<DefaultActionProxy[Uncapitalize<T>]>;
|
|
811
815
|
type VirtualActions<Characters extends Record<string, Character>, Languages extends Lang, S extends State> = {
|
|
812
|
-
|
|
816
|
+
choice: (question: TextContent<Languages, S>, ...choices: ActionChoiceExtendedChoice<Languages, State>[]) => ValidAction;
|
|
813
817
|
say: (character: keyof Characters, content: TextContent<Languages, S>) => ValidAction;
|
|
814
818
|
};
|
|
815
819
|
|
package/dist/index.global.js
CHANGED
|
@@ -35,7 +35,6 @@ var Novely = (() => {
|
|
|
35
35
|
var SKIPPED_DURING_RESTORE = /* @__PURE__ */ new Set(["dialog", "choice", "input", "vibrate", "text"]);
|
|
36
36
|
var BLOCK_EXIT_STATEMENTS = /* @__PURE__ */ new Set(["choice:exit", "condition:exit", "block:exit"]);
|
|
37
37
|
var BLOCK_STATEMENTS = /* @__PURE__ */ new Set(["choice", "condition", "block"]);
|
|
38
|
-
var VIRTUAL_ACTIONS = /* @__PURE__ */ new Set(["say", "choiceExtended"]);
|
|
39
38
|
var AUDIO_ACTIONS = /* @__PURE__ */ new Set([
|
|
40
39
|
"playMusic",
|
|
41
40
|
"stopMusic",
|
|
@@ -1081,7 +1080,8 @@ var Novely = (() => {
|
|
|
1081
1080
|
remove,
|
|
1082
1081
|
rendererContext: ctx,
|
|
1083
1082
|
getDomNodes,
|
|
1084
|
-
getPath
|
|
1083
|
+
getPath,
|
|
1084
|
+
contextKey: ctx.id
|
|
1085
1085
|
});
|
|
1086
1086
|
};
|
|
1087
1087
|
|
|
@@ -1429,25 +1429,23 @@ var Novely = (() => {
|
|
|
1429
1429
|
return renderer.actions[action2];
|
|
1430
1430
|
}
|
|
1431
1431
|
return (...props) => {
|
|
1432
|
-
if (
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
for (let i = 0; i < mappedChoices.length; i++) {
|
|
1450
|
-
props[i + 1] = mappedChoices[i];
|
|
1432
|
+
if (action2 === "say") {
|
|
1433
|
+
action2 = "dialog";
|
|
1434
|
+
const [character] = props;
|
|
1435
|
+
if (DEV && !characters[character]) {
|
|
1436
|
+
throw new Error(`Attempt to call Say action with unknown character "${character}"`);
|
|
1437
|
+
}
|
|
1438
|
+
} else if (action2 === "choice") {
|
|
1439
|
+
if (props.slice(1).every((choice) => !Array.isArray(choice))) {
|
|
1440
|
+
for (let i = 1; i < props.length; i++) {
|
|
1441
|
+
const choice = props[i];
|
|
1442
|
+
props[i] = [
|
|
1443
|
+
choice.title,
|
|
1444
|
+
choice.children,
|
|
1445
|
+
choice.active,
|
|
1446
|
+
choice.visible,
|
|
1447
|
+
choice.image
|
|
1448
|
+
];
|
|
1451
1449
|
}
|
|
1452
1450
|
}
|
|
1453
1451
|
}
|