@bevel-software/platform-core-frontend 0.15.1 → 0.20.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/THIRD-PARTY-NOTICES.md +2 -2
- package/package.json +3 -3
- package/src/core/CoreAppShell.tsx +20 -9
- package/src/core/__tests__/AppChrome.test.tsx +0 -3
- package/src/core/__tests__/events.test.ts +43 -0
- package/src/core/bootstrap.ts +11 -3
- package/src/core/events.ts +85 -3
- package/src/core/registry.ts +1 -1
- package/src/lib/__tests__/email.test.ts +44 -0
- package/src/lib/email.ts +37 -1
- package/src/modules/access/__tests__/ManageAccessDialog.add-row-picking.test.tsx +141 -0
- package/src/modules/access/__tests__/ManageAccessDialog.chip-truncation.test.tsx +204 -0
- package/src/modules/access/__tests__/ManageAccessDialog.download-read.test.tsx +234 -0
- package/src/modules/access/__tests__/ManageAccessDialog.edited-row-visible.test.tsx +160 -0
- package/src/modules/access/__tests__/ManageAccessDialog.placement.test.tsx +2 -2
- package/src/modules/access/__tests__/ManageAccessDialog.proposal.test.tsx +166 -0
- package/src/modules/access/__tests__/ManageAccessDialog.restrict.test.tsx +510 -0
- package/src/modules/access/__tests__/ManageAccessDialog.row-menu-axes.test.tsx +299 -0
- package/src/modules/access/__tests__/ManageAccessDialog.row-menu-width.test.tsx +226 -0
- package/src/modules/access/__tests__/ManageAccessDialog.test.tsx +721 -126
- package/src/modules/access/__tests__/ManageAccessDialog.unknown-email.test.tsx +314 -0
- package/src/modules/access/__tests__/manage-access-affordance.test.ts +14 -0
- package/src/modules/access/__tests__/tailwindDeclarations.ts +210 -0
- package/src/modules/access/api.ts +140 -6
- package/src/modules/access/components/ManageAccessDialog.tsx +1299 -561
- package/src/modules/access/manage-access-affordance.ts +17 -0
- package/src/modules/admin/__tests__/AddMemberInput.test.tsx +297 -0
- package/src/modules/admin/__tests__/AdminRolesPage.capabilities.test.tsx +2 -2
- package/src/modules/admin/__tests__/AdminRolesPage.fixed-admin.test.tsx +189 -0
- package/src/modules/admin/__tests__/AdminRolesPage.suggest.test.tsx +1 -1
- package/src/modules/admin/__tests__/DirectoryGroupsPage.suggest.test.tsx +182 -0
- package/src/modules/admin/__tests__/DirectoryGroupsPage.test.tsx +165 -14
- package/src/modules/admin/__tests__/UserAccountsPage.test.tsx +401 -4
- package/src/modules/admin/__tests__/group-members-path.test.ts +27 -0
- package/src/modules/admin/components/AddMemberInput.tsx +268 -0
- package/src/modules/admin/components/AdminRolesPage.tsx +97 -132
- package/src/modules/admin/components/DirectoryGroupsPage.tsx +91 -39
- package/src/modules/admin/components/UserAccountsPage.tsx +271 -37
- package/src/modules/admin/components/group-members-path.ts +32 -0
- package/src/modules/admin/services/roles.api.ts +12 -1
- package/src/modules/audit/__tests__/AuditLogPage.test.tsx +312 -0
- package/src/modules/audit/components/AuditEventsPanel.tsx +319 -0
- package/src/modules/audit/components/AuditLogPage.tsx +373 -0
- package/src/modules/audit/components/principal-grouping.ts +49 -0
- package/src/modules/audit/services/audit.api.ts +98 -0
- package/src/modules/auth/__tests__/AccountPage.test.tsx +50 -2
- package/src/modules/auth/components/AccountPage.tsx +73 -54
- package/src/modules/auth/components/LoginScreen.tsx +1 -0
- package/src/modules/auth/services/account.api.ts +78 -4
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.access-rules.test.tsx +144 -0
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.binary.test.tsx +422 -0
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.brings-itself-up-to-date.test.tsx +431 -0
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.fork-point.test.tsx +193 -0
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.initial-file.test.tsx +142 -0
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.moved.test.tsx +202 -0
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.test.tsx +205 -13
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.unreadable.test.tsx +271 -0
- package/src/modules/change-requests/__tests__/FileChangeBoxes.test.tsx +208 -0
- package/src/modules/change-requests/__tests__/apply-outcome-for-every-viewer.test.tsx +286 -0
- package/src/modules/change-requests/__tests__/propose.concurrent.test.ts +273 -0
- package/src/modules/change-requests/__tests__/readFailure.test.ts +122 -0
- package/src/modules/change-requests/__tests__/useCrFileDiffs.test.tsx +238 -0
- package/src/modules/change-requests/__tests__/useFileOnBranch.test.tsx +56 -1
- package/src/modules/change-requests/__tests__/useForkPointFile.test.tsx +79 -0
- package/src/modules/change-requests/components/BranchFilePreview.tsx +357 -0
- package/src/modules/change-requests/components/ChangeBox.tsx +31 -2
- package/src/modules/change-requests/components/ChangeRequestDialog.tsx +862 -72
- package/src/modules/change-requests/components/CrFileTree.tsx +74 -58
- package/src/modules/change-requests/components/FileChangeBoxes.tsx +19 -15
- package/src/modules/change-requests/hooks/useApplyChangeRequest.ts +41 -7
- package/src/modules/change-requests/hooks/useCrFileDiffs.ts +181 -23
- package/src/modules/change-requests/hooks/useFileOnBranch.ts +70 -7
- package/src/modules/change-requests/hooks/useForkPointFile.ts +77 -0
- package/src/modules/change-requests/services/change-requests.api.ts +57 -1
- package/src/modules/change-requests/services/denied-file.api.ts +53 -0
- package/src/modules/change-requests/services/propose.api.ts +97 -8
- package/src/modules/change-requests/utils/approval.ts +15 -0
- package/src/modules/change-requests/utils/author.ts +32 -0
- package/src/modules/change-requests/utils/readFailure.ts +110 -0
- package/src/modules/git/__tests__/FileHistoryPanel.test.tsx +20 -0
- package/src/modules/git/components/FileHistoryPanel.tsx +5 -0
- package/src/modules/git/components/PullRequestsForMe.tsx +51 -24
- package/src/modules/git/services/__tests__/error-messages.test.ts +29 -0
- package/src/modules/git/services/error-messages.ts +12 -0
- package/src/modules/git/services/pr-prompts.ts +5 -5
- package/src/modules/layout/__tests__/HeaderAlignment.test.tsx +401 -0
- package/src/modules/layout/__tests__/SidebarFooterGrid.test.tsx +286 -0
- package/src/modules/layout/__tests__/SidebarFrameResponsive.test.tsx +61 -0
- package/src/modules/layout/components/AppLayout.tsx +2 -0
- package/src/modules/layout/components/MobileChatLayout.tsx +4 -1
- package/src/modules/layout/components/ResizableThreePaneLayout.tsx +4 -1
- package/src/modules/layout/components/SidebarFrame.tsx +108 -3
- package/src/modules/library/__tests__/AddToPluginDialog.test.tsx +171 -5
- package/src/modules/library/__tests__/DeleteToolDialog.test.tsx +356 -0
- package/src/modules/library/__tests__/IntegrationsSetupReminder.test.tsx +60 -0
- package/src/modules/library/__tests__/LibraryCard.test.tsx +91 -10
- package/src/modules/library/__tests__/LibraryRoutes.test.tsx +242 -107
- package/src/modules/library/__tests__/LibrarySidebarMenu.test.tsx +103 -98
- package/src/modules/library/__tests__/LinkSkillPanel.test.tsx +20 -5
- package/src/modules/library/__tests__/LockedPluginView.test.tsx +97 -7
- package/src/modules/library/__tests__/NewPluginDialog.test.tsx +13 -4
- package/src/modules/library/__tests__/PersonalAddDialog.test.tsx +79 -3
- package/src/modules/library/__tests__/PersonalPluginPage.test.tsx +201 -0
- package/src/modules/library/__tests__/PluginExtras.test.tsx +100 -9
- package/src/modules/library/__tests__/PluginJoinRequests.test.tsx +60 -1
- package/src/modules/library/__tests__/PluginPage.test.tsx +258 -6
- package/src/modules/library/__tests__/PluginsSidebar.contextmenu.test.tsx +16 -56
- package/src/modules/library/__tests__/PluginsSidebar.test.tsx +155 -152
- package/src/modules/library/__tests__/PluginsSidebarMenu.test.tsx +16 -0
- package/src/modules/library/__tests__/SharedViaPlugins.test.tsx +106 -0
- package/src/modules/library/__tests__/SkillPage.test.tsx +386 -80
- package/src/modules/library/__tests__/SkillsTree.test.tsx +293 -4
- package/src/modules/library/__tests__/ToolConnectionSection.test.tsx +582 -71
- package/src/modules/library/__tests__/ToolPage.test.tsx +87 -4
- package/src/modules/library/__tests__/WorkspaceItemRoute.test.tsx +173 -26
- package/src/modules/library/__tests__/auth-harness.tsx +9 -9
- package/src/modules/library/__tests__/card-row-menu.test.tsx +320 -0
- package/src/modules/library/__tests__/library-data.mapping.test.tsx +98 -0
- package/src/modules/library/__tests__/library-data.stale.test.tsx +121 -28
- package/src/modules/library/__tests__/library-data.test.ts +7 -0
- package/src/modules/library/__tests__/library-paths.test.ts +47 -4
- package/src/modules/library/__tests__/link-membership.test.ts +13 -4
- package/src/modules/library/__tests__/name-with-badges.test.tsx +273 -0
- package/src/modules/library/__tests__/newSkillMarkdown.test.ts +30 -0
- package/src/modules/library/__tests__/owner-pill.test.tsx +357 -0
- package/src/modules/library/__tests__/pending-tools.test.tsx +400 -0
- package/src/modules/library/__tests__/plugin-entries.test.ts +122 -0
- package/src/modules/library/__tests__/plugin-summary.test.ts +36 -1
- package/src/modules/library/__tests__/status.test.ts +82 -2
- package/src/modules/library/__tests__/tools.api.test.ts +44 -1
- package/src/modules/library/components/AccessRequestsBanner.tsx +85 -47
- package/src/modules/library/components/AddDialogTabs.tsx +103 -0
- package/src/modules/library/components/AddToPluginDialog.tsx +74 -18
- package/src/modules/library/components/IntegrationsSetupReminder.tsx +59 -0
- package/src/modules/library/components/ItemActionsMenu.tsx +288 -0
- package/src/modules/library/components/LibraryCard.tsx +146 -45
- package/src/modules/library/components/LibraryLayout.tsx +119 -256
- package/src/modules/library/components/LibraryPage.tsx +172 -39
- package/src/modules/library/components/LinkSkillPanel.tsx +1 -3
- package/src/modules/library/components/LockedPluginView.tsx +62 -34
- package/src/modules/library/components/NameWithBadges.tsx +164 -0
- package/src/modules/library/components/NewPluginDialog.tsx +16 -2
- package/src/modules/library/components/PageActions.tsx +11 -9
- package/src/modules/library/components/{PendingSkillReview.tsx → PendingItemReview.tsx} +14 -7
- package/src/modules/library/components/PersonalAddDialog.tsx +68 -18
- package/src/modules/library/components/PersonalPluginPage.tsx +121 -22
- package/src/modules/library/components/PluginExtras.tsx +140 -17
- package/src/modules/library/components/PluginIndexRow.tsx +47 -12
- package/src/modules/library/components/PluginPage.tsx +157 -41
- package/src/modules/library/components/PluginRows.tsx +286 -0
- package/src/modules/library/components/PluginsSidebar.tsx +239 -263
- package/src/modules/library/components/PluginsSidebarMenu.tsx +26 -1
- package/src/modules/library/components/ShareButton.tsx +17 -0
- package/src/modules/library/components/SkillsTree.tsx +141 -28
- package/src/modules/library/components/TeamRoute.tsx +15 -0
- package/src/modules/library/components/__tests__/upload-notices-once-per-page.test.tsx +144 -0
- package/src/modules/library/components/plugin-page-parts.tsx +103 -17
- package/src/modules/library/components/skill-page/SharedViaPlugins.tsx +6 -12
- package/src/modules/library/components/skill-page/SkillFilePane.tsx +5 -0
- package/src/modules/library/components/skill-page/SkillPage.tsx +274 -122
- package/src/modules/library/components/tool-page/DeleteToolDialog.tsx +218 -0
- package/src/modules/library/components/tool-page/ToolConnectionSection.tsx +79 -178
- package/src/modules/library/components/tool-page/ToolPage.tsx +106 -16
- package/src/modules/library/components/tool-page/ToolVarRow.tsx +42 -41
- package/src/modules/library/hooks/__tests__/useLibraryData.test.ts +98 -0
- package/src/modules/library/hooks/useLibraryData.ts +92 -19
- package/src/modules/library/routes/LibraryRoutes.tsx +14 -11
- package/src/modules/library/routes/WorkspaceItemRoute.tsx +77 -27
- package/src/modules/library/routes/library-paths.ts +26 -28
- package/src/modules/library/services/library.api.ts +38 -20
- package/src/modules/library/services/plugins.api.ts +69 -8
- package/src/modules/library/services/teams.api.ts +15 -0
- package/src/modules/library/services/tools.api.ts +78 -0
- package/src/modules/library/state/library-data.tsx +170 -32
- package/src/modules/library/utils/personal-plugin.ts +13 -15
- package/src/modules/library/utils/plugin-entries.ts +134 -0
- package/src/modules/library/utils/plugin-summary.ts +75 -9
- package/src/modules/library/utils/status.ts +135 -33
- package/src/modules/onboarding/__tests__/creator-welcome.test.tsx +8 -1
- package/src/modules/onboarding/__tests__/onboarding.test.tsx +853 -760
- package/src/modules/onboarding/agent-clients.ts +55 -23
- package/src/modules/onboarding/components/ConnectAgentPill.tsx +5 -1
- package/src/modules/onboarding/components/WelcomePage.tsx +98 -62
- package/src/modules/pr/services/pr-merge.api.ts +2 -1
- package/src/modules/review/components/MarkdownDiffViewer.tsx +53 -8
- package/src/modules/review/components/ReviewPanel.tsx +15 -17
- package/src/modules/review/components/__tests__/MarkdownDiffViewer.test.tsx +64 -0
- package/src/modules/review/components/__tests__/ReviewPanel.test.tsx +25 -1
- package/src/modules/secrets-vault/components/ConnectToolsPage.tsx +454 -117
- package/src/modules/secrets-vault/components/SecretsPage.tsx +48 -7
- package/src/modules/secrets-vault/components/ToolSecretsPanel.tsx +84 -5
- package/src/modules/secrets-vault/components/__tests__/ConnectToolsPage.test.tsx +425 -0
- package/src/modules/secrets-vault/components/__tests__/SecretsPage.test.tsx +417 -82
- package/src/modules/secrets-vault/components/__tests__/ToolSecretsPanel.test.tsx +105 -0
- package/src/modules/secrets-vault/components/__tests__/connect-lists-what-the-banner-counted.test.tsx +407 -0
- package/src/modules/secrets-vault/probe/SavedKeyProbeResult.tsx +98 -0
- package/src/modules/secrets-vault/probe/__tests__/probe-verdict.test.ts +160 -0
- package/src/modules/secrets-vault/probe/probe-verdict.ts +108 -0
- package/src/modules/secrets-vault/probe/useSavedKeyProbe.ts +228 -0
- package/src/modules/secrets-vault/services/connect.api.ts +36 -5
- package/src/modules/secrets-vault/utils/connect-status.ts +98 -0
- package/src/modules/settings/components/ClaudeConnectionCard.tsx +9 -24
- package/src/modules/settings/components/ClaudeConnectionFields.tsx +23 -0
- package/src/modules/settings/components/DeploymentPage.tsx +10 -30
- package/src/modules/settings/components/MarketplaceSection.tsx +152 -0
- package/src/modules/settings/components/__tests__/DeploymentPage.test.tsx +67 -4
- package/src/modules/settings/components/__tests__/MarketplaceSection.test.tsx +325 -0
- package/src/modules/settings/components/__tests__/SettingsLayout.test.tsx +7 -6
- package/src/modules/settings/services/github-facade.api.ts +23 -0
- package/src/modules/settings/settings-nav-items.tsx +13 -3
- package/src/modules/setup/__tests__/setup.oidc.test.tsx +172 -0
- package/src/modules/setup/__tests__/setup.probe-refusal.test.tsx +123 -0
- package/src/modules/setup/__tests__/setup.test.tsx +497 -4
- package/src/modules/setup/__tests__/useSetupStatus.test.tsx +130 -0
- package/src/modules/setup/components/SetupGate.tsx +16 -16
- package/src/modules/setup/components/SetupScreen.tsx +532 -43
- package/src/modules/setup/hooks/useSetupStatus.ts +93 -0
- package/src/modules/setup/services/setup.api.ts +141 -4
- package/src/modules/setup/utils/__tests__/root-folders.test.ts +72 -0
- package/src/modules/setup/utils/root-folders.ts +46 -0
- package/src/modules/toolbar/assets/claude-setup/01-add-manually.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/02-add-configuration.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/03-connect-account.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/04-pick-instance.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/05-plugins-add.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/06-add-marketplace.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/07-paste-url-sync.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/08-install-plugins.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/09-select-repository.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/10-connector-not-added.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/11-add-custom-connector.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/README.md +68 -0
- package/src/modules/toolbar/components/AgentInstructionsCard.tsx +296 -0
- package/src/modules/toolbar/components/ClaudeMarketplaceCarousel.tsx +107 -0
- package/src/modules/toolbar/components/ClaudeRegistrationSteps.tsx +127 -0
- package/src/modules/toolbar/components/CoworkSetupSteps.tsx +100 -0
- package/src/modules/toolbar/components/ExternalAgentAccessPage.tsx +177 -118
- package/src/modules/toolbar/components/ScreenshotStep.tsx +77 -0
- package/src/modules/toolbar/components/SetupCarousel.tsx +177 -0
- package/src/modules/toolbar/components/__tests__/AgentInstructionsCard.test.tsx +370 -0
- package/src/modules/toolbar/components/__tests__/ExternalAgentAccessPage.test.tsx +542 -42
- package/src/modules/toolbar/components/__tests__/Toolbar.test.tsx +2 -2
- package/src/modules/toolbar/components/__tests__/claude-setup-shots.test.ts +104 -0
- package/src/modules/toolbar/components/claude-connector-slide.tsx +38 -0
- package/src/modules/toolbar/components/claude-setup-shots.ts +167 -0
- package/src/modules/toolbar/components/deployment-address.ts +29 -0
- package/src/modules/toolbar/components/setup-step-parts.tsx +35 -0
- package/src/modules/toolbar/services/__tests__/agent-instructions.api.test.ts +89 -0
- package/src/modules/toolbar/services/agent-instructions.api.ts +167 -0
- package/src/modules/toolbar/services/external-api-keys.api.ts +8 -0
- package/src/modules/workflow/state/ChangeRequestStaleBinder.tsx +43 -0
- package/src/modules/workflow/state/EventBusProvider.tsx +122 -11
- package/src/modules/workflow/state/__tests__/EventBusProvider.storage.test.tsx +87 -0
- package/src/modules/workflow/state/__tests__/EventBusProvider.watch.test.tsx +223 -0
- package/src/modules/workflow/state/event-bus.context.ts +10 -0
- package/src/modules/workspace/__tests__/testFixtures.ts +5 -3
- package/src/modules/workspace/components/FileExplorer.tsx +1295 -191
- package/src/modules/workspace/components/FileRoute.tsx +353 -36
- package/src/modules/workspace/components/FileViewer.tsx +172 -46
- package/src/modules/workspace/components/KbDocumentShell.tsx +50 -6
- package/src/modules/workspace/components/KbPageHeader.tsx +120 -55
- package/src/modules/workspace/components/TreeActionConfirm.tsx +350 -0
- package/src/modules/workspace/components/__tests__/FileExplorer.test.tsx +2533 -129
- package/src/modules/workspace/components/__tests__/FileRoute.test.tsx +731 -18
- package/src/modules/workspace/components/__tests__/FileViewer.test.tsx +381 -12
- package/src/modules/workspace/components/__tests__/KbDocumentShell.test.tsx +39 -0
- package/src/modules/workspace/components/__tests__/KbPageHeader.test.tsx +33 -20
- package/src/modules/workspace/components/renderers/DocxRenderer.tsx +4 -5
- package/src/modules/workspace/components/renderers/DownloadFileButton.tsx +13 -4
- package/src/modules/workspace/components/renderers/EmailRenderer.tsx +4 -3
- package/src/modules/workspace/components/renderers/HtmlRenderer.tsx +8 -14
- package/src/modules/workspace/components/renderers/ImageRenderer.tsx +75 -16
- package/src/modules/workspace/components/renderers/KbImage.tsx +180 -0
- package/src/modules/workspace/components/renderers/KbMarkdownView.tsx +22 -6
- package/src/modules/workspace/components/renderers/MarkdownRenderer.tsx +48 -22
- package/src/modules/workspace/components/renderers/PdfRenderer.tsx +4 -5
- package/src/modules/workspace/components/renderers/PptxRenderer.tsx +4 -3
- package/src/modules/workspace/components/renderers/XlsxRenderer.tsx +4 -3
- package/src/modules/workspace/components/renderers/__tests__/DocxRenderer.test.tsx +12 -0
- package/src/modules/workspace/components/renderers/__tests__/DownloadFileButton.test.tsx +57 -9
- package/src/modules/workspace/components/renderers/__tests__/EmailRenderer.test.tsx +13 -1
- package/src/modules/workspace/components/renderers/__tests__/ImageRenderer.test.tsx +163 -0
- package/src/modules/workspace/components/renderers/__tests__/KbMarkdownView.test.tsx +237 -0
- package/src/modules/workspace/components/renderers/__tests__/MarkdownRenderer.test.tsx +108 -14
- package/src/modules/workspace/components/renderers/__tests__/PptxRenderer.test.tsx +14 -1
- package/src/modules/workspace/components/renderers/__tests__/XlsxRenderer.test.tsx +16 -1
- package/src/modules/workspace/components/renderers/__tests__/rendererSelection.test.tsx +66 -1
- package/src/modules/workspace/components/renderers/index.ts +53 -2
- package/src/modules/workspace/components/renderers/kbMarkdownPipeline.tsx +25 -4
- package/src/modules/workspace/components/renderers/rendererWorkspace.ts +40 -0
- package/src/modules/workspace/hooks/__tests__/useImageRevision.test.tsx +174 -0
- package/src/modules/workspace/hooks/__tests__/useOpenChangeRequests.test.tsx +179 -1
- package/src/modules/workspace/hooks/__tests__/useWorkspaceImageResolver.test.tsx +122 -0
- package/src/modules/workspace/hooks/__tests__/useWorkspaceState.test.tsx +892 -7
- package/src/modules/workspace/hooks/useImageRevision.ts +101 -0
- package/src/modules/workspace/hooks/useMergedWorkspaceTree.ts +22 -3
- package/src/modules/workspace/hooks/useWorkspaceImageResolver.ts +55 -0
- package/src/modules/workspace/hooks/useWorkspaceState.ts +424 -66
- package/src/modules/workspace/routing/__tests__/kb-routes.test.tsx +279 -3
- package/src/modules/workspace/routing/kb-routes.ts +206 -29
- package/src/modules/workspace/services/__tests__/workspace.api.test.ts +134 -1
- package/src/modules/workspace/services/workspace.api.ts +57 -4
- package/src/modules/workspace/state/__tests__/applied-request-clears-pending.test.tsx +343 -0
- package/src/modules/workspace/state/__tests__/upload-lands-where-it-was-dropped.test.tsx +158 -0
- package/src/modules/workspace/state/open-change-requests.tsx +100 -12
- package/src/modules/workspace/state/workspace.context.ts +125 -19
- package/src/modules/workspace/utils/__tests__/file-trace.test.ts +73 -0
- package/src/modules/workspace/utils/__tests__/fileTree.test.ts +220 -6
- package/src/modules/workspace/utils/__tests__/pasteLink.test.ts +76 -0
- package/src/modules/workspace/utils/__tests__/treeConfirm.test.ts +364 -0
- package/src/modules/workspace/utils/__tests__/uploadError.test.ts +35 -0
- package/src/modules/workspace/utils/file-trace.ts +50 -0
- package/src/modules/workspace/utils/fileTree.ts +112 -36
- package/src/modules/workspace/utils/frontmatter.ts +8 -4
- package/src/modules/workspace/utils/pasteLink.ts +90 -0
- package/src/modules/workspace/utils/treeConfirm.ts +338 -0
- package/src/modules/workspace/utils/uploadError.ts +29 -0
- package/src/shared/__tests__/marketplace-url.test.ts +6 -1
- package/src/shared/components/Button.tsx +16 -2
- package/src/shared/components/Dialog.tsx +27 -11
- package/src/shared/components/Menu.tsx +13 -1
- package/src/shared/components/PageShell.tsx +13 -8
- package/src/shared/components/__tests__/primitives.test.tsx +116 -2
- package/src/shared/components/__tests__/useFocusHandoff.test.tsx +192 -0
- package/src/shared/components/index.ts +2 -0
- package/src/shared/components/useDismissableMenu.ts +32 -10
- package/src/shared/components/useFocusHandoff.ts +51 -0
- package/src/shared/components/useLatestRef.ts +28 -0
- package/src/shared/markdown/Markdown.tsx +12 -3
- package/src/shared/markdown/__tests__/escapeSpacesInLinkDestinations.test.ts +39 -0
- package/src/shared/markdown/hrefs.ts +50 -0
- package/src/shared/marketplace-url.ts +33 -5
- package/src/shared/mcp/ChatGptInstallLink.tsx +3 -3
- package/src/shared/mcp/ConnectionInstructions.tsx +38 -27
- package/src/shared/mcp/__tests__/connect-snippets.test.ts +3 -3
- package/src/shared/mcp/connect-snippets.ts +14 -9
- package/src/shared/mcp/index.ts +1 -1
- package/src/shared/theme/__tests__/header-band.test.ts +197 -0
- package/src/shared/theme/header.ts +75 -0
- package/src/shared/theme/measure.ts +7 -4
- package/src/shared/theme/tokens.css +25 -0
- package/src/modules/library/__tests__/PluginsIndexPage.test.tsx +0 -363
- package/src/modules/library/__tests__/PluginsSidebar.locked.test.tsx +0 -97
- package/src/modules/library/components/PluginsIndexPage.tsx +0 -270
- package/src/modules/update-check/__tests__/UpdateBanner.test.tsx +0 -126
- package/src/modules/update-check/components/UpdateBanner.tsx +0 -92
- package/src/modules/update-check/services/update-check.api.ts +0 -24
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
2
|
+
import { render, screen, waitFor, within } from '@testing-library/react';
|
|
3
|
+
import { MemoryRouter } from 'react-router-dom';
|
|
4
|
+
import type { PullRequestSummary } from '@bevel-software/platform-shared';
|
|
5
|
+
|
|
6
|
+
const api = vi.hoisted(() => ({ listPullRequestsForMe: vi.fn() }));
|
|
7
|
+
vi.mock('../../git/services/pr.api', () => ({
|
|
8
|
+
listPullRequestsForMe: api.listPullRequestsForMe,
|
|
9
|
+
}));
|
|
10
|
+
|
|
11
|
+
import { SidebarFrame } from '../components/SidebarFrame';
|
|
12
|
+
import {
|
|
13
|
+
SIDEBAR_DEFAULT_WIDTH,
|
|
14
|
+
SIDEBAR_MIN_WIDTH,
|
|
15
|
+
setSidebarCollapsed,
|
|
16
|
+
setSidebarNarrow,
|
|
17
|
+
setSidebarWidth,
|
|
18
|
+
} from '../state/sidebar';
|
|
19
|
+
import { PluginsSidebar } from '../../library/components/PluginsSidebar';
|
|
20
|
+
import { IntegrationsSetupReminder } from '../../library/components/IntegrationsSetupReminder';
|
|
21
|
+
import { PullRequestsForMe } from '../../git/components/PullRequestsForMe';
|
|
22
|
+
import { GitContext, type GitContextValue } from '../../git/state/git.context';
|
|
23
|
+
import {
|
|
24
|
+
WorkspaceContext,
|
|
25
|
+
type WorkspaceContextValue,
|
|
26
|
+
} from '../../workspace/state/workspace.context';
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The sidebar's bottom-left rows, measured against the tree rows above them,
|
|
30
|
+
* at the two widths the ticket names: the default (212px) and the narrowest
|
|
31
|
+
* the drag handle allows (180px).
|
|
32
|
+
*
|
|
33
|
+
* This is the visual regression test, and it is arithmetic rather than a
|
|
34
|
+
* screenshot because there is no CSS engine here: happy-dom parses the
|
|
35
|
+
* markup and resolves no styles at all, so a pixel read off `getBoundingClientRect`
|
|
36
|
+
* would be zero for every element on the page and would agree with any
|
|
37
|
+
* regression whatsoever. What IS in the DOM is the utility classes, and they
|
|
38
|
+
* carry the measure: `px-2.5` is ten pixels wherever it appears. So the test
|
|
39
|
+
* resolves the spacing utilities on the chain from a row up to the sidebar
|
|
40
|
+
* column and compares the sums — the same number a ruler on the screenshot
|
|
41
|
+
* would give, arrived at from the source of the number.
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
/** Tailwind's spacing scale: one step is 4px, and `[29px]` says what it is. */
|
|
45
|
+
function spacingPx(value: string): number {
|
|
46
|
+
const arbitrary = /^\[(\d+(?:\.\d+)?)px\]$/.exec(value);
|
|
47
|
+
if (arbitrary) return Number(arbitrary[1]);
|
|
48
|
+
return Number(value) * 4;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* How far this element's content sits from the sidebar's left edge: its own
|
|
53
|
+
* left padding plus every ancestor's, up to and including the column that
|
|
54
|
+
* `SidebarFrame` draws (the one carrying the frame's `px-3.5`).
|
|
55
|
+
*/
|
|
56
|
+
function leftInset(el: Element): number {
|
|
57
|
+
let total = 0;
|
|
58
|
+
for (let node: Element | null = el; node; node = node.parentElement) {
|
|
59
|
+
for (const cls of node.classList) {
|
|
60
|
+
const px = /^p([xl])-(.+)$/.exec(cls);
|
|
61
|
+
if (px) total += spacingPx(px[2]!);
|
|
62
|
+
}
|
|
63
|
+
if (node.hasAttribute('data-sidebar-column')) break;
|
|
64
|
+
}
|
|
65
|
+
return total;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Every element from `el` up to the sidebar column that would clip a focus
|
|
70
|
+
* ring drawn on `el` — named rather than counted, so a failure says which one
|
|
71
|
+
* appeared. The column itself is the ceiling: what the frame does above it is
|
|
72
|
+
* the collapse animation's business and predates the footer rows.
|
|
73
|
+
*/
|
|
74
|
+
function clipsBetweenRowAndColumn(el: Element): string[] {
|
|
75
|
+
const found: string[] = [];
|
|
76
|
+
for (let node: Element | null = el; node; node = node.parentElement) {
|
|
77
|
+
if (node.hasAttribute('data-sidebar-column')) break;
|
|
78
|
+
for (const cls of node.classList) {
|
|
79
|
+
if (/^overflow(-[xy])?-(hidden|clip|auto|scroll)$/.test(cls)) found.push(cls);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return found;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** The single spacing utility of a kind on an element, in pixels. */
|
|
86
|
+
function spacingOf(el: Element, prefix: string): number | null {
|
|
87
|
+
for (const cls of el.classList) {
|
|
88
|
+
if (cls.startsWith(`${prefix}-`)) return spacingPx(cls.slice(prefix.length + 1));
|
|
89
|
+
}
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function pr(over: Partial<PullRequestSummary> = {}): PullRequestSummary {
|
|
94
|
+
return {
|
|
95
|
+
number: 32,
|
|
96
|
+
title: 'Restate the enforcement wording so it reads as a rule',
|
|
97
|
+
author: { login: 'bevel-bot' },
|
|
98
|
+
appAuthor: { name: 'Ali Raza' },
|
|
99
|
+
branch: 'ali/wording',
|
|
100
|
+
base: 'main',
|
|
101
|
+
state: 'open',
|
|
102
|
+
createdAt: '2026-07-27T00:00:00.000Z',
|
|
103
|
+
touchedNodePaths: ['Knowledge/Foo.md'],
|
|
104
|
+
review: { approvals: 0, changesRequested: 0, pendingLogins: [] },
|
|
105
|
+
url: 'https://example.com/pr/32',
|
|
106
|
+
...over,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const git = {
|
|
111
|
+
status: { branch: 'main', hasUpstream: true, unmergedFromUpstream: false },
|
|
112
|
+
branches: [],
|
|
113
|
+
availability: 'ready',
|
|
114
|
+
lastError: null,
|
|
115
|
+
refreshStatus: async () => null,
|
|
116
|
+
refreshBranches: async () => {},
|
|
117
|
+
createBranch: async () => {},
|
|
118
|
+
deleteBranch: async () => {},
|
|
119
|
+
pull: async () => {},
|
|
120
|
+
fetchForkBase: async () => null,
|
|
121
|
+
fetchFileHistory: async () => [],
|
|
122
|
+
fetchFileDiff: async () => '',
|
|
123
|
+
fetchFileAtChange: async () => ({ baseline: null, current: null }),
|
|
124
|
+
fetchFileComparison: async () => '',
|
|
125
|
+
} as unknown as GitContextValue;
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* The Library sidebar as it is actually composed: the nav in the frame, the
|
|
129
|
+
* setup reminder and the change-request dock in the frame's footer slot —
|
|
130
|
+
* the arrangement `LibraryLayout` builds.
|
|
131
|
+
*/
|
|
132
|
+
async function renderSidebarAt(width: number) {
|
|
133
|
+
setSidebarWidth(width);
|
|
134
|
+
const view = render(
|
|
135
|
+
<MemoryRouter>
|
|
136
|
+
<WorkspaceContext.Provider
|
|
137
|
+
value={{ kbDirName: 'knowledge-base' } as unknown as WorkspaceContextValue}
|
|
138
|
+
>
|
|
139
|
+
<GitContext.Provider value={git}>
|
|
140
|
+
<SidebarFrame
|
|
141
|
+
label="Library navigation"
|
|
142
|
+
footer={
|
|
143
|
+
<>
|
|
144
|
+
<IntegrationsSetupReminder count={2} onFinishSetup={() => {}} />
|
|
145
|
+
<PullRequestsForMe />
|
|
146
|
+
</>
|
|
147
|
+
}
|
|
148
|
+
>
|
|
149
|
+
<PluginsSidebar
|
|
150
|
+
filter={{ kind: 'all' }}
|
|
151
|
+
onSelect={() => {}}
|
|
152
|
+
ownedCount={2}
|
|
153
|
+
ownedAttention={0}
|
|
154
|
+
teams={[{ name: 'Engineering', count: 4, urgent: 0 }]}
|
|
155
|
+
onCreatePlugin={() => {}}
|
|
156
|
+
/>
|
|
157
|
+
</SidebarFrame>
|
|
158
|
+
</GitContext.Provider>
|
|
159
|
+
</WorkspaceContext.Provider>
|
|
160
|
+
</MemoryRouter>,
|
|
161
|
+
);
|
|
162
|
+
// The dock only exists once the queue has arrived.
|
|
163
|
+
await screen.findByRole('button', { name: 'Change requests for you' });
|
|
164
|
+
return view;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
const treeRow = () => screen.getByRole('button', { name: /^Everything/ });
|
|
168
|
+
const reminder = () => screen.getByRole('button', { name: /setup/ });
|
|
169
|
+
const dockHeader = () => screen.getByRole('button', { name: 'Change requests for you' });
|
|
170
|
+
const request = () => screen.getByRole('button', { name: /Restate the enforcement/ });
|
|
171
|
+
/** Where a request's title actually lands — the row's inset plus its indent. */
|
|
172
|
+
const requestText = () => screen.getByText('Restate the enforcement wording so it reads as a rule');
|
|
173
|
+
|
|
174
|
+
beforeEach(() => {
|
|
175
|
+
api.listPullRequestsForMe.mockReset();
|
|
176
|
+
api.listPullRequestsForMe.mockResolvedValue([
|
|
177
|
+
pr({ number: 32 }),
|
|
178
|
+
pr({ number: 41, title: 'Name the folder after what is in it' }),
|
|
179
|
+
]);
|
|
180
|
+
window.localStorage.removeItem('bevel-library-sidebar-view');
|
|
181
|
+
setSidebarNarrow(false);
|
|
182
|
+
setSidebarCollapsed(false);
|
|
183
|
+
setSidebarWidth(SIDEBAR_DEFAULT_WIDTH);
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
describe.each([
|
|
187
|
+
['the default width', SIDEBAR_DEFAULT_WIDTH],
|
|
188
|
+
['the narrowest width', SIDEBAR_MIN_WIDTH],
|
|
189
|
+
])('the sidebar footer at %s', (_name, width) => {
|
|
190
|
+
it('puts both footer rows on the tree rows own left inset', async () => {
|
|
191
|
+
await renderSidebarAt(width);
|
|
192
|
+
|
|
193
|
+
const tree = leftInset(treeRow());
|
|
194
|
+
// 14px of column padding + the 10px row inset. Stated as a number as
|
|
195
|
+
// well as a comparison: if the grid itself moves, the comparison alone
|
|
196
|
+
// would still pass with all three rows wrong together.
|
|
197
|
+
expect(tree).toBe(24);
|
|
198
|
+
expect(leftInset(reminder())).toBe(tree);
|
|
199
|
+
expect(leftInset(dockHeader())).toBe(tree);
|
|
200
|
+
// A request is a CHILD of that row, indented by the caret slot (12px)
|
|
201
|
+
// and its gap (7px) so it starts under the word "Change". Measured from
|
|
202
|
+
// its TEXT rather than its row: the row sits on the shared inset like
|
|
203
|
+
// every other row, and the indent is inside it.
|
|
204
|
+
expect(leftInset(requestText())).toBe(tree + 19);
|
|
205
|
+
expect(leftInset(request())).toBe(tree);
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
it('separates the two rows by one gap, owned by the frame', async () => {
|
|
209
|
+
const { container } = await renderSidebarAt(width);
|
|
210
|
+
const group = container.querySelector('[data-sidebar-footer]') as HTMLElement;
|
|
211
|
+
|
|
212
|
+
expect(group).toContainElement(reminder());
|
|
213
|
+
expect(group).toContainElement(dockHeader());
|
|
214
|
+
// One gap for the group, and one rule above it, at a fixed distance from
|
|
215
|
+
// the tree. Each row bringing its own was the reported bug: two hairlines
|
|
216
|
+
// with nothing between them.
|
|
217
|
+
expect(spacingOf(group, 'gap')).toBe(6);
|
|
218
|
+
expect(spacingOf(group, 'mt')).toBe(8);
|
|
219
|
+
expect(spacingOf(group, 'pt')).toBe(8);
|
|
220
|
+
expect(group).toHaveClass('border-t');
|
|
221
|
+
for (const row of [reminder(), dockHeader().parentElement!]) {
|
|
222
|
+
expect(row.className).not.toMatch(/\bborder-t\b|\bmt-\d/);
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
it('keeps the count on the CHANGE REQUESTS row hard against the right edge', async () => {
|
|
227
|
+
await renderSidebarAt(width);
|
|
228
|
+
const header = dockHeader();
|
|
229
|
+
const count = within(header).getByText('2');
|
|
230
|
+
|
|
231
|
+
expect(header).toHaveClass('flex', 'items-center');
|
|
232
|
+
// Last in the row, and unable to be pushed out of it: the label gives way
|
|
233
|
+
// (`min-w-0 truncate`) and the count does not (`flex-none`).
|
|
234
|
+
expect(header.lastElementChild).toBe(count);
|
|
235
|
+
expect(count).toHaveClass('flex-none');
|
|
236
|
+
expect(screen.getByText('Change requests')).toHaveClass('min-w-0', 'flex-1', 'truncate');
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
it('truncates the reminder to an ellipsis and a tooltip, never the link', async () => {
|
|
240
|
+
await renderSidebarAt(width);
|
|
241
|
+
|
|
242
|
+
expect(screen.getByText('2 integrations need setup.')).toHaveClass('truncate', 'min-w-0');
|
|
243
|
+
expect(screen.getByText('Finish now')).toHaveClass('flex-none');
|
|
244
|
+
expect(screen.getByText('Finish now')).not.toHaveClass('truncate');
|
|
245
|
+
expect(reminder()).toHaveAttribute('title', '2 integrations need setup. Finish now');
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* The hit areas the ticket asks to leave alone. Both footer rows are still
|
|
250
|
+
* whole rows — the button IS the row, the way a tree row's is — and neither
|
|
251
|
+
* has grown a nested control or a new clip between itself and the sidebar's
|
|
252
|
+
* column.
|
|
253
|
+
*
|
|
254
|
+
* "Between itself and the column" is the whole claim, and it stops there on
|
|
255
|
+
* purpose. The frame's `<aside>` is `overflow-hidden` and always was: that
|
|
256
|
+
* is what lets the column keep its width and slide out intact while the
|
|
257
|
+
* frame animates to zero, and it clips the tree rows exactly as much as
|
|
258
|
+
* these two. What this PR must not do is add a clip BELOW it, inside the
|
|
259
|
+
* column, where only the footer rows would lose their ring.
|
|
260
|
+
*/
|
|
261
|
+
it('leaves both rows as one focusable control each', async () => {
|
|
262
|
+
await renderSidebarAt(width);
|
|
263
|
+
|
|
264
|
+
for (const row of [reminder(), dockHeader()]) {
|
|
265
|
+
expect(row.tagName).toBe('BUTTON');
|
|
266
|
+
expect(row.querySelector('button, a, [tabindex]')).toBeNull();
|
|
267
|
+
expect(clipsBetweenRowAndColumn(row)).toEqual([]);
|
|
268
|
+
}
|
|
269
|
+
expect(request()).toHaveAttribute('tabindex', '0');
|
|
270
|
+
});
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* The sidebar's own width is the one thing that moves between the two runs
|
|
275
|
+
* above, so it is worth stating that it really did move — otherwise the whole
|
|
276
|
+
* suite could be passing twice at the same width.
|
|
277
|
+
*/
|
|
278
|
+
it('is measured at two genuinely different widths', async () => {
|
|
279
|
+
const { container, unmount } = await renderSidebarAt(SIDEBAR_DEFAULT_WIDTH);
|
|
280
|
+
expect(container.querySelector('aside')).toHaveStyle({ width: '212px' });
|
|
281
|
+
unmount();
|
|
282
|
+
|
|
283
|
+
await waitFor(() => expect(screen.queryByText('Change requests')).toBeNull());
|
|
284
|
+
const narrow = await renderSidebarAt(SIDEBAR_MIN_WIDTH);
|
|
285
|
+
expect(narrow.container.querySelector('aside')).toHaveStyle({ width: '180px' });
|
|
286
|
+
});
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
SIDEBAR_DRAWER_WIDTH,
|
|
6
6
|
SidebarFrame,
|
|
7
7
|
} from '../components/SidebarFrame';
|
|
8
|
+
import { SIDEBAR_HEADER_TESTID } from '../../../shared/theme/header';
|
|
8
9
|
import {
|
|
9
10
|
SIDEBAR_DEFAULT_WIDTH,
|
|
10
11
|
setSidebarCollapsed,
|
|
@@ -59,6 +60,66 @@ beforeEach(() => {
|
|
|
59
60
|
setSidebarWidth(SIDEBAR_DEFAULT_WIDTH);
|
|
60
61
|
});
|
|
61
62
|
|
|
63
|
+
describe('SidebarFrame: slots', () => {
|
|
64
|
+
it('pins the header above and the footer below whatever the surface holds, inside the one nav column', () => {
|
|
65
|
+
const { container } = render(
|
|
66
|
+
<SidebarFrame label="Library plugins" header={<div>pill</div>} footer={<div>dock</div>}>
|
|
67
|
+
<button type="button">Engineering</button>
|
|
68
|
+
</SidebarFrame>,
|
|
69
|
+
);
|
|
70
|
+
const aside = container.querySelector('aside') as HTMLElement;
|
|
71
|
+
const pill = screen.getByText('pill');
|
|
72
|
+
const row = screen.getByRole('button', { name: 'Engineering' });
|
|
73
|
+
const dock = screen.getByText('dock');
|
|
74
|
+
expect(aside).toContainElement(pill);
|
|
75
|
+
expect(aside).toContainElement(dock);
|
|
76
|
+
// One column, three siblings in it: the header band, the contents, the
|
|
77
|
+
// footer group. Each end slot has exactly one wrapper and for its own
|
|
78
|
+
// reason — the header's is the shared band, the row that has to be the
|
|
79
|
+
// same height as the page's title bar beside it; the footer's is the one
|
|
80
|
+
// slot holding more than one row, so something has to space them. The
|
|
81
|
+
// contents sit between them with no wrapper at all, and all three line up
|
|
82
|
+
// because they are siblings in the same column.
|
|
83
|
+
const band = screen.getByTestId(SIDEBAR_HEADER_TESTID);
|
|
84
|
+
expect(band).toContainElement(pill);
|
|
85
|
+
expect(band.parentElement).toBe(row.parentElement);
|
|
86
|
+
const group = dock.parentElement as HTMLElement;
|
|
87
|
+
expect(group).toHaveAttribute('data-sidebar-footer');
|
|
88
|
+
expect(group.parentElement).toBe(row.parentElement);
|
|
89
|
+
expect(pill.compareDocumentPosition(row) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
|
|
90
|
+
expect(row.compareDocumentPosition(dock) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
it('mounts no footer group for a surface that passes no footer', () => {
|
|
94
|
+
const { container } = render(
|
|
95
|
+
<SidebarFrame label="Settings">
|
|
96
|
+
<button type="button">General</button>
|
|
97
|
+
</SidebarFrame>,
|
|
98
|
+
);
|
|
99
|
+
expect(container.querySelector('[data-sidebar-footer]')).toBeNull();
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Both footer rows decide for themselves whether they have anything to say,
|
|
104
|
+
* and on the ordinary day neither does. The group cannot learn that from
|
|
105
|
+
* React — an element that renders null is still an element — so it is read
|
|
106
|
+
* off the DOM, and `empty:hidden` is what turns "no children" into no rule
|
|
107
|
+
* and no space. Without it every sidebar in the app carries a stray
|
|
108
|
+
* hairline and 16px of dead air at the bottom.
|
|
109
|
+
*/
|
|
110
|
+
it('hides the footer group, rule and all, once its rows render nothing', () => {
|
|
111
|
+
const Nothing = () => null;
|
|
112
|
+
const { container } = render(
|
|
113
|
+
<SidebarFrame label="Library plugins" footer={<Nothing />}>
|
|
114
|
+
<button type="button">Engineering</button>
|
|
115
|
+
</SidebarFrame>,
|
|
116
|
+
);
|
|
117
|
+
const group = container.querySelector('[data-sidebar-footer]') as HTMLElement;
|
|
118
|
+
expect(group).toBeEmptyDOMElement();
|
|
119
|
+
expect(group).toHaveClass('empty:hidden');
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
|
|
62
123
|
describe('SidebarFrame: narrow viewport', () => {
|
|
63
124
|
it('starts collapsed and genuinely removes the sidebar from interaction', () => {
|
|
64
125
|
setViewportWidth(375);
|
|
@@ -23,6 +23,8 @@ interface AppLayoutProps {
|
|
|
23
23
|
* `SidebarFrame`'s `header`.
|
|
24
24
|
*/
|
|
25
25
|
sidebarHeader?: ReactNode;
|
|
26
|
+
/** Pinned below the sidebar's content — see `SidebarFrame`'s `footer`. */
|
|
27
|
+
sidebarFooter?: ReactNode;
|
|
26
28
|
// Legacy named slots, kept as a convenience/compat signature.
|
|
27
29
|
explorer?: ReactNode;
|
|
28
30
|
viewer?: ReactNode;
|
|
@@ -18,6 +18,8 @@ interface MobileChatLayoutProps {
|
|
|
18
18
|
onController?: (controller: LayoutController | null) => void;
|
|
19
19
|
/** Pinned above the explorer contents inside the shared sidebar frame. */
|
|
20
20
|
sidebarHeader?: ReactNode;
|
|
21
|
+
/** Pinned below them — see `SidebarFrame`'s `footer`. */
|
|
22
|
+
sidebarFooter?: ReactNode;
|
|
21
23
|
/**
|
|
22
24
|
* Registry-driven pane list (preferred). This layout is chat-first, so it
|
|
23
25
|
* picks the well-known 'explorer' / 'viewer' / 'chat' panes out of the
|
|
@@ -44,6 +46,7 @@ export function MobileChatLayout({
|
|
|
44
46
|
panes,
|
|
45
47
|
onController,
|
|
46
48
|
sidebarHeader,
|
|
49
|
+
sidebarFooter,
|
|
47
50
|
explorer: explorerSlot,
|
|
48
51
|
viewer: viewerSlot,
|
|
49
52
|
chat: chatSlot,
|
|
@@ -114,7 +117,7 @@ export function MobileChatLayout({
|
|
|
114
117
|
</div>
|
|
115
118
|
</div>
|
|
116
119
|
|
|
117
|
-
<SidebarFrame label="File explorer" header={sidebarHeader}>
|
|
120
|
+
<SidebarFrame label="File explorer" header={sidebarHeader} footer={sidebarFooter}>
|
|
118
121
|
{explorer}
|
|
119
122
|
</SidebarFrame>
|
|
120
123
|
|
|
@@ -53,6 +53,8 @@ interface ResizableThreePaneLayoutProps {
|
|
|
53
53
|
* see `SidebarFrame`'s `header`.
|
|
54
54
|
*/
|
|
55
55
|
sidebarHeader?: ReactNode;
|
|
56
|
+
/** Pinned below the sidebar pane's own content — see `SidebarFrame`'s `footer`. */
|
|
57
|
+
sidebarFooter?: ReactNode;
|
|
56
58
|
// Legacy named slots, kept as a convenience/compat signature (converted to
|
|
57
59
|
// the same pane list internally with the historical sizing defaults).
|
|
58
60
|
explorer?: ReactNode;
|
|
@@ -65,6 +67,7 @@ export function ResizableThreePaneLayout({
|
|
|
65
67
|
panes,
|
|
66
68
|
onController,
|
|
67
69
|
sidebarHeader,
|
|
70
|
+
sidebarFooter,
|
|
68
71
|
explorer,
|
|
69
72
|
viewer,
|
|
70
73
|
chat,
|
|
@@ -199,7 +202,7 @@ export function ResizableThreePaneLayout({
|
|
|
199
202
|
{header}
|
|
200
203
|
<div className="flex flex-1 min-h-0">
|
|
201
204
|
{sidebarPane && (
|
|
202
|
-
<SidebarFrame label="File explorer" header={sidebarHeader}>
|
|
205
|
+
<SidebarFrame label="File explorer" header={sidebarHeader} footer={sidebarFooter}>
|
|
203
206
|
{sidebarPane.node}
|
|
204
207
|
</SidebarFrame>
|
|
205
208
|
)}
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
import { useMediaQuery } from '../hooks/useMediaQuery';
|
|
14
14
|
import { NARROW_QUERY } from '../breakpoints';
|
|
15
15
|
import { useModalLayer } from '../../../shared/components/useModalLayer';
|
|
16
|
+
import { HEADER_BAND, HEADER_COLUMN_TOP, SIDEBAR_HEADER_TESTID } from '../../../shared/theme/header';
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
19
|
* The `aria-controls` target for the top bar's toggle, which renders in a
|
|
@@ -29,6 +30,61 @@ export const SIDEBAR_DRAWER_MAX_WIDTH = '24rem';
|
|
|
29
30
|
const FOCUSABLE_SELECTOR =
|
|
30
31
|
'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
31
32
|
|
|
33
|
+
/**
|
|
34
|
+
* The sidebar's ROW GRID — the horizontal inset every row in this column sits
|
|
35
|
+
* on, the tree rows above and the footer rows below alike (proto:684-693,
|
|
36
|
+
* `FileExplorer`'s `ROW_CLASS`, `PluginsSidebar`'s `rowClass`).
|
|
37
|
+
*
|
|
38
|
+
* Exported because "the same inset" only holds if it is ONE declaration. It
|
|
39
|
+
* was several, and the two rows at the bottom of the column drifted off it —
|
|
40
|
+
* the change-request dock sat 4px right of the tree it hangs under, which is
|
|
41
|
+
* the sort of thing nobody can name and everybody can see.
|
|
42
|
+
*/
|
|
43
|
+
export const SIDEBAR_ROW_INSET = 'px-2.5';
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* How far a change request's content sits inside its row, so that it starts
|
|
47
|
+
* under the word "Change" in the CHANGE REQUESTS header above it: that row's
|
|
48
|
+
* own caret slot (`w-3`, 12px) plus its own gap (`gap-[7px]`), both in
|
|
49
|
+
* `git/components/PullRequestsForMe`. The two numbers are the header's, and
|
|
50
|
+
* this constant is only correct for children of THAT row — a parent with a
|
|
51
|
+
* different caret would need its own.
|
|
52
|
+
*
|
|
53
|
+
* It is emphatically NOT the tree's indent. `FileExplorer` spends a wider
|
|
54
|
+
* caret (`w-3.5`) and a narrower gap (`gap-1.5`), and steps its children by
|
|
55
|
+
* `10 + depth * 13` (proto:3561), which is a depth ladder rather than an
|
|
56
|
+
* alignment — a file there does not start under its folder's name and is not
|
|
57
|
+
* trying to. Only the horizontal INSET (`SIDEBAR_ROW_INSET`) is shared by
|
|
58
|
+
* both; what a row does inside that inset is its own.
|
|
59
|
+
*
|
|
60
|
+
* An indent INSIDE the row, deliberately, rather than a larger inset written
|
|
61
|
+
* instead of it. The row still carries `SIDEBAR_ROW_INSET` and so still moves
|
|
62
|
+
* with the grid — whereas one value holding the inset and the indent added
|
|
63
|
+
* together would keep its own counsel the day the inset changes, and the
|
|
64
|
+
* child rows would drift off the header that moved without them. It also
|
|
65
|
+
* keeps the row spanning the full column, hover and focus ring included.
|
|
66
|
+
*/
|
|
67
|
+
export const SIDEBAR_CHILD_INDENT = 'pl-[19px]';
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* The footer group's geometry: one hairline off whatever the surface was
|
|
71
|
+
* holding, then its rows on the sidebar's own vertical rhythm.
|
|
72
|
+
*
|
|
73
|
+
* It lives HERE rather than on the rows because nowhere else knows all of
|
|
74
|
+
* them. The rows arrive through the `footer` slot from different modules —
|
|
75
|
+
* the Library's setup reminder, the change-request dock — and each bringing a
|
|
76
|
+
* margin and a border of its own is precisely how they ended up pressed
|
|
77
|
+
* together under two hairlines with no gap between them.
|
|
78
|
+
*
|
|
79
|
+
* `empty:hidden` is load-bearing. Both rows decide for THEMSELVES whether
|
|
80
|
+
* they have anything to say (nothing needs setup; nothing is waiting on you),
|
|
81
|
+
* and on the ordinary day both render nothing. React cannot tell the slot
|
|
82
|
+
* that — an element that renders null is still an element — so the emptiness
|
|
83
|
+
* is read off the DOM instead: no children, no rule, no space.
|
|
84
|
+
*/
|
|
85
|
+
const SIDEBAR_FOOTER_SLOT =
|
|
86
|
+
'mt-2 flex flex-none flex-col gap-1.5 border-t border-line pt-2 empty:hidden';
|
|
87
|
+
|
|
32
88
|
/**
|
|
33
89
|
* The app's nav spine — the prototype's `.side` + `.resizer` + `.side-inner`
|
|
34
90
|
* (proto:85-104, proto:4328-4370).
|
|
@@ -55,6 +111,7 @@ export function SidebarFrame({
|
|
|
55
111
|
children,
|
|
56
112
|
label,
|
|
57
113
|
header,
|
|
114
|
+
footer,
|
|
58
115
|
}: {
|
|
59
116
|
children: ReactNode;
|
|
60
117
|
/** Names the region and its resize handle, e.g. `Library navigation`. */
|
|
@@ -70,6 +127,20 @@ export function SidebarFrame({
|
|
|
70
127
|
* not know that, and the next thing to go there costs no edit here.
|
|
71
128
|
*/
|
|
72
129
|
header?: ReactNode;
|
|
130
|
+
/**
|
|
131
|
+
* Pinned below `children`, outside whatever list the surface is holding —
|
|
132
|
+
* the same slot as `header`, at the other end. Both surfaces pass the
|
|
133
|
+
* change-request dock, which is what makes it one queue in one place
|
|
134
|
+
* across Knowledge and Skills & Tools; the frame does not know that.
|
|
135
|
+
*
|
|
136
|
+
* Unlike `header` this slot is a GROUP: it is the one end of the column
|
|
137
|
+
* that holds more than one thing, so the frame draws the rule above it and
|
|
138
|
+
* spaces whatever is inside it (`SIDEBAR_FOOTER_SLOT`). What the rows must
|
|
139
|
+
* still bring themselves is the inset — `SIDEBAR_ROW_INSET`, on the row
|
|
140
|
+
* rather than on the group, so a row's hover and focus still span the full
|
|
141
|
+
* column the way a tree row's does.
|
|
142
|
+
*/
|
|
143
|
+
footer?: ReactNode;
|
|
73
144
|
}) {
|
|
74
145
|
// `narrow` comes off the store rather than straight off `viewportNarrow`
|
|
75
146
|
// below, because the store is where it lands in the same write as
|
|
@@ -269,16 +340,50 @@ export function SidebarFrame({
|
|
|
269
340
|
}}
|
|
270
341
|
>
|
|
271
342
|
{/* proto:104 — `padding:16px 14px 18px`, and an explicit width so the
|
|
272
|
-
column does not reflow while the frame animates to zero.
|
|
343
|
+
column does not reflow while the frame animates to zero.
|
|
344
|
+
|
|
345
|
+
The prototype's 16px TOP is the one number of the three that did
|
|
346
|
+
not survive: it used to stand in for half of the sidebar header
|
|
347
|
+
row's height, with the slot's own content supplying the rest, and
|
|
348
|
+
a height nobody could name is a height the page beside it could
|
|
349
|
+
not match. `HEADER_COLUMN_TOP` replaces it with 12px — the offset
|
|
350
|
+
the page column already opened on — and the band below is the
|
|
351
|
+
same height on both sides, which is what puts the two rows on one
|
|
352
|
+
line. */}
|
|
273
353
|
<div
|
|
274
|
-
|
|
354
|
+
// Named, because it is where the sidebar's row grid starts: every
|
|
355
|
+
// row's inset is this padding plus its own, and the test that holds
|
|
356
|
+
// the footer rows on that grid needs to know where to stop adding.
|
|
357
|
+
data-sidebar-column
|
|
358
|
+
className={cn('flex h-full flex-col px-3.5 pb-[18px]', HEADER_COLUMN_TOP)}
|
|
275
359
|
style={{
|
|
276
360
|
width: narrow ? SIDEBAR_DRAWER_WIDTH : width,
|
|
277
361
|
maxWidth: narrow ? SIDEBAR_DRAWER_MAX_WIDTH : undefined,
|
|
278
362
|
}}
|
|
279
363
|
>
|
|
280
|
-
{header
|
|
364
|
+
{/* The sidebar's header row, on the shared band — the left half of
|
|
365
|
+
the seam under the toolbar; the page's title bar is the right
|
|
366
|
+
half.
|
|
367
|
+
|
|
368
|
+
Keyed on whether the surface DECLARED a header, not on whether
|
|
369
|
+
that header drew anything. Knowledge and the Library both pass
|
|
370
|
+
the connect-your-agent pill, which renders nothing once
|
|
371
|
+
onboarding is done; if the row went with it, finishing setup
|
|
372
|
+
would pull the nav up by the band's height and leave the page's
|
|
373
|
+
title bar aligned to nothing. Settings passes no header at all
|
|
374
|
+
and gets no band, because it has no title bar on the other side
|
|
375
|
+
of the seam to hold a line with. */}
|
|
376
|
+
{header !== undefined && (
|
|
377
|
+
<div data-testid={SIDEBAR_HEADER_TESTID} className={cn(HEADER_BAND, 'w-full')}>
|
|
378
|
+
{header}
|
|
379
|
+
</div>
|
|
380
|
+
)}
|
|
281
381
|
{children}
|
|
382
|
+
{footer && (
|
|
383
|
+
<div data-sidebar-footer className={SIDEBAR_FOOTER_SLOT}>
|
|
384
|
+
{footer}
|
|
385
|
+
</div>
|
|
386
|
+
)}
|
|
282
387
|
</div>
|
|
283
388
|
</aside>
|
|
284
389
|
|