@oxy.so/bloom 19.5.2 → 19.6.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/docs/adoption-matrix.mdx +13 -13
- package/docs/app-shell.mdx +18 -11
- package/docs/compose-layouts.mdx +114 -2
- package/docs/dialog.mdx +7 -0
- package/docs/engagement-bar.mdx +9 -0
- package/docs/layout.mdx +1 -1
- package/docs/list.mdx +4 -3
- package/docs/page-header.mdx +7 -0
- package/docs/public-parts.mdx +1 -1
- package/docs/screen.mdx +4 -0
- package/docs/scroll.mdx +6 -3
- package/docs/sidebar.mdx +26 -5
- package/docs/task-catalog.json +1 -1
- package/docs/task-catalog.mdx +1 -1
- package/lib/commonjs/app-shell/AppShell.js +3 -3
- package/lib/commonjs/app-shell/AppShell.js.map +1 -1
- package/lib/commonjs/app-shell/AppShellEngine.js +2 -1
- package/lib/commonjs/app-shell/AppShellEngine.js.map +1 -1
- package/lib/commonjs/app-shell/AppShellPanelLayout.js +345 -172
- package/lib/commonjs/app-shell/AppShellPanelLayout.js.map +1 -1
- package/lib/commonjs/app-shell/RetainedPanelLayout.js +6 -0
- package/lib/commonjs/app-shell/RetainedPanelLayout.js.map +1 -1
- package/lib/commonjs/app-shell/panel-layout-css.js +20 -13
- package/lib/commonjs/app-shell/panel-layout-css.js.map +1 -1
- package/lib/commonjs/app-shell/panel-layout.js +33 -185
- package/lib/commonjs/app-shell/panel-layout.js.map +1 -1
- package/lib/commonjs/app-shell/panel-motion.js +13 -36
- package/lib/commonjs/app-shell/panel-motion.js.map +1 -1
- package/lib/commonjs/app-shell/panel-transitions.js +26 -0
- package/lib/commonjs/app-shell/panel-transitions.js.map +1 -0
- package/lib/commonjs/app-shell/shell-layout-css.js +2 -2
- package/lib/commonjs/app-shell/shell-layout-css.js.map +1 -1
- package/lib/commonjs/app-shell/use-panel-exit-completion.js +100 -0
- package/lib/commonjs/app-shell/use-panel-exit-completion.js.map +1 -0
- package/lib/commonjs/app-shell/use-panel-resize.js +21 -7
- package/lib/commonjs/app-shell/use-panel-resize.js.map +1 -1
- package/lib/commonjs/app-shell/use-panel-reveal.js +2 -1
- package/lib/commonjs/app-shell/use-panel-reveal.js.map +1 -1
- package/lib/commonjs/bottom-sheet/BottomSheetBase.js +3 -2
- package/lib/commonjs/bottom-sheet/BottomSheetBase.js.map +1 -1
- package/lib/commonjs/dialog/DialogBottomSheet.js +6 -3
- package/lib/commonjs/dialog/DialogBottomSheet.js.map +1 -1
- package/lib/commonjs/engagement-bar/EngagementAction.js +6 -5
- package/lib/commonjs/engagement-bar/EngagementAction.js.map +1 -1
- package/lib/commonjs/engagement-bar/EngagementBar.js +31 -7
- package/lib/commonjs/engagement-bar/EngagementBar.js.map +1 -1
- package/lib/commonjs/engagement-bar/EngagementPop.js +10 -3
- package/lib/commonjs/engagement-bar/EngagementPop.js.map +1 -1
- package/lib/commonjs/engagement-bar/context.js.map +1 -1
- package/lib/commonjs/engagement-bar/paint.js +59 -12
- package/lib/commonjs/engagement-bar/paint.js.map +1 -1
- package/lib/commonjs/hooks/use-border-box-size.js +46 -0
- package/lib/commonjs/hooks/use-border-box-size.js.map +1 -0
- package/lib/commonjs/layout/ScrollBar.web.js +62 -29
- package/lib/commonjs/layout/ScrollBar.web.js.map +1 -1
- package/lib/commonjs/layout/scroll-metrics.js.map +1 -1
- package/lib/commonjs/list/VirtualList.js +12 -0
- package/lib/commonjs/list/VirtualList.js.map +1 -1
- package/lib/commonjs/list/VirtualList.web.js +40 -19
- package/lib/commonjs/list/VirtualList.web.js.map +1 -1
- package/lib/commonjs/list/flash-list-module.js.map +1 -1
- package/lib/commonjs/page-header/EdgeScrim.js +14 -4
- package/lib/commonjs/page-header/EdgeScrim.js.map +1 -1
- package/lib/commonjs/page-header/PageHeader.js +19 -6
- package/lib/commonjs/page-header/PageHeader.js.map +1 -1
- package/lib/commonjs/screen/ScreenBase.js +15 -6
- package/lib/commonjs/screen/ScreenBase.js.map +1 -1
- package/lib/commonjs/screen/ScreenScrollViewBase.js +12 -2
- package/lib/commonjs/screen/ScreenScrollViewBase.js.map +1 -1
- package/lib/commonjs/screen/context.js.map +1 -1
- package/lib/commonjs/screen/use-intrinsic-content-height.js +53 -0
- package/lib/commonjs/screen/use-intrinsic-content-height.js.map +1 -0
- package/lib/commonjs/screen/use-screen-viewport.js +37 -6
- package/lib/commonjs/screen/use-screen-viewport.js.map +1 -1
- package/lib/commonjs/scroll/constants.js +4 -1
- package/lib/commonjs/scroll/constants.js.map +1 -1
- package/lib/commonjs/scroll/owner-handoff.js +27 -7
- package/lib/commonjs/scroll/owner-handoff.js.map +1 -1
- package/lib/commonjs/scroll/use-scroll-restoration.web.js +2 -11
- package/lib/commonjs/scroll/use-scroll-restoration.web.js.map +1 -1
- package/lib/commonjs/sidebar/Sidebar.js +121 -87
- package/lib/commonjs/sidebar/Sidebar.js.map +1 -1
- package/lib/commonjs/sidebar/arrangement.js +36 -0
- package/lib/commonjs/sidebar/arrangement.js.map +1 -0
- package/lib/commonjs/sidebar/index.js.map +1 -1
- package/lib/module/app-shell/AppShell.js +3 -3
- package/lib/module/app-shell/AppShell.js.map +1 -1
- package/lib/module/app-shell/AppShellEngine.js +2 -1
- package/lib/module/app-shell/AppShellEngine.js.map +1 -1
- package/lib/module/app-shell/AppShellPanelLayout.js +319 -147
- package/lib/module/app-shell/AppShellPanelLayout.js.map +1 -1
- package/lib/module/app-shell/RetainedPanelLayout.js +7 -1
- package/lib/module/app-shell/RetainedPanelLayout.js.map +1 -1
- package/lib/module/app-shell/panel-layout-css.js +19 -12
- package/lib/module/app-shell/panel-layout-css.js.map +1 -1
- package/lib/module/app-shell/panel-layout.js +32 -183
- package/lib/module/app-shell/panel-layout.js.map +1 -1
- package/lib/module/app-shell/panel-motion.js +14 -36
- package/lib/module/app-shell/panel-motion.js.map +1 -1
- package/lib/module/app-shell/panel-transitions.js +21 -0
- package/lib/module/app-shell/panel-transitions.js.map +1 -0
- package/lib/module/app-shell/shell-layout-css.js +2 -2
- package/lib/module/app-shell/shell-layout-css.js.map +1 -1
- package/lib/module/app-shell/use-panel-exit-completion.js +97 -0
- package/lib/module/app-shell/use-panel-exit-completion.js.map +1 -0
- package/lib/module/app-shell/use-panel-resize.js +22 -8
- package/lib/module/app-shell/use-panel-resize.js.map +1 -1
- package/lib/module/app-shell/use-panel-reveal.js +2 -1
- package/lib/module/app-shell/use-panel-reveal.js.map +1 -1
- package/lib/module/bottom-sheet/BottomSheetBase.js +3 -2
- package/lib/module/bottom-sheet/BottomSheetBase.js.map +1 -1
- package/lib/module/dialog/DialogBottomSheet.js +6 -3
- package/lib/module/dialog/DialogBottomSheet.js.map +1 -1
- package/lib/module/engagement-bar/EngagementAction.js +7 -6
- package/lib/module/engagement-bar/EngagementAction.js.map +1 -1
- package/lib/module/engagement-bar/EngagementBar.js +29 -5
- package/lib/module/engagement-bar/EngagementBar.js.map +1 -1
- package/lib/module/engagement-bar/EngagementPop.js +10 -3
- package/lib/module/engagement-bar/EngagementPop.js.map +1 -1
- package/lib/module/engagement-bar/context.js.map +1 -1
- package/lib/module/engagement-bar/paint.js +60 -13
- package/lib/module/engagement-bar/paint.js.map +1 -1
- package/lib/module/hooks/use-border-box-size.js +42 -0
- package/lib/module/hooks/use-border-box-size.js.map +1 -0
- package/lib/module/layout/ScrollBar.web.js +64 -31
- package/lib/module/layout/ScrollBar.web.js.map +1 -1
- package/lib/module/layout/scroll-metrics.js.map +1 -1
- package/lib/module/list/VirtualList.js +12 -0
- package/lib/module/list/VirtualList.js.map +1 -1
- package/lib/module/list/VirtualList.web.js +41 -20
- package/lib/module/list/VirtualList.web.js.map +1 -1
- package/lib/module/list/flash-list-module.js.map +1 -1
- package/lib/module/page-header/EdgeScrim.js +14 -4
- package/lib/module/page-header/EdgeScrim.js.map +1 -1
- package/lib/module/page-header/PageHeader.js +19 -6
- package/lib/module/page-header/PageHeader.js.map +1 -1
- package/lib/module/screen/ScreenBase.js +15 -6
- package/lib/module/screen/ScreenBase.js.map +1 -1
- package/lib/module/screen/ScreenScrollViewBase.js +12 -2
- package/lib/module/screen/ScreenScrollViewBase.js.map +1 -1
- package/lib/module/screen/context.js.map +1 -1
- package/lib/module/screen/use-intrinsic-content-height.js +50 -0
- package/lib/module/screen/use-intrinsic-content-height.js.map +1 -0
- package/lib/module/screen/use-screen-viewport.js +39 -8
- package/lib/module/screen/use-screen-viewport.js.map +1 -1
- package/lib/module/scroll/constants.js +3 -0
- package/lib/module/scroll/constants.js.map +1 -1
- package/lib/module/scroll/owner-handoff.js +27 -8
- package/lib/module/scroll/owner-handoff.js.map +1 -1
- package/lib/module/scroll/use-scroll-restoration.web.js +1 -10
- package/lib/module/scroll/use-scroll-restoration.web.js.map +1 -1
- package/lib/module/sidebar/Sidebar.js +121 -87
- package/lib/module/sidebar/Sidebar.js.map +1 -1
- package/lib/module/sidebar/arrangement.js +32 -0
- package/lib/module/sidebar/arrangement.js.map +1 -0
- package/lib/module/sidebar/index.js.map +1 -1
- package/lib/typescript/commonjs/app-shell/AppShell.d.ts.map +1 -1
- package/lib/typescript/commonjs/app-shell/AppShellEngine.d.ts.map +1 -1
- package/lib/typescript/commonjs/app-shell/AppShellPanelLayout.d.ts.map +1 -1
- package/lib/typescript/commonjs/app-shell/RetainedPanelLayout.d.ts.map +1 -1
- package/lib/typescript/commonjs/app-shell/panel-layout-css.d.ts +2 -1
- package/lib/typescript/commonjs/app-shell/panel-layout-css.d.ts.map +1 -1
- package/lib/typescript/commonjs/app-shell/panel-layout-types.d.ts +11 -2
- package/lib/typescript/commonjs/app-shell/panel-layout-types.d.ts.map +1 -1
- package/lib/typescript/commonjs/app-shell/panel-layout.d.ts +13 -27
- package/lib/typescript/commonjs/app-shell/panel-layout.d.ts.map +1 -1
- package/lib/typescript/commonjs/app-shell/panel-motion.d.ts +1 -12
- package/lib/typescript/commonjs/app-shell/panel-motion.d.ts.map +1 -1
- package/lib/typescript/commonjs/app-shell/panel-transitions.d.ts +4 -0
- package/lib/typescript/commonjs/app-shell/panel-transitions.d.ts.map +1 -0
- package/lib/typescript/commonjs/app-shell/shell-layout-css.d.ts.map +1 -1
- package/lib/typescript/commonjs/app-shell/types.d.ts +4 -0
- package/lib/typescript/commonjs/app-shell/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/app-shell/use-panel-exit-completion.d.ts +14 -0
- package/lib/typescript/commonjs/app-shell/use-panel-exit-completion.d.ts.map +1 -0
- package/lib/typescript/commonjs/app-shell/use-panel-reorder.d.ts +2 -2
- package/lib/typescript/commonjs/app-shell/use-panel-reorder.d.ts.map +1 -1
- package/lib/typescript/commonjs/app-shell/use-panel-resize.d.ts +4 -2
- package/lib/typescript/commonjs/app-shell/use-panel-resize.d.ts.map +1 -1
- package/lib/typescript/commonjs/app-shell/use-panel-reveal.d.ts +2 -2
- package/lib/typescript/commonjs/app-shell/use-panel-reveal.d.ts.map +1 -1
- package/lib/typescript/commonjs/bottom-sheet/BottomSheetBase.d.ts.map +1 -1
- package/lib/typescript/commonjs/bottom-sheet/types.d.ts +2 -0
- package/lib/typescript/commonjs/bottom-sheet/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/DialogBottomSheet.d.ts +2 -2
- package/lib/typescript/commonjs/dialog/DialogBottomSheet.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/types.d.ts +2 -0
- package/lib/typescript/commonjs/dialog/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/engagement-bar/EngagementAction.d.ts.map +1 -1
- package/lib/typescript/commonjs/engagement-bar/EngagementBar.d.ts +3 -3
- package/lib/typescript/commonjs/engagement-bar/EngagementBar.d.ts.map +1 -1
- package/lib/typescript/commonjs/engagement-bar/EngagementPop.d.ts +2 -1
- package/lib/typescript/commonjs/engagement-bar/EngagementPop.d.ts.map +1 -1
- package/lib/typescript/commonjs/engagement-bar/context.d.ts +1 -0
- package/lib/typescript/commonjs/engagement-bar/context.d.ts.map +1 -1
- package/lib/typescript/commonjs/engagement-bar/paint.d.ts +4 -2
- package/lib/typescript/commonjs/engagement-bar/paint.d.ts.map +1 -1
- package/lib/typescript/commonjs/engagement-bar/types.d.ts +10 -1
- package/lib/typescript/commonjs/engagement-bar/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/hooks/use-border-box-size.d.ts +13 -0
- package/lib/typescript/commonjs/hooks/use-border-box-size.d.ts.map +1 -0
- package/lib/typescript/commonjs/layout/ScrollBar.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/layout/scroll-metrics.d.ts +2 -0
- package/lib/typescript/commonjs/layout/scroll-metrics.d.ts.map +1 -1
- package/lib/typescript/commonjs/layout/types.d.ts +2 -2
- package/lib/typescript/commonjs/layout/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/list/VirtualList.d.ts.map +1 -1
- package/lib/typescript/commonjs/list/VirtualList.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/list/flash-list-module.d.ts +1 -1
- package/lib/typescript/commonjs/list/flash-list-module.d.ts.map +1 -1
- package/lib/typescript/commonjs/page-header/EdgeScrim.d.ts +3 -1
- package/lib/typescript/commonjs/page-header/EdgeScrim.d.ts.map +1 -1
- package/lib/typescript/commonjs/page-header/PageHeader.d.ts +1 -1
- package/lib/typescript/commonjs/page-header/PageHeader.d.ts.map +1 -1
- package/lib/typescript/commonjs/page-header/types.d.ts +2 -0
- package/lib/typescript/commonjs/page-header/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/screen/ScreenBase.d.ts.map +1 -1
- package/lib/typescript/commonjs/screen/ScreenScrollViewBase.d.ts.map +1 -1
- package/lib/typescript/commonjs/screen/context.d.ts +3 -0
- package/lib/typescript/commonjs/screen/context.d.ts.map +1 -1
- package/lib/typescript/commonjs/screen/use-intrinsic-content-height.d.ts +3 -0
- package/lib/typescript/commonjs/screen/use-intrinsic-content-height.d.ts.map +1 -0
- package/lib/typescript/commonjs/screen/use-screen-viewport.d.ts.map +1 -1
- package/lib/typescript/commonjs/scroll/constants.d.ts +2 -0
- package/lib/typescript/commonjs/scroll/constants.d.ts.map +1 -1
- package/lib/typescript/commonjs/scroll/owner-handoff.d.ts +3 -1
- package/lib/typescript/commonjs/scroll/owner-handoff.d.ts.map +1 -1
- package/lib/typescript/commonjs/scroll/use-scroll-restoration.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/sidebar/Sidebar.d.ts.map +1 -1
- package/lib/typescript/commonjs/sidebar/arrangement.d.ts +32 -0
- package/lib/typescript/commonjs/sidebar/arrangement.d.ts.map +1 -0
- package/lib/typescript/commonjs/sidebar/index.d.ts +1 -0
- package/lib/typescript/commonjs/sidebar/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/sidebar/types.d.ts +13 -1
- package/lib/typescript/commonjs/sidebar/types.d.ts.map +1 -1
- package/lib/typescript/module/app-shell/AppShell.d.ts.map +1 -1
- package/lib/typescript/module/app-shell/AppShellEngine.d.ts.map +1 -1
- package/lib/typescript/module/app-shell/AppShellPanelLayout.d.ts.map +1 -1
- package/lib/typescript/module/app-shell/RetainedPanelLayout.d.ts.map +1 -1
- package/lib/typescript/module/app-shell/panel-layout-css.d.ts +2 -1
- package/lib/typescript/module/app-shell/panel-layout-css.d.ts.map +1 -1
- package/lib/typescript/module/app-shell/panel-layout-types.d.ts +11 -2
- package/lib/typescript/module/app-shell/panel-layout-types.d.ts.map +1 -1
- package/lib/typescript/module/app-shell/panel-layout.d.ts +13 -27
- package/lib/typescript/module/app-shell/panel-layout.d.ts.map +1 -1
- package/lib/typescript/module/app-shell/panel-motion.d.ts +1 -12
- package/lib/typescript/module/app-shell/panel-motion.d.ts.map +1 -1
- package/lib/typescript/module/app-shell/panel-transitions.d.ts +4 -0
- package/lib/typescript/module/app-shell/panel-transitions.d.ts.map +1 -0
- package/lib/typescript/module/app-shell/shell-layout-css.d.ts.map +1 -1
- package/lib/typescript/module/app-shell/types.d.ts +4 -0
- package/lib/typescript/module/app-shell/types.d.ts.map +1 -1
- package/lib/typescript/module/app-shell/use-panel-exit-completion.d.ts +14 -0
- package/lib/typescript/module/app-shell/use-panel-exit-completion.d.ts.map +1 -0
- package/lib/typescript/module/app-shell/use-panel-reorder.d.ts +2 -2
- package/lib/typescript/module/app-shell/use-panel-reorder.d.ts.map +1 -1
- package/lib/typescript/module/app-shell/use-panel-resize.d.ts +4 -2
- package/lib/typescript/module/app-shell/use-panel-resize.d.ts.map +1 -1
- package/lib/typescript/module/app-shell/use-panel-reveal.d.ts +2 -2
- package/lib/typescript/module/app-shell/use-panel-reveal.d.ts.map +1 -1
- package/lib/typescript/module/bottom-sheet/BottomSheetBase.d.ts.map +1 -1
- package/lib/typescript/module/bottom-sheet/types.d.ts +2 -0
- package/lib/typescript/module/bottom-sheet/types.d.ts.map +1 -1
- package/lib/typescript/module/dialog/DialogBottomSheet.d.ts +2 -2
- package/lib/typescript/module/dialog/DialogBottomSheet.d.ts.map +1 -1
- package/lib/typescript/module/dialog/types.d.ts +2 -0
- package/lib/typescript/module/dialog/types.d.ts.map +1 -1
- package/lib/typescript/module/engagement-bar/EngagementAction.d.ts.map +1 -1
- package/lib/typescript/module/engagement-bar/EngagementBar.d.ts +3 -3
- package/lib/typescript/module/engagement-bar/EngagementBar.d.ts.map +1 -1
- package/lib/typescript/module/engagement-bar/EngagementPop.d.ts +2 -1
- package/lib/typescript/module/engagement-bar/EngagementPop.d.ts.map +1 -1
- package/lib/typescript/module/engagement-bar/context.d.ts +1 -0
- package/lib/typescript/module/engagement-bar/context.d.ts.map +1 -1
- package/lib/typescript/module/engagement-bar/paint.d.ts +4 -2
- package/lib/typescript/module/engagement-bar/paint.d.ts.map +1 -1
- package/lib/typescript/module/engagement-bar/types.d.ts +10 -1
- package/lib/typescript/module/engagement-bar/types.d.ts.map +1 -1
- package/lib/typescript/module/hooks/use-border-box-size.d.ts +13 -0
- package/lib/typescript/module/hooks/use-border-box-size.d.ts.map +1 -0
- package/lib/typescript/module/layout/ScrollBar.web.d.ts.map +1 -1
- package/lib/typescript/module/layout/scroll-metrics.d.ts +2 -0
- package/lib/typescript/module/layout/scroll-metrics.d.ts.map +1 -1
- package/lib/typescript/module/layout/types.d.ts +2 -2
- package/lib/typescript/module/layout/types.d.ts.map +1 -1
- package/lib/typescript/module/list/VirtualList.d.ts.map +1 -1
- package/lib/typescript/module/list/VirtualList.web.d.ts.map +1 -1
- package/lib/typescript/module/list/flash-list-module.d.ts +1 -1
- package/lib/typescript/module/list/flash-list-module.d.ts.map +1 -1
- package/lib/typescript/module/page-header/EdgeScrim.d.ts +3 -1
- package/lib/typescript/module/page-header/EdgeScrim.d.ts.map +1 -1
- package/lib/typescript/module/page-header/PageHeader.d.ts +1 -1
- package/lib/typescript/module/page-header/PageHeader.d.ts.map +1 -1
- package/lib/typescript/module/page-header/types.d.ts +2 -0
- package/lib/typescript/module/page-header/types.d.ts.map +1 -1
- package/lib/typescript/module/screen/ScreenBase.d.ts.map +1 -1
- package/lib/typescript/module/screen/ScreenScrollViewBase.d.ts.map +1 -1
- package/lib/typescript/module/screen/context.d.ts +3 -0
- package/lib/typescript/module/screen/context.d.ts.map +1 -1
- package/lib/typescript/module/screen/use-intrinsic-content-height.d.ts +3 -0
- package/lib/typescript/module/screen/use-intrinsic-content-height.d.ts.map +1 -0
- package/lib/typescript/module/screen/use-screen-viewport.d.ts.map +1 -1
- package/lib/typescript/module/scroll/constants.d.ts +2 -0
- package/lib/typescript/module/scroll/constants.d.ts.map +1 -1
- package/lib/typescript/module/scroll/owner-handoff.d.ts +3 -1
- package/lib/typescript/module/scroll/owner-handoff.d.ts.map +1 -1
- package/lib/typescript/module/scroll/use-scroll-restoration.web.d.ts.map +1 -1
- package/lib/typescript/module/sidebar/Sidebar.d.ts.map +1 -1
- package/lib/typescript/module/sidebar/arrangement.d.ts +32 -0
- package/lib/typescript/module/sidebar/arrangement.d.ts.map +1 -0
- package/lib/typescript/module/sidebar/index.d.ts +1 -0
- package/lib/typescript/module/sidebar/index.d.ts.map +1 -1
- package/lib/typescript/module/sidebar/types.d.ts +13 -1
- package/lib/typescript/module/sidebar/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/support/yoga-host-tree.ts +55 -2
- package/src/app-shell/AppShell.tsx +7 -3
- package/src/app-shell/AppShellEngine.tsx +6 -2
- package/src/app-shell/AppShellPanelLayout.tsx +466 -189
- package/src/app-shell/RetainedPanelLayout.tsx +7 -1
- package/src/app-shell/panel-layout-css.ts +41 -27
- package/src/app-shell/panel-layout-types.ts +11 -2
- package/src/app-shell/panel-layout.ts +49 -256
- package/src/app-shell/panel-motion.ts +34 -52
- package/src/app-shell/panel-transitions.ts +39 -0
- package/src/app-shell/shell-layout-css.ts +6 -2
- package/src/app-shell/types.ts +4 -0
- package/src/app-shell/use-panel-exit-completion.ts +95 -0
- package/src/app-shell/use-panel-reorder.ts +2 -2
- package/src/app-shell/use-panel-resize.ts +37 -10
- package/src/app-shell/use-panel-reveal.ts +4 -9
- package/src/bottom-sheet/BottomSheetBase.tsx +6 -2
- package/src/bottom-sheet/types.ts +2 -0
- package/src/dialog/DialogBottomSheet.tsx +13 -2
- package/src/dialog/types.ts +2 -0
- package/src/engagement-bar/EngagementAction.tsx +5 -4
- package/src/engagement-bar/EngagementBar.tsx +30 -5
- package/src/engagement-bar/EngagementPop.tsx +11 -3
- package/src/engagement-bar/context.ts +1 -0
- package/src/engagement-bar/paint.ts +60 -13
- package/src/engagement-bar/types.ts +10 -1
- package/src/hooks/use-border-box-size.ts +38 -0
- package/src/layout/ScrollBar.web.tsx +74 -40
- package/src/layout/scroll-metrics.tsx +2 -0
- package/src/layout/types.ts +2 -2
- package/src/list/VirtualList.tsx +18 -0
- package/src/list/VirtualList.web.tsx +69 -22
- package/src/list/flash-list-module.ts +2 -0
- package/src/page-header/EdgeScrim.tsx +29 -9
- package/src/page-header/PageHeader.tsx +10 -6
- package/src/page-header/types.ts +2 -0
- package/src/screen/ScreenBase.tsx +13 -6
- package/src/screen/ScreenScrollViewBase.tsx +24 -2
- package/src/screen/context.ts +3 -0
- package/src/screen/use-intrinsic-content-height.ts +56 -0
- package/src/screen/use-screen-viewport.ts +60 -11
- package/src/scroll/constants.ts +3 -0
- package/src/scroll/owner-handoff.ts +45 -11
- package/src/scroll/use-scroll-restoration.web.ts +4 -10
- package/src/sidebar/Sidebar.tsx +146 -121
- package/src/sidebar/arrangement.ts +47 -0
- package/src/sidebar/index.ts +6 -0
- package/src/sidebar/types.ts +13 -1
|
@@ -88,6 +88,10 @@ export const SCRIM_STOPS = [
|
|
|
88
88
|
{ offset: 0.72, opacity: 0.38 },
|
|
89
89
|
{ offset: 1, opacity: 0 },
|
|
90
90
|
] as const;
|
|
91
|
+
const LINEAR_STOPS = [
|
|
92
|
+
{ offset: 0, opacity: 1 },
|
|
93
|
+
{ offset: 1, opacity: 0 },
|
|
94
|
+
] as const;
|
|
91
95
|
|
|
92
96
|
export interface EdgeScrimProps {
|
|
93
97
|
/** The page colour the ramp starts from — opaque, alpha travels separately. */
|
|
@@ -99,6 +103,8 @@ export interface EdgeScrimProps {
|
|
|
99
103
|
* put it on every platform.
|
|
100
104
|
*/
|
|
101
105
|
edge?: 'top' | 'bottom';
|
|
106
|
+
/** Smooth legibility curve by default; linear has only the opaque and transparent endpoints. */
|
|
107
|
+
falloff?: 'smooth' | 'linear';
|
|
102
108
|
testID?: string;
|
|
103
109
|
}
|
|
104
110
|
|
|
@@ -112,29 +118,43 @@ export interface EdgeScrimProps {
|
|
|
112
118
|
* spans exactly that view. Alpha travels in the colour here, which a CSS
|
|
113
119
|
* gradient honours (the `stopOpacity` reason above is react-native-svg's).
|
|
114
120
|
*/
|
|
115
|
-
export function edgeScrimGradient(
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
121
|
+
export function edgeScrimGradient(
|
|
122
|
+
color: string,
|
|
123
|
+
edge: 'top' | 'bottom',
|
|
124
|
+
falloff: 'smooth' | 'linear' = 'smooth',
|
|
125
|
+
): string {
|
|
126
|
+
const stops = (falloff === 'linear' ? LINEAR_STOPS : SCRIM_STOPS)
|
|
127
|
+
.map((stop) => `${withAlpha(color, stop.opacity)} ${Math.round(stop.offset * 100)}%`)
|
|
128
|
+
.join(', ');
|
|
119
129
|
return `linear-gradient(to ${edge === 'bottom' ? 'top' : 'bottom'}, ${stops})`;
|
|
120
130
|
}
|
|
121
131
|
|
|
122
|
-
const EdgeScrimComponent: React.FC<EdgeScrimProps> = ({
|
|
132
|
+
const EdgeScrimComponent: React.FC<EdgeScrimProps> = ({
|
|
133
|
+
color,
|
|
134
|
+
edge = 'top',
|
|
135
|
+
falloff = 'smooth',
|
|
136
|
+
testID,
|
|
137
|
+
}) => {
|
|
123
138
|
if (Platform.OS === 'android') {
|
|
124
139
|
return (
|
|
125
140
|
<View
|
|
126
141
|
testID={testID}
|
|
127
142
|
style={[
|
|
128
143
|
StyleSheet.absoluteFill,
|
|
129
|
-
{ experimental_backgroundImage: edgeScrimGradient(color, edge) },
|
|
144
|
+
{ experimental_backgroundImage: edgeScrimGradient(color, edge, falloff) },
|
|
130
145
|
]}
|
|
131
146
|
/>
|
|
132
147
|
);
|
|
133
148
|
}
|
|
134
|
-
return <SvgEdgeScrim color={color} edge={edge} testID={testID} />;
|
|
149
|
+
return <SvgEdgeScrim color={color} edge={edge} falloff={falloff} testID={testID} />;
|
|
135
150
|
};
|
|
136
151
|
|
|
137
|
-
const SvgEdgeScrim: React.FC<EdgeScrimProps> = ({
|
|
152
|
+
const SvgEdgeScrim: React.FC<EdgeScrimProps> = ({
|
|
153
|
+
color,
|
|
154
|
+
edge = 'top',
|
|
155
|
+
falloff = 'smooth',
|
|
156
|
+
testID,
|
|
157
|
+
}) => {
|
|
138
158
|
const id = `${useSvgIdPrefix('bloom-page-header-scrim')}gradient`;
|
|
139
159
|
const fromBottom = edge === 'bottom';
|
|
140
160
|
return (
|
|
@@ -147,7 +167,7 @@ const SvgEdgeScrim: React.FC<EdgeScrimProps> = ({ color, edge = 'top', testID })
|
|
|
147
167
|
x2="0"
|
|
148
168
|
y2={fromBottom ? '0' : '1'}
|
|
149
169
|
>
|
|
150
|
-
{SCRIM_STOPS.map((stop) => (
|
|
170
|
+
{(falloff === 'linear' ? LINEAR_STOPS : SCRIM_STOPS).map((stop) => (
|
|
151
171
|
<Stop
|
|
152
172
|
key={stop.offset}
|
|
153
173
|
offset={String(stop.offset)}
|
|
@@ -15,6 +15,7 @@ import { ServerStyleSheet } from '../styles/ServerStyleSheet';
|
|
|
15
15
|
import { dataHook, dataHooks } from '../styles/data-hook';
|
|
16
16
|
import { Platform, StyleSheet, View, type LayoutChangeEvent } from 'react-native';
|
|
17
17
|
import { useMeasuredSizeClass } from '../hooks/use-width-class';
|
|
18
|
+
import { useBorderBoxSize } from '../hooks/use-border-box-size';
|
|
18
19
|
import Animated, {
|
|
19
20
|
Extrapolation,
|
|
20
21
|
interpolate,
|
|
@@ -190,6 +191,7 @@ function PageHeaderComponent({
|
|
|
190
191
|
border = 'auto',
|
|
191
192
|
transparent = false,
|
|
192
193
|
scrim = 'auto',
|
|
194
|
+
scrimFalloff = 'smooth',
|
|
193
195
|
scrimColor,
|
|
194
196
|
scrollY: externalScrollY,
|
|
195
197
|
scrollThreshold = DEFAULT_THRESHOLD,
|
|
@@ -374,11 +376,13 @@ function PageHeaderComponent({
|
|
|
374
376
|
setNativeLeadingPresent(e.nativeEvent.layout.width > 0);
|
|
375
377
|
updateActionBudget();
|
|
376
378
|
};
|
|
377
|
-
const
|
|
378
|
-
const nextWidth = e.nativeEvent.layout.width;
|
|
379
|
+
const containerSize = useBorderBoxSize(({ width: nextWidth, height: nextHeight }) => {
|
|
379
380
|
actionGeometry.current.width = nextWidth;
|
|
380
381
|
updateActionBudget();
|
|
381
|
-
if (!isWeb)
|
|
382
|
+
if (!isWeb)
|
|
383
|
+
measured.onLayout({
|
|
384
|
+
nativeEvent: { layout: { width: nextWidth, height: nextHeight, x: 0, y: 0 } },
|
|
385
|
+
} as LayoutChangeEvent);
|
|
382
386
|
const nextCompact = nextWidth < BREAKPOINTS.sm;
|
|
383
387
|
if (lastActionsCompact.current !== nextCompact) {
|
|
384
388
|
lastActionsCompact.current = nextCompact;
|
|
@@ -389,12 +393,11 @@ function PageHeaderComponent({
|
|
|
389
393
|
lastActionsSpacious.current = nextSpacious;
|
|
390
394
|
setActionsSpacious(nextSpacious);
|
|
391
395
|
}
|
|
392
|
-
const nextHeight = e.nativeEvent.layout.height;
|
|
393
396
|
if (lastHeight.current !== nextHeight) {
|
|
394
397
|
lastHeight.current = nextHeight;
|
|
395
398
|
setMeasuredHeight(nextHeight);
|
|
396
399
|
}
|
|
397
|
-
};
|
|
400
|
+
});
|
|
398
401
|
|
|
399
402
|
// An overlaying header occupies no layout, so it declares what it covers and
|
|
400
403
|
// the content reads it back. Measured rather than computed: a second title
|
|
@@ -782,6 +785,7 @@ function PageHeaderComponent({
|
|
|
782
785
|
// Fade into the containing surface (ContentPanel publishes its fill),
|
|
783
786
|
// falling back to the page. Explicit scrimColor remains an override.
|
|
784
787
|
color={scrimColor ?? surfaceFill}
|
|
788
|
+
falloff={scrimFalloff}
|
|
785
789
|
testID={testID ? `${testID}-scrim-gradient` : undefined}
|
|
786
790
|
/>
|
|
787
791
|
</Animated.View>
|
|
@@ -841,7 +845,7 @@ function PageHeaderComponent({
|
|
|
841
845
|
bloomPageHeaderPresentation: presentation,
|
|
842
846
|
})}
|
|
843
847
|
testID={testID}
|
|
844
|
-
|
|
848
|
+
{...containerSize}
|
|
845
849
|
style={[
|
|
846
850
|
[
|
|
847
851
|
styles.container,
|
package/src/page-header/types.ts
CHANGED
|
@@ -149,6 +149,8 @@ export interface PageHeaderProps {
|
|
|
149
149
|
transparent?: boolean;
|
|
150
150
|
/** `presentation="floating"` only. Default `auto`. */
|
|
151
151
|
scrim?: PageHeaderScrim;
|
|
152
|
+
/** Floating gradient curve. Default smooth; linear fades uniformly from opaque to transparent. */
|
|
153
|
+
scrimFalloff?: 'smooth' | 'linear';
|
|
152
154
|
/**
|
|
153
155
|
* The colour the edge effect fades FROM. Defaults to `theme.colors.background`
|
|
154
156
|
* — the page colour, which is what the content scrolling under the header is
|
|
@@ -10,6 +10,7 @@ import type React from 'react';
|
|
|
10
10
|
import { useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
11
11
|
import { Platform, View, StyleSheet } from 'react-native';
|
|
12
12
|
import { useKeyboardVisible } from '../hooks/use-keyboard-visible';
|
|
13
|
+
import { useBorderBoxSize } from '../hooks/use-border-box-size';
|
|
13
14
|
import { SafeAreaInsetsContext } from 'react-native-safe-area-context';
|
|
14
15
|
import { useBottomEdgeInset } from '../layout/bottom-edge';
|
|
15
16
|
import { windowEdgeGap } from '../layout/edge';
|
|
@@ -226,6 +227,8 @@ export function createScreen(
|
|
|
226
227
|
lastBottom.current = height;
|
|
227
228
|
setMeasuredBottom(height);
|
|
228
229
|
};
|
|
230
|
+
const headerSize = useBorderBoxSize(({ height }) => setTop(height));
|
|
231
|
+
const footerSize = useBorderBoxSize(({ height }) => setBottom(height));
|
|
229
232
|
const top =
|
|
230
233
|
measuredTop ?? headerHeight ?? 56 + (Platform.OS === 'web' ? 0 : (insets?.top ?? 0));
|
|
231
234
|
const bottom = measuredBottom ?? bottomBarHeight ?? 58 + windowEdgeGap(insets?.bottom ?? 0);
|
|
@@ -376,7 +379,7 @@ export function createScreen(
|
|
|
376
379
|
disabled={windowChrome == null}
|
|
377
380
|
testID={testID ? `${testID}-header` : undefined}
|
|
378
381
|
pointerEvents={windowChrome == null ? 'box-none' : undefined}
|
|
379
|
-
|
|
382
|
+
{...headerSize}
|
|
380
383
|
style={headerSlotStyle}
|
|
381
384
|
>
|
|
382
385
|
<WindowChromeProvider value={windowChrome}>
|
|
@@ -387,7 +390,7 @@ export function createScreen(
|
|
|
387
390
|
<View
|
|
388
391
|
testID={testID ? `${testID}-header` : undefined}
|
|
389
392
|
pointerEvents="box-none"
|
|
390
|
-
|
|
393
|
+
{...headerSize}
|
|
391
394
|
style={headerSlotStyle}
|
|
392
395
|
>
|
|
393
396
|
<ScreenHeaderContext.Provider value={value}>{header}</ScreenHeaderContext.Provider>
|
|
@@ -436,7 +439,7 @@ export function createScreen(
|
|
|
436
439
|
{...(keyboardFollow ? { enabled: active } : {})}
|
|
437
440
|
testID={testID ? `${testID}-bottom` : undefined}
|
|
438
441
|
pointerEvents="box-none"
|
|
439
|
-
|
|
442
|
+
{...footerSize}
|
|
440
443
|
style={
|
|
441
444
|
document
|
|
442
445
|
? {
|
|
@@ -644,12 +647,16 @@ export function createScreen(
|
|
|
644
647
|
) : (
|
|
645
648
|
children
|
|
646
649
|
)}
|
|
647
|
-
{ownWebViewport &&
|
|
648
|
-
<ScrollBar
|
|
650
|
+
{ownWebViewport && !document ? (
|
|
651
|
+
<ScrollBar
|
|
652
|
+
target={scrollbarTarget}
|
|
653
|
+
scrollbar={active ? 'scroll' : 'never'}
|
|
654
|
+
/>
|
|
649
655
|
) : null}
|
|
650
|
-
{ownWebViewport &&
|
|
656
|
+
{ownWebViewport && document && region?.flow !== 'document' ? (
|
|
651
657
|
<ScrollBar
|
|
652
658
|
target="document"
|
|
659
|
+
scrollbar={active ? 'scroll' : 'never'}
|
|
653
660
|
insets={{ start: reservedTop, end: reservedBottom }}
|
|
654
661
|
/>
|
|
655
662
|
) : null}
|
|
@@ -29,6 +29,7 @@ import type { ScrollBarProps } from '../layout/types';
|
|
|
29
29
|
import { StyledView } from '../styles/styled-primitives';
|
|
30
30
|
import { useScreen } from './context';
|
|
31
31
|
import { useScreenViewport } from './context';
|
|
32
|
+
import { useIntrinsicContentHeight } from './use-intrinsic-content-height';
|
|
32
33
|
import { END_SENTINEL_STYLE, useDocumentEndReached } from './use-document-end-reached';
|
|
33
34
|
import { DEFAULT_END_REACHED_THRESHOLD, useEndReached } from './use-end-reached';
|
|
34
35
|
import { useScreenScroll } from './use-screen-scroll';
|
|
@@ -95,6 +96,7 @@ export function createScreenScrollView(
|
|
|
95
96
|
...props
|
|
96
97
|
}: InnerProps) {
|
|
97
98
|
const viewport = useScreenViewport();
|
|
99
|
+
const publishIntrinsic = useIntrinsicContentHeight();
|
|
98
100
|
const screen = useScreen();
|
|
99
101
|
const activeRef = useRef(active !== false);
|
|
100
102
|
activeRef.current = active !== false;
|
|
@@ -137,9 +139,27 @@ export function createScreenScrollView(
|
|
|
137
139
|
if (!active) return;
|
|
138
140
|
end.onContentSizeChange(width, height);
|
|
139
141
|
if (viewport) viewport.metrics.contentHeight.value = height;
|
|
142
|
+
// A growing ScrollView content container reports at least its viewport,
|
|
143
|
+
// not its natural content extent. Keep that case explicitly unknown.
|
|
144
|
+
if (publishIntrinsic) {
|
|
145
|
+
const flat = StyleSheet.flatten(contentContainerStyle);
|
|
146
|
+
publishIntrinsic(
|
|
147
|
+
contentContainerClassName != null || flat?.flexGrow || flat?.flex || flat?.minHeight
|
|
148
|
+
? -1
|
|
149
|
+
: height,
|
|
150
|
+
);
|
|
151
|
+
}
|
|
140
152
|
onContentSizeChange?.(width, height);
|
|
141
153
|
},
|
|
142
|
-
[
|
|
154
|
+
[
|
|
155
|
+
active,
|
|
156
|
+
end.onContentSizeChange,
|
|
157
|
+
onContentSizeChange,
|
|
158
|
+
viewport,
|
|
159
|
+
publishIntrinsic,
|
|
160
|
+
contentContainerStyle,
|
|
161
|
+
contentContainerClassName,
|
|
162
|
+
],
|
|
143
163
|
);
|
|
144
164
|
// A class's padding cannot be read back to add the chrome footprint to it, and
|
|
145
165
|
// an inline padding would override it — so with a class the footprint pads
|
|
@@ -260,6 +280,7 @@ export function createScreenScrollView(
|
|
|
260
280
|
}: InnerProps) {
|
|
261
281
|
const screen = useScreen();
|
|
262
282
|
const viewport = useScreenViewport();
|
|
283
|
+
const publishIntrinsic = useIntrinsicContentHeight();
|
|
263
284
|
const activeRef = useRef(active !== false);
|
|
264
285
|
activeRef.current = active !== false;
|
|
265
286
|
useEffect(() => {
|
|
@@ -374,10 +395,11 @@ export function createScreenScrollView(
|
|
|
374
395
|
(event: LayoutChangeEvent) => {
|
|
375
396
|
if (!active) return;
|
|
376
397
|
const { width, height } = event.nativeEvent.layout;
|
|
398
|
+
publishIntrinsic?.(height, contentRef.current as unknown as HTMLElement | null);
|
|
377
399
|
if (tracksEnd) setContentHeight(height);
|
|
378
400
|
onContentSizeChange?.(width, height);
|
|
379
401
|
},
|
|
380
|
-
[active, tracksEnd, onContentSizeChange],
|
|
402
|
+
[active, tracksEnd, onContentSizeChange, publishIntrinsic],
|
|
381
403
|
);
|
|
382
404
|
return (
|
|
383
405
|
<View
|
package/src/screen/context.ts
CHANGED
|
@@ -53,6 +53,9 @@ export interface ScreenViewportValue {
|
|
|
53
53
|
metrics: ScrollMetrics;
|
|
54
54
|
active: boolean;
|
|
55
55
|
scrollTo(options: { x?: number; y?: number; animated?: boolean }): void;
|
|
56
|
+
/** Internal natural-content measurement, independent of the viewport's flex fill. */
|
|
57
|
+
contentRef?: RefObject<unknown>;
|
|
58
|
+
setIntrinsicContentHeight?: (source: object, height: number | null) => void;
|
|
56
59
|
}
|
|
57
60
|
export const ScreenViewportContext = createContext<ScreenViewportValue | null>(null);
|
|
58
61
|
/** The screen's existing scroll owner; never creates another scroll container. */
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { useCallback, useLayoutEffect, useRef } from 'react';
|
|
2
|
+
import { useScreenContext, useScreenViewport } from './context';
|
|
3
|
+
|
|
4
|
+
/** Existing content-layout callbacks publish a metric; this hook never observes or sizes layout. */
|
|
5
|
+
export function useIntrinsicContentHeight() {
|
|
6
|
+
const viewport = useScreenViewport();
|
|
7
|
+
const screen = useScreenContext();
|
|
8
|
+
const source = useRef({});
|
|
9
|
+
const active = viewport?.active !== false;
|
|
10
|
+
const publish = viewport?.metrics.intrinsicContentHeight
|
|
11
|
+
? viewport.setIntrinsicContentHeight
|
|
12
|
+
: undefined;
|
|
13
|
+
const contentNode = useRef<HTMLElement | null>(null);
|
|
14
|
+
const measure = useCallback(
|
|
15
|
+
(height: number, node?: HTMLElement | null) => {
|
|
16
|
+
if (!active || !publish) return;
|
|
17
|
+
if (node) contentNode.current = node;
|
|
18
|
+
const root = viewport?.contentRef?.current;
|
|
19
|
+
if (node) {
|
|
20
|
+
// The content's own box includes list headers, footers and padding.
|
|
21
|
+
// Its offset includes preceding content; only ancestor bottom padding
|
|
22
|
+
// remains. Never substitute scrollHeight, whose minimum is the viewport.
|
|
23
|
+
if (
|
|
24
|
+
!(root instanceof HTMLElement) ||
|
|
25
|
+
!root.contains(node) ||
|
|
26
|
+
!node.getClientRects().length
|
|
27
|
+
) {
|
|
28
|
+
publish(source.current, -1);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const style = getComputedStyle(node);
|
|
32
|
+
if (Number.parseFloat(style.flexGrow) > 0 || Number.parseFloat(style.minHeight) > 0) {
|
|
33
|
+
publish(source.current, -1);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
height += node.getBoundingClientRect().top - root.getBoundingClientRect().top;
|
|
37
|
+
let parent = node.parentElement;
|
|
38
|
+
while (parent) {
|
|
39
|
+
height += Number.parseFloat(getComputedStyle(parent).paddingBottom) || 0;
|
|
40
|
+
if (parent === root) break;
|
|
41
|
+
parent = parent.parentElement;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
publish(source.current, Number.isFinite(height) && height >= 0 ? height : -1);
|
|
45
|
+
},
|
|
46
|
+
[active, publish, viewport?.contentRef, screen?.topInset, screen?.bottomInset],
|
|
47
|
+
);
|
|
48
|
+
useLayoutEffect(() => {
|
|
49
|
+
if (!active || !publish) return;
|
|
50
|
+
publish(source.current, -1);
|
|
51
|
+
const node = contentNode.current;
|
|
52
|
+
if (node) measure(node.offsetHeight, node);
|
|
53
|
+
return () => publish(source.current, null);
|
|
54
|
+
}, [active, publish, measure]);
|
|
55
|
+
return publish ? measure : undefined;
|
|
56
|
+
}
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
useCallback,
|
|
3
|
+
useEffect,
|
|
4
|
+
useLayoutEffect,
|
|
5
|
+
useMemo,
|
|
6
|
+
useRef,
|
|
7
|
+
type MutableRefObject,
|
|
8
|
+
} from 'react';
|
|
2
9
|
import { Platform } from 'react-native';
|
|
3
10
|
import { useSharedValue } from 'react-native-reanimated';
|
|
4
11
|
import { animateMotion } from '../motion/recipes';
|
|
@@ -6,10 +13,15 @@ import type { useScrollRestoration as UseScrollRestoration } from '../scroll/use
|
|
|
6
13
|
import type { ScrollRestorationTarget } from '../scroll/types';
|
|
7
14
|
import type { ScreenContextValue } from './context';
|
|
8
15
|
import { useOptionalScrollRestorationContext } from '../scroll/context';
|
|
9
|
-
import { recordScrollOwnerHandoff } from '../scroll/owner-handoff';
|
|
16
|
+
import { readScrollOwnerHandoff, recordScrollOwnerHandoff } from '../scroll/owner-handoff';
|
|
10
17
|
import type { ScreenViewportValue, ScreenHostValue } from './context';
|
|
11
18
|
import { useRegisterScreenScroller } from './reselect';
|
|
12
19
|
import { usePrefersReducedMotion } from '../hooks/use-prefers-reduced-motion';
|
|
20
|
+
import type { ScrollMetrics } from '../layout/scroll-metrics';
|
|
21
|
+
|
|
22
|
+
// Retained route Screens can share one panel metric. An outgoing cleanup must
|
|
23
|
+
// not clear the next Screen's measurement.
|
|
24
|
+
const intrinsicOwners = new WeakMap<ScrollMetrics, object>();
|
|
13
25
|
|
|
14
26
|
const useNoContentId = () => null;
|
|
15
27
|
|
|
@@ -32,7 +44,7 @@ export function useScreenViewportBinding(
|
|
|
32
44
|
const contentRef = useRef<unknown>(null);
|
|
33
45
|
const contentHeight = useSharedValue(-1);
|
|
34
46
|
const viewportHeight = useSharedValue(0);
|
|
35
|
-
const metrics = useMemo(
|
|
47
|
+
const metrics = useMemo<ScrollMetrics>(
|
|
36
48
|
() =>
|
|
37
49
|
enabled && host?.metrics
|
|
38
50
|
? host.metrics
|
|
@@ -43,6 +55,37 @@ export function useScreenViewportBinding(
|
|
|
43
55
|
const restoring = useRef(false);
|
|
44
56
|
const active = useRef(screen.active);
|
|
45
57
|
active.current = screen.active;
|
|
58
|
+
const intrinsicScope = useMemo(
|
|
59
|
+
() => ({ sources: new Map<object, number>() }),
|
|
60
|
+
[contentId, metrics],
|
|
61
|
+
);
|
|
62
|
+
const currentIntrinsicScope = useRef(intrinsicScope);
|
|
63
|
+
currentIntrinsicScope.current = intrinsicScope;
|
|
64
|
+
const setIntrinsicContentHeight = useCallback(
|
|
65
|
+
(source: object, height: number | null) => {
|
|
66
|
+
const metric = metrics.intrinsicContentHeight;
|
|
67
|
+
if (!metric || currentIntrinsicScope.current !== intrinsicScope) return;
|
|
68
|
+
if (height === null) intrinsicScope.sources.delete(source);
|
|
69
|
+
else if (enabled && active.current) intrinsicScope.sources.set(source, height);
|
|
70
|
+
else return;
|
|
71
|
+
if (height !== null) intrinsicOwners.set(metrics, intrinsicScope);
|
|
72
|
+
if (intrinsicOwners.get(metrics) !== intrinsicScope) return;
|
|
73
|
+
const values = [...intrinsicScope.sources.values()];
|
|
74
|
+
metric.value =
|
|
75
|
+
values.length && values.every((value) => value >= 0) ? Math.max(...values) : -1;
|
|
76
|
+
},
|
|
77
|
+
[enabled, intrinsicScope, metrics],
|
|
78
|
+
);
|
|
79
|
+
useLayoutEffect(() => {
|
|
80
|
+
if (!enabled || !screen.active) return;
|
|
81
|
+
return () => {
|
|
82
|
+
intrinsicScope.sources.clear();
|
|
83
|
+
if (intrinsicOwners.get(metrics) === intrinsicScope) {
|
|
84
|
+
intrinsicOwners.delete(metrics);
|
|
85
|
+
if (metrics.intrinsicContentHeight) metrics.intrinsicContentHeight.value = -1;
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
}, [enabled, screen.active, intrinsicScope, metrics]);
|
|
46
89
|
const reducedMotion = usePrefersReducedMotion();
|
|
47
90
|
const owner = useRef<{
|
|
48
91
|
documentFlow: boolean;
|
|
@@ -56,6 +99,8 @@ export function useScreenViewportBinding(
|
|
|
56
99
|
useLayoutEffect(() => {
|
|
57
100
|
if (!enabled || !web || typeof window === 'undefined') return;
|
|
58
101
|
const previous = owner.current;
|
|
102
|
+
const element = scrollRef.current as HTMLElement | null;
|
|
103
|
+
const target = documentFlow ? window : element;
|
|
59
104
|
let releaseHandoff: (() => void) | undefined;
|
|
60
105
|
if (
|
|
61
106
|
previous &&
|
|
@@ -64,9 +109,10 @@ export function useScreenViewportBinding(
|
|
|
64
109
|
previous.active &&
|
|
65
110
|
screen.active
|
|
66
111
|
) {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
112
|
+
if (target)
|
|
113
|
+
releaseHandoff = recordScrollOwnerHandoff(target, previous.offset, (offset) => {
|
|
114
|
+
if (owner.current?.documentFlow === documentFlow) owner.current.offset = offset;
|
|
115
|
+
});
|
|
70
116
|
if (documentFlow) window.scrollTo({ top: previous.offset, behavior: 'instant' });
|
|
71
117
|
else if (element) element.scrollTop = previous.offset;
|
|
72
118
|
}
|
|
@@ -74,9 +120,9 @@ export function useScreenViewportBinding(
|
|
|
74
120
|
contentId,
|
|
75
121
|
documentFlow,
|
|
76
122
|
active: screen.active,
|
|
77
|
-
offset:
|
|
78
|
-
?
|
|
79
|
-
|
|
123
|
+
offset:
|
|
124
|
+
(target ? readScrollOwnerHandoff(target) : undefined) ??
|
|
125
|
+
(documentFlow ? window.scrollY : (element?.scrollTop ?? 0)),
|
|
80
126
|
};
|
|
81
127
|
// A newly mounted router sidecar can focus on a later commit. Retain the
|
|
82
128
|
// transfer for this active owner lifetime instead of expiring it during
|
|
@@ -95,7 +141,8 @@ export function useScreenViewportBinding(
|
|
|
95
141
|
? (document.scrollingElement ?? document.documentElement)
|
|
96
142
|
: element!;
|
|
97
143
|
const y = documentFlow ? window.scrollY : node.scrollTop;
|
|
98
|
-
if (owner.current?.documentFlow === documentFlow)
|
|
144
|
+
if (owner.current?.documentFlow === documentFlow)
|
|
145
|
+
owner.current.offset = readScrollOwnerHandoff(target) ?? Math.max(0, y);
|
|
99
146
|
metrics.scrollY.value = Math.max(0, y);
|
|
100
147
|
metrics.contentHeight.value = node.scrollHeight;
|
|
101
148
|
metrics.viewportHeight.value = Math.max(0, node.clientHeight - (documentFlow ? reserved : 0));
|
|
@@ -127,6 +174,8 @@ export function useScreenViewportBinding(
|
|
|
127
174
|
scrollRef: documentFlow ? null : scrollRef,
|
|
128
175
|
metrics,
|
|
129
176
|
active: screen.active,
|
|
177
|
+
contentRef,
|
|
178
|
+
setIntrinsicContentHeight,
|
|
130
179
|
scrollTo(options) {
|
|
131
180
|
if (!active.current) return;
|
|
132
181
|
if (web) {
|
|
@@ -146,7 +195,7 @@ export function useScreenViewportBinding(
|
|
|
146
195
|
}
|
|
147
196
|
},
|
|
148
197
|
}),
|
|
149
|
-
[web, documentFlow, metrics, screen.active, scrollRef],
|
|
198
|
+
[web, documentFlow, metrics, screen.active, scrollRef, setIntrinsicContentHeight],
|
|
150
199
|
);
|
|
151
200
|
// The screen's own viewport answers a reselect, as the page: a list scrolling
|
|
152
201
|
// inside it wins.
|
package/src/scroll/constants.ts
CHANGED
|
@@ -1,25 +1,46 @@
|
|
|
1
|
-
import { SCROLL_USER_TAKEOVER_EVENTS } from './constants';
|
|
1
|
+
import { SCROLL_RESTORE_TOLERANCE_PX, SCROLL_USER_TAKEOVER_EVENTS } from './constants';
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
const offsets = new WeakMap<
|
|
3
|
+
/** One restoration claim; keep its intent until the owner accepts it or the user takes over. */
|
|
4
|
+
const offsets = new WeakMap<
|
|
5
|
+
object,
|
|
6
|
+
{
|
|
7
|
+
offset: number;
|
|
8
|
+
consumed: boolean;
|
|
9
|
+
pending: boolean;
|
|
10
|
+
current(): number | undefined;
|
|
11
|
+
release(): void;
|
|
12
|
+
}
|
|
13
|
+
>();
|
|
5
14
|
|
|
6
|
-
export function recordScrollOwnerHandoff(
|
|
15
|
+
export function recordScrollOwnerHandoff(
|
|
16
|
+
owner: object,
|
|
17
|
+
offset: number,
|
|
18
|
+
onTakeOver?: (offset: number) => void,
|
|
19
|
+
) {
|
|
7
20
|
offsets.get(owner)?.release();
|
|
8
21
|
const target = owner as Partial<EventTarget> & { scrollTop?: number };
|
|
9
22
|
let userTookOver = false;
|
|
23
|
+
const current = () =>
|
|
24
|
+
typeof window !== 'undefined' && owner === window ? window.scrollY : target.scrollTop;
|
|
10
25
|
const observe = () => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
if (typeof
|
|
15
|
-
transfer.offset = Math.max(0,
|
|
26
|
+
const value = current();
|
|
27
|
+
if (value !== undefined && Math.abs(value - transfer.offset) <= SCROLL_RESTORE_TOLERANCE_PX)
|
|
28
|
+
transfer.pending = false;
|
|
29
|
+
if (userTookOver && typeof value === 'number' && Number.isFinite(value))
|
|
30
|
+
transfer.offset = Math.max(0, value);
|
|
31
|
+
if (transfer.consumed && !transfer.pending) transfer.release();
|
|
16
32
|
};
|
|
17
33
|
const takeOver = () => {
|
|
18
34
|
userTookOver = true;
|
|
35
|
+
transfer.pending = false;
|
|
19
36
|
observe();
|
|
37
|
+
onTakeOver?.(transfer.offset);
|
|
20
38
|
};
|
|
21
39
|
const transfer = {
|
|
22
40
|
offset,
|
|
41
|
+
consumed: false,
|
|
42
|
+
pending: true,
|
|
43
|
+
current,
|
|
23
44
|
release() {
|
|
24
45
|
// A departed Screen must not delete a newer Screen's transfer on the
|
|
25
46
|
// shared window owner. Release belongs to this transfer, not its node.
|
|
@@ -41,6 +62,19 @@ export function recordScrollOwnerHandoff(owner: object, offset: number) {
|
|
|
41
62
|
|
|
42
63
|
export function takeScrollOwnerHandoff(owner: object): number | undefined {
|
|
43
64
|
const transfer = offsets.get(owner);
|
|
44
|
-
transfer
|
|
45
|
-
|
|
65
|
+
if (!transfer || transfer.consumed) return undefined;
|
|
66
|
+
transfer.consumed = true;
|
|
67
|
+
readScrollOwnerHandoff(owner);
|
|
68
|
+
return transfer.offset;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** Geometry can clamp a receiving owner before its virtual content is ready. */
|
|
72
|
+
export function readScrollOwnerHandoff(owner: object): number | undefined {
|
|
73
|
+
const transfer = offsets.get(owner);
|
|
74
|
+
if (!transfer) return undefined;
|
|
75
|
+
const current = transfer.current();
|
|
76
|
+
if (current !== undefined && Math.abs(current - transfer.offset) <= SCROLL_RESTORE_TOLERANCE_PX)
|
|
77
|
+
transfer.pending = false;
|
|
78
|
+
if (transfer.consumed && !transfer.pending) transfer.release();
|
|
79
|
+
return transfer.pending ? transfer.offset : undefined;
|
|
46
80
|
}
|
|
@@ -41,7 +41,10 @@
|
|
|
41
41
|
import { useCallback, useMemo, useRef, useState } from 'react';
|
|
42
42
|
|
|
43
43
|
import { useScrollRestorationContext } from './context';
|
|
44
|
-
import {
|
|
44
|
+
import {
|
|
45
|
+
SCROLL_RESTORE_TOLERANCE_PX as RESTORE_STICK_TOLERANCE_PX,
|
|
46
|
+
SCROLL_USER_TAKEOVER_EVENTS,
|
|
47
|
+
} from './constants';
|
|
45
48
|
import { createScroller, resolveScrollTarget } from './scrollable.web';
|
|
46
49
|
import { deriveScrollKey } from './store';
|
|
47
50
|
import { takeScrollOwnerHandoff } from './owner-handoff';
|
|
@@ -61,15 +64,6 @@ import type {
|
|
|
61
64
|
*/
|
|
62
65
|
const RESTORE_FRAME_CAP = 30;
|
|
63
66
|
|
|
64
|
-
/**
|
|
65
|
-
* Tolerance (in CSS pixels) for considering a restore "stuck". After writing
|
|
66
|
-
* `element.scrollTop = target`, the browser may clamp it to the current
|
|
67
|
-
* `scrollHeight - clientHeight`; if the resulting offset is within this many
|
|
68
|
-
* pixels of the target we treat the restore as complete. Sub-pixel rounding and
|
|
69
|
-
* fractional device-pixel ratios make an exact equality check unreliable.
|
|
70
|
-
*/
|
|
71
|
-
const RESTORE_STICK_TOLERANCE_PX = 2;
|
|
72
|
-
|
|
73
67
|
/**
|
|
74
68
|
* This platform observes offsets by subscribing to the resolved DOM node's own
|
|
75
69
|
* `scroll` event, so it needs nothing from the caller. The handler is still
|