akanjs 3.3.0-rc.10 → 3.3.0-rc.11

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.
package/CHANGELOG.md CHANGED
@@ -230,6 +230,7 @@
230
230
 
231
231
  **Upgrading.** Opening an optimized image's URL directly in a browser tab now downloads it instead of showing it; images in pages, CSS and `srcset` are unchanged. A cached passthrough image of type heic, ico, icns, bmp, jxl or tiff is now stored under its own extension instead of `.jpg`, so each one is fetched once more and its old cache file is left behind.
232
232
 
233
+ - 1a225e8: A chat list under an iOS overlay (`data-akan-keyboard-ride="inset"`) now slides down with the keys instead of dropping at once when they go down. Once the keys were up the list held its rise as bottom padding, so its box reached past what it showed by that padding; on the way down `KeyboardRide` read the box's bottom as where the list was drawn, found no distance to travel, and the list fell into place in one frame. The rise each inset rider took is now remembered and subtracted, so the list starts from where it was drawn.
233
234
  - e9598f3: Under an iOS shell that leaves the keyboard to the page, the page box now starts moving with the keys on their first frame. It followed a store update and React's render of the frame, which on a phone started the move about 100 ms after the keys, then jumped to catch up. `Device` now sets `--akan-keyboard-cover`, `--akan-keyboard-duration`, `--akan-keyboard-easing` and `data-akan-keyboard` on the root in the shell's keyboard event itself, and the page box's height and bottom padding follow `--akan-keyboard-cover` in CSS, so the transition starts before any render. `isPageKeyboardAvoidance` and `IOS_KEYBOARD_ANIMATION_EASING` now come from `akanjs/client` too.
234
235
  - 1885caf: A chat screen in an iOS app can now keep the whole screen while the keys are up, as a native chat does, so its tab bar and background stay drawn under the glass keyboard instead of the page ending at the keys. When the focused field sits inside an element marked `data-akan-keyboard-overlay`, `KeyboardRide` leaves the page box whole: the riders (`data-akan-keyboard-ride`) go where the shorter box would have put them and stay there, and a rider marked `data-akan-keyboard-ride="inset"` (a list's content) trades its lift for bottom padding once the keys are up, so the list still scrolls to its top. The root carries `data-akan-keyboard-overlay` meanwhile. Every other field keeps the page box ending at the keys, so a form field elsewhere is never left under them.
235
236
  - 45e3ffa: Under an iOS shell that leaves the keyboard to the page, the page now follows the keys without laying out on every frame. #715 animated the page box's `height`, which re-laid the page out on each frame of the keys' move and dropped frames on a phone, more so under glass (backdrop-filter) surfaces. `KeyboardRide` now changes the box once and carries whatever the page marks `data-akan-keyboard-ride` (a chat's list content, its composer) there as a `transform`, which WebKit hands to Core Animation: keys coming up hold the old box until they are up, since the shorter box would clip a rider still on its way, and keys going down give the taller box at once while the riders start from where they were drawn. A scroller resting at its end stays there. `data-akan-keyboard` on the root follows the keys at once, for what moves with them by transform or opacity; `data-akan-keyboard-layout` and `--akan-keyboard-cover` follow the box, for what changes layout. A page with no rider still gets the box in one step.
@@ -24,7 +24,7 @@ export class KeyboardRide {
24
24
  static #target = 0;
25
25
  static #isOverlay = false;
26
26
  static #timer: ReturnType<typeof setTimeout> | null = null;
27
- static #insets = new Map<HTMLElement, string>();
27
+ static #insets = new Map<HTMLElement, { paddingBottom: string; rise: number }>();
28
28
 
29
29
  static move(height: number, durationMs: number) {
30
30
  if (height === KeyboardRide.#target) return;
@@ -47,7 +47,8 @@ export class KeyboardRide {
47
47
  const riders = [...document.querySelectorAll<HTMLElement>(RIDE_SELECTOR)].filter(
48
48
  (element) => element.getClientRects().length > 0,
49
49
  );
50
- const drawn = riders.map(bottomOf);
50
+
51
+ const drawn = riders.map((rider) => bottomOf(rider) - (KeyboardRide.#insets.get(rider)?.rise ?? 0));
51
52
  for (const rider of riders) {
52
53
  rider.style.transition = "none";
53
54
  rider.style.transform = "";
@@ -97,14 +98,14 @@ export class KeyboardRide {
97
98
  riders.forEach((rider, idx) => {
98
99
  const rise = laid[idx] - settled[idx];
99
100
  if (!isInset(rider) || rise <= 0) return;
100
- KeyboardRide.#insets.set(rider, rider.style.paddingBottom);
101
+ KeyboardRide.#insets.set(rider, { paddingBottom: rider.style.paddingBottom, rise });
101
102
  rider.style.paddingBottom = `calc(${getComputedStyle(rider).paddingBottom} + ${rise}px)`;
102
103
  });
103
104
  for (const scroller of scrollers) scroller.scrollTop = scroller.scrollHeight;
104
105
  }
105
106
 
106
107
  static #releaseInsets() {
107
- for (const [rider, paddingBottom] of KeyboardRide.#insets) rider.style.paddingBottom = paddingBottom;
108
+ for (const [rider, { paddingBottom }] of KeyboardRide.#insets) rider.style.paddingBottom = paddingBottom;
108
109
  KeyboardRide.#insets.clear();
109
110
  }
110
111
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "akanjs",
3
- "version": "3.3.0-rc.10",
3
+ "version": "3.3.0-rc.11",
4
4
  "sourceType": "module",
5
5
  "type": "module",
6
6
  "publishConfig": {