@oxy.so/bloom 2.5.0 → 2.7.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.
Files changed (93) hide show
  1. package/docs/app-shell.mdx +55 -1
  2. package/docs/sidebar.mdx +17 -0
  3. package/lib/commonjs/app-shell/AppShell.js +294 -135
  4. package/lib/commonjs/app-shell/AppShell.js.map +1 -1
  5. package/lib/commonjs/app-shell/AppShellHeader.js +2 -2
  6. package/lib/commonjs/app-shell/AppShellHeader.js.map +1 -1
  7. package/lib/commonjs/app-shell/AppShellMenuButton.js +40 -0
  8. package/lib/commonjs/app-shell/AppShellMenuButton.js.map +1 -0
  9. package/lib/commonjs/app-shell/context.js +30 -0
  10. package/lib/commonjs/app-shell/context.js.map +1 -0
  11. package/lib/commonjs/app-shell/index.js +14 -0
  12. package/lib/commonjs/app-shell/index.js.map +1 -1
  13. package/lib/commonjs/sidebar/Sidebar.js +51 -17
  14. package/lib/commonjs/sidebar/Sidebar.js.map +1 -1
  15. package/lib/commonjs/sidebar/SidebarLogoView.js +124 -0
  16. package/lib/commonjs/sidebar/SidebarLogoView.js.map +1 -0
  17. package/lib/commonjs/sidebar/SidebarRail.js +16 -2
  18. package/lib/commonjs/sidebar/SidebarRail.js.map +1 -1
  19. package/lib/commonjs/styles/web-view-style.js +25 -1
  20. package/lib/commonjs/styles/web-view-style.js.map +1 -1
  21. package/lib/module/app-shell/AppShell.js +296 -137
  22. package/lib/module/app-shell/AppShell.js.map +1 -1
  23. package/lib/module/app-shell/AppShellHeader.js +2 -2
  24. package/lib/module/app-shell/AppShellHeader.js.map +1 -1
  25. package/lib/module/app-shell/AppShellMenuButton.js +35 -0
  26. package/lib/module/app-shell/AppShellMenuButton.js.map +1 -0
  27. package/lib/module/app-shell/context.js +23 -0
  28. package/lib/module/app-shell/context.js.map +1 -0
  29. package/lib/module/app-shell/index.js +2 -0
  30. package/lib/module/app-shell/index.js.map +1 -1
  31. package/lib/module/sidebar/Sidebar.js +51 -17
  32. package/lib/module/sidebar/Sidebar.js.map +1 -1
  33. package/lib/module/sidebar/SidebarLogoView.js +119 -0
  34. package/lib/module/sidebar/SidebarLogoView.js.map +1 -0
  35. package/lib/module/sidebar/SidebarRail.js +16 -2
  36. package/lib/module/sidebar/SidebarRail.js.map +1 -1
  37. package/lib/module/styles/web-view-style.js +23 -0
  38. package/lib/module/styles/web-view-style.js.map +1 -1
  39. package/lib/typescript/commonjs/app-shell/AppShell.d.ts.map +1 -1
  40. package/lib/typescript/commonjs/app-shell/AppShellHeader.d.ts.map +1 -1
  41. package/lib/typescript/commonjs/app-shell/AppShellMenuButton.d.ts +4 -0
  42. package/lib/typescript/commonjs/app-shell/AppShellMenuButton.d.ts.map +1 -0
  43. package/lib/typescript/commonjs/app-shell/context.d.ts +18 -0
  44. package/lib/typescript/commonjs/app-shell/context.d.ts.map +1 -0
  45. package/lib/typescript/commonjs/app-shell/index.d.ts +4 -1
  46. package/lib/typescript/commonjs/app-shell/index.d.ts.map +1 -1
  47. package/lib/typescript/commonjs/app-shell/types.d.ts +47 -3
  48. package/lib/typescript/commonjs/app-shell/types.d.ts.map +1 -1
  49. package/lib/typescript/commonjs/sidebar/Sidebar.d.ts.map +1 -1
  50. package/lib/typescript/commonjs/sidebar/SidebarLogoView.d.ts +6 -0
  51. package/lib/typescript/commonjs/sidebar/SidebarLogoView.d.ts.map +1 -0
  52. package/lib/typescript/commonjs/sidebar/SidebarRail.d.ts +3 -2
  53. package/lib/typescript/commonjs/sidebar/SidebarRail.d.ts.map +1 -1
  54. package/lib/typescript/commonjs/sidebar/index.d.ts +1 -1
  55. package/lib/typescript/commonjs/sidebar/index.d.ts.map +1 -1
  56. package/lib/typescript/commonjs/sidebar/types.d.ts +36 -0
  57. package/lib/typescript/commonjs/sidebar/types.d.ts.map +1 -1
  58. package/lib/typescript/commonjs/styles/web-view-style.d.ts +19 -0
  59. package/lib/typescript/commonjs/styles/web-view-style.d.ts.map +1 -1
  60. package/lib/typescript/module/app-shell/AppShell.d.ts.map +1 -1
  61. package/lib/typescript/module/app-shell/AppShellHeader.d.ts.map +1 -1
  62. package/lib/typescript/module/app-shell/AppShellMenuButton.d.ts +4 -0
  63. package/lib/typescript/module/app-shell/AppShellMenuButton.d.ts.map +1 -0
  64. package/lib/typescript/module/app-shell/context.d.ts +18 -0
  65. package/lib/typescript/module/app-shell/context.d.ts.map +1 -0
  66. package/lib/typescript/module/app-shell/index.d.ts +4 -1
  67. package/lib/typescript/module/app-shell/index.d.ts.map +1 -1
  68. package/lib/typescript/module/app-shell/types.d.ts +47 -3
  69. package/lib/typescript/module/app-shell/types.d.ts.map +1 -1
  70. package/lib/typescript/module/sidebar/Sidebar.d.ts.map +1 -1
  71. package/lib/typescript/module/sidebar/SidebarLogoView.d.ts +6 -0
  72. package/lib/typescript/module/sidebar/SidebarLogoView.d.ts.map +1 -0
  73. package/lib/typescript/module/sidebar/SidebarRail.d.ts +3 -2
  74. package/lib/typescript/module/sidebar/SidebarRail.d.ts.map +1 -1
  75. package/lib/typescript/module/sidebar/index.d.ts +1 -1
  76. package/lib/typescript/module/sidebar/index.d.ts.map +1 -1
  77. package/lib/typescript/module/sidebar/types.d.ts +36 -0
  78. package/lib/typescript/module/sidebar/types.d.ts.map +1 -1
  79. package/lib/typescript/module/styles/web-view-style.d.ts +19 -0
  80. package/lib/typescript/module/styles/web-view-style.d.ts.map +1 -1
  81. package/package.json +1 -1
  82. package/src/app-shell/AppShell.tsx +231 -90
  83. package/src/app-shell/AppShellHeader.tsx +11 -9
  84. package/src/app-shell/AppShellMenuButton.tsx +37 -0
  85. package/src/app-shell/context.ts +35 -0
  86. package/src/app-shell/index.ts +4 -0
  87. package/src/app-shell/types.ts +48 -3
  88. package/src/sidebar/Sidebar.tsx +42 -22
  89. package/src/sidebar/SidebarLogoView.tsx +92 -0
  90. package/src/sidebar/SidebarRail.tsx +9 -1
  91. package/src/sidebar/index.ts +1 -0
  92. package/src/sidebar/types.ts +38 -0
  93. package/src/styles/web-view-style.ts +23 -0
