akanjs 3.3.0-rc.30 → 3.3.0-rc.32
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/client/keyboardRide.ts +6 -3
- package/package.json +1 -1
- package/ui/System/Client.tsx +39 -21
- package/webkit/useFetch.ts +6 -2
package/client/keyboardRide.ts
CHANGED
|
@@ -73,17 +73,20 @@ export class KeyboardRide {
|
|
|
73
73
|
rider.style.transform = "";
|
|
74
74
|
}
|
|
75
75
|
KeyboardRide.#releaseInsets(lists);
|
|
76
|
-
|
|
76
|
+
|
|
77
|
+
const scrollers = KeyboardRide.#scrollersAtEnd(riders);
|
|
78
|
+
const listBoxes = lists.map((list) => KeyboardRide.#scrollerOf(list) ?? list);
|
|
77
79
|
const previous = KeyboardRide.#committed;
|
|
78
80
|
const isHeld = !isOverlay && height > previous;
|
|
79
81
|
KeyboardRide.#commit(height, scrollers);
|
|
80
82
|
const settled = riders.map(bottomOf);
|
|
81
|
-
const listsSettled =
|
|
83
|
+
const listsSettled = listBoxes.map(bottomOf);
|
|
82
84
|
if (isHeld || isOverlay) KeyboardRide.#commit(isOverlay ? 0 : previous, scrollers);
|
|
83
85
|
const laid = isHeld || isOverlay ? riders.map(bottomOf) : settled;
|
|
84
86
|
lists.forEach((list, idx) => {
|
|
85
87
|
const scroller = listEnds[idx] ?? null;
|
|
86
|
-
|
|
88
|
+
const rise = bottomOf(listBoxes[idx] ?? list) - (listsSettled[idx] ?? 0);
|
|
89
|
+
if (height > 0) KeyboardRide.#raiseList(list, rise, scroller, durationMs);
|
|
87
90
|
else KeyboardRide.#lowerList(list, scroller, durationMs);
|
|
88
91
|
});
|
|
89
92
|
riders.forEach((rider, idx) => {
|
package/package.json
CHANGED
package/ui/System/Client.tsx
CHANGED
|
@@ -209,28 +209,46 @@ export const ClientPathWrapper = ({
|
|
|
209
209
|
debugFrame("pathWrapper.mount", { path: pathRoute.path, pageType, href });
|
|
210
210
|
return () => debugFrame("pathWrapper.unmount", { path: pathRoute.path, pageType, href });
|
|
211
211
|
}, []);
|
|
212
|
+
|
|
213
|
+
const pathValue = useMemo(
|
|
214
|
+
() => ({
|
|
215
|
+
pageType,
|
|
216
|
+
pageKey,
|
|
217
|
+
location: {
|
|
218
|
+
href,
|
|
219
|
+
hash,
|
|
220
|
+
pathname,
|
|
221
|
+
params,
|
|
222
|
+
searchParams,
|
|
223
|
+
search,
|
|
224
|
+
pathRoute,
|
|
225
|
+
...(location?.entryId ? { entryId: location.entryId } : {}),
|
|
226
|
+
},
|
|
227
|
+
followsRouter: !location,
|
|
228
|
+
prefix,
|
|
229
|
+
gestureEnabled,
|
|
230
|
+
setGestureEnabled,
|
|
231
|
+
registerFrameSlot,
|
|
232
|
+
}),
|
|
233
|
+
[
|
|
234
|
+
pageType,
|
|
235
|
+
pageKey,
|
|
236
|
+
href,
|
|
237
|
+
hash,
|
|
238
|
+
pathname,
|
|
239
|
+
params,
|
|
240
|
+
searchParams,
|
|
241
|
+
search,
|
|
242
|
+
pathRoute,
|
|
243
|
+
location?.entryId,
|
|
244
|
+
!location,
|
|
245
|
+
prefix,
|
|
246
|
+
gestureEnabled,
|
|
247
|
+
registerFrameSlot,
|
|
248
|
+
],
|
|
249
|
+
);
|
|
212
250
|
return (
|
|
213
|
-
<pathContext.Provider
|
|
214
|
-
value={{
|
|
215
|
-
pageType,
|
|
216
|
-
pageKey,
|
|
217
|
-
location: {
|
|
218
|
-
href,
|
|
219
|
-
hash,
|
|
220
|
-
pathname,
|
|
221
|
-
params,
|
|
222
|
-
searchParams,
|
|
223
|
-
search,
|
|
224
|
-
pathRoute,
|
|
225
|
-
...(location?.entryId ? { entryId: location.entryId } : {}),
|
|
226
|
-
},
|
|
227
|
-
followsRouter: !location,
|
|
228
|
-
prefix,
|
|
229
|
-
gestureEnabled,
|
|
230
|
-
setGestureEnabled,
|
|
231
|
-
registerFrameSlot,
|
|
232
|
-
}}
|
|
233
|
-
>
|
|
251
|
+
<pathContext.Provider value={pathValue}>
|
|
234
252
|
<pageActivityContext.Provider value={pageActivity}>
|
|
235
253
|
<Frame
|
|
236
254
|
{...bindProps}
|
package/webkit/useFetch.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { isThenable } from "akanjs/common";
|
|
3
|
-
import { useEffect, useMemo, useState } from "react";
|
|
3
|
+
import { startTransition, useEffect, useMemo, useState } from "react";
|
|
4
4
|
|
|
5
5
|
export const useFetch = <Return>(
|
|
6
6
|
fnOrPromise: Promise<Return> | Return,
|
|
@@ -20,7 +20,11 @@ export const useFetch = <Return>(
|
|
|
20
20
|
void (async () => {
|
|
21
21
|
try {
|
|
22
22
|
const ret = await fnOrPromise;
|
|
23
|
-
if (
|
|
23
|
+
if (cancelled) return;
|
|
24
|
+
const next = { source: fnOrPromise, value: ret };
|
|
25
|
+
|
|
26
|
+
if (keepPrevious) startTransition(() => setSettled(next));
|
|
27
|
+
else setSettled(next);
|
|
24
28
|
} catch (err) {
|
|
25
29
|
if (cancelled) return;
|
|
26
30
|
const content = `Error: ${typeof err === "string" ? err : (err as Error).message}`;
|