@bobfrankston/rmfmail 1.1.169 → 1.1.174

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.
Files changed (43) hide show
  1. package/bin/mailx.js +110 -2
  2. package/bin/mailx.js.map +1 -1
  3. package/bin/mailx.ts +95 -2
  4. package/client/android-bootstrap.bundle.js +4 -3
  5. package/client/android-bootstrap.bundle.js.map +2 -2
  6. package/client/app.bundle.js +55 -6
  7. package/client/app.bundle.js.map +2 -2
  8. package/client/components/message-list.js +96 -7
  9. package/client/components/message-list.js.map +1 -1
  10. package/client/components/message-list.ts +94 -6
  11. package/package.json +5 -5
  12. package/packages/mailx-core/index.js +1 -1
  13. package/packages/mailx-core/index.js.map +1 -1
  14. package/packages/mailx-core/index.ts +1 -1
  15. package/packages/mailx-imap/index.d.ts +11 -0
  16. package/packages/mailx-imap/index.d.ts.map +1 -1
  17. package/packages/mailx-imap/index.js +111 -5
  18. package/packages/mailx-imap/index.js.map +1 -1
  19. package/packages/mailx-imap/index.ts +102 -5
  20. package/packages/mailx-imap/package-lock.json +2 -2
  21. package/packages/mailx-imap/package.json +1 -1
  22. package/packages/mailx-store/db.d.ts +9 -1
  23. package/packages/mailx-store/db.d.ts.map +1 -1
  24. package/packages/mailx-store/db.js +15 -2
  25. package/packages/mailx-store/db.js.map +1 -1
  26. package/packages/mailx-store/db.ts +18 -4
  27. package/packages/mailx-store/package.json +1 -1
  28. package/packages/mailx-store/store.js +1 -1
  29. package/packages/mailx-store/store.js.map +1 -1
  30. package/packages/mailx-store/store.ts +1 -1
  31. package/packages/mailx-store-web/android-bootstrap.js +1 -1
  32. package/packages/mailx-store-web/android-bootstrap.js.map +1 -1
  33. package/packages/mailx-store-web/android-bootstrap.ts +1 -1
  34. package/packages/mailx-store-web/db.d.ts +2 -1
  35. package/packages/mailx-store-web/db.d.ts.map +1 -1
  36. package/packages/mailx-store-web/db.js +3 -2
  37. package/packages/mailx-store-web/db.js.map +1 -1
  38. package/packages/mailx-store-web/db.ts +4 -3
  39. package/packages/mailx-store-web/package.json +1 -1
  40. package/packages/mailx-store-web/sync-manager.js +1 -1
  41. package/packages/mailx-store-web/sync-manager.js.map +1 -1
  42. package/packages/mailx-store-web/sync-manager.ts +1 -1
  43. /package/packages/mailx-imap/{node_modules.npmglobalize-stash-61952 → node_modules.npmglobalize-stash-50120}/.package-lock.json +0 -0
@@ -2531,6 +2531,31 @@ function currentViewKey() {
2531
2531
  const flaggedOnly = document.getElementById("ml-body")?.classList.contains("flagged-only") || false;
2532
2532
  return cacheKey("folder", currentAccountId2, currentFolderId, flaggedOnly);
2533
2533
  }
