@bevel-software/platform-core-frontend 0.14.0 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/THIRD-PARTY-NOTICES.md +2 -2
- package/package.json +3 -3
- package/src/core/CoreAppShell.tsx +34 -26
- package/src/core/__tests__/AppChrome.test.tsx +0 -3
- package/src/core/__tests__/bootstrap.test.ts +33 -1
- package/src/core/__tests__/events.test.ts +43 -0
- package/src/core/bootstrap.ts +38 -1
- package/src/core/events.ts +85 -3
- package/src/core/registry.ts +1 -1
- package/src/lib/__tests__/api.test.ts +38 -0
- package/src/lib/__tests__/email.test.ts +44 -0
- package/src/lib/api.ts +19 -2
- package/src/lib/email.ts +37 -1
- package/src/lib/utils.ts +2 -0
- 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 +781 -76
- 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__/plugin-token.test.ts +21 -0
- package/src/modules/access/__tests__/tailwindDeclarations.ts +210 -0
- package/src/modules/access/api.ts +192 -10
- package/src/modules/access/components/ManageAccessDialog.tsx +1337 -570
- 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__/ConnectionKeysPage.test.tsx +266 -0
- 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/ConnectionKeysPage.tsx +269 -0
- package/src/modules/admin/components/DirectoryGroupsPage.tsx +91 -39
- package/src/modules/admin/components/UserAccountsPage.tsx +271 -37
- package/src/modules/admin/components/connection-keys-grouping.ts +43 -0
- package/src/modules/admin/components/group-members-path.ts +32 -0
- package/src/modules/admin/services/connection-keys.api.ts +47 -0
- package/src/modules/admin/services/roles.api.ts +12 -1
- 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/__tests__/GitSyncFailedBanner.test.tsx +65 -1
- package/src/modules/git/components/FileHistoryPanel.tsx +5 -0
- package/src/modules/git/components/GitSyncFailedBanner.tsx +68 -5
- 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 +109 -4
- 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 +104 -99
- package/src/modules/library/__tests__/LinkSkillPanel.test.tsx +136 -0
- package/src/modules/library/__tests__/LockedPluginView.test.tsx +103 -7
- package/src/modules/library/__tests__/NewPluginDialog.test.tsx +18 -8
- 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 +115 -9
- package/src/modules/library/__tests__/PluginJoinRequests.test.tsx +60 -1
- package/src/modules/library/__tests__/PluginPage.test.tsx +453 -7
- package/src/modules/library/__tests__/PluginsSidebar.contextmenu.test.tsx +17 -57
- package/src/modules/library/__tests__/PluginsSidebar.test.tsx +161 -97
- 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 +391 -78
- package/src/modules/library/__tests__/SkillsTree.test.tsx +461 -0
- package/src/modules/library/__tests__/ToolConnectionSection.test.tsx +582 -71
- package/src/modules/library/__tests__/ToolPage.test.tsx +94 -4
- package/src/modules/library/__tests__/WorkspaceItemRoute.test.tsx +279 -21
- 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 +183 -0
- package/src/modules/library/__tests__/library-data.test.ts +7 -0
- package/src/modules/library/__tests__/library-paths.test.ts +75 -0
- package/src/modules/library/__tests__/link-membership.test.ts +129 -0
- 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 +67 -0
- 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/__tests__/useJoinRequests.test.tsx +46 -0
- 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 +107 -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 +149 -34
- package/src/modules/library/components/LibraryLayout.tsx +120 -247
- package/src/modules/library/components/LibraryPage.tsx +172 -39
- package/src/modules/library/components/LinkSkillPanel.tsx +169 -0
- package/src/modules/library/components/LockedPluginView.tsx +63 -35
- package/src/modules/library/components/NameWithBadges.tsx +164 -0
- package/src/modules/library/components/NewPluginDialog.tsx +19 -5
- package/src/modules/library/components/PageActions.tsx +31 -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 +123 -23
- package/src/modules/library/components/PluginExtras.tsx +143 -18
- package/src/modules/library/components/PluginIndexRow.tsx +47 -12
- package/src/modules/library/components/PluginPage.tsx +234 -38
- package/src/modules/library/components/PluginRows.tsx +286 -0
- package/src/modules/library/components/PluginsSidebar.tsx +271 -238
- package/src/modules/library/components/PluginsSidebarMenu.tsx +26 -1
- package/src/modules/library/components/RenamePluginDialog.tsx +136 -0
- package/src/modules/library/components/ShareButton.tsx +17 -0
- package/src/modules/library/components/SkillsTree.tsx +204 -0
- package/src/modules/library/components/StatusDot.tsx +1 -0
- 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 +132 -23
- package/src/modules/library/components/skill-page/SharedViaPlugins.tsx +212 -0
- package/src/modules/library/components/skill-page/SkillFilePane.tsx +5 -0
- package/src/modules/library/components/skill-page/SkillPage.tsx +337 -121
- 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 +116 -17
- 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/useJoinRequests.ts +48 -18
- 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 +229 -82
- package/src/modules/library/routes/library-paths.ts +46 -35
- package/src/modules/library/services/library.api.ts +89 -17
- package/src/modules/library/services/plugins.api.ts +161 -9
- 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 +268 -37
- 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 +102 -0
- package/src/modules/library/utils/status.ts +204 -35
- package/src/modules/onboarding/__tests__/creator-welcome.test.tsx +11 -3
- 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 +154 -0
- package/src/modules/settings/components/ClaudeConnectionFields.tsx +23 -0
- package/src/modules/settings/components/DeploymentPage.tsx +16 -22
- package/src/modules/settings/components/MarketplaceSection.tsx +152 -0
- package/src/modules/settings/components/__tests__/ClaudeConnectionCard.test.tsx +63 -0
- package/src/modules/settings/components/__tests__/DeploymentPage.test.tsx +74 -1
- package/src/modules/settings/components/__tests__/MarketplaceSection.test.tsx +325 -0
- package/src/modules/settings/components/__tests__/SettingsLayout.test.tsx +5 -5
- package/src/modules/settings/services/github-facade.api.ts +66 -0
- package/src/modules/settings/settings-nav-items.tsx +10 -2
- 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 +615 -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 +711 -40
- package/src/modules/setup/hooks/useSetupStatus.ts +93 -0
- package/src/modules/setup/services/setup.api.ts +218 -3
- 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 +395 -124
- 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 +659 -36
- 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 +6 -3
- package/src/modules/workspace/components/FileExplorer.tsx +1527 -367
- package/src/modules/workspace/components/FileRoute.tsx +376 -22
- package/src/modules/workspace/components/FileViewer.tsx +166 -45
- 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 +2473 -129
- package/src/modules/workspace/components/__tests__/FileRoute.test.tsx +768 -16
- package/src/modules/workspace/components/__tests__/FileViewer.test.tsx +332 -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 +89 -0
- package/src/modules/workspace/hooks/useWorkspaceImageResolver.ts +55 -0
- package/src/modules/workspace/hooks/useWorkspaceState.ts +438 -66
- package/src/modules/workspace/routing/__tests__/kb-routes.test.tsx +279 -3
- package/src/modules/workspace/routing/kb-routes.ts +207 -30
- package/src/modules/workspace/services/__tests__/workspace.api.test.ts +57 -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 +130 -16
- package/src/modules/workspace/utils/__tests__/file-trace.test.ts +73 -0
- package/src/modules/workspace/utils/__tests__/fileTree.test.ts +234 -5
- 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 +126 -52
- 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 +59 -0
- package/src/shared/components/Badge.tsx +3 -1
- package/src/shared/components/Banner.tsx +5 -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 +118 -0
- 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 +34 -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 -265
- 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
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { useState, type MouseEvent, type ReactNode } from 'react';
|
|
2
2
|
import { cn } from '../../../lib/utils';
|
|
3
|
+
import { SIDEBAR_ROW_INSET } from '../../layout/components/SidebarFrame';
|
|
3
4
|
import type { LibraryFilter } from '../utils/status';
|
|
4
|
-
import { ChalkArrow } from './plugin-page-parts';
|
|
5
|
-
import { LockGlyph } from './LockGlyph';
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* Where a right-click landed in the nav, and everything the layout needs to
|
|
@@ -22,111 +21,130 @@ export interface SidebarContextTarget {
|
|
|
22
21
|
row: HTMLElement | null;
|
|
23
22
|
}
|
|
24
23
|
|
|
24
|
+
/**
|
|
25
|
+
* The two views of what sits below the lenses: by TEAM (who can use what),
|
|
26
|
+
* or the ADVANCED view — the two roots as they are on disk.
|
|
27
|
+
*/
|
|
28
|
+
export type SidebarView = 'teams' | 'advanced';
|
|
29
|
+
|
|
25
30
|
export interface PluginsSidebarProps {
|
|
26
31
|
/** What the URL has selected, or null on a page with no gallery filter. */
|
|
27
32
|
filter: LibraryFilter | null;
|
|
28
33
|
/** A row was clicked — the layout navigates; the sidebar owns no state. */
|
|
29
34
|
onSelect(filter: LibraryFilter): void;
|
|
30
|
-
/** Readable plugins, with their item count and how many integrations need setup. */
|
|
31
|
-
plugins: { plugin: string; count: number; attention: number }[];
|
|
32
|
-
/**
|
|
33
|
-
* Plugins the caller cannot read, alphabetical. Rendered after a gap, with a
|
|
34
|
-
* lock instead of a count.
|
|
35
|
-
*/
|
|
36
|
-
lockedPlugins: string[];
|
|
37
35
|
ownedCount: number;
|
|
38
36
|
/**
|
|
39
37
|
* How many of the caller's OWN items are waiting on them. Drives the amber
|
|
40
38
|
* badge; when zero the row shows `ownedCount` in grey instead.
|
|
41
39
|
*/
|
|
42
40
|
ownedAttention: number;
|
|
43
|
-
/**
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
41
|
+
/**
|
|
42
|
+
* The teams — groups from the access rules, led by the org-wide `Everyone`
|
|
43
|
+
* entry the server puts first — each with how much of the
|
|
44
|
+
* catalog it can use, and how many of its plugins' links lock its members
|
|
45
|
+
* out of a skill right now. Orange wins the count slot: it is other
|
|
46
|
+
* people's problem, and the count is not the news.
|
|
47
|
+
*/
|
|
48
|
+
teams: { name: string; count: number; urgent: number }[];
|
|
50
49
|
/** Start a new plugin. The layout owns the dialog; this is only the intent. */
|
|
51
50
|
onCreatePlugin(): void;
|
|
52
51
|
/**
|
|
53
|
-
* Whether to spell the first plugin out in words,
|
|
54
|
-
* hover-revealed `+` is unchanged for everyone; this is only the
|
|
55
|
-
* mark, and it is an administrator's — see the
|
|
52
|
+
* Whether to spell the first plugin out in words, as a row above the trees.
|
|
53
|
+
* The hover-revealed `+` is unchanged for everyone; this is only the
|
|
54
|
+
* teaching mark, and it is an administrator's — see the row itself below.
|
|
56
55
|
*
|
|
57
56
|
* The caller passes a SETTLED verdict, not just a role: the layout derives
|
|
58
57
|
* it from `workspaceHasNoPlugins`, which stays false while plugin discovery
|
|
59
58
|
* is loading or has failed. Without that, an admin whose plugins were still
|
|
60
59
|
* arriving would briefly read "Create a plugin" over a workspace that has
|
|
61
|
-
* twenty.
|
|
62
|
-
* row may appear), while WHETHER it may appear is the caller's call.
|
|
60
|
+
* twenty.
|
|
63
61
|
*
|
|
64
|
-
* Optional, defaulting to OFF
|
|
65
|
-
* optional on the admin context: this props type is public, and a host
|
|
62
|
+
* Optional, defaulting to OFF: this props type is public, and a host
|
|
66
63
|
* application rendering the nav must stay source-compatible across the
|
|
67
|
-
* upgrade. Omitting it reproduces the nav
|
|
68
|
-
* no written-out CTA at all.
|
|
64
|
+
* upgrade. Omitting it reproduces the nav with no written-out CTA at all.
|
|
69
65
|
*/
|
|
70
66
|
canCreatePlugin?: boolean;
|
|
71
|
-
/**
|
|
72
|
-
* The all-plugins index is showing. Beside `filter` rather than inside it: the
|
|
73
|
-
* index lists PLACES, not a filtered slice of the catalog, so it is not a
|
|
74
|
-
* `LibraryFilter` and pretending otherwise would put a row in the gallery's
|
|
75
|
-
* vocabulary that no gallery can render.
|
|
76
|
-
*/
|
|
77
|
-
pluginsIndexActive: boolean;
|
|
78
|
-
/** Go to the index — the Library's home. */
|
|
79
|
-
onOpenPluginsIndex(): void;
|
|
80
67
|
/**
|
|
81
68
|
* A row — or the nav's empty space — was right-clicked. Like every other
|
|
82
|
-
* handler here this is an INTENT, not a menu: the layout owns the popup
|
|
83
|
-
* because the verbs in it (add to this plugin, manage its access) need the
|
|
84
|
-
* plugin summaries and the workspace, and the sidebar knows neither.
|
|
69
|
+
* handler here this is an INTENT, not a menu: the layout owns the popup.
|
|
85
70
|
*
|
|
86
71
|
* Omitted, the nav does nothing on right-click and the browser's own menu
|
|
87
72
|
* appears — which is the honest default for a view with no actions wired.
|
|
88
73
|
*/
|
|
89
74
|
onContextMenu?(target: SidebarContextTarget): void;
|
|
75
|
+
/**
|
|
76
|
+
* The two roots as file trees, in the Advanced view — the shared `Skills/`
|
|
77
|
+
* root and the `Plugins/` root, exactly as they are on disk. SLOTS rather
|
|
78
|
+
* than components this nav names: each tree reads the workspace and
|
|
79
|
+
* navigates on its own, and the sidebar stays what it is, a pure view of
|
|
80
|
+
* names and counts. Omitted, the view has no trees, which keeps a host
|
|
81
|
+
* rendering the shipped nav source-compatible.
|
|
82
|
+
*/
|
|
83
|
+
skillsTree?: ReactNode;
|
|
84
|
+
pluginsTree?: ReactNode;
|
|
90
85
|
}
|
|
91
86
|
|
|
92
87
|
/**
|
|
93
88
|
* The library's nav spine — the prototype's `.side` + `.nav` (lines 55-95).
|
|
94
89
|
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
90
|
+
* The two LENSES on the whole catalog first — Everything (the Library's
|
|
91
|
+
* home) and Owned by me — then ONE switch between the two views of what is
|
|
92
|
+
* below them:
|
|
93
|
+
*
|
|
94
|
+
* - TEAMS (shown as "Groups") — Everyone first, the org-wide entry the
|
|
95
|
+
* server leads with, then every group from the access rules: a team's
|
|
96
|
+
* page is what being in that group lets a person use. The caller's own
|
|
97
|
+
* space is a plugin, not a group, and has no row here;
|
|
98
|
+
* - ADVANCED — `Skills/` and `Plugins/` as they are on disk.
|
|
99
|
+
*
|
|
100
|
+
* Plugins have no rows of their own here. They are reached through the
|
|
101
|
+
* pages that list them — Everything, a team — and through their folders in
|
|
102
|
+
* the Plugins tree; a nav that listed every plugin beside every team said
|
|
103
|
+
* the same thing twice and grew with the workspace.
|
|
100
104
|
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
105
|
+
* The switch is the one piece of state the nav holds, and it is VIEW state,
|
|
106
|
+
* not selection: which rows are on screen, not which one is current. The
|
|
107
|
+
* URL still owns selection, so the back button, a deep link and the
|
|
108
|
+
* highlighted row can never drift apart — whichever view is showing. The
|
|
109
|
+
* choice is remembered in the browser so a reload lands on the view the
|
|
110
|
+
* person left; the Teams view is the default.
|
|
104
111
|
*
|
|
105
112
|
* This is the CONTENTS only. Being a sidebar — the width, the background, the
|
|
106
113
|
* collapse animation, the drag handle — belongs to `SidebarFrame`, which
|
|
107
114
|
* Knowledge's file tree renders inside too. That is the whole reason the two
|
|
108
115
|
* navs cannot drift: there is one of them, holding a different list.
|
|
116
|
+
*
|
|
117
|
+
* The bottom of the sidebar is not this component's either. The setup
|
|
118
|
+
* reminder that used to close it — "2 integrations need setup. Finish now" —
|
|
119
|
+
* is a FOOTER ROW now (`IntegrationsSetupReminder`), which the layout passes
|
|
120
|
+
* into the frame's `footer` slot beside the change-request dock. A nav that
|
|
121
|
+
* also placed the last row in the column was the reason those two rows
|
|
122
|
+
* disagreed about where the left edge is.
|
|
109
123
|
*/
|
|
110
124
|
export function PluginsSidebar({
|
|
111
125
|
filter,
|
|
112
126
|
onSelect,
|
|
113
|
-
plugins,
|
|
114
|
-
lockedPlugins,
|
|
115
127
|
ownedCount,
|
|
116
128
|
ownedAttention,
|
|
117
|
-
|
|
118
|
-
ungroupedCount,
|
|
119
|
-
attentionCount,
|
|
120
|
-
onFinishSetup,
|
|
129
|
+
teams,
|
|
121
130
|
onCreatePlugin,
|
|
122
131
|
canCreatePlugin = false,
|
|
123
|
-
pluginsIndexActive,
|
|
124
|
-
onOpenPluginsIndex,
|
|
125
132
|
onContextMenu,
|
|
133
|
+
skillsTree,
|
|
134
|
+
pluginsTree,
|
|
126
135
|
}: PluginsSidebarProps) {
|
|
136
|
+
const [view, setView] = useState<SidebarView>(readStoredView);
|
|
137
|
+
const switchView = (next: SidebarView) => {
|
|
138
|
+
setView(next);
|
|
139
|
+
storeView(next);
|
|
140
|
+
};
|
|
141
|
+
|
|
127
142
|
const rowClass = (selected: boolean) =>
|
|
128
143
|
cn(
|
|
129
|
-
'flex items-center justify-between gap-2 rounded-sm
|
|
144
|
+
'flex items-center justify-between gap-2 rounded-sm py-1.5 text-ui transition-colors',
|
|
145
|
+
// The sidebar's row grid, from the frame that owns it — the same inset
|
|
146
|
+
// the footer rows below the tree take.
|
|
147
|
+
SIDEBAR_ROW_INSET,
|
|
130
148
|
selected ? 'bg-hover font-semibold text-ink' : 'text-ink-muted hover:bg-hover hover:text-ink',
|
|
131
149
|
);
|
|
132
150
|
|
|
@@ -135,10 +153,17 @@ export function PluginsSidebar({
|
|
|
135
153
|
* row's OWN target rather than restated at each call site, so a row cannot
|
|
136
154
|
* light up for a filter it does not navigate to.
|
|
137
155
|
*/
|
|
138
|
-
const isCurrent = (target: LibraryFilter) =>
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
:
|
|
156
|
+
const isCurrent = (target: LibraryFilter) => {
|
|
157
|
+
if (!filter) return false;
|
|
158
|
+
switch (target.kind) {
|
|
159
|
+
case 'team':
|
|
160
|
+
return filter.kind === 'team' && filter.group === target.group;
|
|
161
|
+
case 'group':
|
|
162
|
+
return filter.kind === 'group' && filter.plugin === target.plugin;
|
|
163
|
+
default:
|
|
164
|
+
return filter.kind === target.kind;
|
|
165
|
+
}
|
|
166
|
+
};
|
|
142
167
|
|
|
143
168
|
/**
|
|
144
169
|
* Report a right-click upward. `preventDefault` only when somebody is
|
|
@@ -162,10 +187,11 @@ export function PluginsSidebar({
|
|
|
162
187
|
label: string,
|
|
163
188
|
target: LibraryFilter,
|
|
164
189
|
count: number,
|
|
165
|
-
tone: 'count' | 'pending' = 'count',
|
|
190
|
+
tone: 'count' | 'pending' | 'urgent' = 'count',
|
|
166
191
|
) => (
|
|
167
192
|
<button
|
|
168
|
-
|
|
193
|
+
// Keyed by what the row IS (its target), never by what it says.
|
|
194
|
+
key={target.kind === 'team' ? `team:${target.group}` : target.kind}
|
|
169
195
|
type="button"
|
|
170
196
|
aria-current={isCurrent(target)}
|
|
171
197
|
className={rowClass(isCurrent(target))}
|
|
@@ -178,7 +204,11 @@ export function PluginsSidebar({
|
|
|
178
204
|
<span
|
|
179
205
|
className={cn(
|
|
180
206
|
'h-4.5 shrink-0 basis-5.5 rounded-md text-center text-meta leading-[18px] tabular-nums',
|
|
181
|
-
tone === '
|
|
207
|
+
tone === 'urgent'
|
|
208
|
+
? 'bg-urgent-soft font-bold text-urgent'
|
|
209
|
+
: tone === 'pending'
|
|
210
|
+
? 'bg-wait-soft font-bold text-wait'
|
|
211
|
+
: 'text-ink-faint',
|
|
182
212
|
)}
|
|
183
213
|
>
|
|
184
214
|
{count}
|
|
@@ -188,201 +218,204 @@ export function PluginsSidebar({
|
|
|
188
218
|
);
|
|
189
219
|
|
|
190
220
|
/**
|
|
191
|
-
* A
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
*
|
|
195
|
-
*
|
|
196
|
-
* slot so the column of counts stays a column. Never a count (the caller
|
|
197
|
-
* cannot see inside to count anything) and never the amber attention badge
|
|
198
|
-
* (a non-member has nothing to fix). The accessible name carries the state in
|
|
199
|
-
* words, so the glyph itself can stay decorative.
|
|
221
|
+
* A tablist is ONE tab stop: the chosen tab takes focus, the arrows move
|
|
222
|
+
* between the tabs and choose as they go (Home/End to the ends), so a
|
|
223
|
+
* keyboard user is not made to Tab through both views to reach the rows.
|
|
224
|
+
* Roving `tabIndex` is what makes the unchosen tab reachable by arrow and
|
|
225
|
+
* not by Tab.
|
|
200
226
|
*/
|
|
201
|
-
const
|
|
202
|
-
const
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
// place, and `Manage access` is exactly the item an admin locked out of
|
|
214
|
-
// one needs. Which verbs are actually true is the layout's call.
|
|
215
|
-
onContextMenu={(e) => openMenu(e, target, name, e.currentTarget)}
|
|
216
|
-
>
|
|
217
|
-
<span className="truncate">{name}</span>
|
|
218
|
-
<span className="flex h-4.5 shrink-0 basis-5.5 items-center justify-center text-ink-faint">
|
|
219
|
-
<LockGlyph className="size-3" />
|
|
220
|
-
</span>
|
|
221
|
-
</button>
|
|
222
|
-
);
|
|
227
|
+
const onTablistKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {
|
|
228
|
+
const order: SidebarView[] = ['teams', 'advanced'];
|
|
229
|
+
const at = order.indexOf(view);
|
|
230
|
+
let next: SidebarView | null = null;
|
|
231
|
+
if (e.key === 'ArrowRight' || e.key === 'ArrowDown') next = order[(at + 1) % order.length]!;
|
|
232
|
+
else if (e.key === 'ArrowLeft' || e.key === 'ArrowUp') next = order[(at - 1 + order.length) % order.length]!;
|
|
233
|
+
else if (e.key === 'Home') next = order[0]!;
|
|
234
|
+
else if (e.key === 'End') next = order[order.length - 1]!;
|
|
235
|
+
if (next === null) return;
|
|
236
|
+
e.preventDefault();
|
|
237
|
+
switchView(next);
|
|
238
|
+
e.currentTarget.querySelector<HTMLElement>(`#library-view-tab-${next}`)?.focus();
|
|
223
239
|
};
|
|
224
240
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
row with no `LibraryFilter` behind it: the index is a list of
|
|
244
|
-
PLACES, not a slice of the catalog. Its menu is therefore the
|
|
245
|
-
nav's own (`filter: null`) — create a plugin, and none of the
|
|
246
|
-
verbs that need a folder to point at. */}
|
|
247
|
-
<button
|
|
248
|
-
type="button"
|
|
249
|
-
aria-current={pluginsIndexActive}
|
|
250
|
-
className={rowClass(pluginsIndexActive)}
|
|
251
|
-
onClick={onOpenPluginsIndex}
|
|
252
|
-
onContextMenu={(e) => openMenu(e, null, 'All plugins', e.currentTarget)}
|
|
253
|
-
>
|
|
254
|
-
<span className="truncate">All plugins</span>
|
|
255
|
-
</button>
|
|
256
|
-
|
|
257
|
-
{/* Lenses — the whole catalog, sliced — which is exactly what the
|
|
258
|
-
plugin rows below are not. Naming the section is what keeps that
|
|
259
|
-
distinction visible. `Everything` is a row again now that the
|
|
260
|
-
Library lands on the plugins index instead: without one it would
|
|
261
|
-
be a page with no way in. */}
|
|
262
|
-
<SectionLabel spaced>Library</SectionLabel>
|
|
263
|
-
{row('Everything', { kind: 'all' }, 0)}
|
|
264
|
-
{/* Amber is a summons, not a total. It shows how many of your own
|
|
265
|
-
items need something FROM YOU; when none do, the slot falls back
|
|
266
|
-
to the plain count of what you own, in grey. A permanent amber 26
|
|
267
|
-
beside "Owned by me" trained the eye to ignore the one colour on
|
|
268
|
-
this page that is supposed to mean "look here". */}
|
|
269
|
-
{row(
|
|
270
|
-
'Owned by me',
|
|
271
|
-
{ kind: 'owned' },
|
|
272
|
-
ownedAttention > 0 ? ownedAttention : ownedCount,
|
|
273
|
-
ownedAttention > 0 ? 'pending' : 'count',
|
|
274
|
-
)}
|
|
275
|
-
<PluginsLabel onCreate={onCreatePlugin} />
|
|
241
|
+
const tab = (id: SidebarView, label: string) => (
|
|
242
|
+
<button
|
|
243
|
+
key={id}
|
|
244
|
+
type="button"
|
|
245
|
+
role="tab"
|
|
246
|
+
id={`library-view-tab-${id}`}
|
|
247
|
+
aria-selected={view === id}
|
|
248
|
+
aria-controls={`library-view-${id}`}
|
|
249
|
+
tabIndex={view === id ? 0 : -1}
|
|
250
|
+
className={cn(
|
|
251
|
+
'flex-1 rounded-sm px-2 py-1 text-center text-meta font-semibold transition-[background-color,color,box-shadow]',
|
|
252
|
+
view === id ? 'bg-surface text-ink shadow-card' : 'text-ink-muted hover:text-ink',
|
|
253
|
+
)}
|
|
254
|
+
onClick={() => switchView(id)}
|
|
255
|
+
>
|
|
256
|
+
{label}
|
|
257
|
+
</button>
|
|
258
|
+
);
|
|
276
259
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
260
|
+
return (
|
|
261
|
+
<nav
|
|
262
|
+
aria-label="Library navigation"
|
|
263
|
+
className="flex min-h-0 flex-1 flex-col gap-px overflow-y-auto"
|
|
264
|
+
// The nav's empty space is a target too — Knowledge's tree gives its
|
|
265
|
+
// ROOT row a menu holding the create verbs, and this is where the
|
|
266
|
+
// Library's equivalent click lands. Rows stop the event before it
|
|
267
|
+
// reaches here, so this only ever fires on the gaps between them.
|
|
268
|
+
onContextMenu={(e) => openMenu(e, null, 'Library', null)}
|
|
269
|
+
>
|
|
270
|
+
{/* The two lenses on the whole catalog, unlabelled and first:
|
|
271
|
+
Everything is where the Library opens, and a destination the
|
|
272
|
+
whole surface hangs off does not sit inside a category. */}
|
|
273
|
+
{row('Everything', { kind: 'all' }, 0)}
|
|
274
|
+
{/* Amber is a summons, not a total. It shows how many of your own
|
|
275
|
+
items need something FROM YOU; when none do, the slot falls back
|
|
276
|
+
to the plain count of what you own, in grey. A permanent amber 26
|
|
277
|
+
beside "Owned by me" trained the eye to ignore the one colour on
|
|
278
|
+
this page that is supposed to mean "look here". */}
|
|
279
|
+
{row(
|
|
280
|
+
'Owned by me',
|
|
281
|
+
{ kind: 'owned' },
|
|
282
|
+
ownedAttention > 0 ? ownedAttention : ownedCount,
|
|
283
|
+
ownedAttention > 0 ? 'pending' : 'count',
|
|
284
|
+
)}
|
|
299
285
|
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
{/* Mirrored, so the tip points up-left at the row's words from
|
|
315
|
-
the room an empty nav is guaranteed to have beneath it. */}
|
|
316
|
-
<ChalkArrow className="pointer-events-none absolute left-[22px] top-[30px] h-[52px] w-[64px] -scale-x-100 text-ink-faint" />
|
|
317
|
-
</div>
|
|
318
|
-
)}
|
|
319
|
-
{/* Locked plugins, after the prototype's 14px `.navgap`. The gap is the
|
|
320
|
-
whole statement: these are in the same list because they are in the
|
|
321
|
-
same workspace, and below a break because you are not in them. */}
|
|
322
|
-
{lockedPlugins.length > 0 && <div className="h-3.5" aria-hidden="true" />}
|
|
323
|
-
{lockedPlugins.map(lockedRow)}
|
|
324
|
-
</nav>
|
|
286
|
+
{/* The switch — a segmented control as quiet as the rows, on the
|
|
287
|
+
nav's own hover tint, the chosen half lifted onto the surface. */}
|
|
288
|
+
<div
|
|
289
|
+
role="tablist"
|
|
290
|
+
aria-label="Sidebar view"
|
|
291
|
+
className="mt-4 mb-2 flex gap-0.5 rounded-md bg-hover p-0.5"
|
|
292
|
+
onKeyDown={onTablistKeyDown}
|
|
293
|
+
// The switch is a control, not empty nav space: a right-click on it
|
|
294
|
+
// is nobody's to answer, so it must not reach the nav behind it.
|
|
295
|
+
onContextMenu={(e) => e.stopPropagation()}
|
|
296
|
+
>
|
|
297
|
+
{tab('teams', 'Groups')}
|
|
298
|
+
{tab('advanced', 'Advanced')}
|
|
299
|
+
</div>
|
|
325
300
|
|
|
326
|
-
|
|
301
|
+
{/* Both panels stay MOUNTED and the inactive one is hidden, not
|
|
302
|
+
dropped: a tab's `aria-controls` always names a panel that exists,
|
|
303
|
+
and the trees keep what a person opened in them (expanded folders,
|
|
304
|
+
a rename in progress) across a switch and back. */}
|
|
305
|
+
<div
|
|
306
|
+
role="tabpanel"
|
|
307
|
+
id="library-view-teams"
|
|
308
|
+
aria-labelledby="library-view-tab-teams"
|
|
309
|
+
hidden={view !== 'teams'}
|
|
310
|
+
className="flex flex-col gap-px"
|
|
311
|
+
>
|
|
312
|
+
{/* Groups only: your own space is not a group — it is reached from
|
|
313
|
+
its row on Everything and its folder in the Plugins tree. */}
|
|
314
|
+
{teams.map(({ name, count, urgent }) =>
|
|
315
|
+
// Orange wins the count slot: members locked out of a skill outrank
|
|
316
|
+
// how much the team can use, which is not the news.
|
|
317
|
+
row(
|
|
318
|
+
name,
|
|
319
|
+
{ kind: 'team', group: name },
|
|
320
|
+
urgent > 0 ? urgent : count,
|
|
321
|
+
urgent > 0 ? 'urgent' : 'count',
|
|
322
|
+
),
|
|
323
|
+
)}
|
|
324
|
+
</div>
|
|
325
|
+
<div
|
|
326
|
+
role="tabpanel"
|
|
327
|
+
id="library-view-advanced"
|
|
328
|
+
aria-labelledby="library-view-tab-advanced"
|
|
329
|
+
hidden={view !== 'advanced'}
|
|
330
|
+
className="flex flex-col gap-px"
|
|
331
|
+
>
|
|
332
|
+
{/* The usual ways to a new plugin are a right-click — on the nav's
|
|
333
|
+
empty space, or on a folder in the Plugins tree — and a person
|
|
334
|
+
with no plugins yet is exactly the person who has not learned
|
|
335
|
+
either. While the workspace holds no plugins AT ALL, the way to
|
|
336
|
+
the first one is said in words, as a row above the trees.
|
|
337
|
+
Words only, no chalk arrow: the `Skills/` and `Plugins/` roots
|
|
338
|
+
render directly beneath this row even when both are empty, so
|
|
339
|
+
there is no empty space for an arrow to come from — it drew
|
|
340
|
+
across the two root rows. (The empty plugin page keeps its
|
|
341
|
+
arrow; it has the room.) Administrators only: on an untouched
|
|
342
|
+
workspace the first plugin is theirs to make, and telling
|
|
343
|
+
everyone else to make it points them at a decision that is not
|
|
344
|
+
theirs. (Everything says the same in its plugin band, for
|
|
345
|
+
whoever never opens this view.) */}
|
|
346
|
+
{canCreatePlugin && (
|
|
327
347
|
<button
|
|
328
348
|
type="button"
|
|
329
|
-
onClick={
|
|
330
|
-
className=
|
|
349
|
+
onClick={onCreatePlugin}
|
|
350
|
+
className={cn(
|
|
351
|
+
'flex items-center gap-2 rounded-sm py-1.5 text-left text-ui text-ink-faint transition-colors hover:bg-hover hover:text-ink',
|
|
352
|
+
SIDEBAR_ROW_INSET,
|
|
353
|
+
)}
|
|
331
354
|
>
|
|
332
|
-
|
|
355
|
+
<span aria-hidden="true">+</span>
|
|
356
|
+
<span className="truncate">Create a plugin</span>
|
|
333
357
|
</button>
|
|
334
358
|
)}
|
|
335
|
-
|
|
359
|
+
{skillsTree}
|
|
360
|
+
{pluginsTree}
|
|
361
|
+
</div>
|
|
362
|
+
</nav>
|
|
336
363
|
);
|
|
337
364
|
}
|
|
338
365
|
|
|
339
366
|
/**
|
|
340
|
-
* The
|
|
341
|
-
* the
|
|
342
|
-
*
|
|
343
|
-
* The heading says what this list IS rather than what its rows are called:
|
|
344
|
-
* these folders are the set mounted into the caller's MCP — the agent's
|
|
345
|
-
* working context — not merely a directory of plugins. (The locked rows that
|
|
346
|
-
* trail the list sit below a gap for exactly that reason: they are in the
|
|
347
|
-
* workspace but not in your MCP, and the break is what keeps the heading
|
|
348
|
-
* honest about them.)
|
|
349
|
-
*
|
|
350
|
-
* `All plugins` is NOT a row here. It heads the whole nav instead: it is the
|
|
351
|
-
* Library's home rather than one more entry in the set mounted into your MCP,
|
|
352
|
-
* and inside this list it used to collect the clicks meant for the plugins
|
|
353
|
-
* under it.
|
|
354
|
-
*
|
|
355
|
-
* The `+` is always in the DOM and always reachable by keyboard; only its
|
|
356
|
-
* opacity follows hover, so the nav stays quiet without the control being
|
|
357
|
-
* conditional. `focus-visible:opacity-100` is what keeps that honest for
|
|
358
|
-
* anyone who never hovers anything.
|
|
367
|
+
* The remembered view. Browser storage is a per-viewer convenience: it can
|
|
368
|
+
* be absent, refused or cleared, and the nav must render either way — so
|
|
369
|
+
* every read and write is guarded and the default is the Teams view.
|
|
359
370
|
*/
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
+
const VIEW_STORAGE_KEY = 'bevel-library-sidebar-view';
|
|
372
|
+
|
|
373
|
+
function readStoredView(): SidebarView {
|
|
374
|
+
try {
|
|
375
|
+
return window.localStorage.getItem(VIEW_STORAGE_KEY) === 'advanced' ? 'advanced' : 'teams';
|
|
376
|
+
} catch {
|
|
377
|
+
return 'teams';
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
function storeView(view: SidebarView): void {
|
|
382
|
+
try {
|
|
383
|
+
window.localStorage.setItem(VIEW_STORAGE_KEY, view);
|
|
384
|
+
} catch {
|
|
385
|
+
// A browser that refuses storage still gets the view for this session.
|
|
386
|
+
}
|
|
371
387
|
}
|
|
372
388
|
|
|
373
|
-
|
|
389
|
+
/**
|
|
390
|
+
* A nav section's name, with an optional row of actions at its right edge.
|
|
391
|
+
* The first one has no top padding — the sidebar's own `pt-6` already placed
|
|
392
|
+
* it — so every label is the same component with its spacing decided by where
|
|
393
|
+
* it sits, not by which one it is.
|
|
394
|
+
*
|
|
395
|
+
* The actions are always in the DOM and always reachable by keyboard; only
|
|
396
|
+
* their opacity follows hover, so the nav stays quiet without the controls
|
|
397
|
+
* being conditional. `focus-within:opacity-100` is what keeps that honest for
|
|
398
|
+
* anyone who never hovers anything.
|
|
399
|
+
*/
|
|
400
|
+
export function SectionLabel({
|
|
401
|
+
children,
|
|
402
|
+
spaced = false,
|
|
403
|
+
actions,
|
|
404
|
+
}: {
|
|
405
|
+
children: ReactNode;
|
|
406
|
+
spaced?: boolean;
|
|
407
|
+
actions?: ReactNode;
|
|
408
|
+
}) {
|
|
374
409
|
return (
|
|
375
|
-
<div
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
+
|
|
385
|
-
</button>
|
|
410
|
+
<div
|
|
411
|
+
className={cn('group/label flex items-center gap-1 pb-1.5', SIDEBAR_ROW_INSET, spaced && 'pt-5')}
|
|
412
|
+
>
|
|
413
|
+
<span className="text-label uppercase text-ink-faint">{children}</span>
|
|
414
|
+
{actions && (
|
|
415
|
+
<span className="ml-auto flex items-center gap-0.5 opacity-0 transition-opacity focus-within:opacity-100 group-hover/label:opacity-100">
|
|
416
|
+
{actions}
|
|
417
|
+
</span>
|
|
418
|
+
)}
|
|
386
419
|
</div>
|
|
387
420
|
);
|
|
388
421
|
}
|