@novely/core 0.28.0 → 0.28.2

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.
@@ -1061,18 +1061,17 @@ var Novely = (() => {
1061
1061
  const last = prev.saves.at(-1);
1062
1062
  if (!last)
1063
1063
  return add();
1064
- if (!times.has(last[2][0]))
1065
- return add();
1066
1064
  current[2][0] = intime(Date.now());
1067
1065
  current[2][1] = type;
1068
1066
  const isIdentical = dequal(last[0], current[0]) && dequal(last[1], current[1]);
1069
- if (last[2][1] === "auto" && type === "manual") {
1067
+ const isLastMadeInCurrentSession = times.has(last[2][0]);
1068
+ if (isLastMadeInCurrentSession && last[2][1] === "auto" && type === "manual") {
1070
1069
  return replace2();
1071
1070
  }
1072
1071
  if (last[2][1] === "manual" && type === "auto" && isIdentical) {
1073
1072
  return prev;
1074
1073
  }
1075
- if (last[2][1] === "auto" && type === "auto") {
1074
+ if (isLastMadeInCurrentSession && last[2][1] === "auto" && type === "auto") {
1076
1075
  return replace2();
1077
1076
  }
1078
1077
  return add();
@@ -1135,11 +1134,12 @@ var Novely = (() => {
1135
1134
  ctx: context,
1136
1135
  data: latest[1]
1137
1136
  });
1138
- const lastQueueItem = queue.at(-1);
1137
+ const lastQueueItem = queue.at(-1) || [];
1138
+ const lastQueueItemRequiresUserAction = isSkippedDuringRestore(lastQueueItem[0]) || isUserRequiredAction(lastQueueItem);
1139
1139
  await processor.run((item) => {
1140
1140
  if (!latest)
1141
1141
  return;
1142
- if (lastQueueItem === item) {
1142
+ if (lastQueueItem === item && lastQueueItemRequiresUserAction) {
1143
1143
  return;
1144
1144
  }
1145
1145
  const [action2, ...props] = item;
@@ -1183,7 +1183,7 @@ var Novely = (() => {
1183
1183
  return;
1184
1184
  }
1185
1185
  const ctx = renderer.getContext(MAIN_CONTEXT_KEY);
1186
- enmemory(ctx);
1186
+ save("auto");
1187
1187
  const stack = useStack(ctx);
1188
1188
  const current = stack.value;
1189
1189
  stack.clear();
@@ -1208,7 +1208,8 @@ var Novely = (() => {
1208
1208
  const t = (key, lang) => {
1209
1209
  return translation[lang].internal[key];
1210
1210
  };
1211
- const preview = async ([path, data2], name) => {
1211
+ const preview = async (save2, name) => {
1212
+ const [path, data2] = save2;
1212
1213
  const { queue } = getActionsFromPath(story, path, true);
1213
1214
  const ctx = renderer.getContext(name);
1214
1215
  ctx.meta.restoring = true;
@@ -1216,6 +1217,7 @@ var Novely = (() => {
1216
1217
  const processor = createQueueProcessor(queue, {
1217
1218
  skip: /* @__PURE__ */ new Set()
1218
1219
  });
1220
+ useStack(ctx).push(klona(save2));
1219
1221
  await processor.run(([action2, ...props]) => {
1220
1222
  if (isAudioAction(action2))
1221
1223
  return;