@tearleads/windowing 0.2.10 → 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.
- package/README.md +99 -1
- package/index.d.ts +19 -0
- package/index.js +20 -1
- package/index.js.map +1 -1
- package/launcher/LauncherNavigationProvider.d.ts +71 -0
- package/launcher/LauncherNavigationProvider.js +253 -0
- package/launcher/LauncherNavigationProvider.js.map +1 -0
- package/launcher/MiniAppRouteSegmentsContext.d.ts +19 -0
- package/launcher/MiniAppRouteSegmentsContext.js +26 -0
- package/launcher/MiniAppRouteSegmentsContext.js.map +1 -0
- package/launcher/MiniAppWindow.d.ts +18 -0
- package/launcher/MiniAppWindow.js +41 -0
- package/launcher/MiniAppWindow.js.map +1 -0
- package/launcher/NavigationModeOverrideProvider.d.ts +23 -0
- package/launcher/NavigationModeOverrideProvider.js +31 -0
- package/launcher/NavigationModeOverrideProvider.js.map +1 -0
- package/launcher/NavigationModeSwitch.css +22 -0
- package/launcher/NavigationModeSwitch.d.ts +24 -0
- package/launcher/NavigationModeSwitch.js +40 -0
- package/launcher/NavigationModeSwitch.js.map +1 -0
- package/launcher/breakpoints.d.ts +17 -0
- package/launcher/breakpoints.js +18 -0
- package/launcher/breakpoints.js.map +1 -0
- package/launcher/launcherDefinition.d.ts +39 -0
- package/launcher/launcherDefinition.js +18 -0
- package/launcher/launcherDefinition.js.map +1 -0
- package/launcher/navigationHistory.d.ts +16 -0
- package/launcher/navigationHistory.js +48 -0
- package/launcher/navigationHistory.js.map +1 -0
- package/launcher/navigationMode.d.ts +31 -0
- package/launcher/navigationMode.js +35 -0
- package/launcher/navigationMode.js.map +1 -0
- package/launcher/routePaths.d.ts +17 -0
- package/launcher/routePaths.js +46 -0
- package/launcher/routePaths.js.map +1 -0
- package/launcher/routedPathNavigator.d.ts +20 -0
- package/launcher/routedPathNavigator.js +36 -0
- package/launcher/routedPathNavigator.js.map +1 -0
- package/launcher/storedPreference.d.ts +7 -0
- package/launcher/storedPreference.js +43 -0
- package/launcher/storedPreference.js.map +1 -0
- package/launcher/useActiveLauncherRoute.d.ts +14 -0
- package/launcher/useActiveLauncherRoute.js +41 -0
- package/launcher/useActiveLauncherRoute.js.map +1 -0
- package/launcher/useCompactRoutedMode.d.ts +2 -0
- package/launcher/useCompactRoutedMode.js +9 -0
- package/launcher/useCompactRoutedMode.js.map +1 -0
- package/launcher/useMiniAppRouteState.d.ts +14 -0
- package/launcher/useMiniAppRouteState.js +15 -0
- package/launcher/useMiniAppRouteState.js.map +1 -0
- package/launcher/useNavigationMode.d.ts +23 -0
- package/launcher/useNavigationMode.js +34 -0
- package/launcher/useNavigationMode.js.map +1 -0
- package/launcher/useNavigationModeDocumentAttribute.d.ts +16 -0
- package/launcher/useNavigationModeDocumentAttribute.js +24 -0
- package/launcher/useNavigationModeDocumentAttribute.js.map +1 -0
- package/launcher/useRoutedLayoutActive.d.ts +25 -0
- package/launcher/useRoutedLayoutActive.js +69 -0
- package/launcher/useRoutedLayoutActive.js.map +1 -0
- package/launcher/useRoutedLayoutTier.d.ts +17 -0
- package/launcher/useRoutedLayoutTier.js +24 -0
- package/launcher/useRoutedLayoutTier.js.map +1 -0
- package/package.json +1 -1
- package/routed/RoutedPane.css +393 -0
- package/routed/RoutedPane.d.ts +63 -0
- package/routed/RoutedPane.js +91 -0
- package/routed/RoutedPane.js.map +1 -0
- package/routed/RoutedPaneAppBar.d.ts +8 -0
- package/routed/RoutedPaneAppBar.js +23 -0
- package/routed/RoutedPaneAppBar.js.map +1 -0
- package/routed/RoutedPaneMain.d.ts +15 -0
- package/routed/RoutedPaneMain.js +27 -0
- package/routed/RoutedPaneMain.js.map +1 -0
- package/routed/RoutedPaneNav.css +298 -0
- package/routed/RoutedPaneNav.d.ts +20 -0
- package/routed/RoutedPaneNav.js +106 -0
- package/routed/RoutedPaneNav.js.map +1 -0
- package/routed/RoutedPaneOverlayHost.d.ts +37 -0
- package/routed/RoutedPaneOverlayHost.js +29 -0
- package/routed/RoutedPaneOverlayHost.js.map +1 -0
- package/routed/RoutedPanePlacementButton.d.ts +5 -0
- package/routed/RoutedPanePlacementButton.js +10 -0
- package/routed/RoutedPanePlacementButton.js.map +1 -0
- package/routed/RoutedPaneSidebar.css +61 -0
- package/routed/RoutedPaneSidebar.d.ts +7 -0
- package/routed/RoutedPaneSidebar.js +18 -0
- package/routed/RoutedPaneSidebar.js.map +1 -0
- package/routed/RoutedPaneTaskBar.d.ts +24 -0
- package/routed/RoutedPaneTaskBar.js +24 -0
- package/routed/RoutedPaneTaskBar.js.map +1 -0
- package/routed/classNames.d.ts +2 -0
- package/routed/classNames.js +6 -0
- package/routed/classNames.js.map +1 -0
- package/routed/launcherPlacement.d.ts +7 -0
- package/routed/launcherPlacement.js +8 -0
- package/routed/launcherPlacement.js.map +1 -0
- package/routed/useMobileKeyboardVisible.d.ts +7 -0
- package/routed/useMobileKeyboardVisible.js +78 -0
- package/routed/useMobileKeyboardVisible.js.map +1 -0
- package/routed/useMobileSheetDrag.d.ts +10 -0
- package/routed/useMobileSheetDrag.js +83 -0
- package/routed/useMobileSheetDrag.js.map +1 -0
- package/routed/useRoutedPaneOverlays.d.ts +25 -0
- package/routed/useRoutedPaneOverlays.js +72 -0
- package/routed/useRoutedPaneOverlays.js.map +1 -0
- package/tokens.css +24 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo, useState } from "react";
|
|
3
|
+
import { useLauncherNavigationState } from "../launcher/LauncherNavigationProvider.js";
|
|
4
|
+
import { RoutedPaneOverlayHostProvider } from "./RoutedPaneOverlayHost.js";
|
|
5
|
+
/**
|
|
6
|
+
* The routed shell's content pane: the host's top content, then the active
|
|
7
|
+
* mini-app inside the host's boundary. It offers itself to overlays that fill
|
|
8
|
+
* the content pane instead of the screen, so they leave the rail, app bar, and
|
|
9
|
+
* taskbar on screen beside them.
|
|
10
|
+
*/
|
|
11
|
+
export function RoutedPaneMain({ activeAppId, AppBoundary, contentTop, tier, }) {
|
|
12
|
+
const { definition } = useLauncherNavigationState();
|
|
13
|
+
const ActiveMiniApp = useMemo(() => definition.apps[activeAppId]?.createComponent() ?? null, [activeAppId, definition]);
|
|
14
|
+
// Held in state rather than a ref so the overlays that portal into the pane
|
|
15
|
+
// re-render once it is on screen. The ref callback runs in the commit phase
|
|
16
|
+
// and this update flushes before paint, so the pane is already the host by the
|
|
17
|
+
// first frame any overlay inside it can be opened on.
|
|
18
|
+
const [overlayHost, setOverlayHost] = useState(null);
|
|
19
|
+
const overlayHostValue = useMemo(() => ({ host: overlayHost, tier }), [overlayHost, tier]);
|
|
20
|
+
// Programmatically focusable (`tabIndex={-1}`, so never in the tab order),
|
|
21
|
+
// like a window's content pane: an overlay that covered it lands focus here
|
|
22
|
+
// when whatever opened the overlay is gone by the time it closes. Passing the
|
|
23
|
+
// setter itself as the ref keeps its identity stable across renders — an
|
|
24
|
+
// inline callback would detach and reattach the host on every one.
|
|
25
|
+
return (_jsx("main", { className: "routed-pane-main", ref: setOverlayHost, tabIndex: -1, children: _jsxs(RoutedPaneOverlayHostProvider, { value: overlayHostValue, children: [contentTop, ActiveMiniApp && (_jsx(AppBoundary, { appId: activeAppId, children: _jsx(ActiveMiniApp, {}) }))] }) }));
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=RoutedPaneMain.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RoutedPaneMain.js","sourceRoot":"","sources":["../../../home/runner/work/tearleads/tearleads/packages/windowing/src/routed/RoutedPaneMain.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAkB,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAE,0BAA0B,EAAE,MAAM,wCAAwC,CAAC;AAGpF,OAAO,EAAE,6BAA6B,EAAE,MAAM,yBAAyB,CAAC;AAExE;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,EAC7B,WAAW,EACX,WAAW,EACX,UAAU,EACV,IAAI,GAML;IACC,MAAM,EAAE,UAAU,EAAE,GAAG,0BAA0B,EAAE,CAAC;IACpD,MAAM,aAAa,GAAG,OAAO,CAC3B,GAAG,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,eAAe,EAAE,IAAI,IAAI,EAC7D,CAAC,WAAW,EAAE,UAAU,CAAC,CAC1B,CAAC;IACF,4EAA4E;IAC5E,4EAA4E;IAC5E,+EAA+E;IAC/E,sDAAsD;IACtD,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAqB,IAAI,CAAC,CAAC;IACzE,MAAM,gBAAgB,GAAG,OAAO,CAC9B,GAAG,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,EACnC,CAAC,WAAW,EAAE,IAAI,CAAC,CACpB,CAAC;IAEF,2EAA2E;IAC3E,4EAA4E;IAC5E,8EAA8E;IAC9E,yEAAyE;IACzE,mEAAmE;IACnE,OAAO,CACL,eAAM,SAAS,EAAC,kBAAkB,EAAC,GAAG,EAAE,cAAc,EAAE,QAAQ,EAAE,CAAC,CAAC,YAClE,MAAC,6BAA6B,IAAC,KAAK,EAAE,gBAAgB,aACnD,UAAU,EACV,aAAa,IAAI,CAChB,KAAC,WAAW,IAAC,KAAK,EAAE,WAAW,YAC7B,KAAC,aAAa,KAAG,GACL,CACf,IAC6B,GAC3B,CACR,CAAC;AACJ,CAAC","sourcesContent":["import { type ReactNode, useMemo, useState } from \"react\";\nimport { useLauncherNavigationState } from \"../launcher/LauncherNavigationProvider\";\nimport type { MiniAppBoundary } from \"../launcher/MiniAppWindow\";\nimport type { RoutedLayoutTier } from \"../launcher/useRoutedLayoutTier\";\nimport { RoutedPaneOverlayHostProvider } from \"./RoutedPaneOverlayHost\";\n\n/**\n * The routed shell's content pane: the host's top content, then the active\n * mini-app inside the host's boundary. It offers itself to overlays that fill\n * the content pane instead of the screen, so they leave the rail, app bar, and\n * taskbar on screen beside them.\n */\nexport function RoutedPaneMain({\n activeAppId,\n AppBoundary,\n contentTop,\n tier,\n}: {\n activeAppId: string;\n AppBoundary: MiniAppBoundary;\n contentTop: ReactNode;\n tier: RoutedLayoutTier;\n}) {\n const { definition } = useLauncherNavigationState();\n const ActiveMiniApp = useMemo(\n () => definition.apps[activeAppId]?.createComponent() ?? null,\n [activeAppId, definition],\n );\n // Held in state rather than a ref so the overlays that portal into the pane\n // re-render once it is on screen. The ref callback runs in the commit phase\n // and this update flushes before paint, so the pane is already the host by the\n // first frame any overlay inside it can be opened on.\n const [overlayHost, setOverlayHost] = useState<HTMLElement | null>(null);\n const overlayHostValue = useMemo(\n () => ({ host: overlayHost, tier }),\n [overlayHost, tier],\n );\n\n // Programmatically focusable (`tabIndex={-1}`, so never in the tab order),\n // like a window's content pane: an overlay that covered it lands focus here\n // when whatever opened the overlay is gone by the time it closes. Passing the\n // setter itself as the ref keeps its identity stable across renders — an\n // inline callback would detach and reattach the host on every one.\n return (\n <main className=\"routed-pane-main\" ref={setOverlayHost} tabIndex={-1}>\n <RoutedPaneOverlayHostProvider value={overlayHostValue}>\n {contentTop}\n {ActiveMiniApp && (\n <AppBoundary appId={activeAppId}>\n <ActiveMiniApp />\n </AppBoundary>\n )}\n </RoutedPaneOverlayHostProvider>\n </main>\n );\n}\n"]}
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Routed shell navigation surfaces: the tablet rail's app-link panel, the rail
|
|
3
|
+
* itself, and the bottom-sheet app launcher with its scrim. Shell grid,
|
|
4
|
+
* app bar, main, taskbar, and the shared `.routed-pane-iconbutton` live in
|
|
5
|
+
* RoutedPane.css; the tier tokens (--routed-rail-width,
|
|
6
|
+
* --routed-rail-collapsed-width, ...) are declared there on .routed-pane and
|
|
7
|
+
* cascade here.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/* === Navigation panel (tablet rail app links) === */
|
|
11
|
+
|
|
12
|
+
.routed-pane-nav-panel {
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
gap: var(--space-2xs);
|
|
16
|
+
min-width: 0;
|
|
17
|
+
min-height: 0;
|
|
18
|
+
padding: var(--space-sm);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/* Borderless rows: the active/hover fill is the only affordance, so the rail
|
|
22
|
+
reads as a launcher list rather than a stack of buttons. */
|
|
23
|
+
.routed-pane-nav-link {
|
|
24
|
+
border-radius: var(--app-radius-control);
|
|
25
|
+
display: flex;
|
|
26
|
+
align-items: center;
|
|
27
|
+
gap: var(--space-xs);
|
|
28
|
+
min-height: var(--control-height);
|
|
29
|
+
padding: var(--space-xs) var(--space-sm);
|
|
30
|
+
color: inherit;
|
|
31
|
+
text-align: left;
|
|
32
|
+
text-decoration: none;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.routed-pane-nav-link svg {
|
|
36
|
+
flex: 0 0 auto;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.routed-pane-nav-link-label {
|
|
40
|
+
min-width: 0;
|
|
41
|
+
overflow: hidden;
|
|
42
|
+
text-overflow: ellipsis;
|
|
43
|
+
white-space: nowrap;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.routed-pane-nav-link:hover,
|
|
47
|
+
.routed-pane-nav-link:focus-visible,
|
|
48
|
+
.routed-pane-nav-link--active {
|
|
49
|
+
background: var(--emphasis-surface);
|
|
50
|
+
color: var(--emphasis-text);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/* === Tablet rail === */
|
|
54
|
+
|
|
55
|
+
.routed-pane-rail {
|
|
56
|
+
grid-area: rail;
|
|
57
|
+
display: flex;
|
|
58
|
+
flex-direction: column;
|
|
59
|
+
/* The rail owns the screen's leading edge on tablet: widen by the landscape
|
|
60
|
+
inset and pad the content past it so nav stays clear of the cutout. */
|
|
61
|
+
width: calc(var(--routed-rail-width) + var(--safe-area-left));
|
|
62
|
+
padding-top: var(--safe-area-top);
|
|
63
|
+
padding-left: var(--safe-area-left);
|
|
64
|
+
min-height: 0;
|
|
65
|
+
overflow: hidden;
|
|
66
|
+
border-right: var(--border-strong);
|
|
67
|
+
background: var(--color-muted);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.routed-pane-rail--collapsed {
|
|
71
|
+
width: calc(var(--routed-rail-collapsed-width) + var(--safe-area-left));
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/* The rail toggle keeps its top-right corner beside the app bar's Back button.
|
|
75
|
+
Both surfaces absorb the same safe-area inset; this margin matches the app
|
|
76
|
+
bar's top padding so their 44px controls line up. */
|
|
77
|
+
.routed-pane-rail-toggle {
|
|
78
|
+
align-self: flex-end;
|
|
79
|
+
margin-block-start: var(--space-xs);
|
|
80
|
+
margin-inline-end: var(--space-sm);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.routed-pane-rail--collapsed .routed-pane-rail-toggle {
|
|
84
|
+
align-self: center;
|
|
85
|
+
margin-inline-end: 0;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/* Keep the placement action at the foot of the launcher, away from the rail
|
|
89
|
+
toggle and app links, with room for a bottom device inset. */
|
|
90
|
+
.routed-pane-rail > .routed-pane-placement-button {
|
|
91
|
+
align-self: flex-end;
|
|
92
|
+
margin-block-start: auto;
|
|
93
|
+
margin-block-end: max(var(--space-sm), var(--safe-area-bottom));
|
|
94
|
+
margin-inline-end: var(--space-sm);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.routed-pane-rail--collapsed > .routed-pane-placement-button {
|
|
98
|
+
align-self: center;
|
|
99
|
+
margin-inline-end: 0;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.routed-pane-rail .routed-pane-nav-panel {
|
|
103
|
+
flex: 1 1 auto;
|
|
104
|
+
overflow-y: auto;
|
|
105
|
+
scrollbar-gutter: var(--scrollbar-gutter);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/* === Bottom sheet + scrim === */
|
|
109
|
+
|
|
110
|
+
.routed-pane-scrim {
|
|
111
|
+
position: absolute;
|
|
112
|
+
inset: 0;
|
|
113
|
+
z-index: 1;
|
|
114
|
+
margin: 0;
|
|
115
|
+
padding: 0;
|
|
116
|
+
border: 0;
|
|
117
|
+
background: var(--overlay-background);
|
|
118
|
+
cursor: pointer;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.routed-pane-scrim:focus-visible {
|
|
122
|
+
outline: var(--border-strong);
|
|
123
|
+
outline-offset: calc(-2 * var(--border-width));
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.routed-pane-sheet {
|
|
127
|
+
border-radius: var(--app-radius-surface) var(--app-radius-surface) 0 0;
|
|
128
|
+
box-shadow: var(--app-shadow-surface);
|
|
129
|
+
position: absolute;
|
|
130
|
+
inset-inline: 0;
|
|
131
|
+
inset-block-end: 0;
|
|
132
|
+
z-index: 2;
|
|
133
|
+
max-height: min(70vh, 32rem);
|
|
134
|
+
overflow-y: auto;
|
|
135
|
+
scrollbar-gutter: var(--scrollbar-gutter);
|
|
136
|
+
padding-bottom: max(var(--space-sm), var(--safe-area-bottom));
|
|
137
|
+
padding-inline: var(--safe-area-left) var(--safe-area-right);
|
|
138
|
+
border-top: var(--border-strong);
|
|
139
|
+
background: var(--color-muted);
|
|
140
|
+
transform: translateY(100%);
|
|
141
|
+
/* `visibility: hidden` takes the off-screen sheet out of the tab order and
|
|
142
|
+
the accessibility tree while closed; the delayed transition keeps it
|
|
143
|
+
visible through the slide-out so the animation still plays. */
|
|
144
|
+
visibility: hidden;
|
|
145
|
+
transition:
|
|
146
|
+
transform var(--transition),
|
|
147
|
+
visibility 0s linear 0.18s;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.routed-pane-sheet[data-open="true"] {
|
|
151
|
+
transform: translateY(0);
|
|
152
|
+
visibility: visible;
|
|
153
|
+
transition:
|
|
154
|
+
transform var(--transition),
|
|
155
|
+
visibility 0s;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.routed-pane-sheet-header {
|
|
159
|
+
position: sticky;
|
|
160
|
+
top: 0;
|
|
161
|
+
z-index: 1;
|
|
162
|
+
background: var(--color-muted);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.routed-pane-sheet-header .routed-pane-placement-button {
|
|
166
|
+
position: absolute;
|
|
167
|
+
inset-block-start: 0;
|
|
168
|
+
inset-inline-end: var(--space-sm);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.routed-pane-sheet-handle {
|
|
172
|
+
display: flex;
|
|
173
|
+
align-items: center;
|
|
174
|
+
justify-content: center;
|
|
175
|
+
width: 100%;
|
|
176
|
+
min-height: var(--control-height);
|
|
177
|
+
padding: var(--space-xs) 0;
|
|
178
|
+
border: 0;
|
|
179
|
+
background: var(--color-muted);
|
|
180
|
+
color: inherit;
|
|
181
|
+
cursor: grab;
|
|
182
|
+
touch-action: none;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.routed-pane-sheet-handle:active,
|
|
186
|
+
.routed-pane-sheet-handle[data-dragging="true"] {
|
|
187
|
+
cursor: grabbing;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.routed-pane-sheet-handle span {
|
|
191
|
+
display: block;
|
|
192
|
+
width: 2.5rem;
|
|
193
|
+
height: 0.25rem;
|
|
194
|
+
border-radius: 999px;
|
|
195
|
+
background: currentColor;
|
|
196
|
+
opacity: var(--opacity-muted);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.routed-pane-sheet-handle:hover span,
|
|
200
|
+
.routed-pane-sheet-handle:focus-visible span {
|
|
201
|
+
opacity: 1;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.routed-pane-sheet[data-dragging="true"] {
|
|
205
|
+
transition: none;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/*
|
|
209
|
+
* Launcher tiles — square icon-and-label cells (mirrors Explorer's New Document
|
|
210
|
+
* grid) so the sheet reads as an app launcher rather than a menu list.
|
|
211
|
+
*
|
|
212
|
+
* Use a two-column phone layout with tracks wide enough for the longest app
|
|
213
|
+
* name. Android WebView can inflate an individual text node for the system
|
|
214
|
+
* "Font size" setting without changing its grid container's `em` size, so an
|
|
215
|
+
* auto-fit grid cannot reliably reduce its column count as text grows. Keep
|
|
216
|
+
* narrow phones explicitly two columns, including the supported 320px viewport;
|
|
217
|
+
* wider routed layouts gain columns naturally.
|
|
218
|
+
*/
|
|
219
|
+
.routed-pane-sheet-grid {
|
|
220
|
+
display: grid;
|
|
221
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
222
|
+
gap: var(--space-sm);
|
|
223
|
+
padding: var(--space-sm);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
@media (min-width: 30rem) {
|
|
227
|
+
.routed-pane-sheet-grid {
|
|
228
|
+
grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
@media (min-width: 90rem) {
|
|
233
|
+
.routed-pane-sheet-grid {
|
|
234
|
+
/* Bound each square on wide desktops while tablet rows stay compact. */
|
|
235
|
+
grid-template-columns: repeat(auto-fit, minmax(10rem, 12rem));
|
|
236
|
+
justify-content: center;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
.routed-pane-sheet-tile {
|
|
241
|
+
border-radius: var(--app-radius-surface);
|
|
242
|
+
display: flex;
|
|
243
|
+
flex-direction: column;
|
|
244
|
+
align-items: center;
|
|
245
|
+
justify-content: center;
|
|
246
|
+
gap: var(--space-xs);
|
|
247
|
+
aspect-ratio: 1;
|
|
248
|
+
padding: var(--space-sm);
|
|
249
|
+
border: var(--border);
|
|
250
|
+
border-color: var(--app-control-border);
|
|
251
|
+
background: var(--color-light);
|
|
252
|
+
color: inherit;
|
|
253
|
+
font: inherit;
|
|
254
|
+
text-align: center;
|
|
255
|
+
text-decoration: none;
|
|
256
|
+
cursor: pointer;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.routed-pane-sheet-tile:hover,
|
|
260
|
+
.routed-pane-sheet-tile:focus-visible,
|
|
261
|
+
.routed-pane-sheet-tile--active {
|
|
262
|
+
background: var(--emphasis-surface);
|
|
263
|
+
color: var(--emphasis-text);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.routed-pane-sheet-tile svg {
|
|
267
|
+
flex: 0 0 auto;
|
|
268
|
+
/* The tiles widen with the viewport; keep the artwork at roughly a third of
|
|
269
|
+
each square instead of leaving a fixed 32px icon in a large tile. */
|
|
270
|
+
width: clamp(3rem, 34%, 5rem);
|
|
271
|
+
height: auto;
|
|
272
|
+
aspect-ratio: 1;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.routed-pane-sheet-tile-label {
|
|
276
|
+
overflow-wrap: anywhere;
|
|
277
|
+
line-height: 1.2;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/* Touch spacing between the enlarged nav targets (see the sizing note in
|
|
281
|
+
RoutedPane.css — --control-height already resolves to 44px in routed mode;
|
|
282
|
+
only the inter-target gaps need the bump). */
|
|
283
|
+
:root[data-navigation-mode="routed"] .routed-pane-nav-panel {
|
|
284
|
+
gap: var(--space-xs);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/*
|
|
288
|
+
* Keep the JS tier and CSS in lockstep at the 760px line
|
|
289
|
+
* (ROUTED_TABLET_BREAKPOINT_PX, guarded by breakpoints.test.ts). Below it the
|
|
290
|
+
* mobile shell is active; this prevents a brief tablet-rail flash if markup
|
|
291
|
+
* renders before the tier hook resolves. The matching grid collapse lives in
|
|
292
|
+
* RoutedPane.css.
|
|
293
|
+
*/
|
|
294
|
+
@media (max-width: 759px) {
|
|
295
|
+
.routed-pane--tablet .routed-pane-rail {
|
|
296
|
+
display: none;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { RoutedLayoutTier } from "../launcher/useRoutedLayoutTier.js";
|
|
2
|
+
import type { LauncherPlacement } from "./launcherPlacement.js";
|
|
3
|
+
export declare const ROUTED_PANE_NAV_PANEL_ID = "routed-pane-nav-panel";
|
|
4
|
+
/**
|
|
5
|
+
* The navigation surface in its tier-appropriate container: a persistent
|
|
6
|
+
* `<aside>` rail in tablet side mode, or a bottom sheet of launcher tiles (plus
|
|
7
|
+
* dismiss scrim) on mobile and in tablet bottom mode.
|
|
8
|
+
*/
|
|
9
|
+
export declare function RoutedPaneNav({ activeAppId, appIds, drawerOpen, launcherPlacement, onCloseDrawer, onNavigateRail, onToggleLauncherPlacement, onToggleRail, railExpanded, tier, }: {
|
|
10
|
+
activeAppId: string;
|
|
11
|
+
appIds: ReadonlyArray<string>;
|
|
12
|
+
drawerOpen: boolean;
|
|
13
|
+
launcherPlacement: LauncherPlacement;
|
|
14
|
+
onCloseDrawer: () => void;
|
|
15
|
+
onNavigateRail: () => void;
|
|
16
|
+
onToggleLauncherPlacement: () => void;
|
|
17
|
+
onToggleRail: () => void;
|
|
18
|
+
railExpanded: boolean;
|
|
19
|
+
tier: RoutedLayoutTier;
|
|
20
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { SidebarSimpleIcon } from "@phosphor-icons/react/dist/csr/SidebarSimple";
|
|
3
|
+
import { useCallback, useEffect, useMemo, useRef, } from "react";
|
|
4
|
+
import { useLauncherNavigationActions, useLauncherNavigationState, } from "../launcher/LauncherNavigationProvider.js";
|
|
5
|
+
import { classNames } from "./classNames.js";
|
|
6
|
+
import { RoutedPanePlacementButton } from "./RoutedPanePlacementButton.js";
|
|
7
|
+
import { useMobileSheetDrag } from "./useMobileSheetDrag.js";
|
|
8
|
+
import "./RoutedPaneNav.css";
|
|
9
|
+
export const ROUTED_PANE_NAV_PANEL_ID = "routed-pane-nav-panel";
|
|
10
|
+
// The launcher entries, in the order given, labeled from the definition.
|
|
11
|
+
function useRoutedPaneNavItems(appIds) {
|
|
12
|
+
const { definition } = useLauncherNavigationState();
|
|
13
|
+
return useMemo(() => appIds.flatMap((appId) => {
|
|
14
|
+
const app = definition.apps[appId];
|
|
15
|
+
return app ? [{ appId, icon: app.icon, label: app.title }] : [];
|
|
16
|
+
}), [appIds, definition]);
|
|
17
|
+
}
|
|
18
|
+
// Let the browser handle modified clicks (Cmd/Ctrl/Shift/Alt + click,
|
|
19
|
+
// middle-click) so the href still opens in a new tab/window; only intercept
|
|
20
|
+
// a plain left-click for in-app navigation.
|
|
21
|
+
function isBrowserHandledNavClick(event) {
|
|
22
|
+
return (event.button !== 0 ||
|
|
23
|
+
event.metaKey ||
|
|
24
|
+
event.ctrlKey ||
|
|
25
|
+
event.shiftKey ||
|
|
26
|
+
event.altKey);
|
|
27
|
+
}
|
|
28
|
+
function RoutedPaneNavLink({ appId, activeAppId, icon: LinkIcon, label, onNavigate, }) {
|
|
29
|
+
const { getMiniAppHref, openMiniApp } = useLauncherNavigationActions();
|
|
30
|
+
const handleClick = useCallback((event) => {
|
|
31
|
+
if (isBrowserHandledNavClick(event)) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
event.preventDefault();
|
|
35
|
+
openMiniApp({ appId });
|
|
36
|
+
onNavigate();
|
|
37
|
+
}, [appId, onNavigate, openMiniApp]);
|
|
38
|
+
return (_jsxs("a", { "aria-current": activeAppId === appId ? "page" : undefined, className: classNames("routed-pane-nav-link", activeAppId === appId && "routed-pane-nav-link--active"), href: getMiniAppHref(appId), onClick: handleClick, children: [LinkIcon && _jsx(LinkIcon, { "aria-hidden": "true", size: 20 }), _jsx("span", { className: "routed-pane-nav-link-label", children: label })] }));
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The tablet rail's navigation surface: an icon-and-label link per routed
|
|
42
|
+
* mini-app. System commands and per-app file/view actions belong to the app bar
|
|
43
|
+
* toolbar at the top of the shell.
|
|
44
|
+
*/
|
|
45
|
+
function RoutedPaneNavPanel({ activeAppId, appIds, id, onNavigate, }) {
|
|
46
|
+
const visibleNavItems = useRoutedPaneNavItems(appIds);
|
|
47
|
+
return (_jsx("nav", { "aria-label": "Apps", className: "routed-pane-nav-panel", id: id, children: visibleNavItems.map(({ appId, icon, label }) => (_jsx(RoutedPaneNavLink, { activeAppId: activeAppId, appId: appId, icon: icon, label: label, onNavigate: onNavigate }, appId))) }));
|
|
48
|
+
}
|
|
49
|
+
function RoutedPaneRailToggle({ expanded, onToggle, }) {
|
|
50
|
+
const label = expanded
|
|
51
|
+
? "Collapse navigation rail"
|
|
52
|
+
: "Expand navigation rail";
|
|
53
|
+
return (_jsx("button", { "aria-controls": expanded ? ROUTED_PANE_NAV_PANEL_ID : undefined, "aria-expanded": expanded, "aria-label": label, className: "routed-pane-iconbutton routed-pane-rail-toggle", title: label, type: "button", onClick: onToggle, children: _jsx(SidebarSimpleIcon, { "aria-hidden": "true", size: 18 }) }));
|
|
54
|
+
}
|
|
55
|
+
function RoutedPaneMobileNavTile({ active, href, icon: TileIcon, label, onSelect, }) {
|
|
56
|
+
return (_jsxs("a", { "aria-current": active ? "page" : undefined, className: classNames("routed-pane-sheet-tile", active && "routed-pane-sheet-tile--active"), href: href, onClick: (event) => {
|
|
57
|
+
if (isBrowserHandledNavClick(event)) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
event.preventDefault();
|
|
61
|
+
onSelect();
|
|
62
|
+
}, children: [TileIcon && _jsx(TileIcon, { "aria-hidden": "true", size: 32 }), _jsx("span", { className: "routed-pane-sheet-tile-label", children: label })] }));
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* The bottom-sheet navigation: every routed mini-app as a grid of square
|
|
66
|
+
* icon-and-label tiles (styled after Explorer's New Document screen). Like the
|
|
67
|
+
* tablet rail it carries no per-app contextual actions. Selecting a tile
|
|
68
|
+
* navigates and dismisses.
|
|
69
|
+
*/
|
|
70
|
+
function RoutedPaneMobileNav({ activeAppId, appIds, onNavigate, }) {
|
|
71
|
+
const { getMiniAppHref, openMiniApp } = useLauncherNavigationActions();
|
|
72
|
+
const visibleNavItems = useRoutedPaneNavItems(appIds);
|
|
73
|
+
return (_jsx("nav", { "aria-label": "Apps", className: "routed-pane-sheet-grid", children: visibleNavItems.map(({ appId, icon, label }) => (_jsx(RoutedPaneMobileNavTile, { active: activeAppId === appId, href: getMiniAppHref(appId), icon: icon, label: label, onSelect: () => {
|
|
74
|
+
openMiniApp({ appId });
|
|
75
|
+
onNavigate();
|
|
76
|
+
} }, appId))) }));
|
|
77
|
+
}
|
|
78
|
+
function RoutedPaneMobileSheetHandle({ dragging, onClick, onPointerDown, }) {
|
|
79
|
+
return (_jsx("button", { "aria-label": "Dismiss menu", className: "routed-pane-sheet-handle", "data-dragging": dragging ? "true" : "false", type: "button", onClick: onClick, onPointerDown: onPointerDown, children: _jsx("span", { "aria-hidden": "true" }) }));
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* The navigation surface in its tier-appropriate container: a persistent
|
|
83
|
+
* `<aside>` rail in tablet side mode, or a bottom sheet of launcher tiles (plus
|
|
84
|
+
* dismiss scrim) on mobile and in tablet bottom mode.
|
|
85
|
+
*/
|
|
86
|
+
export function RoutedPaneNav({ activeAppId, appIds, drawerOpen, launcherPlacement, onCloseDrawer, onNavigateRail, onToggleLauncherPlacement, onToggleRail, railExpanded, tier, }) {
|
|
87
|
+
const sheetRef = useRef(null);
|
|
88
|
+
useEffect(() => {
|
|
89
|
+
if (drawerOpen && (tier === "mobile" || launcherPlacement === "bottom")) {
|
|
90
|
+
const sheet = sheetRef.current;
|
|
91
|
+
const tile = sheet?.querySelector('.routed-pane-sheet-tile[aria-current="page"]');
|
|
92
|
+
(tile ?? sheet?.querySelector(".routed-pane-sheet-tile"))?.focus();
|
|
93
|
+
}
|
|
94
|
+
}, [drawerOpen, launcherPlacement, tier]);
|
|
95
|
+
const mobileSheetDrag = useMobileSheetDrag({
|
|
96
|
+
drawerOpen: (tier === "mobile" || launcherPlacement === "bottom") && drawerOpen,
|
|
97
|
+
onClose: onCloseDrawer,
|
|
98
|
+
});
|
|
99
|
+
if (tier === "tablet" && launcherPlacement === "side") {
|
|
100
|
+
return (_jsxs("aside", { className: classNames("routed-pane-rail", !railExpanded && "routed-pane-rail--collapsed"), "data-state": railExpanded ? "open" : "closed", children: [_jsx(RoutedPaneRailToggle, { expanded: railExpanded, onToggle: onToggleRail }), railExpanded && (_jsx(RoutedPaneNavPanel, { activeAppId: activeAppId, appIds: appIds, id: ROUTED_PANE_NAV_PANEL_ID, onNavigate: onNavigateRail })), _jsx(RoutedPanePlacementButton, { launcherPlacement: launcherPlacement, onToggle: onToggleLauncherPlacement })] }));
|
|
101
|
+
}
|
|
102
|
+
return (_jsxs(_Fragment, { children: [drawerOpen && (_jsx("button", { "aria-label": "Close menu", className: "routed-pane-scrim", type: "button", onClick: onCloseDrawer })), _jsxs("aside", { "aria-hidden": !drawerOpen, className: "routed-pane-sheet", ref: sheetRef, "data-dragging": mobileSheetDrag.dragging ? "true" : "false", "data-open": drawerOpen ? "true" : "false", id: "routed-pane-sheet", style: drawerOpen && mobileSheetDrag.dragOffset > 0
|
|
103
|
+
? { transform: `translateY(${mobileSheetDrag.dragOffset}px)` }
|
|
104
|
+
: undefined, children: [_jsxs("div", { className: "routed-pane-sheet-header", children: [_jsx(RoutedPaneMobileSheetHandle, { dragging: mobileSheetDrag.dragging, onClick: mobileSheetDrag.handleClick, onPointerDown: mobileSheetDrag.handlePointerDown }), tier === "tablet" && (_jsx(RoutedPanePlacementButton, { launcherPlacement: launcherPlacement, onToggle: onToggleLauncherPlacement }))] }), _jsx(RoutedPaneMobileNav, { activeAppId: activeAppId, appIds: appIds, onNavigate: onCloseDrawer })] })] }));
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=RoutedPaneNav.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RoutedPaneNav.js","sourceRoot":"","sources":["../../../home/runner/work/tearleads/tearleads/packages/windowing/src/routed/RoutedPaneNav.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,8CAA8C,CAAC;AACjF,OAAO,EAGL,WAAW,EACX,SAAS,EACT,OAAO,EACP,MAAM,GACP,MAAM,OAAO,CAAC;AAEf,OAAO,EACL,4BAA4B,EAC5B,0BAA0B,GAC3B,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,qBAAqB,CAAC;AAE7B,MAAM,CAAC,MAAM,wBAAwB,GAAG,uBAAuB,CAAC;AAQhE,yEAAyE;AACzE,SAAS,qBAAqB,CAC5B,MAA6B;IAE7B,MAAM,EAAE,UAAU,EAAE,GAAG,0BAA0B,EAAE,CAAC;IACpD,OAAO,OAAO,CACZ,GAAG,EAAE,CACH,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;QACvB,MAAM,GAAG,GAAG,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACnC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAClE,CAAC,CAAC,EACJ,CAAC,MAAM,EAAE,UAAU,CAAC,CACrB,CAAC;AACJ,CAAC;AAED,sEAAsE;AACtE,4EAA4E;AAC5E,4CAA4C;AAC5C,SAAS,wBAAwB,CAC/B,KAAyC;IAEzC,OAAO,CACL,KAAK,CAAC,MAAM,KAAK,CAAC;QAClB,KAAK,CAAC,OAAO;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IACJ,CAAC;IAED,OAAO,CACL,8BACG,UAAU,IAAI,CACb,+BACa,YAAY,EACvB,SAAS,EAAC,mBAAmB,EAC7B,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,aAAa,GACtB,CACH,EACD,gCACe,CAAC,UAAU,EACxB,SAAS,EAAC,mBAAmB,EAC7B,GAAG,EAAE,QAAQ,mBACE,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,eAC/C,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EACxC,EAAE,EAAC,mBAAmB,EACtB,KAAK,EACH,UAAU,IAAI,eAAe,CAAC,UAAU,GAAG,CAAC;oBAC1C,CAAC,CAAC,EAAE,SAAS,EAAE,cAAc,eAAe,CAAC,UAAU,KAAK,EAAE;oBAC9D,CAAC,CAAC,SAAS,aAGf,eAAK,SAAS,EAAC,0BAA0B,aACvC,KAAC,2BAA2B,IAC1B,QAAQ,EAAE,eAAe,CAAC,QAAQ,EAClC,OAAO,EAAE,eAAe,CAAC,WAAW,EACpC,aAAa,EAAE,eAAe,CAAC,iBAAiB,GAChD,EACD,IAAI,KAAK,QAAQ,IAAI,CACpB,KAAC,yBAAyB,IACxB,iBAAiB,EAAE,iBAAiB,EACpC,QAAQ,EAAE,yBAAyB,GACnC,CACH,IACG,EACN,KAAC,mBAAmB,IAClB,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,aAAa,GACzB,IACI,IACP,CACJ,CAAC;AACJ,CAAC","sourcesContent":["import { SidebarSimpleIcon } from \"@phosphor-icons/react/dist/csr/SidebarSimple\";\nimport {\n type MouseEvent as ReactMouseEvent,\n type PointerEvent as ReactPointerEvent,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n} from \"react\";\nimport type { WindowingIcon } from \"../icons/windowingIcon\";\nimport {\n useLauncherNavigationActions,\n useLauncherNavigationState,\n} from \"../launcher/LauncherNavigationProvider\";\nimport type { RoutedLayoutTier } from \"../launcher/useRoutedLayoutTier\";\nimport { classNames } from \"./classNames\";\nimport type { LauncherPlacement } from \"./launcherPlacement\";\nimport { RoutedPanePlacementButton } from \"./RoutedPanePlacementButton\";\nimport { useMobileSheetDrag } from \"./useMobileSheetDrag\";\nimport \"./RoutedPaneNav.css\";\n\nexport const ROUTED_PANE_NAV_PANEL_ID = \"routed-pane-nav-panel\";\n\ninterface RoutedPaneNavItem {\n appId: string;\n icon: WindowingIcon | undefined;\n label: string;\n}\n\n// The launcher entries, in the order given, labeled from the definition.\nfunction useRoutedPaneNavItems(\n appIds: ReadonlyArray<string>,\n): ReadonlyArray<RoutedPaneNavItem> {\n const { definition } = useLauncherNavigationState();\n return useMemo(\n () =>\n appIds.flatMap((appId) => {\n const app = definition.apps[appId];\n return app ? [{ appId, icon: app.icon, label: app.title }] : [];\n }),\n [appIds, definition],\n );\n}\n\n// Let the browser handle modified clicks (Cmd/Ctrl/Shift/Alt + click,\n// middle-click) so the href still opens in a new tab/window; only intercept\n// a plain left-click for in-app navigation.\nfunction isBrowserHandledNavClick(\n event: ReactMouseEvent<HTMLAnchorElement>,\n): boolean {\n return (\n event.button !== 0 ||\n event.metaKey ||\n event.ctrlKey ||\n event.shiftKey ||\n event.altKey\n );\n}\n\nfunction RoutedPaneNavLink({\n appId,\n activeAppId,\n icon: LinkIcon,\n label,\n onNavigate,\n}: {\n appId: string;\n activeAppId: string;\n icon: WindowingIcon | undefined;\n label: string;\n onNavigate: () => void;\n}) {\n const { getMiniAppHref, openMiniApp } = useLauncherNavigationActions();\n const handleClick = useCallback(\n (event: ReactMouseEvent<HTMLAnchorElement>) => {\n if (isBrowserHandledNavClick(event)) {\n return;\n }\n event.preventDefault();\n openMiniApp({ appId });\n onNavigate();\n },\n [appId, onNavigate, openMiniApp],\n );\n\n return (\n <a\n aria-current={activeAppId === appId ? \"page\" : undefined}\n className={classNames(\n \"routed-pane-nav-link\",\n activeAppId === appId && \"routed-pane-nav-link--active\",\n )}\n href={getMiniAppHref(appId)}\n onClick={handleClick}\n >\n {LinkIcon && <LinkIcon aria-hidden=\"true\" size={20} />}\n <span className=\"routed-pane-nav-link-label\">{label}</span>\n </a>\n );\n}\n\n/**\n * The tablet rail's navigation surface: an icon-and-label link per routed\n * mini-app. System commands and per-app file/view actions belong to the app bar\n * toolbar at the top of the shell.\n */\nfunction RoutedPaneNavPanel({\n activeAppId,\n appIds,\n id,\n onNavigate,\n}: {\n activeAppId: string;\n appIds: ReadonlyArray<string>;\n id: string;\n onNavigate: () => void;\n}) {\n const visibleNavItems = useRoutedPaneNavItems(appIds);\n return (\n <nav aria-label=\"Apps\" className=\"routed-pane-nav-panel\" id={id}>\n {visibleNavItems.map(({ appId, icon, label }) => (\n <RoutedPaneNavLink\n key={appId}\n activeAppId={activeAppId}\n appId={appId}\n icon={icon}\n label={label}\n onNavigate={onNavigate}\n />\n ))}\n </nav>\n );\n}\n\nfunction RoutedPaneRailToggle({\n expanded,\n onToggle,\n}: {\n expanded: boolean;\n onToggle: () => void;\n}) {\n const label = expanded\n ? \"Collapse navigation rail\"\n : \"Expand navigation rail\";\n\n return (\n <button\n aria-controls={expanded ? ROUTED_PANE_NAV_PANEL_ID : undefined}\n aria-expanded={expanded}\n aria-label={label}\n className=\"routed-pane-iconbutton routed-pane-rail-toggle\"\n title={label}\n type=\"button\"\n onClick={onToggle}\n >\n <SidebarSimpleIcon aria-hidden=\"true\" size={18} />\n </button>\n );\n}\n\nfunction RoutedPaneMobileNavTile({\n active,\n href,\n icon: TileIcon,\n label,\n onSelect,\n}: {\n active: boolean;\n href: string;\n icon: WindowingIcon | undefined;\n label: string;\n onSelect: () => void;\n}) {\n return (\n <a\n aria-current={active ? \"page\" : undefined}\n className={classNames(\n \"routed-pane-sheet-tile\",\n active && \"routed-pane-sheet-tile--active\",\n )}\n href={href}\n onClick={(event) => {\n if (isBrowserHandledNavClick(event)) {\n return;\n }\n event.preventDefault();\n onSelect();\n }}\n >\n {TileIcon && <TileIcon aria-hidden=\"true\" size={32} />}\n <span className=\"routed-pane-sheet-tile-label\">{label}</span>\n </a>\n );\n}\n\n/**\n * The bottom-sheet navigation: every routed mini-app as a grid of square\n * icon-and-label tiles (styled after Explorer's New Document screen). Like the\n * tablet rail it carries no per-app contextual actions. Selecting a tile\n * navigates and dismisses.\n */\nfunction RoutedPaneMobileNav({\n activeAppId,\n appIds,\n onNavigate,\n}: {\n activeAppId: string;\n appIds: ReadonlyArray<string>;\n onNavigate: () => void;\n}) {\n const { getMiniAppHref, openMiniApp } = useLauncherNavigationActions();\n const visibleNavItems = useRoutedPaneNavItems(appIds);\n\n return (\n <nav aria-label=\"Apps\" className=\"routed-pane-sheet-grid\">\n {visibleNavItems.map(({ appId, icon, label }) => (\n <RoutedPaneMobileNavTile\n key={appId}\n active={activeAppId === appId}\n href={getMiniAppHref(appId)}\n icon={icon}\n label={label}\n onSelect={() => {\n openMiniApp({ appId });\n onNavigate();\n }}\n />\n ))}\n </nav>\n );\n}\n\nfunction RoutedPaneMobileSheetHandle({\n dragging,\n onClick,\n onPointerDown,\n}: {\n dragging: boolean;\n onClick: (event: ReactMouseEvent<HTMLButtonElement>) => void;\n onPointerDown: (event: ReactPointerEvent<HTMLButtonElement>) => void;\n}) {\n return (\n <button\n aria-label=\"Dismiss menu\"\n className=\"routed-pane-sheet-handle\"\n data-dragging={dragging ? \"true\" : \"false\"}\n type=\"button\"\n onClick={onClick}\n onPointerDown={onPointerDown}\n >\n <span aria-hidden=\"true\" />\n </button>\n );\n}\n\n/**\n * The navigation surface in its tier-appropriate container: a persistent\n * `<aside>` rail in tablet side mode, or a bottom sheet of launcher tiles (plus\n * dismiss scrim) on mobile and in tablet bottom mode.\n */\nexport function RoutedPaneNav({\n activeAppId,\n appIds,\n drawerOpen,\n launcherPlacement,\n onCloseDrawer,\n onNavigateRail,\n onToggleLauncherPlacement,\n onToggleRail,\n railExpanded,\n tier,\n}: {\n activeAppId: string;\n appIds: ReadonlyArray<string>;\n drawerOpen: boolean;\n launcherPlacement: LauncherPlacement;\n onCloseDrawer: () => void;\n onNavigateRail: () => void;\n onToggleLauncherPlacement: () => void;\n onToggleRail: () => void;\n railExpanded: boolean;\n tier: RoutedLayoutTier;\n}) {\n const sheetRef = useRef<HTMLElement>(null);\n useEffect(() => {\n if (drawerOpen && (tier === \"mobile\" || launcherPlacement === \"bottom\")) {\n const sheet = sheetRef.current;\n const tile = sheet?.querySelector<HTMLElement>(\n '.routed-pane-sheet-tile[aria-current=\"page\"]',\n );\n (\n tile ?? sheet?.querySelector<HTMLElement>(\".routed-pane-sheet-tile\")\n )?.focus();\n }\n }, [drawerOpen, launcherPlacement, tier]);\n\n const mobileSheetDrag = useMobileSheetDrag({\n drawerOpen:\n (tier === \"mobile\" || launcherPlacement === \"bottom\") && drawerOpen,\n onClose: onCloseDrawer,\n });\n\n if (tier === \"tablet\" && launcherPlacement === \"side\") {\n return (\n <aside\n className={classNames(\n \"routed-pane-rail\",\n !railExpanded && \"routed-pane-rail--collapsed\",\n )}\n data-state={railExpanded ? \"open\" : \"closed\"}\n >\n <RoutedPaneRailToggle expanded={railExpanded} onToggle={onToggleRail} />\n {railExpanded && (\n <RoutedPaneNavPanel\n activeAppId={activeAppId}\n appIds={appIds}\n id={ROUTED_PANE_NAV_PANEL_ID}\n onNavigate={onNavigateRail}\n />\n )}\n <RoutedPanePlacementButton\n launcherPlacement={launcherPlacement}\n onToggle={onToggleLauncherPlacement}\n />\n </aside>\n );\n }\n\n return (\n <>\n {drawerOpen && (\n <button\n aria-label=\"Close menu\"\n className=\"routed-pane-scrim\"\n type=\"button\"\n onClick={onCloseDrawer}\n />\n )}\n <aside\n aria-hidden={!drawerOpen}\n className=\"routed-pane-sheet\"\n ref={sheetRef}\n data-dragging={mobileSheetDrag.dragging ? \"true\" : \"false\"}\n data-open={drawerOpen ? \"true\" : \"false\"}\n id=\"routed-pane-sheet\"\n style={\n drawerOpen && mobileSheetDrag.dragOffset > 0\n ? { transform: `translateY(${mobileSheetDrag.dragOffset}px)` }\n : undefined\n }\n >\n <div className=\"routed-pane-sheet-header\">\n <RoutedPaneMobileSheetHandle\n dragging={mobileSheetDrag.dragging}\n onClick={mobileSheetDrag.handleClick}\n onPointerDown={mobileSheetDrag.handlePointerDown}\n />\n {tier === \"tablet\" && (\n <RoutedPanePlacementButton\n launcherPlacement={launcherPlacement}\n onToggle={onToggleLauncherPlacement}\n />\n )}\n </div>\n <RoutedPaneMobileNav\n activeAppId={activeAppId}\n appIds={appIds}\n onNavigate={onCloseDrawer}\n />\n </aside>\n </>\n );\n}\n"]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type PropsWithChildren } from "react";
|
|
2
|
+
import type { RoutedLayoutTier } from "../launcher/useRoutedLayoutTier.js";
|
|
3
|
+
export interface RoutedPaneOverlayHostValue {
|
|
4
|
+
/**
|
|
5
|
+
* The routed shell's `<main className="routed-pane-main">` element, offered to
|
|
6
|
+
* overlays that should fill the content pane rather than the viewport — the
|
|
7
|
+
* routed counterpart to a window's `overlayHost` (see `useCurrentWindow`).
|
|
8
|
+
*
|
|
9
|
+
* `null` outside the routed shell, and for the first render inside it, before
|
|
10
|
+
* the pane's ref callback has handed the element back.
|
|
11
|
+
*/
|
|
12
|
+
host: HTMLElement | null;
|
|
13
|
+
/**
|
|
14
|
+
* Which routed shell is on screen. An overlay that is right to confine on the
|
|
15
|
+
* tablet/iPad tier — where a rail and a sidebar sit beside the pane — may
|
|
16
|
+
* still want the whole screen on a phone, which has nothing beside it worth
|
|
17
|
+
* keeping.
|
|
18
|
+
*/
|
|
19
|
+
tier: RoutedLayoutTier;
|
|
20
|
+
}
|
|
21
|
+
export declare function RoutedPaneOverlayHostProvider({ children, value, }: PropsWithChildren<{
|
|
22
|
+
value: RoutedPaneOverlayHostValue;
|
|
23
|
+
}>): import("react").JSX.Element;
|
|
24
|
+
/**
|
|
25
|
+
* The routed content pane an overlay can fill, and the tier it is filling.
|
|
26
|
+
*
|
|
27
|
+
* Portaling into the pane — rather than into `<body>` — is what keeps a full-pane
|
|
28
|
+
* overlay off the rail, the app bar, and the taskbar. The pane is not positioned,
|
|
29
|
+
* so the overlays that use it pin themselves with `sticky` against its
|
|
30
|
+
* scrollport.
|
|
31
|
+
*
|
|
32
|
+
* `host` is offered on **both** tiers and `tier` is the opt-in gate: one
|
|
33
|
+
* overlay may want the pane on a phone as well, while another, such as an
|
|
34
|
+
* image to pinch and pan, keeps the whole viewport there. A consumer chooses by
|
|
35
|
+
* reading `tier`, not by assuming the host means the pane is wanted.
|
|
36
|
+
*/
|
|
37
|
+
export declare function useRoutedPaneOverlayHost(): RoutedPaneOverlayHostValue;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext } from "react";
|
|
3
|
+
// Defaults to no host and the narrower tier, so a component rendered outside the
|
|
4
|
+
// routed shell (a unit test, the windowed shell) behaves as it did before the
|
|
5
|
+
// pane existed rather than reaching for one that is not there.
|
|
6
|
+
const RoutedPaneOverlayHostContext = createContext({
|
|
7
|
+
host: null,
|
|
8
|
+
tier: "mobile",
|
|
9
|
+
});
|
|
10
|
+
export function RoutedPaneOverlayHostProvider({ children, value, }) {
|
|
11
|
+
return (_jsx(RoutedPaneOverlayHostContext.Provider, { value: value, children: children }));
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The routed content pane an overlay can fill, and the tier it is filling.
|
|
15
|
+
*
|
|
16
|
+
* Portaling into the pane — rather than into `<body>` — is what keeps a full-pane
|
|
17
|
+
* overlay off the rail, the app bar, and the taskbar. The pane is not positioned,
|
|
18
|
+
* so the overlays that use it pin themselves with `sticky` against its
|
|
19
|
+
* scrollport.
|
|
20
|
+
*
|
|
21
|
+
* `host` is offered on **both** tiers and `tier` is the opt-in gate: one
|
|
22
|
+
* overlay may want the pane on a phone as well, while another, such as an
|
|
23
|
+
* image to pinch and pan, keeps the whole viewport there. A consumer chooses by
|
|
24
|
+
* reading `tier`, not by assuming the host means the pane is wanted.
|
|
25
|
+
*/
|
|
26
|
+
export function useRoutedPaneOverlayHost() {
|
|
27
|
+
return useContext(RoutedPaneOverlayHostContext);
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=RoutedPaneOverlayHost.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RoutedPaneOverlayHost.js","sourceRoot":"","sources":["../../../home/runner/work/tearleads/tearleads/packages/windowing/src/routed/RoutedPaneOverlayHost.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAA0B,UAAU,EAAE,MAAM,OAAO,CAAC;AAsB1E,iFAAiF;AACjF,8EAA8E;AAC9E,+DAA+D;AAC/D,MAAM,4BAA4B,GAAG,aAAa,CAA6B;IAC7E,IAAI,EAAE,IAAI;IACV,IAAI,EAAE,QAAQ;CACf,CAAC,CAAC;AAEH,MAAM,UAAU,6BAA6B,CAAC,EAC5C,QAAQ,EACR,KAAK,GACoD;IACzD,OAAO,CACL,KAAC,4BAA4B,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YAChD,QAAQ,GAC6B,CACzC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,wBAAwB;IACtC,OAAO,UAAU,CAAC,4BAA4B,CAAC,CAAC;AAClD,CAAC","sourcesContent":["import { createContext, type PropsWithChildren, useContext } from \"react\";\nimport type { RoutedLayoutTier } from \"../launcher/useRoutedLayoutTier\";\n\nexport interface RoutedPaneOverlayHostValue {\n /**\n * The routed shell's `<main className=\"routed-pane-main\">` element, offered to\n * overlays that should fill the content pane rather than the viewport — the\n * routed counterpart to a window's `overlayHost` (see `useCurrentWindow`).\n *\n * `null` outside the routed shell, and for the first render inside it, before\n * the pane's ref callback has handed the element back.\n */\n host: HTMLElement | null;\n /**\n * Which routed shell is on screen. An overlay that is right to confine on the\n * tablet/iPad tier — where a rail and a sidebar sit beside the pane — may\n * still want the whole screen on a phone, which has nothing beside it worth\n * keeping.\n */\n tier: RoutedLayoutTier;\n}\n\n// Defaults to no host and the narrower tier, so a component rendered outside the\n// routed shell (a unit test, the windowed shell) behaves as it did before the\n// pane existed rather than reaching for one that is not there.\nconst RoutedPaneOverlayHostContext = createContext<RoutedPaneOverlayHostValue>({\n host: null,\n tier: \"mobile\",\n});\n\nexport function RoutedPaneOverlayHostProvider({\n children,\n value,\n}: PropsWithChildren<{ value: RoutedPaneOverlayHostValue }>) {\n return (\n <RoutedPaneOverlayHostContext.Provider value={value}>\n {children}\n </RoutedPaneOverlayHostContext.Provider>\n );\n}\n\n/**\n * The routed content pane an overlay can fill, and the tier it is filling.\n *\n * Portaling into the pane — rather than into `<body>` — is what keeps a full-pane\n * overlay off the rail, the app bar, and the taskbar. The pane is not positioned,\n * so the overlays that use it pin themselves with `sticky` against its\n * scrollport.\n *\n * `host` is offered on **both** tiers and `tier` is the opt-in gate: one\n * overlay may want the pane on a phone as well, while another, such as an\n * image to pinch and pan, keeps the whole viewport there. A consumer chooses by\n * reading `tier`, not by assuming the host means the pane is wanted.\n */\nexport function useRoutedPaneOverlayHost(): RoutedPaneOverlayHostValue {\n return useContext(RoutedPaneOverlayHostContext);\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ArrowDownIcon } from "@phosphor-icons/react/dist/csr/ArrowDown";
|
|
3
|
+
import { ArrowLeftIcon } from "@phosphor-icons/react/dist/csr/ArrowLeft";
|
|
4
|
+
export function RoutedPanePlacementButton({ launcherPlacement, onToggle, }) {
|
|
5
|
+
const label = launcherPlacement === "side"
|
|
6
|
+
? "Move launcher to bottom"
|
|
7
|
+
: "Move launcher to side";
|
|
8
|
+
return (_jsx("button", { "aria-label": label, className: "routed-pane-iconbutton routed-pane-placement-button", title: label, type: "button", onClick: onToggle, children: launcherPlacement === "side" ? (_jsx(ArrowDownIcon, { "aria-hidden": true, size: 18 })) : (_jsx(ArrowLeftIcon, { "aria-hidden": true, size: 18 })) }));
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=RoutedPanePlacementButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RoutedPanePlacementButton.js","sourceRoot":"","sources":["../../../home/runner/work/tearleads/tearleads/packages/windowing/src/routed/RoutedPanePlacementButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AAGzE,MAAM,UAAU,yBAAyB,CAAC,EACxC,iBAAiB,EACjB,QAAQ,GAIT;IACC,MAAM,KAAK,GACT,iBAAiB,KAAK,MAAM;QAC1B,CAAC,CAAC,yBAAyB;QAC3B,CAAC,CAAC,uBAAuB,CAAC;IAE9B,OAAO,CACL,+BACc,KAAK,EACjB,SAAS,EAAC,qDAAqD,EAC/D,KAAK,EAAE,KAAK,EACZ,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,QAAQ,YAEhB,iBAAiB,KAAK,MAAM,CAAC,CAAC,CAAC,CAC9B,KAAC,aAAa,yBAAa,IAAI,EAAE,EAAE,GAAI,CACxC,CAAC,CAAC,CAAC,CACF,KAAC,aAAa,yBAAa,IAAI,EAAE,EAAE,GAAI,CACxC,GACM,CACV,CAAC;AACJ,CAAC","sourcesContent":["import { ArrowDownIcon } from \"@phosphor-icons/react/dist/csr/ArrowDown\";\nimport { ArrowLeftIcon } from \"@phosphor-icons/react/dist/csr/ArrowLeft\";\nimport type { LauncherPlacement } from \"./launcherPlacement\";\n\nexport function RoutedPanePlacementButton({\n launcherPlacement,\n onToggle,\n}: {\n launcherPlacement: LauncherPlacement;\n onToggle: () => void;\n}) {\n const label =\n launcherPlacement === \"side\"\n ? \"Move launcher to bottom\"\n : \"Move launcher to side\";\n\n return (\n <button\n aria-label={label}\n className=\"routed-pane-iconbutton routed-pane-placement-button\"\n title={label}\n type=\"button\"\n onClick={onToggle}\n >\n {launcherPlacement === \"side\" ? (\n <ArrowDownIcon aria-hidden size={18} />\n ) : (\n <ArrowLeftIcon aria-hidden size={18} />\n )}\n </button>\n );\n}\n"]}
|