@kabmo-labs/kabmo 0.18.0 → 0.21.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 +43 -13
- package/dist/client/index.html +3 -3
- package/dist/client/index.js +485 -484
- package/dist/client/static/js/index-0721wrkf.css +1 -0
- package/dist/client/static/js/{index-tc09dtca.js → index-zg32n2sk.js} +778 -777
- package/dist/client/static/{manifest-42r8wcmg.webmanifest → manifest-q6h8k9e0.webmanifest} +1 -1
- package/index.html +1 -1
- package/marketplace/plugins/command-runner/package.json +3 -2
- package/marketplace/plugins/git-forge/package.json +3 -2
- package/marketplace/plugins/session-info/package.json +3 -2
- package/marketplace/plugins/stats/package.json +3 -2
- package/package.json +3 -1
- package/public/manifest.webmanifest +1 -1
- package/src/client/components/auth/login-screen/index.tsx +2 -1
- package/src/client/components/common/ComposerPicker.tsx +1 -1
- package/src/client/components/common/FolderPicker.tsx +2 -2
- package/src/client/components/common/Modal.tsx +2 -2
- package/src/client/components/common/PWAInstallButton.tsx +2 -2
- package/src/client/components/common/ViewportSelector.tsx +1 -1
- package/src/client/components/common/anchored-menu/index.tsx +5 -1
- package/src/client/components/common/batch-selection/SelectionCheckbox.tsx +2 -1
- package/src/client/components/common/brand-wordmark/index.test.tsx +13 -2
- package/src/client/components/common/brand-wordmark/index.tsx +13 -2
- package/src/client/components/common/checkbox/style.test.ts +142 -0
- package/src/client/components/common/checkbox/style.ts +51 -0
- package/src/client/components/common/context-usage-button/index.tsx +2 -2
- package/src/client/components/common/file-icon/index.tsx +23 -9
- package/src/client/components/common/header-controls/MoreMenu.tsx +1 -1
- package/src/client/components/common/markdown-review/ReviewPopover.tsx +1 -1
- package/src/client/components/common/panel-mark/index.test.tsx +124 -0
- package/src/client/components/common/panel-mark/index.tsx +105 -0
- package/src/client/components/common/provider-icon/glyphs.test.ts +1 -1
- package/src/client/components/common/provider-icon/index.test.ts +14 -0
- package/src/client/components/common/provider-icon/index.tsx +4 -0
- package/src/client/components/common/provider-icon/resolve.test.ts +8 -7
- package/src/client/components/common/provider-icon/resolve.ts +16 -3
- package/src/client/components/common/session-actions-menu/index.tsx +1 -1
- package/src/client/components/common/toolbar-row/index.tsx +1 -1
- package/src/client/components/layout/ActivityBar.tsx +22 -3
- package/src/client/components/layout/LeftDock.tsx +9 -2
- package/src/client/components/layout/PanelVisibilityMenu.tsx +1 -1
- package/src/client/components/layout/WindowAura.tsx +27 -0
- package/src/client/components/layout/desktop-layout/LeftColumn.tsx +1 -1
- package/src/client/components/layout/desktop-layout/TopNavbar.tsx +2 -2
- package/src/client/components/layout/desktop-layout/WorkspacePanels.tsx +11 -2
- package/src/client/components/layout/desktop-layout/index.tsx +3 -1
- package/src/client/components/layout/session-sidebar/CategoryHeader.tsx +3 -3
- package/src/client/components/layout/session-sidebar/Header.tsx +1 -1
- package/src/client/components/layout/session-sidebar/OverflowMenu.tsx +1 -1
- package/src/client/components/layout/session-sidebar/Toolbar.tsx +1 -1
- package/src/client/components/layout/session-sidebar/about-modal/index.tsx +2 -2
- package/src/client/components/layout/session-sidebar/modern/ActionRow.tsx +1 -1
- package/src/client/components/layout/session-sidebar/modern/WorkspaceHeader.tsx +13 -5
- package/src/client/components/layout/session-sidebar/new-workspace-modal/index.tsx +2 -2
- package/src/client/components/layout/session-sidebar/scheduler-modal/TaskForm.tsx +2 -1
- package/src/client/components/layout/session-sidebar/scheduler-modal/index.tsx +2 -2
- package/src/client/components/mobile/LayoutWrapper.tsx +3 -1
- package/src/client/components/mobile/mobile-main-view/Header.tsx +2 -2
- package/src/client/components/mobile/mobile-session-sidebar/Header.tsx +1 -1
- package/src/client/components/mobile/mobile-session-sidebar/Toolbar.tsx +1 -1
- package/src/client/components/mobile/panel-chips.tsx +10 -2
- package/src/client/components/settings/Modal.tsx +4 -4
- package/src/client/components/settings/ProjectSelectorDropdown.tsx +2 -2
- package/src/client/components/settings/apply-side-effects.test.ts +30 -0
- package/src/client/components/settings/apply-side-effects.ts +14 -0
- package/src/client/components/settings/categories/AppearanceSettings.tsx +6 -0
- package/src/client/components/settings/categories/appearance-settings/EditorBlameSection.tsx +2 -1
- package/src/client/components/settings/categories/appearance-settings/EditorTypingSection.tsx +2 -1
- package/src/client/components/settings/categories/appearance-settings/IconStyleSection.tsx +144 -0
- package/src/client/components/settings/categories/appearance-settings/SurfaceStyleSection.test.tsx +120 -0
- package/src/client/components/settings/categories/appearance-settings/SurfaceStyleSection.tsx +180 -0
- package/src/client/components/settings/categories/mcp-settings/DetailPane.tsx +2 -1
- package/src/client/components/settings/categories/mcp-settings/ImportModal.tsx +2 -2
- package/src/client/components/settings/categories/omp-settings/OrderedChips.tsx +1 -1
- package/src/client/components/settings/categories/panel-plugins/AvailableList.tsx +1 -1
- package/src/client/components/settings/categories/panel-plugins/BuiltinList.tsx +21 -3
- package/src/client/components/settings/categories/panel-plugins/GitFreshness.test.tsx +46 -0
- package/src/client/components/settings/categories/panel-plugins/GitFreshness.tsx +1 -1
- package/src/client/components/settings/categories/panel-plugins/InstalledList.tsx +7 -9
- package/src/client/components/settings/categories/panel-plugins/PluginCard.test.tsx +149 -0
- package/src/client/components/settings/categories/panel-plugins/PluginCard.tsx +34 -7
- package/src/client/components/settings/categories/panel-plugins/PluginMark.test.ts +66 -2
- package/src/client/components/settings/categories/panel-plugins/PluginMark.tsx +47 -10
- package/src/client/components/settings/categories/panel-plugins/Section.tsx +7 -1
- package/src/client/components/settings/categories/panel-plugins/Toolbar.tsx +35 -2
- package/src/client/components/settings/categories/plugin-settings/DetailPane.tsx +2 -1
- package/src/client/components/settings/categories/plugin-settings/SettingsSection.tsx +2 -1
- package/src/client/components/settings/categories/project-settings/ModelDropdown.tsx +1 -1
- package/src/client/components/settings/categories/project-settings/WorktreeSettings.tsx +2 -1
- package/src/client/components/settings/categories/provider-settings/DeleteProviderModal.tsx +2 -2
- package/src/client/components/settings/categories/provider-settings/EntryAdvanced.tsx +3 -2
- package/src/client/components/settings/categories/provider-settings/LogoutProviderModal.tsx +2 -2
- package/src/client/components/settings/categories/skill-catalog/GitImportPanel.tsx +3 -2
- package/src/client/components/settings/categories/skill-settings/DetailHeader.tsx +2 -1
- package/src/client/components/settings/categories/token-usage-settings/Controls.tsx +1 -1
- package/src/client/components/workspace/btw-panel/TopicMenu.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/AiMessageFooter.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/NewChatModal.tsx +3 -3
- package/src/client/components/workspace/chat-timeline/UndoConfirmModal.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/chat-input/AccessDropdown.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/chat-input/GoalModal.tsx +4 -3
- package/src/client/components/workspace/chat-timeline/chat-input/ThinkingLevelDropdown.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/chat-input/WaitingDependencyPicker.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/plan-review/index.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/target-picker/WorkspacePicker.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/target-picker/WorktreePicker.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/extension-dialog/index.tsx +2 -6
- package/src/client/components/workspace/context-panel/CostBreakdownPopover.tsx +1 -1
- package/src/client/components/workspace/diff-panel/index.tsx +2 -2
- package/src/client/components/workspace/editor/PluginRail.tsx +1 -1
- package/src/client/components/workspace/editor/SaveDeletedFileModal.tsx +2 -2
- package/src/client/components/workspace/editor/TabContextMenu.tsx +1 -1
- package/src/client/components/workspace/editor/Tabs.tsx +1 -1
- package/src/client/components/workspace/file-explorer/ContextMenu.tsx +1 -1
- package/src/client/components/workspace/file-explorer/Modals.tsx +10 -10
- package/src/client/components/workspace/file-explorer/RootMenu.tsx +1 -1
- package/src/client/components/workspace/git-panel/BranchToolbar.test.tsx +130 -0
- package/src/client/components/workspace/git-panel/BranchToolbar.tsx +21 -11
- package/src/client/components/workspace/git-panel/CommitBox.tsx +2 -1
- package/src/client/components/workspace/git-panel/Modals.tsx +2 -2
- package/src/client/components/workspace/git-panel/StashSection.tsx +2 -1
- package/src/client/components/workspace/git-panel/branch-modal/DeleteDialog.tsx +2 -1
- package/src/client/components/workspace/git-panel/branch-modal/RenameDialog.tsx +2 -1
- package/src/client/components/workspace/git-panel/commit-modal/index.tsx +2 -2
- package/src/client/components/workspace/git-panel/index.tsx +7 -0
- package/src/client/components/workspace/model-dropdown/Panel.tsx +1 -1
- package/src/client/components/workspace/model-dropdown/SpecsTooltip.tsx +1 -1
- package/src/client/components/workspace/plugin-panel/catalog.tsx +7 -0
- package/src/client/components/workspace/plugin-panel/resolve.tsx +4 -0
- package/src/client/components/workspace/search-panel/Body.tsx +1 -1
- package/src/client/components/workspace/usage-panel/ProviderSelect.tsx +1 -1
- package/src/client/glass-sticky.test.ts +46 -0
- package/src/client/glass.css +795 -0
- package/src/client/glass.test.ts +306 -0
- package/src/client/hooks/ui/glass-support.ts +57 -0
- package/src/client/hooks/ui/icon-style.ts +59 -0
- package/src/client/hooks/ui/stuck-header.test.ts +213 -0
- package/src/client/hooks/ui/stuck-header.ts +122 -0
- package/src/client/hooks/ui/style-attributes.test.ts +120 -0
- package/src/client/hooks/ui/surface-style.ts +56 -0
- package/src/client/hooks/workspace/panel-hues.ts +23 -0
- package/src/client/hooks/workspace/panel-registry.ts +8 -4
- package/src/client/main.tsx +10 -0
- package/src/client/tailwind.css +264 -11
- package/src/server/lib/assets/shell-attributes.server.ts +80 -0
- package/src/server/lib/assets/shell-attributes.test.ts +86 -0
- package/src/server/lib/lifecycle/tls.test.ts +6 -1
- package/src/server/lib/omp/rpc/frame-fold-host.test-util.ts +1 -0
- package/src/server/lib/omp/rpc/frame-fold-signals.test.ts +2 -30
- package/src/server/lib/omp/rpc/frame-fold.test.ts +55 -0
- package/src/server/lib/omp/rpc/frame-fold.ts +4 -0
- package/src/server/lib/omp/rpc/manager.ts +2 -2
- package/src/server/lib/omp/rpc/process-helpers.ts +11 -0
- package/src/server/lib/omp/rpc/process.test.ts +106 -0
- package/src/server/lib/omp/rpc/process.ts +28 -4
- package/src/server/lib/omp/rpc/run-settle.server.ts +12 -0
- package/src/server/lib/omp/rpc/run-settle.test.ts +22 -0
- package/src/server/lib/omp/rpc/session-command-guards.ts +5 -0
- package/src/server/lib/omp/rpc/session-commands.test.ts +9 -1
- package/src/server/lib/omp/rpc/session-commands.ts +11 -0
- package/src/server/lib/omp/rpc/terminal-settle.ts +29 -7
- package/src/server/lib/panels/bundled-catalog.server.ts +1 -0
- package/src/server/lib/panels/git-update.server.test.ts +20 -0
- package/src/server/lib/panels/git-update.server.ts +20 -4
- package/src/server/lib/panels/manifest.test.ts +20 -0
- package/src/server/lib/panels/manifest.ts +12 -0
- package/src/server/lib/panels/scan.server.ts +4 -0
- package/src/server/lib/panels/sync.server.ts +9 -1
- package/src/server/lib/panels/update.server.test.ts +193 -0
- package/src/server/lib/panels/update.server.ts +210 -0
- package/src/server/lib/plugins/server-half.server.ts +42 -0
- package/src/server/lib/queue/delivery-dispatch.server.test.ts +48 -0
- package/src/server/lib/queue/delivery-harness.ts +8 -4
- package/src/server/lib/queue/delivery.server.test.ts +29 -0
- package/src/server/lib/queue/delivery.server.ts +39 -0
- package/src/server/lib/queue/store.server.test.ts +22 -2
- package/src/server/lib/queue/store.server.ts +33 -11
- package/src/server/lib/terminal/attach-replay.test.ts +26 -8
- package/src/server/plugins/ssr.ts +22 -5
- package/src/server/routes/panels/install-route.test.ts +238 -0
- package/src/server/routes/panels/install.ts +36 -64
- package/src/server/routes/panels/panel-routes.test-util.ts +6 -1
- package/src/server/routes/panels/routes.test.ts +1 -118
- package/src/shared/lib/icons/file-brand-color.ts +38 -0
- package/src/shared/lib/icons/icon-paint-css.test.ts +235 -0
- package/src/shared/lib/icons/icon-paint-css.ts +285 -0
- package/src/shared/lib/icons/icon-paint-panel.ts +109 -0
- package/src/shared/lib/icons/icon-tone.ts +166 -0
- package/src/shared/lib/icons/tint-hues.generated.ts +277 -0
- package/src/shared/lib/icons/tint.test.ts +333 -0
- package/src/shared/lib/icons/tint.ts +248 -0
- package/src/shared/lib/models/provider/brand-color.test.ts +116 -0
- package/src/shared/lib/models/provider/brand-color.ts +103 -0
- package/src/shared/lib/omp/rpc/frame.test.ts +65 -0
- package/src/shared/lib/omp/rpc/frame.ts +58 -3
- package/src/shared/lib/panels/update.test.ts +107 -0
- package/src/shared/lib/panels/update.ts +73 -0
- package/src/shared/lib/settings/defaults.ts +4 -0
- package/src/shared/lib/theme/catalog.test.ts +5 -4
- package/src/shared/lib/theme/catalog.ts +18 -3
- package/src/shared/lib/theme/color.ts +50 -0
- package/src/shared/lib/theme/glass-support.test.ts +38 -0
- package/src/shared/lib/theme/glass-support.ts +73 -0
- package/src/shared/lib/theme/icon-style.test.ts +74 -0
- package/src/shared/lib/theme/icon-style.ts +90 -0
- package/src/shared/lib/theme/legibility.ts +91 -0
- package/src/shared/lib/theme/palettes/dark-extended.ts +152 -0
- package/src/shared/lib/theme/palettes/light-extended.ts +157 -0
- package/src/shared/lib/theme/surface-style.test.ts +68 -0
- package/src/shared/lib/theme/surface-style.ts +91 -0
- package/src/shared/lib/theme/theme.test.ts +11 -7
- package/src/shared/lib/workspace/panel-hues.test.ts +68 -0
- package/src/shared/lib/workspace/panel-hues.ts +57 -0
- package/src/shared/types/panels-registry.ts +6 -0
- package/src/shared/types/panels.ts +14 -0
- package/src/shared/types/settings/state.ts +26 -0
- package/src/test-support/fake-omp-frames.ts +163 -0
- package/dist/client/static/js/index-hp75vsv9.css +0 -1
- /package/src/{client/components/common/file-icon/brand-paths.ts → shared/lib/icons/file-brand-paths.ts} +0 -0
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Settings → Appearance → Surfaces.
|
|
8
|
+
*
|
|
9
|
+
* Two cards, each drawn as a MINIATURE of the material rather than an icon: the
|
|
10
|
+
* difference between an opaque panel and a frosted one is the only thing the
|
|
11
|
+
* setting decides, so the card has to show that difference where it happens —
|
|
12
|
+
* a chrome bar over a tinted ground, with the same rows inside.
|
|
13
|
+
*
|
|
14
|
+
* The miniature is built from the SAME tokens the product uses (`--glass-*` and
|
|
15
|
+
* the palette's `text-ink/*`), never from a hex, so a card cannot promise a
|
|
16
|
+
* look the shell does not ship.
|
|
17
|
+
*
|
|
18
|
+
* The cards are `aria-pressed` buttons rather than radios: there is no submit,
|
|
19
|
+
* the choice applies on click, and `applySettingsSideEffects` is what writes the
|
|
20
|
+
* document attribute — this file never touches the DOM itself, so the live
|
|
21
|
+
* apply and the persisted copy cannot disagree.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
import type { ComponentType } from 'preact/compat';
|
|
25
|
+
import type { SettingsState } from '@/shared/types';
|
|
26
|
+
import {
|
|
27
|
+
SURFACE_STYLES,
|
|
28
|
+
SURFACE_STYLE_COPY,
|
|
29
|
+
resolveSurfaceStyle,
|
|
30
|
+
type SurfaceStyle,
|
|
31
|
+
} from '@/shared/lib/theme/surface-style';
|
|
32
|
+
import { GLASS_LIMIT_COPY } from '@/shared/lib/theme/glass-support';
|
|
33
|
+
import { useGlassLimits } from '@/client/hooks/ui/glass-support';
|
|
34
|
+
|
|
35
|
+
interface SurfaceStyleSectionProps {
|
|
36
|
+
settings: SettingsState;
|
|
37
|
+
onUpdate: (updater: Partial<SettingsState> | ((previous: SettingsState) => SettingsState)) => void;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** The rows both miniatures share, so the ONLY difference is the material. */
|
|
41
|
+
function MiniRows() {
|
|
42
|
+
return (
|
|
43
|
+
<span className="flex h-full flex-col gap-1 p-1">
|
|
44
|
+
<span className="flex items-center gap-1">
|
|
45
|
+
<span className="h-[3px] w-[38%] rounded-full bg-ink/40" />
|
|
46
|
+
<span className="ml-auto h-[6px] w-[10%] rounded-[2px] border border-ink/20" />
|
|
47
|
+
</span>
|
|
48
|
+
<span className="h-[2px] w-full rounded-full bg-ink/15" />
|
|
49
|
+
<span className="flex items-center gap-1">
|
|
50
|
+
<span className="h-[3px] w-[52%] rounded-full bg-ink/30" />
|
|
51
|
+
<span className="h-[3px] w-[18%] rounded-full bg-ink/15" />
|
|
52
|
+
</span>
|
|
53
|
+
<span className="flex items-center gap-1">
|
|
54
|
+
<span className="h-[3px] w-[44%] rounded-full bg-ink/30" />
|
|
55
|
+
<span className="h-[3px] w-[22%] rounded-full bg-ink/15" />
|
|
56
|
+
</span>
|
|
57
|
+
</span>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** Opaque panels on the palette canvas. */
|
|
62
|
+
function ClassicMiniature() {
|
|
63
|
+
return (
|
|
64
|
+
<span className="block h-full rounded-md border border-ink/15 bg-paper" aria-hidden="true">
|
|
65
|
+
<span className="block h-[13px] rounded-t-[5px] border-b border-ink/10 bg-paper">
|
|
66
|
+
<span className="mx-1 mt-[4px] block h-[3px] w-[40%] rounded-full bg-ink/35" />
|
|
67
|
+
</span>
|
|
68
|
+
<MiniRows />
|
|
69
|
+
</span>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* One frosted plane over a tinted glow.
|
|
75
|
+
*
|
|
76
|
+
* The glow is drawn INSIDE the card's box on purpose: a full-screen app has no
|
|
77
|
+
* outside for the aura to bleed into, which is why the real plane keeps its
|
|
78
|
+
* blobs under its own edge instead of around it.
|
|
79
|
+
*/
|
|
80
|
+
function GlassMiniature() {
|
|
81
|
+
return (
|
|
82
|
+
<span className="relative block h-full overflow-hidden rounded-md border border-ink/15 bg-canvas" aria-hidden="true">
|
|
83
|
+
<span className="pointer-events-none absolute inset-0">
|
|
84
|
+
<span className="absolute -left-2 top-2 h-[70%] w-[55%] rounded-full bg-info/40 blur-md" />
|
|
85
|
+
<span className="absolute -right-2 -top-2 h-[60%] w-[50%] rounded-full bg-meta/35 blur-md" />
|
|
86
|
+
<span className="absolute -bottom-2 right-3 h-[45%] w-[45%] rounded-full bg-success/30 blur-md" />
|
|
87
|
+
</span>
|
|
88
|
+
<span className="relative block h-[13px] border-b border-ink/10 bg-paper/40">
|
|
89
|
+
<span className="mx-1 mt-[4px] block h-[3px] w-[40%] rounded-full bg-ink/40" />
|
|
90
|
+
</span>
|
|
91
|
+
<span className="relative block h-[calc(100%-13px)] bg-paper/50">
|
|
92
|
+
<MiniRows />
|
|
93
|
+
</span>
|
|
94
|
+
</span>
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const MINIATURES: Record<SurfaceStyle, ComponentType> = {
|
|
99
|
+
classic: ClassicMiniature,
|
|
100
|
+
glass: GlassMiniature,
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Why the frost is missing, when it is.
|
|
105
|
+
*
|
|
106
|
+
* `glass.css` falls back to opaque panels on an engine without `backdrop-filter`
|
|
107
|
+
* and under `prefers-reduced-transparency`, and a CSS fallback cannot say why —
|
|
108
|
+
* so a window that reports `glass` and looks `classic` is indistinguishable from
|
|
109
|
+
* a broken setting. This is the one surface that can name it, in the place the
|
|
110
|
+
* choice was made, and it names every reason that applies.
|
|
111
|
+
*/
|
|
112
|
+
function GlassLimits() {
|
|
113
|
+
const limits = useGlassLimits();
|
|
114
|
+
if (limits.length === 0) return null;
|
|
115
|
+
return (
|
|
116
|
+
<ul className="space-y-1 rounded-lg border border-ink/15 bg-ink/[0.03] p-2.5" aria-live="polite">
|
|
117
|
+
{limits.map((limit) => (
|
|
118
|
+
<li key={limit} className="flex gap-1.5 text-[11px] leading-relaxed text-ink/60">
|
|
119
|
+
<span aria-hidden="true" className="mt-[5px] h-1 w-1 shrink-0 rounded-full bg-ink/40" />
|
|
120
|
+
<span>{GLASS_LIMIT_COPY[limit]}</span>
|
|
121
|
+
</li>
|
|
122
|
+
))}
|
|
123
|
+
</ul>
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export function SurfaceStyleSection({ settings, onUpdate }: SurfaceStyleSectionProps) {
|
|
128
|
+
const selected = resolveSurfaceStyle(settings.surfaceStyle);
|
|
129
|
+
|
|
130
|
+
return (
|
|
131
|
+
<section className="space-y-3">
|
|
132
|
+
<div>
|
|
133
|
+
<h4 className="text-xs font-semibold text-ink">Surfaces</h4>
|
|
134
|
+
<p className="mt-0.5 text-[11px] text-ink/50">
|
|
135
|
+
What the windows are made of. Both styles draw the same panels, rows and dialogs;
|
|
136
|
+
the frost is one blur pass per window, and it follows the palette — there is no
|
|
137
|
+
separate glass colour to tune.
|
|
138
|
+
</p>
|
|
139
|
+
</div>
|
|
140
|
+
|
|
141
|
+
<div className="grid grid-cols-1 gap-2.5 sm:grid-cols-2" role="group" aria-label="Surface style">
|
|
142
|
+
{SURFACE_STYLES.map((style) => {
|
|
143
|
+
const copy = SURFACE_STYLE_COPY[style];
|
|
144
|
+
const isSelected = style === selected;
|
|
145
|
+
const Miniature = MINIATURES[style];
|
|
146
|
+
return (
|
|
147
|
+
<button
|
|
148
|
+
key={style}
|
|
149
|
+
type="button"
|
|
150
|
+
onClick={() => onUpdate({ surfaceStyle: style })}
|
|
151
|
+
aria-pressed={isSelected}
|
|
152
|
+
aria-label={`${copy.label} surfaces — ${copy.description}`}
|
|
153
|
+
className={`flex flex-col gap-2 rounded-xl border p-2.5 text-left transition-colors cursor-pointer ${
|
|
154
|
+
isSelected
|
|
155
|
+
? 'border-ink/40 bg-ink/5'
|
|
156
|
+
: 'border-ink/15 bg-paper hover:border-ink/30 hover:bg-ink/5'
|
|
157
|
+
}`}
|
|
158
|
+
>
|
|
159
|
+
<span className="block h-[78px]">
|
|
160
|
+
<Miniature />
|
|
161
|
+
</span>
|
|
162
|
+
<span className="flex items-center gap-1.5">
|
|
163
|
+
<span className="text-xs font-semibold text-ink">{copy.label}</span>
|
|
164
|
+
<span className="font-mono text-[10px] text-ink/40">{copy.caption}</span>
|
|
165
|
+
{isSelected && (
|
|
166
|
+
<span className="ml-auto rounded-full bg-ink px-1.5 py-[1px] text-[9px] font-semibold text-paper">
|
|
167
|
+
active
|
|
168
|
+
</span>
|
|
169
|
+
)}
|
|
170
|
+
</span>
|
|
171
|
+
<span className="text-[11px] leading-relaxed text-ink/60">{copy.description}</span>
|
|
172
|
+
</button>
|
|
173
|
+
);
|
|
174
|
+
})}
|
|
175
|
+
</div>
|
|
176
|
+
|
|
177
|
+
{selected === 'glass' && <GlassLimits />}
|
|
178
|
+
</section>
|
|
179
|
+
);
|
|
180
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CHECKBOX_CLASS } from '@/client/components/common/checkbox/style';
|
|
1
2
|
import { useEffect, useState } from 'preact/hooks';
|
|
2
3
|
import type { FormEvent, FunctionComponent } from 'preact/compat';
|
|
3
4
|
import { AlertCircle, Check, Code, Globe, Loader2, Save, Terminal, Trash2 } from 'lucide-preact';
|
|
@@ -162,7 +163,7 @@ export const McpDetailPane: FunctionComponent<McpDetailPaneProps> = ({
|
|
|
162
163
|
id="enable-mcp"
|
|
163
164
|
checked={formData.enabled}
|
|
164
165
|
onChange={(e) => setFormData({ ...formData, enabled: e.currentTarget.checked })}
|
|
165
|
-
className=
|
|
166
|
+
className={`${CHECKBOX_CLASS} w-4 h-4 cursor-pointer`}
|
|
166
167
|
/>
|
|
167
168
|
<label htmlFor="enable-mcp" className="text-xs font-medium text-ink cursor-pointer select-none">
|
|
168
169
|
Enable Server
|
|
@@ -110,8 +110,8 @@ export const McpImportModal: FunctionComponent<McpImportModalProps> = ({
|
|
|
110
110
|
};
|
|
111
111
|
|
|
112
112
|
return (
|
|
113
|
-
<div className="fixed inset-0
|
|
114
|
-
<div className="w-full max-w-lg rounded-lg border border-ink/20 bg-paper text-ink p-5 shadow-2xl space-y-4 max-h-full overflow-y-auto scrollbar-overlay-container">
|
|
113
|
+
<div className="fixed inset-0 modal-scrim backdrop-blur-[2px] z-50 flex items-center justify-center p-4 animate-in fade-in duration-150">
|
|
114
|
+
<div className="glass-overlay w-full max-w-lg rounded-lg border border-ink/20 bg-paper text-ink p-5 shadow-2xl space-y-4 max-h-full overflow-y-auto scrollbar-overlay-container">
|
|
115
115
|
<div className="flex items-center justify-between pb-3 border-b border-ink/10">
|
|
116
116
|
<div className="flex items-center gap-2">
|
|
117
117
|
<Code className="w-4 h-4 text-ink/70" />
|
|
@@ -97,7 +97,7 @@ export function OrderedChips({ options, value, saving, onCommit }: OrderedChipsP
|
|
|
97
97
|
<Plus size={10} /> add
|
|
98
98
|
</button>
|
|
99
99
|
{open && remaining.length > 0 && (
|
|
100
|
-
<div className="absolute right-0 top-full z-20 mt-1 max-h-44 w-48 overflow-auto rounded-md border border-ink/15 bg-paper p-1 shadow-lg">
|
|
100
|
+
<div className="glass-popover absolute right-0 top-full z-20 mt-1 max-h-44 w-48 overflow-auto rounded-md border border-ink/15 bg-paper p-1 shadow-lg">
|
|
101
101
|
{remaining.map((option) => (
|
|
102
102
|
<button
|
|
103
103
|
key={option.value}
|
|
@@ -69,7 +69,7 @@ export function AvailableList({ entries, busy, onInstall, onInstallUrl }: Availa
|
|
|
69
69
|
className="flex flex-col gap-2 border border-ink/10 rounded-lg p-3 bg-paper hover:border-ink/20 transition-colors"
|
|
70
70
|
>
|
|
71
71
|
<div className="flex items-start gap-2.5">
|
|
72
|
-
<PluginMark name={entry.name} iconUrl={entry.iconUrl} />
|
|
72
|
+
<PluginMark name={entry.name} iconUrl={entry.iconUrl} color={entry.color} />
|
|
73
73
|
<div className="min-w-0 flex-1">
|
|
74
74
|
<div className="text-xs font-medium text-ink truncate" title={entry.name}>
|
|
75
75
|
{entry.name}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Loader2 } from 'lucide-preact';
|
|
2
2
|
import { BUILTIN_PANELS } from '@/client/components/workspace/panels/builtin';
|
|
3
|
+
import { PanelMark } from '@/client/components/common/panel-mark';
|
|
4
|
+
import { PANEL_MARK_SIZE } from '@/shared/lib/workspace/right-panels';
|
|
3
5
|
|
|
4
6
|
interface BuiltinListProps {
|
|
5
7
|
/** Every panel id switched off — a bare view id, or `plugin:<id>`. */
|
|
@@ -55,9 +57,25 @@ export function BuiltinList({ disabled, busy, onSetEnabled }: BuiltinListProps)
|
|
|
55
57
|
enabled ? 'bg-paper' : 'bg-ink/[0.02]'
|
|
56
58
|
}`}
|
|
57
59
|
>
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
{/* The SAME mark the rail and the phone's chip strip draw, from
|
|
61
|
+
the same hue map: this row used to render the bare glyph and
|
|
62
|
+
therefore took the GLYPH's colour (`lucide-files` → 320°) while
|
|
63
|
+
the rail drew the PANEL's (`files` → 0°).
|
|
64
|
+
|
|
65
|
+
The off state is stated the way the rail states it — the ink
|
|
66
|
+
weight for the monochrome mode, `data-idle` for the colour
|
|
67
|
+
mode, which dims by LUMINANCE and keeps the chroma. `opacity`
|
|
68
|
+
here would have washed the hue out, the exact "kusem" the rail
|
|
69
|
+
stopped doing. */}
|
|
70
|
+
<PanelMark
|
|
71
|
+
className={`flex-shrink-0 ${enabled ? 'text-ink/70' : 'text-ink/30'}`}
|
|
72
|
+
panelId={panel.id}
|
|
73
|
+
builtin
|
|
74
|
+
icon={panel.icon}
|
|
75
|
+
name={panel.title}
|
|
76
|
+
size={PANEL_MARK_SIZE}
|
|
77
|
+
idle={!enabled}
|
|
78
|
+
/>
|
|
61
79
|
<span className="min-w-0 flex-1">
|
|
62
80
|
<span className={`block text-xs truncate ${enabled ? 'text-ink' : 'text-ink/45'}`} title={panel.title}>
|
|
63
81
|
{panel.title}
|
|
@@ -131,6 +131,8 @@ describe('PluginToolbar', () => {
|
|
|
131
131
|
gitCount: 1,
|
|
132
132
|
onSetAutoUpdate: async () => true,
|
|
133
133
|
onCheckUpdates: async () => true,
|
|
134
|
+
updateCount: 0,
|
|
135
|
+
onUpdateAll: async () => true,
|
|
134
136
|
onRefresh: () => {},
|
|
135
137
|
}),
|
|
136
138
|
);
|
|
@@ -146,6 +148,8 @@ describe('PluginToolbar', () => {
|
|
|
146
148
|
gitCount: 1,
|
|
147
149
|
onSetAutoUpdate: async () => true,
|
|
148
150
|
onCheckUpdates: async () => true,
|
|
151
|
+
updateCount: 0,
|
|
152
|
+
onUpdateAll: async () => true,
|
|
149
153
|
onRefresh: () => {},
|
|
150
154
|
}),
|
|
151
155
|
);
|
|
@@ -162,6 +166,8 @@ describe('PluginToolbar', () => {
|
|
|
162
166
|
gitCount: 0,
|
|
163
167
|
onSetAutoUpdate: async () => true,
|
|
164
168
|
onCheckUpdates: async () => true,
|
|
169
|
+
updateCount: 0,
|
|
170
|
+
onUpdateAll: async () => true,
|
|
165
171
|
onRefresh: () => {},
|
|
166
172
|
}),
|
|
167
173
|
);
|
|
@@ -170,6 +176,46 @@ describe('PluginToolbar', () => {
|
|
|
170
176
|
expect(check?.hasAttribute('disabled')).toBe(true);
|
|
171
177
|
expect(check?.getAttribute('title')).toContain('No git-installed plugins');
|
|
172
178
|
});
|
|
179
|
+
|
|
180
|
+
test('Update all is disabled with nothing to apply and counts what it would', () => {
|
|
181
|
+
const none = mount(
|
|
182
|
+
h(PluginToolbar, {
|
|
183
|
+
autoUpdate: false,
|
|
184
|
+
busy: null,
|
|
185
|
+
gitCount: 1,
|
|
186
|
+
onSetAutoUpdate: async () => true,
|
|
187
|
+
onCheckUpdates: async () => true,
|
|
188
|
+
updateCount: 0,
|
|
189
|
+
onUpdateAll: async () => true,
|
|
190
|
+
onRefresh: () => {},
|
|
191
|
+
}),
|
|
192
|
+
);
|
|
193
|
+
const idle = Array.from(none.querySelectorAll('button')).find((button) =>
|
|
194
|
+
button.textContent?.includes('Update all'),
|
|
195
|
+
);
|
|
196
|
+
expect(idle?.hasAttribute('disabled')).toBe(true);
|
|
197
|
+
expect(idle?.textContent).toBe('Update all');
|
|
198
|
+
|
|
199
|
+
render(null, container);
|
|
200
|
+
const waiting = mount(
|
|
201
|
+
h(PluginToolbar, {
|
|
202
|
+
autoUpdate: false,
|
|
203
|
+
busy: null,
|
|
204
|
+
gitCount: 1,
|
|
205
|
+
onSetAutoUpdate: async () => true,
|
|
206
|
+
onCheckUpdates: async () => true,
|
|
207
|
+
updateCount: 2,
|
|
208
|
+
onUpdateAll: async () => true,
|
|
209
|
+
onRefresh: () => {},
|
|
210
|
+
}),
|
|
211
|
+
);
|
|
212
|
+
const ready = Array.from(waiting.querySelectorAll('button')).find((button) =>
|
|
213
|
+
button.textContent?.includes('Update all'),
|
|
214
|
+
);
|
|
215
|
+
expect(ready?.hasAttribute('disabled')).toBe(false);
|
|
216
|
+
// The count is on the button, so one press says how much it will move.
|
|
217
|
+
expect(ready?.textContent).toBe('Update all (2)');
|
|
218
|
+
});
|
|
173
219
|
});
|
|
174
220
|
|
|
175
221
|
describe('SyncBlockedNotice', () => {
|
|
@@ -42,7 +42,7 @@ function shortSha(sha: string | null): string {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
export function GitFreshness({ status, origin, busy, pluginId, onUpdate, latestVersion }: GitFreshnessProps) {
|
|
45
|
-
const updating = busy === `
|
|
45
|
+
const updating = busy === `update:${pluginId}`;
|
|
46
46
|
|
|
47
47
|
if (!status) {
|
|
48
48
|
return (
|
|
@@ -3,7 +3,7 @@ import type { PanelGitStatus, PanelPluginStatus } from '@/shared/types';
|
|
|
3
3
|
import { PluginCard } from '@/client/components/settings/categories/panel-plugins/PluginCard';
|
|
4
4
|
import { PluginReadmeModal } from '@/client/components/settings/categories/panel-plugins/ReadmeModal';
|
|
5
5
|
import type { PluginSlots } from '@/client/lib/plugins/slots';
|
|
6
|
-
import {
|
|
6
|
+
import { countPluginUpdates } from '@/shared/lib/panels/update';
|
|
7
7
|
import type { LeftDockHandle } from '@/client/hooks/workspace/left-dock';
|
|
8
8
|
|
|
9
9
|
interface InstalledGridProps {
|
|
@@ -24,7 +24,7 @@ interface InstalledGridProps {
|
|
|
24
24
|
onSetEnabled: (pluginId: string, enabled: boolean) => Promise<boolean>;
|
|
25
25
|
/** The last known freshness of each git-installed plugin. */
|
|
26
26
|
gitStatus: Record<string, PanelGitStatus>;
|
|
27
|
-
|
|
27
|
+
onUpdate: (pluginId: string) => Promise<boolean>;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
/**
|
|
@@ -52,15 +52,13 @@ export function InstalledList({
|
|
|
52
52
|
onRemove,
|
|
53
53
|
onSetEnabled,
|
|
54
54
|
gitStatus,
|
|
55
|
-
|
|
55
|
+
onUpdate,
|
|
56
56
|
}: InstalledGridProps) {
|
|
57
57
|
const [reading, setReading] = useState<PanelPluginStatus | null>(null);
|
|
58
58
|
const enabledCount = plugins.filter((plugin) => plugin.enabled).length;
|
|
59
|
-
//
|
|
60
|
-
//
|
|
61
|
-
const updates = plugins
|
|
62
|
-
(plugin) => plugin.latestVersion !== undefined && isNewer(plugin.latestVersion, plugin.version),
|
|
63
|
-
).length;
|
|
59
|
+
// The SAME predicate the cards and the Update-all button use, so the header
|
|
60
|
+
// cannot announce a count no button would act on.
|
|
61
|
+
const updates = countPluginUpdates(plugins, gitStatus);
|
|
64
62
|
|
|
65
63
|
return (
|
|
66
64
|
<section>
|
|
@@ -92,7 +90,7 @@ export function InstalledList({
|
|
|
92
90
|
onBuild={onBuild}
|
|
93
91
|
onRemove={onRemove}
|
|
94
92
|
onSetEnabled={onSetEnabled}
|
|
95
|
-
|
|
93
|
+
onUpdate={onUpdate}
|
|
96
94
|
/>
|
|
97
95
|
))}
|
|
98
96
|
</div>
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The Update button on an INSTALLED plugin card.
|
|
8
|
+
*
|
|
9
|
+
* One button for two sources, and the card is where the difference shows: a git
|
|
10
|
+
* clone's Update sits in its freshness row beside the commit pair it would move,
|
|
11
|
+
* while a bundled install's sits in the footer because the store has no commit to
|
|
12
|
+
* show. A card that rendered neither — the reported shape before this change —
|
|
13
|
+
* left a plugin with a pending update and no way to apply it.
|
|
14
|
+
*
|
|
15
|
+
* The negative cases are the load-bearing ones: a current plugin, an unknown one
|
|
16
|
+
* and a local directory must offer NO button, because a button that does nothing
|
|
17
|
+
* is worse than none.
|
|
18
|
+
*
|
|
19
|
+
* Rendered with `h()` against happy-dom, following the panel suites.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
import { afterAll, afterEach, beforeAll, describe, expect, test } from 'bun:test';
|
|
23
|
+
import { Window } from 'happy-dom';
|
|
24
|
+
import { h, render } from 'preact';
|
|
25
|
+
import { act } from 'preact/test-utils';
|
|
26
|
+
import { PluginCard } from '@/client/components/settings/categories/panel-plugins/PluginCard';
|
|
27
|
+
import type { LeftDockHandle } from '@/client/hooks/workspace/left-dock';
|
|
28
|
+
import type { PanelGitStatus, PanelPluginStatus } from '@/shared/types';
|
|
29
|
+
import { installDomGlobals, restoreDomGlobals } from '@/test-support/pristine-globals';
|
|
30
|
+
|
|
31
|
+
let container: HTMLElement;
|
|
32
|
+
|
|
33
|
+
beforeAll(() => {
|
|
34
|
+
installDomGlobals(new Window({ url: 'http://localhost' }));
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
afterEach(() => {
|
|
38
|
+
if (container) render(null, container);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
afterAll(() => {
|
|
42
|
+
restoreDomGlobals();
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
function mount(node: h.JSX.Element): HTMLElement {
|
|
46
|
+
container = document.createElement('div');
|
|
47
|
+
document.body.append(container);
|
|
48
|
+
act(() => render(node, container));
|
|
49
|
+
return container;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** Only a real shape matters here: the card reads it for placement chips. */
|
|
53
|
+
const DOCK = {
|
|
54
|
+
enabled: false,
|
|
55
|
+
panels: [],
|
|
56
|
+
setEnabled: () => {},
|
|
57
|
+
setSide: () => {},
|
|
58
|
+
widthOf: () => 320,
|
|
59
|
+
commitWidth: () => {},
|
|
60
|
+
} satisfies LeftDockHandle;
|
|
61
|
+
|
|
62
|
+
const BASE: PanelPluginStatus = {
|
|
63
|
+
pluginId: 'demo',
|
|
64
|
+
name: 'Demo',
|
|
65
|
+
version: '1.0.0',
|
|
66
|
+
built: true,
|
|
67
|
+
isPackage: true,
|
|
68
|
+
enabled: true,
|
|
69
|
+
bundled: true,
|
|
70
|
+
origin: 'bundled',
|
|
71
|
+
gitOrigin: null,
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const GIT_STATUS: PanelGitStatus = {
|
|
75
|
+
current: 'aaaaaaa',
|
|
76
|
+
latest: 'bbbbbbb',
|
|
77
|
+
updateAvailable: true,
|
|
78
|
+
checkedAt: Date.now(),
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
function card(plugin: PanelPluginStatus, gitStatus: PanelGitStatus | undefined, onUpdate = async () => true) {
|
|
82
|
+
return mount(
|
|
83
|
+
h(PluginCard, {
|
|
84
|
+
plugin,
|
|
85
|
+
entry: undefined,
|
|
86
|
+
failure: undefined,
|
|
87
|
+
iconUrl: undefined,
|
|
88
|
+
readmeUrl: undefined,
|
|
89
|
+
busy: null,
|
|
90
|
+
gitStatus,
|
|
91
|
+
dock: DOCK,
|
|
92
|
+
onReadme: () => {},
|
|
93
|
+
onBuild: async () => true,
|
|
94
|
+
onRemove: async () => true,
|
|
95
|
+
onSetEnabled: async () => true,
|
|
96
|
+
onUpdate,
|
|
97
|
+
}),
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** Every button whose label is exactly Update (the freshness row's and the footer's). */
|
|
102
|
+
function updateButtons(el: HTMLElement): HTMLButtonElement[] {
|
|
103
|
+
return Array.from(el.querySelectorAll('button')).filter((button) => button.textContent?.trim() === 'Update');
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
describe('a bundled install with an update', () => {
|
|
107
|
+
test('offers Update in the footer, and says what it would apply', () => {
|
|
108
|
+
const el = card({ ...BASE, latestVersion: '1.1.0' }, undefined);
|
|
109
|
+
const buttons = updateButtons(el);
|
|
110
|
+
expect(buttons).toHaveLength(1);
|
|
111
|
+
expect(buttons[0].getAttribute('title')).toContain('v1.1.0');
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
test('does not offer one when the store ships the same version', () => {
|
|
115
|
+
expect(updateButtons(card({ ...BASE, latestVersion: '1.0.0' }, undefined))).toHaveLength(0);
|
|
116
|
+
expect(updateButtons(card(BASE, undefined))).toHaveLength(0);
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
describe('a git clone', () => {
|
|
121
|
+
test('offers Update in its freshness row, and none in the footer', () => {
|
|
122
|
+
const el = card(
|
|
123
|
+
{ ...BASE, bundled: false, origin: 'git', gitOrigin: 'https://x/y.git' },
|
|
124
|
+
GIT_STATUS,
|
|
125
|
+
);
|
|
126
|
+
const buttons = updateButtons(el);
|
|
127
|
+
expect(buttons).toHaveLength(1);
|
|
128
|
+
// The row's own button names the origin it would fetch from.
|
|
129
|
+
expect(buttons[0].getAttribute('title')).toContain('https://x/y.git');
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
test('offers none when the probe found nothing to fetch', () => {
|
|
133
|
+
const el = card(
|
|
134
|
+
{ ...BASE, bundled: false, origin: 'git', gitOrigin: 'https://x/y.git' },
|
|
135
|
+
{ ...GIT_STATUS, updateAvailable: false, latest: 'aaaaaaa' },
|
|
136
|
+
);
|
|
137
|
+
expect(updateButtons(el)).toHaveLength(0);
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
describe('a local directory', () => {
|
|
142
|
+
test('never offers Update, even with a newer version beside it', () => {
|
|
143
|
+
const el = card(
|
|
144
|
+
{ ...BASE, bundled: false, origin: 'local', gitOrigin: null, latestVersion: '2.0.0' },
|
|
145
|
+
GIT_STATUS,
|
|
146
|
+
);
|
|
147
|
+
expect(updateButtons(el)).toHaveLength(0);
|
|
148
|
+
});
|
|
149
|
+
});
|
|
@@ -24,8 +24,9 @@
|
|
|
24
24
|
* now share the version, author, origin and slot pieces in `Meta.tsx`.
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
|
-
import { Hammer, Loader2, BookOpen } from 'lucide-preact';
|
|
27
|
+
import { ArrowDownToLine, Hammer, Loader2, BookOpen } from 'lucide-preact';
|
|
28
28
|
import type { PanelGitStatus, PanelPluginStatus } from '@/shared/types';
|
|
29
|
+
import { pluginUpdate } from '@/shared/lib/panels/update';
|
|
29
30
|
import { PluginMark } from '@/client/components/settings/categories/panel-plugins/PluginMark';
|
|
30
31
|
import { RemovePluginButton } from '@/client/components/settings/categories/panel-plugins/InstallForm';
|
|
31
32
|
import { GitFreshness } from '@/client/components/settings/categories/panel-plugins/GitFreshness';
|
|
@@ -61,7 +62,7 @@ interface PluginCardProps {
|
|
|
61
62
|
onBuild: (pluginId: string) => Promise<boolean>;
|
|
62
63
|
onRemove: (pluginId: string) => Promise<boolean>;
|
|
63
64
|
onSetEnabled: (pluginId: string, enabled: boolean) => Promise<boolean>;
|
|
64
|
-
|
|
65
|
+
onUpdate: (pluginId: string) => Promise<boolean>;
|
|
65
66
|
}
|
|
66
67
|
|
|
67
68
|
export function PluginCard({
|
|
@@ -77,7 +78,7 @@ export function PluginCard({
|
|
|
77
78
|
onBuild,
|
|
78
79
|
onRemove,
|
|
79
80
|
onSetEnabled,
|
|
80
|
-
|
|
81
|
+
onUpdate,
|
|
81
82
|
}: PluginCardProps) {
|
|
82
83
|
// The ENABLEMENT key is the panel key, not the plugin id: it is the id the
|
|
83
84
|
// client filters its panel catalog by, so a switch that wrote the bare id
|
|
@@ -86,6 +87,9 @@ export function PluginCard({
|
|
|
86
87
|
const toggling = busy === `enable:${panelKey}` || busy === `disable:${panelKey}`;
|
|
87
88
|
const contributions = usePluginContributions(plugin.pluginId);
|
|
88
89
|
const badges = contributionBadges(contributions, plugin.slots);
|
|
90
|
+
// One answer for both surfaces: a clone's Update lives in its freshness row,
|
|
91
|
+
// a bundled install's in the footer, and both ask this.
|
|
92
|
+
const pending = pluginUpdate(plugin, gitStatus);
|
|
89
93
|
|
|
90
94
|
return (
|
|
91
95
|
<article
|
|
@@ -95,7 +99,7 @@ export function PluginCard({
|
|
|
95
99
|
>
|
|
96
100
|
<header className="flex items-start gap-2.5">
|
|
97
101
|
<div className={plugin.enabled ? '' : 'opacity-50'}>
|
|
98
|
-
<PluginMark name={plugin.name} iconUrl={iconUrl} />
|
|
102
|
+
<PluginMark name={plugin.name} iconUrl={iconUrl} color={plugin.color} />
|
|
99
103
|
</div>
|
|
100
104
|
<div className="min-w-0 flex-1">
|
|
101
105
|
<div className="flex items-center gap-1.5 min-w-0">
|
|
@@ -211,14 +215,15 @@ export function PluginCard({
|
|
|
211
215
|
|
|
212
216
|
{/* A git-installed plugin's freshness. Rendered for a clone only — a
|
|
213
217
|
bundled install is kept current by Kabmo's own update, so a git row
|
|
214
|
-
there would describe a remote it does not have.
|
|
218
|
+
there would describe a remote it does not have. A clone's Update sits
|
|
219
|
+
INSIDE this row, beside the commit pair it would move. */}
|
|
215
220
|
{plugin.gitOrigin ? (
|
|
216
221
|
<GitFreshness
|
|
217
222
|
status={gitStatus}
|
|
218
223
|
origin={plugin.gitOrigin}
|
|
219
224
|
busy={busy}
|
|
220
225
|
pluginId={plugin.pluginId}
|
|
221
|
-
onUpdate={
|
|
226
|
+
onUpdate={onUpdate}
|
|
222
227
|
latestVersion={plugin.latestVersion}
|
|
223
228
|
/>
|
|
224
229
|
) : null}
|
|
@@ -240,7 +245,29 @@ export function PluginCard({
|
|
|
240
245
|
Rebuild
|
|
241
246
|
</button>
|
|
242
247
|
) : null}
|
|
243
|
-
{
|
|
248
|
+
{/* A BUNDLED install's Update, in the footer rather than a freshness row:
|
|
249
|
+
its source is the store, which has no commit to show. A clone's update
|
|
250
|
+
is the one above, so this would be a second button for one action. */}
|
|
251
|
+
{pending && !plugin.gitOrigin ? (
|
|
252
|
+
<button
|
|
253
|
+
type="button"
|
|
254
|
+
onClick={() => void onUpdate(plugin.pluginId)}
|
|
255
|
+
disabled={busy !== null}
|
|
256
|
+
title={
|
|
257
|
+
pending.version
|
|
258
|
+
? `Apply the store's copy of v${pending.version} — your edited files are left untouched, and the update is refused if they conflict`
|
|
259
|
+
: "Apply the store's copy — your edited files are left untouched, and the update is refused if they conflict"
|
|
260
|
+
}
|
|
261
|
+
className="flex items-center gap-1 px-1.5 py-0.5 text-[10px] rounded border border-warning/50 text-warning hover:bg-warning/10 disabled:opacity-40"
|
|
262
|
+
>
|
|
263
|
+
{busy === `update:${plugin.pluginId}` ? (
|
|
264
|
+
<Loader2 size={11} className="animate-spin" />
|
|
265
|
+
) : (
|
|
266
|
+
<ArrowDownToLine size={11} />
|
|
267
|
+
)}
|
|
268
|
+
Update
|
|
269
|
+
</button>
|
|
270
|
+
) : null}
|
|
244
271
|
<span className="ml-auto flex items-center gap-1">
|
|
245
272
|
{readmeUrl ? (
|
|
246
273
|
<button
|