@lincyaw/aegis-ui 0.10.0 → 0.11.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/agent/ask/AskPanel.cjs +1 -1
- package/dist/agent/ask/AskPanel.cjs.map +1 -1
- package/dist/agent/ask/AskPanel.d.ts +5 -0
- package/dist/agent/ask/AskPanel.js +107 -100
- package/dist/agent/ask/AskPanel.js.map +1 -1
- package/dist/commands/commandContext.cjs.map +1 -1
- package/dist/commands/commandContext.d.ts +4 -1
- package/dist/commands/commandContext.js.map +1 -1
- package/dist/components/ui/AgentPanel.cjs +1 -1
- package/dist/components/ui/AgentPanel.cjs.map +1 -1
- package/dist/components/ui/AgentPanel.js +15 -14
- package/dist/components/ui/AgentPanel.js.map +1 -1
- package/dist/components/ui/Avatar.cjs +1 -1
- package/dist/components/ui/Avatar.cjs.map +1 -1
- package/dist/components/ui/Avatar.js +21 -19
- package/dist/components/ui/Avatar.js.map +1 -1
- package/dist/components/ui/BlastRadiusBar.cjs +1 -1
- package/dist/components/ui/BlastRadiusBar.cjs.map +1 -1
- package/dist/components/ui/BlastRadiusBar.d.ts +16 -4
- package/dist/components/ui/BlastRadiusBar.js +27 -23
- package/dist/components/ui/BlastRadiusBar.js.map +1 -1
- package/dist/components/ui/ChatComposer.cjs +1 -1
- package/dist/components/ui/ChatComposer.cjs.map +1 -1
- package/dist/components/ui/ChatComposer.js +32 -31
- package/dist/components/ui/ChatComposer.js.map +1 -1
- package/dist/components/ui/ChatSessionList.cjs +1 -1
- package/dist/components/ui/ChatSessionList.cjs.map +1 -1
- package/dist/components/ui/ChatSessionList.js +68 -66
- package/dist/components/ui/ChatSessionList.js.map +1 -1
- package/dist/components/ui/Checkbox.cjs +1 -1
- package/dist/components/ui/Checkbox.cjs.map +1 -1
- package/dist/components/ui/Checkbox.d.ts +6 -2
- package/dist/components/ui/Checkbox.js +21 -17
- package/dist/components/ui/Checkbox.js.map +1 -1
- package/dist/components/ui/ChoiceCardGroup.cjs +1 -1
- package/dist/components/ui/ChoiceCardGroup.cjs.map +1 -1
- package/dist/components/ui/ChoiceCardGroup.d.ts +13 -4
- package/dist/components/ui/ChoiceCardGroup.js +47 -35
- package/dist/components/ui/ChoiceCardGroup.js.map +1 -1
- package/dist/components/ui/CodeEditor.cjs +1 -1
- package/dist/components/ui/CodeEditor.cjs.map +1 -1
- package/dist/components/ui/CodeEditor.d.ts +11 -1
- package/dist/components/ui/CodeEditor.js +100 -74
- package/dist/components/ui/CodeEditor.js.map +1 -1
- package/dist/components/ui/CommandInvocationCard.cjs +1 -1
- package/dist/components/ui/CommandInvocationCard.cjs.map +1 -1
- package/dist/components/ui/CommandInvocationCard.js +28 -31
- package/dist/components/ui/CommandInvocationCard.js.map +1 -1
- package/dist/components/ui/CommandPalette.cjs +1 -1
- package/dist/components/ui/CommandPalette.cjs.map +1 -1
- package/dist/components/ui/CommandPalette.d.ts +3 -3
- package/dist/components/ui/CommandPalette.js +75 -75
- package/dist/components/ui/CommandPalette.js.map +1 -1
- package/dist/components/ui/CommitGraph.cjs +1 -1
- package/dist/components/ui/CommitGraph.cjs.map +1 -1
- package/dist/components/ui/CommitGraph.d.ts +3 -1
- package/dist/components/ui/CommitGraph.js +77 -74
- package/dist/components/ui/CommitGraph.js.map +1 -1
- package/dist/components/ui/ContentInspectorDialog.cjs +1 -1
- package/dist/components/ui/ContentInspectorDialog.cjs.map +1 -1
- package/dist/components/ui/ContentInspectorDialog.js +25 -31
- package/dist/components/ui/ContentInspectorDialog.js.map +1 -1
- package/dist/components/ui/ContentPreview.cjs +2 -2
- package/dist/components/ui/ContentPreview.cjs.map +1 -1
- package/dist/components/ui/ContentPreview.js +55 -56
- package/dist/components/ui/ContentPreview.js.map +1 -1
- package/dist/components/ui/DangerZone.cjs +1 -1
- package/dist/components/ui/DangerZone.cjs.map +1 -1
- package/dist/components/ui/DangerZone.js +13 -12
- package/dist/components/ui/DangerZone.js.map +1 -1
- package/dist/components/ui/DataList.cjs +1 -1
- package/dist/components/ui/DataList.cjs.map +1 -1
- package/dist/components/ui/DataList.js +25 -24
- package/dist/components/ui/DataList.js.map +1 -1
- package/dist/components/ui/DataTable.cjs +1 -1
- package/dist/components/ui/DataTable.cjs.map +1 -1
- package/dist/components/ui/DataTable.js +41 -41
- package/dist/components/ui/DataTable.js.map +1 -1
- package/dist/components/ui/DropdownMenu.cjs +1 -1
- package/dist/components/ui/DropdownMenu.cjs.map +1 -1
- package/dist/components/ui/DropdownMenu.js +41 -40
- package/dist/components/ui/DropdownMenu.js.map +1 -1
- package/dist/components/ui/EnvironmentSwitcher.cjs +1 -1
- package/dist/components/ui/EnvironmentSwitcher.cjs.map +1 -1
- package/dist/components/ui/EnvironmentSwitcher.js +26 -24
- package/dist/components/ui/EnvironmentSwitcher.js.map +1 -1
- package/dist/components/ui/EventTable.cjs +1 -1
- package/dist/components/ui/EventTable.cjs.map +1 -1
- package/dist/components/ui/EventTable.js +60 -53
- package/dist/components/ui/EventTable.js.map +1 -1
- package/dist/components/ui/FileDropzone.cjs +1 -1
- package/dist/components/ui/FileDropzone.cjs.map +1 -1
- package/dist/components/ui/FileDropzone.js +38 -40
- package/dist/components/ui/FileDropzone.js.map +1 -1
- package/dist/components/ui/FilePreview.cjs +1 -1
- package/dist/components/ui/FilePreview.cjs.map +1 -1
- package/dist/components/ui/FilePreview.js +60 -61
- package/dist/components/ui/FilePreview.js.map +1 -1
- package/dist/components/ui/FolderDropzone.cjs +1 -1
- package/dist/components/ui/FolderDropzone.cjs.map +1 -1
- package/dist/components/ui/FolderDropzone.js +114 -84
- package/dist/components/ui/FolderDropzone.js.map +1 -1
- package/dist/components/ui/ForgotPasswordForm.cjs +1 -1
- package/dist/components/ui/ForgotPasswordForm.cjs.map +1 -1
- package/dist/components/ui/ForgotPasswordForm.js +22 -21
- package/dist/components/ui/ForgotPasswordForm.js.map +1 -1
- package/dist/components/ui/FormRow.cjs +1 -1
- package/dist/components/ui/FormRow.cjs.map +1 -1
- package/dist/components/ui/FormRow.d.ts +32 -11
- package/dist/components/ui/FormRow.js +24 -15
- package/dist/components/ui/FormRow.js.map +1 -1
- package/dist/components/ui/InboxPage.cjs +1 -1
- package/dist/components/ui/InboxPage.cjs.map +1 -1
- package/dist/components/ui/InboxPage.d.ts +12 -3
- package/dist/components/ui/InboxPage.js +91 -77
- package/dist/components/ui/InboxPage.js.map +1 -1
- package/dist/components/ui/LoginForm.cjs +1 -1
- package/dist/components/ui/LoginForm.cjs.map +1 -1
- package/dist/components/ui/LoginForm.js +43 -43
- package/dist/components/ui/LoginForm.js.map +1 -1
- package/dist/components/ui/MonoValue.cjs +1 -1
- package/dist/components/ui/MonoValue.cjs.map +1 -1
- package/dist/components/ui/MonoValue.d.ts +5 -1
- package/dist/components/ui/MonoValue.js +17 -17
- package/dist/components/ui/MonoValue.js.map +1 -1
- package/dist/components/ui/NotificationBell.cjs +1 -1
- package/dist/components/ui/NotificationBell.cjs.map +1 -1
- package/dist/components/ui/NotificationBell.d.ts +17 -1
- package/dist/components/ui/NotificationBell.js +129 -75
- package/dist/components/ui/NotificationBell.js.map +1 -1
- package/dist/components/ui/NumberField.cjs +1 -1
- package/dist/components/ui/NumberField.cjs.map +1 -1
- package/dist/components/ui/NumberField.d.ts +3 -1
- package/dist/components/ui/NumberField.js +52 -49
- package/dist/components/ui/NumberField.js.map +1 -1
- package/dist/components/ui/ObjectBrowser.cjs +1 -1
- package/dist/components/ui/ObjectBrowser.cjs.map +1 -1
- package/dist/components/ui/ObjectBrowser.js +83 -78
- package/dist/components/ui/ObjectBrowser.js.map +1 -1
- package/dist/components/ui/PageSizeSelect.cjs +1 -1
- package/dist/components/ui/PageSizeSelect.cjs.map +1 -1
- package/dist/components/ui/PageSizeSelect.js +30 -29
- package/dist/components/ui/PageSizeSelect.js.map +1 -1
- package/dist/components/ui/Panel.cjs.map +1 -1
- package/dist/components/ui/Panel.d.ts +5 -2
- package/dist/components/ui/Panel.js.map +1 -1
- package/dist/components/ui/ParquetViewer.cjs +1 -1
- package/dist/components/ui/ParquetViewer.cjs.map +1 -1
- package/dist/components/ui/ParquetViewer.js +69 -74
- package/dist/components/ui/ParquetViewer.js.map +1 -1
- package/dist/components/ui/PasswordField.cjs +1 -1
- package/dist/components/ui/PasswordField.cjs.map +1 -1
- package/dist/components/ui/PasswordField.js +28 -27
- package/dist/components/ui/PasswordField.js.map +1 -1
- package/dist/components/ui/PickerField.cjs +1 -1
- package/dist/components/ui/PickerField.cjs.map +1 -1
- package/dist/components/ui/PickerField.d.ts +25 -6
- package/dist/components/ui/PickerField.js +20 -17
- package/dist/components/ui/PickerField.js.map +1 -1
- package/dist/components/ui/ProjectSelector.cjs +1 -1
- package/dist/components/ui/ProjectSelector.cjs.map +1 -1
- package/dist/components/ui/ProjectSelector.js +40 -37
- package/dist/components/ui/ProjectSelector.js.map +1 -1
- package/dist/components/ui/QueryAutocomplete.cjs +1 -1
- package/dist/components/ui/QueryAutocomplete.cjs.map +1 -1
- package/dist/components/ui/QueryAutocomplete.d.ts +7 -1
- package/dist/components/ui/QueryAutocomplete.js +141 -134
- package/dist/components/ui/QueryAutocomplete.js.map +1 -1
- package/dist/components/ui/RegisterForm.cjs +1 -1
- package/dist/components/ui/RegisterForm.cjs.map +1 -1
- package/dist/components/ui/RegisterForm.js +41 -40
- package/dist/components/ui/RegisterForm.js.map +1 -1
- package/dist/components/ui/ResizableSidePanel.cjs +1 -1
- package/dist/components/ui/ResizableSidePanel.cjs.map +1 -1
- package/dist/components/ui/ResizableSidePanel.js +41 -40
- package/dist/components/ui/ResizableSidePanel.js.map +1 -1
- package/dist/components/ui/SavedQueryBar.cjs +1 -1
- package/dist/components/ui/SavedQueryBar.cjs.map +1 -1
- package/dist/components/ui/SavedQueryBar.d.ts +1 -1
- package/dist/components/ui/SavedQueryBar.js +375 -277
- package/dist/components/ui/SavedQueryBar.js.map +1 -1
- package/dist/components/ui/SearchInput.cjs +1 -1
- package/dist/components/ui/SearchInput.cjs.map +1 -1
- package/dist/components/ui/SearchInput.d.ts +5 -1
- package/dist/components/ui/SearchInput.js +28 -24
- package/dist/components/ui/SearchInput.js.map +1 -1
- package/dist/components/ui/Select.cjs +1 -1
- package/dist/components/ui/Select.cjs.map +1 -1
- package/dist/components/ui/Select.d.ts +3 -1
- package/dist/components/ui/Select.js +21 -19
- package/dist/components/ui/Select.js.map +1 -1
- package/dist/components/ui/ServiceMap.cjs +1 -1
- package/dist/components/ui/ServiceMap.cjs.map +1 -1
- package/dist/components/ui/ServiceMap.d.ts +9 -3
- package/dist/components/ui/ServiceMap.js +291 -231
- package/dist/components/ui/ServiceMap.js.map +1 -1
- package/dist/components/ui/Slider.cjs +1 -1
- package/dist/components/ui/Slider.cjs.map +1 -1
- package/dist/components/ui/Slider.d.ts +3 -1
- package/dist/components/ui/Slider.js +11 -9
- package/dist/components/ui/Slider.js.map +1 -1
- package/dist/components/ui/SparkLine.cjs +1 -1
- package/dist/components/ui/SparkLine.cjs.map +1 -1
- package/dist/components/ui/SparkLine.js +24 -23
- package/dist/components/ui/SparkLine.js.map +1 -1
- package/dist/components/ui/Steps.cjs +1 -1
- package/dist/components/ui/Steps.cjs.map +1 -1
- package/dist/components/ui/Steps.js +25 -29
- package/dist/components/ui/Steps.js.map +1 -1
- package/dist/components/ui/Terminal.cjs +1 -1
- package/dist/components/ui/Terminal.cjs.map +1 -1
- package/dist/components/ui/Terminal.js +18 -17
- package/dist/components/ui/Terminal.js.map +1 -1
- package/dist/components/ui/TextField.cjs +1 -1
- package/dist/components/ui/TextField.cjs.map +1 -1
- package/dist/components/ui/TextField.js +6 -6
- package/dist/components/ui/TextField.js.map +1 -1
- package/dist/components/ui/ThemeToggle.cjs +1 -1
- package/dist/components/ui/ThemeToggle.cjs.map +1 -1
- package/dist/components/ui/ThemeToggle.js +15 -18
- package/dist/components/ui/ThemeToggle.js.map +1 -1
- package/dist/components/ui/TimeDisplay.cjs +1 -1
- package/dist/components/ui/TimeDisplay.cjs.map +1 -1
- package/dist/components/ui/TimeDisplay.js +12 -12
- package/dist/components/ui/TimeDisplay.js.map +1 -1
- package/dist/components/ui/TimeRangePicker.cjs +1 -1
- package/dist/components/ui/TimeRangePicker.cjs.map +1 -1
- package/dist/components/ui/TimeRangePicker.js +128 -111
- package/dist/components/ui/TimeRangePicker.js.map +1 -1
- package/dist/components/ui/TraceSpanInspector.cjs +1 -1
- package/dist/components/ui/TraceSpanInspector.cjs.map +1 -1
- package/dist/components/ui/TraceSpanInspector.js +43 -46
- package/dist/components/ui/TraceSpanInspector.js.map +1 -1
- package/dist/components/ui/TraceTree.cjs +1 -1
- package/dist/components/ui/TraceTree.cjs.map +1 -1
- package/dist/components/ui/TraceTree.d.ts +1 -1
- package/dist/components/ui/TraceTree.js +33 -33
- package/dist/components/ui/TraceTree.js.map +1 -1
- package/dist/components/ui/UploadQueue.cjs +1 -1
- package/dist/components/ui/UploadQueue.cjs.map +1 -1
- package/dist/components/ui/UploadQueue.js +59 -70
- package/dist/components/ui/UploadQueue.js.map +1 -1
- package/dist/components/ui/authValidation.cjs +1 -1
- package/dist/components/ui/authValidation.cjs.map +1 -1
- package/dist/components/ui/authValidation.d.ts +2 -2
- package/dist/components/ui/authValidation.js +4 -5
- package/dist/components/ui/authValidation.js.map +1 -1
- package/dist/components/ui/classifyContent.cjs +3 -3
- package/dist/components/ui/classifyContent.cjs.map +1 -1
- package/dist/components/ui/classifyContent.d.ts +2 -1
- package/dist/components/ui/classifyContent.js +52 -54
- package/dist/components/ui/classifyContent.js.map +1 -1
- package/dist/components/ui/relativeTime.cjs +1 -1
- package/dist/components/ui/relativeTime.cjs.map +1 -1
- package/dist/components/ui/relativeTime.d.ts +5 -3
- package/dist/components/ui/relativeTime.js +15 -6
- package/dist/components/ui/relativeTime.js.map +1 -1
- package/dist/hooks/popoverOverflow.cjs +2 -0
- package/dist/hooks/popoverOverflow.cjs.map +1 -0
- package/dist/hooks/popoverOverflow.d.ts +8 -0
- package/dist/hooks/popoverOverflow.js +9 -0
- package/dist/hooks/popoverOverflow.js.map +1 -0
- package/dist/hooks/useDialogPopover.cjs +2 -0
- package/dist/hooks/useDialogPopover.cjs.map +1 -0
- package/dist/hooks/useDialogPopover.d.ts +23 -0
- package/dist/hooks/useDialogPopover.js +48 -0
- package/dist/hooks/useDialogPopover.js.map +1 -0
- package/dist/hooks/useMenuPopover.cjs +1 -1
- package/dist/hooks/useMenuPopover.cjs.map +1 -1
- package/dist/hooks/useMenuPopover.d.ts +0 -8
- package/dist/hooks/useMenuPopover.js +17 -22
- package/dist/hooks/useMenuPopover.js.map +1 -1
- package/dist/hooks/useSavedQueries.cjs +1 -1
- package/dist/hooks/useSavedQueries.cjs.map +1 -1
- package/dist/hooks/useSavedQueries.js +29 -28
- package/dist/hooks/useSavedQueries.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/layouts/shell/AegisShell.cjs +1 -1
- package/dist/layouts/shell/AegisShell.cjs.map +1 -1
- package/dist/layouts/shell/AegisShell.js +41 -41
- package/dist/layouts/shell/AegisShell.js.map +1 -1
- package/dist/layouts/shell/AppSwitcher.cjs +1 -1
- package/dist/layouts/shell/AppSwitcher.cjs.map +1 -1
- package/dist/layouts/shell/AppSwitcher.js +53 -36
- package/dist/layouts/shell/AppSwitcher.js.map +1 -1
- package/dist/layouts/shell/AuthRequiredCard.cjs +1 -1
- package/dist/layouts/shell/AuthRequiredCard.cjs.map +1 -1
- package/dist/layouts/shell/AuthRequiredCard.js +24 -22
- package/dist/layouts/shell/AuthRequiredCard.js.map +1 -1
- package/dist/layouts/shell/RouteErrorBoundary.cjs +1 -1
- package/dist/layouts/shell/RouteErrorBoundary.cjs.map +1 -1
- package/dist/layouts/shell/RouteErrorBoundary.d.ts +4 -1
- package/dist/layouts/shell/RouteErrorBoundary.js +15 -10
- package/dist/layouts/shell/RouteErrorBoundary.js.map +1 -1
- package/dist/layouts/shell/ShellInboxPage.cjs +1 -1
- package/dist/layouts/shell/ShellInboxPage.cjs.map +1 -1
- package/dist/layouts/shell/ShellInboxPage.js +17 -16
- package/dist/layouts/shell/ShellInboxPage.js.map +1 -1
- package/dist/layouts/shell/ShellNotificationBell.cjs +1 -1
- package/dist/layouts/shell/ShellNotificationBell.cjs.map +1 -1
- package/dist/layouts/shell/ShellNotificationBell.js +20 -14
- package/dist/layouts/shell/ShellNotificationBell.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.js +74 -74
- package/dist/layouts/shell/TopHeader.js.map +1 -1
- package/dist/layouts/shell/useShellUser.cjs +1 -1
- package/dist/layouts/shell/useShellUser.cjs.map +1 -1
- package/dist/layouts/shell/useShellUser.js +15 -13
- package/dist/layouts/shell/useShellUser.js.map +1 -1
- package/dist/lib/chart.cjs +1 -1
- package/dist/lib/chart.cjs.map +1 -1
- package/dist/lib/chart.d.ts +5 -7
- package/dist/lib/chart.js +49 -34
- package/dist/lib/chart.js.map +1 -1
- package/dist/lib/timeRange.cjs +1 -1
- package/dist/lib/timeRange.cjs.map +1 -1
- package/dist/lib/timeRange.d.ts +14 -4
- package/dist/lib/timeRange.js +41 -40
- package/dist/lib/timeRange.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 +241 -2
- package/dist/locale/strings.js +543 -26
- package/dist/locale/strings.js.map +1 -1
- package/dist/notifications/notificationContext.cjs.map +1 -1
- package/dist/notifications/notificationContext.d.ts +12 -2
- package/dist/notifications/notificationContext.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/theme/antdTheme.cjs +1 -1
- package/dist/theme/antdTheme.cjs.map +1 -1
- package/dist/theme/antdTheme.js +2 -0
- package/dist/theme/antdTheme.js.map +1 -1
- package/package.json +1 -1
|
@@ -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 { Chip } from '../../components/ui/Chip';\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 <Chip\n tone=\"ink\"\n onClick={() => {\n void auth.signIn?.({});\n }}\n >\n Sign in\n </Chip>\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","Chip","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;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,uBAAAC,IAAwB;AAAA,EACxB,SAAAC;AAAA,EACA,WAAAC;AAAA,EACA,aAAAC;AAAA,EACA,sBAAAC,I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,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 { Chip } from '../../components/ui/Chip';\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 <Chip\n tone=\"ink\"\n onClick={() => {\n void auth.signIn?.({});\n }}\n >\n {strings.signIn}\n </Chip>\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","Chip","Sidebar","renderAppRegion","createPortal","BreadcrumbBar","AskOverlay","ShellCommandPalette","appValue","children","inner","ActiveAppContext"],"mappings":";;;;;;;;;;;;;;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C,OAAA,EAAI,WAAU,wBAAwB,UAAAD,EAAA,CAAK;AAAA,cAAA,EAAA,CAC9C;AAAA,YAAA;AAAA,UACF;AAAA,QAAA;AAAA,QAEDb,EAAM,QACL,gBAAAc,EAAC,OAAA,EAAI,WAAU,4BAA4B,UAAAxD,GAAW;AAAA,0BAEvD6E,IAAA,EAAW;AAAA,QACX/E,KAAwByC,KACvB,gBAAAiB,EAACsB,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,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"),d=require("react"),x=require("antd"),g=require("react-router-dom"),j=require("../../hooks/popoverOverflow.cjs"),w=require("../../hooks/useMenuPopover.cjs"),_=require("./paths.cjs"),m=require("../../locale/useStrings.cjs");function y({apps:n,activeAppId:i,onAppSwitch:l}){const r=w.useMenuPopover(),c=d.useId(),o=g.useNavigate(),a=m.useStrings(),t=s=>{r.close(),l?.(s.id),o(_.joinPath(s.basePath,""))},p=n.filter(s=>!s.hidden),u=e.jsx("ul",{ref:r.panelRef,id:c,className:"aegis-shell__app-list",role:"menu",tabIndex:-1,onKeyDown:r.onPanelKeyDown,children:p.map(s=>{const h=s.id===i?"aegis-shell__app-row aegis-shell__app-row--active":"aegis-shell__app-row";return e.jsx("li",{role:"none",children:e.jsxs("button",{type:"button",role:"menuitem",className:h,onClick:()=>t(s),children:[e.jsx("span",{className:"aegis-shell__app-row-icon",children:s.icon}),e.jsxs("span",{className:"aegis-shell__app-row-body",children:[e.jsx("span",{className:"aegis-shell__app-row-label",children:s.label}),s.description&&e.jsx("span",{className:"aegis-shell__app-row-desc",children:s.description})]})]})},s.id)})});return e.jsx(x.Popover,{open:r.open,onOpenChange:r.setOpen,trigger:"click",placement:"rightTop",autoAdjustOverflow:j.POPOVER_OVERFLOW,arrow:!1,content:u,classNames:{root:"aegis-shell__app-popover"},destroyOnHidden:!0,children:e.jsx("button",{ref:r.triggerRef,type:"button",className:"aegis-shell__app-launcher","aria-label":a.switchApp,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":r.open?c:void 0,onKeyDown:r.onTriggerKeyDown,children:e.jsx("span",{className:"aegis-shell__app-launcher-glyph","aria-hidden":"true",children:e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("circle",{cx:"4",cy:"4",r:"1.5"}),e.jsx("circle",{cx:"10",cy:"4",r:"1.5"}),e.jsx("circle",{cx:"16",cy:"4",r:"1.5"}),e.jsx("circle",{cx:"4",cy:"10",r:"1.5"}),e.jsx("circle",{cx:"10",cy:"10",r:"1.5"}),e.jsx("circle",{cx:"16",cy:"10",r:"1.5"}),e.jsx("circle",{cx:"4",cy:"16",r:"1.5"}),e.jsx("circle",{cx:"10",cy:"16",r:"1.5"}),e.jsx("circle",{cx:"16",cy:"16",r:"1.5"})]})})})})}exports.AppSwitcher=y;
|
|
2
2
|
//# sourceMappingURL=AppSwitcher.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppSwitcher.cjs","sources":["../../../src/layouts/shell/AppSwitcher.tsx"],"sourcesContent":["import { type ReactElement,
|
|
1
|
+
{"version":3,"file":"AppSwitcher.cjs","sources":["../../../src/layouts/shell/AppSwitcher.tsx"],"sourcesContent":["import { type ReactElement, useId } from 'react';\n\nimport { Popover } from 'antd';\nimport { useNavigate } from 'react-router-dom';\n\nimport { POPOVER_OVERFLOW } from '../../hooks/popoverOverflow';\nimport { useMenuPopover } from '../../hooks/useMenuPopover';\nimport { useStrings } from '../../locale';\nimport { joinPath } from './paths';\nimport type { AegisApp } from './types';\n\ninterface AppSwitcherProps {\n apps: AegisApp[];\n activeAppId?: string;\n onAppSwitch?: (appId: string) => void;\n}\n\n/**\n * Alibaba-Cloud-style app launcher. A 9-dot icon on the top-left anchors\n * a popover grid of every registered app — clicking one navigates to its\n * `basePath` and closes the popover.\n */\nexport function AppSwitcher({\n apps,\n activeAppId,\n onAppSwitch,\n}: AppSwitcherProps): ReactElement {\n const menu = useMenuPopover<HTMLUListElement>();\n const menuId = useId();\n const navigate = useNavigate();\n const strings = useStrings();\n\n const handlePick = (app: AegisApp): void => {\n menu.close();\n onAppSwitch?.(app.id);\n navigate(joinPath(app.basePath, ''));\n };\n\n const visibleApps = apps.filter((app) => !app.hidden);\n\n const content = (\n <ul\n ref={menu.panelRef}\n id={menuId}\n className=\"aegis-shell__app-list\"\n role=\"menu\"\n tabIndex={-1}\n onKeyDown={menu.onPanelKeyDown}\n >\n {visibleApps.map((app) => {\n const active = app.id === activeAppId;\n const cls = active\n ? 'aegis-shell__app-row aegis-shell__app-row--active'\n : 'aegis-shell__app-row';\n return (\n <li key={app.id} role=\"none\">\n <button\n type=\"button\"\n role=\"menuitem\"\n className={cls}\n onClick={() => handlePick(app)}\n >\n <span className=\"aegis-shell__app-row-icon\">{app.icon}</span>\n <span className=\"aegis-shell__app-row-body\">\n <span className=\"aegis-shell__app-row-label\">{app.label}</span>\n {app.description && (\n <span className=\"aegis-shell__app-row-desc\">\n {app.description}\n </span>\n )}\n </span>\n </button>\n </li>\n );\n })}\n </ul>\n );\n\n return (\n <Popover\n open={menu.open}\n onOpenChange={menu.setOpen}\n trigger=\"click\"\n placement=\"rightTop\"\n autoAdjustOverflow={POPOVER_OVERFLOW}\n arrow={false}\n content={content}\n classNames={{ root: 'aegis-shell__app-popover' }}\n destroyOnHidden\n >\n <button\n ref={menu.triggerRef}\n type=\"button\"\n className=\"aegis-shell__app-launcher\"\n aria-label={strings.switchApp}\n aria-haspopup=\"menu\"\n aria-expanded={menu.open}\n aria-controls={menu.open ? menuId : undefined}\n onKeyDown={menu.onTriggerKeyDown}\n >\n <span className=\"aegis-shell__app-launcher-glyph\" aria-hidden=\"true\">\n <svg\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 20 20\"\n fill=\"currentColor\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <circle cx=\"4\" cy=\"4\" r=\"1.5\" />\n <circle cx=\"10\" cy=\"4\" r=\"1.5\" />\n <circle cx=\"16\" cy=\"4\" r=\"1.5\" />\n <circle cx=\"4\" cy=\"10\" r=\"1.5\" />\n <circle cx=\"10\" cy=\"10\" r=\"1.5\" />\n <circle cx=\"16\" cy=\"10\" r=\"1.5\" />\n <circle cx=\"4\" cy=\"16\" r=\"1.5\" />\n <circle cx=\"10\" cy=\"16\" r=\"1.5\" />\n <circle cx=\"16\" cy=\"16\" r=\"1.5\" />\n </svg>\n </span>\n </button>\n </Popover>\n );\n}\n"],"names":["AppSwitcher","apps","activeAppId","onAppSwitch","menu","useMenuPopover","menuId","useId","navigate","useNavigate","strings","useStrings","handlePick","app","joinPath","visibleApps","content","jsx","cls","jsxs","Popover","POPOVER_OVERFLOW"],"mappings":"mVAsBO,SAASA,EAAY,CAC1B,KAAAC,EACA,YAAAC,EACA,YAAAC,CACF,EAAmC,CACjC,MAAMC,EAAOC,EAAAA,eAAA,EACPC,EAASC,EAAAA,MAAA,EACTC,EAAWC,EAAAA,YAAA,EACXC,EAAUC,EAAAA,WAAA,EAEVC,EAAcC,GAAwB,CAC1CT,EAAK,MAAA,EACLD,IAAcU,EAAI,EAAE,EACpBL,EAASM,EAAAA,SAASD,EAAI,SAAU,EAAE,CA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KACN,OAAO,KACP,QAAQ,YACR,KAAK,eACL,MAAM,6BAEN,SAAA,CAAAF,MAAC,UAAO,GAAG,IAAI,GAAG,IAAI,EAAE,MAAM,QAC7B,SAAA,CAAO,GAAG,KAAK,GAAG,IAAI,EAAE,MAAM,QAC9B,SAAA,CAAO,GAAG,KAAK,GAAG,IAAI,EAAE,MAAM,QAC9B,SAAA,CAAO,GAAG,IAAI,GAAG,KAAK,EAAE,MAAM,QAC9B,SAAA,CAAO,GAAG,KAAK,GAAG,KAAK,EAAE,MAAM,QAC/B,SAAA,CAAO,GAAG,KAAK,GAAG,KAAK,EAAE,MAAM,QAC/B,SAAA,CAAO,GAAG,IAAI,GAAG,KAAK,EAAE,MAAM,QAC9B,SAAA,CAAO,GAAG,KAAK,GAAG,KAAK,EAAE,MAAM,QAC/B,SAAA,CAAO,GAAG,KAAK,GAAG,KAAK,EAAE,KAAA,CAAM,CAAA,CAAA,CAAA,CAClC,CACF,CAAA,CAAA,CACF,CAAA,CAGN"}
|
|
@@ -1,42 +1,56 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import {
|
|
3
|
-
import { Popover as
|
|
4
|
-
import { useNavigate as
|
|
5
|
-
import {
|
|
1
|
+
import { jsx as e, jsxs as i } from "react/jsx-runtime";
|
|
2
|
+
import { useId as g } from "react";
|
|
3
|
+
import { Popover as u } from "antd";
|
|
4
|
+
import { useNavigate as _ } from "react-router-dom";
|
|
5
|
+
import { POPOVER_OVERFLOW as w } from "../../hooks/popoverOverflow.js";
|
|
6
|
+
import { useMenuPopover as y } from "../../hooks/useMenuPopover.js";
|
|
7
|
+
import { joinPath as f } from "./paths.js";
|
|
6
8
|
import { useStrings as x } from "../../locale/useStrings.js";
|
|
7
|
-
function
|
|
8
|
-
apps:
|
|
9
|
-
activeAppId:
|
|
9
|
+
function R({
|
|
10
|
+
apps: s,
|
|
11
|
+
activeAppId: l,
|
|
10
12
|
onAppSwitch: n
|
|
11
13
|
}) {
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
}, h =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
14
|
+
const c = y(), o = g(), a = _(), t = x(), p = (r) => {
|
|
15
|
+
c.close(), n?.(r.id), a(f(r.basePath, ""));
|
|
16
|
+
}, h = s.filter((r) => !r.hidden), d = /* @__PURE__ */ e(
|
|
17
|
+
"ul",
|
|
18
|
+
{
|
|
19
|
+
ref: c.panelRef,
|
|
20
|
+
id: o,
|
|
21
|
+
className: "aegis-shell__app-list",
|
|
22
|
+
role: "menu",
|
|
23
|
+
tabIndex: -1,
|
|
24
|
+
onKeyDown: c.onPanelKeyDown,
|
|
25
|
+
children: h.map((r) => {
|
|
26
|
+
const m = r.id === l ? "aegis-shell__app-row aegis-shell__app-row--active" : "aegis-shell__app-row";
|
|
27
|
+
return /* @__PURE__ */ e("li", { role: "none", children: /* @__PURE__ */ i(
|
|
28
|
+
"button",
|
|
29
|
+
{
|
|
30
|
+
type: "button",
|
|
31
|
+
role: "menuitem",
|
|
32
|
+
className: m,
|
|
33
|
+
onClick: () => p(r),
|
|
34
|
+
children: [
|
|
35
|
+
/* @__PURE__ */ e("span", { className: "aegis-shell__app-row-icon", children: r.icon }),
|
|
36
|
+
/* @__PURE__ */ i("span", { className: "aegis-shell__app-row-body", children: [
|
|
37
|
+
/* @__PURE__ */ e("span", { className: "aegis-shell__app-row-label", children: r.label }),
|
|
38
|
+
r.description && /* @__PURE__ */ e("span", { className: "aegis-shell__app-row-desc", children: r.description })
|
|
39
|
+
] })
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
) }, r.id);
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
);
|
|
33
46
|
return /* @__PURE__ */ e(
|
|
34
|
-
|
|
47
|
+
u,
|
|
35
48
|
{
|
|
36
|
-
open:
|
|
37
|
-
onOpenChange:
|
|
49
|
+
open: c.open,
|
|
50
|
+
onOpenChange: c.setOpen,
|
|
38
51
|
trigger: "click",
|
|
39
52
|
placement: "rightTop",
|
|
53
|
+
autoAdjustOverflow: w,
|
|
40
54
|
arrow: !1,
|
|
41
55
|
content: d,
|
|
42
56
|
classNames: { root: "aegis-shell__app-popover" },
|
|
@@ -44,12 +58,15 @@ function k({
|
|
|
44
58
|
children: /* @__PURE__ */ e(
|
|
45
59
|
"button",
|
|
46
60
|
{
|
|
61
|
+
ref: c.triggerRef,
|
|
47
62
|
type: "button",
|
|
48
63
|
className: "aegis-shell__app-launcher",
|
|
49
64
|
"aria-label": t.switchApp,
|
|
50
|
-
"aria-haspopup": "
|
|
51
|
-
"aria-expanded":
|
|
52
|
-
|
|
65
|
+
"aria-haspopup": "menu",
|
|
66
|
+
"aria-expanded": c.open,
|
|
67
|
+
"aria-controls": c.open ? o : void 0,
|
|
68
|
+
onKeyDown: c.onTriggerKeyDown,
|
|
69
|
+
children: /* @__PURE__ */ e("span", { className: "aegis-shell__app-launcher-glyph", "aria-hidden": "true", children: /* @__PURE__ */ i(
|
|
53
70
|
"svg",
|
|
54
71
|
{
|
|
55
72
|
width: "20",
|
|
@@ -76,6 +93,6 @@ function k({
|
|
|
76
93
|
);
|
|
77
94
|
}
|
|
78
95
|
export {
|
|
79
|
-
|
|
96
|
+
R as AppSwitcher
|
|
80
97
|
};
|
|
81
98
|
//# sourceMappingURL=AppSwitcher.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppSwitcher.js","sources":["../../../src/layouts/shell/AppSwitcher.tsx"],"sourcesContent":["import { type ReactElement,
|
|
1
|
+
{"version":3,"file":"AppSwitcher.js","sources":["../../../src/layouts/shell/AppSwitcher.tsx"],"sourcesContent":["import { type ReactElement, useId } from 'react';\n\nimport { Popover } from 'antd';\nimport { useNavigate } from 'react-router-dom';\n\nimport { POPOVER_OVERFLOW } from '../../hooks/popoverOverflow';\nimport { useMenuPopover } from '../../hooks/useMenuPopover';\nimport { useStrings } from '../../locale';\nimport { joinPath } from './paths';\nimport type { AegisApp } from './types';\n\ninterface AppSwitcherProps {\n apps: AegisApp[];\n activeAppId?: string;\n onAppSwitch?: (appId: string) => void;\n}\n\n/**\n * Alibaba-Cloud-style app launcher. A 9-dot icon on the top-left anchors\n * a popover grid of every registered app — clicking one navigates to its\n * `basePath` and closes the popover.\n */\nexport function AppSwitcher({\n apps,\n activeAppId,\n onAppSwitch,\n}: AppSwitcherProps): ReactElement {\n const menu = useMenuPopover<HTMLUListElement>();\n const menuId = useId();\n const navigate = useNavigate();\n const strings = useStrings();\n\n const handlePick = (app: AegisApp): void => {\n menu.close();\n onAppSwitch?.(app.id);\n navigate(joinPath(app.basePath, ''));\n };\n\n const visibleApps = apps.filter((app) => !app.hidden);\n\n const content = (\n <ul\n ref={menu.panelRef}\n id={menuId}\n className=\"aegis-shell__app-list\"\n role=\"menu\"\n tabIndex={-1}\n onKeyDown={menu.onPanelKeyDown}\n >\n {visibleApps.map((app) => {\n const active = app.id === activeAppId;\n const cls = active\n ? 'aegis-shell__app-row aegis-shell__app-row--active'\n : 'aegis-shell__app-row';\n return (\n <li key={app.id} role=\"none\">\n <button\n type=\"button\"\n role=\"menuitem\"\n className={cls}\n onClick={() => handlePick(app)}\n >\n <span className=\"aegis-shell__app-row-icon\">{app.icon}</span>\n <span className=\"aegis-shell__app-row-body\">\n <span className=\"aegis-shell__app-row-label\">{app.label}</span>\n {app.description && (\n <span className=\"aegis-shell__app-row-desc\">\n {app.description}\n </span>\n )}\n </span>\n </button>\n </li>\n );\n })}\n </ul>\n );\n\n return (\n <Popover\n open={menu.open}\n onOpenChange={menu.setOpen}\n trigger=\"click\"\n placement=\"rightTop\"\n autoAdjustOverflow={POPOVER_OVERFLOW}\n arrow={false}\n content={content}\n classNames={{ root: 'aegis-shell__app-popover' }}\n destroyOnHidden\n >\n <button\n ref={menu.triggerRef}\n type=\"button\"\n className=\"aegis-shell__app-launcher\"\n aria-label={strings.switchApp}\n aria-haspopup=\"menu\"\n aria-expanded={menu.open}\n aria-controls={menu.open ? menuId : undefined}\n onKeyDown={menu.onTriggerKeyDown}\n >\n <span className=\"aegis-shell__app-launcher-glyph\" aria-hidden=\"true\">\n <svg\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 20 20\"\n fill=\"currentColor\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <circle cx=\"4\" cy=\"4\" r=\"1.5\" />\n <circle cx=\"10\" cy=\"4\" r=\"1.5\" />\n <circle cx=\"16\" cy=\"4\" r=\"1.5\" />\n <circle cx=\"4\" cy=\"10\" r=\"1.5\" />\n <circle cx=\"10\" cy=\"10\" r=\"1.5\" />\n <circle cx=\"16\" cy=\"10\" r=\"1.5\" />\n <circle cx=\"4\" cy=\"16\" r=\"1.5\" />\n <circle cx=\"10\" cy=\"16\" r=\"1.5\" />\n <circle cx=\"16\" cy=\"16\" r=\"1.5\" />\n </svg>\n </span>\n </button>\n </Popover>\n );\n}\n"],"names":["AppSwitcher","apps","activeAppId","onAppSwitch","menu","useMenuPopover","menuId","useId","navigate","useNavigate","strings","useStrings","handlePick","app","joinPath","visibleApps","content","jsx","cls","jsxs","Popover","POPOVER_OVERFLOW"],"mappings":";;;;;;;;AAsBO,SAASA,EAAY;AAAA,EAC1B,MAAAC;AAAA,EACA,aAAAC;AAAA,EACA,aAAAC;AACF,GAAmC;AACjC,QAAMC,IAAOC,EAAA,GACPC,IAASC,EAAA,GACTC,IAAWC,EAAA,GACXC,IAAUC,EAAA,GAEVC,IAAa,CAACC,MAAwB;AAC1C,IAAAT,EAAK,MAAA,GACLD,IAAcU,EAAI,EAAE,GACpBL,EAASM,EAASD,EAAI,UAAU,EAAE,CAAC;AAAA,EACrC,GAEME,IAAcd,EAAK,OAAO,CAACY,MAAQ,CAACA,EAAI,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AAYM,EAAQ;AAAA,UACpB,iBAAc;AAAA,UACd,iBAAeN,EAAK;AAAA,UACpB,iBAAeA,EAAK,OAAOE,IAAS;AAAA,UACpC,WAAWF,EAAK;AAAA,UAEhB,UAAA,gBAAAa,EAAC,QAAA,EAAK,WAAU,mCAAkC,eAAY,QAC5D,UAAA,gBAAAE;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,OAAM;AAAA,cACN,QAAO;AAAA,cACP,SAAQ;AAAA,cACR,MAAK;AAAA,cACL,OAAM;AAAA,cAEN,UAAA;AAAA,gBAAA,gBAAAF,EAAC,YAAO,IAAG,KAAI,IAAG,KAAI,GAAE,OAAM;AAAA,kCAC7B,UAAA,EAAO,IAAG,MAAK,IAAG,KAAI,GAAE,OAAM;AAAA,kCAC9B,UAAA,EAAO,IAAG,MAAK,IAAG,KAAI,GAAE,OAAM;AAAA,kCAC9B,UAAA,EAAO,IAAG,KAAI,IAAG,MAAK,GAAE,OAAM;AAAA,kCAC9B,UAAA,EAAO,IAAG,MAAK,IAAG,MAAK,GAAE,OAAM;AAAA,kCAC/B,UAAA,EAAO,IAAG,MAAK,IAAG,MAAK,GAAE,OAAM;AAAA,kCAC/B,UAAA,EAAO,IAAG,KAAI,IAAG,MAAK,GAAE,OAAM;AAAA,kCAC9B,UAAA,EAAO,IAAG,MAAK,IAAG,MAAK,GAAE,OAAM;AAAA,kCAC/B,UAAA,EAAO,IAAG,MAAK,IAAG,MAAK,GAAE,MAAA,CAAM;AAAA,cAAA;AAAA,YAAA;AAAA,UAAA,EAClC,CACF;AAAA,QAAA;AAAA,MAAA;AAAA,IACF;AAAA,EAAA;AAGN;"}
|
|
@@ -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 i=require("react/jsx-runtime"),l=require("../../components/ui/Chip.cjs"),r=require("../../components/ui/EmptyState.cjs"),c=require("../../locale/useStrings.cjs");function a({app:t,status:n,user:u,onSignIn:o}){const e=c.useStrings();if(n==="loading")return i.jsx(r.EmptyState,{title:e.authChecking});if(n==="unauthenticated")return i.jsx(r.EmptyState,{title:e.authSignInTo(t.label),description:t.description??e.authSignInDescription,action:o?i.jsx(l.Chip,{tone:"ink",onClick:o,children:e.signIn}):void 0});const d=u?.roles??[],s=t.requiredRoles??[];return i.jsx(r.EmptyState,{title:e.authForbiddenTitle,description:s.length?e.authForbiddenRoles(t.label,s,d):e.authForbidden(t.label)})}exports.AuthRequiredCard=a;
|
|
2
2
|
//# sourceMappingURL=AuthRequiredCard.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthRequiredCard.cjs","sources":["../../../src/layouts/shell/AuthRequiredCard.tsx"],"sourcesContent":["import { type ReactElement } from 'react';\n\nimport type { AegisAuthUser, AuthStatus } from '../../auth';\nimport { Chip } from '../../components/ui/Chip';\nimport { EmptyState } from '../../components/ui/EmptyState';\nimport type { AegisApp } from './types';\n\ninterface AuthRequiredCardProps {\n app: AegisApp;\n status: AuthStatus;\n user: AegisAuthUser | null;\n onSignIn?: () => void;\n}\n\n/**\n * Rendered in place of an app's content when the current user is not\n * authorized to view it. Distinguishes between \"needs login\" and\n * \"logged in but missing role\" so the message and call-to-action match.\n */\nexport function AuthRequiredCard({\n app,\n status,\n user,\n onSignIn,\n}: AuthRequiredCardProps): ReactElement {\n if (status === 'loading') {\n return <EmptyState title
|
|
1
|
+
{"version":3,"file":"AuthRequiredCard.cjs","sources":["../../../src/layouts/shell/AuthRequiredCard.tsx"],"sourcesContent":["import { type ReactElement } from 'react';\n\nimport type { AegisAuthUser, AuthStatus } from '../../auth';\nimport { Chip } from '../../components/ui/Chip';\nimport { EmptyState } from '../../components/ui/EmptyState';\nimport { useStrings } from '../../locale';\nimport type { AegisApp } from './types';\n\ninterface AuthRequiredCardProps {\n app: AegisApp;\n status: AuthStatus;\n user: AegisAuthUser | null;\n onSignIn?: () => void;\n}\n\n/**\n * Rendered in place of an app's content when the current user is not\n * authorized to view it. Distinguishes between \"needs login\" and\n * \"logged in but missing role\" so the message and call-to-action match.\n */\nexport function AuthRequiredCard({\n app,\n status,\n user,\n onSignIn,\n}: AuthRequiredCardProps): ReactElement {\n const strings = useStrings();\n if (status === 'loading') {\n return <EmptyState title={strings.authChecking} />;\n }\n if (status === 'unauthenticated') {\n return (\n <EmptyState\n title={strings.authSignInTo(app.label)}\n description={app.description ?? strings.authSignInDescription}\n action={\n onSignIn ? (\n <Chip tone=\"ink\" onClick={onSignIn}>\n {strings.signIn}\n </Chip>\n ) : undefined\n }\n />\n );\n }\n const userRoles = user?.roles ?? [];\n const required = app.requiredRoles ?? [];\n return (\n <EmptyState\n title={strings.authForbiddenTitle}\n description={\n required.length\n ? strings.authForbiddenRoles(app.label, required, userRoles)\n : strings.authForbidden(app.label)\n }\n />\n );\n}\n"],"names":["AuthRequiredCard","app","status","user","onSignIn","strings","useStrings","jsx","EmptyState","Chip","userRoles","required"],"mappings":"wPAoBO,SAASA,EAAiB,CAC/B,IAAAC,EACA,OAAAC,EACA,KAAAC,EACA,SAAAC,CACF,EAAwC,CACtC,MAAMC,EAAUC,EAAAA,WAAA,EAChB,GAAIJ,IAAW,UACb,OAAOK,EAAAA,IAACC,EAAAA,WAAA,CAAW,MAAOH,EAAQ,YAAA,CAAc,EAElD,GAAIH,IAAW,kBACb,OACEK,EAAAA,IAACC,EAAAA,WAAA,CACC,MAAOH,EAAQ,aAAaJ,EAAI,KAAK,EACrC,YAAaA,EAAI,aAAeI,EAAQ,sBACxC,OACED,EACEG,EAAAA,IAACE,EAAAA,KAAA,CAAK,KAAK,MAAM,QAASL,EACvB,SAAAC,EAAQ,MAAA,CACX,EACE,MAAA,CAAA,EAKZ,MAAMK,EAAYP,GAAM,OAAS,CAAA,EAC3BQ,EAAWV,EAAI,eAAiB,CAAA,EACtC,OACEM,EAAAA,IAACC,EAAAA,WAAA,CACC,MAAOH,EAAQ,mBACf,YACEM,EAAS,OACLN,EAAQ,mBAAmBJ,EAAI,MAAOU,EAAUD,CAAS,EACzDL,EAAQ,cAAcJ,EAAI,KAAK,CAAA,CAAA,CAI3C"}
|
|
@@ -1,33 +1,35 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { Chip as
|
|
3
|
-
import { EmptyState as
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { Chip as s } from "../../components/ui/Chip.js";
|
|
3
|
+
import { EmptyState as r } from "../../components/ui/EmptyState.js";
|
|
4
|
+
import { useStrings as c } from "../../locale/useStrings.js";
|
|
5
|
+
function g({
|
|
6
|
+
app: i,
|
|
7
|
+
status: n,
|
|
8
|
+
user: d,
|
|
9
|
+
onSignIn: o
|
|
9
10
|
}) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
const t = c();
|
|
12
|
+
if (n === "loading")
|
|
13
|
+
return /* @__PURE__ */ e(r, { title: t.authChecking });
|
|
14
|
+
if (n === "unauthenticated")
|
|
15
|
+
return /* @__PURE__ */ e(
|
|
16
|
+
r,
|
|
15
17
|
{
|
|
16
|
-
title:
|
|
17
|
-
description:
|
|
18
|
-
action:
|
|
18
|
+
title: t.authSignInTo(i.label),
|
|
19
|
+
description: i.description ?? t.authSignInDescription,
|
|
20
|
+
action: o ? /* @__PURE__ */ e(s, { tone: "ink", onClick: o, children: t.signIn }) : void 0
|
|
19
21
|
}
|
|
20
22
|
);
|
|
21
|
-
const
|
|
22
|
-
return /* @__PURE__ */
|
|
23
|
-
|
|
23
|
+
const u = d?.roles ?? [], l = i.requiredRoles ?? [];
|
|
24
|
+
return /* @__PURE__ */ e(
|
|
25
|
+
r,
|
|
24
26
|
{
|
|
25
|
-
title:
|
|
26
|
-
description:
|
|
27
|
+
title: t.authForbiddenTitle,
|
|
28
|
+
description: l.length ? t.authForbiddenRoles(i.label, l, u) : t.authForbidden(i.label)
|
|
27
29
|
}
|
|
28
30
|
);
|
|
29
31
|
}
|
|
30
32
|
export {
|
|
31
|
-
|
|
33
|
+
g as AuthRequiredCard
|
|
32
34
|
};
|
|
33
35
|
//# sourceMappingURL=AuthRequiredCard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthRequiredCard.js","sources":["../../../src/layouts/shell/AuthRequiredCard.tsx"],"sourcesContent":["import { type ReactElement } from 'react';\n\nimport type { AegisAuthUser, AuthStatus } from '../../auth';\nimport { Chip } from '../../components/ui/Chip';\nimport { EmptyState } from '../../components/ui/EmptyState';\nimport type { AegisApp } from './types';\n\ninterface AuthRequiredCardProps {\n app: AegisApp;\n status: AuthStatus;\n user: AegisAuthUser | null;\n onSignIn?: () => void;\n}\n\n/**\n * Rendered in place of an app's content when the current user is not\n * authorized to view it. Distinguishes between \"needs login\" and\n * \"logged in but missing role\" so the message and call-to-action match.\n */\nexport function AuthRequiredCard({\n app,\n status,\n user,\n onSignIn,\n}: AuthRequiredCardProps): ReactElement {\n if (status === 'loading') {\n return <EmptyState title
|
|
1
|
+
{"version":3,"file":"AuthRequiredCard.js","sources":["../../../src/layouts/shell/AuthRequiredCard.tsx"],"sourcesContent":["import { type ReactElement } from 'react';\n\nimport type { AegisAuthUser, AuthStatus } from '../../auth';\nimport { Chip } from '../../components/ui/Chip';\nimport { EmptyState } from '../../components/ui/EmptyState';\nimport { useStrings } from '../../locale';\nimport type { AegisApp } from './types';\n\ninterface AuthRequiredCardProps {\n app: AegisApp;\n status: AuthStatus;\n user: AegisAuthUser | null;\n onSignIn?: () => void;\n}\n\n/**\n * Rendered in place of an app's content when the current user is not\n * authorized to view it. Distinguishes between \"needs login\" and\n * \"logged in but missing role\" so the message and call-to-action match.\n */\nexport function AuthRequiredCard({\n app,\n status,\n user,\n onSignIn,\n}: AuthRequiredCardProps): ReactElement {\n const strings = useStrings();\n if (status === 'loading') {\n return <EmptyState title={strings.authChecking} />;\n }\n if (status === 'unauthenticated') {\n return (\n <EmptyState\n title={strings.authSignInTo(app.label)}\n description={app.description ?? strings.authSignInDescription}\n action={\n onSignIn ? (\n <Chip tone=\"ink\" onClick={onSignIn}>\n {strings.signIn}\n </Chip>\n ) : undefined\n }\n />\n );\n }\n const userRoles = user?.roles ?? [];\n const required = app.requiredRoles ?? [];\n return (\n <EmptyState\n title={strings.authForbiddenTitle}\n description={\n required.length\n ? strings.authForbiddenRoles(app.label, required, userRoles)\n : strings.authForbidden(app.label)\n }\n />\n );\n}\n"],"names":["AuthRequiredCard","app","status","user","onSignIn","strings","useStrings","jsx","EmptyState","Chip","userRoles","required"],"mappings":";;;;AAoBO,SAASA,EAAiB;AAAA,EAC/B,KAAAC;AAAA,EACA,QAAAC;AAAA,EACA,MAAAC;AAAA,EACA,UAAAC;AACF,GAAwC;AACtC,QAAMC,IAAUC,EAAA;AAChB,MAAIJ,MAAW;AACb,WAAO,gBAAAK,EAACC,GAAA,EAAW,OAAOH,EAAQ,aAAA,CAAc;AAElD,MAAIH,MAAW;AACb,WACE,gBAAAK;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,OAAOH,EAAQ,aAAaJ,EAAI,KAAK;AAAA,QACrC,aAAaA,EAAI,eAAeI,EAAQ;AAAA,QACxC,QACED,IACE,gBAAAG,EAACE,GAAA,EAAK,MAAK,OAAM,SAASL,GACvB,UAAAC,EAAQ,OAAA,CACX,IACE;AAAA,MAAA;AAAA,IAAA;AAKZ,QAAMK,IAAYP,GAAM,SAAS,CAAA,GAC3BQ,IAAWV,EAAI,iBAAiB,CAAA;AACtC,SACE,gBAAAM;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,OAAOH,EAAQ;AAAA,MACf,aACEM,EAAS,SACLN,EAAQ,mBAAmBJ,EAAI,OAAOU,GAAUD,CAAS,IACzDL,EAAQ,cAAcJ,EAAI,KAAK;AAAA,IAAA;AAAA,EAAA;AAI3C;"}
|
|
@@ -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 t=require("react/jsx-runtime"),o=require("react"),n=require("../../components/ui/Button.cjs"),s=require("../../components/ui/ErrorState.cjs"),i=require("../../locale/localeContext.cjs"),c=require("../PageWrapper.cjs");class a extends o.Component{static contextType=i.LocaleContext;state={error:null,resetKey:this.props.resetKey};static getDerivedStateFromError(e){return{error:e instanceof Error?e:new Error(String(e))}}static getDerivedStateFromProps(e,r){return e.resetKey===r.resetKey?null:{error:null,resetKey:e.resetKey}}retry=()=>{this.setState({error:null})};render(){const{error:e}=this.state;if(!e)return this.props.children;const r=this.context;return t.jsx(c.PageWrapper,{children:t.jsx(s.ErrorState,{title:r.routeErrorTitle,description:e.message,action:t.jsx(n.Button,{tone:"secondary",onClick:this.retry,children:r.retry})})})}}exports.RouteErrorBoundary=a;
|
|
2
2
|
//# sourceMappingURL=RouteErrorBoundary.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RouteErrorBoundary.cjs","sources":["../../../src/layouts/shell/RouteErrorBoundary.tsx"],"sourcesContent":["import { Component, type ReactNode } from 'react';\n\nimport { Button } from '../../components/ui/Button';\nimport { ErrorState } from '../../components/ui/ErrorState';\nimport { PageWrapper } from '../PageWrapper';\n\ninterface RouteErrorBoundaryProps {\n /** A new key — the next location — clears the error and renders the route again. */\n resetKey: string;\n children: ReactNode;\n}\n\ninterface RouteErrorBoundaryState {\n error: Error | null;\n resetKey: string;\n}\n\n/**\n * Catches a render error in the routed page, so the shell around it stays\n * up. Shows the error in the page area with a retry; navigating elsewhere\n * clears it.\n */\nexport class RouteErrorBoundary extends Component<\n RouteErrorBoundaryProps,\n RouteErrorBoundaryState\n> {\n override state: RouteErrorBoundaryState = {\n error: null,\n resetKey: this.props.resetKey,\n };\n\n static getDerivedStateFromError(\n error: unknown,\n ): Partial<RouteErrorBoundaryState> {\n return { error: error instanceof Error ? error : new Error(String(error)) };\n }\n\n static getDerivedStateFromProps(\n props: RouteErrorBoundaryProps,\n state: RouteErrorBoundaryState,\n ): Partial<RouteErrorBoundaryState> | null {\n return props.resetKey === state.resetKey\n ? null\n : { error: null, resetKey: props.resetKey };\n }\n\n private readonly retry = (): void => {\n this.setState({ error: null });\n };\n\n override render(): ReactNode {\n const { error } = this.state;\n if (!error) {\n return this.props.children;\n }\n return (\n <PageWrapper>\n <ErrorState\n title
|
|
1
|
+
{"version":3,"file":"RouteErrorBoundary.cjs","sources":["../../../src/layouts/shell/RouteErrorBoundary.tsx"],"sourcesContent":["import { Component, type ContextType, type ReactNode } from 'react';\n\nimport { Button } from '../../components/ui/Button';\nimport { ErrorState } from '../../components/ui/ErrorState';\nimport { LocaleContext } from '../../locale/localeContext';\nimport { PageWrapper } from '../PageWrapper';\n\ninterface RouteErrorBoundaryProps {\n /** A new key — the next location — clears the error and renders the route again. */\n resetKey: string;\n children: ReactNode;\n}\n\ninterface RouteErrorBoundaryState {\n error: Error | null;\n resetKey: string;\n}\n\n/**\n * Catches a render error in the routed page, so the shell around it stays\n * up. Shows the error in the page area with a retry; navigating elsewhere\n * clears it.\n */\nexport class RouteErrorBoundary extends Component<\n RouteErrorBoundaryProps,\n RouteErrorBoundaryState\n> {\n static override contextType = LocaleContext;\n declare context: ContextType<typeof LocaleContext>;\n\n override state: RouteErrorBoundaryState = {\n error: null,\n resetKey: this.props.resetKey,\n };\n\n static getDerivedStateFromError(\n error: unknown,\n ): Partial<RouteErrorBoundaryState> {\n return { error: error instanceof Error ? error : new Error(String(error)) };\n }\n\n static getDerivedStateFromProps(\n props: RouteErrorBoundaryProps,\n state: RouteErrorBoundaryState,\n ): Partial<RouteErrorBoundaryState> | null {\n return props.resetKey === state.resetKey\n ? null\n : { error: null, resetKey: props.resetKey };\n }\n\n private readonly retry = (): void => {\n this.setState({ error: null });\n };\n\n override render(): ReactNode {\n const { error } = this.state;\n if (!error) {\n return this.props.children;\n }\n const strings = this.context;\n return (\n <PageWrapper>\n <ErrorState\n title={strings.routeErrorTitle}\n description={error.message}\n action={\n <Button tone=\"secondary\" onClick={this.retry}>\n {strings.retry}\n </Button>\n }\n />\n </PageWrapper>\n );\n }\n}\n"],"names":["RouteErrorBoundary","Component","LocaleContext","error","props","state","strings","PageWrapper","jsx","ErrorState","Button"],"mappings":"gTAuBO,MAAMA,UAA2BC,EAAAA,SAGtC,CACA,OAAgB,YAAcC,EAAAA,cAGrB,MAAiC,CACxC,MAAO,KACP,SAAU,KAAK,MAAM,QAAA,EAGvB,OAAO,yBACLC,EACkC,CAClC,MAAO,CAAE,MAAOA,aAAiB,MAAQA,EAAQ,IAAI,MAAM,OAAOA,CAAK,CAAC,CAAA,CAC1E,CAEA,OAAO,yBACLC,EACAC,EACyC,CACzC,OAAOD,EAAM,WAAaC,EAAM,SAC5B,KACA,CAAE,MAAO,KAAM,SAAUD,EAAM,QAAA,CACrC,CAEiB,MAAQ,IAAY,CACnC,KAAK,SAAS,CAAE,MAAO,IAAA,CAAM,CAC/B,EAES,QAAoB,CAC3B,KAAM,CAAE,MAAAD,GAAU,KAAK,MACvB,GAAI,CAACA,EACH,OAAO,KAAK,MAAM,SAEpB,MAAMG,EAAU,KAAK,QACrB,aACGC,EAAAA,YAAA,CACC,SAAAC,EAAAA,IAACC,EAAAA,WAAA,CACC,MAAOH,EAAQ,gBACf,YAAaH,EAAM,QACnB,aACGO,SAAA,CAAO,KAAK,YAAY,QAAS,KAAK,MACpC,SAAAJ,EAAQ,KAAA,CACX,CAAA,CAAA,EAGN,CAEJ,CACF"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Component, ReactNode } from 'react';
|
|
1
|
+
import { Component, ContextType, ReactNode } from 'react';
|
|
2
|
+
import { LocaleContext } from '../../locale/localeContext';
|
|
2
3
|
interface RouteErrorBoundaryProps {
|
|
3
4
|
/** A new key — the next location — clears the error and renders the route again. */
|
|
4
5
|
resetKey: string;
|
|
@@ -14,6 +15,8 @@ interface RouteErrorBoundaryState {
|
|
|
14
15
|
* clears it.
|
|
15
16
|
*/
|
|
16
17
|
export declare class RouteErrorBoundary extends Component<RouteErrorBoundaryProps, RouteErrorBoundaryState> {
|
|
18
|
+
static contextType: import('react').Context<import('../..').AegisStrings>;
|
|
19
|
+
context: ContextType<typeof LocaleContext>;
|
|
17
20
|
state: RouteErrorBoundaryState;
|
|
18
21
|
static getDerivedStateFromError(error: unknown): Partial<RouteErrorBoundaryState>;
|
|
19
22
|
static getDerivedStateFromProps(props: RouteErrorBoundaryProps, state: RouteErrorBoundaryState): Partial<RouteErrorBoundaryState> | null;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { Component as o } from "react";
|
|
3
|
-
import { Button as
|
|
4
|
-
import { ErrorState as
|
|
5
|
-
import {
|
|
6
|
-
|
|
3
|
+
import { Button as s } from "../../components/ui/Button.js";
|
|
4
|
+
import { ErrorState as n } from "../../components/ui/ErrorState.js";
|
|
5
|
+
import { LocaleContext as i } from "../../locale/localeContext.js";
|
|
6
|
+
import { PageWrapper as a } from "../PageWrapper.js";
|
|
7
|
+
class h extends o {
|
|
8
|
+
static contextType = i;
|
|
7
9
|
state = {
|
|
8
10
|
error: null,
|
|
9
11
|
resetKey: this.props.resetKey
|
|
@@ -19,17 +21,20 @@ class u extends o {
|
|
|
19
21
|
};
|
|
20
22
|
render() {
|
|
21
23
|
const { error: r } = this.state;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
if (!r)
|
|
25
|
+
return this.props.children;
|
|
26
|
+
const t = this.context;
|
|
27
|
+
return /* @__PURE__ */ e(a, { children: /* @__PURE__ */ e(
|
|
28
|
+
n,
|
|
24
29
|
{
|
|
25
|
-
title:
|
|
30
|
+
title: t.routeErrorTitle,
|
|
26
31
|
description: r.message,
|
|
27
|
-
action: /* @__PURE__ */ e(
|
|
32
|
+
action: /* @__PURE__ */ e(s, { tone: "secondary", onClick: this.retry, children: t.retry })
|
|
28
33
|
}
|
|
29
|
-
) })
|
|
34
|
+
) });
|
|
30
35
|
}
|
|
31
36
|
}
|
|
32
37
|
export {
|
|
33
|
-
|
|
38
|
+
h as RouteErrorBoundary
|
|
34
39
|
};
|
|
35
40
|
//# sourceMappingURL=RouteErrorBoundary.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RouteErrorBoundary.js","sources":["../../../src/layouts/shell/RouteErrorBoundary.tsx"],"sourcesContent":["import { Component, type ReactNode } from 'react';\n\nimport { Button } from '../../components/ui/Button';\nimport { ErrorState } from '../../components/ui/ErrorState';\nimport { PageWrapper } from '../PageWrapper';\n\ninterface RouteErrorBoundaryProps {\n /** A new key — the next location — clears the error and renders the route again. */\n resetKey: string;\n children: ReactNode;\n}\n\ninterface RouteErrorBoundaryState {\n error: Error | null;\n resetKey: string;\n}\n\n/**\n * Catches a render error in the routed page, so the shell around it stays\n * up. Shows the error in the page area with a retry; navigating elsewhere\n * clears it.\n */\nexport class RouteErrorBoundary extends Component<\n RouteErrorBoundaryProps,\n RouteErrorBoundaryState\n> {\n override state: RouteErrorBoundaryState = {\n error: null,\n resetKey: this.props.resetKey,\n };\n\n static getDerivedStateFromError(\n error: unknown,\n ): Partial<RouteErrorBoundaryState> {\n return { error: error instanceof Error ? error : new Error(String(error)) };\n }\n\n static getDerivedStateFromProps(\n props: RouteErrorBoundaryProps,\n state: RouteErrorBoundaryState,\n ): Partial<RouteErrorBoundaryState> | null {\n return props.resetKey === state.resetKey\n ? null\n : { error: null, resetKey: props.resetKey };\n }\n\n private readonly retry = (): void => {\n this.setState({ error: null });\n };\n\n override render(): ReactNode {\n const { error } = this.state;\n if (!error) {\n return this.props.children;\n }\n return (\n <PageWrapper>\n <ErrorState\n title
|
|
1
|
+
{"version":3,"file":"RouteErrorBoundary.js","sources":["../../../src/layouts/shell/RouteErrorBoundary.tsx"],"sourcesContent":["import { Component, type ContextType, type ReactNode } from 'react';\n\nimport { Button } from '../../components/ui/Button';\nimport { ErrorState } from '../../components/ui/ErrorState';\nimport { LocaleContext } from '../../locale/localeContext';\nimport { PageWrapper } from '../PageWrapper';\n\ninterface RouteErrorBoundaryProps {\n /** A new key — the next location — clears the error and renders the route again. */\n resetKey: string;\n children: ReactNode;\n}\n\ninterface RouteErrorBoundaryState {\n error: Error | null;\n resetKey: string;\n}\n\n/**\n * Catches a render error in the routed page, so the shell around it stays\n * up. Shows the error in the page area with a retry; navigating elsewhere\n * clears it.\n */\nexport class RouteErrorBoundary extends Component<\n RouteErrorBoundaryProps,\n RouteErrorBoundaryState\n> {\n static override contextType = LocaleContext;\n declare context: ContextType<typeof LocaleContext>;\n\n override state: RouteErrorBoundaryState = {\n error: null,\n resetKey: this.props.resetKey,\n };\n\n static getDerivedStateFromError(\n error: unknown,\n ): Partial<RouteErrorBoundaryState> {\n return { error: error instanceof Error ? error : new Error(String(error)) };\n }\n\n static getDerivedStateFromProps(\n props: RouteErrorBoundaryProps,\n state: RouteErrorBoundaryState,\n ): Partial<RouteErrorBoundaryState> | null {\n return props.resetKey === state.resetKey\n ? null\n : { error: null, resetKey: props.resetKey };\n }\n\n private readonly retry = (): void => {\n this.setState({ error: null });\n };\n\n override render(): ReactNode {\n const { error } = this.state;\n if (!error) {\n return this.props.children;\n }\n const strings = this.context;\n return (\n <PageWrapper>\n <ErrorState\n title={strings.routeErrorTitle}\n description={error.message}\n action={\n <Button tone=\"secondary\" onClick={this.retry}>\n {strings.retry}\n </Button>\n }\n />\n </PageWrapper>\n );\n }\n}\n"],"names":["RouteErrorBoundary","Component","LocaleContext","error","props","state","strings","PageWrapper","jsx","ErrorState","Button"],"mappings":";;;;;;AAuBO,MAAMA,UAA2BC,EAGtC;AAAA,EACA,OAAgB,cAAcC;AAAA,EAGrB,QAAiC;AAAA,IACxC,OAAO;AAAA,IACP,UAAU,KAAK,MAAM;AAAA,EAAA;AAAA,EAGvB,OAAO,yBACLC,GACkC;AAClC,WAAO,EAAE,OAAOA,aAAiB,QAAQA,IAAQ,IAAI,MAAM,OAAOA,CAAK,CAAC,EAAA;AAAA,EAC1E;AAAA,EAEA,OAAO,yBACLC,GACAC,GACyC;AACzC,WAAOD,EAAM,aAAaC,EAAM,WAC5B,OACA,EAAE,OAAO,MAAM,UAAUD,EAAM,SAAA;AAAA,EACrC;AAAA,EAEiB,QAAQ,MAAY;AACnC,SAAK,SAAS,EAAE,OAAO,KAAA,CAAM;AAAA,EAC/B;AAAA,EAES,SAAoB;AAC3B,UAAM,EAAE,OAAAD,MAAU,KAAK;AACvB,QAAI,CAACA;AACH,aAAO,KAAK,MAAM;AAEpB,UAAMG,IAAU,KAAK;AACrB,6BACGC,GAAA,EACC,UAAA,gBAAAC;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,OAAOH,EAAQ;AAAA,QACf,aAAaH,EAAM;AAAA,QACnB,0BACGO,GAAA,EAAO,MAAK,aAAY,SAAS,KAAK,OACpC,UAAAJ,EAAQ,MAAA,CACX;AAAA,MAAA;AAAA,IAAA,GAGN;AAAA,EAEJ;AACF;"}
|
|
@@ -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 b=require("react/jsx-runtime"),n=require("react"),f=require("../../components/ui/InboxPage.cjs"),g=require("./useOpenNotification.cjs"),v=require("../../notifications/useNotifications.cjs");function x({defaultFilter:t,surface:r}){const{items:i,unreadCount:s,markAllRead:e,error:a,liveError:c,refetch:o}=v.useNotifications(),u=g.useOpenNotification(),l=n.useCallback(()=>{e?.()},[e]),d=n.useCallback(()=>{o?.()},[o]);return b.jsx(f.InboxPage,{items:i,unreadCount:s,onOpen:u,onMarkAllRead:e?l:void 0,error:a,liveError:c,onRetry:o?d:void 0,defaultFilter:t,surface:r})}exports.ShellInboxPage=x;
|
|
2
2
|
//# sourceMappingURL=ShellInboxPage.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShellInboxPage.cjs","sources":["../../../src/layouts/shell/ShellInboxPage.tsx"],"sourcesContent":["import { type ReactElement, useCallback } from 'react';\n\nimport {\n InboxPage,\n type InboxPageSurface,\n} from '../../components/ui/InboxPage';\nimport { useNotifications } from '../../notifications';\nimport { useOpenNotification } from './useOpenNotification';\n\ninterface ShellInboxPageProps {\n defaultFilter?: 'all' | 'unread';\n surface?: InboxPageSurface;\n}\n\n/**\n * The InboxPage filled from `<NotificationProvider>`: opening an item marks\n * it read and follows its `to`. Mount it on the route `inboxPath` names.\n */\nexport function ShellInboxPage({\n defaultFilter,\n surface,\n}: ShellInboxPageProps): ReactElement {\n const { items, unreadCount, markAllRead, error, refetch } =\n useNotifications();\n const open = useOpenNotification();\n const markAll = useCallback(() => {\n void markAllRead?.();\n }, [markAllRead]);\n const retry = useCallback(() => {\n void refetch?.();\n }, [refetch]);\n return (\n <InboxPage\n items={items}\n unreadCount={unreadCount}\n onOpen={open}\n onMarkAllRead={markAllRead ? markAll : undefined}\n error={error}\n onRetry={refetch ? retry : undefined}\n defaultFilter={defaultFilter}\n surface={surface}\n />\n );\n}\n"],"names":["ShellInboxPage","defaultFilter","surface","items","unreadCount","markAllRead","error","refetch","useNotifications","open","useOpenNotification","markAll","useCallback","retry","jsx","InboxPage"],"mappings":"oRAkBO,SAASA,EAAe,CAC7B,cAAAC,EACA,QAAAC,CACF,EAAsC,CACpC,KAAM,CAAE,MAAAC,EAAO,YAAAC,EAAa,YAAAC,EAAa,MAAAC,EAAO,QAAAC,CAAA,
|
|
1
|
+
{"version":3,"file":"ShellInboxPage.cjs","sources":["../../../src/layouts/shell/ShellInboxPage.tsx"],"sourcesContent":["import { type ReactElement, useCallback } from 'react';\n\nimport {\n InboxPage,\n type InboxPageSurface,\n} from '../../components/ui/InboxPage';\nimport { useNotifications } from '../../notifications';\nimport { useOpenNotification } from './useOpenNotification';\n\ninterface ShellInboxPageProps {\n defaultFilter?: 'all' | 'unread';\n surface?: InboxPageSurface;\n}\n\n/**\n * The InboxPage filled from `<NotificationProvider>`: opening an item marks\n * it read and follows its `to`. Mount it on the route `inboxPath` names.\n */\nexport function ShellInboxPage({\n defaultFilter,\n surface,\n}: ShellInboxPageProps): ReactElement {\n const { items, unreadCount, markAllRead, error, liveError, refetch } =\n useNotifications();\n const open = useOpenNotification();\n const markAll = useCallback(() => {\n void markAllRead?.();\n }, [markAllRead]);\n const retry = useCallback(() => {\n void refetch?.();\n }, [refetch]);\n return (\n <InboxPage\n items={items}\n unreadCount={unreadCount}\n onOpen={open}\n onMarkAllRead={markAllRead ? markAll : undefined}\n error={error}\n liveError={liveError}\n onRetry={refetch ? retry : undefined}\n defaultFilter={defaultFilter}\n surface={surface}\n />\n );\n}\n"],"names":["ShellInboxPage","defaultFilter","surface","items","unreadCount","markAllRead","error","liveError","refetch","useNotifications","open","useOpenNotification","markAll","useCallback","retry","jsx","InboxPage"],"mappings":"oRAkBO,SAASA,EAAe,CAC7B,cAAAC,EACA,QAAAC,CACF,EAAsC,CACpC,KAAM,CAAE,MAAAC,EAAO,YAAAC,EAAa,YAAAC,EAAa,MAAAC,EAAO,UAAAC,EAAW,QAAAC,CAAA,EACzDC,mBAAA,EACIC,EAAOC,EAAAA,oBAAA,EACPC,EAAUC,EAAAA,YAAY,IAAM,CAC3BR,IAAA,CACP,EAAG,CAACA,CAAW,CAAC,EACVS,EAAQD,EAAAA,YAAY,IAAM,CACzBL,IAAA,CACP,EAAG,CAACA,CAAO,CAAC,EACZ,OACEO,EAAAA,IAACC,EAAAA,UAAA,CACC,MAAAb,EACA,YAAAC,EACA,OAAQM,EACR,cAAeL,EAAcO,EAAU,OACvC,MAAAN,EACA,UAAAC,EACA,QAASC,EAAUM,EAAQ,OAC3B,cAAAb,EACA,QAAAC,CAAA,CAAA,CAGN"}
|
|
@@ -1,32 +1,33 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useCallback as
|
|
3
|
-
import { InboxPage as
|
|
4
|
-
import { useOpenNotification as
|
|
5
|
-
import { useNotifications as
|
|
6
|
-
function
|
|
7
|
-
defaultFilter:
|
|
1
|
+
import { jsx as p } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback as e } from "react";
|
|
3
|
+
import { InboxPage as d } from "../../components/ui/InboxPage.js";
|
|
4
|
+
import { useOpenNotification as u } from "./useOpenNotification.js";
|
|
5
|
+
import { useNotifications as v } from "../../notifications/useNotifications.js";
|
|
6
|
+
function g({
|
|
7
|
+
defaultFilter: t,
|
|
8
8
|
surface: n
|
|
9
9
|
}) {
|
|
10
|
-
const { items: i, unreadCount: m, markAllRead: o, error: a, refetch: r } =
|
|
10
|
+
const { items: i, unreadCount: m, markAllRead: o, error: a, liveError: l, refetch: r } = v(), s = u(), c = e(() => {
|
|
11
11
|
o?.();
|
|
12
|
-
}, [o]),
|
|
12
|
+
}, [o]), f = e(() => {
|
|
13
13
|
r?.();
|
|
14
14
|
}, [r]);
|
|
15
|
-
return /* @__PURE__ */
|
|
16
|
-
|
|
15
|
+
return /* @__PURE__ */ p(
|
|
16
|
+
d,
|
|
17
17
|
{
|
|
18
18
|
items: i,
|
|
19
19
|
unreadCount: m,
|
|
20
|
-
onOpen:
|
|
21
|
-
onMarkAllRead: o ?
|
|
20
|
+
onOpen: s,
|
|
21
|
+
onMarkAllRead: o ? c : void 0,
|
|
22
22
|
error: a,
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
liveError: l,
|
|
24
|
+
onRetry: r ? f : void 0,
|
|
25
|
+
defaultFilter: t,
|
|
25
26
|
surface: n
|
|
26
27
|
}
|
|
27
28
|
);
|
|
28
29
|
}
|
|
29
30
|
export {
|
|
30
|
-
|
|
31
|
+
g as ShellInboxPage
|
|
31
32
|
};
|
|
32
33
|
//# sourceMappingURL=ShellInboxPage.js.map
|