2534
+ function withScrollAnchor(body, doRender) {
2535
+ const scrollTop = body.scrollTop;
2536
+ if (scrollTop < 4) {
2537
+ doRender();
2538
+ return;
2539
+ }
2540
+ const rowsBefore = Array.from(body.querySelectorAll(".ml-row"));
2541
+ let anchorUuid = "";
2542
+ let anchorOffsetWithinViewport = 0;
2543
+ for (const r of rowsBefore) {
2544
+ const visualTop = r.offsetTop - scrollTop;
2545
+ if (visualTop >= 0) {
2546
+ anchorUuid = r.dataset.uuid || "";
2547
+ anchorOffsetWithinViewport = visualTop;
2548
+ break;
2549
+ }
2550
+ }
2551
+ doRender();
2552
+ if (!anchorUuid)
2553
+ return;
2554
+ const after = body.querySelector(`.ml-row[data-uuid="${CSS.escape(anchorUuid)}"]`);
2555
+ if (after) {
2556
+ body.scrollTop = after.offsetTop - anchorOffsetWithinViewport;
2557
+ }
2558
+ }
2534
2559
  function rememberPosition() {
2535
2560
  const key = currentViewKey();
2536
2561
  if (!key)
@@ -2644,8 +2669,30 @@ function setRowSeen(accountId, uid, yes) {
2644
2669
  row.setUnreadClass(!yes);
2645
2670
  }
2646
2671
  function scrollFocusedIntoView() {
2647
- if (focusedRow)
2648
- focusedRow.el.scrollIntoView({ block: "center" });
2672
+ if (!focusedRow)
2673
+ return;
2674
+ let el = focusedRow.el;
2675
+ if (!document.body.contains(el)) {
2676
+ const body = document.getElementById("ml-body");
2677
+ const uid = focusedRow.msg?.uid;
2678
+ if (body && uid != null) {
2679
+ el = body.querySelector(`.ml-row[data-uid="${uid}"][data-account-id="${CSS.escape(focusedRow.accountId)}"]`) || body.querySelector(`.ml-row[data-uid="${uid}"]`);
2680
+ }
2681
+ if (!el) {
2682
+ const status = document.getElementById("status-sync");
2683
+ if (status) {
2684
+ status.textContent = "Selected message isn't in the loaded list \u2014 scroll down to load more, or open the folder it lives in.";
2685
+ setTimeout(() => {
2686
+ if (status?.textContent?.startsWith("Selected message"))
2687
+ status.textContent = "";
2688
+ }, 4e3);
2689
+ }
2690
+ return;
2691
+ }
2692
+ focusedRow.el = el;
2693
+ el.classList.add("selected");
2694
+ }
2695
+ el.scrollIntoView({ block: "center" });
2649
2696
  }
2650
2697
  function releaseFocus() {
2651
2698
  focusedRow = null;
@@ -2953,10 +3000,11 @@ async function loadUnifiedInbox(autoSelect = true) {
2953
3000
  return;
2954
3001
  }
2955
3002
  setMessages(result.items);
2956
- renderMessages(body, "", result.items);
3003
+ withScrollAnchor(body, () => renderMessages(body, "", result.items));
2957
3004
  const targetUuid = remembered ? pickRestoreUid(result.items, remembered) : null;
2958
3005
  if (targetUuid) {
2959
- body.scrollTop = savedScroll;
3006
+ if (!cached)
3007
+ body.scrollTop = savedScroll;
2960
3008
  restoreSelection(body, targetUuid);
2961
3009
  } else if (autoSelect) {
2962
3010
  selectFirst(body);
@@ -3101,7 +3149,7 @@ async function loadMessages(accountId, folderId, page = 1, specialUse = "", auto
3101
3149
  return;
3102
3150
  }
3103
3151
  setMessages(result.items);
3104
- renderMessages(body, accountId, result.items);
3152
+ withScrollAnchor(body, () => renderMessages(body, accountId, result.items));
3105
3153
  if (focusedRow) {
3106
3154
  const stillThere = result.items.some((m) => m.accountId === focusedRow.accountId && m.uid === focusedRow.msg.uid);
3107
3155
  if (!stillThere) {
@@ -3114,7 +3162,8 @@ async function loadMessages(accountId, folderId, page = 1, specialUse = "", auto
3114
3162
  requestAnimationFrame(() => {
3115
3163
  if (myGen !== loadGen)
3116
3164
  return;
3117
- body.scrollTop = savedScroll;
3165
+ if (!cached)
3166
+ body.scrollTop = savedScroll;
3118
3167
  restoreSelection(body, targetUuid);
3119
3168
  });
3120
3169
  } else if (autoSelect) {