@@ -6,7 +6,7 @@ order: 83
6
6
 
7
7
  # AppShell
8
8
 
9
- `AppShell`, with `AppShellHeader`, `NotificationBell` and `ProOfferCard`.
9
+ `AppShell`, with `AppShellHeader`, `AppShellMenuButton`, `useAppShell`, `NotificationBell` and `ProOfferCard`.
10
10
 
11
11
  ```tsx
12
12
  import { AppShell, NotificationBell, ProOfferCard } from '@oxy.so/bloom/app-shell';
@@ -34,6 +34,60 @@ import { AppShell, NotificationBell, ProOfferCard } from '@oxy.so/bloom/app-shel
34
34
  - `drawerOpen` / `onDrawerOpenChange` control it.
35
35
  - `sidebar={{ variant: 'rail', … }}` keeps the 80px navigation rail in flow from `sm` instead of `lg`; below `sm` the menu button opens the drawer, which always shows the full panel.
36
36
 
37
+ ## Aside
38
+
39
+ ```tsx
40
+ <AppShell sidebar={sidebar} title="Tickets" aside={<ActivityPanel />} asideWidth={320} asideFrom="xl">
41
+ {page}
42
+ </AppShell>
43
+ ```
44
+
45
+ A second column on the right of the page. From `asideFrom` (`xl`, 1280; or `md` / `lg`) it sits beside the content at `asideWidth` (320), pinned like the sidebar — with document scroll it is sticky and scrolls its own overflow, so give it `flex: 1` content if it should fill the height. Below the breakpoint it is stacked after the content (`asideCollapse="stack"`, the default) or dropped (`"hidden"`). Under `drawer="reveal"` it slides with the page.
46
+
47
+ ## Opening the drawer without a title
48
+
49
+ The default header renders whenever it has something to show, and below `lg` the menu button counts — so `<AppShell sidebar={…}>` with no `title` still gets a hamburger, and nothing at all while the sidebar sits in flow.
50
+
51
+ A page that draws its own `header` keeps the drawer reachable with either:
52
+
53
+ ```tsx
54
+ import { AppShellMenuButton, useAppShell } from '@oxy.so/bloom/app-shell';
55
+
56
+ <AppShell sidebar={sidebar} header={<MyHeader leading={<AppShellMenuButton />} />}>…</AppShell>
57
+
58
+ function MyHeader() {
59
+ const { drawerAvailable, drawerOpen, openDrawer, closeDrawer, toggleDrawer } = useAppShell();
60
+ …
61
+ }
62
+ ```
63
+
64
+ `AppShellMenuButton` is the same button the header uses and renders nothing while the sidebar is in flow. `useAppShell()` works anywhere inside the shell (the header, the page, the aside); `drawerAvailable` says whether there is a drawer to open right now.
65
+
66
+ ## A fixed screen
67
+
68
+ `scroll="fixed"` makes the shell exactly one screen tall (`100dvh` on web, its parent on native) and scrolls nothing: the header stays, and the content column fills the height left under it (`flex: 1`). The page owns its scrolling — a chat with a pinned composer, a map, a board:
69
+
70
+ ```tsx
71
+ <AppShell scroll="fixed" sidebar={sidebar} title="Chat">
72
+ <View style={{ flex: 1, minHeight: 0 }}>
73
+ <MessageList style={{ flex: 1 }} />
74
+ <Composer />
75
+ </View>
76
+ </AppShell>
77
+ ```
78
+
79
+ Give the page `flex: 1` and `minHeight: 0`, or a tall child grows the column past the screen instead of scrolling inside it.
80
+
81
+ ## Scrolling on web
82
+
83
+ The page scrolls the **document**, like a [`ContentPanel`](/docs/bloom/main/content-panel) page — not a scroll view inside the frame. The shell is at least one viewport tall and grows with its content; the in-flow sidebar is `position: sticky`, so it stays put while the page moves under it. That is what makes scroll restoration, the mobile address bar collapsing, anchor links and `window.scrollTo` behave as they do on any web page.
84
+
85
+ - Nothing between the shell and the document may become a scroll container: a parent with `height: 100%` plus `overflow: hidden` (or `auto`) around `AppShell` pins the sidebar to a box that never scrolls. Mount it straight under the app root.
86
+ - `reveal` clips the sliding page with `overflow: clip`, not `hidden`, for the same reason — and so the 272px slide never adds a horizontal scrollbar. The waiting rail is `position: fixed`.
87
+ - `scroll="container"` restores the old behaviour — the shell fills its parent and the page scrolls inside its own `ScrollView` — for a shell embedded in a bounded box rather than owning the page.
88
+
89
+ Native has no document: `document` behaves as `container` there, and `fixed` works the same as on web.
90
+
37
91
  ## NotificationBell
38
92
 
39
93
  A medium secondary icon button with the unread count (16px red disc, 1.5px ring in the button's surface that drops on hover) and a `NotificationCenter` in a bottom-end popover, 440 wide. `unreadCount` overrides the computed count.
package/docs/sidebar.mdx CHANGED
@@ -39,6 +39,23 @@ Give it a height (it fills `100%`); its width is its own.
39
39
  | `SidebarRailItem` | one `rail` destination: icon on a 48 × 32 pill over a 10px label |
40
40
  | `SIDEBAR_RAIL_WIDTH` | the rail's width (80) |
41
41
 
42
+ ## Logo
43
+
44
+ ```tsx
45
+ <Sidebar
46
+ logo={{ icon: <OxyMark width={28} height={28} />, wordmark: 'Oxy', href: '/', onPress: () => router.push('/') }}
47
+ items={items}
48
+ account={account}
49
+ />
50
+ ```
51
+
52
+ - `icon` — the mark, centred in a 36 × 36 box (the collapsed column), so it stays put while the sidebar collapses. Size it yourself; 24–28px reads right.
53
+ - `wordmark` — beside the mark, folded away while collapsed. A string renders as the product name in `headline-semibold`; pass an SVG or image for a drawn wordmark.
54
+ - `href` makes it a real anchor on web; `onPress` a button (with both, `onPress` wins so a router can navigate — pass it on native, where there is no anchor). With neither it is decoration, named by `accessibilityLabel` or a string `wordmark`.
55
+ - Give a mark, a wordmark or both. Wordmark only disappears when collapsed.
56
+
57
+ The logo leads the header beside the collapse (or close) control; `account`, if given too, moves to its own row under it. Collapsed, the mark sits above the expand control. `variant="rail"` shows the mark only, centred above the items.
58
+
42
59
  ## Modes
43
60
 
44
61
  ```tsx
