@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.js CHANGED
@@ -2,7 +2,6 @@
2
2
  var SKIPPED_DURING_RESTORE = /* @__PURE__ */ new Set(["dialog", "choice", "input", "vibrate", "text"]);
3
3
  var BLOCK_EXIT_STATEMENTS = /* @__PURE__ */ new Set(["choice:exit", "condition:exit", "block:exit"]);
4
4
  var BLOCK_STATEMENTS = /* @__PURE__ */ new Set(["choice", "condition", "block"]);
5
- var VIRTUAL_ACTIONS = /* @__PURE__ */ new Set(["say", "choiceExtended"]);
6
5
  var AUDIO_ACTIONS = /* @__PURE__ */ new Set([
7
6
  "playMusic",
8
7
  "stopMusic",
@@ -965,7 +964,8 @@ var handleCustomAction = (ctx, fn, { lang, state, setMountElement, setClear, rem
965
964
  remove,
966
965
  rendererContext: ctx,
967
966
  getDomNodes,
968
- getPath
967
+ getPath,
968
+ contextKey: ctx.id
969
969
  });
970
970
  };
971
971
 
@@ -1186,25 +1186,23 @@ var novely = ({
1186
1186
  return renderer.actions[action2];
1187
1187
  }
1188
1188
  return (...props) => {
1189
- if (VIRTUAL_ACTIONS.has(action2)) {
1190
- if (action2 === "say") {
1191
- action2 = "dialog";
1192
- const [character] = props;
1193
- if (DEV3 && !characters[character]) {
1194
- throw new Error(`Attempt to call Say action with unknown character "${character}"`);
1195
- }
1196
- } else if (action2 === "choiceExtended") {
1197
- action2 = "choice";
1198
- const choices = props[1];
1199
- const mappedChoices = choices.map((choice) => [
1200
- choice.title,
1201
- choice.children,
1202
- choice.active,
1203
- choice.visible,
1204
- choice.image
1205
- ]);
1206
- for (let i = 0; i < mappedChoices.length; i++) {
1207
- props[i + 1] = mappedChoices[i];
1189
+ if (action2 === "say") {
1190
+ action2 = "dialog";
1191
+ const [character] = props;
1192
+ if (DEV3 && !characters[character]) {
1193
+ throw new Error(`Attempt to call Say action with unknown character "${character}"`);
1194
+ }
1195
+ } else if (action2 === "choice") {
1196
+ if (props.slice(1).every((choice) => !Array.isArray(choice))) {
1197
+ for (let i = 1; i < props.length; i++) {
1198
+ const choice = props[i];
1199
+ props[i] = [
1200
+ choice.title,
1201
+ choice.children,
1202
+ choice.active,
1203
+ choice.visible,
1204
+ choice.image
1205
+ ];
1208
1206
  }
1209
1207
  }
1210
1208
  }