@panneau/app 5.0.0-alpha.4 → 5.0.0-alpha.5
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 +32 -5
- package/dist/Panneau.css +19 -0
- package/dist/Panneau.d.ts +7 -1
- package/dist/Panneau.d.ts.map +1 -1
- package/dist/Panneau.js +137 -30
- package/dist/Panneau.js.map +1 -1
- package/dist/Panneau.module.js +12 -0
- package/dist/Panneau.module.js.map +1 -0
- package/dist/Shell.d.ts +8 -3
- package/dist/Shell.d.ts.map +1 -1
- package/dist/Shell.js +272 -114
- package/dist/Shell.js.map +1 -1
- package/dist/createPanneauApp.d.ts +3 -0
- package/dist/createPanneauApp.d.ts.map +1 -1
- package/dist/createPanneauApp.js.map +1 -1
- package/dist/cx.d.ts +3 -0
- package/dist/cx.d.ts.map +1 -0
- package/dist/cx.js +9 -0
- package/dist/cx.js.map +1 -0
- package/dist/documentTitle.d.ts +10 -0
- package/dist/documentTitle.d.ts.map +1 -0
- package/dist/documentTitle.js +49 -0
- package/dist/documentTitle.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/location.d.ts +13 -1
- package/dist/location.d.ts.map +1 -1
- package/dist/location.js +55 -48
- package/dist/location.js.map +1 -1
- package/dist/navigation.d.ts +53 -0
- package/dist/navigation.d.ts.map +1 -0
- package/dist/navigation.js +117 -0
- package/dist/navigation.js.map +1 -0
- package/dist/pages/HomePage.d.ts +11 -0
- package/dist/pages/HomePage.d.ts.map +1 -0
- package/dist/pages/HomePage.js +111 -0
- package/dist/pages/HomePage.js.map +1 -0
- package/dist/pages/ItemPanel.css +164 -0
- package/dist/pages/ItemPanel.d.ts +17 -0
- package/dist/pages/ItemPanel.d.ts.map +1 -0
- package/dist/pages/ItemPanel.js +370 -0
- package/dist/pages/ItemPanel.js.map +1 -0
- package/dist/pages/ItemPanel.module.js +34 -0
- package/dist/pages/ItemPanel.module.js.map +1 -0
- package/dist/pages/ItemPreview.d.ts +15 -0
- package/dist/pages/ItemPreview.d.ts.map +1 -0
- package/dist/pages/ItemPreview.js +179 -0
- package/dist/pages/ItemPreview.js.map +1 -0
- package/dist/pages/NotFoundPage.d.ts +6 -0
- package/dist/pages/NotFoundPage.d.ts.map +1 -0
- package/dist/pages/NotFoundPage.js +93 -0
- package/dist/pages/NotFoundPage.js.map +1 -0
- package/dist/pages/PageHeader.d.ts +21 -0
- package/dist/pages/PageHeader.d.ts.map +1 -0
- package/dist/pages/PageHeader.js +86 -0
- package/dist/pages/PageHeader.js.map +1 -0
- package/dist/pages/ResourceFormPage.d.ts +15 -0
- package/dist/pages/ResourceFormPage.d.ts.map +1 -0
- package/dist/pages/ResourceFormPage.js +204 -0
- package/dist/pages/ResourceFormPage.js.map +1 -0
- package/dist/pages/ResourceListPage.d.ts +15 -0
- package/dist/pages/ResourceListPage.d.ts.map +1 -0
- package/dist/pages/ResourceListPage.js +101 -0
- package/dist/pages/ResourceListPage.js.map +1 -0
- package/dist/pages/itemTitle.d.ts +7 -0
- package/dist/pages/itemTitle.d.ts.map +1 -0
- package/dist/pages/itemTitle.js +18 -0
- package/dist/pages/itemTitle.js.map +1 -0
- package/dist/pages/pages.css +162 -0
- package/dist/pages/pages.module.js +40 -0
- package/dist/pages/pages.module.js.map +1 -0
- package/dist/preferences.d.ts +6 -0
- package/dist/preferences.d.ts.map +1 -0
- package/dist/preferences.js +53 -0
- package/dist/preferences.js.map +1 -0
- package/dist/recentItems.d.ts +15 -0
- package/dist/recentItems.d.ts.map +1 -0
- package/dist/recentItems.js +70 -0
- package/dist/recentItems.js.map +1 -0
- package/dist/shell/AppLayout.css +189 -0
- package/dist/shell/AppLayout.d.ts +22 -0
- package/dist/shell/AppLayout.d.ts.map +1 -0
- package/dist/shell/AppLayout.js +365 -0
- package/dist/shell/AppLayout.js.map +1 -0
- package/dist/shell/AppLayout.module.js +36 -0
- package/dist/shell/AppLayout.module.js.map +1 -0
- package/dist/shell/GoTo.d.ts +20 -0
- package/dist/shell/GoTo.d.ts.map +1 -0
- package/dist/shell/GoTo.js +370 -0
- package/dist/shell/GoTo.js.map +1 -0
- package/dist/shell/Sidebar.css +313 -0
- package/dist/shell/Sidebar.d.ts +29 -0
- package/dist/shell/Sidebar.d.ts.map +1 -0
- package/dist/shell/Sidebar.js +225 -0
- package/dist/shell/Sidebar.js.map +1 -0
- package/dist/shell/Sidebar.module.js +60 -0
- package/dist/shell/Sidebar.module.js.map +1 -0
- package/dist/shell/tokens.d.ts +23 -0
- package/dist/shell/tokens.d.ts.map +1 -0
- package/dist/shell/tokens.js +75 -0
- package/dist/shell/tokens.js.map +1 -0
- package/package.json +15 -6
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
import { routePath } from "../routes.js";
|
|
2
|
+
import { cx } from "../cx.js";
|
|
3
|
+
import { usePreference } from "../preferences.js";
|
|
4
|
+
import AppLayout_module_default from "./AppLayout.module.js";
|
|
5
|
+
import { Sidebar } from "./Sidebar.js";
|
|
6
|
+
import { GoTo } from "./GoTo.js";
|
|
7
|
+
import { useEffect, useRef, useState } from "react";
|
|
8
|
+
import { c } from "react/compiler-runtime";
|
|
9
|
+
import { appMessages } from "@panneau/intl";
|
|
10
|
+
import { IconButton, useCommandShortcut, usePanneauIntl, usePortalContainer } from "@panneau/ui";
|
|
11
|
+
import { Dialog, Link, Modal, ModalOverlay } from "react-aria-components";
|
|
12
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { Menu, Search } from "lucide-react";
|
|
14
|
+
//#region src/shell/AppLayout.tsx
|
|
15
|
+
var CONTENT_ID = "panneau-content";
|
|
16
|
+
var SIDEBAR_STATES = ["expanded", "collapsed"];
|
|
17
|
+
function isEditable(target) {
|
|
18
|
+
return target instanceof HTMLElement && (target.isContentEditable || [
|
|
19
|
+
"INPUT",
|
|
20
|
+
"TEXTAREA",
|
|
21
|
+
"SELECT"
|
|
22
|
+
].includes(target.tagName));
|
|
23
|
+
}
|
|
24
|
+
/** Whether two routes are the same list, with or without the panel of an item. */
|
|
25
|
+
function isSameList(a, b) {
|
|
26
|
+
return (a.name === "resource.index" || a.name === "resource.show") && (b.name === "resource.index" || b.name === "resource.show") && a.resource === b.resource;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Where focus goes when the route changes, so that screen readers announce the new page: its
|
|
30
|
+
* title, or the page itself without one. Closing the panel of an item goes back to the item's
|
|
31
|
+
* link in the list; opening it is left to the panel.
|
|
32
|
+
*/
|
|
33
|
+
function focusPage(main, previous, route, basePath) {
|
|
34
|
+
if (isSameList(previous, route)) {
|
|
35
|
+
if (previous.name === "resource.show" && route.name === "resource.index") {
|
|
36
|
+
const href = routePath(previous, basePath);
|
|
37
|
+
[...main.querySelectorAll("a[href]")].find((candidate) => {
|
|
38
|
+
const value = candidate.getAttribute("href") ?? "";
|
|
39
|
+
return value === href || value.startsWith(`${href}?`);
|
|
40
|
+
})?.focus();
|
|
41
|
+
}
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
main.scrollTop = 0;
|
|
45
|
+
window.scrollTo({ top: 0 });
|
|
46
|
+
const heading = main.querySelector("h1");
|
|
47
|
+
if (heading !== null && !heading.hasAttribute("tabindex")) heading.tabIndex = -1;
|
|
48
|
+
(heading ?? main).focus({ preventScroll: true });
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The frame of the app. From the `lg` width of the Panneau root (64rem): the sidebar on the
|
|
52
|
+
* window's background and the page on a raised panel, like the vertical tabs of recent browsers.
|
|
53
|
+
* The sidebar collapses to a rail of icons (with its button, or Ctrl+\ / ⌘+\), and the browser
|
|
54
|
+
* remembers it. On a smaller screen: a bar at the top, whose button opens the sidebar as a drawer.
|
|
55
|
+
* When the route changes, focus moves to the title of the new page, and the page scrolls to the
|
|
56
|
+
* top.
|
|
57
|
+
*/
|
|
58
|
+
function AppLayout(t0) {
|
|
59
|
+
const $ = c(73);
|
|
60
|
+
const { definition, basePath, route, colorScheme, onColorSchemeChange, children } = t0;
|
|
61
|
+
const intl = usePanneauIntl();
|
|
62
|
+
const portalContainer = usePortalContainer();
|
|
63
|
+
const [sidebar, setSidebar] = usePreference("sidebar", SIDEBAR_STATES);
|
|
64
|
+
const [drawerOpen, setDrawerOpen] = useState(false);
|
|
65
|
+
const [goToOpen, setGoToOpen] = useState(false);
|
|
66
|
+
let t1;
|
|
67
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
68
|
+
t1 = () => setGoToOpen(_temp);
|
|
69
|
+
$[0] = t1;
|
|
70
|
+
} else t1 = $[0];
|
|
71
|
+
let t2;
|
|
72
|
+
if ($[1] !== goToOpen) {
|
|
73
|
+
t2 = { isOpen: goToOpen };
|
|
74
|
+
$[1] = goToOpen;
|
|
75
|
+
$[2] = t2;
|
|
76
|
+
} else t2 = $[2];
|
|
77
|
+
useCommandShortcut(t1, t2);
|
|
78
|
+
let t3;
|
|
79
|
+
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
80
|
+
t3 = () => {
|
|
81
|
+
setDrawerOpen(false);
|
|
82
|
+
setGoToOpen(true);
|
|
83
|
+
};
|
|
84
|
+
$[3] = t3;
|
|
85
|
+
} else t3 = $[3];
|
|
86
|
+
const openGoTo = t3;
|
|
87
|
+
const collapsed = sidebar === "collapsed";
|
|
88
|
+
let t4;
|
|
89
|
+
if ($[4] !== collapsed || $[5] !== setSidebar) {
|
|
90
|
+
t4 = () => setSidebar(collapsed ? "expanded" : "collapsed");
|
|
91
|
+
$[4] = collapsed;
|
|
92
|
+
$[5] = setSidebar;
|
|
93
|
+
$[6] = t4;
|
|
94
|
+
} else t4 = $[6];
|
|
95
|
+
const toggle = t4;
|
|
96
|
+
const main = useRef(null);
|
|
97
|
+
const previousRoute = useRef(null);
|
|
98
|
+
let t5;
|
|
99
|
+
if ($[7] !== route) {
|
|
100
|
+
t5 = JSON.stringify(route);
|
|
101
|
+
$[7] = route;
|
|
102
|
+
$[8] = t5;
|
|
103
|
+
} else t5 = $[8];
|
|
104
|
+
const routeKey = t5;
|
|
105
|
+
let t6;
|
|
106
|
+
let t7;
|
|
107
|
+
if ($[9] !== basePath || $[10] !== routeKey) {
|
|
108
|
+
t6 = () => {
|
|
109
|
+
const next = JSON.parse(routeKey);
|
|
110
|
+
const previous = previousRoute.current;
|
|
111
|
+
previousRoute.current = next;
|
|
112
|
+
if (previous === null || main.current === null) return;
|
|
113
|
+
const element = main.current;
|
|
114
|
+
const frame = window.requestAnimationFrame(() => focusPage(element, previous, next, basePath));
|
|
115
|
+
return () => window.cancelAnimationFrame(frame);
|
|
116
|
+
};
|
|
117
|
+
t7 = [routeKey, basePath];
|
|
118
|
+
$[9] = basePath;
|
|
119
|
+
$[10] = routeKey;
|
|
120
|
+
$[11] = t6;
|
|
121
|
+
$[12] = t7;
|
|
122
|
+
} else {
|
|
123
|
+
t6 = $[11];
|
|
124
|
+
t7 = $[12];
|
|
125
|
+
}
|
|
126
|
+
useEffect(t6, t7);
|
|
127
|
+
let t8;
|
|
128
|
+
if ($[13] !== toggle) {
|
|
129
|
+
t8 = () => {
|
|
130
|
+
const onKeyDown = (event) => {
|
|
131
|
+
if (event.key === "\\" && (event.metaKey || event.ctrlKey) && !event.altKey && !isEditable(event.target)) {
|
|
132
|
+
event.preventDefault();
|
|
133
|
+
toggle();
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
window.addEventListener("keydown", onKeyDown);
|
|
137
|
+
return () => window.removeEventListener("keydown", onKeyDown);
|
|
138
|
+
};
|
|
139
|
+
$[13] = toggle;
|
|
140
|
+
$[14] = t8;
|
|
141
|
+
} else t8 = $[14];
|
|
142
|
+
useEffect(t8);
|
|
143
|
+
let t9;
|
|
144
|
+
if ($[15] !== basePath || $[16] !== colorScheme || $[17] !== definition || $[18] !== onColorSchemeChange || $[19] !== route) {
|
|
145
|
+
t9 = {
|
|
146
|
+
definition,
|
|
147
|
+
basePath,
|
|
148
|
+
route,
|
|
149
|
+
colorScheme,
|
|
150
|
+
onColorSchemeChange,
|
|
151
|
+
onGoTo: openGoTo
|
|
152
|
+
};
|
|
153
|
+
$[15] = basePath;
|
|
154
|
+
$[16] = colorScheme;
|
|
155
|
+
$[17] = definition;
|
|
156
|
+
$[18] = onColorSchemeChange;
|
|
157
|
+
$[19] = route;
|
|
158
|
+
$[20] = t9;
|
|
159
|
+
} else t9 = $[20];
|
|
160
|
+
const sidebarProps = t9;
|
|
161
|
+
const t10 = collapsed && AppLayout_module_default.collapsed;
|
|
162
|
+
let t11;
|
|
163
|
+
if ($[21] !== t10) {
|
|
164
|
+
t11 = cx(AppLayout_module_default.layout, t10);
|
|
165
|
+
$[21] = t10;
|
|
166
|
+
$[22] = t11;
|
|
167
|
+
} else t11 = $[22];
|
|
168
|
+
let t12;
|
|
169
|
+
if ($[23] !== intl) {
|
|
170
|
+
t12 = intl.formatMessage(appMessages.skipToContent);
|
|
171
|
+
$[23] = intl;
|
|
172
|
+
$[24] = t12;
|
|
173
|
+
} else t12 = $[24];
|
|
174
|
+
let t13;
|
|
175
|
+
if ($[25] !== t12) {
|
|
176
|
+
t13 = /* @__PURE__ */ jsx("a", {
|
|
177
|
+
href: `#${CONTENT_ID}`,
|
|
178
|
+
className: AppLayout_module_default.skipLink,
|
|
179
|
+
children: t12
|
|
180
|
+
});
|
|
181
|
+
$[25] = t12;
|
|
182
|
+
$[26] = t13;
|
|
183
|
+
} else t13 = $[26];
|
|
184
|
+
let t14;
|
|
185
|
+
if ($[27] !== intl) {
|
|
186
|
+
t14 = intl.formatMessage(appMessages.openMenu);
|
|
187
|
+
$[27] = intl;
|
|
188
|
+
$[28] = t14;
|
|
189
|
+
} else t14 = $[28];
|
|
190
|
+
let t15;
|
|
191
|
+
if ($[29] === Symbol.for("react.memo_cache_sentinel")) {
|
|
192
|
+
t15 = () => setDrawerOpen(true);
|
|
193
|
+
$[29] = t15;
|
|
194
|
+
} else t15 = $[29];
|
|
195
|
+
let t16;
|
|
196
|
+
if ($[30] !== drawerOpen || $[31] !== t14) {
|
|
197
|
+
t16 = /* @__PURE__ */ jsx(IconButton, {
|
|
198
|
+
icon: Menu,
|
|
199
|
+
label: t14,
|
|
200
|
+
"aria-expanded": drawerOpen,
|
|
201
|
+
onPress: t15
|
|
202
|
+
});
|
|
203
|
+
$[30] = drawerOpen;
|
|
204
|
+
$[31] = t14;
|
|
205
|
+
$[32] = t16;
|
|
206
|
+
} else t16 = $[32];
|
|
207
|
+
let t17;
|
|
208
|
+
if ($[33] !== basePath) {
|
|
209
|
+
t17 = routePath({ name: "home" }, basePath);
|
|
210
|
+
$[33] = basePath;
|
|
211
|
+
$[34] = t17;
|
|
212
|
+
} else t17 = $[34];
|
|
213
|
+
let t18;
|
|
214
|
+
if ($[35] !== definition.name || $[36] !== t17) {
|
|
215
|
+
t18 = /* @__PURE__ */ jsx(Link, {
|
|
216
|
+
href: t17,
|
|
217
|
+
className: AppLayout_module_default.topBarName,
|
|
218
|
+
children: definition.name
|
|
219
|
+
});
|
|
220
|
+
$[35] = definition.name;
|
|
221
|
+
$[36] = t17;
|
|
222
|
+
$[37] = t18;
|
|
223
|
+
} else t18 = $[37];
|
|
224
|
+
let t19;
|
|
225
|
+
if ($[38] !== intl) {
|
|
226
|
+
t19 = intl.formatMessage(appMessages.goTo);
|
|
227
|
+
$[38] = intl;
|
|
228
|
+
$[39] = t19;
|
|
229
|
+
} else t19 = $[39];
|
|
230
|
+
let t20;
|
|
231
|
+
if ($[40] !== t19) {
|
|
232
|
+
t20 = /* @__PURE__ */ jsx(IconButton, {
|
|
233
|
+
icon: Search,
|
|
234
|
+
label: t19,
|
|
235
|
+
"aria-haspopup": "dialog",
|
|
236
|
+
className: AppLayout_module_default.topBarSearch,
|
|
237
|
+
onPress: openGoTo
|
|
238
|
+
});
|
|
239
|
+
$[40] = t19;
|
|
240
|
+
$[41] = t20;
|
|
241
|
+
} else t20 = $[41];
|
|
242
|
+
let t21;
|
|
243
|
+
if ($[42] !== t16 || $[43] !== t18 || $[44] !== t20) {
|
|
244
|
+
t21 = /* @__PURE__ */ jsxs("header", {
|
|
245
|
+
className: AppLayout_module_default.topBar,
|
|
246
|
+
children: [
|
|
247
|
+
t16,
|
|
248
|
+
t18,
|
|
249
|
+
t20
|
|
250
|
+
]
|
|
251
|
+
});
|
|
252
|
+
$[42] = t16;
|
|
253
|
+
$[43] = t18;
|
|
254
|
+
$[44] = t20;
|
|
255
|
+
$[45] = t21;
|
|
256
|
+
} else t21 = $[45];
|
|
257
|
+
let t22;
|
|
258
|
+
if ($[46] !== collapsed || $[47] !== sidebarProps || $[48] !== toggle) {
|
|
259
|
+
t22 = /* @__PURE__ */ jsx("aside", {
|
|
260
|
+
className: AppLayout_module_default.sidebar,
|
|
261
|
+
children: /* @__PURE__ */ jsx(Sidebar, {
|
|
262
|
+
...sidebarProps,
|
|
263
|
+
collapsed,
|
|
264
|
+
onToggle: toggle
|
|
265
|
+
})
|
|
266
|
+
});
|
|
267
|
+
$[46] = collapsed;
|
|
268
|
+
$[47] = sidebarProps;
|
|
269
|
+
$[48] = toggle;
|
|
270
|
+
$[49] = t22;
|
|
271
|
+
} else t22 = $[49];
|
|
272
|
+
let t23;
|
|
273
|
+
if ($[50] !== children) {
|
|
274
|
+
t23 = /* @__PURE__ */ jsx("main", {
|
|
275
|
+
ref: main,
|
|
276
|
+
id: CONTENT_ID,
|
|
277
|
+
tabIndex: -1,
|
|
278
|
+
className: AppLayout_module_default.main,
|
|
279
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
280
|
+
className: AppLayout_module_default.panel,
|
|
281
|
+
children
|
|
282
|
+
})
|
|
283
|
+
});
|
|
284
|
+
$[50] = children;
|
|
285
|
+
$[51] = t23;
|
|
286
|
+
} else t23 = $[51];
|
|
287
|
+
let t24;
|
|
288
|
+
if ($[52] !== basePath || $[53] !== collapsed || $[54] !== colorScheme || $[55] !== definition || $[56] !== goToOpen || $[57] !== onColorSchemeChange || $[58] !== toggle) {
|
|
289
|
+
t24 = /* @__PURE__ */ jsx(GoTo, {
|
|
290
|
+
definition,
|
|
291
|
+
basePath,
|
|
292
|
+
isOpen: goToOpen,
|
|
293
|
+
onOpenChange: setGoToOpen,
|
|
294
|
+
sidebarCollapsed: collapsed,
|
|
295
|
+
onToggleSidebar: toggle,
|
|
296
|
+
colorScheme,
|
|
297
|
+
onColorSchemeChange
|
|
298
|
+
});
|
|
299
|
+
$[52] = basePath;
|
|
300
|
+
$[53] = collapsed;
|
|
301
|
+
$[54] = colorScheme;
|
|
302
|
+
$[55] = definition;
|
|
303
|
+
$[56] = goToOpen;
|
|
304
|
+
$[57] = onColorSchemeChange;
|
|
305
|
+
$[58] = toggle;
|
|
306
|
+
$[59] = t24;
|
|
307
|
+
} else t24 = $[59];
|
|
308
|
+
let t25;
|
|
309
|
+
if ($[60] !== drawerOpen || $[61] !== intl || $[62] !== portalContainer || $[63] !== sidebarProps) {
|
|
310
|
+
t25 = portalContainer !== null ? /* @__PURE__ */ jsx(ModalOverlay, {
|
|
311
|
+
isOpen: drawerOpen,
|
|
312
|
+
onOpenChange: setDrawerOpen,
|
|
313
|
+
isDismissable: true,
|
|
314
|
+
className: AppLayout_module_default.backdrop,
|
|
315
|
+
UNSTABLE_portalContainer: portalContainer,
|
|
316
|
+
children: /* @__PURE__ */ jsx(Modal, {
|
|
317
|
+
className: AppLayout_module_default.drawer,
|
|
318
|
+
children: /* @__PURE__ */ jsx(Dialog, {
|
|
319
|
+
"aria-label": intl.formatMessage(appMessages.navigation),
|
|
320
|
+
className: AppLayout_module_default.drawerDialog,
|
|
321
|
+
children: /* @__PURE__ */ jsx(Sidebar, {
|
|
322
|
+
...sidebarProps,
|
|
323
|
+
onClose: () => setDrawerOpen(false),
|
|
324
|
+
onNavigate: () => setDrawerOpen(false)
|
|
325
|
+
})
|
|
326
|
+
})
|
|
327
|
+
})
|
|
328
|
+
}) : null;
|
|
329
|
+
$[60] = drawerOpen;
|
|
330
|
+
$[61] = intl;
|
|
331
|
+
$[62] = portalContainer;
|
|
332
|
+
$[63] = sidebarProps;
|
|
333
|
+
$[64] = t25;
|
|
334
|
+
} else t25 = $[64];
|
|
335
|
+
let t26;
|
|
336
|
+
if ($[65] !== t11 || $[66] !== t13 || $[67] !== t21 || $[68] !== t22 || $[69] !== t23 || $[70] !== t24 || $[71] !== t25) {
|
|
337
|
+
t26 = /* @__PURE__ */ jsxs("div", {
|
|
338
|
+
className: t11,
|
|
339
|
+
children: [
|
|
340
|
+
t13,
|
|
341
|
+
t21,
|
|
342
|
+
t22,
|
|
343
|
+
t23,
|
|
344
|
+
t24,
|
|
345
|
+
t25
|
|
346
|
+
]
|
|
347
|
+
});
|
|
348
|
+
$[65] = t11;
|
|
349
|
+
$[66] = t13;
|
|
350
|
+
$[67] = t21;
|
|
351
|
+
$[68] = t22;
|
|
352
|
+
$[69] = t23;
|
|
353
|
+
$[70] = t24;
|
|
354
|
+
$[71] = t25;
|
|
355
|
+
$[72] = t26;
|
|
356
|
+
} else t26 = $[72];
|
|
357
|
+
return t26;
|
|
358
|
+
}
|
|
359
|
+
function _temp(open) {
|
|
360
|
+
return !open;
|
|
361
|
+
}
|
|
362
|
+
//#endregion
|
|
363
|
+
export { AppLayout };
|
|
364
|
+
|
|
365
|
+
//# sourceMappingURL=AppLayout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppLayout.js","names":["Menu","drawerOpen","Search","openGoTo","collapsed","toggle","main","CONTENT_ID","children","definition","basePath","goToOpen","setGoToOpen","colorScheme","onColorSchemeChange","setDrawerOpen","portalContainer","_c","styles"],"sources":["../../src/shell/AppLayout.tsx"],"sourcesContent":["import { Menu, Search } from 'lucide-react';\nimport { type ReactNode, useEffect, useRef, useState } from 'react';\nimport { Dialog, Link, Modal, ModalOverlay } from 'react-aria-components';\n\nimport { appMessages } from '@panneau/intl';\nimport type { Definition } from '@panneau/protocol';\nimport { IconButton, useCommandShortcut, usePanneauIntl, usePortalContainer } from '@panneau/ui';\n\nimport { cx } from '../cx';\nimport { usePreference } from '../preferences';\nimport { type AppRoute, routePath } from '../routes';\nimport styles from './AppLayout.module.css';\nimport { GoTo } from './GoTo';\nimport { type ColorSchemePreference, Sidebar } from './Sidebar';\n\nconst CONTENT_ID = 'panneau-content';\nconst SIDEBAR_STATES = ['expanded', 'collapsed'] as const;\n\nexport interface AppLayoutProps {\n definition: Definition;\n basePath: string;\n route: AppRoute;\n colorScheme: ColorSchemePreference;\n onColorSchemeChange: (scheme: ColorSchemePreference) => void;\n children?: ReactNode;\n}\n\nfunction isEditable(target: EventTarget | null): boolean {\n return (\n target instanceof HTMLElement &&\n (target.isContentEditable || ['INPUT', 'TEXTAREA', 'SELECT'].includes(target.tagName))\n );\n}\n\n/** Whether two routes are the same list, with or without the panel of an item. */\nfunction isSameList(a: AppRoute, b: AppRoute): boolean {\n return (\n (a.name === 'resource.index' || a.name === 'resource.show') &&\n (b.name === 'resource.index' || b.name === 'resource.show') &&\n a.resource === b.resource\n );\n}\n\n/**\n * Where focus goes when the route changes, so that screen readers announce the new page: its\n * title, or the page itself without one. Closing the panel of an item goes back to the item's\n * link in the list; opening it is left to the panel.\n */\nfunction focusPage(main: HTMLElement, previous: AppRoute, route: AppRoute, basePath: string) {\n if (isSameList(previous, route)) {\n if (previous.name === 'resource.show' && route.name === 'resource.index') {\n const href = routePath(previous, basePath);\n const link = [...main.querySelectorAll<HTMLAnchorElement>('a[href]')].find(\n (candidate) => {\n const value = candidate.getAttribute('href') ?? '';\n return value === href || value.startsWith(`${href}?`);\n },\n );\n link?.focus();\n }\n return;\n }\n main.scrollTop = 0;\n window.scrollTo({ top: 0 });\n const heading = main.querySelector<HTMLElement>('h1');\n if (heading !== null && !heading.hasAttribute('tabindex')) {\n heading.tabIndex = -1;\n }\n (heading ?? main).focus({ preventScroll: true });\n}\n\n/**\n * The frame of the app. From the `lg` width of the Panneau root (64rem): the sidebar on the\n * window's background and the page on a raised panel, like the vertical tabs of recent browsers.\n * The sidebar collapses to a rail of icons (with its button, or Ctrl+\\ / ⌘+\\), and the browser\n * remembers it. On a smaller screen: a bar at the top, whose button opens the sidebar as a drawer.\n * When the route changes, focus moves to the title of the new page, and the page scrolls to the\n * top.\n */\nexport function AppLayout({\n definition,\n basePath,\n route,\n colorScheme,\n onColorSchemeChange,\n children,\n}: AppLayoutProps) {\n const intl = usePanneauIntl();\n const portalContainer = usePortalContainer();\n const [sidebar, setSidebar] = usePreference('sidebar', SIDEBAR_STATES);\n const [drawerOpen, setDrawerOpen] = useState(false);\n const [goToOpen, setGoToOpen] = useState(false);\n useCommandShortcut(() => setGoToOpen((open) => !open), { isOpen: goToOpen });\n const openGoTo = () => {\n setDrawerOpen(false);\n setGoToOpen(true);\n };\n const collapsed = sidebar === 'collapsed';\n const toggle = () => setSidebar(collapsed ? 'expanded' : 'collapsed');\n\n const main = useRef<HTMLElement>(null);\n const previousRoute = useRef<AppRoute | null>(null);\n const routeKey = JSON.stringify(route);\n useEffect(() => {\n const next = JSON.parse(routeKey) as AppRoute;\n const previous = previousRoute.current;\n previousRoute.current = next;\n // The first page keeps the focus where the browser put it\n if (previous === null || main.current === null) {\n return undefined;\n }\n const element = main.current;\n // After the page renders, and after a dialog that navigated gave focus back\n const frame = window.requestAnimationFrame(() =>\n focusPage(element, previous, next, basePath),\n );\n return () => window.cancelAnimationFrame(frame);\n }, [routeKey, basePath]);\n\n useEffect(() => {\n const onKeyDown = (event: KeyboardEvent) => {\n if (\n event.key === '\\\\' &&\n (event.metaKey || event.ctrlKey) &&\n !event.altKey &&\n !isEditable(event.target)\n ) {\n event.preventDefault();\n toggle();\n }\n };\n window.addEventListener('keydown', onKeyDown);\n return () => window.removeEventListener('keydown', onKeyDown);\n });\n\n const sidebarProps = {\n definition,\n basePath,\n route,\n colorScheme,\n onColorSchemeChange,\n onGoTo: openGoTo,\n };\n\n return (\n <div className={cx(styles.layout, collapsed && styles.collapsed)}>\n <a href={`#${CONTENT_ID}`} className={styles.skipLink}>\n {intl.formatMessage(appMessages.skipToContent)}\n </a>\n <header className={styles.topBar}>\n <IconButton\n icon={Menu}\n label={intl.formatMessage(appMessages.openMenu)}\n aria-expanded={drawerOpen}\n onPress={() => setDrawerOpen(true)}\n />\n <Link href={routePath({ name: 'home' }, basePath)} className={styles.topBarName}>\n {definition.name}\n </Link>\n <IconButton\n icon={Search}\n label={intl.formatMessage(appMessages.goTo)}\n aria-haspopup=\"dialog\"\n className={styles.topBarSearch}\n onPress={openGoTo}\n />\n </header>\n <aside className={styles.sidebar}>\n <Sidebar {...sidebarProps} collapsed={collapsed} onToggle={toggle} />\n </aside>\n <main ref={main} id={CONTENT_ID} tabIndex={-1} className={styles.main}>\n <div className={styles.panel}>{children}</div>\n </main>\n <GoTo\n definition={definition}\n basePath={basePath}\n isOpen={goToOpen}\n onOpenChange={setGoToOpen}\n sidebarCollapsed={collapsed}\n onToggleSidebar={toggle}\n colorScheme={colorScheme}\n onColorSchemeChange={onColorSchemeChange}\n />\n {portalContainer !== null ? (\n <ModalOverlay\n isOpen={drawerOpen}\n onOpenChange={setDrawerOpen}\n isDismissable\n className={styles.backdrop}\n UNSTABLE_portalContainer={portalContainer}\n >\n <Modal className={styles.drawer}>\n <Dialog\n aria-label={intl.formatMessage(appMessages.navigation)}\n className={styles.drawerDialog}\n >\n <Sidebar\n {...sidebarProps}\n onClose={() => setDrawerOpen(false)}\n onNavigate={() => setDrawerOpen(false)}\n />\n </Dialog>\n </Modal>\n </ModalOverlay>\n ) : null}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAeA,IAAM,aAAa;AACnB,IAAM,iBAAiB,CAAC,YAAY,WAAW;AAW/C,SAAS,WAAW,QAAqC;CACrD,OACI,kBAAkB,gBACjB,OAAO,qBAAqB;EAAC;EAAS;EAAY;CAAQ,CAAC,CAAC,SAAS,OAAO,OAAO;AAE5F;;AAGA,SAAS,WAAW,GAAa,GAAsB;CACnD,QACK,EAAE,SAAS,oBAAoB,EAAE,SAAS,qBAC1C,EAAE,SAAS,oBAAoB,EAA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Search = "panneau-app-layout-top-bar-search";
|
|
6
|
+
var topBarName = "panneau-app-layout-top-bar-name";
|
|
7
|
+
var sidebar = "panneau-app-layout-sidebar";
|
|
8
|
+
var main = "panneau-app-layout-main";
|
|
9
|
+
var panel = "panneau-app-layout-panel";
|
|
10
|
+
var backdrop = "panneau-app-layout-backdrop";
|
|
11
|
+
var fade = "panneau-app-layout-fade";
|
|
12
|
+
var drawer = "panneau-app-layout-drawer";
|
|
13
|
+
var slide = "panneau-app-layout-slide";
|
|
14
|
+
var drawerDialog = "panneau-app-layout-drawer-dialog";
|
|
15
|
+
var skipLink = "panneau-app-layout-skip-link";
|
|
16
|
+
var collapsed = "panneau-app-layout-collapsed";
|
|
17
|
+
var AppLayout_module_default = {
|
|
18
|
+
layout,
|
|
19
|
+
topBar,
|
|
20
|
+
topBarSearch,
|
|
21
|
+
topBarName,
|
|
22
|
+
sidebar,
|
|
23
|
+
main,
|
|
24
|
+
panel,
|
|
25
|
+
backdrop,
|
|
26
|
+
fade,
|
|
27
|
+
drawer,
|
|
28
|
+
slide,
|
|
29
|
+
drawerDialog,
|
|
30
|
+
skipLink,
|
|
31
|
+
collapsed
|
|
32
|
+
};
|
|
33
|
+
//#endregion
|
|
34
|
+
export { backdrop, collapsed, AppLayout_module_default as default, drawer, drawerDialog, fade, layout, main, panel, sidebar, skipLink, slide, topBar, topBarName, topBarSearch };
|
|
35
|
+
|
|
36
|
+
//# sourceMappingURL=AppLayout.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppLayout.module.js","names":[],"sources":["../../src/shell/AppLayout.module.css"],"sourcesContent":["/* The frame of the app: the page on a panel inset from the edges, on the window's background, as\n * in recent browsers. One column on a small screen, with a bar on top. From Panneau's `lg`\n * breakpoint (64rem, measured on the Panneau root, a size container): the sidebar on the left. */\n\n.layout {\n display: grid;\n grid-template-rows: auto minmax(0, 1fr);\n grid-template-columns: minmax(0, 1fr);\n min-height: 100dvh;\n background: var(--panneau-shell-bg, var(--panneau-color-surface-sunken));\n}\n\n.topBar {\n position: sticky;\n top: 0;\n z-index: 1;\n display: flex;\n align-items: center;\n gap: var(--panneau-space-2);\n min-height: 3.25rem;\n padding: var(--panneau-space-1) var(--panneau-space-3) var(--panneau-space-1)\n var(--panneau-space-1);\n background: var(--panneau-shell-bg, var(--panneau-color-surface-sunken));\n}\n\n.topBarSearch {\n margin-inline-start: auto;\n}\n\n.topBarName {\n overflow: hidden;\n color: var(--panneau-color-text);\n font-weight: var(--panneau-font-weight-bold);\n text-decoration: none;\n text-overflow: ellipsis;\n white-space: nowrap;\n outline: none;\n}\n\n.topBarName[data-focus-visible] {\n border-radius: var(--panneau-radius-sm);\n box-shadow: 0 0 0 var(--panneau-focus-width) var(--panneau-color-focus);\n}\n\n.sidebar {\n display: none;\n}\n\n.main {\n display: flex;\n flex-direction: column;\n min-width: 0;\n padding: 0 var(--panneau-shell-inset, var(--panneau-space-2))\n var(--panneau-shell-inset, var(--panneau-space-2));\n}\n\n.main:focus {\n outline: none;\n}\n\n.panel {\n flex: 1 1 auto;\n min-width: 0;\n padding: var(--panneau-space-5) var(--panneau-space-4) var(--panneau-space-8);\n background: var(--panneau-shell-panel-bg, var(--panneau-color-surface));\n border: var(\n --panneau-shell-panel-border,\n var(--panneau-border-width) solid var(--panneau-color-border)\n );\n border-radius: var(--panneau-shell-panel-radius, calc(var(--panneau-radius-lg) * 1.5));\n box-shadow: var(--panneau-shell-panel-shadow, var(--panneau-shadow-sm));\n}\n\n/* The drawer of a small screen. */\n.backdrop {\n position: fixed;\n inset: 0;\n z-index: var(--panneau-z-overlay);\n background: var(--panneau-color-backdrop);\n}\n\n.backdrop[data-entering] {\n animation: fade var(--panneau-duration) ease-out;\n}\n\n.drawer {\n position: fixed;\n inset-block: 0;\n inset-inline-start: 0;\n width: min(18rem, 85vw);\n background: var(--panneau-shell-bg, var(--panneau-color-surface-sunken));\n box-shadow: var(--panneau-shadow-lg);\n}\n\n.drawer[data-entering] {\n animation: slide 200ms ease-out;\n}\n\n.drawerDialog {\n height: 100%;\n outline: none;\n}\n\n/* Keyboard users jump past the navigation. */\n.skipLink {\n position: absolute;\n top: var(--panneau-space-2);\n left: var(--panneau-space-2);\n z-index: 100;\n padding: var(--panneau-space-2) var(--panneau-space-3);\n border-radius: var(--panneau-radius-md);\n background: var(--panneau-color-accent);\n color: var(--panneau-color-accent-text);\n font-weight: var(--panneau-font-weight-medium);\n text-decoration: none;\n}\n\n.skipLink:not(:focus) {\n width: 1px;\n height: 1px;\n padding: 0;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n}\n\n@keyframes fade {\n from {\n opacity: 0;\n }\n}\n\n@keyframes slide {\n from {\n transform: translateX(-100%);\n }\n}\n\n@container panneau-root (min-width: 64rem) {\n .layout {\n grid-template-rows: minmax(0, 1fr);\n grid-template-columns: var(--panneau-sidebar-width, 15rem) minmax(0, 1fr);\n transition: grid-template-columns 200ms ease-out;\n }\n\n .layout.collapsed {\n grid-template-columns: var(--panneau-sidebar-width-collapsed, 3.5rem) minmax(0, 1fr);\n }\n\n .topBar {\n display: none;\n }\n\n .sidebar {\n position: sticky;\n top: 0;\n display: block;\n height: 100dvh;\n min-width: 0;\n overflow: hidden;\n background: var(--panneau-sidebar-bg, transparent);\n border-inline-end: var(--panneau-sidebar-border, 0 none);\n }\n\n .main {\n padding: var(--panneau-shell-inset, var(--panneau-space-2));\n padding-inline-start: 0;\n }\n\n .panel {\n min-height: calc(100dvh - 2 * var(--panneau-shell-inset, var(--panneau-space-2)));\n padding: var(--panneau-space-6) var(--panneau-shell-panel-padding-x, var(--panneau-space-8))\n var(--panneau-space-10);\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .layout,\n .backdrop[data-entering],\n .drawer[data-entering] {\n animation: none;\n transition: none;\n }\n}\n\n/* The title of a page takes focus when the route changes, for screen readers: no ring. */\n.main :global(h1[tabindex='-1']:focus) {\n outline: none;\n}\n"],"mappings":""}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Definition } from '@panneau/protocol';
|
|
2
|
+
import { type ColorSchemePreference } from './Sidebar';
|
|
3
|
+
export interface GoToProps {
|
|
4
|
+
definition: Definition;
|
|
5
|
+
basePath: string;
|
|
6
|
+
isOpen: boolean;
|
|
7
|
+
onOpenChange: (isOpen: boolean) => void;
|
|
8
|
+
sidebarCollapsed: boolean;
|
|
9
|
+
onToggleSidebar: () => void;
|
|
10
|
+
colorScheme: ColorSchemePreference;
|
|
11
|
+
onColorSchemeChange: (scheme: ColorSchemePreference) => void;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The "Go to…" palette of the app (decision 0029): recent items, navigation, "New {resource}",
|
|
15
|
+
* the commands of plugins, the app's actions, then the results of the server's search, grouped by
|
|
16
|
+
* resource. An item opens its edit form. "Search in" narrows the palette to the results of one
|
|
17
|
+
* resource, 20 of them, until Backspace in the empty field.
|
|
18
|
+
*/
|
|
19
|
+
export declare function GoTo({ definition, basePath, isOpen, onOpenChange, sidebarCollapsed, onToggleSidebar, colorScheme, onColorSchemeChange, }: GoToProps): import("react").JSX.Element;
|
|
20
|
+
//# sourceMappingURL=GoTo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GoTo.d.ts","sourceRoot":"","sources":["../../src/shell/GoTo.tsx"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,UAAU,EAAkB,MAAM,mBAAmB,CAAC;AAepE,OAAO,EAAiB,KAAK,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAWtE,MAAM,WAAW,SAAS;IACtB,UAAU,EAAE,UAAU,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,YAAY,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACxC,gBAAgB,EAAE,OAAO,CAAC;IAC1B,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,WAAW,EAAE,qBAAqB,CAAC;IACnC,mBAAmB,EAAE,CAAC,MAAM,EAAE,qBAAqB,KAAK,IAAI,CAAC;CAChE;AAkCD;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,EACjB,UAAU,EACV,QAAQ,EACR,MAAM,EACN,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,mBAAmB,GACtB,EAAE,SAAS,+BAsPX"}
|