@novely/core 0.27.1 → 0.27.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.
@@ -521,8 +521,8 @@ var Novely = (() => {
521
521
  }
522
522
  }
523
523
  const run = async (match) => {
524
- for await (const [action, ...params] of processedQueue) {
525
- const result = match(action, params);
524
+ for await (const item of processedQueue) {
525
+ const result = match(item);
526
526
  if (isPromise(result)) {
527
527
  await result;
528
528
  }
@@ -571,6 +571,7 @@ var Novely = (() => {
571
571
  stack.push(value);
572
572
  },
573
573
  clear() {
574
+ stack.previous = void 0;
574
575
  stack.length = 0;
575
576
  stack.length = 1;
576
577
  }
@@ -1075,7 +1076,7 @@ var Novely = (() => {
1075
1076
  const { keep, characters: characters2, audio } = processor.keep;
1076
1077
  if (previous) {
1077
1078
  const { queue: prevQueue } = getActionsFromPath(story, previous[0], false);
1078
- for (let i = prevQueue.length - 1; i > queue.length; i--) {
1079
+ for (let i = prevQueue.length - 1; i > queue.length - 1; i--) {
1079
1080
  const element = prevQueue[i];
1080
1081
  if (!isAction(element)) {
1081
1082
  continue;
@@ -1090,9 +1091,15 @@ var Novely = (() => {
1090
1091
  ctx: context,
1091
1092
  data: latest[1]
1092
1093
  });
1093
- await processor.run((action2, props) => {
1094
+ const lastQueueItem = queue.at(-1) || [];
1095
+ const isLastQueueItemRequiresUserAction = isUserRequiredAction(lastQueueItem);
1096
+ await processor.run((item) => {
1094
1097
  if (!latest)
1095
1098
  return;
1099
+ if (isLastQueueItemRequiresUserAction && lastQueueItem === item) {
1100
+ return;
1101
+ }
1102
+ const [action2, ...props] = item;
1096
1103
  return match(action2, props, {
1097
1104
  ctx: context,
1098
1105
  data: latest[1]
@@ -1165,7 +1172,7 @@ var Novely = (() => {
1165
1172
  const processor = createQueueProcessor(queue, {
1166
1173
  skip: /* @__PURE__ */ new Set()
1167
1174
  });
1168
- await processor.run((action2, props) => {
1175
+ await processor.run(([action2, ...props]) => {
1169
1176
  if (isAudioAction(action2))
1170
1177
  return;
1171
1178
  if (action2 === "vibrate")