@lincyaw/aegis-ui 0.17.1 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ui/AnchoredPopover.cjs +2 -0
- package/dist/components/ui/AnchoredPopover.cjs.map +1 -0
- package/dist/components/ui/AnchoredPopover.d.ts +49 -0
- package/dist/components/ui/AnchoredPopover.js +144 -0
- package/dist/components/ui/AnchoredPopover.js.map +1 -0
- package/dist/components/ui/Breadcrumb.cjs +1 -1
- package/dist/components/ui/Breadcrumb.cjs.map +1 -1
- package/dist/components/ui/Breadcrumb.d.ts +13 -1
- package/dist/components/ui/Breadcrumb.js +28 -19
- package/dist/components/ui/Breadcrumb.js.map +1 -1
- package/dist/components/ui/CodeBlock.cjs +2 -2
- package/dist/components/ui/CodeBlock.cjs.map +1 -1
- package/dist/components/ui/CodeBlock.d.ts +28 -1
- package/dist/components/ui/CodeBlock.js +94 -36
- package/dist/components/ui/CodeBlock.js.map +1 -1
- package/dist/components/ui/DetailBeside.cjs +1 -1
- package/dist/components/ui/DetailBeside.cjs.map +1 -1
- package/dist/components/ui/DetailBeside.d.ts +38 -9
- package/dist/components/ui/DetailBeside.js +104 -85
- package/dist/components/ui/DetailBeside.js.map +1 -1
- package/dist/components/ui/LineIcon.cjs +2 -0
- package/dist/components/ui/LineIcon.cjs.map +1 -0
- package/dist/components/ui/LineIcon.d.ts +15 -0
- package/dist/components/ui/LineIcon.js +33 -0
- package/dist/components/ui/LineIcon.js.map +1 -0
- package/dist/components/ui/PaneLayout.cjs +2 -0
- package/dist/components/ui/PaneLayout.cjs.map +1 -0
- package/dist/components/ui/PaneLayout.d.ts +33 -0
- package/dist/components/ui/PaneLayout.js +34 -0
- package/dist/components/ui/PaneLayout.js.map +1 -0
- package/dist/components/ui/Quote.cjs +2 -0
- package/dist/components/ui/Quote.cjs.map +1 -0
- package/dist/components/ui/Quote.d.ts +12 -0
- package/dist/components/ui/Quote.js +10 -0
- package/dist/components/ui/Quote.js.map +1 -0
- package/dist/components/ui/SectionDivider.cjs +1 -1
- package/dist/components/ui/SectionDivider.cjs.map +1 -1
- package/dist/components/ui/SectionDivider.d.ts +7 -1
- package/dist/components/ui/SectionDivider.js +9 -7
- package/dist/components/ui/SectionDivider.js.map +1 -1
- package/dist/components/ui/StatusDot.cjs.map +1 -1
- package/dist/components/ui/StatusDot.d.ts +3 -2
- package/dist/components/ui/StatusDot.js.map +1 -1
- package/dist/components/ui/Toolbar.cjs +1 -1
- package/dist/components/ui/Toolbar.cjs.map +1 -1
- package/dist/components/ui/Toolbar.d.ts +10 -1
- package/dist/components/ui/Toolbar.js +17 -7
- package/dist/components/ui/Toolbar.js.map +1 -1
- package/dist/components/ui/index.d.ts +10 -2
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +343 -332
- package/dist/index.js.map +1 -1
- package/dist/layouts/PageWrapper.cjs +1 -1
- package/dist/layouts/PageWrapper.cjs.map +1 -1
- package/dist/layouts/PageWrapper.d.ts +7 -1
- package/dist/layouts/PageWrapper.js +13 -8
- package/dist/layouts/PageWrapper.js.map +1 -1
- package/dist/layouts/shell/AegisShell.cjs +1 -1
- package/dist/layouts/shell/AegisShell.cjs.map +1 -1
- package/dist/layouts/shell/AegisShell.d.ts +1 -1
- package/dist/layouts/shell/AegisShell.js +193 -150
- package/dist/layouts/shell/AegisShell.js.map +1 -1
- package/dist/layouts/shell/ShellMenuToggle.cjs +2 -0
- package/dist/layouts/shell/ShellMenuToggle.cjs.map +1 -0
- package/dist/layouts/shell/ShellMenuToggle.d.ts +8 -0
- package/dist/layouts/shell/ShellMenuToggle.js +23 -0
- package/dist/layouts/shell/ShellMenuToggle.js.map +1 -0
- package/dist/layouts/shell/Sidebar.cjs +1 -1
- package/dist/layouts/shell/Sidebar.cjs.map +1 -1
- package/dist/layouts/shell/Sidebar.d.ts +10 -4
- package/dist/layouts/shell/Sidebar.js +39 -32
- package/dist/layouts/shell/Sidebar.js.map +1 -1
- package/dist/layouts/shell/TopHeader.cjs +1 -1
- package/dist/layouts/shell/TopHeader.cjs.map +1 -1
- package/dist/layouts/shell/TopHeader.d.ts +14 -0
- package/dist/layouts/shell/TopHeader.js +127 -110
- package/dist/layouts/shell/TopHeader.js.map +1 -1
- package/dist/layouts/shell/buildRouteTree.cjs +1 -1
- package/dist/layouts/shell/buildRouteTree.cjs.map +1 -1
- package/dist/layouts/shell/buildRouteTree.js +5 -5
- package/dist/layouts/shell/buildRouteTree.js.map +1 -1
- package/dist/layouts/shell/index.d.ts +1 -0
- package/dist/layouts/shell/shellNavContext.cjs +2 -0
- package/dist/layouts/shell/shellNavContext.cjs.map +1 -0
- package/dist/layouts/shell/shellNavContext.d.ts +8 -0
- package/dist/layouts/shell/shellNavContext.js +6 -0
- package/dist/layouts/shell/shellNavContext.js.map +1 -0
- package/dist/layouts/shell/types.d.ts +21 -0
- package/dist/lib/scrollView.cjs +1 -1
- package/dist/lib/scrollView.cjs.map +1 -1
- package/dist/lib/scrollView.d.ts +6 -0
- package/dist/lib/scrollView.js +26 -17
- package/dist/lib/scrollView.js.map +1 -1
- package/dist/locale/strings.cjs +1 -1
- package/dist/locale/strings.cjs.map +1 -1
- package/dist/locale/strings.d.ts +2 -0
- package/dist/locale/strings.js +7 -5
- package/dist/locale/strings.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -1,198 +1,241 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useContext as
|
|
3
|
-
import { createPortal as
|
|
4
|
-
import { useLocation as
|
|
5
|
-
import { AmbientBackground as
|
|
6
|
-
import { Button as
|
|
7
|
-
import { useStorageItem as
|
|
8
|
-
import { useWindowScrolled as
|
|
9
|
-
import { ThemeContext as
|
|
10
|
-
import { SkipLink as
|
|
1
|
+
import { jsx as e, jsxs as u, Fragment as b } from "react/jsx-runtime";
|
|
2
|
+
import { useContext as ae, useState as me, useRef as de, useMemo as p, useEffect as ce, useCallback as j } from "react";
|
|
3
|
+
import { createPortal as ue } from "react-dom";
|
|
4
|
+
import { useLocation as pe, useNavigate as ge, useRoutes as he, matchRoutes as fe, useHref as be } from "react-router-dom";
|
|
5
|
+
import { AmbientBackground as ve } from "../../components/ui/AmbientBackground.js";
|
|
6
|
+
import { Button as Se } from "../../components/ui/Button.js";
|
|
7
|
+
import { useStorageItem as Ae } from "../../hooks/useStorageItem.js";
|
|
8
|
+
import { useWindowScrolled as Re } from "../../hooks/useWindowScrolled.js";
|
|
9
|
+
import { ThemeContext as Ce } from "../../theme/themeContext.js";
|
|
10
|
+
import { SkipLink as we } from "../SkipLink.js";
|
|
11
11
|
/* empty css */
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
|
|
33
|
-
|
|
12
|
+
import { AppSwitcher as Be } from "./AppSwitcher.js";
|
|
13
|
+
import { BreadcrumbBar as Pe } from "./BreadcrumbBar.js";
|
|
14
|
+
import { RouteErrorBoundary as Ie } from "./RouteErrorBoundary.js";
|
|
15
|
+
import { ShellCommandPalette as Ne } from "./ShellCommandPalette.js";
|
|
16
|
+
import { ShellNotificationBell as Te } from "./ShellNotificationBell.js";
|
|
17
|
+
import { Sidebar as D } from "./Sidebar.js";
|
|
18
|
+
import { TopHeader as _e, ActiveEnvironmentSwitcher as ke, UserMenu as xe, AgentPanelToggle as Me, ShellBrand as ye } from "./TopHeader.js";
|
|
19
|
+
import { ActiveAppContext as Ee } from "./activeAppContext.js";
|
|
20
|
+
import { isAppVisible as He, findActiveApp as Oe, assertUniqueBasePaths as Le } from "./apps.js";
|
|
21
|
+
import { buildRouteTree as Ue } from "./buildRouteTree.js";
|
|
22
|
+
import { normalizeBasePath as Ve } from "./paths.js";
|
|
23
|
+
import { ShellNavContext as We } from "./shellNavContext.js";
|
|
24
|
+
import { useAgentPanel as je } from "./useAgentPanel.js";
|
|
25
|
+
import { useAppCommands as De } from "./useAppCommands.js";
|
|
26
|
+
import { useMobileNav as Ke } from "./useMobileNav.js";
|
|
27
|
+
import { useShellUser as qe } from "./useShellUser.js";
|
|
28
|
+
import { useWarnOnce as ze } from "./useWarnOnce.js";
|
|
29
|
+
import { useStrings as Ye } from "../../locale/useStrings.js";
|
|
30
|
+
import { useAuth as $e } from "../../auth/useAuth.js";
|
|
31
|
+
import { useHasCommandProvider as Fe } from "../../commands/useCommands.js";
|
|
32
|
+
import { AegisRuntimeProvider as Ge } from "../../agent/core/AegisRuntimeProvider.js";
|
|
33
|
+
import { EnvironmentProvider as Je } from "./environments/EnvironmentProvider.js";
|
|
34
|
+
import { AskOverlay as Qe } from "../../agent/ask/AskOverlay.js";
|
|
35
|
+
const Xe = "aegis-shell.sidebar-collapsed";
|
|
36
|
+
function Ho({
|
|
34
37
|
brand: s,
|
|
35
|
-
apps:
|
|
36
|
-
rootRoutes:
|
|
37
|
-
fallbackPath:
|
|
38
|
-
notFoundElement:
|
|
39
|
-
user:
|
|
40
|
-
userMenu:
|
|
41
|
-
headerCenter:
|
|
42
|
-
headerActions:
|
|
43
|
-
appSwitcher:
|
|
44
|
-
elevateHeaderOnScroll:
|
|
45
|
-
ambient:
|
|
46
|
-
inboxPath:
|
|
47
|
-
onAppSwitch:
|
|
48
|
-
enableCommandPalette:
|
|
49
|
-
commandGroupOrder:
|
|
50
|
-
agentPanel:
|
|
51
|
-
agentRuntime:
|
|
38
|
+
apps: i,
|
|
39
|
+
rootRoutes: a = [],
|
|
40
|
+
fallbackPath: m,
|
|
41
|
+
notFoundElement: w,
|
|
42
|
+
user: K,
|
|
43
|
+
userMenu: q,
|
|
44
|
+
headerCenter: z,
|
|
45
|
+
headerActions: B,
|
|
46
|
+
appSwitcher: P = !0,
|
|
47
|
+
elevateHeaderOnScroll: Y = !1,
|
|
48
|
+
ambient: v,
|
|
49
|
+
inboxPath: S,
|
|
50
|
+
onAppSwitch: I,
|
|
51
|
+
enableCommandPalette: N = !1,
|
|
52
|
+
commandGroupOrder: $,
|
|
53
|
+
agentPanel: T,
|
|
54
|
+
agentRuntime: F,
|
|
55
|
+
chrome: G = "header"
|
|
52
56
|
}) {
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
),
|
|
56
|
-
() =>
|
|
57
|
-
[
|
|
58
|
-
),
|
|
59
|
-
() =>
|
|
60
|
-
[
|
|
61
|
-
),
|
|
62
|
-
() =>
|
|
63
|
-
[
|
|
57
|
+
const d = pe(), J = ge(), _ = Ye(), { pathname: c } = d, r = $e(), k = ae(Ce), [Q, x] = Ae(
|
|
58
|
+
Xe
|
|
59
|
+
), g = Q === "1", [M, X] = me(null), Z = Re(), ee = Y && Z, y = de(null), A = qe(K, q, r), R = p(
|
|
60
|
+
() => i.filter((f) => He(f, r.status, r.user)),
|
|
61
|
+
[i, r.status, r.user]
|
|
62
|
+
), o = p(
|
|
63
|
+
() => Oe(i, c),
|
|
64
|
+
[i, c]
|
|
65
|
+
), oe = p(
|
|
66
|
+
() => o ? { id: o.id, basePath: Ve(o.basePath) } : null,
|
|
67
|
+
[o]
|
|
64
68
|
);
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}, [
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
ce(() => {
|
|
70
|
+
Le(i);
|
|
71
|
+
}, [i]), De(R, o?.id);
|
|
72
|
+
const E = Fe();
|
|
73
|
+
ze(
|
|
74
|
+
N && !E,
|
|
71
75
|
"AegisShell: enableCommandPalette needs a <CommandProvider> above the shell; the command palette is not mounted."
|
|
72
76
|
);
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
const n = je(T), t = Ke(c), l = (o?.chrome ?? G) === "sidebar", te = p(
|
|
78
|
+
() => l ? {
|
|
79
|
+
open: t.open,
|
|
80
|
+
toggle: t.toggle,
|
|
81
|
+
toggleRef: t.toggleRef
|
|
82
|
+
} : null,
|
|
83
|
+
[l, t.open, t.toggle, t.toggleRef]
|
|
84
|
+
), re = j(() => {
|
|
85
|
+
x(g ? "0" : "1");
|
|
86
|
+
}, [x, g]), C = p(
|
|
87
|
+
() => Ue({ apps: i, rootRoutes: a, fallbackPath: m, notFoundElement: w, auth: r }),
|
|
88
|
+
[i, a, m, w, r]
|
|
89
|
+
), ie = he(C.routes), H = fe(C.routes, d), O = H ? H[0].route : void 0, L = /* @__PURE__ */ e(Ie, { resetKey: d.key, children: ie }), U = be("/"), V = U.startsWith("/") ? U.replace(/\/+$/, "") : void 0, ne = j(() => {
|
|
90
|
+
const f = typeof window < "u" ? window : null;
|
|
80
91
|
return {
|
|
81
|
-
currentAppId:
|
|
92
|
+
currentAppId: o?.id ?? null,
|
|
82
93
|
route: {
|
|
83
|
-
pathname:
|
|
84
|
-
search:
|
|
94
|
+
pathname: c,
|
|
95
|
+
search: d.search,
|
|
85
96
|
params: {},
|
|
86
|
-
basename:
|
|
97
|
+
basename: V
|
|
87
98
|
},
|
|
88
99
|
breadcrumbs: [],
|
|
89
|
-
theme:
|
|
100
|
+
theme: k?.resolved ?? "light",
|
|
90
101
|
viewport: {
|
|
91
|
-
width:
|
|
92
|
-
height:
|
|
102
|
+
width: f?.innerWidth ?? 0,
|
|
103
|
+
height: f?.innerHeight ?? 0
|
|
93
104
|
}
|
|
94
105
|
};
|
|
95
|
-
}, [
|
|
96
|
-
if (
|
|
97
|
-
return /* @__PURE__ */
|
|
98
|
-
const
|
|
106
|
+
}, [o, c, d.search, V, k]);
|
|
107
|
+
if (O && C.bareRoutes.has(O))
|
|
108
|
+
return /* @__PURE__ */ e("div", { children: L });
|
|
109
|
+
const h = !!(o?.sidebar && o.sidebar.length > 0), se = l || h && !g, W = r.status === "unauthenticated" && r.signIn && /* @__PURE__ */ e(
|
|
110
|
+
Se,
|
|
111
|
+
{
|
|
112
|
+
onClick: () => {
|
|
113
|
+
r.signIn?.({});
|
|
114
|
+
},
|
|
115
|
+
children: _.signIn
|
|
116
|
+
}
|
|
117
|
+
), le = [
|
|
99
118
|
"aegis-shell",
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
119
|
+
l ? "aegis-shell--chrome-sidebar" : "",
|
|
120
|
+
se ? "aegis-shell--with-sidebar" : "aegis-shell--no-sidebar",
|
|
121
|
+
t.open ? "aegis-shell--mobile-nav-open" : "",
|
|
122
|
+
n.open ? "aegis-shell--with-agent-panel" : "",
|
|
123
|
+
v ? "aegis-shell--ambient" : ""
|
|
104
124
|
].filter(Boolean).join(" ");
|
|
105
|
-
return /* @__PURE__ */
|
|
106
|
-
|
|
125
|
+
return /* @__PURE__ */ e(
|
|
126
|
+
Ge,
|
|
107
127
|
{
|
|
108
|
-
runtime:
|
|
109
|
-
appId:
|
|
110
|
-
shellSnapshot:
|
|
111
|
-
navigate:
|
|
112
|
-
children: /* @__PURE__ */
|
|
113
|
-
/* @__PURE__ */
|
|
114
|
-
|
|
115
|
-
/* @__PURE__ */
|
|
116
|
-
|
|
128
|
+
runtime: F,
|
|
129
|
+
appId: o?.id ?? null,
|
|
130
|
+
shellSnapshot: ne,
|
|
131
|
+
navigate: J,
|
|
132
|
+
children: /* @__PURE__ */ e(Je, { app: o, children: /* @__PURE__ */ u("div", { ref: t.shellRef, className: le, children: [
|
|
133
|
+
/* @__PURE__ */ e(we, { targetId: "aegis-main", targetRef: y }),
|
|
134
|
+
v && /* @__PURE__ */ e(ve, { variant: v }),
|
|
135
|
+
!l && /* @__PURE__ */ e(
|
|
136
|
+
_e,
|
|
117
137
|
{
|
|
118
138
|
brand: s,
|
|
119
|
-
apps:
|
|
120
|
-
activeAppId:
|
|
121
|
-
onAppSwitch:
|
|
122
|
-
appSwitcher:
|
|
123
|
-
scrolled:
|
|
124
|
-
user:
|
|
125
|
-
headerCenter:
|
|
126
|
-
headerActions: /* @__PURE__ */ b
|
|
139
|
+
apps: R,
|
|
140
|
+
activeAppId: o?.id,
|
|
141
|
+
onAppSwitch: I,
|
|
142
|
+
appSwitcher: P,
|
|
143
|
+
scrolled: ee,
|
|
144
|
+
user: A,
|
|
145
|
+
headerCenter: z,
|
|
146
|
+
headerActions: /* @__PURE__ */ u(b, { children: [
|
|
147
|
+
B,
|
|
148
|
+
W
|
|
149
|
+
] }),
|
|
150
|
+
inboxPath: r.status === "authenticated" ? S : void 0,
|
|
151
|
+
onMobileMenuToggle: t.toggle,
|
|
152
|
+
mobileMenuOpen: t.open,
|
|
153
|
+
menuToggleRef: t.toggleRef,
|
|
154
|
+
showMobileMenu: h,
|
|
155
|
+
sidebarCollapsible: h,
|
|
156
|
+
sidebarCollapsed: g,
|
|
157
|
+
onSidebarToggle: re,
|
|
158
|
+
inlineSlotRef: X,
|
|
159
|
+
inlineSlotActive: !!o?.header,
|
|
160
|
+
agentPanelOpen: n.open,
|
|
161
|
+
onAgentPanelToggle: n.toggle
|
|
162
|
+
}
|
|
163
|
+
),
|
|
164
|
+
l ? /* @__PURE__ */ e(
|
|
165
|
+
D,
|
|
166
|
+
{
|
|
167
|
+
activeApp: o,
|
|
168
|
+
drawerRef: t.drawerRef,
|
|
169
|
+
top: /* @__PURE__ */ u(b, { children: [
|
|
170
|
+
P ? /* @__PURE__ */ e(
|
|
171
|
+
Be,
|
|
172
|
+
{
|
|
173
|
+
apps: R,
|
|
174
|
+
activeAppId: o?.id,
|
|
175
|
+
onAppSwitch: I
|
|
176
|
+
}
|
|
177
|
+
) : null,
|
|
178
|
+
/* @__PURE__ */ e(ye, { brand: s })
|
|
179
|
+
] }),
|
|
180
|
+
footer: /* @__PURE__ */ u(b, { children: [
|
|
181
|
+
/* @__PURE__ */ e(ke, {}),
|
|
182
|
+
B,
|
|
127
183
|
W,
|
|
128
|
-
r.status === "
|
|
129
|
-
|
|
184
|
+
r.status === "authenticated" && S && /* @__PURE__ */ e(Te, { inboxPath: S }),
|
|
185
|
+
A && /* @__PURE__ */ e(xe, { user: A, align: "left" }),
|
|
186
|
+
n.toggle && /* @__PURE__ */ e(
|
|
187
|
+
Me,
|
|
130
188
|
{
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
},
|
|
134
|
-
children: R.signIn
|
|
189
|
+
open: n.open,
|
|
190
|
+
onToggle: n.toggle
|
|
135
191
|
}
|
|
136
192
|
)
|
|
137
|
-
] })
|
|
138
|
-
inboxPath: r.status === "authenticated" ? V : void 0,
|
|
139
|
-
onMobileMenuToggle: i.toggle,
|
|
140
|
-
mobileMenuOpen: i.open,
|
|
141
|
-
menuToggleRef: i.toggleRef,
|
|
142
|
-
showMobileMenu: u,
|
|
143
|
-
sidebarCollapsible: u,
|
|
144
|
-
sidebarCollapsed: d,
|
|
145
|
-
onSidebarToggle: X,
|
|
146
|
-
inlineSlotRef: $,
|
|
147
|
-
inlineSlotActive: !!e?.header,
|
|
148
|
-
agentPanelOpen: c.open,
|
|
149
|
-
onAgentPanelToggle: c.toggle
|
|
193
|
+
] })
|
|
150
194
|
}
|
|
151
|
-
),
|
|
152
|
-
|
|
153
|
-
/* @__PURE__ */ o(
|
|
195
|
+
) : h && /* @__PURE__ */ e(D, { activeApp: o, drawerRef: t.drawerRef }),
|
|
196
|
+
/* @__PURE__ */ e(
|
|
154
197
|
"button",
|
|
155
198
|
{
|
|
156
|
-
ref:
|
|
199
|
+
ref: t.backdropRef,
|
|
157
200
|
type: "button",
|
|
158
201
|
className: "aegis-shell__backdrop",
|
|
159
|
-
"aria-label":
|
|
202
|
+
"aria-label": _.closeNavigation,
|
|
160
203
|
tabIndex: -1,
|
|
161
|
-
onClick:
|
|
204
|
+
onClick: t.dismiss
|
|
162
205
|
}
|
|
163
206
|
),
|
|
164
|
-
/* @__PURE__ */
|
|
207
|
+
/* @__PURE__ */ e(
|
|
165
208
|
"main",
|
|
166
209
|
{
|
|
167
210
|
id: "aegis-main",
|
|
168
|
-
ref:
|
|
211
|
+
ref: y,
|
|
169
212
|
tabIndex: -1,
|
|
170
213
|
className: "aegis-shell__main",
|
|
171
|
-
children:
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
/* @__PURE__ */
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
/* @__PURE__ */
|
|
214
|
+
children: Ze(
|
|
215
|
+
o,
|
|
216
|
+
oe,
|
|
217
|
+
/* @__PURE__ */ u(We.Provider, { value: te, children: [
|
|
218
|
+
o?.header && M && ue(o.header, M),
|
|
219
|
+
o?.breadcrumbBar !== !1 && /* @__PURE__ */ e(Pe, { activeApp: o }),
|
|
220
|
+
/* @__PURE__ */ e("div", { className: "aegis-shell__content", children: L })
|
|
178
221
|
] })
|
|
179
222
|
)
|
|
180
223
|
}
|
|
181
224
|
),
|
|
182
|
-
|
|
183
|
-
/* @__PURE__ */
|
|
184
|
-
|
|
225
|
+
n.open && /* @__PURE__ */ e("div", { className: "aegis-shell__agent-panel", children: T }),
|
|
226
|
+
/* @__PURE__ */ e(Qe, {}),
|
|
227
|
+
N && E && /* @__PURE__ */ e(Ne, { groupOrder: $ })
|
|
185
228
|
] }) })
|
|
186
229
|
}
|
|
187
230
|
);
|
|
188
231
|
}
|
|
189
|
-
function
|
|
190
|
-
if (!s || !
|
|
191
|
-
return
|
|
192
|
-
const
|
|
193
|
-
return s.wrap ? /* @__PURE__ */
|
|
232
|
+
function Ze(s, i, a) {
|
|
233
|
+
if (!s || !i)
|
|
234
|
+
return a;
|
|
235
|
+
const m = /* @__PURE__ */ e(Ee.Provider, { value: i, children: a });
|
|
236
|
+
return s.wrap ? /* @__PURE__ */ e(b, { children: s.wrap(m) }) : m;
|
|
194
237
|
}
|
|
195
238
|
export {
|
|
196
|
-
|
|
239
|
+
Ho as AegisShell
|
|
197
240
|
};
|
|
198
241
|
//# sourceMappingURL=AegisShell.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AegisShell.js","sources":["../../../src/layouts/shell/AegisShell.tsx"],"sourcesContent":["import {\n type ReactElement,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport { createPortal } from 'react-dom';\n\nimport {\n matchRoutes,\n useHref,\n useLocation,\n useNavigate,\n useRoutes,\n} from 'react-router-dom';\n\nimport {\n AegisRuntimeProvider,\n AskOverlay,\n type ShellSnapshot,\n} from '../../agent';\nimport { useAuth } from '../../auth';\nimport { useHasCommandProvider } from '../../commands';\nimport { AmbientBackground } from '../../components/ui/AmbientBackground';\nimport { Button } from '../../components/ui/Button';\nimport { useStorageItem } from '../../hooks/useStorageItem';\nimport { useWindowScrolled } from '../../hooks/useWindowScrolled';\nimport { useStrings } from '../../locale';\nimport { ThemeContext } from '../../theme/themeContext';\nimport { SkipLink } from '../SkipLink';\nimport './AegisShell.css';\nimport { BreadcrumbBar } from './BreadcrumbBar';\nimport { RouteErrorBoundary } from './RouteErrorBoundary';\nimport { ShellCommandPalette } from './ShellCommandPalette';\nimport { Sidebar } from './Sidebar';\nimport { TopHeader } from './TopHeader';\nimport { ActiveAppContext } from './activeAppContext';\nimport { assertUniqueBasePaths, findActiveApp, isAppVisible } from './apps';\nimport { buildRouteTree } from './buildRouteTree';\nimport { EnvironmentProvider } from './environments';\nimport { normalizeBasePath } from './paths';\nimport type { AegisApp, AegisShellProps } from './types';\nimport { useAgentPanel } from './useAgentPanel';\nimport { useAppCommands } from './useAppCommands';\nimport { useMobileNav } from './useMobileNav';\nimport { useShellUser } from './useShellUser';\nimport { useWarnOnce } from './useWarnOnce';\n\nconst SIDEBAR_COLLAPSED_KEY = 'aegis-shell.sidebar-collapsed';\n\n/**\n * Top-level layout: top header, two-section sidebar, breadcrumb bar, and\n * a routed content area composed from `apps`.\n *\n * Each app's `routes` is mounted under its `basePath`. The shell renders\n * the chrome around every app — apps themselves only render page content\n * inside a `<PageWrapper>` (the shell wraps the outlet automatically). A\n * page that throws while rendering shows an error with a retry in the page\n * area; the chrome stays up.\n */\nexport function AegisShell({\n brand,\n apps,\n rootRoutes = [],\n fallbackPath,\n notFoundElement,\n user,\n userMenu,\n headerCenter,\n headerActions,\n appSwitcher = true,\n elevateHeaderOnScroll = false,\n ambient,\n inboxPath,\n onAppSwitch,\n enableCommandPalette = false,\n commandGroupOrder,\n agentPanel,\n agentRuntime,\n}: AegisShellProps): ReactElement {\n const location = useLocation();\n const navigate = useNavigate();\n const strings = useStrings();\n const { pathname } = location;\n const auth = useAuth();\n const themeCtx = useContext(ThemeContext);\n const [sidebarCollapsedValue, setSidebarCollapsedValue] = useStorageItem(\n SIDEBAR_COLLAPSED_KEY,\n );\n const sidebarCollapsed = sidebarCollapsedValue === '1';\n const [inlineSlot, setInlineSlot] = useState<HTMLDivElement | null>(null);\n const windowScrolled = useWindowScrolled();\n const headerScrolled = elevateHeaderOnScroll && windowScrolled;\n const mainRef = useRef<HTMLElement>(null);\n\n const resolvedUser = useShellUser(user, userMenu, auth);\n\n const visibleApps = useMemo(\n () => apps.filter((app) => isAppVisible(app, auth.status, auth.user)),\n [apps, auth.status, auth.user],\n );\n\n const activeApp = useMemo(\n () => findActiveApp(apps, pathname),\n [apps, pathname],\n );\n\n const activeAppValue = useMemo(\n () =>\n activeApp\n ? { id: activeApp.id, basePath: normalizeBasePath(activeApp.basePath) }\n : null,\n [activeApp],\n );\n\n useEffect(() => {\n assertUniqueBasePaths(apps);\n }, [apps]);\n\n useAppCommands(visibleApps, activeApp?.id);\n const hasCommandProvider = useHasCommandProvider();\n useWarnOnce(\n enableCommandPalette && !hasCommandProvider,\n 'AegisShell: enableCommandPalette needs a <CommandProvider> above the shell; the command palette is not mounted.',\n );\n\n const agent = useAgentPanel(agentPanel);\n const mobileNav = useMobileNav(pathname);\n\n const toggleSidebar = useCallback(() => {\n setSidebarCollapsedValue(sidebarCollapsed ? '0' : '1');\n }, [setSidebarCollapsedValue, sidebarCollapsed]);\n\n const routeTree = useMemo(\n () =>\n buildRouteTree({ apps, rootRoutes, fallbackPath, notFoundElement, auth }),\n [apps, rootRoutes, fallbackPath, notFoundElement, auth],\n );\n const element = useRoutes(routeTree.routes);\n const matches = matchRoutes(routeTree.routes, location);\n const topRoute = matches ? matches[0].route : undefined;\n const page = (\n <RouteErrorBoundary resetKey={location.key}>{element}</RouteErrorBoundary>\n );\n\n const rootHref = useHref('/');\n // A hash router's href is not a path prefix, so it reports none.\n const basename = rootHref.startsWith('/')\n ? rootHref.replace(/\\/+$/, '')\n : undefined;\n\n const shellSnapshot = useCallback((): ShellSnapshot => {\n const w = typeof window !== 'undefined' ? window : null;\n return {\n currentAppId: activeApp?.id ?? null,\n route: {\n pathname,\n search: location.search,\n params: {},\n basename,\n },\n breadcrumbs: [],\n theme: themeCtx?.resolved ?? 'light',\n viewport: {\n width: w?.innerWidth ?? 0,\n height: w?.innerHeight ?? 0,\n },\n };\n }, [activeApp, pathname, location.search, basename, themeCtx]);\n\n // Bare routes (e.g. /login) render without the shell chrome.\n if (topRoute && routeTree.bareRoutes.has(topRoute)) {\n return <div>{page}</div>;\n }\n\n const appHasSidebar = Boolean(\n activeApp?.sidebar && activeApp.sidebar.length > 0,\n );\n const hasSidebar = appHasSidebar && !sidebarCollapsed;\n\n const shellClass = [\n 'aegis-shell',\n hasSidebar ? 'aegis-shell--with-sidebar' : 'aegis-shell--no-sidebar',\n mobileNav.open ? 'aegis-shell--mobile-nav-open' : '',\n agent.open ? 'aegis-shell--with-agent-panel' : '',\n ambient ? 'aegis-shell--ambient' : '',\n ]\n .filter(Boolean)\n .join(' ');\n\n return (\n <AegisRuntimeProvider\n runtime={agentRuntime}\n appId={activeApp?.id ?? null}\n shellSnapshot={shellSnapshot}\n navigate={navigate}\n >\n <EnvironmentProvider app={activeApp}>\n <div ref={mobileNav.shellRef} className={shellClass}>\n <SkipLink targetId=\"aegis-main\" targetRef={mainRef} />\n {ambient && <AmbientBackground variant={ambient} />}\n <TopHeader\n brand={brand}\n apps={visibleApps}\n activeAppId={activeApp?.id}\n onAppSwitch={onAppSwitch}\n appSwitcher={appSwitcher}\n scrolled={headerScrolled}\n user={resolvedUser}\n headerCenter={headerCenter}\n headerActions={\n <>\n {headerActions}\n {auth.status === 'unauthenticated' && auth.signIn && (\n <Button\n onClick={() => {\n void auth.signIn?.({});\n }}\n >\n {strings.signIn}\n </Button>\n )}\n </>\n }\n inboxPath={auth.status === 'authenticated' ? inboxPath : undefined}\n onMobileMenuToggle={mobileNav.toggle}\n mobileMenuOpen={mobileNav.open}\n menuToggleRef={mobileNav.toggleRef}\n showMobileMenu={appHasSidebar}\n sidebarCollapsible={appHasSidebar}\n sidebarCollapsed={sidebarCollapsed}\n onSidebarToggle={toggleSidebar}\n inlineSlotRef={setInlineSlot}\n inlineSlotActive={Boolean(activeApp?.header)}\n agentPanelOpen={agent.open}\n onAgentPanelToggle={agent.toggle}\n />\n {appHasSidebar && (\n <Sidebar activeApp={activeApp} drawerRef={mobileNav.drawerRef} />\n )}\n <button\n ref={mobileNav.backdropRef}\n type=\"button\"\n className=\"aegis-shell__backdrop\"\n aria-label={strings.closeNavigation}\n tabIndex={-1}\n onClick={mobileNav.dismiss}\n />\n <main\n id=\"aegis-main\"\n ref={mainRef}\n tabIndex={-1}\n className=\"aegis-shell__main\"\n >\n {renderAppRegion(\n activeApp,\n activeAppValue,\n <>\n {activeApp?.header &&\n inlineSlot &&\n createPortal(activeApp.header, inlineSlot)}\n {activeApp?.breadcrumbBar !== false && (\n <BreadcrumbBar activeApp={activeApp} />\n )}\n <div className=\"aegis-shell__content\">{page}</div>\n </>,\n )}\n </main>\n {agent.open && (\n <div className=\"aegis-shell__agent-panel\">{agentPanel}</div>\n )}\n <AskOverlay />\n {enableCommandPalette && hasCommandProvider && (\n <ShellCommandPalette groupOrder={commandGroupOrder} />\n )}\n </div>\n </EnvironmentProvider>\n </AegisRuntimeProvider>\n );\n}\n\nfunction renderAppRegion(\n app: AegisApp | undefined,\n appValue: { id: string; basePath: string } | null,\n children: ReactElement,\n): ReactElement {\n if (!app || !appValue) {\n return children;\n }\n const inner = (\n <ActiveAppContext.Provider value={appValue}>\n {children}\n </ActiveAppContext.Provider>\n );\n return app.wrap ? <>{app.wrap(inner)}</> : inner;\n}\n"],"names":["SIDEBAR_COLLAPSED_KEY","AegisShell","brand","apps","rootRoutes","fallbackPath","notFoundElement","user","userMenu","headerCenter","headerActions","appSwitcher","elevateHeaderOnScroll","ambient","inboxPath","onAppSwitch","enableCommandPalette","commandGroupOrder","agentPanel","agentRuntime","location","useLocation","navigate","useNavigate","strings","useStrings","pathname","auth","useAuth","themeCtx","useContext","ThemeContext","sidebarCollapsedValue","setSidebarCollapsedValue","useStorageItem","sidebarCollapsed","inlineSlot","setInlineSlot","useState","windowScrolled","useWindowScrolled","headerScrolled","mainRef","useRef","resolvedUser","useShellUser","visibleApps","useMemo","app","isAppVisible","activeApp","findActiveApp","activeAppValue","normalizeBasePath","useEffect","assertUniqueBasePaths","useAppCommands","hasCommandProvider","useHasCommandProvider","useWarnOnce","agent","useAgentPanel","mobileNav","useMobileNav","toggleSidebar","useCallback","routeTree","buildRouteTree","element","useRoutes","matches","matchRoutes","topRoute","page","jsx","RouteErrorBoundary","rootHref","useHref","basename","shellSnapshot","w","appHasSidebar","shellClass","AegisRuntimeProvider","EnvironmentProvider","jsxs","SkipLink","AmbientBackground","TopHeader","Fragment","Button","Sidebar","renderAppRegion","createPortal","BreadcrumbBar","AskOverlay","ShellCommandPalette","appValue","children","inner","ActiveAppContext"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoDA,MAAMA,KAAwB;AAYvB,SAASC,GAAW;AAAA,EACzB,OAAAC;AAAA,EACA,MAAAC;AAAA,EACA,YAAAC,IAAa,CAAA;AAAA,EACb,cAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,cAAAC;AAAA,EACA,eAAAC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AACsB,IAAA,EAAoB,YAAY/E,EAAA,CAAmB;AAAA,MAAA,EAAA,CAExD,EAAA,CACF;AAAA,IAAA;AAAA,EAAA;AAGN;AAEA,SAAS2E,GACP5C,GACAiD,GACAC,GACc;AACd,MAAI,CAAClD,KAAO,CAACiD;AACX,WAAOC;AAET,QAAMC,IACJ,gBAAAzB,EAAC0B,GAAiB,UAAjB,EAA0B,OAAOH,GAC/B,UAAAC,GACH;AAEF,SAAOlD,EAAI,OAAO,gBAAA0B,EAAAe,GAAA,EAAG,YAAI,KAAKU,CAAK,GAAE,IAAMA;AAC7C;"}
|
|
1
|
+
{"version":3,"file":"AegisShell.js","sources":["../../../src/layouts/shell/AegisShell.tsx"],"sourcesContent":["import {\n type ReactElement,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport { createPortal } from 'react-dom';\n\nimport {\n matchRoutes,\n useHref,\n useLocation,\n useNavigate,\n useRoutes,\n} from 'react-router-dom';\n\nimport {\n AegisRuntimeProvider,\n AskOverlay,\n type ShellSnapshot,\n} from '../../agent';\nimport { useAuth } from '../../auth';\nimport { useHasCommandProvider } from '../../commands';\nimport { AmbientBackground } from '../../components/ui/AmbientBackground';\nimport { Button } from '../../components/ui/Button';\nimport { useStorageItem } from '../../hooks/useStorageItem';\nimport { useWindowScrolled } from '../../hooks/useWindowScrolled';\nimport { useStrings } from '../../locale';\nimport { ThemeContext } from '../../theme/themeContext';\nimport { SkipLink } from '../SkipLink';\nimport './AegisShell.css';\nimport { AppSwitcher } from './AppSwitcher';\nimport { BreadcrumbBar } from './BreadcrumbBar';\nimport { RouteErrorBoundary } from './RouteErrorBoundary';\nimport { ShellCommandPalette } from './ShellCommandPalette';\nimport { ShellNotificationBell } from './ShellNotificationBell';\nimport { Sidebar } from './Sidebar';\nimport {\n ActiveEnvironmentSwitcher,\n AgentPanelToggle,\n ShellBrand,\n TopHeader,\n UserMenu,\n} from './TopHeader';\nimport { ActiveAppContext } from './activeAppContext';\nimport { assertUniqueBasePaths, findActiveApp, isAppVisible } from './apps';\nimport { buildRouteTree } from './buildRouteTree';\nimport { EnvironmentProvider } from './environments';\nimport { normalizeBasePath } from './paths';\nimport { ShellNavContext, type ShellNavContextValue } from './shellNavContext';\nimport type { AegisApp, AegisShellProps } from './types';\nimport { useAgentPanel } from './useAgentPanel';\nimport { useAppCommands } from './useAppCommands';\nimport { useMobileNav } from './useMobileNav';\nimport { useShellUser } from './useShellUser';\nimport { useWarnOnce } from './useWarnOnce';\n\nconst SIDEBAR_COLLAPSED_KEY = 'aegis-shell.sidebar-collapsed';\n\n/**\n * Top-level layout: top header, two-section sidebar, breadcrumb bar, and\n * a routed content area composed from `apps`.\n *\n * Each app's `routes` is mounted under its `basePath`. The shell renders\n * the chrome around every app — apps themselves only render page content\n * inside a `<PageWrapper>` (the shell wraps the outlet automatically). A\n * page that throws while rendering shows an error with a retry in the page\n * area; the chrome stays up.\n */\nexport function AegisShell({\n brand,\n apps,\n rootRoutes = [],\n fallbackPath,\n notFoundElement,\n user,\n userMenu,\n headerCenter,\n headerActions,\n appSwitcher = true,\n elevateHeaderOnScroll = false,\n ambient,\n inboxPath,\n onAppSwitch,\n enableCommandPalette = false,\n commandGroupOrder,\n agentPanel,\n agentRuntime,\n chrome = 'header',\n}: AegisShellProps): ReactElement {\n const location = useLocation();\n const navigate = useNavigate();\n const strings = useStrings();\n const { pathname } = location;\n const auth = useAuth();\n const themeCtx = useContext(ThemeContext);\n const [sidebarCollapsedValue, setSidebarCollapsedValue] = useStorageItem(\n SIDEBAR_COLLAPSED_KEY,\n );\n const sidebarCollapsed = sidebarCollapsedValue === '1';\n const [inlineSlot, setInlineSlot] = useState<HTMLDivElement | null>(null);\n const windowScrolled = useWindowScrolled();\n const headerScrolled = elevateHeaderOnScroll && windowScrolled;\n const mainRef = useRef<HTMLElement>(null);\n\n const resolvedUser = useShellUser(user, userMenu, auth);\n\n const visibleApps = useMemo(\n () => apps.filter((app) => isAppVisible(app, auth.status, auth.user)),\n [apps, auth.status, auth.user],\n );\n\n const activeApp = useMemo(\n () => findActiveApp(apps, pathname),\n [apps, pathname],\n );\n\n const activeAppValue = useMemo(\n () =>\n activeApp\n ? { id: activeApp.id, basePath: normalizeBasePath(activeApp.basePath) }\n : null,\n [activeApp],\n );\n\n useEffect(() => {\n assertUniqueBasePaths(apps);\n }, [apps]);\n\n useAppCommands(visibleApps, activeApp?.id);\n const hasCommandProvider = useHasCommandProvider();\n useWarnOnce(\n enableCommandPalette && !hasCommandProvider,\n 'AegisShell: enableCommandPalette needs a <CommandProvider> above the shell; the command palette is not mounted.',\n );\n\n const agent = useAgentPanel(agentPanel);\n const mobileNav = useMobileNav(pathname);\n\n const sidebarChrome = (activeApp?.chrome ?? chrome) === 'sidebar';\n const navValue = useMemo<ShellNavContextValue | null>(\n () =>\n sidebarChrome\n ? {\n open: mobileNav.open,\n toggle: mobileNav.toggle,\n toggleRef: mobileNav.toggleRef,\n }\n : null,\n [sidebarChrome, mobileNav.open, mobileNav.toggle, mobileNav.toggleRef],\n );\n\n const toggleSidebar = useCallback(() => {\n setSidebarCollapsedValue(sidebarCollapsed ? '0' : '1');\n }, [setSidebarCollapsedValue, sidebarCollapsed]);\n\n const routeTree = useMemo(\n () =>\n buildRouteTree({ apps, rootRoutes, fallbackPath, notFoundElement, auth }),\n [apps, rootRoutes, fallbackPath, notFoundElement, auth],\n );\n const element = useRoutes(routeTree.routes);\n const matches = matchRoutes(routeTree.routes, location);\n const topRoute = matches ? matches[0].route : undefined;\n const page = (\n <RouteErrorBoundary resetKey={location.key}>{element}</RouteErrorBoundary>\n );\n\n const rootHref = useHref('/');\n // A hash router's href is not a path prefix, so it reports none.\n const basename = rootHref.startsWith('/')\n ? rootHref.replace(/\\/+$/, '')\n : undefined;\n\n const shellSnapshot = useCallback((): ShellSnapshot => {\n const w = typeof window !== 'undefined' ? window : null;\n return {\n currentAppId: activeApp?.id ?? null,\n route: {\n pathname,\n search: location.search,\n params: {},\n basename,\n },\n breadcrumbs: [],\n theme: themeCtx?.resolved ?? 'light',\n viewport: {\n width: w?.innerWidth ?? 0,\n height: w?.innerHeight ?? 0,\n },\n };\n }, [activeApp, pathname, location.search, basename, themeCtx]);\n\n // Bare routes (e.g. /login) render without the shell chrome.\n if (topRoute && routeTree.bareRoutes.has(topRoute)) {\n return <div>{page}</div>;\n }\n\n const appHasSidebar = Boolean(\n activeApp?.sidebar && activeApp.sidebar.length > 0,\n );\n const hasSidebar = sidebarChrome || (appHasSidebar && !sidebarCollapsed);\n\n const signInButton = auth.status === 'unauthenticated' && auth.signIn && (\n <Button\n onClick={() => {\n void auth.signIn?.({});\n }}\n >\n {strings.signIn}\n </Button>\n );\n\n const shellClass = [\n 'aegis-shell',\n sidebarChrome ? 'aegis-shell--chrome-sidebar' : '',\n hasSidebar ? 'aegis-shell--with-sidebar' : 'aegis-shell--no-sidebar',\n mobileNav.open ? 'aegis-shell--mobile-nav-open' : '',\n agent.open ? 'aegis-shell--with-agent-panel' : '',\n ambient ? 'aegis-shell--ambient' : '',\n ]\n .filter(Boolean)\n .join(' ');\n\n return (\n <AegisRuntimeProvider\n runtime={agentRuntime}\n appId={activeApp?.id ?? null}\n shellSnapshot={shellSnapshot}\n navigate={navigate}\n >\n <EnvironmentProvider app={activeApp}>\n <div ref={mobileNav.shellRef} className={shellClass}>\n <SkipLink targetId=\"aegis-main\" targetRef={mainRef} />\n {ambient && <AmbientBackground variant={ambient} />}\n {!sidebarChrome && (\n <TopHeader\n brand={brand}\n apps={visibleApps}\n activeAppId={activeApp?.id}\n onAppSwitch={onAppSwitch}\n appSwitcher={appSwitcher}\n scrolled={headerScrolled}\n user={resolvedUser}\n headerCenter={headerCenter}\n headerActions={\n <>\n {headerActions}\n {signInButton}\n </>\n }\n inboxPath={\n auth.status === 'authenticated' ? inboxPath : undefined\n }\n onMobileMenuToggle={mobileNav.toggle}\n mobileMenuOpen={mobileNav.open}\n menuToggleRef={mobileNav.toggleRef}\n showMobileMenu={appHasSidebar}\n sidebarCollapsible={appHasSidebar}\n sidebarCollapsed={sidebarCollapsed}\n onSidebarToggle={toggleSidebar}\n inlineSlotRef={setInlineSlot}\n inlineSlotActive={Boolean(activeApp?.header)}\n agentPanelOpen={agent.open}\n onAgentPanelToggle={agent.toggle}\n />\n )}\n {sidebarChrome ? (\n <Sidebar\n activeApp={activeApp}\n drawerRef={mobileNav.drawerRef}\n top={\n <>\n {appSwitcher ? (\n <AppSwitcher\n apps={visibleApps}\n activeAppId={activeApp?.id}\n onAppSwitch={onAppSwitch}\n />\n ) : null}\n <ShellBrand brand={brand} />\n </>\n }\n footer={\n <>\n <ActiveEnvironmentSwitcher />\n {headerActions}\n {signInButton}\n {auth.status === 'authenticated' && inboxPath && (\n <ShellNotificationBell inboxPath={inboxPath} />\n )}\n {resolvedUser && (\n <UserMenu user={resolvedUser} align=\"left\" />\n )}\n {agent.toggle && (\n <AgentPanelToggle\n open={agent.open}\n onToggle={agent.toggle}\n />\n )}\n </>\n }\n />\n ) : (\n appHasSidebar && (\n <Sidebar activeApp={activeApp} drawerRef={mobileNav.drawerRef} />\n )\n )}\n <button\n ref={mobileNav.backdropRef}\n type=\"button\"\n className=\"aegis-shell__backdrop\"\n aria-label={strings.closeNavigation}\n tabIndex={-1}\n onClick={mobileNav.dismiss}\n />\n <main\n id=\"aegis-main\"\n ref={mainRef}\n tabIndex={-1}\n className=\"aegis-shell__main\"\n >\n {renderAppRegion(\n activeApp,\n activeAppValue,\n <ShellNavContext.Provider value={navValue}>\n {activeApp?.header &&\n inlineSlot &&\n createPortal(activeApp.header, inlineSlot)}\n {activeApp?.breadcrumbBar !== false && (\n <BreadcrumbBar activeApp={activeApp} />\n )}\n <div className=\"aegis-shell__content\">{page}</div>\n </ShellNavContext.Provider>,\n )}\n </main>\n {agent.open && (\n <div className=\"aegis-shell__agent-panel\">{agentPanel}</div>\n )}\n <AskOverlay />\n {enableCommandPalette && hasCommandProvider && (\n <ShellCommandPalette groupOrder={commandGroupOrder} />\n )}\n </div>\n </EnvironmentProvider>\n </AegisRuntimeProvider>\n );\n}\n\nfunction renderAppRegion(\n app: AegisApp | undefined,\n appValue: { id: string; basePath: string } | null,\n children: ReactElement,\n): ReactElement {\n if (!app || !appValue) {\n return children;\n }\n const inner = (\n <ActiveAppContext.Provider value={appValue}>\n {children}\n </ActiveAppContext.Provider>\n );\n return app.wrap ? <>{app.wrap(inner)}</> : inner;\n}\n"],"names":["SIDEBAR_COLLAPSED_KEY","AegisShell","brand","apps","rootRoutes","fallbackPath","notFoundElement","user","userMenu","headerCenter","headerActions","appSwitcher","elevateHeaderOnScroll","ambient","inboxPath","onAppSwitch","enableCommandPalette","commandGroupOrder","agentPanel","agentRuntime","chrome","location","useLocation","navigate","useNavigate","strings","useStrings","pathname","auth","useAuth","themeCtx","useContext","ThemeContext","sidebarCollapsedValue","setSidebarCollapsedValue","useStorageItem","sidebarCollapsed","inlineSlot","setInlineSlot","useState","windowScrolled","useWindowScrolled","headerScrolled","mainRef","useRef","resolvedUser","useShellUser","visibleApps","useMemo","app","isAppVisible","activeApp","findActiveApp","activeAppValue","normalizeBasePath","useEffect","assertUniqueBasePaths","useAppCommands","hasCommandProvider","useHasCommandProvider","useWarnOnce","agent","useAgentPanel","mobileNav","useMobileNav","sidebarChrome","navValue","toggleSidebar","useCallback","routeTree","buildRouteTree","element","useRoutes","matches","matchRoutes","topRoute","page","jsx","RouteErrorBoundary","rootHref","useHref","basename","shellSnapshot","w","appHasSidebar","hasSidebar","signInButton","Button","shellClass","AegisRuntimeProvider","EnvironmentProvider","jsxs","SkipLink","AmbientBackground","TopHeader","Fragment","Sidebar","AppSwitcher","ShellBrand","ActiveEnvironmentSwitcher","ShellNotificationBell","UserMenu","AgentPanelToggle","renderAppRegion","ShellNavContext","createPortal","BreadcrumbBar","AskOverlay","ShellCommandPalette","appValue","children","inner","ActiveAppContext"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6DA,MAAMA,KAAwB;AAYvB,SAASC,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A,QAEDf,EAAM,QACL,gBAAAgB,EAAC,OAAA,EAAI,WAAU,4BAA4B,UAAA3D,GAAW;AAAA,0BAEvDyF,IAAA,EAAW;AAAA,QACX3F,KAAwB0C,KACvB,gBAAAmB,EAAC+B,IAAA,EAAoB,YAAY3F,EAAA,CAAmB;AAAA,MAAA,EAAA,CAExD,EAAA,CACF;AAAA,IAAA;AAAA,EAAA;AAGN;AAEA,SAASsF,GACPtD,GACA4D,GACAC,GACc;AACd,MAAI,CAAC7D,KAAO,CAAC4D;AACX,WAAOC;AAET,QAAMC,IACJ,gBAAAlC,EAACmC,GAAiB,UAAjB,EAA0B,OAAOH,GAC/B,UAAAC,GACH;AAEF,SAAO7D,EAAI,OAAO,gBAAA4B,EAAAkB,GAAA,EAAG,YAAI,KAAKgB,CAAK,GAAE,IAAMA;AAC7C;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),l=require("react"),o=require("./shellNavContext.cjs"),s=require("../../locale/useStrings.cjs");function r(){const n=s.useStrings(),e=l.useContext(o.ShellNavContext);return e?t.jsx("button",{ref:e.toggleRef,type:"button",className:"aegis-shell__menu-toggle",onClick:e.toggle,"aria-label":e.open?n.closeNavigation:n.openNavigation,"aria-expanded":e.open,children:t.jsx("span",{className:"aegis-shell__menu-toggle-glyph","aria-hidden":"true",children:"☰"})}):null}exports.ShellMenuToggle=r;
|
|
2
|
+
//# sourceMappingURL=ShellMenuToggle.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ShellMenuToggle.cjs","sources":["../../../src/layouts/shell/ShellMenuToggle.tsx"],"sourcesContent":["import { type ReactElement, useContext } from 'react';\n\nimport { useStrings } from '../../locale';\nimport { ShellNavContext } from './shellNavContext';\n\n/**\n * The navigation drawer's toggle, for the page's top bar while the shell\n * runs with `chrome=\"sidebar\"`, which has no header to hold one. It shows\n * at 768 px and below, where the sidebar is the drawer, and renders\n * nothing under a shell that has a header.\n */\nexport function ShellMenuToggle(): ReactElement | null {\n const strings = useStrings();\n const nav = useContext(ShellNavContext);\n if (!nav) {\n return null;\n }\n return (\n <button\n ref={nav.toggleRef}\n type=\"button\"\n className=\"aegis-shell__menu-toggle\"\n onClick={nav.toggle}\n aria-label={nav.open ? strings.closeNavigation : strings.openNavigation}\n aria-expanded={nav.open}\n >\n <span className=\"aegis-shell__menu-toggle-glyph\" aria-hidden=\"true\">\n ☰\n </span>\n </button>\n );\n}\n"],"names":["ShellMenuToggle","strings","useStrings","nav","useContext","ShellNavContext","jsx"],"mappings":"oNAWO,SAASA,GAAuC,CACrD,MAAMC,EAAUC,EAAAA,WAAA,EACVC,EAAMC,EAAAA,WAAWC,iBAAe,EACtC,OAAKF,EAIHG,EAAAA,IAAC,SAAA,CACC,IAAKH,EAAI,UACT,KAAK,SACL,UAAU,2BACV,QAASA,EAAI,OACb,aAAYA,EAAI,KAAOF,EAAQ,gBAAkBA,EAAQ,eACzD,gBAAeE,EAAI,KAEnB,eAAC,OAAA,CAAK,UAAU,iCAAiC,cAAY,OAAO,SAAA,GAAA,CAEpE,CAAA,CAAA,EAbK,IAgBX"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* The navigation drawer's toggle, for the page's top bar while the shell
|
|
4
|
+
* runs with `chrome="sidebar"`, which has no header to hold one. It shows
|
|
5
|
+
* at 768 px and below, where the sidebar is the drawer, and renders
|
|
6
|
+
* nothing under a shell that has a header.
|
|
7
|
+
*/
|
|
8
|
+
export declare function ShellMenuToggle(): ReactElement | null;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useContext as t } from "react";
|
|
3
|
+
import { ShellNavContext as l } from "./shellNavContext.js";
|
|
4
|
+
import { useStrings as r } from "../../locale/useStrings.js";
|
|
5
|
+
function m() {
|
|
6
|
+
const n = r(), e = t(l);
|
|
7
|
+
return e ? /* @__PURE__ */ o(
|
|
8
|
+
"button",
|
|
9
|
+
{
|
|
10
|
+
ref: e.toggleRef,
|
|
11
|
+
type: "button",
|
|
12
|
+
className: "aegis-shell__menu-toggle",
|
|
13
|
+
onClick: e.toggle,
|
|
14
|
+
"aria-label": e.open ? n.closeNavigation : n.openNavigation,
|
|
15
|
+
"aria-expanded": e.open,
|
|
16
|
+
children: /* @__PURE__ */ o("span", { className: "aegis-shell__menu-toggle-glyph", "aria-hidden": "true", children: "☰" })
|
|
17
|
+
}
|
|
18
|
+
) : null;
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
m as ShellMenuToggle
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=ShellMenuToggle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ShellMenuToggle.js","sources":["../../../src/layouts/shell/ShellMenuToggle.tsx"],"sourcesContent":["import { type ReactElement, useContext } from 'react';\n\nimport { useStrings } from '../../locale';\nimport { ShellNavContext } from './shellNavContext';\n\n/**\n * The navigation drawer's toggle, for the page's top bar while the shell\n * runs with `chrome=\"sidebar\"`, which has no header to hold one. It shows\n * at 768 px and below, where the sidebar is the drawer, and renders\n * nothing under a shell that has a header.\n */\nexport function ShellMenuToggle(): ReactElement | null {\n const strings = useStrings();\n const nav = useContext(ShellNavContext);\n if (!nav) {\n return null;\n }\n return (\n <button\n ref={nav.toggleRef}\n type=\"button\"\n className=\"aegis-shell__menu-toggle\"\n onClick={nav.toggle}\n aria-label={nav.open ? strings.closeNavigation : strings.openNavigation}\n aria-expanded={nav.open}\n >\n <span className=\"aegis-shell__menu-toggle-glyph\" aria-hidden=\"true\">\n ☰\n </span>\n </button>\n );\n}\n"],"names":["ShellMenuToggle","strings","useStrings","nav","useContext","ShellNavContext","jsx"],"mappings":";;;;AAWO,SAASA,IAAuC;AACrD,QAAMC,IAAUC,EAAA,GACVC,IAAMC,EAAWC,CAAe;AACtC,SAAKF,IAIH,gBAAAG;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAKH,EAAI;AAAA,MACT,MAAK;AAAA,MACL,WAAU;AAAA,MACV,SAASA,EAAI;AAAA,MACb,cAAYA,EAAI,OAAOF,EAAQ,kBAAkBA,EAAQ;AAAA,MACzD,iBAAeE,EAAI;AAAA,MAEnB,4BAAC,QAAA,EAAK,WAAU,kCAAiC,eAAY,QAAO,UAAA,IAAA,CAEpE;AAAA,IAAA;AAAA,EAAA,IAbK;AAgBX;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("react-router-dom"),_=require("./paths.cjs");function b({activeApp:a,drawerRef:c,top:i,footer:r}){const l=a?.sidebar??[];return l.length===0&&i===void 0?null:e.jsxs("aside",{ref:c,className:"aegis-shell__sidebar",children:[i!==void 0&&e.jsx("div",{className:"aegis-shell__sidebar-top",children:i}),a&&l.length>0&&e.jsxs("section",{className:"aegis-shell__sidebar-section",children:[i===void 0&&e.jsx("div",{className:"aegis-shell__sidebar-heading",children:a.label}),l.map((n,h)=>e.jsxs("div",{children:[n.label&&e.jsx("div",{className:"aegis-shell__sidebar-heading",children:n.label}),n.items.map(s=>{const d=_.joinPath(a.basePath,s.to);return e.jsxs(t.NavLink,{to:d,end:s.end,className:({isActive:o})=>["aegis-shell__nav-link",o?"aegis-shell__nav-link--active":""].filter(Boolean).join(" "),children:[s.icon&&e.jsx("span",{className:"aegis-shell__nav-icon",children:s.icon}),e.jsx("span",{children:s.label})]},d)})]},h))]}),r!==void 0&&e.jsx("div",{className:"aegis-shell__sidebar-footer",children:r})]})}exports.Sidebar=b;
|
|
2
2
|
//# sourceMappingURL=Sidebar.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sidebar.cjs","sources":["../../../src/layouts/shell/Sidebar.tsx"],"sourcesContent":["import type { ReactElement, Ref } from 'react';\n\nimport { NavLink } from 'react-router-dom';\n\nimport { joinPath } from './paths';\nimport type { AegisApp } from './types';\n\ninterface SidebarProps {\n activeApp: AegisApp | undefined;\n /** The sidebar element, which is the navigation drawer at 768 px and below. */\n drawerRef?: Ref<HTMLElement>;\n}\n\n/**\n * Per-app inner nav.
|
|
1
|
+
{"version":3,"file":"Sidebar.cjs","sources":["../../../src/layouts/shell/Sidebar.tsx"],"sourcesContent":["import type { ReactElement, ReactNode, Ref } from 'react';\n\nimport { NavLink } from 'react-router-dom';\n\nimport { joinPath } from './paths';\nimport type { AegisApp } from './types';\n\ninterface SidebarProps {\n activeApp: AegisApp | undefined;\n /** The sidebar element, which is the navigation drawer at 768 px and below. */\n drawerRef?: Ref<HTMLElement>;\n /** Heads the sidebar in place of the app's name, e.g. the brand. */\n top?: ReactNode;\n /** Sits at the sidebar's foot, e.g. the actions and the user menu. */\n footer?: ReactNode;\n}\n\n/**\n * Per-app inner nav. Under the default chrome the global app list lives in\n * the header's `AppSwitcher`, not here — the sidebar only ever shows the\n * current app. Under `chrome=\"sidebar\"` it also carries the brand at its\n * top and the header's controls at its foot.\n */\nexport function Sidebar({\n activeApp,\n drawerRef,\n top,\n footer,\n}: SidebarProps): ReactElement | null {\n const groups = activeApp?.sidebar ?? [];\n if (groups.length === 0 && top === undefined) {\n return null;\n }\n\n return (\n <aside ref={drawerRef} className=\"aegis-shell__sidebar\">\n {top !== undefined && (\n <div className=\"aegis-shell__sidebar-top\">{top}</div>\n )}\n {activeApp && groups.length > 0 && (\n <section className=\"aegis-shell__sidebar-section\">\n {top === undefined && (\n <div className=\"aegis-shell__sidebar-heading\">\n {activeApp.label}\n </div>\n )}\n {groups.map((group, idx) => (\n <div key={idx}>\n {group.label && (\n <div className=\"aegis-shell__sidebar-heading\">\n {group.label}\n </div>\n )}\n {group.items.map((item) => {\n const path = joinPath(activeApp.basePath, item.to);\n return (\n <NavLink\n key={path}\n to={path}\n end={item.end}\n className={({ isActive }) =>\n [\n 'aegis-shell__nav-link',\n isActive ? 'aegis-shell__nav-link--active' : '',\n ]\n .filter(Boolean)\n .join(' ')\n }\n >\n {item.icon && (\n <span className=\"aegis-shell__nav-icon\">{item.icon}</span>\n )}\n <span>{item.label}</span>\n </NavLink>\n );\n })}\n </div>\n ))}\n </section>\n )}\n {footer !== undefined && (\n <div className=\"aegis-shell__sidebar-footer\">{footer}</div>\n )}\n </aside>\n );\n}\n"],"names":["Sidebar","activeApp","drawerRef","top","footer","groups","jsxs","jsx","group","idx","item","path","joinPath","NavLink","isActive"],"mappings":"4KAuBO,SAASA,EAAQ,CACtB,UAAAC,EACA,UAAAC,EACA,IAAAC,EACA,OAAAC,CACF,EAAsC,CACpC,MAAMC,EAASJ,GAAW,SAAW,CAAA,EACrC,OAAII,EAAO,SAAW,GAAKF,IAAQ,OAC1B,KAIPG,EAAAA,KAAC,QAAA,CAAM,IAAKJ,EAAW,UAAU,uBAC9B,SAAA,CAAAC,IAAQ,QACPI,EAAAA,IAAC,MAAA,CAAI,UAAU,2BAA4B,SAAAJ,EAAI,EAEhDF,GAAaI,EAAO,OAAS,GAC5BC,EAAAA,KAAC,UAAA,CAAQ,UAAU,+BAChB,SAAA,CAAAH,IAAQ,QACPI,EAAAA,IAAC,MAAA,CAAI,UAAU,+BACZ,WAAU,MACb,EAEDF,EAAO,IAAI,CAACG,EAAOC,WACjB,MAAA,CACE,SAAA,CAAAD,EAAM,OACLD,EAAAA,IAAC,MAAA,CAAI,UAAU,+BACZ,WAAM,MACT,EAEDC,EAAM,MAAM,IAAKE,GAAS,CACzB,MAAMC,EAAOC,EAAAA,SAASX,EAAU,SAAUS,EAAK,EAAE,EACjD,OACEJ,EAAAA,KAACO,EAAAA,QAAA,CAEC,GAAIF,EACJ,IAAKD,EAAK,IACV,UAAW,CAAC,CAAE,SAAAI,KACZ,CACE,wBACAA,EAAW,gCAAkC,EAAA,EAE5C,OAAO,OAAO,EACd,KAAK,GAAG,EAGZ,SAAA,CAAAJ,EAAK,MACJH,EAAAA,IAAC,OAAA,CAAK,UAAU,wBAAyB,WAAK,KAAK,EAErDA,EAAAA,IAAC,OAAA,CAAM,SAAAG,EAAK,KAAA,CAAM,CAAA,CAAA,EAfbC,CAAA,CAkBX,CAAC,CAAA,CAAA,EA5BOF,CA6BV,CACD,CAAA,EACH,EAEDL,IAAW,QACVG,EAAAA,IAAC,MAAA,CAAI,UAAU,8BAA+B,SAAAH,CAAA,CAAO,CAAA,EAEzD,CAEJ"}
|
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
import { ReactElement, Ref } from 'react';
|
|
1
|
+
import { ReactElement, ReactNode, Ref } from 'react';
|
|
2
2
|
import { AegisApp } from './types';
|
|
3
3
|
interface SidebarProps {
|
|
4
4
|
activeApp: AegisApp | undefined;
|
|
5
5
|
/** The sidebar element, which is the navigation drawer at 768 px and below. */
|
|
6
6
|
drawerRef?: Ref<HTMLElement>;
|
|
7
|
+
/** Heads the sidebar in place of the app's name, e.g. the brand. */
|
|
8
|
+
top?: ReactNode;
|
|
9
|
+
/** Sits at the sidebar's foot, e.g. the actions and the user menu. */
|
|
10
|
+
footer?: ReactNode;
|
|
7
11
|
}
|
|
8
12
|
/**
|
|
9
|
-
* Per-app inner nav.
|
|
10
|
-
* `AppSwitcher`, not here — sidebar only ever shows the
|
|
13
|
+
* Per-app inner nav. Under the default chrome the global app list lives in
|
|
14
|
+
* the header's `AppSwitcher`, not here — the sidebar only ever shows the
|
|
15
|
+
* current app. Under `chrome="sidebar"` it also carries the brand at its
|
|
16
|
+
* top and the header's controls at its foot.
|
|
11
17
|
*/
|
|
12
|
-
export declare function Sidebar({ activeApp, drawerRef, }: SidebarProps): ReactElement | null;
|
|
18
|
+
export declare function Sidebar({ activeApp, drawerRef, top, footer, }: SidebarProps): ReactElement | null;
|
|
13
19
|
export {};
|