@oxyhq/bloom 0.79.0 → 0.80.0
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/README.md +3 -3
- package/lib/commonjs/provider/index.js +11 -7
- package/lib/commonjs/provider/index.js.map +1 -1
- package/lib/commonjs/scroll/context.js +96 -0
- package/lib/commonjs/scroll/context.js.map +1 -0
- package/lib/commonjs/scroll/expo-router/index.js +133 -0
- package/lib/commonjs/scroll/expo-router/index.js.map +1 -0
- package/lib/commonjs/scroll/index.js +85 -21
- package/lib/commonjs/scroll/index.js.map +1 -1
- package/lib/commonjs/scroll/index.web.js +221 -121
- package/lib/commonjs/scroll/index.web.js.map +1 -1
- package/lib/commonjs/scroll/scrollable.native.js +58 -0
- package/lib/commonjs/scroll/scrollable.native.js.map +1 -0
- package/lib/commonjs/scroll/scrollable.web.js +9 -3
- package/lib/commonjs/scroll/scrollable.web.js.map +1 -1
- package/lib/commonjs/scroll/store.js +47 -25
- package/lib/commonjs/scroll/store.js.map +1 -1
- package/lib/commonjs/tabs/Tabs.js +263 -63
- package/lib/commonjs/tabs/Tabs.js.map +1 -1
- package/lib/commonjs/tabs/expo-router/RouterTabs.js +215 -0
- package/lib/commonjs/tabs/expo-router/RouterTabs.js.map +1 -0
- package/lib/commonjs/tabs/expo-router/index.js +13 -0
- package/lib/commonjs/tabs/expo-router/index.js.map +1 -0
- package/lib/commonjs/theme/color-policy.js +11 -10
- package/lib/commonjs/theme/color-policy.js.map +1 -1
- package/lib/module/provider/index.js +10 -6
- package/lib/module/provider/index.js.map +1 -1
- package/lib/module/scroll/context.js +90 -0
- package/lib/module/scroll/context.js.map +1 -0
- package/lib/module/scroll/expo-router/index.js +128 -0
- package/lib/module/scroll/expo-router/index.js.map +1 -0
- package/lib/module/scroll/index.js +80 -21
- package/lib/module/scroll/index.js.map +1 -1
- package/lib/module/scroll/index.web.js +218 -122
- package/lib/module/scroll/index.web.js.map +1 -1
- package/lib/module/scroll/scrollable.native.js +54 -0
- package/lib/module/scroll/scrollable.native.js.map +1 -0
- package/lib/module/scroll/scrollable.web.js +9 -3
- package/lib/module/scroll/scrollable.web.js.map +1 -1
- package/lib/module/scroll/store.js +47 -25
- package/lib/module/scroll/store.js.map +1 -1
- package/lib/module/tabs/Tabs.js +271 -65
- package/lib/module/tabs/Tabs.js.map +1 -1
- package/lib/module/tabs/expo-router/RouterTabs.js +210 -0
- package/lib/module/tabs/expo-router/RouterTabs.js.map +1 -0
- package/lib/module/tabs/expo-router/index.js +10 -0
- package/lib/module/tabs/expo-router/index.js.map +1 -0
- package/lib/module/theme/color-policy.js +11 -10
- package/lib/module/theme/color-policy.js.map +1 -1
- package/lib/typescript/commonjs/provider/index.d.ts +7 -5
- package/lib/typescript/commonjs/provider/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/scroll/context.d.ts +14 -0
- package/lib/typescript/commonjs/scroll/context.d.ts.map +1 -0
- package/lib/typescript/commonjs/scroll/expo-router/index.d.ts +7 -0
- package/lib/typescript/commonjs/scroll/expo-router/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/scroll/index.d.ts +14 -23
- package/lib/typescript/commonjs/scroll/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/scroll/index.web.d.ts +17 -19
- package/lib/typescript/commonjs/scroll/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/scroll/scrollable.native.d.ts +23 -0
- package/lib/typescript/commonjs/scroll/scrollable.native.d.ts.map +1 -0
- package/lib/typescript/commonjs/scroll/scrollable.web.d.ts +18 -5
- package/lib/typescript/commonjs/scroll/scrollable.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/scroll/store.d.ts +41 -22
- package/lib/typescript/commonjs/scroll/store.d.ts.map +1 -1
- package/lib/typescript/commonjs/scroll/types.d.ts +82 -12
- package/lib/typescript/commonjs/scroll/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/tabs/Tabs.d.ts +41 -1
- package/lib/typescript/commonjs/tabs/Tabs.d.ts.map +1 -1
- package/lib/typescript/commonjs/tabs/expo-router/RouterTabs.d.ts +80 -0
- package/lib/typescript/commonjs/tabs/expo-router/RouterTabs.d.ts.map +1 -0
- package/lib/typescript/commonjs/tabs/expo-router/index.d.ts +9 -0
- package/lib/typescript/commonjs/tabs/expo-router/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/tabs/types.d.ts +48 -4
- package/lib/typescript/commonjs/tabs/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/theme/color-policy.d.ts.map +1 -1
- package/lib/typescript/module/provider/index.d.ts +7 -5
- package/lib/typescript/module/provider/index.d.ts.map +1 -1
- package/lib/typescript/module/scroll/context.d.ts +14 -0
- package/lib/typescript/module/scroll/context.d.ts.map +1 -0
- package/lib/typescript/module/scroll/expo-router/index.d.ts +7 -0
- package/lib/typescript/module/scroll/expo-router/index.d.ts.map +1 -0
- package/lib/typescript/module/scroll/index.d.ts +14 -23
- package/lib/typescript/module/scroll/index.d.ts.map +1 -1
- package/lib/typescript/module/scroll/index.web.d.ts +17 -19
- package/lib/typescript/module/scroll/index.web.d.ts.map +1 -1
- package/lib/typescript/module/scroll/scrollable.native.d.ts +23 -0
- package/lib/typescript/module/scroll/scrollable.native.d.ts.map +1 -0
- package/lib/typescript/module/scroll/scrollable.web.d.ts +18 -5
- package/lib/typescript/module/scroll/scrollable.web.d.ts.map +1 -1
- package/lib/typescript/module/scroll/store.d.ts +41 -22
- package/lib/typescript/module/scroll/store.d.ts.map +1 -1
- package/lib/typescript/module/scroll/types.d.ts +82 -12
- package/lib/typescript/module/scroll/types.d.ts.map +1 -1
- package/lib/typescript/module/tabs/Tabs.d.ts +41 -1
- package/lib/typescript/module/tabs/Tabs.d.ts.map +1 -1
- package/lib/typescript/module/tabs/expo-router/RouterTabs.d.ts +80 -0
- package/lib/typescript/module/tabs/expo-router/RouterTabs.d.ts.map +1 -0
- package/lib/typescript/module/tabs/expo-router/index.d.ts +9 -0
- package/lib/typescript/module/tabs/expo-router/index.d.ts.map +1 -0
- package/lib/typescript/module/tabs/types.d.ts +48 -4
- package/lib/typescript/module/tabs/types.d.ts.map +1 -1
- package/lib/typescript/module/theme/color-policy.d.ts.map +1 -1
- package/package.json +29 -1
- package/src/__tests__/BloomProvider.web.test.tsx +8 -15
- package/src/__tests__/Tabs.test.tsx +187 -0
- package/src/__tests__/optional-peer-imports.test.ts +7 -2
- package/src/__tests__/scroll-expo-router-adapter.test.tsx +164 -0
- package/src/__tests__/scroll-native.test.tsx +465 -0
- package/src/__tests__/scroll-store.test.ts +41 -17
- package/src/__tests__/scroll-web.test.tsx +797 -108
- package/src/provider/index.tsx +10 -7
- package/src/scroll/context.tsx +107 -0
- package/src/scroll/expo-router/index.ts +140 -0
- package/src/scroll/index.ts +92 -25
- package/src/scroll/index.web.tsx +255 -162
- package/src/scroll/scrollable.native.ts +64 -0
- package/src/scroll/scrollable.web.ts +30 -8
- package/src/scroll/store.ts +47 -25
- package/src/scroll/types.ts +82 -12
- package/src/tabs/Tabs.tsx +352 -77
- package/src/tabs/expo-router/RouterTabs.tsx +268 -0
- package/src/tabs/expo-router/index.ts +8 -0
- package/src/tabs/types.ts +48 -4
- package/src/theme/__tests__/__fixtures__/golden-resolved-tokens.json +5 -5
- package/src/theme/__tests__/__snapshots__/visual-gallery.test.tsx.snap +11 -11
- package/src/theme/__tests__/policy-legibility.test.ts +10 -7
- package/src/theme/color-policy.ts +11 -10
- package/lib/commonjs/provider/scroll-provider.js +0 -13
- package/lib/commonjs/provider/scroll-provider.js.map +0 -1
- package/lib/commonjs/provider/scroll-provider.web.js +0 -13
- package/lib/commonjs/provider/scroll-provider.web.js.map +0 -1
- package/lib/module/provider/scroll-provider.js +0 -16
- package/lib/module/provider/scroll-provider.js.map +0 -1
- package/lib/module/provider/scroll-provider.web.js +0 -5
- package/lib/module/provider/scroll-provider.web.js.map +0 -1
- package/lib/typescript/commonjs/provider/scroll-provider.d.ts +0 -14
- package/lib/typescript/commonjs/provider/scroll-provider.d.ts.map +0 -1
- package/lib/typescript/commonjs/provider/scroll-provider.web.d.ts +0 -3
- package/lib/typescript/commonjs/provider/scroll-provider.web.d.ts.map +0 -1
- package/lib/typescript/module/provider/scroll-provider.d.ts +0 -14
- package/lib/typescript/module/provider/scroll-provider.d.ts.map +0 -1
- package/lib/typescript/module/provider/scroll-provider.web.d.ts +0 -3
- package/lib/typescript/module/provider/scroll-provider.web.d.ts.map +0 -1
- package/src/__tests__/scroll-native.test.ts +0 -25
- package/src/provider/scroll-provider.ts +0 -13
- package/src/provider/scroll-provider.web.ts +0 -2
|
@@ -1,34 +1,93 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Native variant of the scroll-restoration primitive
|
|
4
|
+
* Native variant of the scroll-restoration primitive.
|
|
5
5
|
*
|
|
6
|
-
* React Navigation's native-stack keeps every screen
|
|
7
|
-
* stack, so a list's scroll position survives a push/pop for free
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
6
|
+
* React Navigation's native-stack keeps every screen MOUNTED while it is in the
|
|
7
|
+
* stack, so a list's scroll position survives a push/pop for free — this file
|
|
8
|
+
* must not interfere with that, and does not: nothing here runs on focus.
|
|
9
|
+
*
|
|
10
|
+
* What native does not survive is a KEY CHANGE: an in-screen tab or folder swap
|
|
11
|
+
* that re-keys a list, and a screen that genuinely unmounts and remounts. The
|
|
12
|
+
* effect below is therefore keyed on the storage key (plus `enabled`) rather
|
|
13
|
+
* than on focus, which draws exactly that line with no bookkeeping: React
|
|
14
|
+
* re-runs it when the key changes and leaves it alone when a push/pop merely
|
|
15
|
+
* re-focuses the same screen showing the same content.
|
|
12
16
|
*
|
|
13
17
|
* Web bundlers select `./index.web` via the `"browser"` export condition in
|
|
14
18
|
* `package.json`; native bundlers fall through to this file.
|
|
15
19
|
*/
|
|
16
|
-
|
|
20
|
+
import { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
21
|
+
import { useScrollRestorationContext } from "./context.js";
|
|
22
|
+
import { createScroller } from "./scrollable.native.js";
|
|
23
|
+
import { deriveScrollKey } from "./store.js";
|
|
24
|
+
export { ScrollRestorationProvider } from "./context.js";
|
|
17
25
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
26
|
+
* Preserve and restore the scroll offset of `target` across content changes,
|
|
27
|
+
* keyed by the content its screen is showing plus an optional `options.key`.
|
|
28
|
+
*
|
|
29
|
+
* Behaviour (native):
|
|
30
|
+
* - Offsets are recorded from the returned `onScroll` binding, which the caller
|
|
31
|
+
* wires onto the list. There is no other way to observe a list's offset.
|
|
32
|
+
* - When the storage key changes — a re-keyed list, a remount, or `enabled`
|
|
33
|
+
* turning on — the saved offset is applied, or 0 when the key was never seen.
|
|
34
|
+
* - A push/pop that re-focuses the same screen scrolls nothing. The navigator
|
|
35
|
+
* already preserved the position, and re-applying it would at best be a
|
|
36
|
+
* no-op and at worst fight a list that has legitimately moved on.
|
|
20
37
|
*/
|
|
21
|
-
export function
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
38
|
+
export function useScrollRestoration(target, options) {
|
|
39
|
+
const {
|
|
40
|
+
store,
|
|
41
|
+
adapter
|
|
42
|
+
} = useScrollRestorationContext();
|
|
43
|
+
const contentId = adapter.useScreenContentId();
|
|
44
|
+
const enabled = options?.enabled ?? true;
|
|
45
|
+
const scrollKey = deriveScrollKey(contentId, options?.key);
|
|
26
46
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
47
|
+
// The key the live `onScroll` binding is allowed to record against. It is
|
|
48
|
+
// assigned by the effect below only AFTER that effect's own write has landed,
|
|
49
|
+
// and cleared by its cleanup — so the relayout the outgoing content emits
|
|
50
|
+
// while a new key is already rendered is never attributed to the new key.
|
|
51
|
+
const recordingKeyRef = useRef(null);
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
if (!enabled || scrollKey === null) return undefined;
|
|
54
|
+
const scroller = createScroller(target);
|
|
55
|
+
let frame = null;
|
|
56
|
+
|
|
57
|
+
// Restore and reset are ONE write: a miss reads 0, and 0 is exactly what a
|
|
58
|
+
// list showing content never seen this session must be sent to rather than
|
|
59
|
+
// left at the offset its predecessor had.
|
|
60
|
+
const apply = () => {
|
|
61
|
+
frame = null;
|
|
62
|
+
scroller.setOffset(store.read(scrollKey));
|
|
63
|
+
recordingKeyRef.current = scrollKey;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
// Defer one frame. This effect fires in the same commit that rendered the
|
|
67
|
+
// incoming rows, and a list cannot honour an offset before it has laid them
|
|
68
|
+
// out — the write would be clamped to whatever height it has reached so
|
|
69
|
+
// far, with no second chance (unlike web, native gets no scroll event to
|
|
70
|
+
// re-apply from). One frame is all that is needed because `enabled` has
|
|
71
|
+
// already guaranteed the rows are there; what remains is the layout pass.
|
|
72
|
+
if (typeof requestAnimationFrame === 'function') {
|
|
73
|
+
frame = requestAnimationFrame(apply);
|
|
74
|
+
} else {
|
|
75
|
+
// No frame scheduler (SSR, or a bare Node import of this barrel).
|
|
76
|
+
// Applying immediately is still the correct write; only the wait is lost.
|
|
77
|
+
apply();
|
|
78
|
+
}
|
|
79
|
+
return () => {
|
|
80
|
+
if (frame !== null) cancelAnimationFrame(frame);
|
|
81
|
+
recordingKeyRef.current = null;
|
|
82
|
+
};
|
|
83
|
+
}, [store, scrollKey, enabled, target]);
|
|
84
|
+
const onScroll = useCallback(event => {
|
|
85
|
+
const key = recordingKeyRef.current;
|
|
86
|
+
if (key === null) return;
|
|
87
|
+
store.save(key, event.nativeEvent.contentOffset.y);
|
|
88
|
+
}, [store]);
|
|
89
|
+
return useMemo(() => ({
|
|
90
|
+
onScroll
|
|
91
|
+
}), [onScroll]);
|
|
33
92
|
}
|
|
34
93
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["useCallback","useEffect","useMemo","useRef","useScrollRestorationContext","createScroller","deriveScrollKey","ScrollRestorationProvider","useScrollRestoration","target","options","store","adapter","contentId","useScreenContentId","enabled","scrollKey","key","recordingKeyRef","undefined","scroller","frame","apply","setOffset","read","current","requestAnimationFrame","cancelAnimationFrame","onScroll","event","save","nativeEvent","contentOffset","y"],"sourceRoot":"../../../src","sources":["scroll/index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ,OAAO;AAE/D,SAASC,2BAA2B,QAAQ,cAAW;AACvD,SAASC,cAAc,QAAQ,wBAAqB;AACpD,SAASC,eAAe,QAAQ,YAAS;AAOzC,SAASC,yBAAyB,QAAQ,cAAW;AAYrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,oBAAoBA,CAClCC,MAA+B,EAC/BC,OAAqC,EACX;EAC1B,MAAM;IAAEC,KAAK;IAAEC;EAAQ,CAAC,GAAGR,2BAA2B,CAAC,CAAC;EACxD,MAAMS,SAAS,GAAGD,OAAO,CAACE,kBAAkB,CAAC,CAAC;EAC9C,MAAMC,OAAO,GAAGL,OAAO,EAAEK,OAAO,IAAI,IAAI;EACxC,MAAMC,SAAS,GAAGV,eAAe,CAACO,SAAS,EAAEH,OAAO,EAAEO,GAAG,CAAC;;EAE1D;EACA;EACA;EACA;EACA,MAAMC,eAAe,GAAGf,MAAM,CAAgB,IAAI,CAAC;EAEnDF,SAAS,CAAC,MAAM;IACd,IAAI,CAACc,OAAO,IAAIC,SAAS,KAAK,IAAI,EAAE,OAAOG,SAAS;IAEpD,MAAMC,QAAQ,GAAGf,cAAc,CAACI,MAAM,CAAC;IACvC,IAAIY,KAAoB,GAAG,IAAI;;IAE/B;IACA;IACA;IACA,MAAMC,KAAK,GAAGA,CAAA,KAAY;MACxBD,KAAK,GAAG,IAAI;MACZD,QAAQ,CAACG,SAAS,CAACZ,KAAK,CAACa,IAAI,CAACR,SAAS,CAAC,CAAC;MACzCE,eAAe,CAACO,OAAO,GAAGT,SAAS;IACrC,CAAC;;IAED;IACA;IACA;IACA;IACA;IACA;IACA,IAAI,OAAOU,qBAAqB,KAAK,UAAU,EAAE;MAC/CL,KAAK,GAAGK,qBAAqB,CAACJ,KAAK,CAAC;IACtC,CAAC,MAAM;MACL;MACA;MACAA,KAAK,CAAC,CAAC;IACT;IAEA,OAAO,MAAM;MACX,IAAID,KAAK,KAAK,IAAI,EAAEM,oBAAoB,CAACN,KAAK,CAAC;MAC/CH,eAAe,CAACO,OAAO,GAAG,IAAI;IAChC,CAAC;EACH,CAAC,EAAE,CAACd,KAAK,EAAEK,SAAS,EAAED,OAAO,EAAEN,MAAM,CAAC,CAAC;EAEvC,MAAMmB,QAAQ,GAAG5B,WAAW,CACzB6B,KAAK,IAAK;IACT,MAAMZ,GAAG,GAAGC,eAAe,CAACO,OAAO;IACnC,IAAIR,GAAG,KAAK,IAAI,EAAE;IAClBN,KAAK,CAACmB,IAAI,CAACb,GAAG,EAAEY,KAAK,CAACE,WAAW,CAACC,aAAa,CAACC,CAAC,CAAC;EACpD,CAAC,EACD,CAACtB,KAAK,CACR,CAAC;EAED,OAAOT,OAAO,CAAC,OAAO;IAAE0B;EAAS,CAAC,CAAC,EAAE,CAACA,QAAQ,CAAC,CAAC;AAClD","ignoreList":[]}
|
|
@@ -3,22 +3,22 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* Web variant of the scroll-restoration primitive.
|
|
5
5
|
*
|
|
6
|
-
* Mirrors the proven Bluesky pattern (`history.scrollRestoration
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
6
|
+
* Mirrors the proven Bluesky pattern (manual `history.scrollRestoration` plus
|
|
7
|
+
* an in-memory `Map<key, offset>`) with three deliberate differences forced by
|
|
8
|
+
* Oxy's layouts and by the behaviour of the (expo-router-wrapped) React
|
|
9
|
+
* Navigation web stack:
|
|
10
10
|
*
|
|
11
11
|
* 1. Bluesky restores the WINDOW scroller, whereas Oxy apps keep multi-column
|
|
12
12
|
* layouts whose feed scrolls an INNER container. So we restore the offset
|
|
13
13
|
* of a caller-registered scrollable (a ref to an element / RN scroll
|
|
14
|
-
* component, or the `'window'` sentinel)
|
|
14
|
+
* component, or the `'window'` sentinel).
|
|
15
15
|
*
|
|
16
|
-
* 2. The web stack HIDES the background screen on push. While
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
16
|
+
* 2. The web stack HIDES the background screen on push. While hidden, the
|
|
17
|
+
* previous screen's scroll container collapses (`scrollHeight ===
|
|
18
|
+
* clientHeight`) and the navigator forces its `scrollTop` to 0. The screen
|
|
19
|
+
* is NOT unmounted, so a virtualized list (e.g. FlashList) keeps its rows
|
|
20
|
+
* but re-lays them out over SEVERAL frames once the screen is re-shown. Two
|
|
21
|
+
* problems follow, both handled here:
|
|
22
22
|
*
|
|
23
23
|
* (a) A blur-time read of `scrollTop` returns the navigator's forced 0,
|
|
24
24
|
* not the user's real offset — saving it would clobber the good
|
|
@@ -32,32 +32,26 @@
|
|
|
32
32
|
* sticks (the content has grown tall enough) or a small frame cap is
|
|
33
33
|
* reached.
|
|
34
34
|
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
35
|
+
* 3. A document-scrolled app (one window scroller shared by every route) has
|
|
36
|
+
* no per-screen container to reset, so an unrecognised key MUST be written
|
|
37
|
+
* to 0 explicitly. Doing nothing leaves the previous screen's offset in
|
|
38
|
+
* place and the new screen opens mid-page.
|
|
37
39
|
*
|
|
38
|
-
*
|
|
39
|
-
* `
|
|
40
|
-
* than from `@react-navigation/native` directly. Every Oxy app uses expo-router
|
|
41
|
-
* as its router, so it is always a DIRECT, top-level dependency that resolves
|
|
42
|
-
* cleanly under Bun's isolated linker — whereas `@react-navigation/native` is
|
|
43
|
-
* only a nested/transitive dependency of expo-router and would fail to resolve
|
|
44
|
-
* when bundling those apps.
|
|
40
|
+
* Native bundlers use `./index.ts`; web bundlers select this file via the
|
|
41
|
+
* `"browser"` export condition in `package.json`.
|
|
45
42
|
*/
|
|
46
|
-
import {
|
|
47
|
-
import {
|
|
43
|
+
import { useCallback, useRef } from 'react';
|
|
44
|
+
import { useScrollRestorationContext } from "./context.js";
|
|
48
45
|
import { createScroller } from "./scrollable.web.js";
|
|
49
|
-
import {
|
|
50
|
-
|
|
51
|
-
const ScrollOffsetContext = /*#__PURE__*/createContext(null);
|
|
52
|
-
ScrollOffsetContext.displayName = 'BloomScrollOffsetContext';
|
|
53
|
-
|
|
46
|
+
import { deriveScrollKey } from "./store.js";
|
|
47
|
+
export { ScrollRestorationProvider } from "./context.js";
|
|
54
48
|
/**
|
|
55
|
-
* Maximum number of animation frames the
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
49
|
+
* Maximum number of animation frames the restore will re-apply the saved offset
|
|
50
|
+
* before giving up. A virtualized list re-lays out its rows over a handful of
|
|
51
|
+
* frames after its screen is re-shown; ~30 frames (≈0.5s at 60fps) is
|
|
52
|
+
* comfortably longer than any observed relayout while staying short enough that
|
|
53
|
+
* the loop never lingers as a perceptible cost. The loop normally exits far
|
|
54
|
+
* earlier — as soon as the write sticks.
|
|
61
55
|
*/
|
|
62
56
|
const RESTORE_FRAME_CAP = 30;
|
|
63
57
|
|
|
@@ -71,141 +65,243 @@ const RESTORE_FRAME_CAP = 30;
|
|
|
71
65
|
const RESTORE_STICK_TOLERANCE_PX = 2;
|
|
72
66
|
|
|
73
67
|
/**
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
* it is set before any provider mounts, matching Bluesky's module-level call.
|
|
68
|
+
* The web binding is a constant: this platform observes offsets by subscribing
|
|
69
|
+
* to the resolved DOM node's own `scroll` event, so it needs nothing from the
|
|
70
|
+
* caller. It is still returned — and still safe to spread onto a list — so a
|
|
71
|
+
* call site is written once and runs on both platforms.
|
|
79
72
|
*/
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
73
|
+
const WEB_BINDING = {
|
|
74
|
+
onScroll: () => undefined
|
|
75
|
+
};
|
|
83
76
|
|
|
84
77
|
/**
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
78
|
+
* Events that mean the USER has taken over the scroller, and the restore must
|
|
79
|
+
* stop trying to put them back.
|
|
80
|
+
*
|
|
81
|
+
* The browser's own restoration is specified the same way: HTML §7.4.6.5 has
|
|
82
|
+
* the UA re-attempt the saved position and "may continue to attempt to do so
|
|
83
|
+
* periodically, until document's has been scrolled by the user becomes true".
|
|
84
|
+
* Without this the loop fights anyone who starts scrolling inside the frame
|
|
85
|
+
* budget, yanking them back once per frame for up to {@link RESTORE_FRAME_CAP}
|
|
86
|
+
* frames.
|
|
87
|
+
*
|
|
88
|
+
* Two designs were rejected, and the reasons are the point:
|
|
89
|
+
*
|
|
90
|
+
* - **"Any `scroll` event aborts"** — the obvious version, and it aborts on the
|
|
91
|
+
* FIRST frame every time: `setOffset` is itself a scroll, so the loop would
|
|
92
|
+
* cancel on the event its own write produced and no restore would ever
|
|
93
|
+
* complete.
|
|
94
|
+
* - **"Abort on an offset we did not write"** — tempting because it needs no
|
|
95
|
+
* listeners, but a virtualized list inserting rows ABOVE the viewport makes
|
|
96
|
+
* the browser's scroll anchoring move `scrollTop` on its own. That is
|
|
97
|
+
* precisely the situation the loop exists for, so the unexplained-delta test
|
|
98
|
+
* would abort exactly when it must not.
|
|
99
|
+
*
|
|
100
|
+
* What is being detected is user INPUT, so this detects user input. `pointerdown`
|
|
101
|
+
* covers a scrollbar drag and a touch-less press; `keydown` covers arrow/page
|
|
102
|
+
* keys, and reaches us whenever focus is inside the scroller it would scroll.
|
|
88
103
|
*/
|
|
89
|
-
|
|
90
|
-
children
|
|
91
|
-
}) {
|
|
92
|
-
const store = useMemo(() => new ScrollOffsetStore(), []);
|
|
93
|
-
return /*#__PURE__*/_jsx(ScrollOffsetContext.Provider, {
|
|
94
|
-
value: store,
|
|
95
|
-
children: children
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
function useScrollOffsetStore() {
|
|
99
|
-
const store = useContext(ScrollOffsetContext);
|
|
100
|
-
if (store === null) {
|
|
101
|
-
throw new Error('useScrollRestoration must be used within a <ScrollRestorationProvider>.');
|
|
102
|
-
}
|
|
103
|
-
return store;
|
|
104
|
-
}
|
|
104
|
+
const USER_TAKEOVER_EVENTS = ['wheel', 'touchstart', 'pointerdown', 'keydown'];
|
|
105
105
|
|
|
106
106
|
/**
|
|
107
107
|
* Preserve and restore the scroll offset of `target` across navigation, keyed
|
|
108
|
-
* by the
|
|
109
|
-
* multiple scrollables).
|
|
108
|
+
* by the content its screen is showing plus an optional `options.key`.
|
|
110
109
|
*
|
|
111
110
|
* Behaviour (web):
|
|
112
111
|
* - On every scroll while the screen is focused, the current offset is recorded
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
* saved
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
112
|
+
* under the key that was live when the listener was attached. This stream of
|
|
113
|
+
* saves is the source of truth.
|
|
114
|
+
* - On focus — and again whenever the key changes while the screen STAYS
|
|
115
|
+
* focused, which is how an in-screen tab or folder swap is seen at all — the
|
|
116
|
+
* offset saved for the new key is re-applied across a bounded run of
|
|
117
|
+
* animation frames, stopping as soon as the write sticks or
|
|
118
|
+
* {@link RESTORE_FRAME_CAP} is reached. Content never seen this session is
|
|
119
|
+
* written to 0 once instead; a write to 0 always sticks, so it needs no loop.
|
|
120
|
+
* - On blur (and on a key change), the LAST OBSERVED offset is persisted under
|
|
121
|
+
* the OUTGOING key as a final safety net — not a fresh `scrollTop` read,
|
|
122
|
+
* which the navigator may already have forced to 0 while collapsing the
|
|
123
|
+
* hidden screen.
|
|
121
124
|
*/
|
|
122
125
|
export function useScrollRestoration(target, options) {
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
|
|
126
|
+
const {
|
|
127
|
+
store,
|
|
128
|
+
adapter
|
|
129
|
+
} = useScrollRestorationContext();
|
|
130
|
+
const contentId = adapter.useScreenContentId();
|
|
126
131
|
const enabled = options?.enabled ?? true;
|
|
127
|
-
const scrollKey = deriveScrollKey(
|
|
132
|
+
const scrollKey = deriveScrollKey(contentId, options?.key);
|
|
128
133
|
|
|
129
|
-
//
|
|
130
|
-
//
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
//
|
|
139
|
-
//
|
|
140
|
-
// each focus.
|
|
134
|
+
// The key this hook instance has already sent to the top. Writing 0 is a
|
|
135
|
+
// one-time ARRIVAL action: a later re-run for the SAME key (`enabled` turning
|
|
136
|
+
// on once the rows exist, a screen regaining focus) must not repeat it,
|
|
137
|
+
// because by then the user may have scrolled somewhere the hook never got to
|
|
138
|
+
// record. Restoring twice is harmless; resetting twice is data loss.
|
|
139
|
+
const resetKeyRef = useRef(null);
|
|
140
|
+
adapter.useScreenFocusEffect(
|
|
141
|
+
// Every varying input is a dependency rather than a ref read, so the
|
|
142
|
+
// session below CLOSES OVER the key it belongs to. That is what makes a
|
|
143
|
+
// key change mid-focus correct in both directions: the outgoing session's
|
|
144
|
+
// cleanup persists to the old key, and the incoming one restores the new.
|
|
141
145
|
useCallback(() => {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
const
|
|
145
|
-
const element = targetRef.current === 'window' ? typeof window !== 'undefined' ? window : null : resolveScrollEventTarget(targetRef.current);
|
|
146
|
+
if (!enabled || scrollKey === null) return undefined;
|
|
147
|
+
const scroller = createScroller(target);
|
|
148
|
+
const element = target === 'window' ? typeof window === 'undefined' ? null : window : resolveScrollEventTarget(target);
|
|
146
149
|
|
|
147
|
-
// The last offset the live scroll listener observed for this
|
|
148
|
-
//
|
|
149
|
-
//
|
|
150
|
-
//
|
|
151
|
-
//
|
|
152
|
-
//
|
|
150
|
+
// The last offset the live scroll listener observed for this session.
|
|
151
|
+
// This — not a cleanup-time `getOffset()` — is what we persist at the
|
|
152
|
+
// end, because by then the navigator may have collapsed the hidden
|
|
153
|
+
// screen and forced its `scrollTop` to 0 (problem A). `null` means the
|
|
154
|
+
// user never scrolled this session, so there is nothing newer to persist
|
|
155
|
+
// than what the scroll listener already saved live.
|
|
153
156
|
let lastObservedOffset = null;
|
|
157
|
+
|
|
158
|
+
// The offset WE last wrote, which a real browser dispatches back as a
|
|
159
|
+
// `scroll` event (jsdom does not, so the tests for this emit it
|
|
160
|
+
// explicitly). Both writers arm it: the reset, and every frame of the
|
|
161
|
+
// restore loop. Persisting either records an offset the user never
|
|
162
|
+
// chose — the reset's 0 under a key another LIVE screen may share (the
|
|
163
|
+
// two-live-entries trade content keying makes, see `deriveScrollKey`),
|
|
164
|
+
// and the loop's intermediate value as a PARTIAL that outlives an
|
|
165
|
+
// interrupted restore.
|
|
166
|
+
//
|
|
167
|
+
// A `restoring` FLAG covering the loop's duration is the obvious
|
|
168
|
+
// alternative and is wrong. It could only be cleared by a takeover
|
|
169
|
+
// event, so a session whose scroll came from a source that fires none —
|
|
170
|
+
// `scrollIntoView` from another component, a focus-driven scroll — would
|
|
171
|
+
// suppress saves indefinitely and never record the user's position at
|
|
172
|
+
// all: an unbounded corruption traded for a bounded one. Arming a VALUE
|
|
173
|
+
// is bounded to one event per write and covers every way the loop can
|
|
174
|
+
// end (stuck, capped, aborted), because each frame re-arms.
|
|
175
|
+
let echoOffset = null;
|
|
176
|
+
|
|
177
|
+
// The largest offset reachable when we last PERSISTED one. A browser
|
|
178
|
+
// clamp is recognised against this rather than against the previous
|
|
179
|
+
// OBSERVATION, and that distinction is the whole mechanism: Chrome
|
|
180
|
+
// dispatches TWO `scroll` events for one clamp, so an
|
|
181
|
+
// observation-relative test sees the shrink on the first and nothing on
|
|
182
|
+
// the second, which then saves the clamped value anyway. Measured.
|
|
183
|
+
let maxOffsetAtLastSave = scroller.getMaxOffset();
|
|
154
184
|
const save = () => {
|
|
155
|
-
const currentKey = scrollKeyRef.current;
|
|
156
|
-
if (!enabledRef.current || currentKey === null) return;
|
|
157
185
|
const offset = scroller.getOffset();
|
|
186
|
+
const maxOffset = scroller.getMaxOffset();
|
|
158
187
|
// Ignore a spurious 0 produced by the navigator collapsing a hidden
|
|
159
188
|
// background screen: while collapsed the container cannot scroll, so
|
|
160
|
-
// its `scrollTop` is forced to 0. Persisting it would clobber the
|
|
161
|
-
//
|
|
189
|
+
// its `scrollTop` is forced to 0. Persisting it would clobber the good
|
|
190
|
+
// offset recorded by earlier live saves (problem A). A genuine
|
|
162
191
|
// scroll-to-top keeps the container scrollable and is saved normally.
|
|
163
|
-
if (offset === 0 &&
|
|
192
|
+
if (offset === 0 && maxOffset <= 0) return;
|
|
193
|
+
// A partial clamp: the reachable range SHRANK and the offset is sitting
|
|
194
|
+
// exactly at the new bottom. That is what the browser does to a tab
|
|
195
|
+
// whose document has been taken over by a shorter sibling — the two
|
|
196
|
+
// together are a signature a genuine scroll does not have, because
|
|
197
|
+
// reaching the bottom on your own does not shrink the page in the same
|
|
198
|
+
// breath. Suppressing keeps the pre-clamp offset, which on return
|
|
199
|
+
// simply clamps to the same place if the content really did shrink.
|
|
200
|
+
if (maxOffset < maxOffsetAtLastSave && Math.abs(offset - maxOffset) <= RESTORE_STICK_TOLERANCE_PX) {
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
if (offset === echoOffset) {
|
|
204
|
+
// Our own write coming back. Consume the arming so a real scroll to
|
|
205
|
+
// the same offset later is saved normally.
|
|
206
|
+
echoOffset = null;
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
echoOffset = null;
|
|
164
210
|
lastObservedOffset = offset;
|
|
165
|
-
|
|
211
|
+
maxOffsetAtLastSave = maxOffset;
|
|
212
|
+
store.save(scrollKey, offset);
|
|
166
213
|
};
|
|
167
214
|
|
|
168
|
-
// Restore
|
|
169
|
-
//
|
|
170
|
-
//
|
|
171
|
-
//
|
|
172
|
-
|
|
173
|
-
|
|
215
|
+
// Restore and reset are ONE write. A miss reads 0, and 0 is exactly what
|
|
216
|
+
// an unseen screen must be written to — left alone it would show the
|
|
217
|
+
// previous screen's offset, since a document-scrolled app shares one
|
|
218
|
+
// scroller across every route.
|
|
219
|
+
const targetOffset = store.read(scrollKey);
|
|
220
|
+
|
|
221
|
+
// They remain two DECISIONS, though, and `read` cannot tell them apart:
|
|
222
|
+
// a key never seen and a key deliberately saved at the top both read 0.
|
|
223
|
+
// Only the first is a RESET, and a reset is a one-time ARRIVAL action
|
|
224
|
+
// gated on `resetKeyRef` — repeating it on a later re-run for the same
|
|
225
|
+
// key would send a user who has since scrolled back to the top, and the
|
|
226
|
+
// hook was inert while they did it so there is nothing to restore them
|
|
227
|
+
// to afterwards. A 0 the user deliberately saved is theirs, and always
|
|
228
|
+
// re-applies. `has` is the only thing that answers this.
|
|
229
|
+
const isReset = !store.has(scrollKey);
|
|
230
|
+
const alreadyReset = isReset && resetKeyRef.current === scrollKey;
|
|
231
|
+
if (isReset) resetKeyRef.current = scrollKey;
|
|
174
232
|
let rafId = null;
|
|
175
|
-
|
|
233
|
+
const stopRestore = () => {
|
|
234
|
+
if (rafId === null) return;
|
|
235
|
+
cancelAnimationFrame(rafId);
|
|
236
|
+
rafId = null;
|
|
237
|
+
};
|
|
238
|
+
if (alreadyReset) {
|
|
239
|
+
// Nothing to write: this content has already been sent to the top once
|
|
240
|
+
// and the user is wherever they have moved to since.
|
|
241
|
+
} else if (targetOffset === 0) {
|
|
242
|
+
// A write to 0 is never clamped away, so it needs no re-apply loop.
|
|
243
|
+
echoOffset = 0;
|
|
244
|
+
scroller.setOffset(0);
|
|
245
|
+
} else if (typeof requestAnimationFrame !== 'undefined') {
|
|
246
|
+
// Re-apply across a bounded run of frames. A freshly re-shown
|
|
247
|
+
// virtualized list re-lays out its rows over several frames, so a
|
|
248
|
+
// single write while it is still collapsed would be clamped to 0 and
|
|
249
|
+
// never re-applied (problem B).
|
|
250
|
+
//
|
|
251
|
+
// Every write the loop makes is suppressed from the save path (see
|
|
252
|
+
// `echoOffset` below), so an interrupted restore leaves the ORIGINAL
|
|
253
|
+
// target stored rather than a partial. Nothing is lost on the success
|
|
254
|
+
// path: `targetOffset` came out of the store, so persisting it again
|
|
255
|
+
// would write back the same number.
|
|
176
256
|
let framesLeft = RESTORE_FRAME_CAP;
|
|
177
257
|
const applyOffset = () => {
|
|
178
258
|
rafId = null;
|
|
179
259
|
scroller.setOffset(targetOffset);
|
|
180
260
|
framesLeft -= 1;
|
|
261
|
+
// `getOffset` re-reads the value the browser actually took, which is
|
|
262
|
+
// clamped to the content height it has reached so far. Arm it as the
|
|
263
|
+
// echo to swallow: this write is about to come back as a `scroll`
|
|
264
|
+
// event, and persisting a PARTIAL offset we wrote ourselves is how a
|
|
265
|
+
// restore that is aborted or capped corrupts the stored position.
|
|
266
|
+
const landed = scroller.getOffset();
|
|
267
|
+
echoOffset = landed;
|
|
181
268
|
// Stop once the write took effect (content grew tall enough) or we
|
|
182
|
-
// exhaust the frame budget.
|
|
183
|
-
const reached = Math.abs(
|
|
269
|
+
// exhaust the frame budget.
|
|
270
|
+
const reached = Math.abs(landed - targetOffset) <= RESTORE_STICK_TOLERANCE_PX;
|
|
184
271
|
if (!reached && framesLeft > 0) {
|
|
185
272
|
rafId = requestAnimationFrame(applyOffset);
|
|
186
273
|
}
|
|
187
274
|
};
|
|
188
275
|
rafId = requestAnimationFrame(applyOffset);
|
|
276
|
+
// Only while a loop is actually in flight — the reset path has nothing
|
|
277
|
+
// to abort, and the listeners would be idle on every screen.
|
|
278
|
+
for (const type of USER_TAKEOVER_EVENTS) {
|
|
279
|
+
element?.addEventListener(type, stopRestore, {
|
|
280
|
+
passive: true
|
|
281
|
+
});
|
|
282
|
+
}
|
|
189
283
|
}
|
|
190
284
|
element?.addEventListener('scroll', save, {
|
|
191
285
|
passive: true
|
|
192
286
|
});
|
|
193
287
|
return () => {
|
|
194
|
-
|
|
288
|
+
stopRestore();
|
|
195
289
|
element?.removeEventListener('scroll', save);
|
|
196
|
-
//
|
|
197
|
-
//
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
290
|
+
// Removing a listener that was never added is a no-op, so this needs no
|
|
291
|
+
// flag tracking whether the loop branch ran.
|
|
292
|
+
for (const type of USER_TAKEOVER_EVENTS) {
|
|
293
|
+
element?.removeEventListener(type, stopRestore);
|
|
294
|
+
}
|
|
295
|
+
// Final capture: persist the last offset the scroll listener OBSERVED,
|
|
296
|
+
// never a fresh read (which the navigator may have forced to 0 while
|
|
297
|
+
// collapsing the hidden screen). When the user never scrolled this
|
|
298
|
+
// session there is nothing newer than the live saves already recorded.
|
|
201
299
|
if (lastObservedOffset !== null) {
|
|
202
|
-
|
|
203
|
-
if (enabledRef.current && currentKey !== null) {
|
|
204
|
-
store.save(currentKey, lastObservedOffset);
|
|
205
|
-
}
|
|
300
|
+
store.save(scrollKey, lastObservedOffset);
|
|
206
301
|
}
|
|
207
302
|
};
|
|
208
|
-
}, [store]));
|
|
303
|
+
}, [store, scrollKey, enabled, target]));
|
|
304
|
+
return WEB_BINDING;
|
|
209
305
|
}
|
|
210
306
|
|
|
211
307
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["useCallback","useRef","useScrollRestorationContext","createScroller","deriveScrollKey","ScrollRestorationProvider","RESTORE_FRAME_CAP","RESTORE_STICK_TOLERANCE_PX","WEB_BINDING","onScroll","undefined","USER_TAKEOVER_EVENTS","useScrollRestoration","target","options","store","adapter","contentId","useScreenContentId","enabled","scrollKey","key","resetKeyRef","useScreenFocusEffect","scroller","element","window","resolveScrollEventTarget","lastObservedOffset","echoOffset","maxOffsetAtLastSave","getMaxOffset","save","offset","getOffset","maxOffset","Math","abs","targetOffset","read","isReset","has","alreadyReset","current","rafId","stopRestore","cancelAnimationFrame","setOffset","requestAnimationFrame","framesLeft","applyOffset","landed","reached","type","addEventListener","passive","removeEventListener","EventTarget","handle","getScrollableNode","node"],"sourceRoot":"../../../src","sources":["scroll/index.web.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,MAAM,QAAQ,OAAO;AAE3C,SAASC,2BAA2B,QAAQ,cAAW;AACvD,SAASC,cAAc,QAAQ,qBAAkB;AACjD,SAASC,eAAe,QAAQ,YAAS;AAOzC,SAASC,yBAAyB,QAAQ,cAAW;AAYrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,iBAAiB,GAAG,EAAE;;AAE5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,0BAA0B,GAAG,CAAC;;AAEpC;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,WAAqC,GAAG;EAAEC,QAAQ,EAAEA,CAAA,KAAMC;AAAU,CAAC;;AAE3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,oBAAoB,GAAG,CAAC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,CAAC;;AAE9E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,oBAAoBA,CAClCC,MAA+B,EAC/BC,OAAqC,EACX;EAC1B,MAAM;IAAEC,KAAK;IAAEC;EAAQ,CAAC,GAAGd,2BAA2B,CAAC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