samagotchi 0.167.0 → 0.168.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.
@@ -204,7 +204,8 @@ export function outlineBlock(blockEl, gens) {
204
204
  // taskStop the page's stopper (task_stop.js): a running task_wait
205
205
  // row gets its stop-task button (none: no button).
206
206
  // A new step goes on top of the block while the turn runs (chronological()
207
- // restores the order at its end).
207
+ // restores the order at its end), or last once inOrder() was called (the
208
+ // block went into the history mid-turn).
208
209
  export function createTurnBlock({
209
210
  historyEl, isNearBottom, sawText, sessionId, blockHost, follow, placeAnswer,
210
211
  onChange = () => {},
@@ -227,6 +228,9 @@ export function createTurnBlock({
227
228
  let flushTimer = null;
228
229
  // When the last flush wrote something (performance.now()).
229
230
  let lastFlushAt = -Infinity;
231
+ // New steps go last, not on top (inOrder: the block left the stage's
232
+ // cloud for the history, stage_opened.js).
233
+ let inOrder = false;
230
234
 
231
235
  function removeHint() {
232
236
  const hint = historyEl.querySelector(".hint");
@@ -318,7 +322,8 @@ export function createTurnBlock({
318
322
  draw(entry);
319
323
  entry.el = entry.end.previousElementSibling || entry.frag.querySelector("details.gen");
320
324
  const stick = isNearBottom();
321
- blockEl.insertBefore(entry.frag, blockSummaryEl.nextSibling);
325
+ if (inOrder) blockEl.appendChild(entry.frag);
326
+ else blockEl.insertBefore(entry.frag, blockSummaryEl.nextSibling);
322
327
  if (stick) follow();
323
328
  return entry;
324
329
  }
@@ -699,6 +704,7 @@ export function createTurnBlock({
699
704
  pendingSteers = [];
700
705
  cancelFlush();
701
706
  lastFlushAt = -Infinity;
707
+ inOrder = false;
702
708
  }
703
709
 
704
710
  return {
@@ -798,6 +804,12 @@ export function createTurnBlock({
798
804
  return entry ? { el: entry.el, summary: entry.el.querySelector(":scope > summary"), thinkingWrap: thinkingWrap(entry) } : null;
799
805
  },
800
806
  chronological,
807
+ // From now on the steps are in order: the ones so far, and each new
808
+ // one last.
809
+ inOrder() {
810
+ chronological();
811
+ inOrder = true;
812
+ },
801
813
  };
802
814
  }
803
815
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: samagotchi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.167.0
4
+ version: 0.168.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Dedov
@@ -956,6 +956,7 @@ files:
956
956
  - lib/samagotchi/web/public/format.js
957
957
  - lib/samagotchi/web/public/forms.css
958
958
  - lib/samagotchi/web/public/hash_intent.js
959
+ - lib/samagotchi/web/public/history_end.js
959
960
  - lib/samagotchi/web/public/history_reveal.js
960
961
  - lib/samagotchi/web/public/history_shape.js
961
962
  - lib/samagotchi/web/public/icons/chi-180.png
@@ -1043,8 +1044,10 @@ files:
1043
1044
  - lib/samagotchi/web/public/settings_panel.js
1044
1045
  - lib/samagotchi/web/public/shell_command.js
1045
1046
  - lib/samagotchi/web/public/shown_texts.js
1047
+ - lib/samagotchi/web/public/stage_cards.js
1046
1048
  - lib/samagotchi/web/public/stage_frame.js
1047
1049
  - lib/samagotchi/web/public/stage_model.js
1050
+ - lib/samagotchi/web/public/stage_opened.js
1048
1051
  - lib/samagotchi/web/public/stage_slots.js
1049
1052
  - lib/samagotchi/web/public/stage_stall.js
1050
1053
  - lib/samagotchi/web/public/stage_view.js