clavarium 0.2.0-next.3 → 0.2.0-next.4

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.
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "clavarium",
3
- "version": "0.2.0-next.3",
3
+ "version": "0.2.0-next.4",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "clavarium",
9
- "version": "0.2.0-next.3",
9
+ "version": "0.2.0-next.4",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@xterm/addon-fit": "^0.11.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clavarium",
3
- "version": "0.2.0-next.3",
3
+ "version": "0.2.0-next.4",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "description": "A conversation is a VM with a terminal in it. Everything else is a folder.",
package/web/app.js CHANGED
@@ -2611,6 +2611,12 @@
2611
2611
  }
2612
2612
  addEventListener('popstate', (event) => {
2613
2613
  if (DEVICE) return;
2614
+ /* Back while a review is shown: the review closes, as with its own "‹" link. */
2615
+ if (reviewInHistory && !event.state?.review) {
2616
+ reviewInHistory = false;
2617
+ const back = gitBack; shutGit(); if (back?.go) back.go(); else focusTerminal();
2618
+ return;
2619
+ }
2614
2620
  pushed = event.state?.depth ?? 0;
2615
2621
  /* Walked back on purpose (Close): the address is set to what is shown. */
2616
2622
  if (skipPop) { skipPop = false; remember(false); return; }
@@ -3287,12 +3293,19 @@
3287
3293
  const g = $('gitview');
3288
3294
  if (host && g.parentNode !== host) host.append(g);
3289
3295
  g.classList.toggle('inset', Boolean(host));
3296
+ /* The device's own Back (a phone's gesture, the browser's button) closes the review: it is a step of its own in the history. */
3297
+ if (!DEVICE && !reviewInHistory) { history.pushState({ depth: pushed, review: true }, '', location.href); reviewInHistory = true; }
3290
3298
  gitShown = name; gitCommit = commit; gitAsked = target; gitAskedBranch = branch; gitBack = back; gitTab = 'changes';
3291
3299
  g.hidden = false; g.scrollTop = 0;
3292
3300
  await paintGit();
3293
3301
  }
3294
3302
  /* Left without its own button (Chat, Terminal, another conversation, another place). */
3295
- function shutGit() { $('gitview').hidden = true; gitShown = ''; gitBack = null; }
3303
+ let reviewInHistory = false;
3304
+ function shutGit() {
3305
+ $('gitview').hidden = true; gitShown = ''; gitBack = null;
3306
+ /* Closed by a click: its step in the history stays, as the place it was opened from. */
3307
+ if (reviewInHistory) { reviewInHistory = false; if (history.state?.review) history.replaceState({ depth: history.state.depth ?? 0 }, '', location.href); }
3308
+ }
3296
3309
  for (const b of $('gitview-tabs').querySelectorAll('[data-tab]')) b.addEventListener('click', () => { gitTab = b.dataset.tab; paintReviewTab(); });
3297
3310
  for (const b of $('gitview-layout').querySelectorAll('[data-layout]')) b.addEventListener('click', () => { gitLayout = b.dataset.layout; paintReviewTab(); drawDiff(gitText.replace(/\n$/, '')); });
3298
3311
  for (const b of $('gitview-picker').querySelectorAll('[data-step]')) b.addEventListener('click', () => { showFile(gitFile + Number(b.dataset.step)); $('gitview-diff').scrollIntoView({ block: 'start' }); });