shadok-ai 0.19.80 → 0.19.81

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 (2) hide show
  1. package/package.json +1 -1
  2. package/public/index.html +34 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shadok-ai",
3
- "version": "0.19.80",
3
+ "version": "0.19.81",
4
4
  "main": "dist/session.js",
5
5
  "scripts": {
6
6
  "test": "node --import tsx --test --test-timeout=120000 test/*.ts context/*/test/*.test.mjs",
package/public/index.html CHANGED
@@ -2124,6 +2124,9 @@
2124
2124
  and it costs a good third of the conversation still visible; it comes back
2125
2125
  the moment the keyboard closes. */
2126
2126
  body.kb-up header { display: none; }
2127
+ /* The keyboard covers the home indicator: the safe-area padding that keeps
2128
+ the field clear of it would only leave a dead band above the keyboard. */
2129
+ body.kb-up #composer { padding-bottom: 8px; }
2127
2130
  }
2128
2131
  /* iOS Safari ZOOMS INTO any focused field whose font is under 16px. That zoom is
2129
2132
  the single cause of two symptoms that look unrelated: the layout viewport
@@ -12862,14 +12865,20 @@
12862
12865
  if (window.visualViewport && matchMedia("(pointer: coarse)").matches) {
12863
12866
  const vv = window.visualViewport;
12864
12867
  let pending = 0;
12868
+ // The keyboard-free height: the tallest the visible viewport has been since
12869
+ // the last rotation. The keyboard used to be read as `innerHeight - vv.height`,
12870
+ // but that assumes the LAYOUT viewport keeps its height when the keyboard
12871
+ // opens — and an installed (Home Screen) cockpit on a recent iOS shrinks both,
12872
+ // so the gap stayed 0: no `kb-up`, the header never folded away and the
12873
+ // composer kept its home-indicator padding above the keyboard (a dead band).
12874
+ let fullH = Math.max(window.innerHeight, vv.height);
12875
+ const kbOpen = () => fullH - vv.height > 120; // a retracting URL bar is not a keyboard
12865
12876
  const syncViewport = () => {
12866
12877
  pending = 0;
12878
+ fullH = Math.max(fullH, vv.height);
12867
12879
  document.documentElement.style.setProperty("--app-h", vv.height + "px");
12868
12880
  document.body.classList.add("vv-sized");
12869
- // `innerHeight` is the LAYOUT viewport: it does not move when the keyboard
12870
- // opens, so the gap between the two IS the keyboard. The threshold keeps a
12871
- // retracting URL bar from being read as one.
12872
- document.body.classList.toggle("kb-up", window.innerHeight - vv.height > 120);
12881
+ document.body.classList.toggle("kb-up", kbOpen());
12873
12882
  // The chassis now fits above the keyboard: if the browser already dragged
12874
12883
  // the document, that offset hides nothing but the header.
12875
12884
  if (window.scrollY || window.scrollX) window.scrollTo(0, 0);
@@ -12880,6 +12889,27 @@
12880
12889
  const schedule = () => { if (!pending) pending = requestAnimationFrame(syncViewport); };
12881
12890
  vv.addEventListener("resize", schedule);
12882
12891
  vv.addEventListener("scroll", schedule);
12892
+ // A rotation changes what "full height" means: start over from what is seen.
12893
+ matchMedia("(orientation: portrait)").addEventListener("change", () => {
12894
+ fullH = 0;
12895
+ setTimeout(() => { fullH = Math.max(window.innerHeight, vv.height); schedule(); }, 300);
12896
+ });
12897
+ // Closing: iOS reports the new height only once the keyboard has finished
12898
+ // sliding away, so for that whole animation the chassis stayed keyboard-sized
12899
+ // and the composer floated mid-screen above an empty band, then snapped down.
12900
+ // Leaving the field IS the keyboard closing (unless focus moves to another
12901
+ // text field), so give the chassis its full height at once: the keyboard then
12902
+ // slides off a page already in place. The real resize lands later and agrees.
12903
+ const typesText = (el) => !!el && (el.isContentEditable || el.tagName === "TEXTAREA"
12904
+ || (el.tagName === "INPUT" && !/^(button|submit|reset|checkbox|radio|file|range|color|image)$/i.test(el.type)));
12905
+ document.addEventListener("focusout", (e) => {
12906
+ if (!document.body.classList.contains("kb-up") || typesText(e.relatedTarget)) return;
12907
+ if (pending) { cancelAnimationFrame(pending); pending = 0; }
12908
+ document.documentElement.style.setProperty("--app-h", fullH + "px");
12909
+ document.body.classList.remove("kb-up");
12910
+ if (window.scrollY || window.scrollX) window.scrollTo(0, 0);
12911
+ if (active) pinBottom(active);
12912
+ });
12883
12913
  syncViewport();
12884
12914
  }
12885
12915