@novely/core 0.42.0 → 0.43.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 CHANGED
@@ -809,7 +809,7 @@ type ActionProxy<Characters extends Record<string, Character>, Languages extends
809
809
  type DefaultActionProxy = ActionProxy<Record<string, Character>, Lang, State>;
810
810
  type GetActionParameters<T extends Capitalize<keyof DefaultActionProxy>> = Parameters<DefaultActionProxy[Uncapitalize<T>]>;
811
811
  type VirtualActions<Characters extends Record<string, Character>, Languages extends Lang, S extends State> = {
812
- choiceExtended: (question: TextContent<Languages, S>, choices: ActionChoiceExtendedChoice<Languages, State>[]) => ValidAction;
812
+ choice: (question: TextContent<Languages, S>, ...choices: ActionChoiceExtendedChoice<Languages, State>[]) => ValidAction;
813
813
  say: (character: keyof Characters, content: TextContent<Languages, S>) => ValidAction;
814
814
  };
815
815
 
@@ -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",
@@ -1429,25 +1428,23 @@ var Novely = (() => {
1429
1428
  return renderer.actions[action2];
1430
1429
  }
1431
1430
  return (...props) => {
1432
- if (VIRTUAL_ACTIONS.has(action2)) {
1433
- if (action2 === "say") {
1434
- action2 = "dialog";
1435
- const [character] = props;
1436
- if (DEV && !characters[character]) {
1437
- throw new Error(`Attempt to call Say action with unknown character "${character}"`);
1438
- }
1439
- } else if (action2 === "choiceExtended") {
1440
- action2 = "choice";
1441
- const choices = props[1];
1442
- const mappedChoices = choices.map((choice) => [
1443
- choice.title,
1444
- choice.children,
1445
- choice.active,
1446
- choice.visible,
1447
- choice.image
1448
- ]);
1449
- for (let i = 0; i < mappedChoices.length; i++) {
1450
- props[i + 1] = mappedChoices[i];
1431
+ if (action2 === "say") {
1432
+ action2 = "dialog";
1433
+ const [character] = props;
1434
+ if (DEV && !characters[character]) {
1435
+ throw new Error(`Attempt to call Say action with unknown character "${character}"`);
1436
+ }
1437
+ } else if (action2 === "choice") {
1438
+ if (props.slice(1).every((choice) => !Array.isArray(choice))) {
1439
+ for (let i = 1; i < props.length; i++) {
1440
+ const choice = props[i];
1441
+ props[i] = [
1442
+ choice.title,
1443
+ choice.children,
1444
+ choice.active,
1445
+ choice.visible,
1446
+ choice.image
1447
+ ];
1451
1448
  }
1452
1449
  }
1453
1450
  }