@@ -13,23 +13,30 @@ var _index = require("../overlay/index.js");
13
13
  var _portal = require("../portal");
14
14
  var _index2 = require("../sidebar/index.js");
15
15
  var _breakpoints = require("../styles/breakpoints.js");
16
+ var _webViewStyle = require("../styles/web-view-style.js");
16
17
  var _useTheme = require("../theme/use-theme.js");
17
18
  var _AppShellHeader = require("./AppShellHeader.js");
19
+ var _context = require("./context.js");
18
20
  var _jsxRuntime = require("react/jsx-runtime");
19
21
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
20
22
  /**
21
23
  * The page frame: a starter shell and a dashboard shell, combined into one
22
24
  * component.
23
25
  *
24
- * root row, full height, background-full, overflow hidden
26
+ * root row, background-full; one screen tall at least (document
27
+ * scroll), exactly (`fixed`), or its parent's height (`container`)
25
28
  * lg and up the sidebar in flow (from `sm` for `variant: 'rail'`, whose
26
29
  * drawer below `sm` opens the panel); `overlay` pads the whole frame 12 with a
27
30
  * 16 gap, `reveal` sits the rail 12 from the top-left
28
- * main scrolls; the content column is centred, max 1300, gap 10:
31
+ * main scrolls — on web the DOCUMENT (see `scroll`), elsewhere its own
32
+ * ScrollView; the content column is centred, max 1300, gap 10:
29
33
  * header (breadcrumb + title row), then the content (gap 16,
30
34
  * 16 below). `overlay` insets the column 12 from the top at `sm`,
31
35
  * `reveal` pads the page 12 (24 on top at `sm`)
32
- * below lg the header grows a hamburger. `overlay` opens the rail as a
36
+ * aside optional right column, `asideWidth` (320) wide from `asideFrom`
37
+ * (xl), pinned like the rail; below it stacked after the content
38
+ * below lg the header grows a hamburger (also with no title — see
39
+ * `useAppShell` / `AppShellMenuButton`). `overlay` opens the rail as a
33
40
  * drawer (12 inset) over a 40% black backdrop; `reveal` slides
34
41
  * the page 272 right and rounds it to 32 while the rail, flat
35
42
  * beneath it, scales up from 0.94 and fades in (325ms,
@@ -40,6 +47,38 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
40
47
  const REVEAL_EASE = _reactNativeReanimated.Easing.bezier(0.42, 0, 0.58, 1);
41
48
  const REVEAL_MS = 325;
42
49
  const REVEAL_OFFSET = 272;
50
+ /**
51
+ * The page's scroller. `document`: a plain box, the page grows the document.
52
+ * `fixed`: a plain box that fills the frame's height and never scrolls — the
53
+ * page owns its scrolling. `container`: a `ScrollView` filling the frame.
54
+ */
55
+ function Scroller({
56
+ mode,
57
+ style,
58
+ contentStyle,
59
+ children
60
+ }) {
61
+ if (mode === 'document') return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
62
+ style: [style, contentStyle],
63
+ children: children
64
+ });
65
+ if (mode === 'fixed') {
66
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
67
+ style: [{
68
+ flex: 1,
69
+ minHeight: 0
70
+ }, style, contentStyle],
71
+ children: children
72
+ });
73
+ }
74
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ScrollView, {
75
+ style: [{
76
+ flex: 1
77
+ }, style],
78
+ contentContainerStyle: contentStyle,
79
+ children: children
80
+ });
81
+ }
43
82
  const AppShellComponent = ({
44
83
  sidebar,
45
84
  drawer = 'overlay',
@@ -47,11 +86,16 @@ const AppShellComponent = ({
47
86
  breadcrumb,
48
87
  actions,
49
88
  header,
89
+ aside,
90
+ asideWidth = 320,
91
+ asideFrom = 'xl',
92
+ asideCollapse = 'stack',
50
93
  children,
51
94
  contentMaxWidth = 1300,
52
95
  overlay,
53
96
  drawerOpen,
54
97
  onDrawerOpenChange,
98
+ scroll = 'document',
55
99
  style,
56
100
  testID
57
101
  }) => {
@@ -59,10 +103,16 @@ const AppShellComponent = ({
59
103
  const {
60
104
  width
61
105
  } = (0, _reactNative.useWindowDimensions)();
106
+ // Native has no document: `document` falls back to `container` there.
107
+ const mode = scroll === 'document' && _reactNative.Platform.OS !== 'web' ? 'container' : scroll;
108
+ const doc = mode === 'document';
109
+ const fixed = mode === 'fixed';
62
110
  const small = width >= _breakpoints.BREAKPOINTS.sm;
63
111
  // The rail is narrow enough to stay in flow from `sm`; the panel needs `lg`.
64
112
  const rail = sidebar?.variant === 'rail';
65
113
  const wide = rail ? small : width >= _breakpoints.BREAKPOINTS.lg;
114
+ const asideBeside = aside != null && width >= _breakpoints.BREAKPOINTS[asideFrom];
115
+ const asideStacked = aside != null && !asideBeside && asideCollapse === 'stack';
66
116
  // The drawer always opens the full panel, whatever the in-flow variant.
67
117
  const drawerSidebar = sidebar ? {
68
118
  ...sidebar,
@@ -74,7 +124,15 @@ const AppShellComponent = ({
74
124
  defaultValue: false,
75
125
  onChange: onDrawerOpenChange
76
126
  });
77
- const isOpen = open && !wide;
127
+ const drawerAvailable = !!sidebar && !wide;
128
+ const isOpen = open && drawerAvailable;
129
+ const shell = (0, _react.useMemo)(() => ({
130
+ drawerAvailable,
131
+ drawerOpen: isOpen,
132
+ openDrawer: () => setOpen(true),
133
+ closeDrawer: () => setOpen(false),
134
+ toggleDrawer: () => setOpen(!isOpen)
135
+ }), [drawerAvailable, isOpen, setOpen]);
78
136
  const {
79
137
  neutral: n
80
138
  } = (0, _shared.resolveButtonRamps)(theme);
@@ -102,172 +160,273 @@ const AppShellComponent = ({
102
160
  const veilStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => ({
103
161
  opacity: reveal.value
104
162
  }), [reveal]);
105
- const headerNode = header ?? (title != null ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_AppShellHeader.AppShellHeader, {
163
+
164
+ // The default header renders whenever it has something to show — a menu
165
+ // button alone counts, so a page without a title can still open the drawer.
166
+ const headerNode = header ?? (title != null || breadcrumb != null || actions != null || drawerAvailable ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_AppShellHeader.AppShellHeader, {
106
167
  title: title,
107
168
  breadcrumb: breadcrumb,
108
169
  actions: actions,
109
170
  menuOpen: isOpen,
110
- onMenuPress: sidebar && !wide ? () => setOpen(!open) : undefined,
171
+ onMenuPress: drawerAvailable ? shell.toggleDrawer : undefined,
111
172
  testID: testID ? `${testID}-header` : undefined
112
173
  }) : null);
174
+ const fill = fixed ? {
175
+ flex: 1,
176
+ minHeight: 0
177
+ } : null;
113
178
  const column = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
114
- style: {
179
+ style: [{
115
180
  width: '100%',
116
181
  maxWidth: contentMaxWidth,
117
182
  alignSelf: 'center',
118
183
  gap: 10
119
- },
120
- children: [headerNode, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
121
- style: {
184
+ }, fill],
185
+ children: [headerNode, /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
186
+ style: [{
122
187
  width: '100%',
123
188
  gap: 16,
124
189
  paddingBottom: drawer === 'overlay' ? 16 : 0
125
- },
126
- children: children
190
+ }, fill],
191
+ children: [children, asideStacked ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
192
+ testID: testID ? `${testID}-aside` : undefined,
193
+ children: aside
194
+ }) : null]
127
195
  })]
128
196
  });
197
+
198
+ // Beside the content: sticky and self-scrolling with document scroll, a
199
+ // full-height scroller otherwise.
200
+ const asideColumn = inset => asideBeside ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
201
+ testID: testID ? `${testID}-aside` : undefined,
202
+ style: [{
203
+ width: asideWidth,
204
+ flexShrink: 0
205
+ }, doc ? {
206
+ ...stickyRail(12),
207
+ width: asideWidth
208
+ } : {
209
+ alignSelf: 'stretch'
210
+ }, inset],
211
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ScrollView, {
212
+ style: {
213
+ flex: 1
214
+ },
215
+ contentContainerStyle: {
216
+ flexGrow: 1
217
+ },
218
+ showsVerticalScrollIndicator: false,
219
+ children: aside
220
+ })
221
+ }) : null;
222
+ const frame = doc ? documentRoot : fixed ? fixedRoot : containerRoot;
129
223
  if (drawer === 'reveal') {
130
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
131
- testID: testID,
132
- style: [{
133
- flex: 1,
134
- height: '100%',
135
- flexDirection: 'row',
136
- overflow: 'hidden',
137
- backgroundColor: background
138
- }, style],
139
- children: [sidebar && wide ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
140
- style: {
141
- paddingTop: 12,
142
- paddingBottom: 12,
143
- paddingLeft: 12,
144
- flexShrink: 0
145
- },
146
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.Sidebar, {
147
- ...sidebar
148
- })
149
- }) : null, sidebar && !wide ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
150
- "aria-hidden": !isOpen,
151
- pointerEvents: isOpen ? 'auto' : 'none',
152
- style: {
153
- position: 'absolute',
154
- top: 0,
155
- bottom: 0,
156
- left: 0,
157
- width: 272,
158
- paddingTop: 12,
159
- paddingBottom: 12,
160
- paddingLeft: 6
161
- },
162
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeReanimated.default.View, {
163
- style: [{
164
- height: '100%',
165
- width: 260,
166
- transformOrigin: 'left center'
167
- }, railStyle],
168
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.Sidebar, {
169
- ...drawerSidebar,
170
- mobile: true,
171
- flat: true,
172
- onClose: () => setOpen(false)
173
- })
174
- })
175
- }) : null, /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNativeReanimated.default.View, {
176
- style: [{
177
- flex: 1,
178
- minWidth: 0,
179
- overflow: 'hidden',
224
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_context.AppShellProvider, {
225
+ value: shell,
226
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
227
+ testID: testID,
228
+ style: [frame, doc ? {
229
+ overflow: _webViewStyle.WEB_OVERFLOW_CLIP
230
+ } : null, {
231
+ flexDirection: 'row',
180
232
  backgroundColor: background
181
- }, wide ? null : pageStyle],
182
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ScrollView, {
183
- style: {
184
- flex: 1
185
- },
186
- contentContainerStyle: {
187
- padding: 12,
188
- paddingTop: small ? 24 : 12
189
- },
190
- children: column
191
- }), !wide ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeReanimated.default.View, {
192
- pointerEvents: isOpen ? 'auto' : 'none',
233
+ }, style],
234
+ children: [sidebar && wide ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
193
235
  style: [{
194
- position: 'absolute',
195
- top: 0,
196
- left: 0,
197
- right: 0,
198
- bottom: 0
199
- }, veilStyle],
200
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
201
- role: "button",
202
- accessibilityLabel: "Close navigation",
203
- focusable: isOpen,
204
- onPress: () => setOpen(false),
205
- style: {
206
- flex: 1,
207
- backgroundColor: theme.isDark ? 'rgba(255, 255, 255, 0.05)' : 'rgba(0, 0, 0, 0.1)'
208
- },
209
- testID: testID ? `${testID}-veil` : undefined
236
+ paddingTop: 12,
237
+ paddingBottom: 12,
238
+ paddingLeft: 12,
239
+ flexShrink: 0
240
+ }, doc ? stickyRail(0) : null],
241
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.Sidebar, {
242
+ ...sidebar
210
243
  })
