@kabmo-labs/kabmo 0.11.1 → 0.12.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/README.md +67 -421
- package/dist/client/index.html +1 -1
- package/dist/client/index.js +426 -413
- package/dist/client/static/js/{index-amss8pge.js → index-0smc9gm2.js} +1123 -747
- package/dist/client/static/js/index-shexbk5f.css +1 -0
- package/marketplace/marketplace.json +13 -3
- package/marketplace/plugins/command-runner/package.json +4 -2
- package/marketplace/plugins/git-forge/README.md +219 -0
- package/marketplace/plugins/git-forge/icon.svg +20 -0
- package/marketplace/plugins/git-forge/package.json +56 -0
- package/marketplace/plugins/git-forge/src/app.tsx +82 -0
- package/marketplace/plugins/git-forge/src/command.test.ts +181 -0
- package/marketplace/plugins/git-forge/src/command.ts +119 -0
- package/marketplace/plugins/git-forge/src/header.tsx +87 -0
- package/marketplace/plugins/git-forge/src/panel/Badge.tsx +76 -0
- package/marketplace/plugins/git-forge/src/panel/Change.tsx +150 -0
- package/marketplace/plugins/git-forge/src/panel/CiBadge.tsx +51 -0
- package/marketplace/plugins/git-forge/src/panel/Credential.tsx +107 -0
- package/marketplace/plugins/git-forge/src/panel/Glyph.tsx +70 -0
- package/marketplace/plugins/git-forge/src/panel/Header.tsx +255 -0
- package/marketplace/plugins/git-forge/src/panel/ItemView.tsx +198 -0
- package/marketplace/plugins/git-forge/src/panel/List.tsx +89 -0
- package/marketplace/plugins/git-forge/src/panel/Row.tsx +68 -0
- package/marketplace/plugins/git-forge/src/panel/Sidebar.tsx +94 -0
- package/marketplace/plugins/git-forge/src/panel/Write.tsx +236 -0
- package/marketplace/plugins/git-forge/src/panel/format.ts +78 -0
- package/marketplace/plugins/git-forge/src/panel/index.test.tsx +344 -0
- package/marketplace/plugins/git-forge/src/panel/index.tsx +193 -0
- package/marketplace/plugins/git-forge/src/panel/use-forge.ts +250 -0
- package/marketplace/plugins/git-forge/src/panel/write.test.tsx +269 -0
- package/marketplace/plugins/git-forge/src/protocol.ts +308 -0
- package/marketplace/plugins/git-forge/src/server/adapters.test.ts +274 -0
- package/marketplace/plugins/git-forge/src/server/bitbucket.ts +307 -0
- package/marketplace/plugins/git-forge/src/server/capabilities.test.ts +116 -0
- package/marketplace/plugins/git-forge/src/server/capabilities.ts +105 -0
- package/marketplace/plugins/git-forge/src/server/ci.test.ts +88 -0
- package/marketplace/plugins/git-forge/src/server/ci.ts +118 -0
- package/marketplace/plugins/git-forge/src/server/context.ts +76 -0
- package/marketplace/plugins/git-forge/src/server/diff.test.ts +127 -0
- package/marketplace/plugins/git-forge/src/server/diff.ts +120 -0
- package/marketplace/plugins/git-forge/src/server/filters.test.ts +138 -0
- package/marketplace/plugins/git-forge/src/server/filters.ts +138 -0
- package/marketplace/plugins/git-forge/src/server/forges.test.ts +235 -0
- package/marketplace/plugins/git-forge/src/server/gitea.ts +296 -0
- package/marketplace/plugins/git-forge/src/server/github-extras.ts +92 -0
- package/marketplace/plugins/git-forge/src/server/github.ts +320 -0
- package/marketplace/plugins/git-forge/src/server/gitlab-detail.ts +207 -0
- package/marketplace/plugins/git-forge/src/server/gitlab.test.ts +195 -0
- package/marketplace/plugins/git-forge/src/server/gitlab.ts +176 -0
- package/marketplace/plugins/git-forge/src/server/http.test.ts +270 -0
- package/marketplace/plugins/git-forge/src/server/http.ts +329 -0
- package/marketplace/plugins/git-forge/src/server/map.ts +120 -0
- package/marketplace/plugins/git-forge/src/server/registry.ts +47 -0
- package/marketplace/plugins/git-forge/src/server/remote.test.ts +146 -0
- package/marketplace/plugins/git-forge/src/server/remote.ts +188 -0
- package/marketplace/plugins/git-forge/src/server/scope-probe.test.ts +98 -0
- package/marketplace/plugins/git-forge/src/server/scope-probe.ts +128 -0
- package/marketplace/plugins/git-forge/src/server/scope.ts +66 -0
- package/marketplace/plugins/git-forge/src/server/test-context.ts +67 -0
- package/marketplace/plugins/git-forge/src/server/test-host.ts +51 -0
- package/marketplace/plugins/git-forge/src/server/token.test.ts +107 -0
- package/marketplace/plugins/git-forge/src/server/token.ts +139 -0
- package/marketplace/plugins/git-forge/src/server/write-http.test.ts +127 -0
- package/marketplace/plugins/git-forge/src/server/write-http.ts +110 -0
- package/marketplace/plugins/git-forge/src/server/writes.test.ts +218 -0
- package/marketplace/plugins/git-forge/src/server/writes.ts +313 -0
- package/marketplace/plugins/git-forge/src/server.ts +284 -0
- package/marketplace/plugins/git-forge/tsconfig.json +16 -0
- package/marketplace/plugins/session-info/package.json +4 -2
- package/marketplace/plugins/stats/package.json +4 -2
- package/package.json +6 -1
- package/src/client/components/common/code-surface/blame-hover.ts +188 -0
- package/src/client/components/common/code-surface/blame-panel.test.ts +304 -0
- package/src/client/components/common/code-surface/blame-panel.ts +306 -0
- package/src/client/components/common/code-surface/blame.test.ts +303 -0
- package/src/client/components/common/code-surface/blame.ts +227 -0
- package/src/client/components/common/code-surface/conflict-markers.test.ts +135 -0
- package/src/client/components/common/code-surface/conflict-markers.ts +144 -0
- package/src/client/components/common/code-surface/documents.ts +48 -1
- package/src/client/components/common/code-surface/extensions.test.ts +4 -0
- package/src/client/components/common/code-surface/extensions.ts +44 -0
- package/src/client/components/common/code-surface/fold-stack.test.ts +4 -0
- package/src/client/components/common/code-surface/indent.test.ts +5 -0
- package/src/client/components/common/code-surface/index.tsx +16 -2
- package/src/client/components/common/code-surface/lint-parsers.test.ts +109 -0
- package/src/client/components/common/code-surface/lint-parsers.ts +134 -0
- package/src/client/components/common/code-surface/lint.test.ts +101 -0
- package/src/client/components/common/code-surface/lint.ts +85 -0
- package/src/client/components/common/code-surface/props.ts +17 -0
- package/src/client/components/common/code-surface/surface-failures.test.ts +132 -0
- package/src/client/components/common/code-surface/theme.ts +71 -0
- package/src/client/components/common/header-controls/index.test.tsx +1 -1
- package/src/client/components/common/header-controls/plugin-entry.test.tsx +1 -1
- package/src/client/components/common/header-controls/shell-chrome.test.tsx +1 -1
- package/src/client/components/common/provider-icon/Plate.tsx +88 -0
- package/src/client/components/common/provider-icon/index.tsx +55 -11
- package/src/client/components/layout/session-sidebar/SessionsView.tsx +5 -2
- package/src/client/components/mobile/SessionSidebar.tsx +2 -10
- package/src/client/components/mobile/mobile-right-sidebar/FullEditor.tsx +6 -0
- package/src/client/components/mobile/mobile-right-sidebar/StatusBar.tsx +8 -0
- package/src/client/components/settings/categories/AppearanceSettings.tsx +3 -0
- package/src/client/components/settings/categories/ProviderSettings.tsx +43 -41
- package/src/client/components/settings/categories/appearance-settings/EditorBlameSection.tsx +97 -0
- package/src/client/components/settings/categories/panel-plugins/AvailableList.tsx +106 -54
- package/src/client/components/settings/categories/panel-plugins/GitFreshness.tsx +14 -1
- package/src/client/components/settings/categories/panel-plugins/InstalledList.tsx +39 -150
- package/src/client/components/settings/categories/panel-plugins/Meta.test.tsx +143 -0
- package/src/client/components/settings/categories/panel-plugins/Meta.tsx +157 -0
- package/src/client/components/settings/categories/panel-plugins/Placement.test.tsx +149 -0
- package/src/client/components/settings/categories/panel-plugins/Placement.tsx +99 -0
- package/src/client/components/settings/categories/panel-plugins/PluginCard.tsx +270 -0
- package/src/client/components/settings/categories/panel-plugins/Section.tsx +11 -3
- package/src/client/components/settings/categories/provider-settings/AddModelModal.tsx +25 -0
- package/src/client/components/settings/categories/provider-settings/AuthSection.tsx +135 -80
- package/src/client/components/settings/categories/provider-settings/DeleteProviderModal.tsx +51 -21
- package/src/client/components/settings/categories/provider-settings/EntryAdvanced.tsx +175 -0
- package/src/client/components/settings/categories/provider-settings/EntryModal.tsx +275 -0
- package/src/client/components/settings/categories/provider-settings/Header.tsx +40 -9
- package/src/client/components/settings/categories/provider-settings/LoginModal.tsx +142 -160
- package/src/client/components/settings/categories/provider-settings/LogoutProviderModal.tsx +2 -2
- package/src/client/components/settings/categories/provider-settings/ModelCapabilitiesModal.tsx +84 -46
- package/src/client/components/settings/categories/provider-settings/ModelsList.tsx +217 -102
- package/src/client/components/settings/categories/provider-settings/PresetPicker.tsx +5 -2
- package/src/client/components/settings/categories/provider-settings/SidebarList.plugin.test.ts +3 -3
- package/src/client/components/settings/categories/provider-settings/SidebarList.tsx +158 -102
- package/src/client/components/settings/categories/provider-settings/auth-section.test.tsx +135 -0
- package/src/client/components/settings/categories/provider-settings/groups.test.ts +98 -0
- package/src/client/components/settings/categories/provider-settings/groups.ts +108 -0
- package/src/client/components/settings/categories/provider-settings/layout.test.tsx +325 -0
- package/src/client/components/settings/categories/provider-settings/model-dialogs.test.tsx +135 -0
- package/src/client/components/settings/categories/provider-settings/preset-picker.test.tsx +73 -0
- package/src/client/components/settings/categories/usage-settings/ProviderCard.tsx +22 -2
- package/src/client/components/settings/categories/usage-settings/ProviderDetail.tsx +2 -0
- package/src/client/components/settings/categories/usage-settings/SidebarList.tsx +16 -6
- package/src/client/components/settings/categories/usage-settings/providers.ts +3 -0
- package/src/client/components/settings/categories/usage-settings/usage-and-picker.test.ts +19 -0
- package/src/client/components/settings/categories/usage-settings/usage-icons.test.tsx +143 -0
- package/src/client/components/workspace/chat-timeline/MinimapShortcuts.test.ts +2 -1
- package/src/client/components/workspace/chat-timeline/chat-input/GoalBanner.test.ts +23 -19
- package/src/client/components/workspace/chat-timeline/chat-input/ModeToggles.test.ts +23 -19
- package/src/client/components/workspace/chat-timeline/chat-input/Toolbar.test.ts +20 -18
- package/src/client/components/workspace/chat-timeline/chat-input/compact.test.tsx +19 -6
- package/src/client/components/workspace/chat-timeline/index.tsx +7 -16
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Wait.missing.test.ts +100 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Wait.test.ts +3 -47
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Wait.tsx +8 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/wait-test-util.ts +62 -0
- package/src/client/components/workspace/diff-panel/HunkStepper.tsx +62 -0
- package/src/client/components/workspace/diff-panel/MergeDiffView.tsx +29 -0
- package/src/client/components/workspace/diff-panel/Toolbar.tsx +32 -1
- package/src/client/components/workspace/diff-panel/changes.ts +69 -0
- package/src/client/components/workspace/diff-panel/chunks.ts +85 -0
- package/src/client/components/workspace/diff-panel/index.tsx +21 -1
- package/src/client/components/workspace/diff-panel/merge.test.ts +145 -0
- package/src/client/components/workspace/diff-panel/merge.ts +63 -68
- package/src/client/components/workspace/editor/EditorDropOverlay.tsx +6 -1
- package/src/client/components/workspace/editor/FileDocument.tsx +51 -1
- package/src/client/components/workspace/editor/FilePane.tsx +25 -1
- package/src/client/components/workspace/editor/StatusBar.tsx +19 -0
- package/src/client/components/workspace/editor/Toolbar.tsx +29 -5
- package/src/client/components/workspace/editor/toolbar-clusters.test.ts +86 -0
- package/src/client/components/workspace/editor/toolbar-clusters.tsx +48 -16
- package/src/client/components/workspace/editor/viewers/bytes.ts +16 -0
- package/src/client/components/workspace/git-panel/index.test.ts +46 -1
- package/src/client/components/workspace/git-panel/index.tsx +11 -38
- package/src/client/components/workspace/model-dropdown/Item.plugin.test.ts +66 -0
- package/src/client/components/workspace/model-dropdown/Item.tsx +71 -62
- package/src/client/components/workspace/model-dropdown/Section.tsx +31 -14
- package/src/client/components/workspace/model-dropdown/collapsed.ts +72 -0
- package/src/client/components/workspace/model-dropdown/index.tsx +42 -19
- package/src/client/components/workspace/model-dropdown/refresh.test.tsx +260 -0
- package/src/client/components/workspace/model-dropdown/trigger.test.ts +34 -0
- package/src/client/components/workspace/model-dropdown/use-catalog.ts +13 -2
- package/src/client/components/workspace/usage-panel/ProviderSelect.tsx +19 -3
- package/src/client/hooks/chat/omp/folder-auto-expand.ts +113 -0
- package/src/client/hooks/chat/omp/index.ts +20 -0
- package/src/client/hooks/chat/omp/pending-rows.ts +21 -0
- package/src/client/hooks/chat/omp/pending-sessions.test.ts +16 -1
- package/src/client/hooks/chat/omp/session-sidebar-controller.test.ts +102 -0
- package/src/client/hooks/chat/omp/session-sidebar-controller.ts +21 -1
- package/src/client/hooks/chat/omp/stream.ts +8 -1
- package/src/client/hooks/chat/timeline/index.ts +1 -1
- package/src/client/hooks/chat/timeline/new-chat-open.ts +60 -0
- package/src/client/hooks/editor/blame-settings.ts +67 -0
- package/src/client/hooks/editor/blame.test.ts +272 -0
- package/src/client/hooks/editor/blame.ts +232 -0
- package/src/client/hooks/editor/file-editor-types.ts +23 -0
- package/src/client/hooks/editor/save-file.test.ts +20 -0
- package/src/client/hooks/editor/use-editor-drop.test-util.ts +198 -0
- package/src/client/hooks/editor/use-editor-drop.test.ts +70 -175
- package/src/client/hooks/editor/use-editor-drop.ts +19 -36
- package/src/client/hooks/editor/use-file-editor.ts +7 -1
- package/src/client/hooks/settings/providers/actions.ts +90 -194
- package/src/client/hooks/settings/providers/api.ts +7 -1
- package/src/client/hooks/settings/providers/index.ts +171 -59
- package/src/client/hooks/settings/providers/login.test.ts +79 -0
- package/src/client/hooks/settings/providers/login.ts +276 -0
- package/src/client/hooks/settings/providers/messages.ts +28 -0
- package/src/client/hooks/settings/providers/model-actions.ts +178 -0
- package/src/client/hooks/ui/editor-error-toast.ts +47 -0
- package/src/client/hooks/ui/open-file.ts +7 -0
- package/src/client/hooks/ui/toasts.ts +7 -0
- package/src/client/hooks/workspace/file-tabs.ts +4 -1
- package/src/client/hooks/workspace/folder-expansion.test.ts +62 -0
- package/src/client/hooks/workspace/folder-expansion.ts +33 -0
- package/src/client/hooks/workspace/git-action-outcome.ts +86 -0
- package/src/client/hooks/workspace/git-actions.ts +29 -2
- package/src/client/hooks/workspace/plugin-contributions.test.ts +117 -0
- package/src/client/hooks/workspace/plugin-contributions.ts +146 -0
- package/src/client/lib/editor-errors.test.ts +85 -0
- package/src/client/lib/editor-errors.ts +71 -0
- package/src/client/lib/fs/resolve-open.test.ts +125 -0
- package/src/client/lib/fs/resolve-open.ts +90 -0
- package/src/client/lib/git/action-message.test.ts +82 -0
- package/src/client/lib/git/action-message.ts +160 -0
- package/src/client/lib/launch/device-files.test.ts +160 -0
- package/src/client/lib/launch/device-files.ts +197 -0
- package/src/client/lib/native/open-paths.test.ts +140 -0
- package/src/client/lib/native/open-paths.ts +157 -0
- package/src/client/lib/plugins/bootstrap.test.ts +1 -1
- package/src/client/main.tsx +20 -0
- package/src/server/db.server.test.ts +39 -0
- package/src/server/db.server.ts +21 -2
- package/src/server/lib/db/schema.ts +2 -0
- package/src/server/lib/fs/external-roots.test.ts +100 -0
- package/src/server/lib/fs/external-roots.ts +101 -0
- package/src/server/lib/fs/git-actions-branch.ts +15 -2
- package/src/server/lib/fs/git-actions-shared.ts +24 -0
- package/src/server/lib/fs/git-actions-sync.test.ts +18 -7
- package/src/server/lib/fs/git-actions-worktree.ts +5 -1
- package/src/server/lib/fs/git-blame.test.ts +206 -0
- package/src/server/lib/fs/git-blame.ts +189 -0
- package/src/server/lib/fs/root.ts +14 -0
- package/src/server/lib/http/same-origin.ts +28 -7
- package/src/server/lib/models/catalog.server.ts +230 -0
- package/src/server/lib/models/catalog.test.ts +83 -0
- package/src/server/lib/models/credential-origin.server.ts +108 -0
- package/src/server/lib/models/credential-origin.test.ts +132 -0
- package/src/server/lib/models/provider-icon-fetch.ts +115 -0
- package/src/server/lib/models/provider-icon-parse.test.ts +134 -0
- package/src/server/lib/models/provider-icon-parse.ts +139 -0
- package/src/server/lib/models/provider-icon-store.server.ts +118 -0
- package/src/server/lib/models/provider-icon-store.test.ts +107 -0
- package/src/server/lib/models/provider-icon.server.ts +209 -0
- package/src/server/lib/models/provider-items.server.ts +211 -37
- package/src/server/lib/models/provider-items.test.ts +201 -0
- package/src/server/lib/models/provider-registry.server.test.ts +27 -9
- package/src/server/lib/models/provider-registry.server.ts +160 -67
- package/src/server/lib/models/registry.server.test.ts +3 -3
- package/src/server/lib/models/registry.server.ts +8 -0
- package/src/server/lib/omp/config/definitions.test.ts +5 -4
- package/src/server/lib/omp/config/models-config.ts +42 -0
- package/src/server/lib/omp/config/provider-entry.test.ts +205 -0
- package/src/server/lib/omp/config/provider-entry.ts +197 -0
- package/src/server/lib/omp/config/provider-seeds.ts +10 -0
- package/src/server/lib/omp/core/models-json.ts +69 -0
- package/src/server/lib/omp/session/messages.ts +17 -3
- package/src/server/lib/omp/session/sidebar-data.canonical.test.ts +13 -3
- package/src/server/lib/panels/bundled-catalog.server.ts +7 -0
- package/src/server/lib/panels/catalog-offers.server.ts +68 -0
- package/src/server/lib/panels/git-update.server.test.ts +14 -0
- package/src/server/lib/panels/git-update.server.ts +63 -1
- package/src/server/lib/panels/manifest.test.ts +65 -0
- package/src/server/lib/panels/manifest.ts +55 -1
- package/src/server/lib/panels/offers.server.test.ts +191 -0
- package/src/server/lib/panels/offers.server.ts +108 -0
- package/src/server/lib/panels/registry.server.test.ts +35 -1
- package/src/server/lib/panels/registry.server.ts +51 -142
- package/src/server/lib/panels/scan.server.ts +162 -0
- package/src/server/lib/route-adapter.ts +13 -2
- package/src/server/lib/tray/tray.test.ts +2 -1
- package/src/server/lib/usage/providers.server.ts +4 -1
- package/src/server/routes/chat/session.ts +7 -1
- package/src/server/routes/fs/git-blame-loader.test.ts +146 -0
- package/src/server/routes/fs/git.ts +17 -0
- package/src/server/routes/fs/grant.test.ts +135 -0
- package/src/server/routes/fs/grant.ts +79 -0
- package/src/server/routes/fs/index.ts +2 -0
- package/src/server/routes/fs/scope.ts +34 -17
- package/src/server/routes/omp/login.ts +41 -14
- package/src/server/routes/omp/routes.test.ts +23 -10
- package/src/server/routes/settings/index.ts +8 -0
- package/src/server/routes/settings/provider-entry.ts +108 -0
- package/src/server/routes/settings/provider-icon.ts +99 -0
- package/src/server/routes/settings/provider-model.ts +4 -1
- package/src/server/routes/settings/provider-refresh.ts +87 -0
- package/src/server/routes/settings/providers.ts +31 -2
- package/src/shared/lib/chat/omp/fold.test.ts +34 -0
- package/src/shared/lib/chat/omp/tool-frames.test.ts +20 -0
- package/src/shared/lib/chat/omp/tool-frames.ts +5 -1
- package/src/shared/lib/chat/omp/tool-results.ts +29 -3
- package/src/shared/lib/chat/tool/wait-facts.ts +4 -0
- package/src/shared/lib/fs/git-blame.test.ts +266 -0
- package/src/shared/lib/fs/git-blame.ts +246 -0
- package/src/shared/lib/git/url.ts +18 -0
- package/src/shared/lib/markdown/sanitize.test.ts +57 -0
- package/src/shared/lib/markdown/sanitize.ts +30 -7
- package/src/shared/lib/models/provider/connection.ts +135 -0
- package/src/shared/lib/models/provider/dialect.test.ts +4 -2
- package/src/shared/lib/models/provider/dialect.ts +76 -6
- package/src/shared/lib/models/provider/models.ts +2 -0
- package/src/shared/lib/models/provider/origin.ts +94 -0
- package/src/shared/lib/models/provider/provider-ui.test.ts +7 -0
- package/src/shared/lib/models/server-cache.ts +8 -3
- package/src/shared/lib/omp/session/messages-map-pending.test.ts +110 -0
- package/src/shared/lib/omp/session/messages-map.ts +34 -2
- package/src/shared/lib/omp/session/prewarm-misc.test.ts +7 -90
- package/src/shared/lib/omp/session/prewarm.test.ts +133 -0
- package/src/shared/lib/omp/session/prewarm.ts +23 -1
- package/src/shared/lib/omp/session/wait.test.ts +28 -0
- package/src/shared/lib/omp/session/wait.ts +38 -3
- package/src/shared/lib/panels/slot-labels.test.ts +61 -0
- package/src/shared/lib/panels/slot-labels.ts +133 -0
- package/src/shared/lib/workspace/panel-ids.ts +11 -0
- package/src/shared/types/fs.ts +6 -0
- package/src/shared/types/index.ts +1 -0
- package/src/shared/types/models.ts +12 -0
- package/src/shared/types/panels-registry.ts +277 -0
- package/src/shared/types/panels.ts +46 -213
- package/src/shared/types/settings/provider.ts +58 -0
- package/src/shared/types/settings/usage.ts +10 -0
- package/src/test-support/pristine-globals.ts +7 -0
- package/dist/client/static/js/index-bq6qeayr.css +0 -1
- package/src/client/components/settings/categories/provider-settings/ReconnectModal.tsx +0 -184
|
@@ -3,27 +3,42 @@ import { BookOpen, Download, Loader2, Store } from 'lucide-preact';
|
|
|
3
3
|
import type { PanelCatalogEntry } from '@/shared/types';
|
|
4
4
|
import { PluginMark } from '@/client/components/settings/categories/panel-plugins/PluginMark';
|
|
5
5
|
import { PluginReadmeModal } from '@/client/components/settings/categories/panel-plugins/ReadmeModal';
|
|
6
|
+
import {
|
|
7
|
+
AuthorLine,
|
|
8
|
+
SlotBadges,
|
|
9
|
+
VersionLine,
|
|
10
|
+
} from '@/client/components/settings/categories/panel-plugins/Meta';
|
|
11
|
+
import { declaredContributions } from '@/client/hooks/workspace/plugin-contributions';
|
|
6
12
|
|
|
7
13
|
interface AvailableListProps {
|
|
8
14
|
entries: PanelCatalogEntry[];
|
|
9
15
|
busy: string | null;
|
|
16
|
+
/** Install a store offer, by plugin id. */
|
|
10
17
|
onInstall: (pluginId: string) => Promise<boolean>;
|
|
18
|
+
/** Install a catalog entry that names a git URL, by URL. */
|
|
19
|
+
onInstallUrl: (url: string) => Promise<boolean>;
|
|
11
20
|
}
|
|
12
21
|
|
|
13
22
|
/**
|
|
14
|
-
* What the
|
|
23
|
+
* What the catalogs OFFER, as a grid of cards.
|
|
15
24
|
*
|
|
16
25
|
* A grid rather than a list because the unit here is a plugin, not a field of
|
|
17
|
-
* one: a card has room for the mark, the name, the version and the
|
|
18
|
-
* and the eye scans a store by its marks. A row of stacked text
|
|
19
|
-
* every plugin look alike.
|
|
26
|
+
* one: a card has room for the mark, the name, the version, the author and the
|
|
27
|
+
* description, and the eye scans a store by its marks. A row of stacked text
|
|
28
|
+
* fields made every plugin look alike.
|
|
20
29
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
30
|
+
* TWO sources feed this grid and the card says which, because they behave
|
|
31
|
+
* differently after installing: Kabmo's bundled store (kept current by Kabmo's
|
|
32
|
+
* own update) and a git URL a `marketplace.json` curates (a clone the user
|
|
33
|
+
* owns). Both are one noun to a reader — a plugin that can be installed — so
|
|
34
|
+
* splitting them into two grids would make one catalog look like two.
|
|
35
|
+
*
|
|
36
|
+
* A card cannot ask a plugin what it contributes: its panels exist only once its
|
|
37
|
+
* bundle has loaded, and an offer has no bundle here. What it CAN show is what
|
|
38
|
+
* the manifest declares, drawn in the dashed variant so a claim never reads as
|
|
39
|
+
* a fact.
|
|
25
40
|
*/
|
|
26
|
-
export function AvailableList({ entries, busy, onInstall }: AvailableListProps) {
|
|
41
|
+
export function AvailableList({ entries, busy, onInstall, onInstallUrl }: AvailableListProps) {
|
|
27
42
|
// Which README is open. A card's button is only rendered when the plugin
|
|
28
43
|
// ships one, so a plugin with no README offers no button rather than one that
|
|
29
44
|
// opens an error.
|
|
@@ -35,64 +50,101 @@ export function AvailableList({ entries, busy, onInstall }: AvailableListProps)
|
|
|
35
50
|
<section>
|
|
36
51
|
<header className="flex items-center gap-2 mb-2">
|
|
37
52
|
<Store size={14} className="text-ink/50 flex-shrink-0" />
|
|
38
|
-
<h3 className="text-sm font-medium text-ink">Available
|
|
53
|
+
<h3 className="text-sm font-medium text-ink">Available</h3>
|
|
39
54
|
<span className="ml-auto text-[11px] text-ink/50">
|
|
40
55
|
{entries.length} plugin{entries.length === 1 ? '' : 's'}
|
|
41
56
|
</span>
|
|
42
57
|
</header>
|
|
43
58
|
|
|
44
|
-
<div className="grid gap-3 [grid-template-columns:repeat(auto-fill,minmax(
|
|
45
|
-
{entries.map((entry) =>
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
<div className="grid gap-3 [grid-template-columns:repeat(auto-fill,minmax(240px,1fr))]">
|
|
60
|
+
{entries.map((entry) => {
|
|
61
|
+
// A store offer installs under `install:<id>` and a git offer under the
|
|
62
|
+
// plain `install` label (it is addressed by URL, not by id) — so both
|
|
63
|
+
// spellings are the same "this card is working".
|
|
64
|
+
const installing = busy === 'install' || busy === `install:${entry.pluginId}`;
|
|
65
|
+
const declared = declaredContributions(entry.slots);
|
|
66
|
+
return (
|
|
67
|
+
<article
|
|
68
|
+
key={`${entry.origin}:${entry.pluginId}`}
|
|
69
|
+
className="flex flex-col gap-2 border border-ink/10 rounded-lg p-3 bg-paper hover:border-ink/20 transition-colors"
|
|
70
|
+
>
|
|
71
|
+
<div className="flex items-start gap-2.5">
|
|
72
|
+
<PluginMark name={entry.name} iconUrl={entry.iconUrl} />
|
|
73
|
+
<div className="min-w-0 flex-1">
|
|
74
|
+
<div className="text-xs font-medium text-ink truncate" title={entry.name}>
|
|
75
|
+
{entry.name}
|
|
76
|
+
</div>
|
|
77
|
+
<div className="flex items-center gap-1.5 min-w-0">
|
|
78
|
+
{/* A git offer's catalog name IS its id, so printing both
|
|
79
|
+
would put the same word on two lines. */}
|
|
80
|
+
{entry.pluginId === entry.name ? null : (
|
|
81
|
+
<span className="text-[11px] text-ink/45 font-mono truncate" title={entry.pluginId}>
|
|
82
|
+
{entry.pluginId}
|
|
83
|
+
</span>
|
|
84
|
+
)}
|
|
85
|
+
<VersionLine version={entry.version} />
|
|
86
|
+
</div>
|
|
58
87
|
</div>
|
|
59
88
|
</div>
|
|
60
|
-
<span className="text-[10px] text-ink/40 font-mono flex-shrink-0">v{entry.version}</span>
|
|
61
|
-
</div>
|
|
62
89
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
90
|
+
<div className="flex items-center gap-2 flex-wrap">
|
|
91
|
+
<span
|
|
92
|
+
className="flex items-center gap-1 px-1.5 py-0.5 rounded bg-ink/5 border border-ink/10 text-[10px] text-ink/55"
|
|
93
|
+
title={
|
|
94
|
+
entry.origin === 'git'
|
|
95
|
+
? 'Listed in marketplace.json as a git repository — installing clones it.'
|
|
96
|
+
: 'Shipped inside Kabmo’s own store.'
|
|
97
|
+
}
|
|
98
|
+
>
|
|
99
|
+
{entry.origin === 'git' ? 'Git' : 'Bundled'}
|
|
100
|
+
</span>
|
|
101
|
+
<AuthorLine author={entry.author} />
|
|
102
|
+
</div>
|
|
103
|
+
|
|
104
|
+
{entry.description ? (
|
|
105
|
+
<p className="text-[11px] text-ink/60 leading-relaxed line-clamp-3">{entry.description}</p>
|
|
106
|
+
) : null}
|
|
66
107
|
|
|
67
|
-
|
|
68
|
-
|
|
108
|
+
<SlotBadges items={declared} declared />
|
|
109
|
+
|
|
110
|
+
{entry.origin === 'git' && entry.url ? (
|
|
111
|
+
<p className="text-[10px] font-mono text-ink/40 truncate" title={entry.url}>
|
|
112
|
+
{entry.url}
|
|
113
|
+
</p>
|
|
114
|
+
) : null}
|
|
115
|
+
|
|
116
|
+
<div className="mt-auto flex items-center gap-1.5 pt-1">
|
|
117
|
+
{entry.readmeUrl ? (
|
|
118
|
+
<button
|
|
119
|
+
type="button"
|
|
120
|
+
onClick={() => setReading(entry)}
|
|
121
|
+
title={`Read ${entry.name}'s README`}
|
|
122
|
+
aria-label={`Read ${entry.name}'s README`}
|
|
123
|
+
className="flex items-center gap-1.5 px-2 py-1 text-[11px] rounded border border-ink/15 hover:bg-ink/5 text-ink/70"
|
|
124
|
+
>
|
|
125
|
+
<BookOpen size={12} />
|
|
126
|
+
README
|
|
127
|
+
</button>
|
|
128
|
+
) : null}
|
|
69
129
|
<button
|
|
70
130
|
type="button"
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
131
|
+
disabled={busy !== null}
|
|
132
|
+
onClick={() => {
|
|
133
|
+
// A git offer installs by URL and a store offer by id: the
|
|
134
|
+
// two routes are the two install sources the server has,
|
|
135
|
+
// and picking the wrong one answers "no bundled plugin".
|
|
136
|
+
if (entry.origin === 'git' && entry.url) void onInstallUrl(entry.url);
|
|
137
|
+
else void onInstall(entry.pluginId);
|
|
138
|
+
}}
|
|
139
|
+
className="ml-auto flex items-center gap-1 px-2.5 py-1 rounded-lg border border-ink/20 text-[11px] text-ink/70 hover:text-ink hover:border-ink/40 transition-colors disabled:opacity-40"
|
|
75
140
|
>
|
|
76
|
-
<
|
|
77
|
-
|
|
141
|
+
{installing ? <Loader2 size={12} className="animate-spin" /> : <Download size={12} />}
|
|
142
|
+
Install
|
|
78
143
|
</button>
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
disabled={busy !== null}
|
|
84
|
-
className="flex-1 flex items-center justify-center gap-1.5 px-2.5 py-1.5 text-[11px] rounded border border-ink/15 hover:bg-ink/5 disabled:opacity-40"
|
|
85
|
-
>
|
|
86
|
-
{busy === `install:${entry.pluginId}` ? (
|
|
87
|
-
<Loader2 size={12} className="animate-spin" />
|
|
88
|
-
) : (
|
|
89
|
-
<Download size={12} />
|
|
90
|
-
)}
|
|
91
|
-
Install
|
|
92
|
-
</button>
|
|
93
|
-
</div>
|
|
94
|
-
</article>
|
|
95
|
-
))}
|
|
144
|
+
</div>
|
|
145
|
+
</article>
|
|
146
|
+
);
|
|
147
|
+
})}
|
|
96
148
|
</div>
|
|
97
149
|
|
|
98
150
|
{reading?.readmeUrl ? (
|
|
@@ -15,6 +15,11 @@
|
|
|
15
15
|
* The commit SHAs are shortened to seven characters, which is what git itself
|
|
16
16
|
* prints and enough to tell two commits apart by eye; the full value stays in the
|
|
17
17
|
* `title` so a reader can copy it.
|
|
18
|
+
*
|
|
19
|
+
* When the probe could also read the remote's manifest, the newer VERSION is
|
|
20
|
+
* named beside the commit pair. A commit answers "is this behind"; it does not
|
|
21
|
+
* answer "which release is newer", and a card whose every other row carries a
|
|
22
|
+
* version would otherwise leave this one saying `a1b2c3d → d4e5f6a`.
|
|
18
23
|
*/
|
|
19
24
|
|
|
20
25
|
import { ArrowDownToLine, Loader2 } from 'lucide-preact';
|
|
@@ -27,6 +32,8 @@ interface GitFreshnessProps {
|
|
|
27
32
|
busy: string | null;
|
|
28
33
|
pluginId: string;
|
|
29
34
|
onUpdate: (pluginId: string) => Promise<boolean>;
|
|
35
|
+
/** The version the remote's manifest declares, when the probe read it. */
|
|
36
|
+
latestVersion?: string | undefined;
|
|
30
37
|
}
|
|
31
38
|
|
|
32
39
|
/** `a1b2c3d4e5` → `a1b2c3d`, the abbreviation git itself uses. */
|
|
@@ -34,7 +41,7 @@ function shortSha(sha: string | null): string {
|
|
|
34
41
|
return sha ? sha.slice(0, 7) : '?';
|
|
35
42
|
}
|
|
36
43
|
|
|
37
|
-
export function GitFreshness({ status, origin, busy, pluginId, onUpdate }: GitFreshnessProps) {
|
|
44
|
+
export function GitFreshness({ status, origin, busy, pluginId, onUpdate, latestVersion }: GitFreshnessProps) {
|
|
38
45
|
const updating = busy === `update_git:${pluginId}`;
|
|
39
46
|
|
|
40
47
|
if (!status) {
|
|
@@ -61,11 +68,17 @@ export function GitFreshness({ status, origin, busy, pluginId, onUpdate }: GitFr
|
|
|
61
68
|
);
|
|
62
69
|
}
|
|
63
70
|
|
|
71
|
+
const remote = latestVersion ?? status.latestVersion;
|
|
72
|
+
|
|
64
73
|
return (
|
|
65
74
|
<div className="flex items-center gap-1.5">
|
|
75
|
+
{/* Two elements, not one string: JSX trims the whitespace between a text
|
|
76
|
+
node and an adjacent element, so the version rendered jammed against
|
|
77
|
+
the SHA (`8d026acv1.1.0`). */}
|
|
66
78
|
<span className="text-[10px] text-ink/50 font-mono truncate" title={`${origin}\n${status.current} → ${status.latest}`}>
|
|
67
79
|
{shortSha(status.current)} → {shortSha(status.latest)}
|
|
68
80
|
</span>
|
|
81
|
+
{remote ? <span className="text-[10px] text-warning font-mono flex-shrink-0">v{remote}</span> : null}
|
|
69
82
|
<button
|
|
70
83
|
type="button"
|
|
71
84
|
onClick={() => void onUpdate(pluginId)}
|
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
import { useState } from 'preact/hooks';
|
|
2
|
-
import { BookOpen, Hammer, Loader2 } from 'lucide-preact';
|
|
3
2
|
import type { PanelGitStatus, PanelPluginStatus } from '@/shared/types';
|
|
4
|
-
import {
|
|
5
|
-
import { PluginMark } from '@/client/components/settings/categories/panel-plugins/PluginMark';
|
|
3
|
+
import { PluginCard } from '@/client/components/settings/categories/panel-plugins/PluginCard';
|
|
6
4
|
import { PluginReadmeModal } from '@/client/components/settings/categories/panel-plugins/ReadmeModal';
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
/** The four slots a plugin may fill, in the order a card lists them. */
|
|
12
|
-
const SLOT_ORDER: readonly SlotName[] = ['rightPanel', 'panel', 'headerPanel', 'settingsSection'];
|
|
5
|
+
import type { PluginSlots } from '@/client/lib/plugins/slots';
|
|
6
|
+
import { isNewer } from '@/shared/lib/updates/semver';
|
|
7
|
+
import type { LeftDockHandle } from '@/client/hooks/workspace/left-dock';
|
|
13
8
|
|
|
14
9
|
interface InstalledGridProps {
|
|
15
10
|
plugins: PanelPluginStatus[];
|
|
@@ -22,6 +17,8 @@ interface InstalledGridProps {
|
|
|
22
17
|
/** Installed plugins' READMEs, by plugin id. */
|
|
23
18
|
readmeUrls: Map<string, string | undefined>;
|
|
24
19
|
busy: string | null;
|
|
20
|
+
/** Panel placement, read once here and handed to every card. */
|
|
21
|
+
dock: LeftDockHandle;
|
|
25
22
|
onBuild: (pluginId: string) => Promise<boolean>;
|
|
26
23
|
onRemove: (pluginId: string) => Promise<boolean>;
|
|
27
24
|
onSetEnabled: (pluginId: string, enabled: boolean) => Promise<boolean>;
|
|
@@ -50,6 +47,7 @@ export function InstalledList({
|
|
|
50
47
|
iconUrls,
|
|
51
48
|
readmeUrls,
|
|
52
49
|
busy,
|
|
50
|
+
dock,
|
|
53
51
|
onBuild,
|
|
54
52
|
onRemove,
|
|
55
53
|
onSetEnabled,
|
|
@@ -57,155 +55,46 @@ export function InstalledList({
|
|
|
57
55
|
onUpdateGit,
|
|
58
56
|
}: InstalledGridProps) {
|
|
59
57
|
const [reading, setReading] = useState<PanelPluginStatus | null>(null);
|
|
58
|
+
const enabledCount = plugins.filter((plugin) => plugin.enabled).length;
|
|
59
|
+
// `isNewer`, not `!==`: a clone whose remote is at the SAME version is current,
|
|
60
|
+
// and counting it would announce an update that changes nothing.
|
|
61
|
+
const updates = plugins.filter(
|
|
62
|
+
(plugin) => plugin.latestVersion !== undefined && isNewer(plugin.latestVersion, plugin.version),
|
|
63
|
+
).length;
|
|
60
64
|
|
|
61
65
|
return (
|
|
62
66
|
<section>
|
|
63
67
|
<header className="flex items-center gap-2 mb-2">
|
|
64
68
|
<h3 className="text-sm font-medium text-ink">Installed</h3>
|
|
65
|
-
<span className="
|
|
66
|
-
{
|
|
69
|
+
<span className="text-[11px] text-ink/45">
|
|
70
|
+
{enabledCount}/{plugins.length} enabled
|
|
67
71
|
</span>
|
|
72
|
+
{updates > 0 ? (
|
|
73
|
+
<span className="text-[10px] px-1.5 py-0.5 rounded bg-warning/15 text-warning border border-warning/25">
|
|
74
|
+
{updates} update{updates === 1 ? '' : 's'} available
|
|
75
|
+
</span>
|
|
76
|
+
) : null}
|
|
68
77
|
</header>
|
|
69
78
|
|
|
70
|
-
<div className="grid gap-3 [grid-template-columns:repeat(auto-fill,minmax(
|
|
71
|
-
{plugins.map((plugin) =>
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
<div className={plugin.enabled ? '' : 'opacity-50'}>
|
|
90
|
-
<PluginMark name={plugin.name} iconUrl={iconUrls.get(plugin.pluginId)} />
|
|
91
|
-
</div>
|
|
92
|
-
<div className="min-w-0 flex-1">
|
|
93
|
-
<div className="text-xs font-medium text-ink truncate" title={plugin.name}>
|
|
94
|
-
{plugin.name}
|
|
95
|
-
</div>
|
|
96
|
-
<div className="text-[11px] text-ink/45 font-mono truncate" title={plugin.pluginId}>
|
|
97
|
-
{plugin.pluginId}
|
|
98
|
-
</div>
|
|
99
|
-
</div>
|
|
100
|
-
{/* The switch is the card's primary control, so it sits where a
|
|
101
|
-
card's action belongs rather than in a row of chrome. */}
|
|
102
|
-
<button
|
|
103
|
-
type="button"
|
|
104
|
-
role="switch"
|
|
105
|
-
aria-checked={plugin.enabled}
|
|
106
|
-
aria-label={`${plugin.enabled ? 'Disable' : 'Enable'} ${plugin.name}`}
|
|
107
|
-
disabled={busy !== null}
|
|
108
|
-
onClick={() => void onSetEnabled(panelKey, !plugin.enabled)}
|
|
109
|
-
title={plugin.enabled ? 'Disable — keep the files, remove its buttons' : 'Enable this plugin'}
|
|
110
|
-
className={`relative w-8 h-4 rounded-full transition-colors flex-shrink-0 mt-0.5 disabled:opacity-40 ${
|
|
111
|
-
plugin.enabled ? 'bg-ink/70' : 'bg-ink/20'
|
|
112
|
-
}`}
|
|
113
|
-
>
|
|
114
|
-
{toggling ? (
|
|
115
|
-
<Loader2 size={9} className="absolute inset-0 m-auto animate-spin text-canvas" />
|
|
116
|
-
) : (
|
|
117
|
-
<span
|
|
118
|
-
className={`absolute top-0.5 w-3 h-3 rounded-full bg-canvas transition-all ${
|
|
119
|
-
plugin.enabled ? 'left-[18px]' : 'left-0.5'
|
|
120
|
-
}`}
|
|
121
|
-
/>
|
|
122
|
-
)}
|
|
123
|
-
</button>
|
|
124
|
-
</div>
|
|
125
|
-
|
|
126
|
-
{/* Three distinct states, and the difference matters: a plugin
|
|
127
|
-
that is switched off has no components BY DESIGN, one whose
|
|
128
|
-
bundle failed has a reason to show, and one that loaded says
|
|
129
|
-
what it contributes. */}
|
|
130
|
-
{!plugin.enabled ? (
|
|
131
|
-
<p className="text-[11px] text-ink/45">Disabled — contributes nothing while the switch is off.</p>
|
|
132
|
-
) : failure ? (
|
|
133
|
-
<p className="text-[11px] text-error">Bundle failed to load — {failure}</p>
|
|
134
|
-
) : !entry ? (
|
|
135
|
-
<p className="text-[11px] text-ink/45">Loading bundle…</p>
|
|
136
|
-
) : contributed.length === 0 ? (
|
|
137
|
-
<p className="text-[11px] text-ink/45">Loaded, but registers no panels.</p>
|
|
138
|
-
) : (
|
|
139
|
-
<div className="flex flex-wrap items-center gap-1.5">
|
|
140
|
-
{contributed.map((slot) => (
|
|
141
|
-
<span
|
|
142
|
-
key={slot}
|
|
143
|
-
className="text-[10px] font-mono px-1.5 py-0.5 rounded bg-ink/10 text-ink/60"
|
|
144
|
-
title={entry.titles[slot] ?? slot}
|
|
145
|
-
>
|
|
146
|
-
{slot}
|
|
147
|
-
</span>
|
|
148
|
-
))}
|
|
149
|
-
</div>
|
|
150
|
-
)}
|
|
151
|
-
|
|
152
|
-
<div className="mt-auto flex items-center gap-1.5 pt-1">
|
|
153
|
-
{plugin.bundled ? (
|
|
154
|
-
<span className="text-[10px] px-1.5 py-0.5 rounded bg-ink/10 text-ink/50">bundled</span>
|
|
155
|
-
) : null}
|
|
156
|
-
{!plugin.built ? (
|
|
157
|
-
<button
|
|
158
|
-
type="button"
|
|
159
|
-
onClick={() => void onBuild(plugin.pluginId)}
|
|
160
|
-
disabled={busy !== null}
|
|
161
|
-
title={plugin.reason ? `Rebuild — ${plugin.reason}` : 'Rebuild this plugin'}
|
|
162
|
-
className="flex items-center gap-1 px-1.5 py-0.5 text-[10px] rounded border border-warning/40 text-warning hover:bg-warning/10 disabled:opacity-40"
|
|
163
|
-
>
|
|
164
|
-
{busy === `build:${plugin.pluginId}` ? (
|
|
165
|
-
<Loader2 size={11} className="animate-spin" />
|
|
166
|
-
) : (
|
|
167
|
-
<Hammer size={11} />
|
|
168
|
-
)}
|
|
169
|
-
Rebuild
|
|
170
|
-
</button>
|
|
171
|
-
) : null}
|
|
172
|
-
<span className="ml-auto flex items-center gap-1">
|
|
173
|
-
{readmeUrls.get(plugin.pluginId) ? (
|
|
174
|
-
<button
|
|
175
|
-
type="button"
|
|
176
|
-
onClick={() => setReading(plugin)}
|
|
177
|
-
title={`Read ${plugin.name}'s README`}
|
|
178
|
-
aria-label={`Read ${plugin.name}'s README`}
|
|
179
|
-
className="p-1 rounded text-ink/40 hover:text-ink hover:bg-ink/5 flex-shrink-0"
|
|
180
|
-
>
|
|
181
|
-
<BookOpen size={13} />
|
|
182
|
-
</button>
|
|
183
|
-
) : null}
|
|
184
|
-
<RemovePluginButton pluginId={plugin.pluginId} disabled={busy !== null} onRemove={onRemove} />
|
|
185
|
-
</span>
|
|
186
|
-
</div>
|
|
187
|
-
|
|
188
|
-
{!plugin.built ? (
|
|
189
|
-
<p className="text-[11px] text-warning">
|
|
190
|
-
Not built{plugin.reason ? ` — ${plugin.reason}` : ''}. The bundle will 404 until it is built.
|
|
191
|
-
</p>
|
|
192
|
-
) : null}
|
|
193
|
-
|
|
194
|
-
{/* A git-installed plugin's freshness. Rendered for a clone only —
|
|
195
|
-
a bundled install is kept current by Kabmo's own update,
|
|
196
|
-
so a git row there would describe a remote it does not have. */}
|
|
197
|
-
{plugin.gitOrigin ? (
|
|
198
|
-
<GitFreshness
|
|
199
|
-
status={gitStatus[plugin.pluginId]}
|
|
200
|
-
origin={plugin.gitOrigin}
|
|
201
|
-
busy={busy}
|
|
202
|
-
pluginId={plugin.pluginId}
|
|
203
|
-
onUpdate={onUpdateGit}
|
|
204
|
-
/>
|
|
205
|
-
) : null}
|
|
206
|
-
</article>
|
|
207
|
-
);
|
|
208
|
-
})}
|
|
79
|
+
<div className="grid gap-3 [grid-template-columns:repeat(auto-fill,minmax(260px,1fr))]">
|
|
80
|
+
{plugins.map((plugin) => (
|
|
81
|
+
<PluginCard
|
|
82
|
+
key={plugin.pluginId}
|
|
83
|
+
plugin={plugin}
|
|
84
|
+
entry={slots.get(plugin.pluginId)}
|
|
85
|
+
failure={failures.get(plugin.pluginId)}
|
|
86
|
+
iconUrl={iconUrls.get(plugin.pluginId)}
|
|
87
|
+
readmeUrl={readmeUrls.get(plugin.pluginId)}
|
|
88
|
+
busy={busy}
|
|
89
|
+
gitStatus={gitStatus[plugin.pluginId]}
|
|
90
|
+
dock={dock}
|
|
91
|
+
onReadme={() => setReading(plugin)}
|
|
92
|
+
onBuild={onBuild}
|
|
93
|
+
onRemove={onRemove}
|
|
94
|
+
onSetEnabled={onSetEnabled}
|
|
95
|
+
onUpdateGit={onUpdateGit}
|
|
96
|
+
/>
|
|
97
|
+
))}
|
|
209
98
|
</div>
|
|
210
99
|
|
|
211
100
|
{reading && readmeUrls.get(reading.pluginId) ? (
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The four facts every plugin card is built from: version, author, origin and
|
|
8
|
+
* slot badges.
|
|
9
|
+
*
|
|
10
|
+
* Each one has a failure mode that reads as a DIFFERENT true statement, which is
|
|
11
|
+
* why they are pinned separately:
|
|
12
|
+
*
|
|
13
|
+
* - a version pair drawn for an equal version announces an update that changes
|
|
14
|
+
* nothing;
|
|
15
|
+
* - an absent author rendered as nothing reads as a plugin with no author rather
|
|
16
|
+
* than one whose manifest does not say;
|
|
17
|
+
* - an origin badge that guesses makes a clone look like a store install, which
|
|
18
|
+
* is the difference between "Kabmo keeps this current" and "you do";
|
|
19
|
+
* - a declared slot drawn like a live one makes an author's claim read as a
|
|
20
|
+
* registration the host imported.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
import { afterAll, afterEach, beforeAll, describe, expect, test } from 'bun:test';
|
|
24
|
+
import { Window } from 'happy-dom';
|
|
25
|
+
import { h, render } from 'preact';
|
|
26
|
+
import { act } from 'preact/test-utils';
|
|
27
|
+
import {
|
|
28
|
+
AuthorLine,
|
|
29
|
+
OriginBadge,
|
|
30
|
+
SlotBadges,
|
|
31
|
+
VersionLine,
|
|
32
|
+
} from '@/client/components/settings/categories/panel-plugins/Meta';
|
|
33
|
+
import { installDomGlobals, restoreDomGlobals } from '@/test-support/pristine-globals';
|
|
34
|
+
|
|
35
|
+
let container: HTMLElement;
|
|
36
|
+
|
|
37
|
+
beforeAll(() => {
|
|
38
|
+
installDomGlobals(new Window({ url: 'http://localhost' }));
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
afterEach(() => {
|
|
42
|
+
if (container) render(null, container);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
afterAll(() => {
|
|
46
|
+
restoreDomGlobals();
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
/** Mount one element and return the container. */
|
|
50
|
+
function mount(node: h.JSX.Element): HTMLElement {
|
|
51
|
+
container = document.createElement('div');
|
|
52
|
+
document.body.append(container);
|
|
53
|
+
act(() => render(node, container));
|
|
54
|
+
return container;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
describe('VersionLine', () => {
|
|
58
|
+
test('one number when nothing newer is known', () => {
|
|
59
|
+
const el = mount(h(VersionLine, { version: '0.2.0' }));
|
|
60
|
+
expect(el.textContent).toBe('v0.2.0');
|
|
61
|
+
expect(el.textContent).not.toContain('→');
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
test('an equal latest version is not an update', () => {
|
|
65
|
+
// The store publishes the same version the user runs. Drawing a pair here
|
|
66
|
+
// would claim an update that changes nothing.
|
|
67
|
+
const el = mount(h(VersionLine, { version: '0.2.0', latest: '0.2.0' }));
|
|
68
|
+
expect(el.textContent).toBe('v0.2.0');
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
test('names both sides when the source is newer', () => {
|
|
72
|
+
const el = mount(h(VersionLine, { version: '0.2.0', latest: '0.3.0' }));
|
|
73
|
+
expect(el.textContent).toContain('v0.2.0');
|
|
74
|
+
expect(el.textContent).toContain('v0.3.0');
|
|
75
|
+
expect(el.textContent).toContain('→');
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
test('a plugin with no version says so rather than showing "v"', () => {
|
|
79
|
+
expect(mount(h(VersionLine, { version: '' })).textContent).toBe('unversioned');
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
describe('AuthorLine', () => {
|
|
84
|
+
test('an absent author is stated, not silently dropped', () => {
|
|
85
|
+
expect(mount(h(AuthorLine, { author: undefined })).textContent).toBe('author unknown');
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
test('a name with no URL is plain text', () => {
|
|
89
|
+
const el = mount(h(AuthorLine, { author: { name: 'Acme' } }));
|
|
90
|
+
expect(el.textContent).toBe('by Acme');
|
|
91
|
+
expect(el.querySelector('a')).toBeNull();
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
test('a URL makes the credit a link', () => {
|
|
95
|
+
const el = mount(h(AuthorLine, { author: { name: 'Acme', url: 'https://acme.example' } }));
|
|
96
|
+
const link = el.querySelector('a');
|
|
97
|
+
expect(link?.getAttribute('href')).toBe('https://acme.example');
|
|
98
|
+
// An external link opens in a tab and must not hand over the opener.
|
|
99
|
+
expect(link?.getAttribute('rel')).toContain('noreferrer');
|
|
100
|
+
expect(el.textContent).toContain('by Acme');
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
describe('OriginBadge', () => {
|
|
105
|
+
test('each origin names where the code came from and who keeps it current', () => {
|
|
106
|
+
expect(mount(h(OriginBadge, { origin: 'bundled' })).textContent).toBe('Bundled');
|
|
107
|
+
expect(mount(h(OriginBadge, { origin: 'git' })).textContent).toBe('Git');
|
|
108
|
+
expect(mount(h(OriginBadge, { origin: 'local' })).textContent).toBe('Local');
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
test('the detail is in the title, so the distinction is readable without a click', () => {
|
|
112
|
+
const el = mount(h(OriginBadge, { origin: 'git' }));
|
|
113
|
+
expect(el.querySelector('[title]')?.getAttribute('title')).toContain('git clone');
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
describe('SlotBadges', () => {
|
|
118
|
+
const item = { key: 'rightPanel', label: 'Right panel', detail: 'A view in the right column.', kind: 'panel' as const, count: 1 };
|
|
119
|
+
|
|
120
|
+
test('a live registration is a solid badge', () => {
|
|
121
|
+
const el = mount(h(SlotBadges, { items: [item], declared: false }));
|
|
122
|
+
const badge = el.querySelector('span');
|
|
123
|
+
expect(badge?.className).not.toContain('border-dashed');
|
|
124
|
+
expect(badge?.getAttribute('title')).not.toContain('declared');
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
test('a declared-only slot is dashed AND says so in its title', () => {
|
|
128
|
+
// A claim drawn like a fact is the one thing this must not do.
|
|
129
|
+
const el = mount(h(SlotBadges, { items: [item], declared: true }));
|
|
130
|
+
const badge = el.querySelector('span');
|
|
131
|
+
expect(badge?.className).toContain('border-dashed');
|
|
132
|
+
expect(badge?.getAttribute('title')).toContain('declared by the manifest');
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
test('a count above one is shown, so four actions do not look like one', () => {
|
|
136
|
+
const el = mount(h(SlotBadges, { items: [{ ...item, count: 4 }], declared: false }));
|
|
137
|
+
expect(el.textContent).toContain('×4');
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
test('nothing to show renders nothing', () => {
|
|
141
|
+
expect(mount(h(SlotBadges, { items: [], declared: false })).textContent).toBe('');
|
|
142
|
+
});
|
|
143
|
+
});
|