@tearleads/windowing 0.2.11 → 0.2.12

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 (106) hide show
  1. package/README.md +93 -1
  2. package/index.d.ts +19 -0
  3. package/index.js +20 -1
  4. package/index.js.map +1 -1
  5. package/launcher/LauncherNavigationProvider.d.ts +71 -0
  6. package/launcher/LauncherNavigationProvider.js +253 -0
  7. package/launcher/LauncherNavigationProvider.js.map +1 -0
  8. package/launcher/MiniAppRouteSegmentsContext.d.ts +19 -0
  9. package/launcher/MiniAppRouteSegmentsContext.js +26 -0
  10. package/launcher/MiniAppRouteSegmentsContext.js.map +1 -0
  11. package/launcher/MiniAppWindow.d.ts +18 -0
  12. package/launcher/MiniAppWindow.js +41 -0
  13. package/launcher/MiniAppWindow.js.map +1 -0
  14. package/launcher/NavigationModeOverrideProvider.d.ts +23 -0
  15. package/launcher/NavigationModeOverrideProvider.js +31 -0
  16. package/launcher/NavigationModeOverrideProvider.js.map +1 -0
  17. package/launcher/NavigationModeSwitch.css +22 -0
  18. package/launcher/NavigationModeSwitch.d.ts +24 -0
  19. package/launcher/NavigationModeSwitch.js +40 -0
  20. package/launcher/NavigationModeSwitch.js.map +1 -0
  21. package/launcher/breakpoints.d.ts +17 -0
  22. package/launcher/breakpoints.js +18 -0
  23. package/launcher/breakpoints.js.map +1 -0
  24. package/launcher/launcherDefinition.d.ts +39 -0
  25. package/launcher/launcherDefinition.js +18 -0
  26. package/launcher/launcherDefinition.js.map +1 -0
  27. package/launcher/navigationHistory.d.ts +16 -0
  28. package/launcher/navigationHistory.js +48 -0
  29. package/launcher/navigationHistory.js.map +1 -0
  30. package/launcher/navigationMode.d.ts +31 -0
  31. package/launcher/navigationMode.js +35 -0
  32. package/launcher/navigationMode.js.map +1 -0
  33. package/launcher/routePaths.d.ts +17 -0
  34. package/launcher/routePaths.js +46 -0
  35. package/launcher/routePaths.js.map +1 -0
  36. package/launcher/routedPathNavigator.d.ts +20 -0
  37. package/launcher/routedPathNavigator.js +36 -0
  38. package/launcher/routedPathNavigator.js.map +1 -0
  39. package/launcher/storedPreference.d.ts +7 -0
  40. package/launcher/storedPreference.js +43 -0
  41. package/launcher/storedPreference.js.map +1 -0
  42. package/launcher/useActiveLauncherRoute.d.ts +14 -0
  43. package/launcher/useActiveLauncherRoute.js +41 -0
  44. package/launcher/useActiveLauncherRoute.js.map +1 -0
  45. package/launcher/useCompactRoutedMode.d.ts +2 -0
  46. package/launcher/useCompactRoutedMode.js +9 -0
  47. package/launcher/useCompactRoutedMode.js.map +1 -0
  48. package/launcher/useMiniAppRouteState.d.ts +14 -0
  49. package/launcher/useMiniAppRouteState.js +15 -0
  50. package/launcher/useMiniAppRouteState.js.map +1 -0
  51. package/launcher/useNavigationMode.d.ts +23 -0
  52. package/launcher/useNavigationMode.js +34 -0
  53. package/launcher/useNavigationMode.js.map +1 -0
  54. package/launcher/useNavigationModeDocumentAttribute.d.ts +16 -0
  55. package/launcher/useNavigationModeDocumentAttribute.js +24 -0
  56. package/launcher/useNavigationModeDocumentAttribute.js.map +1 -0
  57. package/launcher/useRoutedLayoutActive.d.ts +25 -0
  58. package/launcher/useRoutedLayoutActive.js +69 -0
  59. package/launcher/useRoutedLayoutActive.js.map +1 -0
  60. package/launcher/useRoutedLayoutTier.d.ts +17 -0
  61. package/launcher/useRoutedLayoutTier.js +24 -0
  62. package/launcher/useRoutedLayoutTier.js.map +1 -0
  63. package/package.json +1 -1
  64. package/routed/RoutedPane.css +393 -0
  65. package/routed/RoutedPane.d.ts +63 -0
  66. package/routed/RoutedPane.js +91 -0
  67. package/routed/RoutedPane.js.map +1 -0
  68. package/routed/RoutedPaneAppBar.d.ts +8 -0
  69. package/routed/RoutedPaneAppBar.js +23 -0
  70. package/routed/RoutedPaneAppBar.js.map +1 -0
  71. package/routed/RoutedPaneMain.d.ts +15 -0
  72. package/routed/RoutedPaneMain.js +27 -0
  73. package/routed/RoutedPaneMain.js.map +1 -0
  74. package/routed/RoutedPaneNav.css +298 -0
  75. package/routed/RoutedPaneNav.d.ts +20 -0
  76. package/routed/RoutedPaneNav.js +106 -0
  77. package/routed/RoutedPaneNav.js.map +1 -0
  78. package/routed/RoutedPaneOverlayHost.d.ts +37 -0
  79. package/routed/RoutedPaneOverlayHost.js +29 -0
  80. package/routed/RoutedPaneOverlayHost.js.map +1 -0
  81. package/routed/RoutedPanePlacementButton.d.ts +5 -0
  82. package/routed/RoutedPanePlacementButton.js +10 -0
  83. package/routed/RoutedPanePlacementButton.js.map +1 -0
  84. package/routed/RoutedPaneSidebar.css +61 -0
  85. package/routed/RoutedPaneSidebar.d.ts +7 -0
  86. package/routed/RoutedPaneSidebar.js +18 -0
  87. package/routed/RoutedPaneSidebar.js.map +1 -0
  88. package/routed/RoutedPaneTaskBar.d.ts +24 -0
  89. package/routed/RoutedPaneTaskBar.js +24 -0
  90. package/routed/RoutedPaneTaskBar.js.map +1 -0
  91. package/routed/classNames.d.ts +2 -0
  92. package/routed/classNames.js +6 -0
  93. package/routed/classNames.js.map +1 -0
  94. package/routed/launcherPlacement.d.ts +7 -0
  95. package/routed/launcherPlacement.js +8 -0
  96. package/routed/launcherPlacement.js.map +1 -0
  97. package/routed/useMobileKeyboardVisible.d.ts +7 -0
  98. package/routed/useMobileKeyboardVisible.js +78 -0
  99. package/routed/useMobileKeyboardVisible.js.map +1 -0
  100. package/routed/useMobileSheetDrag.d.ts +10 -0
  101. package/routed/useMobileSheetDrag.js +83 -0
  102. package/routed/useMobileSheetDrag.js.map +1 -0
  103. package/routed/useRoutedPaneOverlays.d.ts +25 -0
  104. package/routed/useRoutedPaneOverlays.js +72 -0
  105. package/routed/useRoutedPaneOverlays.js.map +1 -0
  106. package/tokens.css +24 -0