211
- }) : null]
212
- }), overlay]
213
- });
214
- }
215
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
216
- testID: testID,
217
- style: [{
218
- flex: 1,
219
- height: '100%',
220
- flexDirection: 'row',
221
- gap: 16,
222
- overflow: 'hidden',
223
- padding: 12,
224
- backgroundColor: background
225
- }, style],
226
- children: [sidebar && wide ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.Sidebar, {
227
- ...sidebar
228
- }) : null, sidebar && isOpen ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_portal.Portal, {
229
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_index.OverlayRoot, {
230
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_index.Backdrop, {
231
- onPress: () => setOpen(false),
232
- blurIntensity: 0,
233
- dimOpacity: 0.4,
234
- accessibilityLabel: "Close navigation"
235
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
236
- pointerEvents: "box-none",
244
+ }) : null, sidebar && !wide ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
245
+ "aria-hidden": !isOpen,
246
+ pointerEvents: isOpen ? 'auto' : 'none'
247
+ // Fixed on web in document mode: the rail waits beneath the VIEWPORT,
248
+ // wherever the page is scrolled to.
249
+ ,
237
250
  style: {
238
- position: 'absolute',
251
+ position: doc ? _webViewStyle.WEB_POSITION_FIXED : 'absolute',
239
252
  top: 0,
240
253
  bottom: 0,
241
254
  left: 0,
242
- flexDirection: 'row',
243
- padding: 12
255
+ width: 272,
256
+ paddingTop: 12,
257
+ paddingBottom: 12,
258
+ paddingLeft: 6
244
259
  },
245
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
246
- pointerEvents: "auto",
247
- style: {
248
- height: '100%'
249
- },
260
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeReanimated.default.View, {
261
+ style: [{
262
+ height: '100%',
263
+ width: 260,
264
+ transformOrigin: 'left center'
265
+ }, railStyle],
250
266
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.Sidebar, {
251
267
  ...drawerSidebar,
252
268
  mobile: true,
269
+ flat: true,
253
270
  onClose: () => setOpen(false)
254
271
  })
255
272
  })
