@oxyhq/bloom 0.78.0 → 0.79.1
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 +184 -118
- 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/store.js +47 -25
- package/lib/commonjs/scroll/store.js.map +1 -1
- package/lib/commonjs/theme/color-policy.js +11 -9
- 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 +181 -119
- 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/store.js +47 -25
- package/lib/module/scroll/store.js.map +1 -1
- package/lib/module/theme/color-policy.js +11 -9
- 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/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/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/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/theme/color-policy.d.ts.map +1 -1
- package/package.json +15 -1
- package/src/__tests__/BloomProvider.web.test.tsx +8 -15
- package/src/__tests__/optional-peer-imports.test.ts +2 -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 +547 -111
- 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 +219 -162
- package/src/scroll/scrollable.native.ts +64 -0
- package/src/scroll/store.ts +47 -25
- package/src/scroll/types.ts +82 -12
- package/src/theme/__tests__/__fixtures__/golden-resolved-tokens.json +27 -27
- package/src/theme/__tests__/__snapshots__/visual-gallery.test.tsx.snap +55 -55
- package/src/theme/__tests__/policy-legibility.test.ts +21 -1
- package/src/theme/color-policy.ts +13 -9
- 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
|
@@ -207,15 +207,17 @@ function vividHueNear(hue) {
|
|
|
207
207
|
* why 11 of the 13 presets carry white and exactly the two light ones do not.
|
|
208
208
|
*/
|
|
209
209
|
function whiteLabelTone(palette, seedTone, isDark) {
|
|
210
|
-
//
|
|
211
|
-
//
|
|
212
|
-
//
|
|
213
|
-
//
|
|
214
|
-
//
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
210
|
+
// LIGHT: every fill comes down, no exemption. On a near-white page a bright
|
|
211
|
+
// colour has nothing to read against — a lime at its own tone 90 is a pale
|
|
212
|
+
// smear there, indistinguishable from the same colour in dark, which is not a
|
|
213
|
+
// theme at all. Coming down is what makes faircoin a deep green in light and a
|
|
214
|
+
// bright lime in dark.
|
|
215
|
+
if (!isDark) return LIGHT_FILL_TONE;
|
|
216
|
+
// DARK: the budget applies. Most brands come down to where white fits, but a
|
|
217
|
+
// seed that is already light cannot without ceasing to be itself, so it keeps
|
|
218
|
+
// its own tone and takes a black label. That is the eleven-and-two pattern.
|
|
219
|
+
const candidate = Math.max(DARK_FILL_TONE, seedTone - TONE_BUDGET);
|
|
220
|
+
return contrastOf(palette.tone(candidate), true) >= AA ? candidate : Math.max(seedTone, DARK_SEED_FLOOR);
|
|
219
221
|
}
|
|
220
222
|
|
|
221
223
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["argbFromHex","Hct","TonalPalette","blueFromArgb","greenFromArgb","redFromArgb","STATUS_SEEDS","success","error","warning","info","AA","rgb","argb","rgba","alpha","contrastOf","onWhite","channel","v","c","Math","pow","luminance","foregroundFor","noLegibleForeground","LIGHT_FILL_TONE","DARK_FILL_TONE","TONE_BUDGET","DARK_SEED_FLOOR","DARK_ACCENT_FLOOR","ACCENT_CHROMA","TEXT_TONE","light","dark","TEXT_CHROMA","SUBTLE_SOURCE_TONE","SUBTLE_ALPHA","SPLIT_ROTATIONS","VIVID_SNAP_WINDOW","VIVID_SNAP_MIN_GAIN","MIN_ACCENT_SEPARATION","DESTRUCTIVE_PROXIMITY","hueDistance","a","b","d","abs","min","peakTone","hue","palette","fromHueAndChroma","bestTone","bestChroma","tone","chroma","fromInt","peakChroma","vividHueNear","baseChroma","bestHue","delta","candidate","whiteLabelTone","seedTone","isDark","max","accentTone","peak","fillPair","startTone","fill","foreground","accentHues","seedHue","firstRotation","secondRotation","geometricA","geometricB","geometricStandout","quiet","snapped","standout","errorHue","secondary","tertiary","buildPolicyTokens","seedHex","roles","pinned","seed","brandPalette","primary","tokens","surfaceContainer","surfaceContainerLowest","surfaceContainerHigh","onSurfaceVariant","hues","role","pin","undefined","fillPalette","textPalette","vividPalette","pair","i","hex","Object","entries","status"],"sourceRoot":"../../../src","sources":["theme/color-policy.ts"],"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,SAASA,WAAW,QAAyB,yBAAgB;AAC7D,SAASC,GAAG,QAAQ,uBAAoB;AACxC,SAASC,YAAY,QAAQ,iCAA8B;AAC3D,SAASC,YAAY,EAAEC,aAAa,EAAEC,WAAW,QAAQ,+BAA4B;;AAErF;AACA,OAAO,MAAMC,YAAY,GAAG;EAC1BC,OAAO,EAAE,SAAS;EAClBC,KAAK,EAAE,SAAS;EAChBC,OAAO,EAAE,SAAS;EAClBC,IAAI,EAAE;AACR,CAAU;;AAEV;;AAMA;;AAGA,MAAMC,EAAE,GAAG,GAAG;AAEd,MAAMC,GAAG,GAAIC,IAAY,IACvB,OAAOR,WAAW,CAACQ,IAAI,CAAC,IAAIT,aAAa,CAACS,IAAI,CAAC,IAAIV,YAAY,CAACU,IAAI,CAAC,GAAG;;AAE1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,IAAI,GAAGA,CAACD,IAAY,EAAEE,KAAa,KACvC,QAAQV,WAAW,CAACQ,IAAI,CAAC,KAAKT,aAAa,CAACS,IAAI,CAAC,KAA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AAG7B,YAAY,CAACH,IAAI,GAAGG,YAAY,CAACJ,KAC5C,CAAC;EACH;EAEA,OAAO6D,MAAM;AACf","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["argbFromHex","Hct","TonalPalette","blueFromArgb","greenFromArgb","redFromArgb","STATUS_SEEDS","success","error","warning","info","AA","rgb","argb","rgba","alpha","contrastOf","onWhite","channel","v","c","Math","pow","luminance","foregroundFor","noLegibleForeground","LIGHT_FILL_TONE","DARK_FILL_TONE","TONE_BUDGET","DARK_SEED_FLOOR","DARK_ACCENT_FLOOR","ACCENT_CHROMA","TEXT_TONE","light","dark","TEXT_CHROMA","SUBTLE_SOURCE_TONE","SUBTLE_ALPHA","SPLIT_ROTATIONS","VIVID_SNAP_WINDOW","VIVID_SNAP_MIN_GAIN","MIN_ACCENT_SEPARATION","DESTRUCTIVE_PROXIMITY","hueDistance","a","b","d","abs","min","peakTone","hue","palette","fromHueAndChroma","bestTone","bestChroma","tone","chroma","fromInt","peakChroma","vividHueNear","baseChroma","bestHue","delta","candidate","whiteLabelTone","seedTone","isDark","max","accentTone","peak","fillPair","startTone","fill","foreground","accentHues","seedHue","firstRotation","secondRotation","geometricA","geometricB","geometricStandout","quiet","snapped","standout","errorHue","secondary","tertiary","buildPolicyTokens","seedHex","roles","pinned","seed","brandPalette","primary","tokens","surfaceContainer","surfaceContainerLowest","surfaceContainerHigh","onSurfaceVariant","hues","role","pin","undefined","fillPalette","textPalette","vividPalette","pair","i","hex","Object","entries","status"],"sourceRoot":"../../../src","sources":["theme/color-policy.ts"],"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,SAASA,WAAW,QAAyB,yBAAgB;AAC7D,SAASC,GAAG,QAAQ,uBAAoB;AACxC,SAASC,YAAY,QAAQ,iCAA8B;AAC3D,SAASC,YAAY,EAAEC,aAAa,EAAEC,WAAW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EoE,MAAM,CAAC,KAAKM,IAAI,EAAE,CAAC,GAAGM,IAAI,CAAClC,IAAI;IAC/BsB,MAAM,CAAC,KAAKM,IAAI,aAAa,CAAC,GAAGM,IAAI,CAACjC,UAAU;IAChDqB,MAAM,CAAC,KAAKM,IAAI,OAAO,CAAC,GAAGxF,GAAG,CAC5BV,YAAY,CAACkD,gBAAgB,CAAC2D,MAAM,CAAC7D,GAAG,EAAEf,WAAW,CAAC,CAACoB,IAAI,CACzDW,MAAM,GAAGlC,SAAS,CAACE,IAAI,GAAGF,SAAS,CAACC,KACtC,CACF,CAAC;IACD;IACA;IACA;IACA;IACA6D,MAAM,CAAC,KAAKM,IAAI,SAAS,CAAC,GAAGtF,IAAI,CAC/BqC,OAAO,CAACI,IAAI,CAACwD,MAAM,CAACxD,IAAI,CAAC,EACzBW,MAAM,GAAG7B,YAAY,CAACH,IAAI,GAAGG,YAAY,CAACJ,KAC5C,CAAC;EACH;EAEA,OAAO6D,MAAM;AACf","ignoreList":[]}
|
|
@@ -18,11 +18,13 @@
|
|
|
18
18
|
* Nesting extra contexts costs nothing at runtime — the win is that scope is no
|
|
19
19
|
* longer a per-app decision.
|
|
20
20
|
*
|
|
21
|
-
* EXPO/EXPO-ROUTER APPS ONLY
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
21
|
+
* EXPO/EXPO-ROUTER APPS ONLY, and now for one narrow reason: it binds the
|
|
22
|
+
* scroll store to the expo-router ADAPTER, which is the only module in the
|
|
23
|
+
* scroll primitive that imports `expo-router`. The scroll core itself is
|
|
24
|
+
* router-agnostic, so a Vite/SPA consumer can mount
|
|
25
|
+
* `<ScrollRestorationProvider adapter={...}>` from `@oxyhq/bloom/scroll` with
|
|
26
|
+
* an adapter for its own router — alongside `BloomThemeProvider` and whatever
|
|
27
|
+
* else it needs — rather than going without.
|
|
26
28
|
*
|
|
27
29
|
* NOT included, on purpose — these are OUTLETS, not state, and their placement
|
|
28
30
|
* in the tree is a real app decision (z-order, safe areas, and mounting a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/provider/index.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/provider/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,EAAyB,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAG9E,OAAO,EAAsB,KAAK,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAI5E,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,uBAAuB,EAAE,UAAU,CAAC;IACnF,QAAQ,EAAE,SAAS,CAAC;IACpB;;;;OAIG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,wFAAwF;IACxF,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,aAAa,EACb,OAAc,EACd,GAAG,UAAU,EACd,EAAE,kBAAkB,2CAcpB;yBAnBe,aAAa"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ScrollOffsetStore } from './store';
|
|
2
|
+
import type { ScrollRestorationProviderProps, ScrollRouterAdapter } from './types';
|
|
3
|
+
export interface ScrollRestorationContextValue {
|
|
4
|
+
store: ScrollOffsetStore;
|
|
5
|
+
adapter: ScrollRouterAdapter;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Holds the offset map and the router binding for the subtree. One provider
|
|
9
|
+
* near the app root is enough; the store lives as long as the provider, so
|
|
10
|
+
* offsets survive navigating away and back (including browser Back/Forward).
|
|
11
|
+
*/
|
|
12
|
+
export declare function ScrollRestorationProvider({ children, adapter, }: ScrollRestorationProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare function useScrollRestorationContext(): ScrollRestorationContextValue;
|
|
14
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../src/scroll/context.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,KAAK,EACV,8BAA8B,EAC9B,mBAAmB,EACpB,MAAM,SAAS,CAAC;AAEjB,MAAM,WAAW,6BAA6B;IAC5C,KAAK,EAAE,iBAAiB,CAAC;IACzB,OAAO,EAAE,mBAAmB,CAAC;CAC9B;AAMD;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,EACxC,QAAQ,EACR,OAAO,GACR,EAAE,8BAA8B,2CAWhC;AAED,wBAAgB,2BAA2B,IAAI,6BAA6B,CAQ3E"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ScrollRouterAdapter } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* The adapter to hand `<ScrollRestorationProvider adapter={...}>` in an
|
|
4
|
+
* expo-router app. A module-level constant, as the adapter contract requires.
|
|
5
|
+
*/
|
|
6
|
+
export declare const expoRouterScrollAdapter: ScrollRouterAdapter;
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/scroll/expo-router/index.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAqB,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAkHvE;;;GAGG;AACH,eAAO,MAAM,uBAAuB,EAAE,mBAGrC,CAAC"}
|
|
@@ -1,27 +1,18 @@
|
|
|
1
|
+
import type { ScrollRestorationBinding, ScrollRestorationTarget, UseScrollRestorationOptions } from './types';
|
|
2
|
+
export { ScrollRestorationProvider } from './context';
|
|
3
|
+
export type { ScreenFocusEffect, ScrollableHandle, ScrollRestorationBinding, ScrollRestorationProviderProps, ScrollRestorationTarget, ScrollRouterAdapter, UseScrollRestorationOptions, } from './types';
|
|
1
4
|
/**
|
|
2
|
-
*
|
|
5
|
+
* Preserve and restore the scroll offset of `target` across content changes,
|
|
6
|
+
* keyed by the content its screen is showing plus an optional `options.key`.
|
|
3
7
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* nothing.
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* `package.json`; native bundlers fall through to this file.
|
|
13
|
-
*/
|
|
14
|
-
import type { ReactElement } from 'react';
|
|
15
|
-
import type { ScrollRestorationProviderProps, ScrollRestorationTarget, UseScrollRestorationOptions } from './types';
|
|
16
|
-
export type { ScrollableHandle, ScrollRestorationProviderProps, ScrollRestorationTarget, UseScrollRestorationOptions, } from './types';
|
|
17
|
-
/**
|
|
18
|
-
* No-op provider. Renders children unchanged — native scroll persistence is
|
|
19
|
-
* handled by the navigator, so no per-route state is kept.
|
|
20
|
-
*/
|
|
21
|
-
export declare function ScrollRestorationProvider({ children, }: ScrollRestorationProviderProps): ReactElement;
|
|
22
|
-
/**
|
|
23
|
-
* No-op hook. Accepts the same arguments as the web implementation so call
|
|
24
|
-
* sites are identical across platforms.
|
|
8
|
+
* Behaviour (native):
|
|
9
|
+
* - Offsets are recorded from the returned `onScroll` binding, which the caller
|
|
10
|
+
* wires onto the list. There is no other way to observe a list's offset.
|
|
11
|
+
* - When the storage key changes — a re-keyed list, a remount, or `enabled`
|
|
12
|
+
* turning on — the saved offset is applied, or 0 when the key was never seen.
|
|
13
|
+
* - A push/pop that re-focuses the same screen scrolls nothing. The navigator
|
|
14
|
+
* already preserved the position, and re-applying it would at best be a
|
|
15
|
+
* no-op and at worst fight a list that has legitimately moved on.
|
|
25
16
|
*/
|
|
26
|
-
export declare function useScrollRestoration(
|
|
17
|
+
export declare function useScrollRestoration(target: ScrollRestorationTarget, options?: UseScrollRestorationOptions): ScrollRestorationBinding;
|
|
27
18
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/scroll/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/scroll/index.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EACV,wBAAwB,EACxB,uBAAuB,EACvB,2BAA2B,EAC5B,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AAEtD,YAAY,EACV,iBAAiB,EACjB,gBAAgB,EAChB,wBAAwB,EACxB,8BAA8B,EAC9B,uBAAuB,EACvB,mBAAmB,EACnB,2BAA2B,GAC5B,MAAM,SAAS,CAAC;AAEjB;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,uBAAuB,EAC/B,OAAO,CAAC,EAAE,2BAA2B,GACpC,wBAAwB,CAyD1B"}
|
|
@@ -1,26 +1,24 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
* Holds the per-route offset map for the subtree. One provider near the app
|
|
5
|
-
* root is enough; the store lives for the document's lifetime so offsets
|
|
6
|
-
* survive navigating away and back (including browser Back/Forward).
|
|
7
|
-
*/
|
|
8
|
-
export declare function ScrollRestorationProvider({ children, }: ScrollRestorationProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
import type { ScrollRestorationBinding, ScrollRestorationTarget, UseScrollRestorationOptions } from './types';
|
|
2
|
+
export { ScrollRestorationProvider } from './context';
|
|
3
|
+
export type { ScreenFocusEffect, ScrollableHandle, ScrollRestorationBinding, ScrollRestorationProviderProps, ScrollRestorationTarget, ScrollRouterAdapter, UseScrollRestorationOptions, } from './types';
|
|
9
4
|
/**
|
|
10
5
|
* Preserve and restore the scroll offset of `target` across navigation, keyed
|
|
11
|
-
* by the
|
|
12
|
-
* multiple scrollables).
|
|
6
|
+
* by the content its screen is showing plus an optional `options.key`.
|
|
13
7
|
*
|
|
14
8
|
* Behaviour (web):
|
|
15
9
|
* - On every scroll while the screen is focused, the current offset is recorded
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* saved
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
10
|
+
* under the key that was live when the listener was attached. This stream of
|
|
11
|
+
* saves is the source of truth.
|
|
12
|
+
* - On focus — and again whenever the key changes while the screen STAYS
|
|
13
|
+
* focused, which is how an in-screen tab or folder swap is seen at all — the
|
|
14
|
+
* offset saved for the new key is re-applied across a bounded run of
|
|
15
|
+
* animation frames, stopping as soon as the write sticks or
|
|
16
|
+
* {@link RESTORE_FRAME_CAP} is reached. Content never seen this session is
|
|
17
|
+
* written to 0 once instead; a write to 0 always sticks, so it needs no loop.
|
|
18
|
+
* - On blur (and on a key change), the LAST OBSERVED offset is persisted under
|
|
19
|
+
* the OUTGOING key as a final safety net — not a fresh `scrollTop` read,
|
|
20
|
+
* which the navigator may already have forced to 0 while collapsing the
|
|
21
|
+
* hidden screen.
|
|
24
22
|
*/
|
|
25
|
-
export declare function useScrollRestoration(target: ScrollRestorationTarget, options?: UseScrollRestorationOptions):
|
|
23
|
+
export declare function useScrollRestoration(target: ScrollRestorationTarget, options?: UseScrollRestorationOptions): ScrollRestorationBinding;
|
|
26
24
|
//# sourceMappingURL=index.web.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../../../../src/scroll/index.web.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../../../../src/scroll/index.web.tsx"],"names":[],"mappings":"AA6CA,OAAO,KAAK,EACV,wBAAwB,EACxB,uBAAuB,EACvB,2BAA2B,EAC5B,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AAEtD,YAAY,EACV,iBAAiB,EACjB,gBAAgB,EAChB,wBAAwB,EACxB,8BAA8B,EAC9B,uBAAuB,EACvB,mBAAmB,EACnB,2BAA2B,GAC5B,MAAM,SAAS,CAAC;AA0DjB;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,uBAAuB,EAC/B,OAAO,CAAC,EAAE,2BAA2B,GACpC,wBAAwB,CA4J1B"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ScrollRestorationTarget } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* The write half of a scrollable, on native. There is no read half: native
|
|
4
|
+
* offers no way to sample a list's offset from outside it, so offsets arrive
|
|
5
|
+
* through the `onScroll` binding the hook returns instead.
|
|
6
|
+
*/
|
|
7
|
+
export interface NativeScroller {
|
|
8
|
+
setOffset: (offset: number) => void;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Build a {@link NativeScroller} for a target.
|
|
12
|
+
*
|
|
13
|
+
* `scrollToOffset` (`FlatList`, `FlashList`) is preferred over `scrollTo`
|
|
14
|
+
* (`ScrollView`) because a list exposes both shapes on some versions and only
|
|
15
|
+
* the former accounts for the list's own header. The `'window'` sentinel has no
|
|
16
|
+
* native meaning — there is no document scroller — so it resolves to a no-op
|
|
17
|
+
* rather than an error: a call site shared with web legitimately passes it.
|
|
18
|
+
*
|
|
19
|
+
* The handle is re-resolved on every write; it is never cached, because a ref
|
|
20
|
+
* can be swapped or detached between the schedule and the write.
|
|
21
|
+
*/
|
|
22
|
+
export declare function createScroller(target: ScrollRestorationTarget): NativeScroller;
|
|
23
|
+
//# sourceMappingURL=scrollable.native.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scrollable.native.d.ts","sourceRoot":"","sources":["../../../../src/scroll/scrollable.native.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAoB,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAEzE;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CACrC;AAsBD;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,uBAAuB,GAC9B,cAAc,CAkBhB"}
|
|
@@ -1,42 +1,61 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Derive the storage key for a scrollable from WHAT its screen is showing plus
|
|
3
|
+
* an optional caller sub-key.
|
|
3
4
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
*
|
|
11
|
-
*
|
|
5
|
+
* The key is CONTENT identity, deliberately not the navigation entry. An offset
|
|
6
|
+
* belongs to what the user was looking at, so returning to it restores however
|
|
7
|
+
* they got there — browser Back or Forward, a tab press, an in-app link — and
|
|
8
|
+
* only content never seen this session opens at the top. Keying on the entry
|
|
9
|
+
* would defeat that: a tab press and `router.replace` both mint a fresh entry,
|
|
10
|
+
* so both would open at the top even though the user has been there.
|
|
11
|
+
*
|
|
12
|
+
* The trade, chosen rather than overlooked: the same content occupying two LIVE
|
|
13
|
+
* entries now shares one offset. Pushing `/@alice` on top of `/@alice` in a
|
|
14
|
+
* native stack restores the first one's position instead of opening at the top,
|
|
15
|
+
* and while both are mounted each writes to the same key. That is the price of
|
|
16
|
+
* a tab press restoring, which is the behaviour that was asked for.
|
|
12
17
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
18
|
+
* The key is always the same two-field composite, with an absent sub-key
|
|
19
|
+
* written as empty, so two different identities can never collapse onto one key
|
|
20
|
+
* by omission.
|
|
15
21
|
*
|
|
16
|
-
* Returns `null` when there is no
|
|
17
|
-
* is not inside a navigator
|
|
22
|
+
* Returns `null` when there is no content id to anchor against (the scrollable
|
|
23
|
+
* is not inside a navigator, or the adapter cannot answer), which every caller
|
|
24
|
+
* treats as "do not persist and do not restore".
|
|
18
25
|
*/
|
|
19
|
-
export declare function deriveScrollKey(
|
|
26
|
+
export declare function deriveScrollKey(contentId: string | null, subKey?: string): string | null;
|
|
20
27
|
/**
|
|
21
28
|
* In-memory map of `scrollKey -> last-known scroll offset`.
|
|
22
29
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
30
|
+
* Offsets live only for the lifetime of the document/session. We never persist
|
|
31
|
+
* them — a full reload should start at the top — and we never auto-evict,
|
|
32
|
+
* because an entry can be revisited via browser Forward/Back long after it
|
|
33
|
+
* blurred.
|
|
34
|
+
*
|
|
35
|
+
* Deliberately an instance held in React context rather than a module-level
|
|
36
|
+
* singleton: a dependency tree can legitimately contain two copies of Bloom
|
|
37
|
+
* (a hoisted one plus a nested one under another Oxy package), and a
|
|
38
|
+
* module-global would then exist twice with no way for either half to see the
|
|
39
|
+
* other's offsets.
|
|
27
40
|
*/
|
|
28
41
|
export declare class ScrollOffsetStore {
|
|
29
42
|
private readonly offsets;
|
|
30
43
|
/** Persist the offset for a key. A negative offset is clamped to 0. */
|
|
31
44
|
save(key: string, offset: number): void;
|
|
32
45
|
/**
|
|
33
|
-
* Read the saved offset for a key. Returns `0` when nothing was saved,
|
|
34
|
-
*
|
|
46
|
+
* Read the saved offset for a key. Returns `0` when nothing was saved, which
|
|
47
|
+
* is the same value a caller writes when {@link has} is false — an unseen
|
|
48
|
+
* list restores to the top.
|
|
35
49
|
*/
|
|
36
50
|
read(key: string): number;
|
|
37
|
-
/**
|
|
51
|
+
/**
|
|
52
|
+
* Whether an offset was ever saved for this key. This — not `read() > 0` —
|
|
53
|
+
* is what separates "restore" from "reset": a key that was never seen and a
|
|
54
|
+
* key deliberately saved at the top both read 0, and only the store knows
|
|
55
|
+
* which is which.
|
|
56
|
+
*/
|
|
38
57
|
has(key: string): boolean;
|
|
39
|
-
/** Drop a saved offset (e.g. when
|
|
58
|
+
/** Drop a saved offset (e.g. when an entry is permanently removed). */
|
|
40
59
|
forget(key: string): void;
|
|
41
60
|
/** Clear every saved offset. Primarily for tests and full resets. */
|
|
42
61
|
clear(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../../src/scroll/store.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../../src/scroll/store.ts"],"names":[],"mappings":"AAiBA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,MAAM,CAAC,EAAE,MAAM,GACd,MAAM,GAAG,IAAI,CAGf;AAED;;;;;;;;;;;;;GAaG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA6B;IAErD,uEAAuE;IACvE,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAIvC;;;;OAIG;IACH,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAIzB;;;;;OAKG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAIzB,uEAAuE;IACvE,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAIzB,qEAAqE;IACrE,KAAK,IAAI,IAAI;IAIb,iDAAiD;IACjD,IAAI,IAAI,IAAI,MAAM,CAEjB;CACF"}
|
|
@@ -1,24 +1,31 @@
|
|
|
1
1
|
import type { ReactNode, RefObject } from 'react';
|
|
2
|
+
import type { NativeScrollEvent, NativeSyntheticEvent } from 'react-native';
|
|
2
3
|
/**
|
|
3
4
|
* Anything `useScrollRestoration` knows how to read/write a vertical scroll
|
|
4
5
|
* offset from. The hook accepts a ref to one of these:
|
|
5
6
|
*
|
|
6
|
-
* - a React Native `ScrollView` / `FlatList` ref (which on web is
|
|
7
|
-
* DOM node and exposes `getScrollableNode()`),
|
|
7
|
+
* - a React Native `ScrollView` / `FlatList` / `FlashList` ref (which on web is
|
|
8
|
+
* backed by a DOM node and exposes `getScrollableNode()`),
|
|
8
9
|
* - a raw DOM element ref (when a component renders its own scroll container),
|
|
9
|
-
* - the literal `'window'` sentinel, for the
|
|
10
|
-
*
|
|
10
|
+
* - the literal `'window'` sentinel, for the layout where the list IS the
|
|
11
|
+
* document scroller.
|
|
11
12
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
13
|
+
* The two imperative methods are the native write path; web writes `scrollTop`
|
|
14
|
+
* on the resolved DOM node instead. Both are optional because a given ref only
|
|
15
|
+
* ever exposes one of them (list vs. scroll view).
|
|
14
16
|
*/
|
|
15
17
|
export interface ScrollableHandle {
|
|
16
|
-
/**
|
|
18
|
+
/** `ScrollView`'s imperative scroll API. */
|
|
17
19
|
scrollTo?: (options: {
|
|
18
20
|
x?: number;
|
|
19
21
|
y?: number;
|
|
20
22
|
animated?: boolean;
|
|
21
23
|
}) => void;
|
|
24
|
+
/** `FlatList`/`FlashList`'s imperative scroll API. */
|
|
25
|
+
scrollToOffset?: (options: {
|
|
26
|
+
offset: number;
|
|
27
|
+
animated?: boolean;
|
|
28
|
+
}) => void;
|
|
22
29
|
/** Web/RNW path: returns the underlying DOM node. */
|
|
23
30
|
getScrollableNode?: () => unknown;
|
|
24
31
|
}
|
|
@@ -26,21 +33,84 @@ export interface ScrollableHandle {
|
|
|
26
33
|
* The accepted ref shapes. `'window'` is a sentinel for the document scroller.
|
|
27
34
|
*/
|
|
28
35
|
export type ScrollRestorationTarget = RefObject<ScrollableHandle | null> | RefObject<unknown> | 'window';
|
|
36
|
+
/** The effect shape `useScreenFocusEffect` runs — mirrors `useEffect`'s. */
|
|
37
|
+
export type ScreenFocusEffect = () => (() => void) | void;
|
|
38
|
+
/**
|
|
39
|
+
* The router bindings the scroll core needs, and the ONLY thing it knows about
|
|
40
|
+
* routing. Keeping this to two hooks is what lets the core ship without a
|
|
41
|
+
* router import, so a Vite/SPA consumer can supply its own adapter (or none).
|
|
42
|
+
*
|
|
43
|
+
* Both members are HOOKS: the core calls them from `useScrollRestoration`, so
|
|
44
|
+
* the adapter value must be referentially stable for the lifetime of the
|
|
45
|
+
* provider (a module-level constant, which is what every adapter Bloom ships
|
|
46
|
+
* is). Swapping in a different adapter at runtime would change the hook order
|
|
47
|
+
* of every consumer below it.
|
|
48
|
+
*/
|
|
49
|
+
export interface ScrollRouterAdapter {
|
|
50
|
+
/**
|
|
51
|
+
* Identify WHAT the calling screen is showing — its route and params, not the
|
|
52
|
+
* history slot it occupies. Offsets are remembered per content, so returning
|
|
53
|
+
* to something already seen restores it however the user got there.
|
|
54
|
+
*
|
|
55
|
+
* It must describe the screen the CALLER is rendered inside, never the
|
|
56
|
+
* globally focused one: a background screen has to keep reporting its own
|
|
57
|
+
* content, or it would save its offset under the foreground screen's key.
|
|
58
|
+
*
|
|
59
|
+
* `null` when the adapter cannot answer (a scrollable rendered outside any
|
|
60
|
+
* navigator), which makes the hook inert rather than guessing.
|
|
61
|
+
*/
|
|
62
|
+
useScreenContentId(): string | null;
|
|
63
|
+
/**
|
|
64
|
+
* Run `effect` while the calling screen is focused, and its cleanup on blur.
|
|
65
|
+
* Re-runs when `effect`'s identity changes AND the screen is focused — that
|
|
66
|
+
* is what makes an in-screen key change (a tab or folder swap) visible to a
|
|
67
|
+
* hook that never blurred.
|
|
68
|
+
*/
|
|
69
|
+
useScreenFocusEffect(effect: ScreenFocusEffect): void;
|
|
70
|
+
}
|
|
29
71
|
export interface UseScrollRestorationOptions {
|
|
30
72
|
/**
|
|
31
|
-
* Sub-key
|
|
32
|
-
*
|
|
33
|
-
*
|
|
73
|
+
* Sub-key distinguishing scrollables that share one screen AND one content
|
|
74
|
+
* id — the tabs of a profile, the folders of a saved-items screen. Changing
|
|
75
|
+
* it while the screen stays focused saves the outgoing list's offset and
|
|
76
|
+
* restores (or resets) the incoming one.
|
|
34
77
|
*/
|
|
35
78
|
key?: string;
|
|
36
79
|
/**
|
|
37
|
-
* When `false
|
|
38
|
-
*
|
|
80
|
+
* When `false` the hook is completely inert: no save, no restore, no reset.
|
|
81
|
+
*
|
|
82
|
+
* On NATIVE this is load-bearing rather than a feature flag. Restoring into a
|
|
83
|
+
* list whose rows have not been laid out yet lands at the wrong place (or is
|
|
84
|
+
* clamped away), and native has no equivalent of the web path's re-apply
|
|
85
|
+
* loop — so the caller gates on its own content being present, e.g.
|
|
86
|
+
* `enabled: rows.length > 0`. Flipping it from `false` to `true` is what
|
|
87
|
+
* triggers the restore.
|
|
88
|
+
*
|
|
39
89
|
* Defaults to `true`.
|
|
40
90
|
*/
|
|
41
91
|
enabled?: boolean;
|
|
42
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* What `useScrollRestoration` hands back. Identical on both platforms so call
|
|
95
|
+
* sites are written once.
|
|
96
|
+
*/
|
|
97
|
+
export interface ScrollRestorationBinding {
|
|
98
|
+
/**
|
|
99
|
+
* Wire onto the list being restored: `<FlashList onScroll={scroll.onScroll}>`.
|
|
100
|
+
*
|
|
101
|
+
* Native has no way to observe a list's offset from outside it, so this is
|
|
102
|
+
* how offsets are recorded there. On web it is a stable no-op — the web path
|
|
103
|
+
* subscribes to the resolved DOM node's own `scroll` event, which needs
|
|
104
|
+
* nothing from the caller — and passing it costs nothing.
|
|
105
|
+
*/
|
|
106
|
+
onScroll: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
|
107
|
+
}
|
|
43
108
|
export interface ScrollRestorationProviderProps {
|
|
44
109
|
children: ReactNode;
|
|
110
|
+
/**
|
|
111
|
+
* Binds the store to a router. Must be referentially stable — see
|
|
112
|
+
* {@link ScrollRouterAdapter}.
|
|
113
|
+
*/
|
|
114
|
+
adapter: ScrollRouterAdapter;
|
|
45
115
|
}
|
|
46
116
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/scroll/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/scroll/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClD,OAAO,KAAK,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAE5E;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,gBAAgB;IAC/B,4CAA4C;IAC5C,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE;QAAE,CAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,CAAC;IAC7E,sDAAsD;IACtD,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,CAAC;IAC3E,qDAAqD;IACrD,iBAAiB,CAAC,EAAE,MAAM,OAAO,CAAC;CACnC;AAED;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAC/B,SAAS,CAAC,gBAAgB,GAAG,IAAI,CAAC,GAClC,SAAS,CAAC,OAAO,CAAC,GAClB,QAAQ,CAAC;AAEb,4EAA4E;AAC5E,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,CAAC;AAE1D;;;;;;;;;;GAUG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;;;;;;;;OAWG;IACH,kBAAkB,IAAI,MAAM,GAAG,IAAI,CAAC;IACpC;;;;;OAKG;IACH,oBAAoB,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAAC;CACvD;AAED,MAAM,WAAW,2BAA2B;IAC1C;;;;;OAKG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,wBAAwB;IACvC;;;;;;;OAOG;IACH,QAAQ,EAAE,CAAC,KAAK,EAAE,oBAAoB,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;CACpE;AAED,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,EAAE,SAAS,CAAC;IACpB;;;OAGG;IACH,OAAO,EAAE,mBAAmB,CAAC;CAC9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color-policy.d.ts","sourceRoot":"","sources":["../../../../src/theme/color-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,EAAe,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAK9D,sFAAsF;AACtF,eAAO,MAAM,YAAY;;;;;CAKf,CAAC;AAEX,wFAAwF;AACxF,MAAM,WAAW,aAAa;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,kFAAkF;AAClF,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"color-policy.d.ts","sourceRoot":"","sources":["../../../../src/theme/color-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,EAAe,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAK9D,sFAAsF;AACtF,eAAO,MAAM,YAAY;;;;;CAKf,CAAC;AAEX,wFAAwF;AACxF,MAAM,WAAW,aAAa;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,kFAAkF;AAClF,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAkPlD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,OAAO,EACf,KAAK,EAAE,UAAU,EACjB,MAAM,GAAE,aAAkB,GACzB,YAAY,CAgHd"}
|
|
@@ -18,11 +18,13 @@
|
|
|
18
18
|
* Nesting extra contexts costs nothing at runtime — the win is that scope is no
|
|
19
19
|
* longer a per-app decision.
|
|
20
20
|
*
|
|
21
|
-
* EXPO/EXPO-ROUTER APPS ONLY
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
21
|
+
* EXPO/EXPO-ROUTER APPS ONLY, and now for one narrow reason: it binds the
|
|
22
|
+
* scroll store to the expo-router ADAPTER, which is the only module in the
|
|
23
|
+
* scroll primitive that imports `expo-router`. The scroll core itself is
|
|
24
|
+
* router-agnostic, so a Vite/SPA consumer can mount
|
|
25
|
+
* `<ScrollRestorationProvider adapter={...}>` from `@oxyhq/bloom/scroll` with
|
|
26
|
+
* an adapter for its own router — alongside `BloomThemeProvider` and whatever
|
|
27
|
+
* else it needs — rather than going without.
|
|
26
28
|
*
|
|
27
29
|
* NOT included, on purpose — these are OUTLETS, not state, and their placement
|
|
28
30
|
* in the tree is a real app decision (z-order, safe areas, and mounting a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/provider/index.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/provider/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,EAAyB,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAG9E,OAAO,EAAsB,KAAK,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAI5E,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,uBAAuB,EAAE,UAAU,CAAC;IACnF,QAAQ,EAAE,SAAS,CAAC;IACpB;;;;OAIG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,wFAAwF;IACxF,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,aAAa,EACb,OAAc,EACd,GAAG,UAAU,EACd,EAAE,kBAAkB,2CAcpB;yBAnBe,aAAa"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ScrollOffsetStore } from './store';
|
|
2
|
+
import type { ScrollRestorationProviderProps, ScrollRouterAdapter } from './types';
|
|
3
|
+
export interface ScrollRestorationContextValue {
|
|
4
|
+
store: ScrollOffsetStore;
|
|
5
|
+
adapter: ScrollRouterAdapter;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Holds the offset map and the router binding for the subtree. One provider
|
|
9
|
+
* near the app root is enough; the store lives as long as the provider, so
|
|
10
|
+
* offsets survive navigating away and back (including browser Back/Forward).
|
|
11
|
+
*/
|
|
12
|
+
export declare function ScrollRestorationProvider({ children, adapter, }: ScrollRestorationProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare function useScrollRestorationContext(): ScrollRestorationContextValue;
|
|
14
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../src/scroll/context.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,KAAK,EACV,8BAA8B,EAC9B,mBAAmB,EACpB,MAAM,SAAS,CAAC;AAEjB,MAAM,WAAW,6BAA6B;IAC5C,KAAK,EAAE,iBAAiB,CAAC;IACzB,OAAO,EAAE,mBAAmB,CAAC;CAC9B;AAMD;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,EACxC,QAAQ,EACR,OAAO,GACR,EAAE,8BAA8B,2CAWhC;AAED,wBAAgB,2BAA2B,IAAI,6BAA6B,CAQ3E"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ScrollRouterAdapter } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* The adapter to hand `<ScrollRestorationProvider adapter={...}>` in an
|
|
4
|
+
* expo-router app. A module-level constant, as the adapter contract requires.
|
|
5
|
+
*/
|
|
6
|
+
export declare const expoRouterScrollAdapter: ScrollRouterAdapter;
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/scroll/expo-router/index.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAqB,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAkHvE;;;GAGG;AACH,eAAO,MAAM,uBAAuB,EAAE,mBAGrC,CAAC"}
|