@lincyaw/aegis-ui 0.17.0 → 0.18.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 +35 -0
- package/dist/components/ui/AnchoredPopover.js +118 -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 +19 -1
- package/dist/components/ui/CodeBlock.js +86 -36
- package/dist/components/ui/CodeBlock.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 +9 -1
- 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/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
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react/jsx-runtime");;/* empty css */function i({children:e,bleed:r=!1,className:a,...s}){const t=["page-wrapper",r?"page-wrapper--bleed":"",a??""].filter(Boolean).join(" ");return p.jsx("div",{className:t,...s,children:e})}exports.PageWrapper=i;
|
|
2
2
|
//# sourceMappingURL=PageWrapper.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageWrapper.cjs","sources":["../../src/layouts/PageWrapper.tsx"],"sourcesContent":["import type { HTMLAttributes, ReactNode } from 'react';\n\nimport './PageWrapper.css';\n\nexport interface PageWrapperProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n}\n\n/**\n * Page root container. Owns `max-width`, `margin`, `padding`, and the\n * staggered fade-in animation. Sub-apps compose pages from this — they\n * must never redefine these properties.\n */\nexport function PageWrapper({\n children,\n className,\n ...rest\n}: PageWrapperProps) {\n const classes =
|
|
1
|
+
{"version":3,"file":"PageWrapper.cjs","sources":["../../src/layouts/PageWrapper.tsx"],"sourcesContent":["import type { HTMLAttributes, ReactNode } from 'react';\n\nimport './PageWrapper.css';\n\nexport interface PageWrapperProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n /**\n * Fills the view under the shell's header edge to edge, with no padding\n * and no gap between its blocks: a column of `Toolbar` bars over a\n * `PaneLayout` that takes the rest of the height.\n */\n bleed?: boolean;\n}\n\n/**\n * Page root container. Owns `max-width`, `margin`, `padding`, and the\n * staggered fade-in animation. Sub-apps compose pages from this — they\n * must never redefine these properties.\n */\nexport function PageWrapper({\n children,\n bleed = false,\n className,\n ...rest\n}: PageWrapperProps) {\n const classes = [\n 'page-wrapper',\n bleed ? 'page-wrapper--bleed' : '',\n className ?? '',\n ]\n .filter(Boolean)\n .join(' ');\n return (\n <div className={classes} {...rest}>\n {children}\n </div>\n );\n}\n"],"names":["PageWrapper","children","bleed","className","rest","classes"],"mappings":"sJAmBO,SAASA,EAAY,CAC1B,SAAAC,EACA,MAAAC,EAAQ,GACR,UAAAC,EACA,GAAGC,CACL,EAAqB,CACnB,MAAMC,EAAU,CACd,eACAH,EAAQ,sBAAwB,GAChCC,GAAa,EAAA,EAEZ,OAAO,OAAO,EACd,KAAK,GAAG,EACX,aACG,MAAA,CAAI,UAAWE,EAAU,GAAGD,EAC1B,SAAAH,EACH,CAEJ"}
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
2
|
export interface PageWrapperProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
3
|
children: ReactNode;
|
|
4
|
+
/**
|
|
5
|
+
* Fills the view under the shell's header edge to edge, with no padding
|
|
6
|
+
* and no gap between its blocks: a column of `Toolbar` bars over a
|
|
7
|
+
* `PaneLayout` that takes the rest of the height.
|
|
8
|
+
*/
|
|
9
|
+
bleed?: boolean;
|
|
4
10
|
}
|
|
5
11
|
/**
|
|
6
12
|
* Page root container. Owns `max-width`, `margin`, `padding`, and the
|
|
7
13
|
* staggered fade-in animation. Sub-apps compose pages from this — they
|
|
8
14
|
* must never redefine these properties.
|
|
9
15
|
*/
|
|
10
|
-
export declare function PageWrapper({ children, className, ...rest }: PageWrapperProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export declare function PageWrapper({ children, bleed, className, ...rest }: PageWrapperProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,14 +1,19 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
2
|
/* empty css */
|
|
3
|
-
function
|
|
4
|
-
children:
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
function l({
|
|
4
|
+
children: e,
|
|
5
|
+
bleed: r = !1,
|
|
6
|
+
className: a,
|
|
7
|
+
...p
|
|
7
8
|
}) {
|
|
8
|
-
const
|
|
9
|
-
|
|
9
|
+
const o = [
|
|
10
|
+
"page-wrapper",
|
|
11
|
+
r ? "page-wrapper--bleed" : "",
|
|
12
|
+
a ?? ""
|
|
13
|
+
].filter(Boolean).join(" ");
|
|
14
|
+
return /* @__PURE__ */ s("div", { className: o, ...p, children: e });
|
|
10
15
|
}
|
|
11
16
|
export {
|
|
12
|
-
|
|
17
|
+
l as PageWrapper
|
|
13
18
|
};
|
|
14
19
|
//# sourceMappingURL=PageWrapper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageWrapper.js","sources":["../../src/layouts/PageWrapper.tsx"],"sourcesContent":["import type { HTMLAttributes, ReactNode } from 'react';\n\nimport './PageWrapper.css';\n\nexport interface PageWrapperProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n}\n\n/**\n * Page root container. Owns `max-width`, `margin`, `padding`, and the\n * staggered fade-in animation. Sub-apps compose pages from this — they\n * must never redefine these properties.\n */\nexport function PageWrapper({\n children,\n className,\n ...rest\n}: PageWrapperProps) {\n const classes =
|
|
1
|
+
{"version":3,"file":"PageWrapper.js","sources":["../../src/layouts/PageWrapper.tsx"],"sourcesContent":["import type { HTMLAttributes, ReactNode } from 'react';\n\nimport './PageWrapper.css';\n\nexport interface PageWrapperProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n /**\n * Fills the view under the shell's header edge to edge, with no padding\n * and no gap between its blocks: a column of `Toolbar` bars over a\n * `PaneLayout` that takes the rest of the height.\n */\n bleed?: boolean;\n}\n\n/**\n * Page root container. Owns `max-width`, `margin`, `padding`, and the\n * staggered fade-in animation. Sub-apps compose pages from this — they\n * must never redefine these properties.\n */\nexport function PageWrapper({\n children,\n bleed = false,\n className,\n ...rest\n}: PageWrapperProps) {\n const classes = [\n 'page-wrapper',\n bleed ? 'page-wrapper--bleed' : '',\n className ?? '',\n ]\n .filter(Boolean)\n .join(' ');\n return (\n <div className={classes} {...rest}>\n {children}\n </div>\n );\n}\n"],"names":["PageWrapper","children","bleed","className","rest","classes"],"mappings":";;AAmBO,SAASA,EAAY;AAAA,EAC1B,UAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,WAAAC;AAAA,EACA,GAAGC;AACL,GAAqB;AACnB,QAAMC,IAAU;AAAA,IACd;AAAA,IACAH,IAAQ,wBAAwB;AAAA,IAChCC,KAAa;AAAA,EAAA,EAEZ,OAAO,OAAO,EACd,KAAK,GAAG;AACX,2BACG,OAAA,EAAI,WAAWE,GAAU,GAAGD,GAC1B,UAAAH,GACH;AAEJ;"}
|
|
@@ -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"),o=require("react"),le=require("react-dom"),h=require("react-router-dom"),ue=require("../../components/ui/AmbientBackground.cjs"),ce=require("../../components/ui/Button.cjs"),de=require("../../hooks/useStorageItem.cjs"),ge=require("../../hooks/useWindowScrolled.cjs"),he=require("../../theme/themeContext.cjs"),me=require("../SkipLink.cjs");;/* empty css */const pe=require("./AppSwitcher.cjs"),be=require("./BreadcrumbBar.cjs"),ve=require("./RouteErrorBoundary.cjs"),xe=require("./ShellCommandPalette.cjs"),Se=require("./ShellNotificationBell.cjs"),D=require("./Sidebar.cjs"),m=require("./TopHeader.cjs"),fe=require("./activeAppContext.cjs"),j=require("./apps.cjs"),qe=require("./buildRouteTree.cjs"),Ae=require("./paths.cjs"),je=require("./shellNavContext.cjs"),Re=require("./useAgentPanel.cjs"),Ce=require("./useAppCommands.cjs"),we=require("./useMobileNav.cjs"),Be=require("./useShellUser.cjs"),Pe=require("./useWarnOnce.cjs"),Ie=require("../../locale/useStrings.cjs"),ke=require("../../auth/useAuth.cjs"),Me=require("../../commands/useCommands.cjs"),Ne=require("../../agent/core/AegisRuntimeProvider.cjs"),Te=require("./environments/EnvironmentProvider.cjs"),ye=require("../../agent/ask/AskOverlay.cjs"),_e="aegis-shell.sidebar-collapsed";function Oe({brand:a,apps:r,rootRoutes:u=[],fallbackPath:c,notFoundElement:R,user:V,userMenu:F,headerCenter:K,headerActions:C,appSwitcher:w=!0,elevateHeaderOnScroll:z=!1,ambient:x,inboxPath:S,onAppSwitch:B,enableCommandPalette:P=!1,commandGroupOrder:Y,agentPanel:I,agentRuntime:G,chrome:J="header"}){const d=h.useLocation(),Q=h.useNavigate(),k=Ie.useStrings(),{pathname:g}=d,n=ke.useAuth(),M=o.useContext(he.ThemeContext),[X,N]=de.useStorageItem(_e),p=X==="1",[T,Z]=o.useState(null),$=ge.useWindowScrolled(),ee=z&&$,y=o.useRef(null),f=Be.useShellUser(V,F,n),q=o.useMemo(()=>r.filter(v=>j.isAppVisible(v,n.status,n.user)),[r,n.status,n.user]),s=o.useMemo(()=>j.findActiveApp(r,g),[r,g]),se=o.useMemo(()=>s?{id:s.id,basePath:Ae.normalizeBasePath(s.basePath)}:null,[s]);o.useEffect(()=>{j.assertUniqueBasePaths(r)},[r]),Ce.useAppCommands(q,s?.id);const _=Me.useHasCommandProvider();Pe.useWarnOnce(P&&!_,"AegisShell: enableCommandPalette needs a <CommandProvider> above the shell; the command palette is not mounted.");const i=Re.useAgentPanel(I),t=we.useMobileNav(g),l=(s?.chrome??J)==="sidebar",te=o.useMemo(()=>l?{open:t.open,toggle:t.toggle,toggleRef:t.toggleRef}:null,[l,t.open,t.toggle,t.toggleRef]),ne=o.useCallback(()=>{N(p?"0":"1")},[N,p]),A=o.useMemo(()=>qe.buildRouteTree({apps:r,rootRoutes:u,fallbackPath:c,notFoundElement:R,auth:n}),[r,u,c,R,n]),re=h.useRoutes(A.routes),O=h.matchRoutes(A.routes,d),E=O?O[0].route:void 0,H=e.jsx(ve.RouteErrorBoundary,{resetKey:d.key,children:re}),W=h.useHref("/"),L=W.startsWith("/")?W.replace(/\/+$/,""):void 0,oe=o.useCallback(()=>{const v=typeof window<"u"?window:null;return{currentAppId:s?.id??null,route:{pathname:g,search:d.search,params:{},basename:L},breadcrumbs:[],theme:M?.resolved??"light",viewport:{width:v?.innerWidth??0,height:v?.innerHeight??0}}},[s,g,d.search,L,M]);if(E&&A.bareRoutes.has(E))return e.jsx("div",{children:H});const b=!!(s?.sidebar&&s.sidebar.length>0),ie=l||b&&!p,U=n.status==="unauthenticated"&&n.signIn&&e.jsx(ce.Button,{onClick:()=>{n.signIn?.({})},children:k.signIn}),ae=["aegis-shell",l?"aegis-shell--chrome-sidebar":"",ie?"aegis-shell--with-sidebar":"aegis-shell--no-sidebar",t.open?"aegis-shell--mobile-nav-open":"",i.open?"aegis-shell--with-agent-panel":"",x?"aegis-shell--ambient":""].filter(Boolean).join(" ");return e.jsx(Ne.AegisRuntimeProvider,{runtime:G,appId:s?.id??null,shellSnapshot:oe,navigate:Q,children:e.jsx(Te.EnvironmentProvider,{app:s,children:e.jsxs("div",{ref:t.shellRef,className:ae,children:[e.jsx(me.SkipLink,{targetId:"aegis-main",targetRef:y}),x&&e.jsx(ue.AmbientBackground,{variant:x}),!l&&e.jsx(m.TopHeader,{brand:a,apps:q,activeAppId:s?.id,onAppSwitch:B,appSwitcher:w,scrolled:ee,user:f,headerCenter:K,headerActions:e.jsxs(e.Fragment,{children:[C,U]}),inboxPath:n.status==="authenticated"?S:void 0,onMobileMenuToggle:t.toggle,mobileMenuOpen:t.open,menuToggleRef:t.toggleRef,showMobileMenu:b,sidebarCollapsible:b,sidebarCollapsed:p,onSidebarToggle:ne,inlineSlotRef:Z,inlineSlotActive:!!s?.header,agentPanelOpen:i.open,onAgentPanelToggle:i.toggle}),l?e.jsx(D.Sidebar,{activeApp:s,drawerRef:t.drawerRef,top:e.jsxs(e.Fragment,{children:[w?e.jsx(pe.AppSwitcher,{apps:q,activeAppId:s?.id,onAppSwitch:B}):null,e.jsx(m.ShellBrand,{brand:a})]}),footer:e.jsxs(e.Fragment,{children:[e.jsx(m.ActiveEnvironmentSwitcher,{}),C,U,n.status==="authenticated"&&S&&e.jsx(Se.ShellNotificationBell,{inboxPath:S}),f&&e.jsx(m.UserMenu,{user:f,align:"left"}),i.toggle&&e.jsx(m.AgentPanelToggle,{open:i.open,onToggle:i.toggle})]})}):b&&e.jsx(D.Sidebar,{activeApp:s,drawerRef:t.drawerRef}),e.jsx("button",{ref:t.backdropRef,type:"button",className:"aegis-shell__backdrop","aria-label":k.closeNavigation,tabIndex:-1,onClick:t.dismiss}),e.jsx("main",{id:"aegis-main",ref:y,tabIndex:-1,className:"aegis-shell__main",children:Ee(s,se,e.jsxs(je.ShellNavContext.Provider,{value:te,children:[s?.header&&T&&le.createPortal(s.header,T),s?.breadcrumbBar!==!1&&e.jsx(be.BreadcrumbBar,{activeApp:s}),e.jsx("div",{className:"aegis-shell__content",children:H})]}))}),i.open&&e.jsx("div",{className:"aegis-shell__agent-panel",children:I}),e.jsx(ye.AskOverlay,{}),P&&_&&e.jsx(xe.ShellCommandPalette,{groupOrder:Y})]})})})}function Ee(a,r,u){if(!a||!r)return u;const c=e.jsx(fe.ActiveAppContext.Provider,{value:r,children:u});return a.wrap?e.jsx(e.Fragment,{children:a.wrap(c)}):c}exports.AegisShell=Oe;
|
|
2
2
|
//# sourceMappingURL=AegisShell.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AegisShell.cjs","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":"itCAoDMA,GAAwB,gCAYvB,SAASC,GAAW,CACzB,MAAAC,EAAA,KACAC,EACA,WAAAC,EAAa,CAAA,EACb,aAAAC,EACA,gBAAAC,EACA,KAAAC,EACA,SAAAC,EACA,aAAAC,EACA,cAAAC,EACA,YAAAC,EAAc,GACd,sBAAAC,EAAwB,GACxB,QAAAC,EACA,UAAAC,EACA,YAAAC,EACA,qBAAAC,EAAuB,GACvB,kBAAAC,EACA,WAAAC,EACA,aAAAC,CACF,EAAkC,CAChC,MAAMC,EAAWC,EAAAA,YAAA,EACXC,EAAWC,EAAAA,YAAA,EACXC,EAAUC,GAAAA,WAAA,EACV,CAAE,SAAAC,GAAaN,EACfO,EAAOC,GAAAA,QAAA,EACPC,EAAWC,EAAAA,WAAWC,eAAY,EAClC,CAACC,EAAuBC,CAAwB,EAAIC,GAAAA,eACxDlC,EAAA,EAEImC,EAAmBH,IAA0B,IAC7C,CAACI,EAAYC,CAAa,EAAIC,EAAAA,SAAgC,IAAI,EAClEC,EAAiBC,GAAAA,kBAAA,EACjBC,EAAiB7B,GAAyB2B,EAC1CG,EAAUC,EAAAA,OAAoB,IAAI,EAElCC,EAAeC,GAAAA,aAAatC,EAAMC,EAAUmB,CAAI,EAEhDmB,EAAcC,EAAAA,QAClB,IAAM5C,EAAK,OAAQ6C,GAAQC,EAAAA,aAAaD,EAAKrB,EAAK,OAAQA,EAAK,IAAI,CAAC,EACpE,CAACxB,EAAMwB,EAAK,OAAQA,EAAK,IAAI,CAAA,EAGzBuB,EAAYH,EAAAA,QAChB,IAAMI,EAAAA,cAAchD,EAAMuB,CAAQ,EAClC,CAACvB,EAAMuB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AClD,GAAO,CAACiD,EACX,OAAOC,EAET,MAAMC,EACJzB,EAAAA,IAAC0B,oBAAiB,SAAjB,CAA0B,MAAOH,EAC/B,SAAAC,EACH,EAEF,OAAOlD,EAAI,KAAO0B,EAAAA,IAAAe,WAAA,CAAG,WAAI,KAAKU,CAAK,EAAE,EAAMA,CAC7C"}
|
|
1
|
+
{"version":3,"file":"AegisShell.cjs","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":"6zCA6DMA,GAAwB,gCAYvB,SAASC,GAAW,CACzB,MAAAC,EAAA,KACAC,EACA,WAAAC,EAAa,CAAA,EACb,aAAAC,EACA,gBAAAC,EACA,KAAAC,EACA,SAAAC,EACA,aAAAC,EACA,cAAAC,EACA,YAAAC,EAAc,GACd,sBAAAC,EAAwB,GACxB,QAAAC,EACA,UAAAC,EACA,YA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yB,MAAOtC,GAC9B,SAAA,CAAAf,GAAW,QACVd,GACAoE,GAAAA,aAAatD,EAAU,OAAQd,CAAU,EAC1Cc,GAAW,gBAAkB,IAC5B0B,EAAAA,IAAC6B,GAAAA,eAAc,UAAAvD,EAAsB,EAEvC0B,EAAAA,IAAC,MAAA,CAAI,UAAU,uBAAwB,SAAAD,CAAA,CAAK,CAAA,CAAA,CAC9C,CAAA,CACF,CAAA,EAEDf,EAAM,MACLgB,EAAAA,IAAC,MAAA,CAAI,UAAU,2BAA4B,SAAA3D,EAAW,QAEvDyF,GAAAA,WAAA,EAAW,EACX3F,GAAwB0C,GACvBmB,EAAAA,IAAC+B,GAAAA,oBAAA,CAAoB,WAAY3F,CAAA,CAAmB,CAAA,CAAA,CAExD,CAAA,CACF,CAAA,CAAA,CAGN,CAEA,SAASsF,GACPtD,EACA4D,EACAC,EACc,CACd,GAAI,CAAC7D,GAAO,CAAC4D,EACX,OAAOC,EAET,MAAMC,EACJlC,EAAAA,IAACmC,oBAAiB,SAAjB,CAA0B,MAAOH,EAC/B,SAAAC,EACH,EAEF,OAAO7D,EAAI,KAAO4B,EAAAA,IAAAkB,WAAA,CAAG,WAAI,KAAKgB,CAAK,EAAE,EAAMA,CAC7C"}
|
|
@@ -10,4 +10,4 @@ import { AegisShellProps } from './types';
|
|
|
10
10
|
* page that throws while rendering shows an error with a retry in the page
|
|
11
11
|
* area; the chrome stays up.
|
|
12
12
|
*/
|
|
13
|
-
export declare function AegisShell({ brand, apps, rootRoutes, fallbackPath, notFoundElement, user, userMenu, headerCenter, headerActions, appSwitcher, elevateHeaderOnScroll, ambient, inboxPath, onAppSwitch, enableCommandPalette, commandGroupOrder, agentPanel, agentRuntime, }: AegisShellProps): ReactElement;
|
|
13
|
+
export declare function AegisShell({ brand, apps, rootRoutes, fallbackPath, notFoundElement, user, userMenu, headerCenter, headerActions, appSwitcher, elevateHeaderOnScroll, ambient, inboxPath, onAppSwitch, enableCommandPalette, commandGroupOrder, agentPanel, agentRuntime, chrome, }: AegisShellProps): ReactElement;
|