256
- })]
273
+ }) : null, /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNativeReanimated.default.View, {
274
+ style: [{
275
+ flex: 1,
276
+ minWidth: 0,
277
+ flexDirection: 'row',
278
+ overflow: doc ? _webViewStyle.WEB_OVERFLOW_CLIP : 'hidden',
279
+ backgroundColor: background
280
+ }, wide ? null : pageStyle],
281
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Scroller, {
282
+ mode: mode,
283
+ style: {
284
+ flex: doc ? undefined : 1,
285
+ flexGrow: 1,
286
+ minWidth: 0
287
+ },
288
+ contentStyle: {
289
+ padding: 12,
290
+ paddingTop: small ? 24 : 12
291
+ },
292
+ children: column
293
+ }), asideColumn({
294
+ paddingTop: small ? 24 : 12,
295
+ paddingBottom: 12,
296
+ paddingRight: 12
297
+ }), !wide ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeReanimated.default.View, {
298
+ pointerEvents: isOpen ? 'auto' : 'none',
299
+ style: [{
300
+ position: 'absolute',
301
+ top: 0,
302
+ left: 0,
303
+ right: 0,
304
+ bottom: 0
305
+ }, veilStyle],
306
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
307
+ role: "button",
308
+ accessibilityLabel: "Close navigation",
309
+ focusable: isOpen,
310
+ onPress: () => setOpen(false),
311
+ style: {
312
+ flex: 1,
313
+ backgroundColor: theme.isDark ? 'rgba(255, 255, 255, 0.05)' : 'rgba(0, 0, 0, 0.1)'
314
+ },
315
+ testID: testID ? `${testID}-veil` : undefined
316
+ })
317
+ }) : null]
318
+ }), overlay]
257
319
  })