@@ -0,0 +1,393 @@
1
+ /*
2
+ * Routed shell. Two responsive tiers share one component tree; the
3
+ * `routed-pane--mobile` / `routed-pane--tablet` modifier (driven by
4
+ * useRoutedLayoutTier, keyed to the same 760px line as the media query below)
5
+ * picks the layout.
6
+ *
7
+ * - mobile: top app bar + centered bottom menu button that opens a bottom
8
+ * sheet of app-launcher tiles over content.
9
+ * - tablet: a left rail by default, or a bottom launcher sheet when selected.
10
+ *
11
+ * Both tiers carry the bottom taskbar (the centered menu icon + the host's
12
+ * tray); tablet keeps its rail in side mode. Mobile temporarily hides the bar
13
+ * while a text-editing control has focus and the software keyboard occupies the
14
+ * bottom of the viewport.
15
+ *
16
+ * The host sizes the shell: place `.routed-pane` (or the `className` it is
17
+ * given) in its layout, as a grid item or a block with a height.
18
+ *
19
+ * The navigation surfaces (nav panel, tablet rail, bottom sheet + scrim) are
20
+ * styled in RoutedPaneNav.css; this file owns the shell grid, app bar, main,
21
+ * and taskbar.
22
+ */
23
+
24
+ /* The shell's sizes assume border-box, like the window chrome (see
25
+ Window.css), and box-sizing does not inherit, so the shell sets it on
26
+ everything it renders. At zero specificity, any host rule wins. */
27
+ :where(.routed-pane),
28
+ :where(.routed-pane) :where(*) {
29
+ box-sizing: border-box;
30
+ }
31
+
32
+ .routed-pane {
33
+ position: relative;
34
+ min-height: 0;
35
+ overflow: hidden;
36
+ color: var(--color-dark);
37
+ background: var(--color-light);
38
+ --routed-sidebar-surface: color-mix(
39
+ in srgb,
40
+ var(--color-light) 60%,
41
+ var(--color-muted)
42
+ );
43
+ /* The floor keeps the longest app name ("Identity Manager") on one line beside
44
+ its glyph on the narrowest tablet; the rail links ellipsize past that. */
45
+ --routed-rail-width: clamp(14rem, 22vw, 17rem);
46
+ /* Collapsed, the rail is exactly one icon button plus a gutter either side,
47
+ so its toggle is the same 44px control the app bar carries rather than a
48
+ shrunken variant squeezed into a narrower strip. */
49
+ --routed-rail-collapsed-width: calc(
50
+ var(--control-height) +
51
+ (2 * var(--space-xs))
52
+ );
53
+ --routed-drawer-width: min(20rem, 82vw);
54
+ --routed-touch-target: 44px;
55
+ }
56
+
57
+ /* Mobile: app bar on top, taskbar on bottom; rail/sidebar are overlays. */
58
+ .routed-pane--mobile {
59
+ display: grid;
60
+ grid-template:
61
+ "appbar" auto
62
+ "main" 1fr
63
+ "warning" auto
64
+ "taskbar" auto
65
+ / minmax(0, 1fr);
66
+ }
67
+
68
+ /* Tablet: persistent rail column (full height) + app bar over main + taskbar
69
+ spanning the content column beside the rail (matches the mobile bottom bar). */
70
+ .routed-pane--tablet {
71
+ display: grid;
72
+ grid-template:
73
+ "rail appbar" auto
74
+ "rail main" 1fr
75
+ "rail warning" auto
76
+ "rail taskbar" auto
77
+ / auto minmax(0, 1fr);
78
+ }
79
+
80
+ .routed-pane--tablet[data-sidebar="open"] {
81
+ grid-template:
82
+ "rail appbar appbar" auto
83
+ "rail sidebar main" 1fr
84
+ "rail warning warning" auto
85
+ "rail taskbar taskbar" auto
86
+ / auto auto minmax(0, 1fr);
87
+ }
88
+
89
+ /* The bottom launcher removes the rail and lets the app use the full width. */
90
+ .routed-pane--tablet[data-launcher-placement="bottom"] {
91
+ grid-template:
92
+ "appbar" auto
93
+ "main" 1fr
94
+ "warning" auto
95
+ "taskbar" auto
96
+ / minmax(0, 1fr);
97
+ }
98
+
99
+ .routed-pane--tablet[data-launcher-placement="bottom"][data-sidebar="open"] {
100
+ grid-template:
101
+ "appbar appbar" auto
102
+ "sidebar main" 1fr
103
+ "warning warning" auto
104
+ "taskbar taskbar" auto
105
+ / auto minmax(0, 1fr);
106
+ }
107
+
108
+ /* === App bar === */
109
+
110
+ .routed-pane-appbar {
111
+ grid-area: appbar;
112
+ display: flex;
113
+ align-items: center;
114
+ gap: var(--space-sm);
115
+ min-width: 0;
116
+ padding: calc(var(--space-xs) + var(--safe-area-top)) var(--space-sm)
117
+ var(--space-xs);
118
+ /* This is now the topmost chrome, so absorb the top cutout while keeping the
119
+ trailing controls clear of a landscape cutout. */
120
+ padding-inline-end: calc(var(--space-sm) + var(--safe-area-right));
121
+ border-bottom: var(--border-strong);
122
+ background: var(--color-muted);
123
+ }
124
+
125
+ /* Mobile and tablet bottom mode put the app bar at the screen's leading edge. */
126
+ .routed-pane--mobile .routed-pane-appbar {
127
+ padding-inline-start: calc(var(--space-sm) + var(--safe-area-left));
128
+ }
129
+
130
+ .routed-pane--tablet[data-launcher-placement="bottom"] .routed-pane-appbar {
131
+ padding-inline-start: calc(var(--space-sm) + var(--safe-area-left));
132
+ }
133
+
134
+ .routed-pane-appbar-primary,
135
+ .routed-pane-toolbar {
136
+ display: flex;
137
+ align-items: center;
138
+ gap: var(--space-xs);
139
+ min-width: 0;
140
+ }
141
+
142
+ .routed-pane-appbar-primary {
143
+ flex: 0 1 auto;
144
+ }
145
+
146
+ .routed-pane-appbar-spacer {
147
+ flex: 1 1 auto;
148
+ }
149
+
150
+ .routed-pane-title {
151
+ flex: 0 1 auto;
152
+ min-width: 0;
153
+ overflow: hidden;
154
+ font-weight: 700;
155
+ text-overflow: ellipsis;
156
+ white-space: nowrap;
157
+ }
158
+
159
+ .routed-pane-history-controls {
160
+ display: flex;
161
+ align-items: center;
162
+ gap: var(--space-xs);
163
+ flex: 0 0 auto;
164
+ }
165
+
166
+ /*
167
+ * The routed shell's icon button: one square `--control-height` (44px) control
168
+ * shared by the app bar's back / forward / sidebar buttons, every registered
169
+ * toolbar action, and the rail's expand/collapse and launcher placement
170
+ * controls (RoutedPaneNav.css).
171
+ * Self-contained rather than scoped to `.routed-pane-appbar button` so a
172
+ * control outside the bar opts into the identical HIG touch target, border, and
173
+ * hover treatment instead of re-deriving a near-miss of its own.
174
+ */
175
+ .routed-pane-iconbutton {
176
+ flex: 0 0 auto;
177
+ display: inline-flex;
178
+ align-items: center;
179
+ justify-content: center;
180
+ width: var(--control-height);
181
+ min-width: var(--control-height);
182
+ min-height: var(--control-height);
183
+ padding: 0;
184
+ border: var(--border-width) solid transparent;
185
+ border-radius: var(--app-radius-control);
186
+ background: transparent;
187
+ color: inherit;
188
+ font: inherit;
189
+ line-height: 1;
190
+ cursor: pointer;
191
+ }
192
+
193
+ .routed-pane-iconbutton:hover:not(:disabled),
194
+ .routed-pane-iconbutton:focus-visible:not(:disabled) {
195
+ background: var(--app-hover-surface);
196
+ }
197
+
198
+ .routed-pane-iconbutton[aria-expanded="true"] {
199
+ background: var(--emphasis-surface);
200
+ color: var(--emphasis-text);
201
+ }
202
+
203
+ .routed-pane-iconbutton:disabled {
204
+ opacity: var(--opacity-disabled);
205
+ cursor: default;
206
+ }
207
+
208
+ /* `--control-icon-size` grows the app bar's back / forward / sidebar glyphs,
209
+ the rail controls', and every registered toolbar action's icon off their
210
+ `size={18}` attribute to the touch size the routed layout sets (see
211
+ tokens.css). */
212
+ .routed-pane-iconbutton svg {
213
+ flex: 0 0 auto;
214
+ width: var(--control-icon-size);
215
+ height: var(--control-icon-size);
216
+ }
217
+
218
+ .routed-pane-toolbar {
219
+ /* Shrink and scroll rather than pushing trailing actions off-screen. A
220
+ mini-app can register more fixed 44px touch targets than a narrow phone can
221
+ lay out beside the nav controls — e.g. a file document in the Explorer
222
+ stacks Get Info / Link / Move on top of its own Edit / Download. The
223
+ buttons keep their touch size and the row scrolls horizontally instead of
224
+ overflowing the app bar (which does not clip). The scrollbar is hidden
225
+ since a touch swipe is the affordance. */
226
+ flex: 0 1 auto;
227
+ overflow-x: auto;
228
+ scrollbar-width: none;
229
+ }
230
+
231
+ .routed-pane-toolbar::-webkit-scrollbar {
232
+ display: none;
233
+ }
234
+
235
+ /* === Main === */
236
+
237
+ .routed-pane-main {
238
+ grid-area: main;
239
+ /* Main-content controls use local z-indices for row hit areas, sticky
240
+ headers, and menus. Keep those layers below the routed shell's scrim,
241
+ drawer, and sheet instead of letting equal z-indices paint through them. */
242
+ isolation: isolate;
243
+ min-height: 0;
244
+ overflow: auto;
245
+ scrollbar-gutter: var(--scrollbar-gutter);
246
+ /* Keep content out of a landscape cutout. The trailing edge is the screen
247
+ edge in both tiers; the leading edge on mobile and tablet bottom mode when
248
+ the app sidebar is closed. Zero elsewhere, preserving full-bleed lists. */
249
+ padding-inline-end: var(--safe-area-right);
250
+ }
251
+
252
+ .routed-pane--mobile .routed-pane-main {
253
+ padding-inline-start: var(--safe-area-left);
254
+ }
255
+
256
+ .routed-pane--tablet[data-launcher-placement="bottom"][data-sidebar="closed"]
257
+ .routed-pane-main {
258
+ padding-inline-start: var(--safe-area-left);
259
+ }
260
+
261
+ /*
262
+ * Release the form measure on this tier. The mobile shell is single-column and
263
+ * deliberately edge-to-edge — its tab strip even bleeds past the root's inline
264
+ * padding to both screen edges (see MiniAppTabs.css) — but the tier runs all the
265
+ * way to 759px, well past the 34rem cap, so between those widths the cap would
266
+ * pull the column in and strand that bleed short of the screen (asserted by
267
+ * e2e/mobile-chrome.spec.ts). `100%` rather than `none` because consumers also
268
+ * read the token inside `min()`, where a keyword would invalidate the whole
269
+ * declaration; every capped element is already within its container's width, so
270
+ * this reads as "no cap" for all of them.
271
+ *
272
+ * This releases the shell subtree, not the tier: portaled surfaces (menus,
273
+ * modals, the image viewer) render outside it and keep the 34rem cap. Harmless
274
+ * while they stay narrower than the measure — `--modal-width` is 22rem — but a
275
+ * portal that outgrows it would need the release repeated on its own root.
276
+ */
277
+ .routed-pane--mobile {
278
+ --form-measure: 100%;
279
+ }
280
+
281
+ /* === Bottom taskbar (both tiers) === */
282
+
283
+ /* Three columns keep the logo optically centered regardless of the corner
284
+ controls' width: an empty balancing column, the centered logo, then the
285
+ end-aligned system tray (the mode switch). */
286
+ /* The host's strip (renderAboveTaskbar) rides in its own row directly above
287
+ the taskbar, spanning the same columns; empty, it collapses the row to
288
+ nothing. */
289
+ .routed-pane-above-taskbar {
290
+ grid-area: warning;
291
+ min-width: 0;
292
+ }
293
+
294
+ .routed-pane-taskbar {
295
+ grid-area: taskbar;
296
+ display: grid;
297
+ grid-template-columns: 1fr auto 1fr;
298
+ align-items: center;
299
+ padding: var(--space-xs) calc(var(--space-sm) + var(--safe-area-right))
300
+ max(var(--space-xs), var(--safe-area-bottom)) var(--space-sm);
301
+ border-top: var(--border-strong);
302
+ background: var(--color-muted);
303
+ }
304
+
305
+ .routed-pane-taskbar[hidden] {
306
+ display: none;
307
+ }
308
+
309
+ .routed-pane--mobile[data-keyboard="open"] .routed-pane-main {
310
+ padding-block-end: max(var(--space-xs), var(--safe-area-bottom));
311
+ }
312
+
313
+ /* Same leading-edge safe area as the app bar. */
314
+ .routed-pane--mobile .routed-pane-taskbar {
315
+ padding-inline-start: calc(var(--space-sm) + var(--safe-area-left));
316
+ }
317
+
318
+ .routed-pane--tablet[data-launcher-placement="bottom"] .routed-pane-taskbar {
319
+ padding-inline-start: calc(var(--space-sm) + var(--safe-area-left));
320
+ }
321
+
322
+ .routed-pane-taskbar-menu-button {
323
+ border-radius: var(--app-radius-control);
324
+ grid-column: 2;
325
+ justify-self: center;
326
+ display: inline-flex;
327
+ align-items: center;
328
+ justify-content: center;
329
+ width: var(--routed-touch-target);
330
+ height: var(--routed-touch-target);
331
+ padding: 0;
332
+ border: 0;
333
+ background: transparent;
334
+ color: inherit;
335
+ font: inherit;
336
+ line-height: 1;
337
+ cursor: pointer;
338
+ }
339
+
340
+ .routed-pane-taskbar-menu-button:hover,
341
+ .routed-pane-taskbar-menu-button:focus-visible,
342
+ .routed-pane-taskbar-menu-button[aria-expanded="true"] {
343
+ background: var(--emphasis-surface);
344
+ color: var(--emphasis-text);
345
+ }
346
+
347
+ /* The host's menu icon, which follows the button's color. */
348
+ .routed-pane-taskbar-menu-button > * {
349
+ display: block;
350
+ width: 28px;
351
+ height: 28px;
352
+ }
353
+
354
+ /* System tray: the windowed/routed switch, tucked into the trailing corner. */
355
+ .routed-pane-taskbar-end {
356
+ grid-column: 3;
357
+ justify-self: end;
358
+ display: inline-flex;
359
+ align-items: center;
360
+ gap: var(--space-xs);
361
+ }
362
+
363
+ /*
364
+ * Touch sizing flows from the routed-layout hook rather than a
365
+ * `@media (pointer: coarse)` query: `--control-height` resolves to 44px
366
+ * whenever the routed shell is active (see `:root[data-navigation-mode="routed"]`
367
+ * in tokens.css). The app-bar buttons, nav links, and
368
+ * system-menu actions above are all sized off `--control-height`, so they
369
+ * already meet the 44px touch target — on phones AND on an iPad with a mouse
370
+ * attached (which reports `pointer: fine` and a coarse-pointer query would
371
+ * miss). The mobile menu button is a fixed 44px square. Only the inter-target
372
+ * spacing needs a touch bump so the enlarged controls are not crowded.
373
+ */
374
+ :root[data-navigation-mode="routed"] .routed-pane-history-controls {
375
+ gap: var(--space-sm);
376
+ }
377
+
378
+ /*
379
+ * Keep the JS tier and CSS in lockstep at the 760px line
380
+ * (ROUTED_TABLET_BREAKPOINT_PX). Below it the mobile shell is active; this
381
+ * guard prevents a brief tablet-rail flash if markup renders before the tier
382
+ * hook resolves.
383
+ */
384
+ @media (max-width: 759px) {
385
+ .routed-pane--tablet {
386
+ grid-template:
387
+ "appbar" auto
388
+ "main" 1fr
389
+ "warning" auto
390
+ "taskbar" auto
391
+ / minmax(0, 1fr);
392
+ }
393
+ }
@@ -0,0 +1,63 @@
1
+ import { type ReactNode } from "react";
2
+ import { type LauncherDefinition } from "../launcher/launcherDefinition.js";
3
+ import type { MiniAppBoundary } from "../launcher/MiniAppWindow.js";
4
+ import { type RoutedLayoutTier } from "../launcher/useRoutedLayoutTier.js";
5
+ import { type SubscribeKeyboardVisibility } from "./useMobileKeyboardVisible.js";
6
+ /**
7
+ * Whether a freshly mounted routed mini-app shows its sidebar.
8
+ *
9
+ * On mobile the sidebar is a dismissable overlay (dialog + scrim), so it must
10
+ * never open on its own when an app loads — it starts collapsed and the user
11
+ * reveals it from the app bar. The tablet rail honours each app's configured
12
+ * {@link MiniAppDefinition.initialShowSidebar} default (defaulting to shown).
13
+ */
14
+ export declare function initialRoutedSidebarExpanded(definition: LauncherDefinition, tier: RoutedLayoutTier, activeAppId: string): boolean;
15
+ export interface RoutedPaneProps {
16
+ /**
17
+ * Wraps the active mini-app, such as an error boundary that fails inside the
18
+ * app rather than the shell.
19
+ */
20
+ AppBoundary?: MiniAppBoundary | undefined;
21
+ /**
22
+ * The apps the launcher offers, in order, such as the definition's order less
23
+ * the apps the session may not see. Defaults to the definition's order.
24
+ */
25
+ appIds?: ReadonlyArray<string> | undefined;
26
+ /** Rides above the active app in the content pane. */
27
+ contentTop?: ReactNode;
28
+ /**
29
+ * Where the tablet tier's launcher placement persists in localStorage.
30
+ * Defaults to `windowing.launcherPlacement`.
31
+ */
32
+ launcherPlacementStorageKey?: string | undefined;
33
+ /**
34
+ * The taskbar's menu button, centered: the product's logo, which opens the
35
+ * launcher sheet, or the rail on the tablet tier in side mode.
36
+ */
37
+ menuIcon: ReactNode;
38
+ /**
39
+ * A strip in its own row directly above the taskbar, such as a deployment
40
+ * warning. It is told whether the phone's software keyboard is open, while
41
+ * the taskbar itself hides.
42
+ */
43
+ renderAboveTaskbar?: ((state: {
44
+ keyboardVisible: boolean;
45
+ }) => ReactNode) | undefined;
46
+ /** Native keyboard state, for a WebView whose resizing hides it. */
47
+ subscribeKeyboardVisibility?: SubscribeKeyboardVisibility | undefined;
48
+ /** The taskbar's end-aligned tray, such as the windowed/routed switch. */
49
+ taskbarTray?: ReactNode;
50
+ }
51
+ /**
52
+ * The routed shell, the iPad / phone layout: one mini-app at a time, chosen by
53
+ * the route, with an app bar, a launcher, and a taskbar. Render it inside a
54
+ * {@link LauncherNavigationProvider} in `routed` mode, in a container that
55
+ * gives it its size.
56
+ *
57
+ * Below 760px it is a phone layout whose launcher is a bottom sheet of tiles;
58
+ * at or above it, a tablet layout whose launcher is a left rail or, at the
59
+ * user's choice, the same sheet. The app's sidebar and toolbar actions, which
60
+ * it registers with the window hooks, appear in the shell's sidebar and app
61
+ * bar.
62
+ */
63
+ export declare function RoutedPane({ AppBoundary, appIds, launcherPlacementStorageKey, ...props }: RoutedPaneProps): import("react").JSX.Element | null;
@@ -0,0 +1,91 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useCallback, useMemo, useState } from "react";
3
+ import { useLauncherNavigationState } from "../launcher/LauncherNavigationProvider.js";
4
+ import { resolveLauncherHomeAppId, resolveLauncherOrder, } from "../launcher/launcherDefinition.js";
5
+ import { useRoutedLayoutTier, } from "../launcher/useRoutedLayoutTier.js";
6
+ import { WindowMenuProvider } from "../window/WindowMenuContext.js";
7
+ import { hasWindowSidebar, useWindowSidebar, WindowSidebarProvider, } from "../window/WindowSidebarContext.js";
8
+ import "./RoutedPane.css";
9
+ import { loadLauncherPlacement, saveLauncherPlacement, } from "./launcherPlacement.js";
10
+ import { RoutedPaneAppBar } from "./RoutedPaneAppBar.js";
11
+ import { RoutedPaneMain } from "./RoutedPaneMain.js";
12
+ import { RoutedPaneNav } from "./RoutedPaneNav.js";
13
+ import { RoutedPaneSidebar } from "./RoutedPaneSidebar.js";
14
+ import { RoutedPaneTaskBar } from "./RoutedPaneTaskBar.js";
15
+ import { useMobileKeyboardVisible, } from "./useMobileKeyboardVisible.js";
16
+ import { invertBoolean, useRoutedPaneOverlays } from "./useRoutedPaneOverlays.js";
17
+ const DEFAULT_LAUNCHER_PLACEMENT_STORAGE_KEY = "windowing.launcherPlacement";
18
+ function PassThroughBoundary({ children }) {
19
+ return children;
20
+ }
21
+ /**
22
+ * Whether a freshly mounted routed mini-app shows its sidebar.
23
+ *
24
+ * On mobile the sidebar is a dismissable overlay (dialog + scrim), so it must
25
+ * never open on its own when an app loads — it starts collapsed and the user
26
+ * reveals it from the app bar. The tablet rail honours each app's configured
27
+ * {@link MiniAppDefinition.initialShowSidebar} default (defaulting to shown).
28
+ */
29
+ export function initialRoutedSidebarExpanded(definition, tier, activeAppId) {
30
+ if (tier === "mobile") {
31
+ return false;
32
+ }
33
+ return definition.apps[activeAppId]?.initialShowSidebar ?? true;
34
+ }
35
+ function RoutedPaneSurface({ activeAppId, AppBoundary, appIds, contentTop, launcherPlacement, menuIcon, navigationRailExpanded, onToggleLauncherPlacement, onToggleNavigationRail, renderAboveTaskbar, subscribeKeyboardVisibility, taskbarTray, tier, }) {
36
+ const { definition } = useLauncherNavigationState();
37
+ const { sidebar } = useWindowSidebar();
38
+ const hasSidebar = hasWindowSidebar(sidebar);
39
+ const mobileKeyboardVisible = useMobileKeyboardVisible(tier === "mobile", subscribeKeyboardVisibility);
40
+ const { closeDrawer, closeSidebar, dismissDrawer, drawerOpen, menuButtonRef, moveLauncher, sidebarExpanded, toggleDrawer, toggleSidebar, } = useRoutedPaneOverlays({
41
+ initialSidebarExpanded: () => initialRoutedSidebarExpanded(definition, tier, activeAppId),
42
+ launcherPlacement,
43
+ navigationRailExpanded,
44
+ onToggleLauncherPlacement,
45
+ tier,
46
+ });
47
+ const sidebarVisible = hasSidebar && sidebarExpanded;
48
+ return (_jsxs("section", { className: `routed-pane routed-pane--${tier}`, "data-keyboard": mobileKeyboardVisible ? "open" : "closed", "data-launcher-placement": launcherPlacement, "data-sidebar": sidebarVisible ? "open" : "closed", role: "application", children: [_jsx(RoutedPaneAppBar, { activeAppId: activeAppId, hasSidebar: hasSidebar, onToggleSidebar: toggleSidebar, sidebarExpanded: sidebarExpanded, tier: tier }), _jsx(RoutedPaneNav, { activeAppId: activeAppId, appIds: appIds, drawerOpen: drawerOpen, launcherPlacement: launcherPlacement, onCloseDrawer: dismissDrawer, onNavigateRail: closeDrawer, onToggleLauncherPlacement: moveLauncher, onToggleRail: onToggleNavigationRail, railExpanded: navigationRailExpanded, tier: tier }), sidebarVisible && (_jsx(RoutedPaneSidebar, { onClose: closeSidebar, tier: tier, children: sidebar })), _jsx(RoutedPaneMain, { activeAppId: activeAppId, AppBoundary: AppBoundary, contentTop: contentTop, tier: tier }), renderAboveTaskbar && (_jsx("div", { className: "routed-pane-above-taskbar", children: renderAboveTaskbar({ keyboardVisible: mobileKeyboardVisible }) })), _jsx(RoutedPaneTaskBar, { drawerOpen: drawerOpen, hidden: mobileKeyboardVisible, launcherPlacement: launcherPlacement, menuButtonRef: menuButtonRef, menuIcon: menuIcon, onToggleDrawer: toggleDrawer, onToggleRail: onToggleNavigationRail, railExpanded: navigationRailExpanded, tier: tier, tray: taskbarTray })] }));
49
+ }
50
+ /**
51
+ * Hosts the per-app chrome registries (toolbar actions and the mini-app
52
+ * sidebar). Keyed by the active app id upstream so each mini-app mounts against
53
+ * fresh registries.
54
+ */
55
+ function RoutedPaneWithRegistries(props) {
56
+ return (_jsx(WindowMenuProvider, { children: _jsx(WindowSidebarProvider, { children: _jsx(RoutedPaneSurface, { ...props }) }) }));
57
+ }
58
+ /**
59
+ * The routed shell, the iPad / phone layout: one mini-app at a time, chosen by
60
+ * the route, with an app bar, a launcher, and a taskbar. Render it inside a
61
+ * {@link LauncherNavigationProvider} in `routed` mode, in a container that
62
+ * gives it its size.
63
+ *
64
+ * Below 760px it is a phone layout whose launcher is a bottom sheet of tiles;
65
+ * at or above it, a tablet layout whose launcher is a left rail or, at the
66
+ * user's choice, the same sheet. The app's sidebar and toolbar actions, which
67
+ * it registers with the window hooks, appear in the shell's sidebar and app
68
+ * bar.
69
+ */
70
+ export function RoutedPane({ AppBoundary = PassThroughBoundary, appIds, launcherPlacementStorageKey = DEFAULT_LAUNCHER_PLACEMENT_STORAGE_KEY, ...props }) {
71
+ const tier = useRoutedLayoutTier();
72
+ const { definition, route: { appId }, } = useLauncherNavigationState();
73
+ const [launcherPlacement, setLauncherPlacement] = useState(() => loadLauncherPlacement(launcherPlacementStorageKey));
74
+ const [navigationRailExpanded, setNavigationRailExpanded] = useState(false);
75
+ // The route only ever names one of the launcher's apps, so the root route is
76
+ // the one case that falls back to the home app.
77
+ const activeAppId = appId ?? resolveLauncherHomeAppId(definition);
78
+ const offeredAppIds = useMemo(() => appIds ?? resolveLauncherOrder(definition), [appIds, definition]);
79
+ const toggleNavigationRail = useCallback(() => setNavigationRailExpanded(invertBoolean), []);
80
+ const toggleLauncherPlacement = useCallback((wasOpen) => {
81
+ const next = launcherPlacement === "side" ? "bottom" : "side";
82
+ setNavigationRailExpanded(next === "side" && wasOpen);
83
+ setLauncherPlacement(next);
84
+ saveLauncherPlacement(launcherPlacementStorageKey, next);
85
+ }, [launcherPlacement, launcherPlacementStorageKey]);
86
+ if (activeAppId === null) {
87
+ return null;
88
+ }
89
+ return (_jsx(RoutedPaneWithRegistries, { ...props, AppBoundary: AppBoundary, activeAppId: activeAppId, appIds: offeredAppIds, launcherPlacement: launcherPlacement, navigationRailExpanded: navigationRailExpanded, onToggleLauncherPlacement: toggleLauncherPlacement, onToggleNavigationRail: toggleNavigationRail, tier: tier }, activeAppId));
90
+ }
91
+ //# sourceMappingURL=RoutedPane.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RoutedPane.js","sourceRoot":"","sources":["../../../home/runner/work/tearleads/tearleads/packages/windowing/src/routed/RoutedPane.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAkB,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACvE,OAAO,EAAE,0BAA0B,EAAE,MAAM,wCAAwC,CAAC;AACpF,OAAO,EAEL,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAEL,mBAAmB,GACpB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,gCAAgC,CAAC;AACxC,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAEL,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAEL,wBAAwB,GACzB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAE/E,MAAM,sCAAsC,GAAG,6BAA6B,CAAC;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AAoB,CAAC,IAAI,CAAC,CAAC;QAC3B,qBAAqB,CAAC,2BAA2B,EAAE,IAAI,CAAC,CAAC;IAC3D,CAAC,EACD,CAAC,iBAAiB,EAAE,2BAA2B,CAAC,CACjD,CAAC;IAEF,IAAI,WAAW,KAAK,IAAI,EAAE,CAAC;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CACL,KAAC,wBAAwB,OAEnB,KAAK,EACT,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,aAAa,EACrB,iBAAiB,EAAE,iBAAiB,EACpC,sBAAsB,EAAE,sBAAsB,EAC9C,yBAAyB,EAAE,uBAAuB,EAClD,sBAAsB,EAAE,oBAAoB,EAC5C,IAAI,EAAE,IAAI,IATL,WAAW,CAUhB,CACH,CAAC;AACJ,CAAC","sourcesContent":["import { type ReactNode, useCallback, useMemo, useState } from \"react\";\nimport { useLauncherNavigationState } from \"../launcher/LauncherNavigationProvider\";\nimport {\n type LauncherDefinition,\n resolveLauncherHomeAppId,\n resolveLauncherOrder,\n} from \"../launcher/launcherDefinition\";\nimport type { MiniAppBoundary } from \"../launcher/MiniAppWindow\";\nimport {\n type RoutedLayoutTier,\n useRoutedLayoutTier,\n} from \"../launcher/useRoutedLayoutTier\";\nimport { WindowMenuProvider } from \"../window/WindowMenuContext\";\nimport {\n hasWindowSidebar,\n useWindowSidebar,\n WindowSidebarProvider,\n} from \"../window/WindowSidebarContext\";\nimport \"./RoutedPane.css\";\nimport {\n type LauncherPlacement,\n loadLauncherPlacement,\n saveLauncherPlacement,\n} from \"./launcherPlacement\";\nimport { RoutedPaneAppBar } from \"./RoutedPaneAppBar\";\nimport { RoutedPaneMain } from \"./RoutedPaneMain\";\nimport { RoutedPaneNav } from \"./RoutedPaneNav\";\nimport { RoutedPaneSidebar } from \"./RoutedPaneSidebar\";\nimport { RoutedPaneTaskBar } from \"./RoutedPaneTaskBar\";\nimport {\n type SubscribeKeyboardVisibility,\n useMobileKeyboardVisible,\n} from \"./useMobileKeyboardVisible\";\nimport { invertBoolean, useRoutedPaneOverlays } from \"./useRoutedPaneOverlays\";\n\nconst DEFAULT_LAUNCHER_PLACEMENT_STORAGE_KEY = \"windowing.launcherPlacement\";\n\nfunction PassThroughBoundary({ children }: { children?: ReactNode }) {\n return children;\n}\n\n/**\n * Whether a freshly mounted routed mini-app shows its sidebar.\n *\n * On mobile the sidebar is a dismissable overlay (dialog + scrim), so it must\n * never open on its own when an app loads — it starts collapsed and the user\n * reveals it from the app bar. The tablet rail honours each app's configured\n * {@link MiniAppDefinition.initialShowSidebar} default (defaulting to shown).\n */\nexport function initialRoutedSidebarExpanded(\n definition: LauncherDefinition,\n tier: RoutedLayoutTier,\n activeAppId: string,\n): boolean {\n if (tier === \"mobile\") {\n return false;\n }\n\n return definition.apps[activeAppId]?.initialShowSidebar ?? true;\n}\n\nexport interface RoutedPaneProps {\n /**\n * Wraps the active mini-app, such as an error boundary that fails inside the\n * app rather than the shell.\n */\n AppBoundary?: MiniAppBoundary | undefined;\n /**\n * The apps the launcher offers, in order, such as the definition's order less\n * the apps the session may not see. Defaults to the definition's order.\n */\n appIds?: ReadonlyArray<string> | undefined;\n /** Rides above the active app in the content pane. */\n contentTop?: ReactNode;\n /**\n * Where the tablet tier's launcher placement persists in localStorage.\n * Defaults to `windowing.launcherPlacement`.\n */\n launcherPlacementStorageKey?: string | undefined;\n /**\n * The taskbar's menu button, centered: the product's logo, which opens the\n * launcher sheet, or the rail on the tablet tier in side mode.\n */\n menuIcon: ReactNode;\n /**\n * A strip in its own row directly above the taskbar, such as a deployment\n * warning. It is told whether the phone's software keyboard is open, while\n * the taskbar itself hides.\n */\n renderAboveTaskbar?:\n | ((state: { keyboardVisible: boolean }) => ReactNode)\n | undefined;\n /** Native keyboard state, for a WebView whose resizing hides it. */\n subscribeKeyboardVisibility?: SubscribeKeyboardVisibility | undefined;\n /** The taskbar's end-aligned tray, such as the windowed/routed switch. */\n taskbarTray?: ReactNode;\n}\n\ninterface RoutedPaneSurfaceProps\n extends Omit<\n RoutedPaneProps,\n \"AppBoundary\" | \"appIds\" | \"launcherPlacementStorageKey\"\n > {\n AppBoundary: MiniAppBoundary;\n activeAppId: string;\n appIds: ReadonlyArray<string>;\n launcherPlacement: LauncherPlacement;\n navigationRailExpanded: boolean;\n onToggleLauncherPlacement: (wasOpen: boolean) => void;\n onToggleNavigationRail: () => void;\n tier: RoutedLayoutTier;\n}\n\nfunction RoutedPaneSurface({\n activeAppId,\n AppBoundary,\n appIds,\n contentTop,\n launcherPlacement,\n menuIcon,\n navigationRailExpanded,\n onToggleLauncherPlacement,\n onToggleNavigationRail,\n renderAboveTaskbar,\n subscribeKeyboardVisibility,\n taskbarTray,\n tier,\n}: RoutedPaneSurfaceProps) {\n const { definition } = useLauncherNavigationState();\n const { sidebar } = useWindowSidebar();\n const hasSidebar = hasWindowSidebar(sidebar);\n const mobileKeyboardVisible = useMobileKeyboardVisible(\n tier === \"mobile\",\n subscribeKeyboardVisibility,\n );\n\n const {\n closeDrawer,\n closeSidebar,\n dismissDrawer,\n drawerOpen,\n menuButtonRef,\n moveLauncher,\n sidebarExpanded,\n toggleDrawer,\n toggleSidebar,\n } = useRoutedPaneOverlays({\n initialSidebarExpanded: () =>\n initialRoutedSidebarExpanded(definition, tier, activeAppId),\n launcherPlacement,\n navigationRailExpanded,\n onToggleLauncherPlacement,\n tier,\n });\n const sidebarVisible = hasSidebar && sidebarExpanded;\n\n return (\n <section\n className={`routed-pane routed-pane--${tier}`}\n data-keyboard={mobileKeyboardVisible ? \"open\" : \"closed\"}\n data-launcher-placement={launcherPlacement}\n data-sidebar={sidebarVisible ? \"open\" : \"closed\"}\n role=\"application\"\n >\n <RoutedPaneAppBar\n activeAppId={activeAppId}\n hasSidebar={hasSidebar}\n onToggleSidebar={toggleSidebar}\n sidebarExpanded={sidebarExpanded}\n tier={tier}\n />\n <RoutedPaneNav\n activeAppId={activeAppId}\n appIds={appIds}\n drawerOpen={drawerOpen}\n launcherPlacement={launcherPlacement}\n onCloseDrawer={dismissDrawer}\n onNavigateRail={closeDrawer}\n onToggleLauncherPlacement={moveLauncher}\n onToggleRail={onToggleNavigationRail}\n railExpanded={navigationRailExpanded}\n tier={tier}\n />\n {sidebarVisible && (\n <RoutedPaneSidebar onClose={closeSidebar} tier={tier}>\n {sidebar}\n </RoutedPaneSidebar>\n )}\n <RoutedPaneMain\n activeAppId={activeAppId}\n AppBoundary={AppBoundary}\n contentTop={contentTop}\n tier={tier}\n />\n {renderAboveTaskbar && (\n <div className=\"routed-pane-above-taskbar\">\n {renderAboveTaskbar({ keyboardVisible: mobileKeyboardVisible })}\n </div>\n )}\n <RoutedPaneTaskBar\n drawerOpen={drawerOpen}\n hidden={mobileKeyboardVisible}\n launcherPlacement={launcherPlacement}\n menuButtonRef={menuButtonRef}\n menuIcon={menuIcon}\n onToggleDrawer={toggleDrawer}\n onToggleRail={onToggleNavigationRail}\n railExpanded={navigationRailExpanded}\n tier={tier}\n tray={taskbarTray}\n />\n </section>\n );\n}\n\n/**\n * Hosts the per-app chrome registries (toolbar actions and the mini-app\n * sidebar). Keyed by the active app id upstream so each mini-app mounts against\n * fresh registries.\n */\nfunction RoutedPaneWithRegistries(props: RoutedPaneSurfaceProps) {\n return (\n <WindowMenuProvider>\n <WindowSidebarProvider>\n <RoutedPaneSurface {...props} />\n </WindowSidebarProvider>\n </WindowMenuProvider>\n );\n}\n\n/**\n * The routed shell, the iPad / phone layout: one mini-app at a time, chosen by\n * the route, with an app bar, a launcher, and a taskbar. Render it inside a\n * {@link LauncherNavigationProvider} in `routed` mode, in a container that\n * gives it its size.\n *\n * Below 760px it is a phone layout whose launcher is a bottom sheet of tiles;\n * at or above it, a tablet layout whose launcher is a left rail or, at the\n * user's choice, the same sheet. The app's sidebar and toolbar actions, which\n * it registers with the window hooks, appear in the shell's sidebar and app\n * bar.\n */\nexport function RoutedPane({\n AppBoundary = PassThroughBoundary,\n appIds,\n launcherPlacementStorageKey = DEFAULT_LAUNCHER_PLACEMENT_STORAGE_KEY,\n ...props\n}: RoutedPaneProps) {\n const tier = useRoutedLayoutTier();\n const {\n definition,\n route: { appId },\n } = useLauncherNavigationState();\n const [launcherPlacement, setLauncherPlacement] = useState<LauncherPlacement>(\n () => loadLauncherPlacement(launcherPlacementStorageKey),\n );\n const [navigationRailExpanded, setNavigationRailExpanded] = useState(false);\n // The route only ever names one of the launcher's apps, so the root route is\n // the one case that falls back to the home app.\n const activeAppId = appId ?? resolveLauncherHomeAppId(definition);\n const offeredAppIds = useMemo(\n () => appIds ?? resolveLauncherOrder(definition),\n [appIds, definition],\n );\n const toggleNavigationRail = useCallback(\n () => setNavigationRailExpanded(invertBoolean),\n [],\n );\n const toggleLauncherPlacement = useCallback(\n (wasOpen: boolean) => {\n const next = launcherPlacement === \"side\" ? \"bottom\" : \"side\";\n setNavigationRailExpanded(next === \"side\" && wasOpen);\n setLauncherPlacement(next);\n saveLauncherPlacement(launcherPlacementStorageKey, next);\n },\n [launcherPlacement, launcherPlacementStorageKey],\n );\n\n if (activeAppId === null) {\n return null;\n }\n\n return (\n <RoutedPaneWithRegistries\n key={activeAppId}\n {...props}\n AppBoundary={AppBoundary}\n activeAppId={activeAppId}\n appIds={offeredAppIds}\n launcherPlacement={launcherPlacement}\n navigationRailExpanded={navigationRailExpanded}\n onToggleLauncherPlacement={toggleLauncherPlacement}\n onToggleNavigationRail={toggleNavigationRail}\n tier={tier}\n />\n );\n}\n"]}
@@ -0,0 +1,8 @@
1
+ import type { RoutedLayoutTier } from "../launcher/useRoutedLayoutTier.js";
2
+ export declare function RoutedPaneAppBar({ activeAppId, hasSidebar, onToggleSidebar, sidebarExpanded, tier, }: {
3
+ activeAppId: string;
4
+ hasSidebar: boolean;
5
+ onToggleSidebar: () => void;
6
+ sidebarExpanded: boolean;
7
+ tier: RoutedLayoutTier;
8
+ }): import("react").JSX.Element;
@@ -0,0 +1,23 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ArrowsClockwiseIcon } from "@phosphor-icons/react/dist/csr/ArrowsClockwise";
3
+ import { CaretLeftIcon } from "@phosphor-icons/react/dist/csr/CaretLeft";
4
+ import { CaretRightIcon } from "@phosphor-icons/react/dist/csr/CaretRight";
5
+ import { SidebarSimpleIcon } from "@phosphor-icons/react/dist/csr/SidebarSimple";
6
+ import { useLauncherNavigationActions, useLauncherNavigationState, } from "../launcher/LauncherNavigationProvider.js";
7
+ import { WindowTitleBarActionButtons } from "../window/WindowChromeActions.js";
8
+ import { useWindowBackActionValue, useWindowRefreshMenuItemValue, useWindowTitleBarActions, } from "../window/WindowMenuContext.js";
9
+ export function RoutedPaneAppBar({ activeAppId, hasSidebar, onToggleSidebar, sidebarExpanded, tier, }) {
10
+ const { goBack, goForward } = useLauncherNavigationActions();
11
+ const { definition, history } = useLauncherNavigationState();
12
+ const backAction = useWindowBackActionValue();
13
+ const toolbarActions = useWindowTitleBarActions();
14
+ // The routed shell has no menu bar, so the app's refresh registration — which
15
+ // windowed mode reaches through the View menu — rides the toolbar as a glyph.
16
+ const refreshItem = useWindowRefreshMenuItemValue();
17
+ const backLabel = backAction?.label ?? "Back";
18
+ const canGoBack = backAction ? !backAction.disabled : history.canGoBack;
19
+ const sidebarLabel = sidebarExpanded ? "Hide Sidebar" : "Show Sidebar";
20
+ const showToolbar = toolbarActions.length > 0 || refreshItem !== null;
21
+ return (_jsxs("header", { className: "routed-pane-appbar", children: [_jsxs("div", { className: "routed-pane-appbar-primary", children: [_jsxs("div", { className: "routed-pane-history-controls", children: [_jsx("button", { "aria-label": backLabel, className: "routed-pane-iconbutton", disabled: !canGoBack, title: backLabel, type: "button", onClick: backAction?.onClick ?? goBack, children: _jsx(CaretLeftIcon, { "aria-hidden": true, size: 18 }) }), _jsx("button", { "aria-label": "Forward", className: "routed-pane-iconbutton", disabled: !history.canGoForward, title: "Forward", type: "button", onClick: goForward, children: _jsx(CaretRightIcon, { "aria-hidden": true, size: 18 }) })] }), hasSidebar && (_jsx("button", { "aria-controls": "routed-pane-sidebar", "aria-expanded": sidebarExpanded, "aria-label": sidebarLabel, className: "routed-pane-iconbutton", title: sidebarLabel, type: "button", onClick: onToggleSidebar, children: _jsx(SidebarSimpleIcon, { "aria-hidden": true, size: 18 }) })), tier !== "mobile" && (_jsx("div", { className: "routed-pane-title", children: definition.apps[activeAppId]?.title }))] }), _jsx("div", { className: "routed-pane-appbar-spacer" }), showToolbar && (_jsxs("div", { "aria-label": "Toolbar", className: "routed-pane-toolbar", role: "toolbar", children: [_jsx(WindowTitleBarActionButtons, { actions: toolbarActions, className: "routed-pane-iconbutton" }), refreshItem && (_jsx("button", { "aria-label": refreshItem.label, className: "routed-pane-iconbutton", disabled: refreshItem.disabled, title: refreshItem.label, type: "button", onClick: refreshItem.onClick, children: _jsx(ArrowsClockwiseIcon, { "aria-hidden": true, size: 18 }) }))] }))] }));
22
+ }
23
+ //# sourceMappingURL=RoutedPaneAppBar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RoutedPaneAppBar.js","sourceRoot":"","sources":["../../../home/runner/work/tearleads/tearleads/packages/windowing/src/routed/RoutedPaneAppBar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gDAAgD,CAAC;AACrF,OAAO,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,8CAA8C,CAAC;AACjF,OAAO,EACL,4BAA4B,EAC5B,0BAA0B,GAC3B,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EACL,wBAAwB,EACxB,6BAA6B,EAC7B,wBAAwB,GACzB,MAAM,6BAA6B,CAAC;AAErC,MAAM,UAAU,gBAAgB,CAAC,EAC/B,WAAW,EACX,UAAU,EACV,eAAe,EACf,eAAe,EACf,IA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AAI,CACb,kCACgB,qBAAqB,mBACpB,eAAe,gBAClB,YAAY,EACxB,SAAS,EAAC,wBAAwB,EAClC,KAAK,EAAE,YAAY,EACnB,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,eAAe,YAExB,KAAC,iBAAiB,yBAAa,IAAI,EAAE,EAAE,GAAI,GACpC,CACV,EACA,IAAI,KAAK,QAAQ,IAAI,CACpB,cAAK,SAAS,EAAC,mBAAmB,YAC/B,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,KAAK,GAChC,CACP,IACG,EACN,cAAK,SAAS,EAAC,2BAA2B,GAAG,EAC5C,WAAW,IAAI,CACd,6BACa,SAAS,EACpB,SAAS,EAAC,qBAAqB,EAC/B,IAAI,EAAC,SAAS,aAEd,KAAC,2BAA2B,IAC1B,OAAO,EAAE,cAAc,EACvB,SAAS,EAAC,wBAAwB,GAClC,EACD,WAAW,IAAI,CACd,+BACc,WAAW,CAAC,KAAK,EAC7B,SAAS,EAAC,wBAAwB,EAClC,QAAQ,EAAE,WAAW,CAAC,QAAQ,EAC9B,KAAK,EAAE,WAAW,CAAC,KAAK,EACxB,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,WAAW,CAAC,OAAO,YAE5B,KAAC,mBAAmB,yBAAa,IAAI,EAAE,EAAE,GAAI,GACtC,CACV,IACG,CACP,IACM,CACV,CAAC;AACJ,CAAC","sourcesContent":["import { ArrowsClockwiseIcon } from \"@phosphor-icons/react/dist/csr/ArrowsClockwise\";\nimport { CaretLeftIcon } from \"@phosphor-icons/react/dist/csr/CaretLeft\";\nimport { CaretRightIcon } from \"@phosphor-icons/react/dist/csr/CaretRight\";\nimport { SidebarSimpleIcon } from \"@phosphor-icons/react/dist/csr/SidebarSimple\";\nimport {\n useLauncherNavigationActions,\n useLauncherNavigationState,\n} from \"../launcher/LauncherNavigationProvider\";\nimport type { RoutedLayoutTier } from \"../launcher/useRoutedLayoutTier\";\nimport { WindowTitleBarActionButtons } from \"../window/WindowChromeActions\";\nimport {\n useWindowBackActionValue,\n useWindowRefreshMenuItemValue,\n useWindowTitleBarActions,\n} from \"../window/WindowMenuContext\";\n\nexport function RoutedPaneAppBar({\n activeAppId,\n hasSidebar,\n onToggleSidebar,\n sidebarExpanded,\n tier,\n}: {\n activeAppId: string;\n hasSidebar: boolean;\n onToggleSidebar: () => void;\n sidebarExpanded: boolean;\n tier: RoutedLayoutTier;\n}) {\n const { goBack, goForward } = useLauncherNavigationActions();\n const { definition, history } = useLauncherNavigationState();\n const backAction = useWindowBackActionValue();\n const toolbarActions = useWindowTitleBarActions();\n // The routed shell has no menu bar, so the app's refresh registration — which\n // windowed mode reaches through the View menu — rides the toolbar as a glyph.\n const refreshItem = useWindowRefreshMenuItemValue();\n const backLabel = backAction?.label ?? \"Back\";\n const canGoBack = backAction ? !backAction.disabled : history.canGoBack;\n const sidebarLabel = sidebarExpanded ? \"Hide Sidebar\" : \"Show Sidebar\";\n const showToolbar = toolbarActions.length > 0 || refreshItem !== null;\n\n return (\n <header className=\"routed-pane-appbar\">\n <div className=\"routed-pane-appbar-primary\">\n <div className=\"routed-pane-history-controls\">\n <button\n aria-label={backLabel}\n className=\"routed-pane-iconbutton\"\n disabled={!canGoBack}\n title={backLabel}\n type=\"button\"\n onClick={backAction?.onClick ?? goBack}\n >\n <CaretLeftIcon aria-hidden size={18} />\n </button>\n <button\n aria-label=\"Forward\"\n className=\"routed-pane-iconbutton\"\n disabled={!history.canGoForward}\n title=\"Forward\"\n type=\"button\"\n onClick={goForward}\n >\n <CaretRightIcon aria-hidden size={18} />\n </button>\n </div>\n {hasSidebar && (\n <button\n aria-controls=\"routed-pane-sidebar\"\n aria-expanded={sidebarExpanded}\n aria-label={sidebarLabel}\n className=\"routed-pane-iconbutton\"\n title={sidebarLabel}\n type=\"button\"\n onClick={onToggleSidebar}\n >\n <SidebarSimpleIcon aria-hidden size={18} />\n </button>\n )}\n {tier !== \"mobile\" && (\n <div className=\"routed-pane-title\">\n {definition.apps[activeAppId]?.title}\n </div>\n )}\n </div>\n <div className=\"routed-pane-appbar-spacer\" />\n {showToolbar && (\n <div\n aria-label=\"Toolbar\"\n className=\"routed-pane-toolbar\"\n role=\"toolbar\"\n >\n <WindowTitleBarActionButtons\n actions={toolbarActions}\n className=\"routed-pane-iconbutton\"\n />\n {refreshItem && (\n <button\n aria-label={refreshItem.label}\n className=\"routed-pane-iconbutton\"\n disabled={refreshItem.disabled}\n title={refreshItem.label}\n type=\"button\"\n onClick={refreshItem.onClick}\n >\n <ArrowsClockwiseIcon aria-hidden size={18} />\n </button>\n )}\n </div>\n )}\n </header>\n );\n}\n"]}
@@ -0,0 +1,15 @@
1
+ import { type ReactNode } from "react";
2
+ import type { MiniAppBoundary } from "../launcher/MiniAppWindow.js";
3
+ import type { RoutedLayoutTier } from "../launcher/useRoutedLayoutTier.js";
4
+ /**
5
+ * The routed shell's content pane: the host's top content, then the active
6
+ * mini-app inside the host's boundary. It offers itself to overlays that fill
7
+ * the content pane instead of the screen, so they leave the rail, app bar, and
8
+ * taskbar on screen beside them.
9
+ */
10
+ export declare function RoutedPaneMain({ activeAppId, AppBoundary, contentTop, tier, }: {
11
+ activeAppId: string;
12
+ AppBoundary: MiniAppBoundary;
13
+ contentTop: ReactNode;
14
+ tier: RoutedLayoutTier;
15
+ }): import("react").JSX.Element;