258
- }) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ScrollView, {
259
- style: {
260
- flex: 1,
261
- minWidth: 0,
320
+ });
321
+ }
322
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_context.AppShellProvider, {
323
+ value: shell,
324
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
325
+ testID: testID,
326
+ style: [frame, {
327
+ flexDirection: 'row',
328
+ gap: 16,
329
+ padding: 12,
262
330
  backgroundColor: background
263
- },
264
- contentContainerStyle: {
265
- paddingTop: small ? 12 : 0
266
- },
267
- children: column
268
- }), overlay]
331
+ }, style],
332
+ children: [sidebar && wide ? doc ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
333
+ style: stickyRail(12),
334
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.Sidebar, {
335
+ ...sidebar
336
+ })
337
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.Sidebar, {
338
+ ...sidebar
339
+ }) : null, sidebar && isOpen ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_portal.Portal, {
340
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_index.OverlayRoot, {
341
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_index.Backdrop, {
342
+ onPress: () => setOpen(false),
343
+ blurIntensity: 0,
344
+ dimOpacity: 0.4,
345
+ accessibilityLabel: "Close navigation"
346
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
347
+ pointerEvents: "box-none",
348
+ style: {
349
+ position: 'absolute',
350
+ top: 0,
351
+ bottom: 0,
352
+ left: 0,
353
+ flexDirection: 'row',
354
+ padding: 12
355
+ },
356
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
357
+ pointerEvents: "auto",
358
+ style: {
359
+ height: '100%'
360
+ },
361
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.Sidebar, {
362
+ ...drawerSidebar,
363
+ mobile: true,
364
+ onClose: () => setOpen(false)
365
+ })
366
+ })
367
+ })]
368
+ })
369
+ }) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(Scroller, {
370
+ mode: mode,
371
+ style: {
372
+ flex: 1,
373
+ minWidth: 0,
374
+ backgroundColor: background
375
+ },
376
+ contentStyle: {
377
+ paddingTop: small ? 12 : 0
378
+ },
379
+ children: column
380
+ }), asideColumn({}), overlay]
381
+ })
269
382
  });
270
383
  };
384
+
385
+ /**
386
+ * Document mode: the frame is at least one viewport tall and grows with the
387
+ * page, so the browser scrolls the document (scroll restoration, the address
388
+ * bar collapsing, anchor links, `window.scrollTo`) exactly as it does for a
389
+ * `ContentPanel` page. Nothing here may be a scroll container — no `hidden`
390
+ * overflow — or the sticky rail would stick to a box that never scrolls.
391
+ */
392
+ const documentRoot = {
393
+ flexGrow: 1,
394
+ minHeight: _webViewStyle.WEB_VIEWPORT_HEIGHT
395
+ };
396
+ // (Under `reveal` the document root also takes `overflow: clip`: the page slides
397
+ // 272 right, and `clip` keeps that from widening the document with a horizontal
398
+ // scrollbar without becoming a scroll container.)
399
+
400
+ /** Container mode: fill the parent, scroll inside. */
401
+ const containerRoot = {
402
+ flex: 1,
403
+ height: '100%',
404
+ overflow: 'hidden'
405
+ };
406
+
407
+ /**
408
+ * Fixed mode: exactly one screen — `100dvh` on web, the parent on native — and
409
+ * nothing scrolls; the content fills the height left under the header.
410
+ */
411
+ const fixedRoot = _reactNative.Platform.OS === 'web' ? {
412
+ height: _webViewStyle.WEB_VIEWPORT_HEIGHT,
413
+ overflow: 'hidden'
414
+ } : {
415
+ flex: 1,
416
+ height: '100%',
417
+ overflow: 'hidden'
418
+ };
419
+
420
+ /** The in-flow rail, pinned to the viewport while the document scrolls under it. */
421
+ function stickyRail(inset) {
422
+ return {
423
+ position: _webViewStyle.WEB_POSITION_STICKY,
424
+ top: inset,
425
+ height: (0, _webViewStyle.webViewportHeightMinus)(inset * 2),
426
+ alignSelf: 'flex-start',
427
+ flexShrink: 0
428
+ };
429
+ }
271
430
  const AppShell = exports.AppShell = /*#__PURE__*/(0, _react.memo)(AppShellComponent);
272
431
  AppShell.displayName = 'AppShell';
273
432
  //# sourceMappingURL=AppShell.js.map